diff --git a/src/main/java/com/ydool/platform/mybatis/handler/CustomMetaObjectHandler.java b/src/main/java/com/ydool/platform/mybatis/handler/CustomMetaObjectHandler.java index 50e1a77..d4c3e35 100644 --- a/src/main/java/com/ydool/platform/mybatis/handler/CustomMetaObjectHandler.java +++ b/src/main/java/com/ydool/platform/mybatis/handler/CustomMetaObjectHandler.java @@ -1,17 +1,20 @@ package com.ydool.platform.mybatis.handler; import cn.dev33.satoken.stp.StpUtil; +import cn.hutool.extra.spring.SpringUtil; import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.reflection.MetaObject; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.time.LocalDateTime; @Component @Slf4j public class CustomMetaObjectHandler implements MetaObjectHandler { - /** * 插入时的填充策略 * @@ -19,9 +22,10 @@ public class CustomMetaObjectHandler implements MetaObjectHandler { */ @Override public void insertFill(MetaObject metaObject) { - this.setFieldValByName("createdId", StpUtil.getLoginIdAsString(), metaObject); + +// this.setFieldValByName("createdId", StpUtil.getLoginIdAsString(), metaObject); this.setFieldValByName("createdAt", LocalDateTime.now(), metaObject); - this.setFieldValByName("updatedId", StpUtil.getLoginIdAsString(), metaObject); +// this.setFieldValByName("updatedId", StpUtil.getLoginIdAsString(), metaObject); this.setFieldValByName("updatedAt", LocalDateTime.now(), metaObject); } @@ -32,7 +36,7 @@ public class CustomMetaObjectHandler implements MetaObjectHandler { */ @Override public void updateFill(MetaObject metaObject) { - this.setFieldValByName("updatedId", StpUtil.getLoginIdAsString(), metaObject); +// this.setFieldValByName("updatedId", StpUtil.getLoginIdAsString(), metaObject); this.setFieldValByName("updatedAt", LocalDateTime.now(), metaObject); } diff --git a/src/main/java/com/ydool/staff/controller/PersonnelController.java b/src/main/java/com/ydool/staff/controller/PersonnelController.java index 3c61b92..ad9126e 100644 --- a/src/main/java/com/ydool/staff/controller/PersonnelController.java +++ b/src/main/java/com/ydool/staff/controller/PersonnelController.java @@ -128,7 +128,7 @@ public class PersonnelController extends BaseController { @GetMapping("getPersonnelRetire") @ApiOperation(value = "查看近两月是否有人退休") //@Scheduled(cron = "0 0 7 * * ?") /*每天7点更新一次*/ - //@Scheduled(cron = "0 */1 * * * ?") /*每天7点更新一次*/ + @Scheduled(cron = "0 */1 * * * ?") /*每天7点更新一次*/ public void getPersonnelRetire(){ personnelService.getPersonnelRetire(); } diff --git a/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java index a0c257b..21b6cd6 100644 --- a/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java @@ -59,8 +59,11 @@ import com.ydool.system.mapper.ConfigMapper; import com.ydool.system.mapper.DeptMapper; import com.ydool.system.mapper.UserMapper; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.multipart.MultipartFile; import org.thymeleaf.util.StringUtils; import javax.annotation.Resource; @@ -73,6 +76,7 @@ import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.concurrent.CompletableFuture; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -817,7 +821,6 @@ public class PersonnelServiceImpl extends BaseService