Commit d5b09a95 authored by cq990612's avatar cq990612

优化代码结构

parent 8dad775c
......@@ -361,6 +361,16 @@ public class DateUtil {
return Integer.parseInt(String.valueOf(betweenDays));
}
public static boolean isThanDay(Date startDate, Date endDate, int thanDay) {
long betweenDays = (endDate.getTime() - startDate.getTime()) / (1000 * 3600 * 24);
long than = (endDate.getTime() - startDate.getTime()) % (1000 * 3600 * 24);
if ((betweenDays > thanDay) || (betweenDays==thanDay && than!=0)) {
return true;
}else{
return false;
}
}
/**
* 获取当前月份天数的数组
*
......
......@@ -118,7 +118,7 @@ public class WorkCollectServiceImpl implements WorkCollectService {
if (null != workCollect.getRejectTime()) {
Date rejectTime = workCollect.getRejectTime();
rejectTime = DateUtil.convertStrToDate(DateUtil.convertDateToStr(rejectTime, "yyyy-MM-dd"), "yyyy-MM-dd");
if (date.getTime() - rejectTime.getTime() > submitAdopt.getSubmitTime() * 24 * 60 * 60 * 1000) {
if (DateUtil.isThanDay(rejectTime,date,submitAdopt.getSubmitTime())) {
modifyTime = 0;
}
}
......
......@@ -81,6 +81,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
@Autowired
private WorkTypeManagerService workTypeManagerService;
// 工单状态
private final static Integer COMPLETED = StatusEnum.COMPLETED.getCode();
private final static Integer APPROVED = StatusEnum.APPROVED.getCode();
private final static Integer REJECTED = StatusEnum.REJECTED.getCode();
......@@ -262,13 +263,13 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
Date rejectTime1 = byUserIdAndWorkDay.getRejectTime();
dto.setStatus(RE_SUBMIT);
Date rejectTime = DateUtil.convertStrToDate(DateUtil.convertDateToStr(rejectTime1, "yyyy-MM-dd"), "yyyy-MM-dd");
if (date.getTime() - rejectTime.getTime() > submitTime * 24 * 60 * 60 * 1000) {
if (DateUtil.isThanDay(rejectTime,date,submitTime)) {
throw new BaseCustomException("627", "超过" + submitTime + "天的不能填报");
}
}
// 4、默认设置超过系统默认3天(包括驳回3天)未填报的工时将不能填报
if (!REJECTED.equals(dto.getStatus()) && !RE_SUBMIT.equals(dto.getStatus())) {
if (date.getTime() - dto.getWorkDay().getTime() > submitTime * 24 * 60 * 60 * 1000) {
if (DateUtil.isThanDay(dto.getWorkDay(),date,submitTime) ) {
throw new BaseCustomException("627", "超过" + submitTime + "天的不能填报");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment