cjl
2023-10-25 2d6c5b3f4f72ae3ca6ba155ee3b85892c81f2fe0
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
package com.moral.api.service.impl;
 
 
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
 
import java.io.IOException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.moral.api.entity.HistoryDaily;
import com.moral.api.entity.TbExcel;
import com.moral.api.mapper.ExcelMapper;
import com.moral.api.mapper.HistoryDailyMapper;
import com.moral.api.pojo.bo.ExcelBO;
 
import com.moral.api.pojo.vo.excel.ExcelVo;
import com.moral.api.service.ExcelService;
import com.moral.api.utils.ExcelUtils;
 
import com.moral.util.DateUtils;
 
 
@Service
@Slf4j
public class ExcelServiceImpl implements ExcelService {
 
    @Autowired
    private ExcelMapper excelMapper;
 
    @Autowired
    private HistoryDailyMapper  historyDailyMapper;
 
    /**
     * 高新区导入
     * @param files
     * @param params
     * @return
     * @throws IOException
     */
    @Override
    public ExcelBO importTemplate(List<MultipartFile> files, Map<String, Object> params) throws IOException {
        Date date2 = new Date();
        String time = (String) params.get("time");
        String code = (String) params.get("code");
//        String time1 = (String) params.get("date");
        Date date = DateUtils.getDate(time, "yyyy-MM-dd");
//        Date date1 = DateUtils.getDate(time1, "yyyy-MM-dd");
        ExcelBO excelBO = new ExcelBO();
        QueryWrapper<TbExcel> wrapper = new QueryWrapper<>();
        wrapper.eq("time",date).eq("code",code);
        TbExcel excel = excelMapper.selectOne(wrapper);
        if (excel==null){
            TbExcel excel1 = new TbExcel();
            HashMap<String, Object> map = new HashMap<>();
            MultipartFile file1 = files.get(0);
            Map<String, Object> map1 = getMap1(file1);
            map.put("c1",map1);
            MultipartFile file2 = files.get(1);
            Map<String, Object> map2 = getMap2(file2);
            map.put("c2",map2);
            MultipartFile file3 = files.get(2);
            Map<String, Object> map3 = getMap3(file3);
            map.put("c3",map3);
            MultipartFile file4 = files.get(3);
            Map<String, Object> map4 = getMap4(file4);
            map.put("c4",map4);
            MultipartFile file5 = files.get(4);
            Map<String, Object> map5 = getMap5(file5);
            map.put("c5",map5);
            if (files.size()>5){
                MultipartFile file6 = files.get(5);
                Map<String, Object> map6 = getMap6(file6);
                map.put("c6",map6);
            }
            String s = JSON.toJSONString(map);
            excel1.setValue(s);
            excel1.setTime(date);
            excel1.setCode(code);
            excel1.setDate(date2);
            excelMapper.insert(excel1);
            excelBO.setId(excel1.getId());
            excelBO.setTime(excel1.getTime());
            excelBO.setDate(date2);
 
        }else {
            HashMap<String, Object> map = new HashMap<>();
            MultipartFile file1 = files.get(0);
            Map<String, Object> map1 = getMap1(file1);
            map.put("c1",map1);
            MultipartFile file2 = files.get(1);
            Map<String, Object> map2 = getMap2(file2);
            map.put("c2",map2);
            MultipartFile file3 = files.get(2);
            Map<String, Object> map3 = getMap3(file3);
            map.put("c3",map3);
            MultipartFile file4 = files.get(3);
            Map<String, Object> map4 = getMap4(file4);
            map.put("c4",map4);
            MultipartFile file5 = files.get(4);
            Map<String, Object> map5 = getMap5(file5);
            map.put("c5",map5);
            if (files.size()>5){
                MultipartFile file6 = files.get(5);
                Map<String, Object> map6 = getMap6(file6);
                map.put("c6",map6);
            }
            String s = JSON.toJSONString(map);
            excel.setValue(s);
            excelMapper.updateById(excel);
            excelBO.setId(excel.getId());
            excelBO.setTime(excel.getTime());
            excelBO.setDate(date2);
        }
        return excelBO;
    }
 
