Commit b020131f authored by cq990612's avatar cq990612

优化代码结构

parent 1191b4cb
...@@ -203,7 +203,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -203,7 +203,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
List<WorkTimeOrderDto> workTimeOrders = createWorkOrderDto.getWorkTimeOrders(); List<WorkTimeOrderDto> workTimeOrders = createWorkOrderDto.getWorkTimeOrders();
Date date = new Date(); Date date = new Date();
WorkSubmitAdopt workSubmitAdopt = workSubmitAdoptService.getById(1); WorkSubmitAdopt workSubmitAdopt = workSubmitAdoptService.getById(1);
Integer autoExamine = workSubmitAdopt.getAutoExamine(); Integer submitTime = workSubmitAdopt.getSubmitTime();
// 1.判断是否重复填报 // 1.判断是否重复填报
isRepeat(workTimeOrders); isRepeat(workTimeOrders);
...@@ -259,14 +259,14 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -259,14 +259,14 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
for (WorkTimeOrder dto : addList) { for (WorkTimeOrder dto : addList) {
// 4、默认设置超过系统默认3天(包括驳回3天)未填报的工时将不能填报 // 4、默认设置超过系统默认3天(包括驳回3天)未填报的工时将不能填报
if (!REJECTED.equals(dto.getStatus()) && !RE_SUBMIT.equals(dto.getStatus())) { if (!REJECTED.equals(dto.getStatus()) && !RE_SUBMIT.equals(dto.getStatus())) {
if (date.getTime() - dto.getWorkDay().getTime() > autoExamine * 24 * 60 * 60 * 1000) { if (date.getTime() - dto.getWorkDay().getTime() > submitTime * 24 * 60 * 60 * 1000) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.WORK_DAY_THAN_DATE); throw new BaseCustomException(BASE_RESP_CODE_ENUM.WORK_DAY_THAN_DATE);
} }
} }
if (REJECTED.equals(dto.getStatus()) || RE_SUBMIT.equals(dto.getStatus())) { if (REJECTED.equals(dto.getStatus()) || RE_SUBMIT.equals(dto.getStatus())) {
Date modifyTime = DateUtil.convertStrToDate(DateUtil.convertDateToStr(workTimeOrderMapper.selectById(dto.getWorkId()).getModifyTime(), "yyyy-MM-dd"), "yyyy-MM-dd"); Date modifyTime = DateUtil.convertStrToDate(DateUtil.convertDateToStr(workTimeOrderMapper.selectById(dto.getWorkId()).getModifyTime(), "yyyy-MM-dd"), "yyyy-MM-dd");
System.out.println(modifyTime); System.out.println(modifyTime);
if (date.getTime() - modifyTime.getTime() > autoExamine * 24 * 60 * 60 * 1000) { if (date.getTime() - modifyTime.getTime() > submitTime * 24 * 60 * 60 * 1000) {
throw new BaseCustomException(BASE_RESP_CODE_ENUM.WORK_DAY_THAN_DATE); throw new BaseCustomException(BASE_RESP_CODE_ENUM.WORK_DAY_THAN_DATE);
} }
} }
...@@ -356,6 +356,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -356,6 +356,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
if (null == projectId && null == type) { if (null == projectId && null == type) {
return null; return null;
} }
if (0 != user.getLevel()) { if (0 != user.getLevel()) {
QueryWrapper<WorkTimeOrder> wrapper = new QueryWrapper<>(); QueryWrapper<WorkTimeOrder> wrapper = new QueryWrapper<>();
wrapper.in("status", COMPLETED, RE_SUBMIT); wrapper.in("status", COMPLETED, RE_SUBMIT);
......
...@@ -61,7 +61,7 @@ public class Trigger implements SchedulingConfigurer { ...@@ -61,7 +61,7 @@ public class Trigger implements SchedulingConfigurer {
, triggerContext -> { , triggerContext -> {
Integer autoAdopt = workSubmitAdoptService.getById(1).getAutoAdopt(); Integer autoAdopt = workSubmitAdoptService.getById(1).getAutoAdopt();
String time = "0 0 0 */" + autoAdopt + " * ?"; String time = "0 30 17 */" + autoAdopt + " * ?";
//返回执行的周期 //返回执行的周期
return new CronTrigger(time).nextExecutionTime(triggerContext); return new CronTrigger(time).nextExecutionTime(triggerContext);
}); });
......
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