package com.fzzy.igds.util; 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"; /** * 创建气象信息的主键 *

* 组织编码+ 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; } }