    /**
     * 高新区导出
     * @param id
     * @return
     */
    @Override
    public ExcelVo export(Integer id) {
        HashMap<String, Object> map1 = new HashMap<>();
        ArrayList<Map<String,Object>> list1 = new ArrayList<>();
        ArrayList<Map<String,Object>> list2 = new ArrayList<>();
        ArrayList<Map<String,Object>> list3 = new ArrayList<>();
        ArrayList<Map<String,Object>> list4 = new ArrayList<>();
        ArrayList<Map<String,Object>> list5= new ArrayList<>();
        ExcelVo excelVo = new ExcelVo();
        //类型转换
        TbExcel excel = excelMapper.selectById(id);
        String value = excel.getValue();
 
        JSONObject jsonObject = JSON.parseObject(value);
        Map map4 = JSON.parseObject(value, Map.class);
        Set sets = map4.keySet();
        for (Object set : sets) {
            if (set.equals("c1")){
                Object o = map4.get(set);
                String s = JSON.toJSONString(o);
                Map map5 = JSON.parseObject(s, Map.class);
                Set set1s = map5.keySet();
                for (Object set1 : set1s) {
                    Object o1 = map5.get(set1);
                    String s1 = JSON.toJSONString(o1);
                    Map map6 = JSON.parseObject(s1, Map.class);
                    list1.add(map6);
                }
            }
            if (set.equals("c2")){
                Object o = map4.get(set);
                String s = JSON.toJSONString(o);
                Map map5 = JSON.parseObject(s, Map.class);
                Set set1s = map5.keySet();
                for (Object set1 : set1s) {
                    Object o1 = map5.get(set1);
                    String s1 = JSON.toJSONString(o1);
                    Map map6 = JSON.parseObject(s1, Map.class);
                    list2.add(map6);
                }
            }
            if (set.equals("c3")){
                Object o = map4.get(set);
                String s = JSON.toJSONString(o);
                Map map5 = JSON.parseObject(s, Map.class);
                Set set1s = map5.keySet();
                for (Object set1 : set1s) {
                    if (set1.equals("高新区")){
                        Object o1 = map5.get(set1);
                        String s1 = JSON.toJSONString(o1);
                        Map map6 = JSON.parseObject(s1, Map.class);
                        map6.put("place","国控站");
                        list3.add(map6);
                    }else {
                        Object o1 = map5.get(set1);
                        String s1 = JSON.toJSONString(o1);
                        Map map6 = JSON.parseObject(s1, Map.class);
                        map6.put("place",set1.toString().substring(3));
                        list3.add(map6);
                    }
                }
            }
            if (set.equals("c4")){
                Object o = map4.get(set);
                String s = JSON.toJSONString(o);
                Map map5 = JSON.parseObject(s, Map.class);
                Set set1s = map5.keySet();
                for (Object set1 : set1s) {
                    Object o1 = map5.get(set1);
                    String s1 = JSON.toJSONString(o1);
                    Map map6 = JSON.parseObject(s1, Map.class);
                    String o2 = String.valueOf(map6.get("PM2_5m"));
 
                    String place = String.valueOf(map6.get("place"));
                    String o3m = String.valueOf(map6.get("O3m"));
                    String aqIm = String.valueOf(map6.get("AQIm")) ;
                    String o2s =String.valueOf(map6.get("PM2_5y"));
                    String O3ms = String.valueOf(map6.get("O3y")) ;
                    String aqIms = String.valueOf(map6.get("AQIy"));
                    String result = o2+"、"+o3m+"、"+aqIm+"、"+o2s+"、"+O3ms+"、"+aqIms;
                    map1.put(place,result);
                    list4.add(map6);
                }
            }
            if (set.equals("c5")){
                Object o = map4.get(set);
                String s = JSON.toJSONString(o);
                Map map5 = JSON.parseObject(s, Map.class);
                Set set1s = map5.keySet();
                for (Object set1 : set1s) {
                    Object o1 = map5.get(set1);
                    String s1 = JSON.toJSONString(o1);
                    Map map6 = JSON.parseObject(s1, Map.class);
                    list5.add(map6);
                }
            }
        }
 
        //第四个文件
        String c4 = jsonObject.getString("c4");
        JSONObject jsonObject3 = JSON.parseObject(c4);
        String gxq = jsonObject3.getString("高新区");
        JSONObject jsonObject4 = JSON.parseObject(gxq);
 
        String PM25m = jsonObject4.getString("PM2_5m");
        String PM25ms = jsonObject4.getString("PM2_5ms");
        String code1 = getString(PM25ms);
        String O3m = jsonObject4.getString("O3m");
        String O3ms = jsonObject4.getString("O3ms");
        String code2 = getString(O3ms);
        String AQIm = jsonObject4.getString("AQIm");
        String AQIms = jsonObject4.getString("AQIms");
        String code3 = getString(AQIms);
        String PM25y = jsonObject4.getString("PM2_5y");
        String PM25ys = jsonObject4.getString("PM2_5ys");
        String code4 = getString(PM25ys);
        String O3y = jsonObject4.getString("O3y");
        String O3ys = jsonObject4.getString("O3ys");
        String code5 = getString(O3ys);
        String AQIy = jsonObject4.getString("AQIy");
        String AQIys = jsonObject4.getString("AQIys");
        String code6 = getString(AQIys);
 
        StringBuilder sb1 = new StringBuilder();
        StringBuilder sb2 = new StringBuilder();
        StringBuilder sb3 = new StringBuilder();
        StringBuilder sb4 = new StringBuilder();
        StringBuilder sb5 = new StringBuilder();
        StringBuilder sb6 = new StringBuilder();
        Set<String> trims = map1.keySet();
        for (String trim : trims) {
            String o = (String) map1.get(trim);
            String[] split = o.split("、");
            if (Double.parseDouble(split[0])>Double.parseDouble(PM25m)){
                sb1.append(trim.substring(3)+"、");
            }
            if (Double.parseDouble(split[1])>Double.parseDouble(O3m)){
                sb2.append(trim.substring(3)+"、");
            }
            if (Double.parseDouble(split[2])<Double.parseDouble(AQIm)){
                sb3.append(trim.substring(3)+"、");
            }
            if (Double.parseDouble(split[3])>Double.parseDouble(PM25y)){
                sb4.append(trim.substring(3)+"、");
            }
            if (Double.parseDouble(split[4])>Double.parseDouble(O3y)){
                sb5.append(trim.substring(3)+"、");
            }
            if (Double.parseDouble(split[5])<Double.parseDouble(AQIy)){
                sb6.append(trim.substring(3)+"、");
            }
        }
        String builder1 = getBuilder(sb1);
        String builder2 = getBuilder(sb2);
        String builder3 = getBuilder(sb3);
        String builder4 = getBuilder(sb4);
        String builder5 = getBuilder(sb5);
        String builder6 = getBuilder(sb6);
        excelVo.setName1(builder1);
        excelVo.setName2(builder2);
        excelVo.setName3(builder3);
        excelVo.setName4(builder4);
        excelVo.setName5(builder5);
        excelVo.setName6(builder6);
 
        //第五个文件
        String c5 = jsonObject.getString("c5");
        JSONObject jsonObject5 = JSON.parseObject(c5);
        String cxq = jsonObject5.getString("彩香");
        JSONObject jsonObject6 = JSON.parseObject(cxq);
        String cxp = jsonObject6.getString("PM2_5y");
        double CX = 0.0;
        if (!cxp.equals("--")){
           CX = Double.parseDouble(cxp);
        }
        double aDouble = 0.0;
        if (!PM25y.equals("--")){
             aDouble = Double.parseDouble(PM25y);
        }
        double v = aDouble - CX;
        if (v>=0){
            excelVo.setDiff1("高于");
            excelVo.setCode1(String.valueOf(new BigDecimal(v).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue()));
        }else {
            excelVo.setDiff1("低于");
            excelVo.setCode1(String.valueOf(new BigDecimal(Math.abs(v)).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue()));
        }
        String xcq = jsonObject5.getString("相城区");
        JSONObject jsonObject7 = JSON.parseObject(xcq);
        String xcp = jsonObject7.getString("PM2_5y");
         double XCP = 0.0;
        if (!xcp.equals("--")){
            XCP = Double.parseDouble(xcp);
        }
        double v1 = aDouble - XCP;
        if (v1>=0){
            excelVo.setDiff2("高于");
            excelVo.setCode2(String.valueOf(new BigDecimal(v1).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue()));
        }else {
            excelVo.setDiff2("低于");
            excelVo.setCode2(String.valueOf(new BigDecimal(Math.abs(v1)).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue()));
 
        }
 
 
 
        //第一个文件
        String c1 = jsonObject.getString("c1");
        JSONObject jsonObject1 = JSON.parseObject(c1);
        //高新区
        String cx = jsonObject1.getString("高新区");
        JSONObject jsonObject2 = JSON.parseObject(cx);
        String reTime = jsonObject2.getString("日期");
        Date reDate = DateUtils.getDate(reTime, "yyyy-MM-dd");
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
        String format = simpleDateFormat.format(reDate);
        String substring = format.substring(5);
        String CO = jsonObject2.getString("CO");
        String NO2 = jsonObject2.getString("NO2");
        String SO2 = jsonObject2.getString("SO2");
        String PM10 = jsonObject2.getString("PM10");
        String PM25 = jsonObject2.getString("PM2_5");
        String s1 = jsonObject2.getString("SU");
        String O8 = jsonObject2.getString("O3_8H");
        String s3 = jsonObject2.getString("空气质量类别");
        String s4 = jsonObject2.getString("空气质量级别");
        int count = 0;
        if (Double.parseDouble(PM10)<150){
            count++;
        }
        if (Double.parseDouble(PM25)<75){
            count++;
        }
        if (Double.parseDouble(SO2)<150){
            count++;
        }
        if (Double.parseDouble(NO2)<80){
            count++;
        }
        if (Double.parseDouble(CO)<4){
            count++;
        }
        if (!O8.equals("--")) {
            if (Double.parseDouble(O8) < 160) {
                count++;
            }
        }
 
 
 
//        String res =  substring+",我区空气质量为"+s3+s4+",首要污染物为:"+s1+"。从空气6因子看," +
//                 count+"项达标:PM10为"+PM10+"ug/m³(标准值150μg/m³);PM2.5为"+PM25+"μg/m³(标准值75μg/m³);" +
//                 "SO2为"+SO2+"μg/m³(标准值150μg/m³);NO2为"+NO2+"μg/m³(标准值80μg/m³);CO为"+CO+"mg/m³" +
//                 "(标准值4mg/m³);O3-8H为"+O8+"μg/m³(标准值160μg/m³)。";
//        String month ="我区月度(9月1日-13日)PM2.5浓度为"+PM25m+"微克/立方米,同比"+code1+"%。" +
//                "臭氧8小时滑动平均值90百分位数浓度为"+O3m+"微克/立方米,同比"+code2+"%。" +
//                "空气质量优良天数比例为"+AQIm+"%,同比"+code3+"%。";
//        String  years= "今年以来(01月1日-"+substring+"),我区PM2.5浓度为"+PM25y+"微克/立方米,同比"+code4+"%。" +
//                "臭氧8小时滑动平均值90百分位数浓度为"+O3y+"微克/立方米,同比"+code5+"%。" +
//                "空气质量优良天数比例为"+AQIy+"%,同比"+code6+"%。";
 
        excelVo.setQuality(s4+s3);
        excelVo.setSu(s1);
        excelVo.setCount(count);
        excelVo.setPM10(PM10);
        excelVo.setPM25(PM25);
        excelVo.setSO2(SO2);
        excelVo.setNO2(NO2);
        excelVo.setCO(CO);
        excelVo.setO3_8H(O8);
        excelVo.setPM25m(PM25m);
        excelVo.setPM25ms(code1);
        excelVo.setO3m(O3m);
        excelVo.setO3ms(code2);
        excelVo.setAQIm(AQIm);
        excelVo.setAQIms(code3);
        excelVo.setPM25y(PM25y);
        excelVo.setPM25ys(code4);
        excelVo.setO3y(O3y);
        excelVo.setO3ys(code5);
        excelVo.setAQIy(AQIy);
        excelVo.setAQIys(code6);
        excelVo.setTime1(format);
        excelVo.setTime(substring);
 
        excelVo.setList1(list1);
        excelVo.setList2(list2);
        excelVo.setList3(list3);
        excelVo.setList4(list4);
        excelVo.setList5(list5);
 
        return excelVo;
    }
 
