강석 최 2022-10-25 17:49:29 +09:00
commit 573e69c8f3
13 changed files with 791 additions and 293 deletions

View File

@ -234,10 +234,15 @@ public class AffairController { // 첩보수집활동 > 외사경찰 견문관
@GetMapping("/statistics") @GetMapping("/statistics")
public ModelAndView statistics(@AuthenticationPrincipal UserInfo loginUser, TypeStatistics typeStatistics){ public ModelAndView statistics(@AuthenticationPrincipal UserInfo loginUser, TypeStatistics typeStatistics){
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/affair/affairStatistics"); ModelAndView mav = new ModelAndView("igActivities/fpiMgt/affair/affairStatistics");
List<TypeStatistics> type1 = affairService.selectType1List(typeStatistics); mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
List<TypeStatistics> type2 = affairService.selectType2List(typeStatistics); mav.addObject("searchParams", typeStatistics);
List<TypeStatistics> type3 = affairService.selectType3List(typeStatistics);
List<TypeStatistics> type4 = affairService.selectType4List(typeStatistics); return mav;
}
@PostMapping("/fieldStatistics")
public ModelAndView fieldStatistics(@AuthenticationPrincipal UserInfo loginUser, TypeStatistics typeStatistics){
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/affair/fieldStatistics");
List<TypeStatistics> totalList = affairService.selectStatusTotal(typeStatistics); List<TypeStatistics> totalList = affairService.selectStatusTotal(typeStatistics);
List<TypeStatistics> type1List = affairService.selecType1ListCnt(typeStatistics); List<TypeStatistics> type1List = affairService.selecType1ListCnt(typeStatistics);
List<TypeStatistics> type2List = affairService.selecType2ListCnt(typeStatistics); List<TypeStatistics> type2List = affairService.selecType2ListCnt(typeStatistics);
@ -254,30 +259,47 @@ public class AffairController { // 첩보수집활동 > 외사경찰 견문관
totalList.add(total); totalList.add(total);
} }
mav.addObject("totalList", totalList); mav.addObject("totalList", totalList);
type1List = addTotalRow(type1, type1List); type1List = addTotalRow(typeStatistics.getCategory1(), type1List);
type2List = addTotalRow(type2, type2List); type2List = addTotalRow(typeStatistics.getCategory2(), type2List);
type3List = addTotalRow(type3, type3List); type3List = addTotalRow(typeStatistics.getCategory3(), type3List);
type4List = addTotalRow(type4, type4List); type4List = addTotalRow(typeStatistics.getCategory4(), type4List);
mav.addObject("type1", type1);
mav.addObject("type2", type2);
mav.addObject("type3", type3);
mav.addObject("type4", type4);
mav.addObject("type1List", type1List); mav.addObject("type1List", type1List);
mav.addObject("type2List", type2List); mav.addObject("type2List", type2List);
mav.addObject("type3List", type3List); mav.addObject("type3List", type3List);
mav.addObject("type4List", type4List); mav.addObject("type4List", type4List);
mav.addObject("searchParams", typeStatistics); mav.addObject("searchParams", typeStatistics);
//메뉴권한 확인
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/translator/info").get(0).getAccessAuth();
mav.addObject("accessAuth", accessAuth);
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
return mav; return mav;
} }
private List<TypeStatistics> addTotalRow(List<TypeStatistics> type, List<TypeStatistics> typeList){ @PostMapping("/ratingStatistics")
public ModelAndView ratingStatistics(@AuthenticationPrincipal UserInfo loginUser, TypeStatistics typeStatistics){
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/affair/ratingStatistics");
List<TypeStatistics> totalList = affairService.selectRatingStatusTotal(typeStatistics);
List<TypeStatistics> sangboCntList = affairService.selectSangboTotal(typeStatistics);
List<TypeStatistics> arrCntList = affairService.selectArrCntList(typeStatistics);
if(!totalList.isEmpty()) {
TypeStatistics total = new TypeStatistics();
total.setItemValue("누계");
total.setWrtOrgan("total");
total.setCnt(0);
for(TypeStatistics stat: totalList) {
total.setCnt(total.getCnt()+stat.getCnt());
}
totalList.add(total);
}
sangboCntList = addTotalRow(typeStatistics.getSangbo(), sangboCntList);
arrCntList = addTotalRow(typeStatistics.getRating(), arrCntList);
mav.addObject("totalList", totalList);
mav.addObject("sangboList", sangboCntList);
mav.addObject("arrCntList", arrCntList);
mav.addObject("searchParams", typeStatistics);
return mav;
}
private List<TypeStatistics> addTotalRow(List<String> type, List<TypeStatistics> typeList){
Map<String, Integer> totalMap = new HashMap<>(); Map<String, Integer> totalMap = new HashMap<>();
for(TypeStatistics t: type) { for(String t: type) {
totalMap.put(t.getAffairType(), 0); totalMap.put(t, 0);
} }
for(TypeStatistics t: typeList) { for(TypeStatistics t: typeList) {
totalMap.put(t.getAffairType(), totalMap.get(t.getAffairType())+t.getCnt()); totalMap.put(t.getAffairType(), totalMap.get(t.getAffairType())+t.getCnt());
@ -292,8 +314,8 @@ public class AffairController { // 첩보수집활동 > 외사경찰 견문관
total.setCnt(cnt); total.setCnt(cnt);
typeList.add(total); typeList.add(total);
} }
return typeList; return typeList;
} }
} }

View File

