Commit 8721c1c2 authored by cq990612's avatar cq990612

优化代码结构

parent e7893fb4
...@@ -30,8 +30,11 @@ public class WorkSubmitAdopt implements Serializable { ...@@ -30,8 +30,11 @@ public class WorkSubmitAdopt implements Serializable {
@ApiModelProperty(name = "submitTime",value = "工时提交时限") @ApiModelProperty(name = "submitTime",value = "工时提交时限")
private Integer submitTime; private Integer submitTime;
@ApiModelProperty(name = "autoAdopt",value = "工时自动审批时限") @ApiModelProperty(name = "autoAdopt",value = "工时自动审批间隔")
private Integer autoAdopt; private Integer autoAdopt;
@ApiModelProperty(name = "autoExamine",value = "自动审批")
private Integer autoExamine;
} }
...@@ -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 submitTime = workSubmitAdopt.getSubmitTime(); Integer autoExamine = workSubmitAdopt.getAutoExamine();
// 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() > submitTime * 24 * 60 * 60 * 1000) { if (date.getTime() - dto.getWorkDay().getTime() > autoExamine * 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() > submitTime * 24 * 60 * 60 * 1000) { if (date.getTime() - modifyTime.getTime() > autoExamine * 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);
} }
} }
...@@ -355,6 +355,9 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService { ...@@ -355,6 +355,9 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
log.info("WorkOrderServiceImpl[]getExamineApplets[]input.param.userId:{},projectId:{},type:{}" + userId, projectId, type); log.info("WorkOrderServiceImpl[]getExamineApplets[]input.param.userId:{},projectId:{},type:{}" + userId, projectId, type);
isManager(userId); isManager(userId);
WorkUser user = workUserService.getById(userId); WorkUser user = workUserService.getById(userId);
if (null == projectId && null == type) {
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);
......
...@@ -49,12 +49,12 @@ public class Trigger implements SchedulingConfigurer { ...@@ -49,12 +49,12 @@ public class Trigger implements SchedulingConfigurer {
() -> { () -> {
//这里写业务方法 //这里写业务方法
WorkSubmitAdopt workSubmitAdopt = workSubmitAdoptService.getById(1); WorkSubmitAdopt workSubmitAdopt = workSubmitAdoptService.getById(1);
Integer autoAdopt = workSubmitAdopt.getSubmitTime(); Integer autoExamine = workSubmitAdopt.getAutoExamine();
// 更新work_time_order表 // 更新work_time_order表
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
c.setTime(new Date()); c.setTime(new Date());
c.add(Calendar.DATE, -autoAdopt); c.add(Calendar.DATE, -(autoExamine+1));
Date start = c.getTime(); Date start = c.getTime();
String qyt= format.format(start); String qyt= format.format(start);
Date yesterdayDate = DateUtil.convertStrToDate(qyt, "yyyy-MM-dd"); Date yesterdayDate = DateUtil.convertStrToDate(qyt, "yyyy-MM-dd");
......
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