    /**
     * 查询
     * @param startTime
     * @param code
     * @return
     */
    @Override
    public List<ExcelBO> excelSelect(String startTime, String code,String endTime) {
        ArrayList<ExcelBO> excelBOS = new ArrayList<>();
        QueryWrapper<TbExcel> wrapper = new QueryWrapper<>();
        wrapper.between("time",startTime,endTime);
        wrapper.eq("code",code);
        List<TbExcel> tbExcels = excelMapper.selectList(wrapper);
        if (tbExcels==null){
            return null;
        }
        for (TbExcel tbExcel : tbExcels) {
            ExcelBO excelBO = new ExcelBO();
            BeanUtils.copyProperties(tbExcel,excelBO);
            excelBOS.add(excelBO);
        }
 
        return excelBOS;
    }
 
    /**
     * 天数据补充
     * @param files
     * @return
     */
    @Override
    public void rexcelImport(List<MultipartFile> files) throws IOException {
        MultipartFile file = files.get(0);
        XSSFWorkbook workbook = new XSSFWorkbook(file.getInputStream());
//        HashMap<String, Object> rsMap = new HashMap<>();
        ArrayList<Map<String, Object>> list = new ArrayList<>();
        XSSFSheet sheetAt = workbook.getSheetAt(0);
        //一共有多少行
        int lastRowNum = sheetAt.getLastRowNum();
        for (int i = 1; i <= lastRowNum; i++) {
            XSSFRow row = sheetAt.getRow(i);
            if (row == null) {
                continue;
            }
            short lastCellNum = row.getLastCellNum();
//            if (lastCellNum < 10) {
//                continue;
//            }
            Object[] objects = new Object[lastCellNum];
            for (int j = 0; j < lastCellNum; j++) {
                Cell cell = row.getCell(j);
                Object value = ExcelUtils.getValue(cell);
                objects[j] = value;
            }
            HashMap<String, Object> map = new HashMap<>();
            map.put("mac", objects[0]);
            map.put("time", objects[1]);
            // pm2.5
            if (!objects[2].toString().equals("-")){
                map.put("a34004", objects[2]);
            }
 
            // pm10
            if (!objects[3].toString().equals("-")){
                map.put("a34002", objects[3]);
            }
            // 二氧化硫
            if (!objects[4].toString().equals("-")){
                map.put("a21026", objects[4]);
            }
            // 二氧化氮
            if (!objects[5].toString().equals("-")){
                map.put("a21004", objects[5]);
            }
            // co
            if (!objects[6].toString().equals("-")){
                map.put("a21005", objects[6]);
            }
            // o3
            if (!objects[7].toString().equals("-")){
                map.put("a05024", objects[7]);
            }
 
            // 温度
            if (!objects[8].toString().equals("-")){
                map.put("a01001", objects[8]);
            }
            // 湿度
            if (!objects[9].toString().equals("-")){
                map.put("a01002", objects[9]);
            }
            // 风速
            if (!objects[10].toString().equals("-")){
                map.put("a01007", objects[10]);
            }
            // 风向
            if (!objects[11].toString().equals("-")){
                map.put("a01008", objects[11]);
            }
 
            // 气压
            if (!objects[12].toString().equals("-")){
                map.put("a01006", objects[12]);
            }
            // 光照强度
            if (!objects[13].toString().equals("-")){
                map.put("a00e12", objects[13]);
            }
            // tvoc
            if (!objects[14].toString().equals("-")){
                map.put("a99054", objects[14]);
            }
 
//            map.put("颗粒物0.3", objects[15]);
//            map.put("颗粒物2.5", objects[16]);
//            map.put("硫化氢", objects[17]);
//            map.put("氨气", objects[18]);
//            map.put("苯", objects[19]);
//            map.put("甲苯", objects[20]);
//            map.put("二甲苯", objects[21]);
//            map.put("非甲烷总烃", objects[22]);
            list.add(map);
        }
//        ArrayList<HistoryDaily> rsList = new ArrayList<>();
        for (Map<String, Object> map : list) {
            HistoryDaily historyDaily = new HistoryDaily();
            String time = map.remove("time").toString();
            Date date=null;
            if (time.length()>20){
                date = DateUtils.dateStringToDate(time);
            }else {
                date = DateUtils.getDate(time, DateUtils.yyyy_MM_dd_HH_mm_ss_EN);
            }
 
            String mac = map.remove("mac").toString();
            String value = JSONObject.toJSONString(map);
            historyDaily.setMac(mac);
            historyDaily.setTime(date);
            historyDaily.setValue(value);
//            log.info(historyDaily.getValue());
            historyDailyMapper.insert(historyDaily);
//            rsList.add(historyDaily);
        }
    }
 
 
    private String getBuilder(StringBuilder sb) {
        if (sb.length() > 0 && sb.charAt(sb.length() - 1) == '、') {
            sb.deleteCharAt(sb.length() -1 );
        }else {
            sb.append("无");
        }
        String s = sb.toString();
        return s;
    }
 
