OWL ITS + 탐지시스템(인터넷 진흥원)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
package kr.wisestone.owl.service.impl;
 
import com.google.common.collect.Lists;
import kr.wisestone.owl.common.ExcelConditionCheck;
import kr.wisestone.owl.common.MessageAccessor;
import kr.wisestone.owl.constant.Constants;
import kr.wisestone.owl.constant.MngPermission;
import kr.wisestone.owl.constant.MsgConstants;
import kr.wisestone.owl.domain.*;
import kr.wisestone.owl.domain.enumType.ProjectType;
import kr.wisestone.owl.exception.OwlRuntimeException;
import kr.wisestone.owl.mapper.IssueMapper;
import kr.wisestone.owl.mapper.WidgetMapper;
import kr.wisestone.owl.repository.ProjectClosureRepository;
import kr.wisestone.owl.repository.UserDepartmentRepository;
import kr.wisestone.owl.service.*;
import kr.wisestone.owl.util.*;
import kr.wisestone.owl.vo.*;
import kr.wisestone.owl.web.condition.IssueCondition;
import kr.wisestone.owl.web.condition.WidgetCondition;
import kr.wisestone.owl.web.view.ExcelView;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.StopWatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.web.servlet.ModelAndView;
 
import javax.servlet.http.HttpServletRequest;
import java.util.*;
 
@Service
public class WidgetServiceImpl implements WidgetService {
 
    private static final Logger log = LoggerFactory.getLogger(WidgetServiceImpl.class);
 
    @Autowired
    private WidgetMapper widgetMapper;
 
    @Autowired
    private IssueMapper issueMapper;
 
    @Autowired
    protected WebAppUtil webAppUtil;
 
    @Autowired
    protected PageUtil pageUtil;
 
    @Autowired
    private ProjectService projectService;
 
    @Autowired
    private ProjectRoleDepartmentService projectRoleDepartmentService;
 
    @Autowired
    private ProjectClosureService projectClosureService;
 
    @Autowired
    private IssueStatusService issueStatusService;
 
    @Autowired
    private UserService userService;
 
    @Autowired
    private UserLevelService userLevelService;
 
    @Autowired
    private UserDepartmentService userDepartmentService;
 
    @Autowired
    private UserDepartmentRepository userDepartmentRepository;
 
    @Autowired
    protected MessageAccessor messageAccessor;
 
    @Autowired
    private ExcelView excelView;
 
    @Autowired
    private WorkspaceService workspaceService;
 
    @Autowired
    private ExcelConditionCheck excelConditionCheck;
 
    @Autowired
    private UserWorkspaceService userWorkspaceService;
 
    @Autowired
    private ProjectClosureRepository projectClosureRepository;
 
 
    //  전체 위젯을 조회한다.
    @Override
    @Transactional(readOnly = true)
    public void findAllWidget(Map<String, Object> resJsonData) {
        Long lastProjectId = userService.getUser(this.webAppUtil.getLoginId()).getLastProjectId();
 
        //  위젯의 기본 검색 조건을 설정한다.
        WidgetCondition widgetCondition = this.makeWidgetCondition();
        if (lastProjectId != null && lastProjectId > -1) {
            widgetCondition.setProjectIds(lastProjectId);
            resJsonData.put("dashboardType", 1);
        } else {
            resJsonData.put("dashboardType", 0);
        }
 
        //  페이징 설정 - 모든 위젯은 데이터를 5개만 가져온다.
        PageVo pageVo = this.pageUtil.getDefaultPageVo();
        pageVo.setPageSize(5);
        Pageable pageable = this.pageUtil.convertPageable(pageVo);
 
        //  전체 이슈 정보를 조회한다.
        this.findStatisticsIssue(resJsonData, widgetCondition);
        //  1.129 - 1.06 튜닝 결과 : 0.795 - 0.686
 
        //  전체 이슈 처리현황을 조회한다.
        this.findIssueComplete(resJsonData, widgetCondition, null);
        //  0.169 - 0.168
 
        //  진행중인 프로젝트 현황 정보를 조회한다.
        this.findProjectProgress(resJsonData, widgetCondition);
        //  0.1 - 0.1
 
        //  나의 이슈 현황 정보를 조회한다. - 내가 담당/할당하는 이슈 현황 정보도 여기서 추출한다.
        this.findMyIssueDetail(resJsonData, widgetCondition);
        // 5.053 - 6.933 튜닝 결과 : 0.36 - 0.33
 
        //  나에게 할당된 이슈 정보를 조회한다.
        this.findMyAssigneeIssue(resJsonData, widgetCondition, pageable);
        //  0.442 - 0.399 튜닝 결과 : 0.266 - 0.273
 
        //  위험 관리 이슈 정보를 조회한다.
        this.findRiskIssue(resJsonData, widgetCondition, pageable);
        // 1.153 - 1.15 - 튜닝 결과 : 0.64 - 0.63
 
        //  내가 등록한 이슈 정보를 조회한다.
        this.findRegisterIssue(resJsonData, widgetCondition, pageable);
        // 0.263 - 0.270 - 튜닝 결과 : 0.145 - 0.149
        StopWatch serviceStart = new StopWatch();
        serviceStart.start();
        //  지연중인 이슈 정보를 조회한다.
        this.findDelayIssue(resJsonData, widgetCondition, pageable);
        //  0.044 - 0.055
        serviceStart.stop();
        //  상태별 이슈 현황을 조회한다.
        this.findByStandIssueStatus(resJsonData, widgetCondition);
 
        //  프로젝트 별 멤버 진행률 정보를 조회한다.
        this.findMemberProgress(resJsonData, widgetCondition, false);
        // 0.271 - 0.271
 
        //  이슈 타입 별 이슈 정보를 조회한다.
        this.findByStandIssueType(resJsonData, widgetCondition, false);
        //  0.025
 
        // 중요도 별 이슈 정보를 조회한다.
        this.findSeverityIssueWidget(resJsonData, widgetCondition, null, pageable);
 
 
        log.debug("serviceEnd : " + serviceStart.getTime());
 
        log.debug("완료");
    }
 
