cjl
2024-03-28 33b9d2c203a9998272088ecdf43a15dd53669967
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
package com.moral.util;
 
import java.util.HashMap;
import java.util.Map;
 
/**
 * @program: screen
 * @description: 天气相关数据计算工具类
 * @author: lizijie
 * @create: 2022-04-08 14:15
 **/
public class WeatherUtils {
 
    public static Map<String,Object> dressingIndex(Map map){
        //温度
        Double temp = Double.parseDouble(map.get("temp").toString());
        //湿度
        Double humidity = Double.parseDouble(map.get("humidity").toString());
        //风力等级
        Double windScale = Double.parseDouble(map.get("windScale").toString());
        //Map<String,Object> resultMap = new HashMap<>();
        String index = "";
        String feel = "";
        String clothingThickness = null;
        String advise = "";
        if(temp >= 40.0){
            index = "0";
            feel = "酷热,很不舒适";
            clothingThickness = "0mm";
            advise = "停止户外露天作业,对老弱病幼人群采取保护措施。";
        }else if (temp >= 37.0){
            index = "1-4";
            feel = "暑热,不舒适";
            clothingThickness = "0mm";
            advise = "避免在高温时段进行户外活动,老弱病幼落实防暑降温防护措施。";
        }else if (temp >= 35.0){
            index = "1-3";
            feel = "闷热,不舒适";
            clothingThickness = "0mm";
            advise = "天气闷热,适宜着丝麻、轻棉织物制作的短衣、短裙、薄短裙、短裤等夏季服装。午后尽量减少户外活动;高温条件下作业和露天作业人员采取必要防护措施。";
        }else if (temp >= 33.0){
            index = "1-2";
            feel = "炎热,不舒适";
            clothingThickness = "0mm";
            advise = "天气炎热,适宜着短衫、短裙、短裤、薄型T恤衫、敞领短袖棉衫等夏季服装。";
        }else if (temp >= 28.0){
            index = "1-1";
            feel = "热,较不舒适";
            clothingThickness = "0mm";
            advise = "天气较热,适宜着棉麻面料的衬衫、薄长裙、薄T恤等夏季服装;年老体弱者:长袖衬衫和单裤。";
        }else if (temp >= 25.0){
            if(humidity > 80){
                index = "1-1";
                feel = "热,较不舒适";
                clothingThickness = "0mm";
                advise = "天气较热,适宜着棉麻面料的衬衫、薄长裙、薄T恤等夏季服装;年老体弱者:长袖衬衫和单裤。";
            }else {
                index = "2";
                feel = "热舒适";
                clothingThickness = "0~1.5mm";
                advise = "天气偏热,适宜着短衫、短裙、短套装、T恤等夏季服装;年老体弱者:单层薄短裤、薄型棉衫。";
            }
        }else if (temp >= 23.0){
            index = "3";
            feel = "较舒适";
            clothingThickness = "1.5~2.4mm";
            advise = "天气暖和,适宜着单层棉麻面料的短套装、T恤衫、薄牛仔衫裤、休闲服、职业套装等春秋过渡装。年老体弱者请适当增减衣物。";
        }else if (temp >= 21.0){
            index = "4-1";
            feel = "舒适";
            clothingThickness = "2.41~4.0mm";
            advise = "天气温暖,适宜着长袖衬衫加单裤、单层薄短裤,薄型棉衫等春秋过渡装;年老体弱者“针织长袖衬衫+背心、长裤、薄型套装。";
        }else if (temp >= 18.0){
            index = "4-2";
            feel = "凉舒适";
            clothingThickness = "4.01~6.0mm";
            advise = "天气温和,适宜着单层薄衫裤,薄型棉衫、长袖T恤、薄型套装、牛仔衫裤、西服套装、薄型夹克等春秋过渡装;年老体弱者宜着针织长袖衬衫+马甲、长裤、夹克衫、西服套装等。";
        }else if (temp >= 15.0){
            index = "5";
            feel = "温凉,较舒适";
            clothingThickness = "6.0~7.0mm";
            advise = "天气温凉,适宜着夹衣、马甲衬衫、长裤、夹克衫、西服套装、加薄羊毛衫等春秋服装。年老体弱者:夹衣或风衣加羊毛衫。";
        }else if (temp >= 13.0){
            index = "6-1";
            feel = "微凉";
            clothingThickness = "7.01~8.0mm";
            advise = "天气微凉,适宜着意见羊毛衫、夹克衫、西服套装、马甲衬衫+夹克衫配长裤等春秋着装;年老体弱者:厚外套加毛衣、呢外套加羊毛衫。";;
        }else if (temp >= 11.0){
            index = "6-2";
            feel = "较凉";
            clothingThickness = "8.01~9.0";
            advise = "天球较凉,适宜着厚外套加毛衣、大衣、毛套装、西服套装等春秋服装。体弱者宜着大衣、毛衣加呢外套等厚型春秋服装。";
        }else if (temp >= 8.0){
            index = "6-3";
            feel = "凉";
            clothingThickness = "9.01~10.0mm";
            advise = "天气凉,适宜着一到两件羊毛衫、大衣、毛套装、皮夹克等春秋着装;年老体弱者宜着大衣、夹衣或风衣加羊毛衫等厚型春秋着装。";
        }else if (temp >= 5.0){
            index = "7-1";
            feel = "微冷";
            clothingThickness = "10.01~11.0mm";
            advise = "天气微冷,适宜着毛衣、风衣、大衣、皮夹克、外套、毛套装、西装、防寒服等厚型春秋着装;年老体弱者:一到两件羊毛衫+大衣或毛套装、薄棉外套等。";
        }else if (temp >= 0.0){
            if (windScale >= 4 || humidity >= 80){
                index = "7-3";
                feel = "较冷";
                clothingThickness = "12.01~13.0mm";
                advise = "天气冷,冬季着装:棉衣、羽绒衣、冬大衣、皮夹克、毛衣再外罩大衣等;年老体弱者尤其要注意保暖防冻。";
            }else {
                index = "7-2";
                feel = "较冷";
                clothingThickness = "11.01~12.0mm";
                advise = "天气较冷,适宜着薄棉衣、薄羽绒衣、皮夹克加羊毛衫等冬季服装;年老体弱者宜着厚棉衣或冬大衣。";
            }
        }else if (temp >= -4.9){
            if (windScale >= 4 || humidity >= 80){
                index = "8-1";
                feel = "寒冷";
                clothingThickness = ">=13.0.0mm";
                advise = "天气寒冷,冬季着装:棉衣、羽绒服、冬大衣、皮夹克加羊毛衫、厚呢外套、呢帽、手套等;年老体弱者尽量少外出。";
            }else {
                index = "7-3";
                feel = "冷";
                clothingThickness = "12.01~13.0";
                advise = "天气冷,冬季着装:棉衣、羽绒衣、冬大衣、皮夹克、毛衣再外罩大衣等;年老体弱者尤其要注意保暖防冻。";
            }
        }else if (temp >= -9.9){
            if (windScale <= 4 || humidity < 80){
                index = "8-1";
                feel = "寒冷";
                clothingThickness = ">=13.0.0mm";
                advise = "天气寒冷,冬季着装:棉衣、羽绒服、冬大衣、皮夹克加羊毛衫、厚呢外套、呢帽、手套等;年老体弱者尽量少外出。";
            }else if (windScale <= 4 || humidity >= 80){
                index = "8-2";
                feel = "很冷";
                clothingThickness = ">=15.0";
                advise = "温度极低,尽量少外出;建议着厚棉衣、厚羽绒服、冬大衣、皮夹克、裘皮大衣、棉(皮)帽、棉(皮)手套、棉(皮)靴等隆冬着装。";
            }else if (windScale >= 4 || humidity < 80){
                index = "8-2";
                feel = "很冷";
                clothingThickness = ">=15.0";
                advise = "温度极低,尽量少外出;建议着厚棉衣、厚羽绒服、冬大衣、皮夹克、裘皮大衣、棉(皮)帽、棉(皮)手套、棉(皮)靴等隆冬着装。";
            }else if (windScale >= 4 || humidity >= 80){
                index = "8-3";
                feel = "极冷";
                clothingThickness = ">=15.0";
                advise = "温度极低,尽量少外出;建议着厚棉衣、厚羽绒服、冬大衣、皮夹克、裘皮大衣、棉(皮)帽、棉(皮)手套、棉(皮)靴等隆冬着装。";
            }
        }else if (temp <= -10.0){
            index = "8-3";
            feel = "极冷";
            clothingThickness = ">=15.0";
            advise = "温度极低,尽量少外出;建议着厚棉衣、厚羽绒服、冬大衣、皮夹克、裘皮大衣、棉(皮)帽、棉(皮)手套、棉(皮)靴等隆冬着装。";
        }
        map.put("index",index);
        map.put("feel",feel);
        map.put("clothingThickness",clothingThickness);
        map.put("advise",advise);
        System.out.println(map);
        return map;
    }
 
}