    private String getString(String value) {
        String code =null;
        double aDouble = 0.0;
        if (!value.equals("--")){
             aDouble = Double.parseDouble(value);
        }
 
        if (aDouble>=0){
            code = "上升"+ value;
        }else {
            String s = value.substring(1);
            code = "下降"+ s;
        }
        return code;
    }
 
 
    private Map<String, Object> getMap4(MultipartFile file) throws IOException {
        XSSFWorkbook workbook = new XSSFWorkbook(file.getInputStream());
        HashMap<String, Object> rsMap = new HashMap<>();
        XSSFSheet sheetAt = workbook.getSheetAt(0);
        //一共有多少行
        int lastRowNum = sheetAt.getLastRowNum();
        for (int i = 5; i <= lastRowNum; i++) {
            XSSFRow row = sheetAt.getRow(i);
            if (row == null) {
                continue;
            }
            short lastCellNum = row.getLastCellNum();
            if (lastCellNum < 10) {
                continue;
            }
            Object[] objects = new Object[lastCellNum];
            for (int j = 0; j < lastCellNum; j++) {
                Cell cell = row.getCell(j);
 
                Object value = ExcelUtils.getValue(cell);
                objects[j] = value;
            }
            HashMap<String, Object> map = new HashMap<>();
            map.put("place", objects[0]);
            map.put("PM2_5d", objects[1]);
            map.put("PM2_5m", objects[2]);
            map.put("PM2_5y", objects[3]);
            map.put("PM2_5r", objects[4]);
            map.put("PM2_5ms", objects[5]);
            map.put("PM2_5ys", objects[6]);
            map.put("PM2_5rs", objects[7]);
            map.put("AQId", objects[8]);
            map.put("AQIm", objects[9]);
            map.put("AQIy", objects[10]);
            map.put("AQIr", objects[11]);
            map.put("AQIms", objects[12]);
            map.put("AQIys", objects[13]);
            map.put("AQIrs", objects[14]);
            map.put("O3d", objects[15]);
            map.put("O3m", objects[16]);
            map.put("O3y", objects[17]);
            map.put("O3r", objects[18]);
            map.put("O3ms", objects[19]);
            map.put("O3ys", objects[20]);
            map.put("O3rs", objects[21]);
            rsMap.put(objects[0].toString(), map);
        }
        return rsMap;
    }
    private Map<String, Object> getMap1(MultipartFile file) throws IOException {
        XSSFWorkbook workbook = new XSSFWorkbook(file.getInputStream());
        HashMap<String, Object> rsMap = new HashMap<>();
        XSSFSheet sheetAt = workbook.getSheetAt(0);
        //一共有多少行
        int lastRowNum = sheetAt.getLastRowNum();
        for (int i = 3; i <= lastRowNum; i++) {
            XSSFRow row = sheetAt.getRow(i);
            if (row == null) {
                continue;
            }
            short lastCellNum = row.getLastCellNum();
            if (lastCellNum < 10) {
                continue;
            }
            Object[] objects = new Object[lastCellNum];
            for (int j = 0; j < lastCellNum; j++) {
                Cell cell = row.getCell(j);
                Object value = ExcelUtils.getValue(cell);
                objects[j] = value;
            }
            HashMap<String, Object> map = new HashMap<>();
            map.put("place", objects[0]);
            map.put("日期", objects[1]);
            map.put("SO2", objects[2]);
            map.put("SO2分指数", objects[3]);
            map.put("NO2", objects[4]);
            map.put("NO2分指数", objects[5]);
            map.put("PM10", objects[6]);
            map.put("PM10分指数", objects[7]);
            map.put("CO", objects[8]);
            map.put("CO分指数", objects[9]);
            map.put("O3_1h", objects[10]);
            map.put("O3一小时分指数", objects[11]);
            map.put("O3_8H", objects[12]);
            map.put("O3八小时分指数", objects[13]);
            map.put("PM2_5", objects[14]);
            map.put("PM2_5分指数", objects[15]);
            map.put("AQI", objects[16]);
            map.put("SU", objects[17]);
            map.put("空气质量级别", objects[18]);
            map.put("空气质量类别", objects[19]);
 
            rsMap.put(objects[0].toString(), map);
        }
        return rsMap;
    }
 
 
    private Map<String, Object> getMap2(MultipartFile file) throws IOException {
        XSSFWorkbook workbook = new XSSFWorkbook(file.getInputStream());
        HashMap<String, Object> rsMap = new HashMap<>();
        XSSFSheet sheetAt = workbook.getSheetAt(0);
        //一共有多少行
        int lastRowNum = sheetAt.getLastRowNum();
        for (int i = 3; i <= lastRowNum; i++) {
            XSSFRow row = sheetAt.getRow(i);
            if (row == null) {
                continue;
            }
            short lastCellNum = row.getLastCellNum();
            if (lastCellNum < 10) {
                continue;
            }
            Object[] objects = new Object[lastCellNum];
            for (int j = 0; j < lastCellNum; j++) {
                Cell cell = row.getCell(j);
                Object value = ExcelUtils.getValue(cell);
                objects[j] = value;
            }
            HashMap<String, Object> map = new HashMap<>();
            if (objects[0].toString().equals("高新区")){
                map.put("place", "国控站");
            }else {
                map.put("place",objects[0].toString().substring(3));
            }
            map.put("日期", objects[1]);
            map.put("SO2", objects[2]);
            map.put("SO2分指数", objects[3]);
            map.put("NO2", objects[4]);
            map.put("NO2分指数", objects[5]);
            map.put("PM10", objects[6]);
            map.put("PM10分指数", objects[7]);
            map.put("CO", objects[8]);
            map.put("CO分指数", objects[9]);
            map.put("O3_1h", objects[10]);
            map.put("O3一小时分指数", objects[11]);
            map.put("O3_8H", objects[12]);
            map.put("O3八小时分指数", objects[13]);
            map.put("PM2_5", objects[14]);
            map.put("PM2_5分指数", objects[15]);
            map.put("AQI", objects[16]);
            map.put("SU", objects[17]);
            map.put("空气质量级别", objects[18]);
            map.put("空气质量类别", objects[19]);
 
            rsMap.put(objects[0].toString(), map);
        }
        return rsMap;
    }
 
