mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
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
package com.panzhihua.service_dangjian.service.impl;
 
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.panzhihua.common.model.dtos.partybuilding.*;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.partybuilding.PhotoMicroWishData;
import com.panzhihua.common.utlis.StringUtils;
import com.panzhihua.service_dangjian.dao.StreetBigScreenDAO;
import com.panzhihua.service_dangjian.service.StreetBigScreenService;
import org.springframework.stereotype.Service;
 
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
 
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: 党组织
 * @author: huang.hongfa weixin hhf9596 qq 959656820
 * @create: 2020-11-30 11:40
 **/
@Service
public class StreetBigScreenServiceImpl extends ServiceImpl<StreetBigScreenDAO, ComActDTO>
    implements StreetBigScreenService
{
 
 
    @Override
    public R getCommunityId(String streetId)
    {
        if(StringUtils.isEmpty(streetId))
        {
            return R.fail("街道id不能为空");
        }
        return R.ok(baseMapper.getCommunityId(streetId));
    }
 
    /**
     * 获取核心指标数据
     * @param streetId
     * @return
     */
    @Override
    public R getCoreData(String streetId,String communityId,String type,String starTime,String endTime)
    {
        if(StringUtils.isEmpty(streetId) && StringUtils.isEmpty(communityId) )
        {
            return R.fail("街道id或社区id不能为空");
        }
 
        //获取小程序用户数量
        int userNum=0;
        //获取实有人口总数
        int ActualPopNum=0;
        //获取小区总数
        int VillageNum=0;
        //获取志愿者总数
        int VolunteerNum=0;
 
        if(StringUtils.equals(type,"1"))
        {
            //按年份
//            int year=Calendar.getInstance().get(Calendar.YEAR);
            //获取小程序用户数量
            userNum= baseMapper.getUserNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            //获取实有人口总数
            ActualPopNum= baseMapper.getActualPopNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            //获取小区总数
            VillageNum= baseMapper.getVillageNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            //获取志愿者总数
            VolunteerNum= baseMapper.getVolunteerNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
        }
        else if(StringUtils.equals(type,"2"))
        {
            //按月份
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Date date = null;
            try {
                date = sdf.parse(starTime+"-01");
            } catch (ParseException e) {
                e.printStackTrace();
            }
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(date);
            calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
            Date lastDay = calendar.getTime();
            // 获取当前月份的第一天
            String firstDayOfMonth = starTime+"-01";
//                // 获取当前月份的最后一天
            String lastDayOfMonth = sdf.format(lastDay);
 
            //获取小程序用户数量
            userNum= baseMapper.getUserNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
            //获取实有人口总数
            ActualPopNum= baseMapper.getActualPopNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
            //获取小区总数
            VillageNum= baseMapper.getVillageNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
            //获取志愿者总数
            VolunteerNum= baseMapper.getVolunteerNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
        }
        else if(StringUtils.equals(type,"3"))
        {
            //按天份
//            DateTimeFormatter newformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
//            String data=LocalDate.now().format(newformatter);
            userNum= baseMapper.getUserNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
            //获取实有人口总数
            ActualPopNum= baseMapper.getActualPopNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
            //获取小区总数
            VillageNum= baseMapper.getVillageNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
            //获取志愿者总数
            VolunteerNum= baseMapper.getVolunteerNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
        }
        else if(StringUtils.equals(type,"4"))
        {
            //按时间范围
            userNum= baseMapper.getUserNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
            //获取实有人口总数
            ActualPopNum= baseMapper.getActualPopNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
            //获取小区总数
            VillageNum= baseMapper.getVillageNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
            //获取志愿者总数
            VolunteerNum= baseMapper.getVolunteerNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
        }
        else
        {
            //type为空  查全部
            userNum= baseMapper.getUserNum(streetId,communityId,null,null);
            //获取实有人口总数
            ActualPopNum= baseMapper.getActualPopNum(streetId,communityId,null,null);
            //获取小区总数
            VillageNum= baseMapper.getVillageNum(streetId,communityId,null,null);
            //获取志愿者总数
            VolunteerNum= baseMapper.getVolunteerNum(streetId,communityId,null,null);
        }
 
        StreetCoreData streetCoreData=new StreetCoreData();
        streetCoreData.setUserNum(userNum);
        streetCoreData.setVillageNum(VillageNum);
        streetCoreData.setActualPopNum(ActualPopNum);
        streetCoreData.setVolunteerNum(VolunteerNum);
 
        return R.ok(streetCoreData);
    }
 
 
    /**
     * 获取三务三资数据
     * @param streetId
     * @param communityId
     * @param type
     * @param starTime
     * @param endTime
     * @return
     */
    @Override
    public R getThreeNum(String streetId, String communityId,String type,String starTime, String endTime)
    {
        if(StringUtils.isEmpty(streetId) && StringUtils.isEmpty(communityId) )
        {
            return R.fail("街道id或社区id不能为空");
        }
 
        int partyAffairsNum=0;
        int serviceNum=0;
        int financeNum=0;
        int fundNum=0;
        int propertyNum=0;
        int naturalResourcesNum=0;
        int villageEconomyNum=0;
 
        if(StringUtils.equals(type,"1"))
        {
            //按年份
//            int year=Calendar.getInstance().get(Calendar.YEAR);
            partyAffairsNum=baseMapper.getThreeNum(streetId,communityId,"党务公开",starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            serviceNum=baseMapper.getThreeNum(streetId,communityId,"服务公开",starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            financeNum=baseMapper.getThreeNum(streetId,communityId,"财务公开",starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            fundNum=baseMapper.getThreeNum(streetId,communityId,"资金公开",starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            propertyNum=baseMapper.getThreeNum(streetId,communityId,"资产公开",starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            naturalResourcesNum=baseMapper.getThreeNum(streetId,communityId,"资源公开",starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            villageEconomyNum=baseMapper.getThreeNum(streetId,communityId,"村集体经济组织项目",starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
        }
        else if(StringUtils.equals(type,"2"))
        {
 
            try {
                //按月份
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                Date date = sdf.parse(starTime+"-01");
                Calendar calendar = Calendar.getInstance();
                calendar.setTime(date);
                calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
                Date lastDay = calendar.getTime();
                // 获取当前月份的第一天
                String firstDayOfMonth = starTime+"-01";
//                // 获取当前月份的最后一天
                String lastDayOfMonth = sdf.format(lastDay);
 
                partyAffairsNum=baseMapper.getThreeNum(streetId,communityId,"党务公开",firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
                serviceNum=baseMapper.getThreeNum(streetId,communityId,"服务公开",firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
                financeNum=baseMapper.getThreeNum(streetId,communityId,"财务公开",firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
                fundNum=baseMapper.getThreeNum(streetId,communityId,"资金公开",firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
                propertyNum=baseMapper.getThreeNum(streetId,communityId,"资产公开",firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
                naturalResourcesNum=baseMapper.getThreeNum(streetId,communityId,"资源公开",firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
                villageEconomyNum=baseMapper.getThreeNum(streetId,communityId,"村集体经济组织项目",firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
 
            } catch (ParseException e) {
                e.printStackTrace();
            }
 
            // 获取并打印第一天的日期
 
 
 
 
        }
        else if(StringUtils.equals(type,"3"))
        {
            //按天份
//            DateTimeFormatter newformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
//            String data=LocalDate.now().format(newformatter);
 
            partyAffairsNum=baseMapper.getThreeNum(streetId,communityId,"党务公开",starTime+" 00:00:00",starTime+" 23:59:59");
            serviceNum=baseMapper.getThreeNum(streetId,communityId,"服务公开",starTime+" 00:00:00",starTime+" 23:59:59");
            financeNum=baseMapper.getThreeNum(streetId,communityId,"财务公开",starTime+" 00:00:00",starTime+" 23:59:59");
            fundNum=baseMapper.getThreeNum(streetId,communityId,"资金公开",starTime+" 00:00:00",starTime+" 23:59:59");
            propertyNum=baseMapper.getThreeNum(streetId,communityId,"资产公开",starTime+" 00:00:00",starTime+" 23:59:59");
            naturalResourcesNum=baseMapper.getThreeNum(streetId,communityId,"资源公开",starTime+" 00:00:00",starTime+" 23:59:59");
            villageEconomyNum=baseMapper.getThreeNum(streetId,communityId,"村集体经济组织项目",starTime+" 00:00:00",starTime+" 23:59:59");
        }
        else if(StringUtils.equals(type,"4"))
        {
            //按时间范围
            partyAffairsNum=baseMapper.getThreeNum(streetId,communityId,"党务公开",starTime+" 00:00:00",endTime+" 23:59:59");
            serviceNum=baseMapper.getThreeNum(streetId,communityId,"服务公开",starTime+" 00:00:00",endTime+" 23:59:59");
            financeNum=baseMapper.getThreeNum(streetId,communityId,"财务公开",starTime+" 00:00:00",endTime+" 23:59:59");
            fundNum=baseMapper.getThreeNum(streetId,communityId,"资金公开",starTime+" 00:00:00",endTime+" 23:59:59");
            propertyNum=baseMapper.getThreeNum(streetId,communityId,"资产公开",starTime+" 00:00:00",endTime+" 23:59:59");
            naturalResourcesNum=baseMapper.getThreeNum(streetId,communityId,"资源公开",starTime+" 00:00:00",endTime+" 23:59:59");
            villageEconomyNum=baseMapper.getThreeNum(streetId,communityId,"村集体经济组织项目",starTime+" 00:00:00",endTime+" 23:59:59");
 
        }
        else
        {
            partyAffairsNum=baseMapper.getThreeNum(streetId,communityId,"党务公开",null,null);
            serviceNum=baseMapper.getThreeNum(streetId,communityId,"服务公开",null,null);
            financeNum=baseMapper.getThreeNum(streetId,communityId,"财务公开",null,null);
            fundNum=baseMapper.getThreeNum(streetId,communityId,"资金公开",null,null);
            propertyNum=baseMapper.getThreeNum(streetId,communityId,"资产公开",null,null);
            naturalResourcesNum=baseMapper.getThreeNum(streetId,communityId,"资源公开",null,null);
            villageEconomyNum=baseMapper.getThreeNum(streetId,communityId,"村集体经济组织项目",null,null);
        }
 
        ThreeNumData threeNumData=new ThreeNumData();
        threeNumData.setPartyAffairsNum(partyAffairsNum);
        threeNumData.setServiceNum(serviceNum);
        threeNumData.setFinanceNum(financeNum);
        threeNumData.setFundNum(fundNum);
        threeNumData.setPropertyNum(propertyNum);
        threeNumData.setNaturalResourcesNum(naturalResourcesNum);
        threeNumData.setVillageEconomyNum(villageEconomyNum);
 
        threeNumData.setThreeServiceNum(partyAffairsNum+serviceNum+financeNum);
        threeNumData.setThreeFundNum(fundNum+propertyNum+naturalResourcesNum);
 
 
        return R.ok(threeNumData);
    }
 
 
    /**
     * 双报到双服务
     * @param streetId
     * @param communityId
     * @param type
     * @param starTime
     * @param endTime
     * @return
     */
    @Override
    public R getDoubleRegistration(String streetId, String communityId, String type, String starTime, String endTime)
    {
        if(StringUtils.isEmpty(streetId) && StringUtils.isEmpty(communityId) )
        {
            return R.fail("街道id或社区id不能为空");
        }
 
        //旧的报道需求问题统计数  2.问题清单 3.需求清单
        Integer OleProblemNum=0;
        Integer OleNeedNum=0;
        //旧的报道需求问题统计数 1问题清单  2需求清单
        Integer NewProblemNum=0;
        Integer NewNeedNum=0;
        //获取旧双报道服务时间
        Double OldTime=0.0;
        //获取新双报道服务时间
        Double NewTime=0.0;
        //党建动态数据
        Integer PartyBuildingNum=0;
        //报到单位总计数据
        Integer UnitNum=0;
        //报到党员总计数据
        Integer MemberNum=0;
 
        Integer fuwuNum=0;
 
        if(StringUtils.equals(type,"1"))
        {
            //按年份
//            int year=Calendar.getInstance().get(Calendar.YEAR);
            //旧的报道需求问题统计数  2.问题清单 3.需求清单
            OleProblemNum=baseMapper.getOleNeedProblemNum("2",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            OleNeedNum=baseMapper.getOleNeedProblemNum("3",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            //旧的报道需求问题统计数 1问题清单  2需求清单
            NewProblemNum=baseMapper.getNewNeedProblemNum("1",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            NewNeedNum=baseMapper.getNewNeedProblemNum("2",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            //获取旧双报道服务时间
            OldTime=baseMapper.getOldTime(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            //获取新双报道服务时间
            NewTime=baseMapper.getNewTime(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            //党建动态数据
            PartyBuildingNum=baseMapper.getPartyBuildingNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            //报到单位总计数据
            UnitNum=baseMapper.getUnitNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            //报到党员总计数据
            MemberNum=baseMapper.getMemberNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
 
            fuwuNum=baseMapper.getRegistNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
        }
        else if(StringUtils.equals(type,"2"))
        {
            //按月份
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Date date = null;
            try {
                date = sdf.parse(starTime+"-01");
            } catch (ParseException e) {
                e.printStackTrace();
            }
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(date);
            calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
            Date lastDay = calendar.getTime();
            // 获取当前月份的第一天
            String firstDayOfMonth = starTime+"-01";
//                // 获取当前月份的最后一天
            String lastDayOfMonth = sdf.format(lastDay);
 
            //旧的报道需求问题统计数  2.问题清单 3.需求清单
            OleProblemNum=baseMapper.getOleNeedProblemNum("2",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
            OleNeedNum=baseMapper.getOleNeedProblemNum("3",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
            //旧的报道需求问题统计数 1问题清单  2需求清单
            NewProblemNum=baseMapper.getNewNeedProblemNum("1",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
            NewNeedNum=baseMapper.getNewNeedProblemNum("2",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
            //获取旧双报道服务时间
            OldTime=baseMapper.getOldTime(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
            //获取新双报道服务时间
            NewTime=baseMapper.getNewTime(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
            //党建动态数据
            PartyBuildingNum=baseMapper.getPartyBuildingNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
            //报到单位总计数据
            UnitNum=baseMapper.getUnitNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
            //报到党员总计数据
            MemberNum=baseMapper.getMemberNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
            fuwuNum=baseMapper.getRegistNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
        }
        else if(StringUtils.equals(type,"3"))
        {
            //按天份
//            DateTimeFormatter newformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
//            String data=LocalDate.now().format(newformatter);
 
            //旧的报道需求问题统计数  2.问题清单 3.需求清单
            OleProblemNum=baseMapper.getOleNeedProblemNum("2",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
            OleNeedNum=baseMapper.getOleNeedProblemNum("3",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
            //旧的报道需求问题统计数 1问题清单  2需求清单
            NewProblemNum=baseMapper.getNewNeedProblemNum("1",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
            NewNeedNum=baseMapper.getNewNeedProblemNum("2",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
            //获取旧双报道服务时间
            OldTime=baseMapper.getOldTime(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
            //获取新双报道服务时间
            NewTime=baseMapper.getNewTime(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
            //党建动态数据
            PartyBuildingNum=baseMapper.getPartyBuildingNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
            //报到单位总计数据
            UnitNum=baseMapper.getUnitNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
            //报到党员总计数据
            MemberNum=baseMapper.getMemberNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
            fuwuNum=baseMapper.getRegistNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
        }
        else if(StringUtils.equals(type,"4"))
        {
            //按时间范围
            //旧的报道需求问题统计数  2.问题清单 3.需求清单
            OleProblemNum=baseMapper.getOleNeedProblemNum("2",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
            OleNeedNum=baseMapper.getOleNeedProblemNum("3",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
            //旧的报道需求问题统计数 1问题清单  2需求清单
            NewProblemNum=baseMapper.getNewNeedProblemNum("1",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
            NewNeedNum=baseMapper.getNewNeedProblemNum("2",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
            //获取旧双报道服务时间
            OldTime=baseMapper.getOldTime(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
            //获取新双报道服务时间
            NewTime=baseMapper.getNewTime(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
            //党建动态数据
            PartyBuildingNum=baseMapper.getPartyBuildingNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
            //报到单位总计数据
            UnitNum=baseMapper.getUnitNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
            //报到党员总计数据
            MemberNum=baseMapper.getMemberNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
            fuwuNum=baseMapper.getRegistNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
 
        }
        else
        {
            //旧的报道需求问题统计数  2.问题清单 3.需求清单
            OleProblemNum=baseMapper.getOleNeedProblemNum("2",streetId,communityId,null,null);
            OleNeedNum=baseMapper.getOleNeedProblemNum("3",streetId,communityId,null,null);
            //旧的报道需求问题统计数 1问题清单  2需求清单
            NewProblemNum=baseMapper.getNewNeedProblemNum("1",streetId,communityId,null,null);
            NewNeedNum=baseMapper.getNewNeedProblemNum("2",streetId,communityId,null,null);
            //获取旧双报道服务时间
            OldTime=baseMapper.getOldTime(streetId,communityId,null,null);
            //获取新双报道服务时间
            NewTime=baseMapper.getNewTime(streetId,communityId,null,null);
            //党建动态数据
            PartyBuildingNum=baseMapper.getPartyBuildingNum(streetId,communityId,null,null);
            //报到单位总计数据
            UnitNum=baseMapper.getUnitNum(streetId,communityId,null,null);
            //报到党员总计数据
            MemberNum=baseMapper.getMemberNum(streetId,communityId,null,null);
            fuwuNum=baseMapper.getRegistNum(streetId,communityId,null,null);
        }
 
 
        if(NewTime==null)
        {
            NewTime=0.0;
        }
        if(OldTime==null)
        {
            OldTime=0.0;
        }
 
        DoubleRegistrationData doubleRegistrationData=new DoubleRegistrationData();
        //报道需求统计数
        doubleRegistrationData.setNeedNum(NewNeedNum+OleNeedNum);
        //报道问题
        doubleRegistrationData.setProblemNum(OleProblemNum+NewProblemNum);
        //获取旧双报道服务时间
        doubleRegistrationData.setTimes(OldTime+NewTime);
        //党建动态数据
        doubleRegistrationData.setPartyBuildingNum(PartyBuildingNum);
        //报到单位总计数据
        doubleRegistrationData.setUnitNum(UnitNum);
        //报到党员总计数据
        doubleRegistrationData.setMemberNum(MemberNum);
        //报到服务次数
        doubleRegistrationData.setAllNum(NewNeedNum+OleNeedNum+OleProblemNum+NewProblemNum+fuwuNum);
 
 
        return R.ok(doubleRegistrationData);
    }
 
    /**
     * 随手拍  微心愿
     * @param streetId
     * @param communityId
     * @param type
     * @param starTime
     * @param endTime
     * @return
     */
    @Override
    public R getPhotoMicroWish(String streetId, String communityId, String type, String starTime, String endTime)
    {
 
        //随手拍
        List<PhotoMicroWishData> photoList=new ArrayList<>();
        //微心愿
        List<PhotoMicroWishData> microWishList=new ArrayList<>();
 
//        List<PhotoMicroWishData> list=new ArrayList<>();
 
 
        int photoNum=0;
 
        int microWishNum=0;
 
        if(StringUtils.equals(type,"1"))
        {
            //按年份
//            int year=Calendar.getInstance().get(Calendar.YEAR);
 
            //随手拍
            photoList=baseMapper.getPhotoMicroWishData("1","%Y",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            //微心愿
            microWishList=baseMapper.getPhotoMicroWishData("2","%Y",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
 
            photoNum=baseMapper.getPhotoAllNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            microWishNum=baseMapper.getMicroWishAllNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
        }
        else if(StringUtils.equals(type,"2"))
        {
            //按月份
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Date date = null;
            try {
                date = sdf.parse(starTime+"-01");
            } catch (ParseException e) {
                e.printStackTrace();
            }
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(date);
            calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
            Date lastDay = calendar.getTime();
            // 获取当前月份的第一天
            String firstDayOfMonth = starTime+"-01";
//                // 获取当前月份的最后一天
            String lastDayOfMonth = sdf.format(lastDay);
 
            photoList=baseMapper.getPhotoMicroWishData("1","%Y-%m",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
            microWishList=baseMapper.getPhotoMicroWishData("2","%Y-%m",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
 
            photoNum=baseMapper.getPhotoAllNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
            microWishNum=baseMapper.getMicroWishAllNum(streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
 
        }
        else if(StringUtils.equals(type,"3"))
        {
            //按天份
//            DateTimeFormatter newformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
//            String data=LocalDate.now().format(newformatter);
 
            photoList=baseMapper.getPhotoMicroWishData("1","%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
            microWishList=baseMapper.getPhotoMicroWishData("2","%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
 
            photoNum=baseMapper.getPhotoAllNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
            microWishNum=baseMapper.getMicroWishAllNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
        }
        else if(StringUtils.equals(type,"4"))
        {
            photoList=baseMapper.getPhotoMicroWishData("1","%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
            microWishList=baseMapper.getPhotoMicroWishData("2","%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
 
            photoNum=baseMapper.getPhotoAllNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
            microWishNum=baseMapper.getMicroWishAllNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
        }
        else
        {
            photoList=baseMapper.getPhotoMicroWishData("1","%Y-%m",streetId,communityId,null,null);
            microWishList=baseMapper.getPhotoMicroWishData("2","%Y-%m",streetId,communityId,null,null);
 
            photoNum=baseMapper.getPhotoAllNum(streetId,communityId,null,null);
            microWishNum=baseMapper.getMicroWishAllNum(streetId,communityId,null,null);
        }
 
//        for (int a=0;a<microWishList.size();a++)
//        {
//            int num=0;
//            for (int b=0;b<photoList.size();b++)
//            {
//                if(photoList.get(b).getTiems().equals(microWishList.get(a).getTiems()))
//                {
//                    photoList.get(b).setMicroNum(microWishList.get(a).getPhotoNum());
//                }
//                else
//                {
//                    num++;
//                }
//            }
//
//            if(num>=photoList.size())
//            {
//                PhotoMicroWishData  data=new PhotoMicroWishData();
//                data.setMicroNum(microWishList.get(a).getPhotoNum());
//                data.setCreateAt(microWishList.get(a).getCreateAt());
//                data.setTiems(microWishList.get(a).getTiems());
//                data.setPhotoNum("0");
//                list.add(data);
//            }
//
//        }
//
//        photoList.addAll(list);
//
//        if(photoList!=null && photoList.size()>1)
//        {
//            Collections.sort(photoList, new Comparator<PhotoMicroWishData>() {
//                @Override
//                public int compare(PhotoMicroWishData o1, PhotoMicroWishData o2) {
//                    return o1.getCreateAt().compareTo(o2.getCreateAt());
//                }
//            });
//        }
 
 
        PhotoMicroWish photoMicroWish=new PhotoMicroWish();
        photoMicroWish.setPhotoList(photoList);
        photoMicroWish.setMicroWishList(microWishList);
        photoMicroWish.setPhotoNum(photoNum);
        photoMicroWish.setMicroWishNum(microWishNum);
        return R.ok(photoMicroWish);
    }
 
    /**
     * 社区活动、议事投票、问卷调查、社区动态发布趋势
     * @param streetId
     * @param communityId
     * @param type
     * @param starTime
     * @param endTime
     * @return
     */
    @Override
    public R getAllData(String streetId, String communityId, String type, String starTime, String endTime)
    {
        //议事投票
        List<PhotoMicroWishData> discussList=new ArrayList<>();
        //问卷调查
        List<PhotoMicroWishData> questnaireNumList=new ArrayList<>();
        //社区动态
        List<PhotoMicroWishData> nommunityDynNumList=new ArrayList<>();
        //社区活动
        List<PhotoMicroWishData> nommunityActNumList=new ArrayList<>();
 
 
        //议事投票数量")
        int discussNum=0;
 
        //问卷调查数量")
        int questnaireNum=0;
 
        //社区动态数量")
        int nommunityDynNum=0;
 
        //社区活动数量")
        int nommunityActNum=0;
 
        if(StringUtils.equals(type,"1"))
        {
            //按年份
//            int year=Calendar.getInstance().get(Calendar.YEAR);
 
            //* 社区活动统计
            nommunityActNumList=baseMapper.getNommunityActNumList("%Y",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            //社区动态
            nommunityDynNumList=baseMapper.getNommunityDynNumList("%Y",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            //问卷调查
            questnaireNumList=baseMapper.getQuestnaireNumList("%Y",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
            //议事投票
            discussList=baseMapper.getDiscussNumList("%Y",streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
 
 
            //议事投票数量")
            discussNum=baseMapper.getDiscussNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
 
            //问卷调查数量")
            questnaireNum=baseMapper.getQuestnaireNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
 
            //社区动态数量")
            nommunityDynNum=baseMapper.getNommunityDynNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
 
            //社区活动数量")
            nommunityActNum=baseMapper.getNommunityActNum(streetId,communityId,starTime+"-01-01 00:00:00",starTime+"-12-31 23:59:59");
 
 
        }
        else if(StringUtils.equals(type,"2"))
        {
            //按月份
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Date date = null;
            try {
                date = sdf.parse(starTime+"-01");
            } catch (ParseException e) {
                e.printStackTrace();
            }
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(date);
            calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
            Date lastDay = calendar.getTime();
            // 获取当前月份的第一天
            String firstDayOfMonth = starTime+"-01";
//                // 获取当前月份的最后一天
            String lastDayOfMonth = sdf.format(lastDay);
 
            //* 社区活动统计
            nommunityActNumList=baseMapper.getNommunityActNumList("%Y-%m",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
            //社区动态
            nommunityDynNumList=baseMapper.getNommunityDynNumList("%Y-%m",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
            //问卷调查
            questnaireNumList=baseMapper.getQuestnaireNumList("%Y-%m",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
            //议事投票
            discussList=baseMapper.getDiscussNumList("%Y-%m",streetId,communityId,firstDayOfMonth+" 00:00:00",lastDayOfMonth+" 23:59:59");
 
        }
        else if(StringUtils.equals(type,"3"))
        {
            //按天份
//            DateTimeFormatter newformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
//            String data=LocalDate.now().format(newformatter);
 
            //* 社区活动统计
            nommunityActNumList=baseMapper.getNommunityActNumList("%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
            //社区动态
            nommunityDynNumList=baseMapper.getNommunityDynNumList("%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
            //问卷调查
            questnaireNumList=baseMapper.getQuestnaireNumList("%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
            //议事投票
            discussList=baseMapper.getDiscussNumList("%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
 
 
            //议事投票数量")
            discussNum=baseMapper.getDiscussNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
 
            //问卷调查数量")
            questnaireNum=baseMapper.getQuestnaireNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
 
            //社区动态数量")
            nommunityDynNum=baseMapper.getNommunityDynNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
 
            //社区活动数量")
            nommunityActNum=baseMapper.getNommunityActNum(streetId,communityId,starTime+" 00:00:00",starTime+" 23:59:59");
 
 
 
        }
        else if(StringUtils.equals(type,"4"))
        {
            //* 社区活动统计
            nommunityActNumList=baseMapper.getNommunityActNumList("%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
            //社区动态
            nommunityDynNumList=baseMapper.getNommunityDynNumList("%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
            //问卷调查
            questnaireNumList=baseMapper.getQuestnaireNumList("%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
            //议事投票
            discussList=baseMapper.getDiscussNumList("%Y-%m-%d",streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
 
 
            //议事投票数量")
            discussNum=baseMapper.getDiscussNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
 
            //问卷调查数量")
            questnaireNum=baseMapper.getQuestnaireNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
 
            //社区动态数量")
            nommunityDynNum=baseMapper.getNommunityDynNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
 
            //社区活动数量")
            nommunityActNum=baseMapper.getNommunityActNum(streetId,communityId,starTime+" 00:00:00",endTime+" 23:59:59");
        }
        else
        {
            //* 社区活动统计
            nommunityActNumList=baseMapper.getNommunityActNumList("%Y-%m",streetId,communityId,null,null);
            //社区动态
            nommunityDynNumList=baseMapper.getNommunityDynNumList("%Y-%m",streetId,communityId,null,null);
            //问卷调查
            questnaireNumList=baseMapper.getQuestnaireNumList("%Y-%m",streetId,communityId,null,null);
            //议事投票
            discussList=baseMapper.getDiscussNumList("%Y-%m",streetId,communityId,null,null);
 
 
 
            //议事投票数量")
            discussNum=baseMapper.getDiscussNum(streetId,communityId,null,null);
 
            //问卷调查数量")
            questnaireNum=baseMapper.getQuestnaireNum(streetId,communityId,null,null);
 
            //社区动态数量")
            nommunityDynNum=baseMapper.getNommunityDynNum(streetId,communityId,null,null);
 
            //社区活动数量")
            nommunityActNum=baseMapper.getNommunityActNum(streetId,communityId,null,null);
 
        }
 
        AllData allData=new AllData();
        allData.setDiscussList(discussList);
        allData.setNommunityActNumList(nommunityActNumList);
        allData.setNommunityDynNumList(nommunityDynNumList);
        allData.setQuestnaireNumList(questnaireNumList);
        allData.setQuestnaireNum(questnaireNum);
        allData.setNommunityDynNum(nommunityDynNum);
        allData.setNommunityActNum(nommunityActNum);
        allData.setDiscussNum(discussNum);
 
        return R.ok(allData);
    }
 
 
}