提交 ed04eae3 authored 作者: 000516's avatar 000516

添加档期执行上报异常信息

上级 71371012
......@@ -39,6 +39,7 @@ public enum ECode implements StatusCode {
RISK_STORE_TASK_CREATE_ERROR(900, "创建任务,请输入门店名称;"),
RISK_STORE_TASK_FIND_ONE_ERROR(901, "门店编码/任务ID不可同时为空;"),
FS_CREATE_APPROVAL_ERROR(902, "%s"),
SAP_EXECUTE_MONTH_ERROR(903, "执行月份必需填写计划日期的当月或次月;"),
/**
......
......@@ -232,4 +232,42 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
return intervals;
}
/**
* 判断两个日期的年月是否相等
*/
public static boolean isSameYearMonth(Date a, Date b) {
if (a == null || b == null) {
return false;
}
LocalDate dateA = toLocalDate(a);
LocalDate dateB = toLocalDate(b);
return dateA.getYear() == dateB.getYear() &&
dateA.getMonthValue() == dateB.getMonthValue();
}
/**
* 判断b是否是a的下个月
*/
public static boolean isNextMonth(Date a, Date b) {
if (a == null || b == null) {
return false;
}
LocalDate dateA = toLocalDate(a);
LocalDate dateB = toLocalDate(b);
LocalDate nextMonthOfA = dateA.plusMonths(1);
return nextMonthOfA.getYear() == dateB.getYear() &&
nextMonthOfA.getMonthValue() == dateB.getMonthValue();
}
/**
* 将Date转换为LocalDate
*/
public static LocalDate toLocalDate(Date date) {
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论