    private Map<String, Object> getMap3(MultipartFile file) throws IOException {
        
        XSSFWorkbook workbook = new XSSFWorkbook(file.getInputStream());
        HashMap<String, List<Double>> rsMap = new HashMap<>();
        HashMap<String, Map<String, List<Double>>> maps = new HashMap<>();
        HashMap<String, List<Double>> map1 = new HashMap<>();
        HashMap<String, List<Double>> map2 = new HashMap<>();
 
 
 
        XSSFSheet sheetAt = workbook.getSheetAt(0);
        //一共有多少行
        int lastRowNum = sheetAt.getLastRowNum();
        for (int i = 3; i <= lastRowNum; i++) {
            XSSFRow row = sheetAt.getRow(i);
            if (row == null) {
                continue;
            }
            short lastCellNum = row.getLastCellNum();
            if (lastCellNum < 10) {
                continue;
            }
            Object[] objects = new Object[lastCellNum];
            for (int j = 0; j < lastCellNum; j++) {
                Cell cell = row.getCell(j);
                Object value = ExcelUtils.getValue(cell);
                objects[j] = value;
            }
 
 
            //CO
            double CO=0.0;
            if (!(objects[8].toString()).equals("--")){
                CO = Double.parseDouble(objects[8].toString());
            }
 
            //o3
            double O3=0.0;
            if (!(objects[12].toString()).equals("--")){
               O3 = Double.parseDouble(objects[12].toString());
            }
 
 
 
 
 
            if (map1.get(objects[0].toString())==null){
                ArrayList<Double> doubles1 = new ArrayList<>();
                ArrayList<Double> doubles2 = new ArrayList<>();
                doubles1.add(CO);
                doubles2.add(O3);
                map1.put(objects[0].toString(),doubles1);
                map2.put(objects[0].toString(),doubles2);
            }else {
                List<Double> doubles = map1.get(objects[0].toString());
                doubles.add(CO);
                List<Double> lists = map2.get(objects[0].toString());
                lists.add(O3);
            }
 
            if (maps.get(objects[0].toString())==null){
                ArrayList<Double> list1 = new ArrayList<>();
                ArrayList<Double> list2 = new ArrayList<>();
                ArrayList<Double> list4 = new ArrayList<>();
                ArrayList<Double> list3 = new ArrayList<>();
                HashMap<String, List<Double>> ListHashMap = new HashMap<>();
                if (!(objects[2].toString()).equals("--")){
                    double SO21 = Double.parseDouble(objects[2].toString());
                    list1.add(SO21);
                }
                if (!(objects[4].toString()).equals("--")){
                    double NO21 = Double.parseDouble(objects[4].toString());
                    list2.add(NO21);
                }
                if (!(objects[6].toString()).equals("--")){
                  double  PM101 = Double.parseDouble(objects[6].toString());
                  list3.add(PM101);
                }
                if (!(objects[14].toString()).equals("--")){
                  double PM2_51 = Double.parseDouble(objects[14].toString());
                    list4.add(PM2_51);
               }
 
                ListHashMap.put("SO2",list1);
                ListHashMap.put("NO2",list2);
                ListHashMap.put("PM10",list3);
                ListHashMap.put("PM2_5",list4);
                maps.put(objects[0].toString(),ListHashMap);
 
            }else {
                Map<String, List<Double>> stringListMap = maps.get(objects[0].toString());
                List<Double> SO2List = stringListMap.get("SO2");
                if (!(objects[2].toString()).equals("--")){
                    double SO21 = Double.parseDouble(objects[2].toString());
                    SO2List.add(SO21);
                }
 
                List<Double> NO2List = stringListMap.get("NO2");
                if (!(objects[4].toString()).equals("--")){
                    double NO21 = Double.parseDouble(objects[4].toString());
                    NO2List.add(NO21);
                }
 
                List<Double> PM10List = stringListMap.get("PM10");
                if (!(objects[6].toString()).equals("--")){
                    double  PM101 = Double.parseDouble(objects[6].toString());
                    PM10List.add(PM101);
                }
 
                List<Double> PM2_5List = stringListMap.get("PM2_5");
                if (!(objects[14].toString()).equals("--")){
                    double PM2_51 = Double.parseDouble(objects[14].toString());
                    PM2_5List.add(PM2_51);
                }
 
            }
        }
        Set<String> strings2 = maps.keySet();
        for (String s : strings2) {
            Map<String, List<Double>> stringListMap = maps.get(s);
            ArrayList<Double> list = new ArrayList<>();
            Double so2 = getYz(stringListMap, "SO2");
            Double no2 = getYz(stringListMap, "NO2");
            Double pm10 = getYz(stringListMap, "PM10");
            Double pm2_5 = getYz(stringListMap, "PM2_5");
            list.add(so2);
            list.add(no2);
            list.add(pm10);
            list.add(pm2_5);
            rsMap.put(s,list);
        }
 
        HashMap<String, List<Double>> ListHashMap = new HashMap<>();
        Set<String> strings = rsMap.keySet();
        for (String string : strings) {
            List<Double> list = getList(rsMap, map1, map2, string);
            ListHashMap.put(string,list);
        }
        //计算aqi和首要污染物
        HashMap<String, Object> resultMap = new HashMap<>();
        Set<String> strings1 = ListHashMap.keySet();
        for (String s : strings1) {
            HashMap<String, Object> map = new HashMap<>();
            List<Double> doubles = ListHashMap.get(s);
 
            ArrayList<Double> list = new ArrayList<>();
            double co = getCo(doubles.get(0));
            double so2 = getSo2(doubles.get(1));
            double no2 = getNo2(doubles.get(2));
            double pm10 = getPm10(doubles.get(3));
            double pm2_5 = getPm2_5(doubles.get(4));
            double o3 = getO3(doubles.get(5));
            list.add(co);
            list.add(so2);
            list.add(no2);
            list.add(pm10);
            list.add(pm2_5);
            list.add(o3);
 
            Double aqi = Collections.max(list);
 
            map.put("a21005",doubles.get(0));
            map.put("a21026",doubles.get(1));
            map.put("a21004",doubles.get(2));
            map.put("a34002",doubles.get(3));
            map.put("a34004",doubles.get(4));
            map.put("a05024",doubles.get(5));
            map.put("AQI",aqi);
            map.put("SU", getSU(aqi,list));
            resultMap.put(s,map);
        }
        return resultMap;
    }
 
 
 