@ -16,13 +16,6 @@ public interface AffairMapper {
String selectHashTags(Integer affairKey); String selectHashTags(Integer affairKey);
List<TypeStatistics> selectType1List(TypeStatistics typeStatistics);
List<TypeStatistics> selectType2List(TypeStatistics typeStatistics);
List<TypeStatistics> selectType3List(TypeStatistics typeStatistics);
List<TypeStatistics> selectType4List(TypeStatistics typeStatistics);
List<TypeStatistics> selectStatusTotal(TypeStatistics typeStatistics); List<TypeStatistics> selectStatusTotal(TypeStatistics typeStatistics);
@ -33,4 +26,10 @@ public interface AffairMapper {
List<TypeStatistics> selecType3ListCnt(TypeStatistics typeStatistics); List<TypeStatistics> selecType3ListCnt(TypeStatistics typeStatistics);
List<TypeStatistics> selecType4ListCnt(TypeStatistics typeStatistics); List<TypeStatistics> selecType4ListCnt(TypeStatistics typeStatistics);
List<TypeStatistics> selectRatingStatusTotal(TypeStatistics typeStatistics);
List<TypeStatistics> selectSangboTotal(TypeStatistics typeStatistics);
List<TypeStatistics> selectArrCntList(TypeStatistics typeStatistics);
} }

View File

@ -24,6 +24,10 @@ public class TypeStatistics extends BaseModel {
@Transient @Transient
private Integer cnt; private Integer cnt;
@Transient @Transient
private String userNm;
@Transient
private List<String> rating;
@Transient
private List<String> category1; private List<String> category1;
@Transient @Transient
private List<String> category2; private List<String> category2;
@ -33,11 +37,18 @@ public class TypeStatistics extends BaseModel {
private List<String> category4; private List<String> category4;
@Transient @Transient
private List<String> organList; private List<String> organList;
@Transient
private List<String> sangbo;
@Override @Override
public String toString() { public String toString() {
return "TypeStatistics [wrtOrgan=" + wrtOrgan + ", itemValue=" + itemValue + ", affairType=" + affairType + ", cnt=" return "TypeStatistics [wrtOrgan=" + wrtOrgan + ", itemValue=" + itemValue + ", affairType=" + affairType + ", cnt="
+ cnt + ", category1=" + category1 + "]"; + cnt + ", rating=" + rating + ", category1=" + category1 + ", category2=" + category2 + ", category3="
+ category3 + ", category4=" + category4 + ", organList=" + organList + "]";
} }
} }

View File

@ -148,22 +148,6 @@ public class AffairService extends BaseService { // 견문보고
return affairFileRepository.findById(new AffairFile.AffairFileId(parentKey, fileSeq)).orElse(null); return affairFileRepository.findById(new AffairFile.AffairFileId(parentKey, fileSeq)).orElse(null);
} }
public List<TypeStatistics> selectType1List(TypeStatistics typeStatistics) {
return affairMapper.selectType1List(typeStatistics);
}
public List<TypeStatistics> selectType2List(TypeStatistics typeStatistics) {
return affairMapper.selectType2List(typeStatistics);
}
public List<TypeStatistics> selectType3List(TypeStatistics typeStatistics) {
return affairMapper.selectType3List(typeStatistics);
}
public List<TypeStatistics> selectType4List(TypeStatistics typeStatistics) {
return affairMapper.selectType4List(typeStatistics);
}
public List<TypeStatistics> selectStatusTotal(TypeStatistics typeStatistics) { public List<TypeStatistics> selectStatusTotal(TypeStatistics typeStatistics) {
return affairMapper.selectStatusTotal(typeStatistics); return affairMapper.selectStatusTotal(typeStatistics);
} }
@ -183,4 +167,13 @@ public class AffairService extends BaseService { // 견문보고
public List<TypeStatistics> selecType4ListCnt(TypeStatistics typeStatistics) { public List<TypeStatistics> selecType4ListCnt(TypeStatistics typeStatistics) {
return affairMapper.selecType4ListCnt(typeStatistics); return affairMapper.selecType4ListCnt(typeStatistics);
} }
public List<TypeStatistics> selectRatingStatusTotal(TypeStatistics typeStatistics) {
return affairMapper.selectRatingStatusTotal(typeStatistics);
}
public List<TypeStatistics> selectSangboTotal(TypeStatistics typeStatistics) {
return affairMapper.selectSangboTotal(typeStatistics);
}
public List<TypeStatistics> selectArrCntList(TypeStatistics typeStatistics) {
return affairMapper.selectArrCntList(typeStatistics);
}
} }

View File