    //  위젯의 기본 검색 조건을 설정한다.
    @Override
    @Transactional(readOnly = true)
    public WidgetCondition makeWidgetCondition() {
        User user = this.webAppUtil.getLoginUserObject();
        UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId());
        //  해당 워크스페이스에서 참여하고 있는 프로젝트 중 상태가 오픈인 프로젝트
        List<Map<String, Object>> projects = null;
        if (this.userWorkspaceService.checkWorkspaceManager(user)
                || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_PROJECT)) {
            projects = this.projectService.findByWorkspaceManagerAll();
        } else  {
            projects = this.projectService.findByWorkspaceIdAndIncludeProjectAll(Lists.newArrayList("02"), ProjectType.BTS_PROJECT.toString());
        }
 
        List<Long> projectIds = Lists.newArrayList();
 
        for (Map<String, Object> result : projects) {
            Long projectId = MapUtil.getLong(result, "id");
 
            if (projectId != null) {
                projectIds.add(projectId);
            }
        }
 
        WidgetCondition widgetCondition = new WidgetCondition();
        widgetCondition.setProjectIds(projectIds);
        widgetCondition.setProjects(projects);
        widgetCondition.setLoginUserId(this.webAppUtil.getLoginId());
        this.SetMyDepartmentId(widgetCondition); // 로그인 한 유저가 속해있는 부서
        widgetCondition.setCompleteDate(DateUtil.convertDateToStr(new Date()));
        widgetCondition.setWorkspaceId(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId());
 
        return widgetCondition;
    }
 
    void SetMyDepartmentId(WidgetCondition widgetCondition){
        Long loginId = widgetCondition.getLoginUserId();
        List<Long> myDepartmentIds = Lists.newArrayList();
        List<UserDepartment> myDepartments = this.userDepartmentRepository.findByUserId(loginId);
 
        if(myDepartments != null && myDepartments.size() > 0){
            for(UserDepartment myDepartment : myDepartments){
                myDepartmentIds.add(myDepartment.getDepartmentId());
            }
        }
        widgetCondition.setMyDepartmentIds(myDepartmentIds);
    }
 
    void SetMeAndDownProjectIds(List<Long> parentProjectIds, WidgetCondition widgetCondition) {
        List<Long> downProjectIds = Lists.newArrayList();
        List<Long> projectIds = Lists.newArrayList();
        projectIds.add(-1L);
        User user = this.webAppUtil.getLoginUserObject();
        UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId());
        if(parentProjectIds != null && parentProjectIds.size() > 0){
            for(Long parentProjectId : parentProjectIds){
                if(!this.userWorkspaceService.checkWorkspaceManager(user) || !MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_PROJECT)){
                    Project project = this.projectService.getProject(parentProjectId);
                    List<Map<String, Object>> results = this.projectService.findByWorkspaceIdAndIncludeProject(Lists.newArrayList("01", "02", "03"), project.getProjectType().toString());
                    if(results == null || results.size() < 1) {
                        widgetCondition.setMeAndDownProjectIds(projectIds);
                        break;
                    }
                }
                List<ProjectClosure> projectClosures = this.projectClosureRepository.findByParentProjectId(parentProjectId); //내 프로젝트ID가 상위프로젝트인게 있는지
                if(projectClosures != null && projectClosures.size() > 0){
                    for(ProjectClosure projectClosure : projectClosures){
                        if(projectClosure.getParentProject().getId().equals(parentProjectId)){
                            downProjectIds.add(projectClosure.getProject().getId());
                            //widgetCondition.setDownProjectIds(downProjectIds);
                        }else{
                            downProjectIds.clear();
                        }
                    }
                }else{
                    downProjectIds.clear();
                }
                widgetCondition.setDownProjectIds(downProjectIds);
                List<Long> meAndDownProjectIds = Lists.newArrayList();
                meAndDownProjectIds.addAll(widgetCondition.getProjectIds());
                meAndDownProjectIds.addAll(widgetCondition.getDownProjectIds());
                widgetCondition.setMeAndDownProjectIds(meAndDownProjectIds);
            }
        }
    }
 
    //  전체 이슈 정보를 조회한다.
    @Override
    @Transactional(readOnly = true)
    public void findStatisticsIssue(Map<String, Object> resJsonData, WidgetCondition widgetCondition) {
        Long noAssigneeIssue = 0L;  //  미할당 이슈
        Long remainIssue = 0L;  //  잔여 이슈
        Long assigneeIssue = 0L;    //  할당된 이슈
        Long registerIssue = 0L; //  등록한 이슈
        Long delayIssue = 0L; //  지연된 이슈
        Long completeIssue = 0L; // 완료된 이슈
 
        widgetCondition.setLoginUserId(this.webAppUtil.getLoginId());
        widgetCondition.setWorkspaceId(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId());
        User user = this.webAppUtil.getLoginUserObject();
        UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId());
 
        if (widgetCondition.getProjectIds().size() > 0) {
            SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition);
            if (this.userWorkspaceService.checkWorkspaceManager(user)
                    || (MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE))) {
                remainIssue = this.widgetMapper.countRemainIssue(widgetCondition);   //  잔여 이슈
                delayIssue = this.widgetMapper.countTodayDelayIssue(widgetCondition); //  지연된 이슈
                assigneeIssue = this.widgetMapper.countAssigneeIssue(widgetCondition);   //  할당된 이슈
                registerIssue = this.widgetMapper.countTodayRegisterIssue(widgetCondition);    //  등록한 이슈
                noAssigneeIssue = this.widgetMapper.countNoAssigneeIssue(widgetCondition);   //  미할당 이슈
                completeIssue = this.widgetMapper.countCompleteIssue(widgetCondition); // 완료된 이슈
            } else {
                SetMyDepartmentId(widgetCondition);
                remainIssue = this.widgetMapper.countRemainIssueByDepartment(widgetCondition);   //  잔여 이슈
                delayIssue = this.widgetMapper.countTodayDelayIssueByDepartment(widgetCondition); //  지연된 이슈
                assigneeIssue = this.widgetMapper.countAssigneeIssueByDepartment(widgetCondition);   //  할당된 이슈
                registerIssue = this.widgetMapper.countTodayRegisterIssueByDepartment(widgetCondition);    //  등록한 이슈
                //noAssigneeIssue = this.widgetMapper.countNoAssigneeIssueByDepartment(widgetCondition);   //  일반 유저는 미할당 이슈 0개로 보이게
                completeIssue = this.widgetMapper.countCompleteIssueByDepartment(widgetCondition); // 완료된 이슈
            }
        }
 
        Map<String, Object> results = new HashMap<>();
        results.put("today", DateUtil.convertDateToStr(new Date(), "yyyy.MM.dd"));
        results.put("projectIds", widgetCondition.getProjectIds());
        results.put("noAssigneeIssue", noAssigneeIssue);
        results.put("registerIssue", registerIssue);
        results.put("assigneeIssue", assigneeIssue);
        results.put("delayIssue", delayIssue);
        results.put("remainIssue", remainIssue);
        results.put("completeIssue", completeIssue);
        //  업무 공간 만료가 7일전일 경우 표시
        results.put("workspace", this.workspaceService.getWorkspaceExpireDay());
 
        resJsonData.put("issueStatisticsWidget", results);
    }
 
    //  진행중인 프로젝트 현황 정보를 조회한다.
    @Override
    @Transactional(readOnly = true)
    public void findProjectProgress(Map<String, Object> resJsonData, WidgetCondition widgetCondition) {
        List<Map<String, Object>> progressingProjectDetails = Lists.newArrayList();
 
        User user = this.webAppUtil.getLoginUserObject();
        UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId());
 
        if (widgetCondition.getProjectIds().size() > 0) {
            SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition);
            if (this.userWorkspaceService.checkWorkspaceManager(user)
                    || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_PROJECT)) {
                progressingProjectDetails = this.widgetMapper.findProjectProgressAll(widgetCondition);
            } else {
                progressingProjectDetails = this.widgetMapper.findProjectProgress(widgetCondition);
            }
        }
 
        Long completeIssueCount = 0L;
        Long remainIssueCount = 0L;
 
        for (Map<String, Object> progressingProjectDetail : progressingProjectDetails) {
            Long completeCount = MapUtil.getLong(progressingProjectDetail, "close");    //  완료 이슈
            Long remainCount = MapUtil.getLong(progressingProjectDetail, "remain"); //  잔여 이슈
            //  관리자 정보를 파싱하여 관리자 명, 이메일, 프로필 정보를 추출한다.
            this.parseManagerInfo(MapUtil.getString(progressingProjectDetail, "managerInfo"), progressingProjectDetail);
            //  프로젝트 진행률 정보를 구한다.
            this.statisticsProject(completeCount, remainCount, progressingProjectDetail, "projectProgressPercent");
 
            if (completeCount != null) {
                completeIssueCount += completeCount;
            }
 
            if (remainCount != null) {
                remainIssueCount += remainCount;
            }
        }
        //  프로젝트 진행률
        Double progressPercent = ((double) completeIssueCount / ((double) completeIssueCount + (double) remainIssueCount)) * 100.0;
 
        if (progressPercent.isNaN()) {
            progressPercent = 0.0;
        }
 
        Map<String, Object> results = new HashMap<>();
        results.put("totalIssueCount", completeIssueCount + remainIssueCount);
        results.put("completeIssueCount", completeIssueCount);
        results.put("remainIssueCount", remainIssueCount);
        results.put("progressPercent", progressPercent);
        results.put("projects", progressingProjectDetails);
 
        resJsonData.put("projectProgressWidget", results);
    }
 
    //  관리자 정보를 파싱하여 관리자 명, 이메일, 프로필 정보를 추출한다.
    private void parseManagerInfo(String managerInfo, Map<String, Object> progressingProjectDetail) {
        if (managerInfo != null) {
            int count = 0;
 
            for (String text : managerInfo.split("%")) {
                if (!StringUtils.isEmpty(text)) {
 
                    if (count == 0) {
                        progressingProjectDetail.put("managerName", text);
                    }
 
                    if (count == 1) {
                        progressingProjectDetail.put("managerEmail", CommonUtil.decryptAES128(text));
                    }
 
                    if (count == 2) {
                        progressingProjectDetail.put("managerProfile", text);
                    }
                }
                count++;
            }
        }
    }
 
    //  프로젝트 진행률 정보를 구한다.
    private void statisticsProject(Long completeCount, Long remainCount, Map<String, Object> progressingProjectDetail, String mapKey) {
        Double projectProgressPercent = ((double) completeCount / ((double) completeCount + (double) remainCount)) * 100.0;
 
        if (projectProgressPercent.isNaN()) {
            projectProgressPercent = 0.0;
        }
 
        progressingProjectDetail.put(mapKey, projectProgressPercent);
    }
 
    //  나에게 할당된 이슈 정보를 조회한다.
    @Override
    @Transactional(readOnly = true)
    public void findMyAssigneeIssue(Map<String, Object> resJsonData, WidgetCondition widgetCondition, Pageable pageable) {
        widgetCondition.setPage(pageable.getPageNumber() * pageable.getPageSize());
        widgetCondition.setPageSize(pageable.getPageSize());
 
        //  할당된 잔여 이슈
        Map<String, Object> myIssueWidget = (Map<String, Object>) resJsonData.get("myIssueWidget");
        Long totalAssigneeRemainIssueCount = MapUtil.getLong(myIssueWidget, "totalAssigneeRemainIssueCount");
        if (totalAssigneeRemainIssueCount == null) {
            totalAssigneeRemainIssueCount = 0L;
        }
 
        //  오늘 할당된 이슈
        Long todayCount = 0L;
        List<Map<String, Object>> assigneeIssues = Lists.newArrayList();
        Long totalCount = 0L;
 
        if (widgetCondition.getProjectIds().size() > 0) {
            SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition);
            this.SetMyDepartmentId(widgetCondition);
            todayCount = this.widgetMapper.countTodayMyAssigneeIssue(widgetCondition);
            assigneeIssues = this.widgetMapper.findMyAssigneeIssue(widgetCondition);
            totalCount = this.widgetMapper.countMyAssigneeIssue(widgetCondition);
        }
 
        //  0.156 - 0.166
        int totalPage = (int) Math.ceil((totalCount - 1) / pageable.getPageSize()) + 1;
 
        Map<String, Object> results = new HashMap<>();
        results.put("todayCount", todayCount);
        results.put("remainCount", totalAssigneeRemainIssueCount);
        results.put("issues", assigneeIssues);
        results.put(Constants.REQ_KEY_PAGE_VO, new ResPage(pageable.getPageNumber(), pageable.getPageSize(),
                totalPage, totalCount));
 
        resJsonData.put("myAssigneeIssueWidget", results);
    }
 
    //  지연중인 이슈 정보를 조회한다.
    @Override
    @Transactional(readOnly = true)
    public void findDelayIssue(Map<String, Object> resJsonData, WidgetCondition widgetCondition, Pageable pageable) {
        widgetCondition.setPage(pageable.getPageNumber() * pageable.getPageSize());
        widgetCondition.setPageSize(pageable.getPageSize());
 
        List<Map<String, Object>> delayIssues = Lists.newArrayList();
        Long totalCount = 0L;
 
        if (widgetCondition.getProjectIds().size() > 0) {
            SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition);
 
            delayIssues = this.widgetMapper.findDelayIssue(widgetCondition);
            totalCount = this.widgetMapper.countDelayIssue(widgetCondition);
        }
 
        int totalPage = (int) Math.ceil((totalCount - 1) / pageable.getPageSize()) + 1;
        //  오늘 날짜를 기준으로 지연일을 구한다.
        this.setDelayDay(delayIssues);
 
        Map<String, Object> results = new HashMap<>();
        results.put("delayCount", totalCount);
        results.put("issues", delayIssues);
        results.put(Constants.REQ_KEY_PAGE_VO, new ResPage(pageable.getPageNumber(), pageable.getPageSize(),
                totalPage, totalCount));
        resJsonData.put("delayIssueWidget", results);
    }
 
    //  오늘 날짜를 기준으로 지연일을 구한다.
    private void setDelayDay(List<Map<String, Object>> delayIssues) {
        for (Map<String, Object> delayIssue : delayIssues) {
            String completeDate = MapUtil.getString(delayIssue, "completeDate");
            Date convertCompleteDate = DateUtil.convertStrToDate(completeDate, "yyyy.MM.dd");
            Integer diff = DateUtil.getDateDiff(convertCompleteDate, new Date());
            delayIssue.put("delayDay", diff);
        }
    }
 
    //  내가 등록한 이슈 정보를 조회한다.
    @Override
    @Transactional(readOnly = true)
    public void findRegisterIssue(Map<String, Object> resJsonData, WidgetCondition widgetCondition, Pageable pageable) {
        widgetCondition.setPage(pageable.getPageNumber() * pageable.getPageSize());
        widgetCondition.setPageSize(pageable.getPageSize());
 
        //  등록한 잔여 이슈
        Map<String, Object> myIssueWidget = (Map<String, Object>) resJsonData.get("myIssueWidget");
        Long totalRegisterRemainIssueCount = MapUtil.getLong(myIssueWidget, "totalRegisterRemainIssueCount");
        if (totalRegisterRemainIssueCount == null) {
            totalRegisterRemainIssueCount = 0L;
        }
 
        //  오늘 등록한 이슈
        Long todayCount = 0L;
        List<Map<String, Object>> registerIssues = Lists.newArrayList();
        Long totalCount = 0L;
 
        if (widgetCondition.getProjectIds().size() > 0) {
            SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition);
            todayCount = this.widgetMapper.countTodayRegisterIssue(widgetCondition);
            registerIssues = this.widgetMapper.findRegisterIssue(widgetCondition);
            totalCount = this.widgetMapper.countRegisterIssue(widgetCondition);
        }
 
        int totalPage = (int) Math.ceil((totalCount - 1) / pageable.getPageSize()) + 1;
        Map<String, Object> results = new HashMap<>();
 
        results.put("todayCount", todayCount);
        results.put("remainCount", totalRegisterRemainIssueCount);
        results.put("issues", registerIssues);
        results.put(Constants.REQ_KEY_PAGE_VO, new ResPage(pageable.getPageNumber(), pageable.getPageSize(),
                totalPage, totalCount));
        resJsonData.put("registerIssueWidget", results);
    }
 
    //  프로젝트 별 멤버 진행률 정보를 조회한다.
    @Override
    @Transactional(readOnly = true)
    public void findMemberProgress(Map<String, Object> resJsonData, WidgetCondition widgetCondition, Boolean getWidgetCondition) {
        //  위젯 검색 조건을 만들고 전체 프로젝트 정보를 리턴한다.
        Map<String, Object> results = this.makeWidgetConditionAllProject(widgetCondition, getWidgetCondition);
 
        widgetCondition.setLoginUserId(this.webAppUtil.getLoginId());
        widgetCondition.setWorkspaceId(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId());
        User user = this.webAppUtil.getLoginUserObject();
        UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId());
 
        if (widgetCondition.getProjectId() != null) {
            SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition);
            List<Map<String, Object>> projectMemberIssues = Lists.newArrayList();
            if (this.userWorkspaceService.checkWorkspaceManager(user)
                    || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)) {
                projectMemberIssues = this.widgetMapper.findProjectMemberIssue(widgetCondition);
            } else {
                projectMemberIssues = this.widgetMapper.findProjectMemberIssueByDepartment(widgetCondition);
            }
 
            for (Map<String, Object> projectMemberIssue : projectMemberIssues) {
                //String departmentName = MapUtil.getString(projectMemberIssue, "departmentName");
                Long completeCount = MapUtil.getLong(projectMemberIssue, "completeCount");
                Long remainCount = MapUtil.getLong(projectMemberIssue, "remainCount");
                //projectMemberIssue.put("account", CommonUtil.decryptAES128(MapUtil.getString(projectMemberIssue, "account")));
 
                //  프로젝트 진행률 정보를 구한다.
                this.statisticsProject(completeCount, remainCount, projectMemberIssue, "projectProgressPercent");
            }
            //  멤버별 정보
            results.put("members", projectMemberIssues);
        } else {
            results.put("members", Lists.newArrayList());
        }
 
        resJsonData.put("memberProgressWidget", results);
    }
 
    //  나의 이슈 현황 정보를 조회한다.
    @Override
    @Transactional(readOnly = true)
    public void findMyIssueDetail(Map<String, Object> resJsonData, WidgetCondition widgetCondition) {
        List<Map<String, Object>> registerCompleteIssueMaps = Lists.newArrayList();
        List<Map<String, Object>> registerRemainIssueMaps = Lists.newArrayList();
        List<Map<String, Object>> assigneeCompleteIssueMaps = Lists.newArrayList();
        List<Map<String, Object>> assigneeRemainIssueMaps = Lists.newArrayList();
 
        if (widgetCondition.getProjectIds().size() > 0) {
            SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition);
 
            registerCompleteIssueMaps = this.widgetMapper.findMyRegisterCompleteIssue(widgetCondition);
            registerRemainIssueMaps = this.widgetMapper.findMyRegisterRemainIssue(widgetCondition);
            assigneeCompleteIssueMaps = this.widgetMapper.findMyAssigneeCompleteIssue(widgetCondition);
            assigneeRemainIssueMaps = this.widgetMapper.findMyAssigneeRemainIssue(widgetCondition);
        }
 
        Map<String, Object> result = new HashMap<>();
        Long totalRegisterRemainIssueCount = 0L;    //  등록한 이슈 중 잔여 이슈 총 갯수
        Long totalAssigneeRemainIssueCount = 0L;    //  할당된 이슈 중 잔여 이슈 총 갯수
 
        for (Map<String, Object> project : widgetCondition.getProjects()) {
            Long projectId = MapUtil.getLong(project, "id");
            if (projectId != null) {
                //  Map 에서 등록/담당하는 이슈 갯수를 추출한다.
                Long registerCompleteIssueCount = this.getMyIssueCount(projectId, registerCompleteIssueMaps);
                Long registerRemainIssueCount = this.getMyIssueCount(projectId, registerRemainIssueMaps);
                Long assigneeCompleteIssueCount = this.getMyIssueCount(projectId, assigneeCompleteIssueMaps);
                Long assigneeRemainIssueCount = this.getMyIssueCount(projectId, assigneeRemainIssueMaps);
                project.put("registerCompleteIssueCount", registerCompleteIssueCount);
                project.put("registerRemainIssueCount", registerRemainIssueCount);
                project.put("totalRegisterIssueCount", (registerCompleteIssueCount + registerRemainIssueCount));
                project.put("assigneeCompleteIssueCount", assigneeCompleteIssueCount);
                project.put("assigneeRemainIssueCount", assigneeRemainIssueCount);
                project.put("totalAssigneeIssueCount", (assigneeCompleteIssueCount + assigneeRemainIssueCount));
                this.statisticsProject(registerCompleteIssueCount, registerRemainIssueCount, project, "registerIssueProgressPercent");
                this.statisticsProject(assigneeCompleteIssueCount, assigneeRemainIssueCount, project, "assigneeIssueProgressPercent");
                totalRegisterRemainIssueCount += registerRemainIssueCount;
                totalAssigneeRemainIssueCount += assigneeRemainIssueCount;
            }
        }
 
        result.put("issues", widgetCondition.getProjects());
        result.put("totalRegisterRemainIssueCount", totalRegisterRemainIssueCount);
        result.put("totalAssigneeRemainIssueCount", totalAssigneeRemainIssueCount);
        resJsonData.put("myIssueWidget", result);
    }
 
    //  Map 에서 등록/담당하는 이슈 갯수를 추출한다.
    private long getMyIssueCount(Long projectId, List<Map<String, Object>> maps) {
        long issueCount = 0L;
 
        for (Map<String, Object> map : maps) {
            Long issueProjectId = MapUtil.getLong(map, "projectId");
            if (issueProjectId != null) {
                if (projectId.equals(issueProjectId)) {
                    Long count = MapUtil.getLong(map, "issueCount");
                    if (count != null) {
                        issueCount = count;
                    }
                }
            }
        }
 
        return issueCount;
    }
 
    //  위험 관리 이슈 정보를 조회한다.
    @Override
    @Transactional(readOnly = true)
    public void findRiskIssue(Map<String, Object> resJsonData, WidgetCondition widgetCondition, Pageable pageable) {
        widgetCondition.setPage(pageable.getPageNumber() * pageable.getPageSize());
        widgetCondition.setPageSize(pageable.getPageSize());
 
        //Map<String, Object> countChangeStatusAndAssigneeIssue = new HashMap<>();
        //countChangeStatusAndAssigneeIssue.put("changeAssigneeCount", 0L);
        Map<String, Object> countChangeStatusAndDepartmentIssue = new HashMap<>();
        countChangeStatusAndDepartmentIssue.put("changeDepartmentCount", 0L);
        countChangeStatusAndDepartmentIssue.put("changeIssueStatusCount", 0L);
        //  0.212 - 0.213
        List<Map<String, Object>> riskIssues = Lists.newArrayList();
        //  0.244 - 0.248
 
        Long totalCount = 0L;
 
        if (widgetCondition.getProjectIds().size() > 0) {
            SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition);
            //countChangeStatusAndAssigneeIssue = this.widgetMapper.countChangeStatusAndAssigneeIssue(widgetCondition);
            countChangeStatusAndDepartmentIssue = this.widgetMapper.countChangeStatusAndDepartmentIssue(widgetCondition);
            riskIssues = this.widgetMapper.findRiskIssue(widgetCondition);
            totalCount = this.widgetMapper.countRiskIssue(widgetCondition);
        }
 
        //  이슈의 담당자 정보를 가져온다.
        if (riskIssues.size() > 0) {
            this.setIssueUsers(riskIssues);
        }
 
        int totalPage = (int) Math.ceil((totalCount - 1) / pageable.getPageSize()) + 1;
        Map<String, Object> results = new HashMap<>();
 
        //results.put("changeAssigneeCount", MapUtil.getLong(countChangeStatusAndAssigneeIssue, "changeAssigneeCount"));
        results.put("changeDepartmentCount", MapUtil.getLong(countChangeStatusAndDepartmentIssue, "changeDepartmentCount"));
        results.put("changeIssueStatusCount", MapUtil.getLong(countChangeStatusAndDepartmentIssue, "changeIssueStatusCount"));
        results.put("issues", riskIssues);
        results.put(Constants.REQ_KEY_PAGE_VO, new ResPage(pageable.getPageNumber(), pageable.getPageSize(),
                totalPage, totalCount));
        resJsonData.put("riskIssueWidget", results);
    }
 
    //  이슈의 담당자 정보를 가져온다.
    private void setIssueUsers(List<Map<String, Object>> riskIssues) {
        List<String> issueIds = Lists.newArrayList();
 
        for (Map<String, Object> riskIssue : riskIssues) {
            issueIds.add(MapUtil.getString(riskIssue, "id"));
        }
 
        List<Map<String, Object>> issueUsers = this.issueMapper.findIssueUser(new IssueCondition(issueIds));
        Map<String, Object> mapIssueUsers = new HashMap<>();    //  이슈 번호를 키로해서 이슈 담당자 정보를 저장한다.
 
        for (Map<String, Object> issueUser : issueUsers) {
            String issueId = MapUtil.getString(issueUser, "issueId");
            issueUser.put("account", CommonUtil.decryptAES128(MapUtil.getString(issueUser, "account")));
 
            //  존재하지 않을 경우
            if (mapIssueUsers.get(issueId) == null) {
                List<Map<String, Object>> users = Lists.newArrayList();
                users.add(issueUser);
                mapIssueUsers.put(issueId, users);
            } else {
                //  이미 존재할 경우
                List<Map<String, Object>> users = (List<Map<String, Object>>) mapIssueUsers.get(issueId);
                users.add(issueUser);
                mapIssueUsers.put(issueId, users);
            }
        }
 
        for (Map<String, Object> riskIssue : riskIssues) {
            String issueId = MapUtil.getString(riskIssue, "id");
            if (mapIssueUsers.get(issueId) == null) {
                riskIssue.put("issueUsers", Lists.newArrayList());
            } else {
                riskIssue.put("issueUsers", mapIssueUsers.get(issueId));
            }
        }
    }
 
    //  전체 이슈 처리 현황
    @Override
    @Transactional(readOnly = true)
    public void findIssueComplete(Map<String, Object> resJsonData, WidgetCondition widgetCondition, String searchPeriod) {
        //  검색 조건이 기본 설정일 때 - 최근 7일
        if (searchPeriod == null) {
            widgetCondition.setSearchPeriod(DateUtil.LAST_SEVEN_DAYS);
        } else {
            widgetCondition.setSearchPeriod(searchPeriod);
        }
 
        //  검색 일자를 구한다.
        List<Date> searchDates = CommonUtil.findSearchPeriod(widgetCondition.getSearchPeriod());
 
        //  날짜가 검색되지 않았으면 오류
        if (searchDates.size() < 1) {
            throw new OwlRuntimeException(
                    this.messageAccessor.getMessage(MsgConstants.WIDGET_SEARCH_DATE_NOT_FOUND));
        }
 
        //  위젯 검색 조건에 시작일, 종료일을 설정한다.
        widgetCondition.setSearchStartDate(DateUtil.convertDateToYYYYMMDD(searchDates.get(0)));
        widgetCondition.setSearchEndDate(DateUtil.convertDateToYYYYMMDD(DateUtil.addDays(searchDates.get(searchDates.size() - 1), 1)));
 
        //  이슈
        List<Map<String, Object>> dateCounts = Lists.newArrayList();
        Long totalIssueCount = 0L;
 
        if (widgetCondition.getProjectIds().size() > 0) {
            SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition);
 
            dateCounts = this.widgetMapper.findIssueComplete(widgetCondition);
            totalIssueCount = this.widgetMapper.countTotalIssue(widgetCondition);
        }
 
        Map<String, Object> results = new HashMap<>();
        //  전체 이슈 처리 현황을 날짜별로 구분해서 저장한다.
        this.setIssueCompleteCountList(searchDates, dateCounts, totalIssueCount, results);
 
        resJsonData.put("issueCompleteWidget", results);
    }
 
    //  전체 이슈 처리 현황을 날짜별로 구분해서 저장한다.
    private void setIssueCompleteCountList(List<Date> searchDates, List<Map<String, Object>> dateCounts, Long totalIssueCount, Map<String, Object> results) {
        List<Map<String, Object>> issueCompleteCountList = Lists.newArrayList();
        Integer totalCompleteCount = 0;
 
        //  일자 별로 기본 값 셋팅
        for (Date searchDate : searchDates) {
            Map<String, Object> result = new HashMap<>();
            result.put("modifyDate", DateUtil.convertDateToYYYYMMDD(searchDate));
            result.put("issueCount", 0);
 
            //  수정일
            for (Map<String, Object> dateCount : dateCounts) {
                String targetDate = MapUtil.getString(dateCount, "modifyDate");
 
                if (DateUtil.convertDateToYYYYMMDD(searchDate).equals(targetDate)) {
                    Integer issueCount = MapUtil.getInteger(dateCount, "issueCount");
                    totalCompleteCount += issueCount;
                    result.put("issueCount", issueCount);
                    break;
                }
            }
 
            issueCompleteCountList.add(result);
        }
 
        for (Map<String, Object> issueCompleteCount : issueCompleteCountList) {
            String modifyDate = MapUtil.getString(issueCompleteCount, "modifyDate");
            Date convertModifyDate = DateUtil.convertStrToDate(modifyDate, "yyyy-MM-dd");
            issueCompleteCount.put("modifyDate", DateUtil.convertDateToStr(convertModifyDate, "MM.dd"));
        }
 
        results.put("issueCompleteCountList", issueCompleteCountList);
        results.put("completeCount", totalCompleteCount);
        results.put("totalIssueCount", totalIssueCount);
 
        //  처리율
        Double issueCompleteWidget = ((double) totalCompleteCount / (double) totalIssueCount) * 100.0;
 
        if (issueCompleteWidget.isNaN()) {
            issueCompleteWidget = 0.0;
        }
 
        Double dayIssueCompleteAvg = ((double) totalCompleteCount / searchDates.size());
 
        results.put("dayIssueCompleteAvg", dayIssueCompleteAvg);
        results.put("issueProgressPercent", issueCompleteWidget);
    }
 
    //  상태별 이슈 현황
    @Override
    @Transactional(readOnly = true)
    public void findByStandIssueStatus(Map<String, Object> resJsonData, WidgetCondition widgetCondition) {
        List<IssueStatus> issueStatuses = this.issueStatusService.findByWorkspaceId(widgetCondition.getWorkspaceId());
        widgetCondition.setIssueStatuses(issueStatuses);
 
        List<Map<String, Object>> issueStatusMaps = Lists.newArrayList();
 
        for (IssueStatus issueStatus : issueStatuses) {
            Map<String, Object> issueStatusMap = new HashMap<>();
            issueStatusMap.put("key", issueStatus.getName());
            issueStatusMap.put("color", issueStatus.getColor());
            issueStatusMap.put("values", Lists.newArrayList());
            issueStatusMaps.add(issueStatusMap);
        }
 
        List<Map<String, Object>> results = Lists.newArrayList();
        User user = this.webAppUtil.getLoginUserObject();
        UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId());
 
        if (widgetCondition.getProjectIds().size() > 0) {
            SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition);
            if (this.userWorkspaceService.checkWorkspaceManager(user)
                    || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)) {
                results = this.widgetMapper.findByStandIssueStatus(widgetCondition);
            }else {
                results = this.widgetMapper.findByStandIssueStatusOfDepartment(widgetCondition);
            }
        }
 
        for (Map<String, Object> result : results) {
            for (Map<String, Object> issueStatusMap : issueStatusMaps) {
                String key = MapUtil.getString(issueStatusMap, "key");
                Long value = MapUtil.getLong(result, key);
                List<Map<String, Object>> values = (List<Map<String, Object>>) issueStatusMap.get("values");
                Map<String, Object> map = new HashMap<>();
                map.put("x", MapUtil.getString(result, "projectName"));
                map.put("y", value);
                values.add(map);
            }
        }
 
        resJsonData.put("issueStatusWidget", issueStatusMaps);
    }
 
    //  이슈 타입 별 이슈 정보를 조회한다.
    @Override
    @Transactional(readOnly = true)
    public void findByStandIssueType(Map<String, Object> resJsonData, WidgetCondition widgetCondition, Boolean getWidgetCondition) {
        //  위젯 검색 조건을 얻어야 할 상황일 때 - 화면에서 탭을 눌러 데이터를 재요청했을 때 위젯 검색 조건을 만들고 전체 프로젝트 정보를 리턴한다.
        Map<String, Object> results = this.makeWidgetConditionAllProject(widgetCondition, getWidgetCondition);
        User user = this.webAppUtil.getLoginUserObject();
        UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId());
        if (widgetCondition.getProjectId() != null) {
            SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition);
            if (widgetCondition.getMeAndDownProjectIds() != null) {
                for (Long meAndProjectId : widgetCondition.getMeAndDownProjectIds()) {
                    if(meAndProjectId == -1L) {
                        results.replace("projectVos", null);
                    }
                }
            }
            List<Map<String, Object>> issueTypeIssues = Lists.newArrayList();
            if (this.userWorkspaceService.checkWorkspaceManager(user)
                    || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)) {
                issueTypeIssues = this.widgetMapper.findByStandIssueType(widgetCondition);
            } else {
                issueTypeIssues = this.widgetMapper.findByStandIssueTypeOfDepartment(widgetCondition);
            }
            //  이슈 정보
            results.put("issues", issueTypeIssues);
        } else {
            results.put("issues", Lists.newArrayList());
        }
 
        resJsonData.put("issueTypeWidget", results);
    }
 
    //  위젯 검색 조건을 만들고 전체 프로젝트 정보를 리턴한다.
    private Map<String, Object> makeWidgetConditionAllProject(WidgetCondition widgetCondition, boolean getWidgetCondition) {
        Map<String, Object> results = new HashMap<>();
        SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition);
 
        //  위젯 검색 조건을 얻어야 할 상황일 때 - 화면에서 탭을 눌러 데이터를 재요청했을 때
        if (getWidgetCondition) {
            WidgetCondition condition = this.makeWidgetCondition();
            widgetCondition.setProjectIds(condition.getProjectIds());
        }
 
        //  전체 위젯 검색 으로 들어왔을 경우 - findAllWidget()
        if (widgetCondition.getProjectId() == null && (widgetCondition.getProjectIds().size() > 0) && !getWidgetCondition) {
            widgetCondition.setProjectId(widgetCondition.getProjectIds().get(0));
        }
 
        if (widgetCondition.getProjectId() != null) {
            List<Project> projects = this.projectService.findAll(widgetCondition.getProjectIds());  //  전체 프로젝트
            Project project = this.projectService.findOne(widgetCondition.getProjectId());
            results.put("projectVos", ConvertUtil.convertObjectsToClasses(projects, ProjectVo.class));
 
            if (project != null) {
                results.put("projectName", project.getName());
            } else  {
                results.put("projectName", "");
            }
        } else {
            results.put("projectVos", Lists.newArrayList());
            results.put("projectName", "");
        }
 
        return results;
    }
 
 
    //중요도 별 이슈 현황 정보를 조회한다.
    @Override
    @Transactional(readOnly = true)
    public void findSeverityIssueWidget(Map<String, Object> resJsonData, WidgetCondition widgetCondition, Map<String, Object> parameter, Pageable pageable) {
        widgetCondition.setPage(pageable.getPageNumber() * pageable.getPageSize());
        widgetCondition.setPageSize(pageable.getPageSize());
 
        Long severityId = 1L;
        Long projectId = null;
        if (parameter != null) {
            severityId = MapUtil.getLong(parameter,"severityId");
            projectId = MapUtil.getLong(parameter,"projectId");
        }
 
        //  검색조건 기본 설정 값 - 중요도: 심각
        if (severityId != null) {
            widgetCondition.setSeverityId(severityId);
        }
 
        if (projectId != null) {
            widgetCondition.setProjectIds(projectId);
            widgetCondition.setProjectId(projectId);
        }
 
        //중요도 별 이슈
        List<Map<String, Object>> severityCounts = Lists.newArrayList();
        List<Map<String, Object>> severityIssues = Lists.newArrayList();
        Long totalCount = 0L;
 
        widgetCondition.setLoginUserId(this.webAppUtil.getLoginId());
        widgetCondition.setWorkspaceId(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId());
        User user = this.webAppUtil.getLoginUserObject();
        UserLevel userLevel = this.userLevelService.getUserLevel(user.getUserLevel().getId());
 
        if (widgetCondition.getProjectIds().size() > 0) {
            SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition);
            if (this.userWorkspaceService.checkWorkspaceManager(user)
                    || MngPermission.checkMngPermission(userLevel.getPermission(), MngPermission.USER_PERMISSION_MNG_ISSUE)) {
                severityCounts = this.widgetMapper.countSeverityIssue(widgetCondition);
                severityIssues = this.widgetMapper.findSeverityIssues(widgetCondition);
                totalCount = this.widgetMapper.countSearchIssue(widgetCondition);
            }else {
                SetMyDepartmentId(widgetCondition);
                severityCounts = this.widgetMapper.countSeverityIssueByDepartment(widgetCondition);
                severityIssues = this.widgetMapper.findSeverityIssuesByDepartment(widgetCondition);
                totalCount = this.widgetMapper.countSearchIssueByDepartment(widgetCondition);
            }
        }
 
        Long criticalIssueCount = 0L, majorIssueCount = 0L, minorIssueCount = 0L, trivialIssueCount = 0L;
 
        for (Map<String, Object> severityCount : severityCounts) {
            Long criticalCount = MapUtil.getLong(severityCount, "critical");    // 중요도: 심각 갯수
            Long majorCount = MapUtil.getLong(severityCount, "major");  // 중요도: 높음 갯수
            Long minorCount = MapUtil.getLong(severityCount, "minor");  // 중요도: 보통 갯수
            Long trivialCount = MapUtil.getLong(severityCount, "trivial");  // 중요도: 낮음 갯수
 
            if (criticalCount != null) {
                criticalIssueCount += criticalCount;
            }
 
            if (majorCount != null) {
                majorIssueCount += majorCount;
            }
 
            if (minorCount != null) {
                minorIssueCount += minorCount;
            }
 
            if (trivialCount != null) {
                trivialIssueCount += trivialCount;
            }
        }
 
        int totalPage = (int) Math.ceil((totalCount - 1) / pageable.getPageSize()) + 1;
 
        Map<String, Object> results = new HashMap<>();
        results.put("criticalIssueCount", criticalIssueCount);
        results.put("majorIssueCount", majorIssueCount);
        results.put("minorIssueCount", minorIssueCount);
        results.put("trivialIssueCount", trivialIssueCount);
        results.put(Constants.REQ_KEY_PAGE_VO, new ResPage(pageable.getPageNumber(), pageable.getPageSize(),
                totalPage, totalCount));
        results.put("issues", severityIssues);
        resJsonData.put("severityIssueWidget", results);
    }
 
 
    //  엑셀 다운로드
    @Override
    @Transactional
    public ModelAndView downloadExcel(HttpServletRequest request, Model model) {
        //  사용 공간에서 로그인한 사용자가 비활성인지 확인하고 비활성일 경우 엑셀 다운로드를 금지한다.
        ModelAndView modelAndView = this.workspaceService.checkUseExcelDownload(model);
        if (modelAndView != null) {
            return modelAndView;
        }
 
        Map<String, Object> params = new HashMap<>();
 
        Enumeration e = request.getParameterNames();
        while (e.hasMoreElements()) {
            String name = (String) e.nextElement();
            if (!org.springframework.util.StringUtils.isEmpty(request.getParameter(name))) {
                params.put(name, request.getParameter(name));
            }
        }
 
        //  다운로드 위젯 유형에 오류가 있을 경우 다운로드된다. - 기본적으로 Exception 발생할 때 사용될 엑셀 형식을 저장한다.
        ExportExcelVo excelInfo = this.excelConditionCheck.makeEmptyDownloadExcel();
 
        String downloadWidgetType = MapUtil.getString(params, "downloadWidgetType");
        if (downloadWidgetType == null) {
            downloadWidgetType = "";
            excelInfo.setFileName(this.messageAccessor.message("common.typeErrorDownloadWidget")); // 다운로드 위젯 유형 오류
        }
 
        switch (downloadWidgetType) {
            case "PROJECT_PROGRESS":
                //  진행중인 프로젝트 현황 정보를 엑셀로 다운로드 한다.
                excelInfo = this.downloadExcelProjectProgress();
                break;
            case "MY_ASSIGNEE_ISSUE":
                //  나에게 할당된 이슈 정보를 엑셀로 다운로드 한다.
                excelInfo = this.downloadExcelMyAssigneeIssue();
                break;
            case "RISK_ISSUE":
                //  위험 관리 정보를 엑셀로 다운로드 한다.
                excelInfo = this.downloadExcelRiskIssue();
                break;
            case "REGISTER_ISSUE":
                //  내가 등록한 이슈 정보를 엑셀로 다운로드 한다.
                excelInfo = this.downloadExcelRegisterIssue();
                break;
            case "DELAY_ISSUE":
                //  지연 중인 이슈 정보를 엑셀로 다운로드 한다.
                excelInfo = this.downloadExcelDelayIssue();
                break;
            case "MEMBER_PROGRESS":
                //  프로젝트 별 멤버 진행률 정보를 엑셀로 다운로드 한다.
                excelInfo = this.downloadExcelMemberProgress(MapUtil.getLong(params, "projectId"));
                break;
            case "MY_ISSUE":
                //  나의 이슈 정보를 엑셀로 다운로드 한다.
                excelInfo = this.downloadExcelMyIssue();
                break;
            case "SEVERITY_ISSUE":
                //  중요도 별 이슈 정보를 엑셀로 다운로드 한다.
                excelInfo = this.downloadExcelSeverityIssue(MapUtil.getLong(params, "severityId"));
                break;
        }
 
        model.addAttribute(Constants.EXCEL, excelInfo);
        return new ModelAndView(this.excelView);
    }
 
 
    //  진행중인 프로젝트 현황 정보를 엑셀로 다운로드 한다.
    private ExportExcelVo downloadExcelProjectProgress() {
        Map<String, Object> resJsonData = new HashMap<>();
        //  진행 중인 프로젝트 현황
        this.findProjectProgress(resJsonData, this.makeWidgetCondition());
 
        Map<String, Object> projectProgressWidget = (Map<String, Object>) MapUtil.getObject(resJsonData, "projectProgressWidget");
        List<Map<String, Object>> projects = (List) MapUtil.getObject(projectProgressWidget, "projects");
 
 
        for (Map<String, Object> project : projects) {
            //  매니저 정보 변환
            project.put("manager", MapUtil.getString(project, "managerName") + "(" + MapUtil.getString(project, "managerEmail") + ")");
            //  기간 정보 변환
            project.put("period", MapUtil.getString(project, "startDate") + " - " + MapUtil.getString(project, "endDate"));
            //  진행률 자리수 제한
            Double projectProgressPercent = MapUtil.getDouble(project, "projectProgressPercent");
            project.put("projectProgressPercent", String.format("%.1f", projectProgressPercent) + "%");
 
            //  이슈 키운트 정보 변환
            int closeCount = MapUtil.getInteger(project, "close");
            int remainCount = MapUtil.getInteger(project, "remain");
 
            try {
                int totalCount = closeCount + remainCount;
                project.put("issueCount", CommonUtil.getDecimalFormat(MapUtil.getInteger(project, "close")) + " / " + CommonUtil.getDecimalFormat(totalCount));
            } catch (Exception e) {
                log.debug("downloadExcelProjectProgress Null Exception");
            }
        }
 
        ExportExcelVo excelInfo = new ExportExcelVo();
        excelInfo.setFileName(this.messageAccessor.message("common.inProgressProjectStatus")); // 진행 중인 프로젝트 현황
        excelInfo.setDatas((List) MapUtil.getObject(projectProgressWidget, "projects"));
        excelInfo.addAttrInfos(new ExportExcelAttrVo("name", this.messageAccessor.message("common.project"), 40, ExportExcelAttrVo.ALIGN_LEFT)); // 프로젝트
        excelInfo.addAttrInfos(new ExportExcelAttrVo("manager", this.messageAccessor.message("common.admin"), 20, ExportExcelAttrVo.ALIGN_CENTER)); // 관리자
        excelInfo.addAttrInfos(new ExportExcelAttrVo("projectProgressPercent", this.messageAccessor.message("common.progressPercent"), 6, ExportExcelAttrVo.ALIGN_CENTER)); //진행률
        excelInfo.addAttrInfos(new ExportExcelAttrVo("issueCount", this.messageAccessor.message("common.issue"), 6, ExportExcelAttrVo.ALIGN_CENTER)); // 이슈
        excelInfo.addAttrInfos(new ExportExcelAttrVo("teamCount", this.messageAccessor.message("common.teamMember"), 6, ExportExcelAttrVo.ALIGN_CENTER)); // 팀원
        excelInfo.addAttrInfos(new ExportExcelAttrVo("period", this.messageAccessor.message("common.period"), 15, ExportExcelAttrVo.ALIGN_CENTER)); // 기간
 
        return excelInfo;
    }
 
    //  나에게 할당된 이슈 정보를 엑셀로 다운로드 한다.
    private ExportExcelVo downloadExcelMyAssigneeIssue() {
        WidgetCondition widgetCondition = this.makeWidgetCondition();
 
        /*widgetCondition.setLoginUserId(this.webAppUtil.getLoginId());
        widgetCondition.setWorkspaceId(this.userService.getUser(this.webAppUtil.getLoginId()).getLastWorkspaceId());
        User user = this.webAppUtil.getLoginUserObject();*/
 
        //  나에게 할당된 이슈
        List<Map<String, Object>> assigneeIssues = Lists.newArrayList();
        if (widgetCondition.getProjectIds().size() > 0) {
            //if (this.userWorkspaceService.checkWorkspaceManager(user)) {
            assigneeIssues = this.widgetMapper.findMyAssigneeIssue(this.makeWidgetCondition());
            /*} else {
                assigneeIssues = this.widgetMapper.findMyAssigneeIssueByDepartment(this.makeWidgetCondition());
            }*/
        }
 
        ExportExcelVo excelInfo = new ExportExcelVo();
        excelInfo.setFileName(this.messageAccessor.message("common.assignedToMeIssue")); // 나에게 할당된 이슈
        excelInfo.setDatas(assigneeIssues);
        excelInfo.addAttrInfos(new ExportExcelAttrVo("issueKey", this.messageAccessor.message("common.issueKey"), 6, ExportExcelAttrVo.ALIGN_CENTER)); // 이슈 번호
        excelInfo.addAttrInfos(new ExportExcelAttrVo("registerDate", this.messageAccessor.message("common.registerDate"), 8, ExportExcelAttrVo.ALIGN_CENTER)); // 등록일
        excelInfo.addAttrInfos(new ExportExcelAttrVo("projectName", this.messageAccessor.message("common.project"), 15, ExportExcelAttrVo.ALIGN_LEFT)); // 프로젝트
        excelInfo.addAttrInfos(new ExportExcelAttrVo("title", this.messageAccessor.message("common.issueTitle"), 40, ExportExcelAttrVo.ALIGN_LEFT)); // 이슈
        excelInfo.addAttrInfos(new ExportExcelAttrVo("issueStatusName", this.messageAccessor.message("common.status"), 6, ExportExcelAttrVo.ALIGN_CENTER)); // 상태
        excelInfo.addAttrInfos(new ExportExcelAttrVo("completeDate", this.messageAccessor.message("common.endDate"), 15, ExportExcelAttrVo.ALIGN_CENTER)); // 종료일
        return excelInfo;
    }
 
    //  위험 관리 이슈 정보를 엑셀로 다운로드 한다.
    private ExportExcelVo downloadExcelRiskIssue() {
        WidgetCondition widgetCondition = this.makeWidgetCondition();
        //  위험 관리 이슈
        List<Map<String, Object>> riskIssues = Lists.newArrayList();
 
        if (widgetCondition.getProjectIds().size() > 0) {
            riskIssues = this.widgetMapper.findRiskIssue(this.makeWidgetCondition());
        }
 
        //  이슈의 담당자 정보를 가져온다.
        this.setIssueUsers(riskIssues);
 
        for (Map<String, Object> risk : riskIssues) {
            String riskType = "";
            String changeAssigneeType = MapUtil.getString(risk, "changeAssigneeType");
            String changeIssueStatusType = MapUtil.getString(risk, "changeIssueStatusType");
 
            if (changeAssigneeType != null) {
                if (changeAssigneeType.equals("1")) {
                    riskType = this.messageAccessor.message("common.reversalAssigneeTeamUpdate"); // 빈번한 담당부서 변경
                }
            }
 
            if (changeIssueStatusType != null) {
                if (changeIssueStatusType.equals("1")) {
                    riskType = this.messageAccessor.message("common.reversalStatusUpdate"); // 번복되는 상태 변경
                }
            }
 
            if (changeAssigneeType != null && changeIssueStatusType != null) {
                if (changeAssigneeType.equals("1") && changeIssueStatusType.equals("1")) {
                    riskType = this.messageAccessor.message("common.reversalAssigneeTeamUpdate") + '\n' + this.messageAccessor.message("common.reversalStatusUpdate"); // 빈번한 담당부서 변경, 번복되는 상태 변경
                }
            }
 
            risk.put("riskType", riskType);
 
            List<Map<String, Object>> issueUsers = (List<Map<String, Object>>) MapUtil.getObject(risk, "issueUsers");
 
            StringBuilder stringBuilder = new StringBuilder();
 
            for (Map<String, Object> issueUser : issueUsers) {
                if (!StringUtils.isEmpty(stringBuilder.toString())) {
                    stringBuilder.append("\n");
                }
 
                stringBuilder.append(MapUtil.getString(issueUser, "name"));
                stringBuilder.append("(");
                stringBuilder.append(MapUtil.getString(issueUser, "account"));
                stringBuilder.append(") ");
            }
 
            risk.put("issueUsers", stringBuilder.toString());
        }
 
        ExportExcelVo excelInfo = new ExportExcelVo();
        excelInfo.setFileName(this.messageAccessor.message("common.managementRisk")); // 위험 관리
        excelInfo.setDatas(riskIssues);
        excelInfo.addAttrInfos(new ExportExcelAttrVo("issueKey", this.messageAccessor.message("common.issueKey"), 6, ExportExcelAttrVo.ALIGN_CENTER)); // 이슈 번호
        excelInfo.addAttrInfos(new ExportExcelAttrVo("riskType", this.messageAccessor.message("common.division"), 15, ExportExcelAttrVo.ALIGN_CENTER)); // 구분
        excelInfo.addAttrInfos(new ExportExcelAttrVo("projectName", this.messageAccessor.message("common.project"), 15, ExportExcelAttrVo.ALIGN_LEFT)); // 프로젝트
        excelInfo.addAttrInfos(new ExportExcelAttrVo("title", this.messageAccessor.message("common.issueTitle"), 40, ExportExcelAttrVo.ALIGN_LEFT)); // 이슈
        excelInfo.addAttrInfos(new ExportExcelAttrVo("issueStatusName", this.messageAccessor.message("common.status"), 6, ExportExcelAttrVo.ALIGN_CENTER)); // 상태
        excelInfo.addAttrInfos(new ExportExcelAttrVo("issueUsers", this.messageAccessor.message("common.assignee"), 20, ExportExcelAttrVo.ALIGN_CENTER)); // 담당자
        return excelInfo;
    }
 
    //  내가 등록한 이슈 정보를 엑셀로 다운로드 한다.
    private ExportExcelVo downloadExcelRegisterIssue() {
        WidgetCondition widgetCondition = this.makeWidgetCondition();
        List<Map<String, Object>> registerIssues = Lists.newArrayList();
        Long totalCount = 0L;
 
        if (widgetCondition.getProjectIds().size() > 0) {
            totalCount = this.widgetMapper.countRegisterIssue(widgetCondition);
        }
 
        widgetCondition.setPage(0);
        widgetCondition.setPageSize(totalCount.intValue());
 
        //  내가 등록한 이슈
        if (widgetCondition.getProjectIds().size() > 0) {
            SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition);
            registerIssues = this.widgetMapper.findRegisterIssue(widgetCondition);
        }
 
        //  기간 정보를 셋팅한다.
        this.setPeriod(registerIssues);
 
        ExportExcelVo excelInfo = new ExportExcelVo();
        excelInfo.setFileName(this.messageAccessor.message("common.registeredByMeIssue")); // 내가 등록한 이슈 현황
        excelInfo.setDatas(registerIssues);
        excelInfo.addAttrInfos(new ExportExcelAttrVo("issueKey", this.messageAccessor.message("common.issueKey"), 6, ExportExcelAttrVo.ALIGN_CENTER)); // 이슈 번호
        excelInfo.addAttrInfos(new ExportExcelAttrVo("issueStatusName", this.messageAccessor.message("common.status"), 6, ExportExcelAttrVo.ALIGN_CENTER)); // 상태
        excelInfo.addAttrInfos(new ExportExcelAttrVo("projectName", this.messageAccessor.message("common.project"), 15, ExportExcelAttrVo.ALIGN_LEFT)); // 프로젝트
        excelInfo.addAttrInfos(new ExportExcelAttrVo("title", this.messageAccessor.message("common.issueTitle"), 40, ExportExcelAttrVo.ALIGN_LEFT)); // 이슈
        excelInfo.addAttrInfos(new ExportExcelAttrVo("period", this.messageAccessor.message("common.period"), 15, ExportExcelAttrVo.ALIGN_CENTER)); // 기간
        return excelInfo;
    }
 
    //  기간 정보를 셋팅한다.
    private void setPeriod(List<Map<String, Object>> issues) {
        for (Map<String, Object> issue : issues) {
            if (MapUtil.getString(issue, "startDate") == null) {
                issue.put("period", " - ");
            } else {
                issue.put("period", MapUtil.getString(issue, "startDate") + " - " + MapUtil.getString(issue, "completeDate"));
            }
        }
    }
 
    //  지연 중인 이슈 정보를 엑셀로 다운로드 한다.
    private ExportExcelVo downloadExcelDelayIssue() {
        WidgetCondition widgetCondition = this.makeWidgetCondition();
        List<Map<String, Object>> delayIssues = Lists.newArrayList();
        Long totalCount = 0L;
 
        if (widgetCondition.getProjectIds().size() > 0) {
            totalCount = this.widgetMapper.countDelayIssue(widgetCondition);
        }
 
        widgetCondition.setPage(0);
        widgetCondition.setPageSize(totalCount.intValue());
 
        if (widgetCondition.getProjectIds().size() > 0) {
            SetMeAndDownProjectIds(widgetCondition.getProjectIds(), widgetCondition);
            delayIssues = this.widgetMapper.findDelayIssue(widgetCondition);
        }
 
        //  오늘 날짜를 기준으로 지연일을 구한다.
        this.setDelayDay(delayIssues);
 
        //  기간 정보를 셋팅한다.
        this.setPeriod(delayIssues);
 
        ExportExcelVo excelInfo = new ExportExcelVo();
        excelInfo.setFileName(this.messageAccessor.message("common.delayingIssue")); // 지연 중인 이슈
        excelInfo.setDatas(delayIssues);
        excelInfo.addAttrInfos(new ExportExcelAttrVo("issueKey", this.messageAccessor.message("common.issueKey"), 6, ExportExcelAttrVo.ALIGN_CENTER)); // 이슈 번호
        excelInfo.addAttrInfos(new ExportExcelAttrVo("delayDay", this.messageAccessor.message("common.delayDate"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // 지연일
        excelInfo.addAttrInfos(new ExportExcelAttrVo("projectName", this.messageAccessor.message("common.project"), 15, ExportExcelAttrVo.ALIGN_LEFT)); // 프로젝트
        excelInfo.addAttrInfos(new ExportExcelAttrVo("title", this.messageAccessor.message("common.issueTitle"), 40, ExportExcelAttrVo.ALIGN_LEFT)); // 이슈
        excelInfo.addAttrInfos(new ExportExcelAttrVo("issueStatusName", this.messageAccessor.message("common.status"), 6, ExportExcelAttrVo.ALIGN_CENTER)); // 상태
        excelInfo.addAttrInfos(new ExportExcelAttrVo("period", this.messageAccessor.message("common.period"), 20, ExportExcelAttrVo.ALIGN_CENTER)); // 기간
        return excelInfo;
    }
 
    //  프로젝트별 멤버 진행률 정보를 엑셀로 다운로드 한다.
    private ExportExcelVo downloadExcelMemberProgress(Long projectId) {
        Map<String, Object> resJsonData = new HashMap<>();
 
        WidgetCondition widgetCondition = this.makeWidgetCondition();
        widgetCondition.setProjectIds(Lists.newArrayList(projectId));
 
        //  프로젝트 별 멤버 진행률 정보를 조회한다.
        this.findMemberProgress(resJsonData, widgetCondition, false);
 
        Map<String, Object> memberProgressWidget = (Map<String, Object>) MapUtil.getObject(resJsonData, "memberProgressWidget");
        List<Map<String, Object>> members = (List<Map<String, Object>>) MapUtil.getObject(memberProgressWidget, "members");
 
        for (Map<String, Object> member : members) {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append(MapUtil.getString(member, "name"));
            stringBuilder.append("(");
            stringBuilder.append(MapUtil.getString(member, "account"));
            stringBuilder.append(") ");
            member.put("byName", stringBuilder.toString());
            //  진행률 자리수 제한
            Double projectProgressPercent = MapUtil.getDouble(member, "projectProgressPercent");
            member.put("projectProgressPercent", String.format("%.1f", projectProgressPercent) + "%");
 
            int completeCount = MapUtil.getInteger(member, "completeCount");
            int remainCount = MapUtil.getInteger(member, "remainCount");
            int totalCount = completeCount + remainCount;
            //  담당 이슈 카운트
            member.put("issueCount", CommonUtil.getDecimalFormat(completeCount) + " / " + CommonUtil.getDecimalFormat(totalCount));
        }
 
        ExportExcelVo excelInfo = new ExportExcelVo();
        excelInfo.setFileName(this.messageAccessor.message("common.progressByMember")); // 멤버별 진행률
        excelInfo.setDatas(members);
 
        //excelInfo.addAttrInfos(new ExportExcelAttrVo("byName", this.messageAccessor.message("common.teamMember"), 15, ExportExcelAttrVo.ALIGN_LEFT)); // 팀원
        excelInfo.addAttrInfos(new ExportExcelAttrVo("projectName", this.messageAccessor.message("common.project"), 15, ExportExcelAttrVo.ALIGN_LEFT)); // 프로젝트
        excelInfo.addAttrInfos(new ExportExcelAttrVo("departmentName", this.messageAccessor.message("common.teamDepartment"), 15, ExportExcelAttrVo.ALIGN_LEFT)); // 담당부서
        excelInfo.addAttrInfos(new ExportExcelAttrVo("projectProgressPercent", this.messageAccessor.message("common.progressPercent"), 6, ExportExcelAttrVo.ALIGN_LEFT)); // 진행률
        excelInfo.addAttrInfos(new ExportExcelAttrVo("issueCount", this.messageAccessor.message("common.assignedIssue"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // 담당 이슈
        excelInfo.addAttrInfos(new ExportExcelAttrVo("delayCount", this.messageAccessor.message("common.delaying"), 6, ExportExcelAttrVo.ALIGN_CENTER)); // 지연중
        return excelInfo;
    }
 
    //  나의 이슈 정보를 엑셀로 다운로드 한다.
    private ExportExcelVo downloadExcelMyIssue() {
        Map<String, Object> resJsonData = new HashMap<>();
        //  나의 이슈 현황 정보를 조회한다.
        this.findMyIssueDetail(resJsonData, this.makeWidgetCondition());
 
        Map<String, Object> myIssueWidget = (Map<String, Object>) MapUtil.getObject(resJsonData, "myIssueWidget");
        List<Map<String, Object>> issues = (List<Map<String, Object>>) MapUtil.getObject(myIssueWidget, "issues");
 
        List<Map<String, Object>> newIssues = Lists.newArrayList();
 
        for (Map<String, Object> issue : issues) {
            Map<String, Object> registerMaps = new HashMap<>();
            Map<String, Object> assigneeMaps = new HashMap<>();
 
            registerMaps.put("name", MapUtil.getString(issue, "name"));
            registerMaps.put("division", this.messageAccessor.message("common.registration")); // 등록
            registerMaps.put("totalRegisterIssueCount", CommonUtil.getDecimalFormat(MapUtil.getInteger(issue, "totalRegisterIssueCount")));
            registerMaps.put("registerCompleteIssueCount", CommonUtil.getDecimalFormat(MapUtil.getInteger(issue, "registerCompleteIssueCount")));
            Double registerIssueProgressPercent = MapUtil.getDouble(issue, "registerIssueProgressPercent");
            registerMaps.put("registerIssueProgressPercent", String.format("%.1f", registerIssueProgressPercent) + "%");
            registerMaps.put("registerRemainIssueCount", CommonUtil.getDecimalFormat(MapUtil.getInteger(issue, "registerRemainIssueCount")));
 
            assigneeMaps.put("division", this.messageAccessor.message("common.assigned")); // 담당
            assigneeMaps.put("totalRegisterIssueCount", CommonUtil.getDecimalFormat(MapUtil.getInteger(issue, "totalAssigneeIssueCount")));
            assigneeMaps.put("registerCompleteIssueCount", CommonUtil.getDecimalFormat(MapUtil.getInteger(issue, "assigneeCompleteIssueCount")));
            Double assigneeIssueProgressPercent = MapUtil.getDouble(issue, "assigneeIssueProgressPercent");
            assigneeMaps.put("registerIssueProgressPercent", String.format("%.1f", assigneeIssueProgressPercent) + "%");
            assigneeMaps.put("registerRemainIssueCount", CommonUtil.getDecimalFormat(MapUtil.getInteger(issue, "assigneeRemainIssueCount")));
 
            newIssues.add(registerMaps);
            newIssues.add(assigneeMaps);
        }
 
        ExportExcelVo excelInfo = new ExportExcelVo();
        excelInfo.setFileName(this.messageAccessor.message("common.myIssueStatus")); // 나의 이슈 현황
        excelInfo.setDatas(newIssues);
        excelInfo.addAttrInfos(new ExportExcelAttrVo("name", this.messageAccessor.message("common.project"), 15, ExportExcelAttrVo.ALIGN_CENTER, 1)); // 프로젝트
        excelInfo.addAttrInfos(new ExportExcelAttrVo("division", this.messageAccessor.message("common.division"), 6, ExportExcelAttrVo.ALIGN_CENTER)); // 구분
        excelInfo.addAttrInfos(new ExportExcelAttrVo("totalRegisterIssueCount", this.messageAccessor.message("common.issue"), 10, ExportExcelAttrVo.ALIGN_CENTER)); // 이슈
        excelInfo.addAttrInfos(new ExportExcelAttrVo("registerCompleteIssueCount", this.messageAccessor.message("common.complete"), 6, ExportExcelAttrVo.ALIGN_CENTER)); // 완료
        excelInfo.addAttrInfos(new ExportExcelAttrVo("registerIssueProgressPercent", this.messageAccessor.message("common.progressPercent"), 6, ExportExcelAttrVo.ALIGN_CENTER)); // 진행률
        excelInfo.addAttrInfos(new ExportExcelAttrVo("registerRemainIssueCount", this.messageAccessor.message("common.remainIssue"), 6, ExportExcelAttrVo.ALIGN_CENTER)); // 잔여 이슈
 
        return excelInfo;
    }
 
    //  중요도 별 이슈 정보를 엑셀로 다운로드 한다.
    private ExportExcelVo downloadExcelSeverityIssue(Long severityId) {
 
        WidgetCondition widgetCondition = this.makeWidgetCondition();
 
        if (widgetCondition.getSeverityId() == null) {
            widgetCondition.setSeverityId(severityId);
        }
 
        List<Map<String, Object>> severityIssue = Lists.newArrayList();
 
        if (widgetCondition.getProjectIds().size() > 0) {
            severityIssue = this.widgetMapper.findSeverityIssues(widgetCondition);
        }
 
        //기간 정보 셋팅
        this.setPeriod(severityIssue);
 
        ExportExcelVo excelInfo = new ExportExcelVo();
        excelInfo.setFileName(this.messageAccessor.message("common.severityIssue")); // 중요도 별 이슈현황
        excelInfo.setDatas(severityIssue);
        excelInfo.addAttrInfos(new ExportExcelAttrVo("issueKey", this.messageAccessor.message("common.issueKey"), 8, ExportExcelAttrVo.ALIGN_CENTER));    //이슈 번호
        excelInfo.addAttrInfos(new ExportExcelAttrVo("severityName", this.messageAccessor.message("common.importance"), 6, ExportExcelAttrVo.ALIGN_CENTER)); // 중요도
        excelInfo.addAttrInfos(new ExportExcelAttrVo("projectName", this.messageAccessor.message("common.project"), 15, ExportExcelAttrVo.ALIGN_LEFT)); // 프로젝트
        excelInfo.addAttrInfos(new ExportExcelAttrVo("title", this.messageAccessor.message("common.issueTitle"), 40, ExportExcelAttrVo.ALIGN_CENTER)); // 이슈제목
        excelInfo.addAttrInfos(new ExportExcelAttrVo("issueStatusName", this.messageAccessor.message("common.status"), 6, ExportExcelAttrVo.ALIGN_CENTER));  //이슈 상태
        excelInfo.addAttrInfos(new ExportExcelAttrVo("period", this.messageAccessor.message("common.period"), 15, ExportExcelAttrVo.ALIGN_CENTER)); // 기간
 
        return excelInfo;
    }
}