    /**
     * 计算平均值
     * @param stringListMap
     */
    private Double getYz(Map<String, List<Double>> stringListMap,String code) {
        List<Double> doubles = stringListMap.get(code);
        double v = new BigDecimal(doubles.stream().collect(Collectors.averagingDouble(Double::doubleValue))).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue();
        return v;
    }
 
    /**
     * 计算月累计参数
     * @param rsMap
     * @param map1
     * @param map2
     * @param code
     * @return
     */
    private List<Double> getList(HashMap<String, List<Double>> rsMap, HashMap<String, List<Double>> map1, HashMap<String, List<Double>> map2,String code) {
        ArrayList<Double> list = new ArrayList<>();
        List<Double> doubles1 = map1.get(code);
        double percentiles1 = getPercentiles(doubles1, 0.95);
        double co = getDouble(percentiles1);
        list.add(co);
        List<Double> doubles2 = map2.get(code);
        double percentiles2 = getPercentiles(doubles2, 0.90);
        List<Double> doubles3 = rsMap.get(code);
        for (int i = 0; i < doubles3.size(); i++) {
           double anInt = getInt(doubles3.get(i));
            list.add(anInt);
        }
        double anInt = getInt(percentiles2);
        list.add(anInt);
        return list;
    }
 
    private Map<String, Object> getMap5(MultipartFile file) throws IOException {
        XSSFWorkbook workbook = new XSSFWorkbook(file.getInputStream());
        HashMap<String, Object> rsMap = new HashMap<>();
        XSSFSheet sheetAt = workbook.getSheetAt(0);
        //一共有多少行
        int lastRowNum = sheetAt.getLastRowNum();
        for (int i = 5; i <= lastRowNum; i++) {
            XSSFRow row = sheetAt.getRow(i);
            if (row == null) {
                continue;
            }
            short lastCellNum = row.getLastCellNum();
            if (lastCellNum < 10) {
                continue;
            }
            Object[] objects = new Object[lastCellNum];
            for (int j = 0; j < lastCellNum; j++) {
                Cell cell = row.getCell(j);
                Object value = ExcelUtils.getValue(cell);
                objects[j] = value;
            }
            HashMap<String, Object> map = new HashMap<>();
            map.put("place", objects[0]);
            map.put("PM2_5d", objects[1]);
            map.put("PM2_5m", objects[2]);
            map.put("PM2_5y", objects[3]);
            map.put("PM2_5r", objects[4]);
            map.put("PM2_5ms", objects[5]);
            map.put("PM2_5ys", objects[6]);
            map.put("PM2_5rs", objects[7]);
            map.put("AQId", objects[8]);
            map.put("AQIm", objects[9]);
            map.put("AQIy", objects[10]);
            map.put("AQIr", objects[11]);
            map.put("AQIms", objects[12]);
            map.put("AQIys", objects[13]);
            map.put("AQIrs", objects[14]);
            map.put("O3d", objects[15]);
            map.put("O3m", objects[16]);
            map.put("O3y", objects[17]);
            map.put("O3r", objects[18]);
            map.put("O3ms", objects[19]);
            map.put("O3ys", objects[20]);
            map.put("O3rs", objects[21]);
            rsMap.put(objects[0].toString(), map);
        }
        return rsMap;
    }
 
 
    private Map<String, Object> getMap6(MultipartFile file) throws IOException {
//        XSSFWorkbook workbook = new XSSFWorkbook(file.getInputStream());
        HSSFWorkbook workbook= new HSSFWorkbook(file.getInputStream());
        HashMap<String, Object> rsMap = new HashMap<>();
//        XSSFSheet sheetAt = workbook.getSheetAt(0);
        HSSFSheet sheetAt = workbook.getSheetAt(0);
        //一共有多少行
        int lastRowNum = sheetAt.getLastRowNum();
        for (int i = 1; i <= lastRowNum; i++) {
//            XSSFRow row = sheetAt.getRow(i);
            HSSFRow row = sheetAt.getRow(i);
            if (row == null) {
                continue;
            }
            short lastCellNum = row.getLastCellNum();
 
            Object[] objects = new Object[lastCellNum];
            for (int j = 0; j < lastCellNum; j++) {
                Cell cell = row.getCell(j);
                Object value = ExcelUtils.getValue(cell);
                objects[j] = value;
            }
            HashMap<String, Object> map = new HashMap<>();
            map.put("企业名称", objects[0]);
            map.put("设备名称", objects[1]);
            map.put("合计", objects[2]);
            map.put("油烟", objects[3]);
            map.put("颗粒物", objects[4]);
            map.put("设备离线", objects[5]);
 
            rsMap.put(objects[0].toString()+i, map);
        }
        return rsMap;
    }
 