@ -115,11 +115,42 @@
where a.affair_key = #{affairKey} where a.affair_key = #{affairKey}
</select> </select>
<select id="selectType1List" resultType="TypeStatistics" parameterType="TypeStatistics"> <sql id="searchStatistics">
select item_cd as affairType, <if test='userNm != null and userNm != ""'>
item_value and wrt_user_nm like '%'||#{userNm}||'%'
from code_mgt </if>
where category_cd = 'DC01' <if test='startDate != null and startDate != ""'>
and wrt_dt >= #{startDate}::date
</if>
<if test='endDate != null and endDate != ""'>
and wrt_dt &lt;= #{endDate}::date+1
</if>
<if test='rating != null and rating != "" or sangbo != null and sangbo != ""'>
and affair_key in (
select affair_key
from affair_rating aa
inner join organ_config ab
on aa.rating_organ = ab.organ_cd
<where>
<if test='rating != null and rating != ""'>
and aa.affair_rate in
<foreach collection="rating" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='sangbo != null and sangbo != ""'>
and aa.organ_up = 'T'
and ab.organ_type in
<foreach collection="sangbo" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
)
</if>
</sql>
<sql id="statisticsCategory1">
<choose> <choose>
<when test='category1 != null and category1 != ""'> <when test='category1 != null and category1 != ""'>
and item_cd in and item_cd in
@ -131,14 +162,9 @@
and item_cd not in (select item_cd from code_mgt where category_cd = 'DC01') and item_cd not in (select item_cd from code_mgt where category_cd = 'DC01')
</otherwise> </otherwise>
</choose> </choose>
order by affairType asc </sql>
</select>
<select id="selectType2List" resultType="TypeStatistics" parameterType="TypeStatistics"> <sql id="statisticsCategory2">
select item_cd as affairType,
item_value
from code_mgt
where category_cd = 'DC02'
<choose> <choose>
<when test='category2 != null and category2 != ""'> <when test='category2 != null and category2 != ""'>
and item_cd in and item_cd in
@ -150,14 +176,9 @@
and item_cd not in (select item_cd from code_mgt where category_cd = 'DC02') and item_cd not in (select item_cd from code_mgt where category_cd = 'DC02')
</otherwise> </otherwise>
</choose> </choose>
order by affairType asc </sql>
</select>
<select id="selectType3List" resultType="TypeStatistics" parameterType="TypeStatistics"> <sql id="statisticsCategory3">
select item_cd as affairType,
item_value
from code_mgt
where category_cd = 'DC03'
<choose> <choose>
<when test='category3 != null and category3 != ""'> <when test='category3 != null and category3 != ""'>
and item_cd in and item_cd in
@ -169,14 +190,9 @@
and item_cd not in (select item_cd from code_mgt where category_cd = 'DC03') and item_cd not in (select item_cd from code_mgt where category_cd = 'DC03')
</otherwise> </otherwise>
</choose> </choose>
order by affairType asc </sql>
</select>
<select id="selectType4List" resultType="TypeStatistics" parameterType="TypeStatistics"> <sql id="statisticsCategory4">
select item_cd as affairType,
item_value
from code_mgt
where category_cd = 'DC04'
<choose> <choose>
<when test='category4 != null and category4 != ""'> <when test='category4 != null and category4 != ""'>
and item_cd in and item_cd in
@ -188,8 +204,7 @@
and item_cd not in (select item_cd from code_mgt where category_cd = 'DC04') and item_cd not in (select item_cd from code_mgt where category_cd = 'DC04')
</otherwise> </otherwise>
</choose> </choose>
order by affairType asc </sql>
</select>
<select id="selectStatusTotal" resultType="TypeStatistics" parameterType="TypeStatistics"> <select id="selectStatusTotal" resultType="TypeStatistics" parameterType="TypeStatistics">
select item_cd as wrt_organ, select item_cd as wrt_organ,
@ -217,26 +232,58 @@
count(*) as cnt count(*) as cnt
from affair_board from affair_board
<trim prefix="WHERE" prefixOverrides="AND |OR "> <trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test='userNm != null and userNm != ""'>
and wrt_user_nm like '%'||#{userNm}||'%'
</if>
<if test='startDate != null and startDate != ""'>
and wrt_dt >= #{startDate}::date
</if>
<if test='endDate != null and endDate != ""'>
and wrt_dt &lt;= #{endDate}::date+1
</if>
<if test='rating != null and rating != "" or sangbo != null and sangbo != ""'>
and affair_key in (
select affair_key
from affair_rating aa
inner join organ_config ab
on aa.rating_organ = ab.organ_cd
<where>
<if test='rating != null and rating != ""'>
and aa.affair_rate in
<foreach collection="rating" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='sangbo != null and sangbo != ""'>
and aa.organ_up = 'T'
and ab.organ_type in
<foreach collection="sangbo" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
)
</if>
<if test='category1 != null and category1 != ""'> <if test='category1 != null and category1 != ""'>
or affair_type1 in and affair_type1 in
<foreach collection="category1" item="item" index="index" separator="," open="(" close=")"> <foreach collection="category1" item="item" index="index" separator="," open="(" close=")">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test='category2 != null and category2 != ""'> <if test='category2 != null and category2 != ""'>
or affair_type2 in and affair_type2 in
<foreach collection="category2" item="item" index="index" separator="," open="(" close=")"> <foreach collection="category2" item="item" index="index" separator="," open="(" close=")">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test='category3 != null and category3 != ""'> <if test='category3 != null and category3 != ""'>
or affair_type3 in and affair_type3 in
<foreach collection="category3" item="item" index="index" separator="," open="(" close=")"> <foreach collection="category3" item="item" index="index" separator="," open="(" close=")">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test='category4 != null and category4 != ""'> <if test='category4 != null and category4 != ""'>
or affair_type4 in and affair_type4 in
<foreach collection="category4" item="item" index="index" separator="," open="(" close=")"> <foreach collection="category4" item="item" index="index" separator="," open="(" close=")">
#{item} #{item}
</foreach> </foreach>
@ -257,17 +304,7 @@
item_value item_value
from code_mgt from code_mgt
where category_cd = 'DC01' where category_cd = 'DC01'
<choose> <include refid="statisticsCategory1"></include>
<when test='category1 != null and category1 != ""'>
and item_cd in
<foreach collection="category1" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd = 'DC01')
</otherwise>
</choose>
)a left join )a left join
(select item_cd, (select item_cd,
item_value item_value
@ -286,6 +323,9 @@
affair_type1 as affair_type, affair_type1 as affair_type,
count(*) as cnt count(*) as cnt
from affair_board from affair_board
<where>
<include refid="searchStatistics"></include>
</where>
group by wrt_organ,affair_type1) c group by wrt_organ,affair_type1) c
on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ
order by wrt_organ,affair_type asc order by wrt_organ,affair_type asc
@ -301,17 +341,7 @@
item_value item_value
from code_mgt from code_mgt
where category_cd = 'DC02' where category_cd = 'DC02'
<choose> <include refid="statisticsCategory2"></include>
<when test='category2 != null and category2 != ""'>
and item_cd in
<foreach collection="category2" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd = 'DC02')
</otherwise>
</choose>
)a left join )a left join
(select item_cd, (select item_cd,
item_value item_value
@ -330,6 +360,9 @@
affair_type2 as affair_type, affair_type2 as affair_type,
count(*) as cnt count(*) as cnt
from affair_board from affair_board
<where>
<include refid="searchStatistics"></include>
</where>
group by wrt_organ,affair_type2) c group by wrt_organ,affair_type2) c
on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ
order by wrt_organ,affair_type asc order by wrt_organ,affair_type asc
@ -345,17 +378,7 @@
item_value item_value
from code_mgt from code_mgt
where category_cd = 'DC03' where category_cd = 'DC03'
<choose> <include refid="statisticsCategory3"></include>
<when test='category3 != null and category3 != ""'>
and item_cd in
<foreach collection="category3" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd = 'DC03')
</otherwise>
</choose>
)a left join )a left join
(select item_cd, (select item_cd,
item_value item_value
@ -374,6 +397,9 @@
affair_type3 as affair_type, affair_type3 as affair_type,
count(*) as cnt count(*) as cnt
from affair_board from affair_board
<where>
<include refid="searchStatistics"></include>
</where>
group by wrt_organ,affair_type3) c group by wrt_organ,affair_type3) c
on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ
order by wrt_organ,affair_type asc order by wrt_organ,affair_type asc
@ -389,17 +415,7 @@
item_value item_value
from code_mgt from code_mgt
where category_cd = 'DC04' where category_cd = 'DC04'
<choose> <include refid="statisticsCategory4"></include>
<when test='category4 != null and category4 != ""'>
and item_cd in
<foreach collection="category4" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd = 'DC04')
</otherwise>
</choose>
)a left join )a left join
(select item_cd, (select item_cd,
item_value item_value
@ -418,8 +434,191 @@
affair_type4 as affair_type, affair_type4 as affair_type,
count(*) as cnt count(*) as cnt
from affair_board from affair_board
<where>
<include refid="searchStatistics"></include>
</where>
group by wrt_organ,affair_type4) c group by wrt_organ,affair_type4) c
on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ
order by wrt_organ,affair_type asc order by wrt_organ,affair_type asc
</select> </select>
<sql id="raitingSearch">
<choose>
<when test='sangbo != null and sangbo != ""'>
and ar.organ_up = 'T'
and oc.organ_type in
<foreach collection="sangbo" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and oc.organ_type not in ('OGC002','OGC003')
</otherwise>
</choose>
<choose>
<when test='category1 != null and category1 != ""'>
and affair_type1 in
<foreach collection="category1" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and affair_type1 not in (select item_cd from code_mgt where category_cd = 'DC01')
</otherwise>
</choose>
<choose>
<when test='category2 != null and category2 != ""'>
and affair_type2 in
<foreach collection="category2" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and affair_type2 not in (select item_cd from code_mgt where category_cd = 'DC02')
</otherwise>
</choose>
<choose>
<when test='category3 != null and category3 != ""'>
and affair_type3 in
<foreach collection="category3" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and affair_type3 not in (select item_cd from code_mgt where category_cd = 'DC03')
</otherwise>
</choose>
<choose>
<when test='category4 != null and category4 != ""'>
and affair_type4 in
<foreach collection="category4" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and affair_type4 not in (select item_cd from code_mgt where category_cd = 'DC04')
</otherwise>
</choose>
<choose>
<when test='rating != null and rating != ""'>
and affair_rate in
<foreach collection="rating" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and affair_rate not in (select item_cd from code_mgt where category_cd = 'AAR')
</otherwise>
</choose>
</sql>
<select id="selectRatingStatusTotal" resultType="TypeStatistics" parameterType="TypeStatistics">
select item_cd as wrt_organ,
item_value,
coalesce(cnt,0) as cnt
from
(select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T') a
left outer join
(select ab.wrt_organ,
oc.organ_type,
count(*) as cnt
from affair_board ab,
affair_rating ar,
organ_config oc
where ab.affair_key = ar.affair_key
and ar.rating_organ = oc.organ_cd
<include refid="raitingSearch"></include>
group by ab.wrt_organ,oc.organ_type) c
on a.item_cd = c.wrt_organ
order by item_cd asc
</select>
<select id="selectSangboTotal" resultType="TypeStatistics" parameterType="TypeStatistics">
select item_cd as wrt_organ,
item_value,
b.organ_type as affairType,
coalesce(cnt,0) as cnt
from
(select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T') a left join
(select organ_type
from organ_config
<where>
<choose>
<when test='sangbo != null and sangbo != ""'>
organ_type in
<foreach collection="sangbo" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
organ_type not in (select organ_type from organ_config)
</otherwise>
</choose>
</where>
group by organ_type) b on 1=1
left outer join
(select ab.wrt_organ,
oc.organ_type,
count(*) as cnt
from affair_board ab,
affair_rating ar,
organ_config oc
where ab.affair_key = ar.affair_key
and ar.rating_organ = oc.organ_cd
<include refid="raitingSearch"></include>
group by ab.wrt_organ,oc.organ_type) c
on a.item_cd = c.wrt_organ and b.organ_type = c.organ_type
order by item_cd, affairType asc
</select>
<select id="selectArrCntList" resultType="TypeStatistics" parameterType="TypeStatistics">
select a.item_cd as wrt_organ,
b.item_cd as affairType,
coalesce(cnt,0) as cnt
from
(select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T') a left join
(select item_cd
from code_mgt
where category_cd='AAR'
<choose>
<when test='rating != null and rating != ""'>
and item_cd in
<foreach collection="rating" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd='AAR')
</otherwise>
</choose>
) b on 1=1
left outer join
(select ab.wrt_organ,
ar.affair_rate,
count(*) as cnt
from affair_board ab,
affair_rating ar,
organ_config oc
where ab.affair_key = ar.affair_key
and ar.rating_organ = oc.organ_cd
and ar.affair_rate is not null
and ar.affair_rate != ''
<include refid="raitingSearch"></include>
group by ab.wrt_organ,ar.affair_rate) c
on c.wrt_organ = a.item_cd and c.affair_rate = b.item_cd
order by wrt_organ,affairType asc
</select>
</mapper> </mapper>

View File

@ -0,0 +1,6 @@
/*로그인 폼*/
.affair-scroll{
max-height: 200px;
overflow-y: auto;
}

View File

@ -16,6 +16,24 @@
background-color: #ffffff; background-color: #ffffff;
} }
#fadeSearchDiv{
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background-color: #00000050;
z-index: 2090;
}
#fadeSearchDiv > div{
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
background-color: #ffffff;
}
.activeTr{ .activeTr{
--bs-bg-opacity: 0.25; --bs-bg-opacity: 0.25;
background-color: rgba(var(--bs-success-rgb),var(--bs-bg-opacity))!important; background-color: rgba(var(--bs-success-rgb),var(--bs-bg-opacity))!important;

View File

@ -8,6 +8,14 @@ function contentFade(action){
} }
} }
function searchFade(action){
if(action === "in"){
$("#fadeSearchDiv").show()
}else{
$("#fadeSearchDiv").hide()
}
}
$(document).on('click', '.allChk', function (){ $(document).on('click', '.allChk', function (){
$(this).parents('table').find('[type="checkbox"]').prop("checked", this.checked); $(this).parents('table').find('[type="checkbox"]').prop("checked", this.checked);
}) })

View File

@ -1,3 +1,9 @@
$(function(){
$("#dateSelectorDiv").datepicker({
format: "yyyy-mm-dd",
language: "ko"
});
})
$(document).on('click', '#downExcel', function (){ $(document).on('click', '#downExcel', function (){
exportExcel(); exportExcel();
@ -50,3 +56,114 @@ function getToday(){
return year + "-" + month + "-" + day; return year + "-" + month + "-" + day;
} }
$(document).on('click', '#fieldSearch', function (){
goFieldStatistics();
})
$(document).on('click', '#fieldTab', function (){
goFieldStatistics();
})
function goFieldStatistics(){
searchFade("in");
const formData = new FormData($("#searchFm")[0]);
$.ajax({
url: '/affair/fieldStatistics',
data: formData,
type: 'POST',
dataType:"html",
contentType: false,
processData: false,
success: function(html){
$("#statisticsBody").empty().append(html)
$("#statisticsBody").show();
$(".statisticsMenu").hide();
searchFade("out");
},
error:function(){
searchFade("out");
}
});
}
$(document).on('click', '#ratingSearch', function (){
goRatingStatistics();
})
$(document).on('click', '#ratingTab', function (){
goRatingStatistics();
})
function goRatingStatistics(){
searchFade("in");
const formData = new FormData($("#searchFm")[0]);
$.ajax({
url: '/affair/ratingStatistics',
data: formData,
type: 'POST',
dataType:"html",
contentType: false,
processData: false,
success: function(html){
$("#statisticsBody").empty().append(html)
$("#statisticsBody").show();
$(".statisticsMenu").hide();
searchFade("out");
},
error:function(){
searchFade("out");
}
});
}
$(document).on('click', '#showMenu', function (){
$(".statisticsMenu").show();
})
$(document).ready(function() {
$("#organAll").click(function() {
if($("#organAll").is(":checked")){
$("input[name=organList]").prop("checked", true);
} else{
$("input[name=organList]").prop("checked", false);
}
});
$("#ratingAll").click(function() {
if($("#ratingAll").is(":checked")){
$("input[name=rating]").prop("checked", true);
} else{
$("input[name=rating]").prop("checked", false);
}
});
$("#category1All").click(function() {
if($("#category1All").is(":checked")){
$("input[name=category1]").prop("checked", true);
} else{
$("input[name=category1]").prop("checked", false);
}
});
$("#category2All").click(function() {
if($("#category2All").is(":checked")){
$("input[name=category2]").prop("checked", true);
} else{
$("input[name=category2]").prop("checked", false);
}
});
$("#category3All").click(function() {
if($("#category3All").is(":checked")){
$("input[name=category3]").prop("checked", true);
} else{
$("input[name=category3]").prop("checked", false);
}
});
$("#category4All").click(function() {
if($("#category4All").is(":checked")){
$("input[name=category4]").prop("checked", true);
} else{
$("input[name=category4]").prop("checked", false);
}
});
});

View File

@ -5,6 +5,9 @@
<th:block layout:fragment="script"> <th:block layout:fragment="script">
<script type="text/javascript" th:src="@{/js/igActivities/fpiMgt/affair/statistics.js}"></script> <script type="text/javascript" th:src="@{/js/igActivities/fpiMgt/affair/statistics.js}"></script>
</th:block> </th:block>
<th:block layout:fragment="css">
<link rel="stylesheet" th:href="@{/css/affair/affair.css}">
</th:block>
<div layout:fragment="content"> <div layout:fragment="content">
<main class="pt-3"> <main class="pt-3">
<h4>견문통계</h4> <h4>견문통계</h4>
@ -14,10 +17,11 @@
<div class="col-12 card text-center"> <div class="col-12 card text-center">
<div class="card-body"> <div class="card-body">
<div class="col-auto"> <div class="col-auto">
<button id="downExcel">엑셀다운</button>
</div> </div>
<div class="tab-content border border-top-0 p-2"> <div class="tab-content border border-top-0 p-2">
<form id="searchFm" method="get" th:action="@{/affair/statistics}"> <form id="searchFm" class="statisticsMenu">
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
<div class="row pe-3 py-1"> <div class="row pe-3 py-1">
<div class="col-auto"> <div class="col-auto">
<div class="input-group w-auto input-daterange" id="dateSelectorDiv"> <div class="input-group w-auto input-daterange" id="dateSelectorDiv">
@ -26,145 +30,81 @@
</div> </div>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<input type="text" class="form-control form-control-sm" name="userNm" placeholder="보고자명" autocomplete="off">
</div>
</div>
<div class="row pe-3 py-1">
<div class="col-auto affair-scroll">
<h4>소속<input id="organAll" type="checkbox" checked></h4>
<ul class="select_list" th:each="commonCode:${session.commonCode.get('OG')}"> <ul class="select_list" th:each="commonCode:${session.commonCode.get('OG')}">
<th:block th:if="${#lists.contains(mgtOrganList, commonCode.itemCd)}"> <th:block th:if="${#lists.contains(mgtOrganList, commonCode.itemCd)}">
<li> <li>
<input id="category11" name="organList" type="checkbox" th:value="${commonCode.itemCd}" th:if="${#lists.isEmpty(searchParams.organList)}"> <input th:id="|organ${commonCode.itemCd}|" name="organList" type="checkbox" th:value="${commonCode.itemCd}" checked>
<input id="category11" name="organList" type="checkbox" th:value="${commonCode.itemCd}" th:checked="${#lists.contains(searchParams.organList, commonCode.itemCd)}" th:unless="${#lists.isEmpty(searchParams.organList)}"> <label th:for="|organ${commonCode.itemCd}|" th:text="${commonCode.itemValue}"></label>
<label th:text="${commonCode.itemValue}"></label>
</li> </li>
</th:block> </th:block>
</ul> </ul>
</th:block> </th:block>
</div> </div>
<div class="row justify-content-end pb-1"> <div class="col-auto affair-scroll">
<div class="col-auto" style="overflow: auto"> <h4>평가<input id="ratingAll" type="checkbox" checked></h4>
<ul class="select_list" th:each="commonCode:${session.commonCode.get('AAR')}">
<li>
<input th:id="|rating${commonCode.itemCd}|" name="rating" type="checkbox" th:value="${commonCode.itemCd}" checked>
<label th:for="|rating${commonCode.itemCd}|" th:text="${commonCode.itemValue}"></label>
</li>
</ul>
</div>
<div class="col-auto affair-scroll">
<h4>분야1<input id="category1All" type="checkbox" checked></h4>
<ul class="select_list" th:each="commonCode:${session.commonCode.get('DC01')}"> <ul class="select_list" th:each="commonCode:${session.commonCode.get('DC01')}">
<li> <li>
<input th:id="|category1${commonCode.itemCd}|" name="category1" type="checkbox" th:value="${commonCode.itemCd}" th:if="${#lists.isEmpty(searchParams.category1)}"> <input th:id="|category1${commonCode.itemCd}|" name="category1" type="checkbox" th:value="${commonCode.itemCd}" checked>
<input th:id="|category1${commonCode.itemCd}|" name="category1" type="checkbox" th:value="${commonCode.itemCd}" th:checked="${#lists.contains(searchParams.category1, commonCode.itemCd)}" th:unless="${#lists.isEmpty(searchParams.category1)}">
<label th:for="|category1${commonCode.itemCd}|" th:text="${commonCode.itemValue}"></label> <label th:for="|category1${commonCode.itemCd}|" th:text="${commonCode.itemValue}"></label>
</li> </li>
</ul> </ul>
</div> </div>
<div class="col-auto"> <div class="col-auto affair-scroll">
<h4>분야2<input id="category2All" type="checkbox" checked></h4>
<ul class="select_list" th:each="commonCode:${session.commonCode.get('DC02')}"> <ul class="select_list" th:each="commonCode:${session.commonCode.get('DC02')}">
<li> <li>
<input id="category11" name="category2" type="checkbox" th:value="${commonCode.itemCd}" th:if="${#lists.isEmpty(searchParams.category2)}"> <input th:id="|category2${commonCode.itemCd}|" name="category2" type="checkbox" th:value="${commonCode.itemCd}" checked>
<input id="category11" name="category2" type="checkbox" th:value="${commonCode.itemCd}" th:checked="${#lists.contains(searchParams.category2, commonCode.itemCd)}" th:unless="${#lists.isEmpty(searchParams.category2)}"> <label th:for="|category2${commonCode.itemCd}|" th:text="${commonCode.itemValue}"></label>
<label th:text="${commonCode.itemValue}"></label>
</li> </li>
</ul> </ul>
</div> </div>
<div class="col-auto"> <div class="col-auto affair-scroll">
<h4>분야3<input id="category3All" type="checkbox" checked></h4>
<ul class="select_list" th:each="commonCode:${session.commonCode.get('DC03')}"> <ul class="select_list" th:each="commonCode:${session.commonCode.get('DC03')}">
<li> <li>
<input id="category11" name="category3" type="checkbox" th:value="${commonCode.itemCd}" th:if="${#lists.isEmpty(searchParams.category3)}"> <input th:id="|category3${commonCode.itemCd}|" name="category3" type="checkbox" th:value="${commonCode.itemCd}" checked>
<input id="category11" name="category3" type="checkbox" th:value="${commonCode.itemCd}" th:checked="${#lists.contains(searchParams.category3, commonCode.itemCd)}" th:unless="${#lists.isEmpty(searchParams.category3)}"> <label th:for=|category3${commonCode.itemCd}| th:text="${commonCode.itemValue}"></label>
<label th:text="${commonCode.itemValue}"></label> </li>
</ul>
</div>
<div class="col-auto affair-scroll">
<h4>분야4<input id="category4All" type="checkbox" checked></h4>
<ul class="select_list" th:each="commonCode:${session.commonCode.get('DC04')}">
<li>
<input th:id="|category4${commonCode.itemCd}|" name="category4" type="checkbox" th:value="${commonCode.itemCd}" checked>
<label th:for="|category4${commonCode.itemCd}|" th:text="${commonCode.itemValue}"></label>
</li> </li>
</ul> </ul>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<ul class="select_list" th:each="commonCode:${session.commonCode.get('DC04')}"> <input id="category11" name="sangbo" type="checkbox" value="OGC003" checked>경찰서상보<br>
<li> <input id="category11" name="sangbo" type="checkbox" value="OGC002" checked>지방청상보
<input id="category11" name="category4" type="checkbox" th:value="${commonCode.itemCd}" th:if="${#lists.isEmpty(searchParams.category4)}">
<input id="category11" name="category4" type="checkbox" th:value="${commonCode.itemCd}" th:checked="${#lists.contains(searchParams.category4, commonCode.itemCd)}" th:unless="${#lists.isEmpty(searchParams.category4)}">
<label th:text="${commonCode.itemValue}"></label>
</li>
</ul>
</div>
</div> </div>
<div class="col-1 d-grid gap-2"> <div class="col-1 d-grid gap-2">
<input type="submit" class="btn btn-lg btn-primary col-auto" id="searchBtn" value="검색"> <button type="button" id="fieldSearch" class="btn btn-lg btn-primary col-auto">분야별 검색</button>
<button type="button" id="ratingSearch" class="btn btn-lg btn-primary col-auto">평가별 검색</button>
</div> </div>
</div> </div>
</form> </form>
<div class="row justify-content-start"> <div class="row justify-content-start">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card" id="statisticsBody" style="display:none;">
<div class="card-body">
<div class="row">
<table class="table table-hover" id="tableData">
<thead>
<tr>
<th rowspan="2">구분</th>
<th rowspan="2">누계</th>
<th:block th:unless="${#lists.isEmpty(type1)}">
<th th:colspan="${type1.size()}">분류1</th>
</th:block>
<th:block th:unless="${#lists.isEmpty(type2)}">
<th th:colspan="${type2.size()}">분류2</th>
</th:block>
<th:block th:unless="${#lists.isEmpty(type3)}">
<th th:colspan="${type3.size()}">분류3</th>
</th:block>
<th:block th:unless="${#lists.isEmpty(type4)}">
<th th:colspan="${type4.size()}">분류4</th>
</th:block>
</tr>
<tr>
<th:block th:unless="${#lists.isEmpty(type1)}">
<th:block th:each="type1:${type1}">
<th th:text="${type1.itemValue}"></th>
</th:block>
</th:block>
<th:block th:unless="${#lists.isEmpty(type2)}">
<th:block th:each="type2:${type2}">
<th th:text="${type2.itemValue}"></th>
</th:block>
</th:block>
<th:block th:unless="${#lists.isEmpty(type3)}">
<th:block th:each="type3:${type3}">
<th th:text="${type3.itemValue}"></th>
</th:block>
</th:block>
<th:block th:unless="${#lists.isEmpty(type4)}">
<th:block th:each="type4:${type4}">
<th th:text="${type4.itemValue}"></th>
</th:block>
</th:block>
</tr>
</thead>
<tbody>
<th:block th:each="total:${totalList}">
<tr>
<td th:text="${total.itemValue}"></td>
<td th:text="${total.cnt}"></td>
<th:block th:each="commonCode:${type1}">
<th:block th:each="type1:${type1List}">
<th:block th:if="${type1.affairType eq commonCode.affairType} and ${total.wrtOrgan eq type1.wrtOrgan}">
<td th:text="${type1.cnt}"></td>
</th:block>
</th:block>
</th:block>
<th:block th:each="commonCode:${type2}">
<th:block th:each="type2:${type2List}">
<th:block th:if="${type2.affairType eq commonCode.affairType} and ${total.wrtOrgan eq type2.wrtOrgan}">
<td th:text="${type2.cnt}"></td>
</th:block>
</th:block>
</th:block>
<th:block th:each="commonCode:${type3}">
<th:block th:each="type3:${type3List}">
<th:block th:if="${type3.affairType eq commonCode.affairType} and ${total.wrtOrgan eq type3.wrtOrgan}">
<td th:text="${type3.cnt}"></td>
</th:block>
</th:block>
</th:block>
<th:block th:each="commonCode:${type4}">
<th:block th:each="type4:${type4List}">
<th:block th:if="${type4.affairType eq commonCode.affairType} and ${total.wrtOrgan eq type4.wrtOrgan}">
<td th:text="${type4.cnt}"></td>
</th:block>
</th:block>
</th:block>
</tr>
</th:block>
</tbody>
</table>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,111 @@
<ul class="nav nav-tabs" id="userTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="fieldTab" data-bs-toggle="tab"
type="button" role="tab">분야별</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="ratingTab" data-bs-toggle="tab"
type="button" role="tab">평가별</button>
</li>
</ul>
<div class="card-body">
<button id="showMenu">검색조건열기</button>
<button id="downExcel">엑셀다운</button>
<div class="row" id="statisticsDiv">
<table class="table table-hover table-bordered border-dark"
id="tableData">
<thead>
<tr>
<th rowspan="2">구분</th>
<th rowspan="2">누계</th>
<th:block th:unless="${#lists.isEmpty(searchParams.category1)}">
<th th:colspan="${searchParams.category1.size()}">분류1</th>
</th:block>
<th:block th:unless="${#lists.isEmpty(searchParams.category2)}">
<th th:colspan="${searchParams.category2.size()}">분류2</th>
</th:block>
<th:block th:unless="${#lists.isEmpty(searchParams.category3)}">
<th th:colspan="${searchParams.category3.size()}">분류3</th>
</th:block>
<th:block th:unless="${#lists.isEmpty(searchParams.category4)}">
<th th:colspan="${searchParams.category4.size()}">분류4</th>
</th:block>
</tr>
<tr>
<th:block th:unless="${#lists.isEmpty(searchParams.category1)}">
<th:block th:each="commonCode:${session.commonCode.get('DC01')}">
<th:block
th:if="${#lists.contains(searchParams.category1, commonCode.itemCd)}">
<th th:text="${commonCode.itemValue}"></th>
</th:block>
</th:block>
</th:block>
<th:block th:unless="${#lists.isEmpty(searchParams.category2)}">
<th:block th:each="commonCode:${session.commonCode.get('DC02')}">
<th:block
th:if="${#lists.contains(searchParams.category2, commonCode.itemCd)}">
<th th:text="${commonCode.itemValue}"></th>
</th:block>
</th:block>
</th:block>
<th:block th:unless="${#lists.isEmpty(searchParams.category3)}">
<th:block th:each="commonCode:${session.commonCode.get('DC03')}">
<th:block
th:if="${#lists.contains(searchParams.category3, commonCode.itemCd)}">
<th th:text="${commonCode.itemValue}"></th>
</th:block>
</th:block>
</th:block>
<th:block th:unless="${#lists.isEmpty(searchParams.category4)}">
<th:block th:each="commonCode:${session.commonCode.get('DC04')}">
<th:block
th:if="${#lists.contains(searchParams.category4, commonCode.itemCd)}">
<th th:text="${commonCode.itemValue}"></th>
</th:block>
</th:block>
</th:block>
</tr>
</thead>
<tbody>
<th:block th:each="total:${totalList}">
<tr>
<td th:text="${total.itemValue}"></td>
<td th:text="${total.cnt}"></td>
<th:block th:each="category1:${searchParams.category1}">
<th:block th:each="type1List:${type1List}">
<th:block
th:if="${type1List.affairType eq category1} and ${total.wrtOrgan eq type1List.wrtOrgan}">
<td th:text="${type1List.cnt}"></td>
</th:block>
</th:block>
</th:block>
<th:block th:each="category2:${searchParams.category2}">
<th:block th:each="type2List:${type2List}">
<th:block
th:if="${type2List.affairType eq category2} and ${total.wrtOrgan eq type2List.wrtOrgan}">
<td th:text="${type2List.cnt}"></td>
</th:block>
</th:block>
</th:block>
<th:block th:each="category3:${searchParams.category3}">
<th:block th:each="type3List:${type3List}">
<th:block
th:if="${type3List.affairType eq category3} and ${total.wrtOrgan eq type3List.wrtOrgan}">
<td th:text="${type3List.cnt}"></td>
</th:block>
</th:block>
</th:block>
<th:block th:each="category4:${searchParams.category4}">
<th:block th:each="type4List:${type4List}">
<th:block
th:if="${type4List.affairType eq category4} and ${total.wrtOrgan eq type4List.wrtOrgan}">
<td th:text="${type4List.cnt}"></td>
</th:block>
</th:block>
</th:block>
</tr>
</th:block>
</tbody>
</table>
</div>
</div>

View File

@ -0,0 +1,71 @@
<ul class="nav nav-tabs" id="userTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link" id="fieldTab" data-bs-toggle="tab"
type="button" role="tab">분야별</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link active" id="ratingTab" data-bs-toggle="tab"
type="button" role="tab">평가별</button>
</li>
</ul>
<div class="card-body">
<button id="showMenu">검색조건열기</button>
<button id="downExcel">엑셀다운</button>
<div class="row" id="statisticsDiv">
<table class="table table-hover table-bordered border-dark"
id="tableData">
<thead>
<tr>
<th rowspan="2">구분</th>
<th rowspan="2">누계</th>
<th:block th:unless="${#lists.isEmpty(searchParams.sangbo)}">
<th th:colspan="${searchParams.sangbo.size()}">상보</th>
</th:block>
<th:block th:unless="${#lists.isEmpty(searchParams.rating)}">
<th th:colspan="${searchParams.rating.size()}">평과결과별</th>
</th:block>
</tr>
<tr>
<th:block th:unless="${#lists.isEmpty(searchParams.sangbo)}">
<th:block th:each="sangbo:${searchParams.sangbo}">
<th th:if="${sangbo eq 'OGC002'}">지방청</th>
<th th:if="${sangbo eq 'OGC003'}">경찰서</th>
</th:block>
</th:block>
<th:block th:unless="${#lists.isEmpty(searchParams.rating)}">
<th:block th:each="commonCode:${session.commonCode.get('AAR')}">
<th:block
th:if="${#lists.contains(searchParams.rating, commonCode.itemCd)}">
<th th:text="${commonCode.itemValue}"></th>
</th:block>
</th:block>
</th:block>
</tr>
</thead>
<tbody>
<th:block th:each="total:${totalList}">
<tr>
<td th:text="${total.itemValue}"></td>
<td th:text="${total.cnt}"></td>
<th:block th:each="sangbo:${searchParams.sangbo}">
<th:block th:each="sangboList:${sangboList}">
<th:block
th:if="${sangboList.affairType eq sangbo} and ${total.wrtOrgan eq sangboList.wrtOrgan}">
<td th:text="${sangboList.cnt}"></td>
</th:block>
</th:block>
</th:block>
<th:block th:each="rating:${searchParams.rating}">
<th:block th:each="arrCntList:${arrCntList}">
<th:block
th:if="${arrCntList.affairType eq rating} and ${total.wrtOrgan eq arrCntList.wrtOrgan}">
<td th:text="${arrCntList.cnt}"></td>
</th:block>
</th:block>
</th:block>
</tr>
</th:block>
</tbody>
</table>
</div>
</div>

View File

@ -63,6 +63,9 @@
<div id="fadeDiv" style="display: none;"> <div id="fadeDiv" style="display: none;">
<div class="p-5 rounded"><h1>저장중입니다.</h1></div> <div class="p-5 rounded"><h1>저장중입니다.</h1></div>
</div> </div>
<div id="fadeSearchDiv" style="display: none;">
<div class="p-5 rounded"><h1>조회중입니다.</h1></div>
</div>
<th:block layout:fragment="modal"></th:block> <th:block layout:fragment="modal"></th:block>
</body> </body>
</html> </html>