CZT
2023-09-06 71c4fa1e27f75ae4b765c95c67a3069c84dc72ba
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
package com.ld.igds.weather;
 
import org.apache.commons.lang3.time.DateFormatUtils;
 
import java.util.Date;
 
/**
 * 常量定义
 *
 * @author: andy.jia
 * @description:
 * @version:
 * @data:2020年2月19日
 */
public class WeatherUtil {
 
    public static final String SOURCE_01 = "01";
    public static final String SOURCE_02 = "02";
 
    /**
     * 创建气象信息的主键
     * <p>
     * 组织编码+ yyyyMMddHHmm
     *
     * @return
     */
    public static String buildWeatherId(String deptId, Date updateTime) {
        if (null == updateTime)
            updateTime = new Date();
        return deptId + "-" + DateFormatUtils.format(updateTime, "yyyyMMddHHmm");
    }
 
    /**
     * 判断当前气象信息是否需要持久化,默认系统只保存在上午8点 和下午3点的气象信。
     *
     * @param updateTime
     * @return
     */
    public static boolean isSave(Date updateTime) {
 
        String tag = DateFormatUtils.format(updateTime, "HHmm");
        String tag1 = "0800";
        String tag2 = "1500";
 
        if (tag.equals(tag1) || tag.equals(tag2)) {
            return true;
        }
 
        return false;
    }
 
}