    /**
     * excel计算公式
     * @param list
     * @param percentile
     * @return
     */
    private static double getPercentiles(List<Double> list, double percentile) {
        Collections.sort(list);
        double x = (list.size()-1) * percentile;
        int i = (int) x;
        double j = x - i;
        return (1 - j) * list.get(i) + j * list.get(i+1);
    }
 
 
    private  static double  getDouble(Double  code1){
        double floor1 = Math.floor(code1 * 10);
        //保留一位小数四舍五入
        double result = new BigDecimal(code1).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
 
 
        if (code1*100-floor1*10==5 && (result*10) % 2 !=0){
            result= result-0.1;
        }else {
            result = result-0;
        }
 
        return result;
    }
 
 
 
    private  static double  getInt(Double  code){
        //向下取整数
        double floor = Math.floor(code);
        //四舍五入
        double round = Math.round(code);
 
 
        if (code*10-(floor*10)==5  && round % 2 !=0){
            round=round-1;
        }else {
            round=round-0;
        }
        return  round;
    }
    /**
     * 计算搜要污染物
     * @param aqi
     * @param list
     * @return
     */
    private String getSU(Double aqi,ArrayList list){
        String SU=null;
        if (aqi<=50){
            SU="-";
        } else if (aqi==list.get(1)){
            SU="SO2";
        }else if (aqi==list.get(0)){
            SU="CO";
        }else if (aqi==list.get(2)){
            SU="NO2";
        }else if (aqi==list.get(3)){
            SU="PM10";
        }else if (aqi==list.get(4)){
            SU="PM2.5";
        }else if (aqi==list.get(5)){
            SU="O3";
        }
        return SU;
    }
 
    private  static  double getSo2(double so2){
        double v = 0.0;
        if (so2<50){
            v = 50 * so2 / 50;
        }else if (so2<150  && so2 >= 50){
            v = 50 * (so2 - 50) / 100 + 50;
        }else if (so2<475  && so2 >= 150){
            v = 50 * (so2 - 150) / 325 + 100;
        }else if (so2<800  && so2 >= 475){
            v = 50 * (so2 - 475) / 325 + 150;
        }else {
            v = 100 * (so2 - 800) / 800 + 200;
        }
        return Math.round(v);
    }
 
    private  static  double getNo2(double no2){
        double v = 0.0;
        if (no2<40){
            v = 50 * no2 / 40;
        }else if (no2<80  && no2 >= 40){
            v = 50 * (no2 - 40) / 40 + 50;
        }else if (no2<180  && no2 >= 80){
            v = 50 * (no2 - 80) / 100 + 100;
        }else if (no2<280  && no2 >= 180){
            v = 50 * (no2 - 180) / 100 + 150;
        }else if (no2<565  && no2 >= 280){
            v = 100 * (no2 - 280) / 285 + 200;
        }else if (no2<750  && no2 >= 565){
            v = 100 * (no2 - 565) / 185 + 300;
        }
        else {
            v = 100 * (no2 - 750) / 190 + 400;
        }
        return Math.round(v);
    }
 
 
    private  static  double getCo(double co){
        double v = 0.0;
        if (co<2){
            v = 50 * co / 2;
        }else if (co<4  && co >= 2){
            v = 50 * (co - 2) / 2 + 50;
        }else if (co<14  && co >= 4){
            v = 50 * (co - 4) / 10 + 100;
        }else if (co<24  && co >= 14){
            v = 50 * (co - 14) / 10 + 150;
        }else if (co<36  && co >= 24){
            v = 100 * (co - 24) / 12 + 200;
        }else if (co<48  && co >= 36){
            v = 100 * (co - 36) / 12 + 300;
        }
        else {
            v = 100 * (co - 48) / 12 + 400;
        }
        return Math.round(v);
    }
 
    private  static  double getPm10(double pm10){
        double v = 0.0;
        if (pm10<50){
            v = 50 * pm10 / 50;
        }else if (pm10<150  && pm10 >= 50){
            v = 50 * (pm10 - 50) / 100 + 50;
        }else if (pm10<250  && pm10 >= 150){
            v = 50 * (pm10 - 150) / 100 + 100;
        }else if (pm10<350  && pm10 >= 250){
            v = 50 * (pm10 - 250) / 100 + 150;
        }else if (pm10<420  && pm10 >= 350){
            v = 100 * (pm10 - 350) / 70 + 200;
        }else if (pm10<500  && pm10 >= 420){
            v = 100 * (pm10 - 420) / 80 + 300;
        }
        else {
            v = 100 * (pm10 - 500) / 100 + 400;
        }
        return Math.round(v);
    }
 
    private  static  double getPm2_5(double pm2_5){
        double v = 0.0;
        if (pm2_5<35){
            v = 50 * pm2_5 / 35;
        }else if (pm2_5<75  && pm2_5 >= 35){
            v = 50 * (pm2_5 - 35) / 40 + 50;
        }else if (pm2_5<115  && pm2_5 >= 75){
            v = 50 * (pm2_5 - 75) / 40 + 100;
        }else if (pm2_5<150  && pm2_5 >= 115){
            v = 50 * (pm2_5 - 115) / 35 + 150;
        }else if (pm2_5<250  && pm2_5 >= 150){
            v = 100 * (pm2_5 - 150) / 100 + 200;
        }else if (pm2_5<350  && pm2_5 >= 250){
            v = 100 * (pm2_5 - 250) / 100 + 300;
        }
        else {
            v = 100 * (pm2_5 - 350) / 150 + 400;
        }
        return Math.round(v);
    }
 
 
    private  static  double getO3(double o3){
        double v = 0.0;
        if (o3<100){
            v = 50 * o3 / 100;
        }else if (o3<160  && o3 >= 100){
            v = 50 * (o3 - 100) / 60 + 50;
        }else if (o3<215  && o3 >= 160){
            v = 50 * (o3 - 160) / 55 + 100;
        }else if (o3<265  && o3 >= 215){
            v = 50 * (o3 - 215) / 50 + 150;
        }else if (o3<800  && o3 >= 265){
            v = 100 * (o3 - 265) / 535 + 200;
        }else if (o3<1000  && o3 >= 800){
            v = 100 * (o3 - 800) / 200 + 300;
        }
        return Math.round(v);
    }
}