退休人员定时任务
This commit is contained in:
parent
1e20050371
commit
608709d2d4
|
@ -1,17 +1,20 @@
|
||||||
package com.ydool.platform.mybatis.handler;
|
package com.ydool.platform.mybatis.handler;
|
||||||
|
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.ibatis.reflection.MetaObject;
|
import org.apache.ibatis.reflection.MetaObject;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class CustomMetaObjectHandler implements MetaObjectHandler {
|
public class CustomMetaObjectHandler implements MetaObjectHandler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插入时的填充策略
|
* 插入时的填充策略
|
||||||
*
|
*
|
||||||
|
@ -19,9 +22,10 @@ public class CustomMetaObjectHandler implements MetaObjectHandler {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void insertFill(MetaObject metaObject) {
|
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("createdAt", LocalDateTime.now(), metaObject);
|
||||||
this.setFieldValByName("updatedId", StpUtil.getLoginIdAsString(), metaObject);
|
// this.setFieldValByName("updatedId", StpUtil.getLoginIdAsString(), metaObject);
|
||||||
this.setFieldValByName("updatedAt", LocalDateTime.now(), metaObject);
|
this.setFieldValByName("updatedAt", LocalDateTime.now(), metaObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +36,7 @@ public class CustomMetaObjectHandler implements MetaObjectHandler {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void updateFill(MetaObject metaObject) {
|
public void updateFill(MetaObject metaObject) {
|
||||||
this.setFieldValByName("updatedId", StpUtil.getLoginIdAsString(), metaObject);
|
// this.setFieldValByName("updatedId", StpUtil.getLoginIdAsString(), metaObject);
|
||||||
this.setFieldValByName("updatedAt", LocalDateTime.now(), metaObject);
|
this.setFieldValByName("updatedAt", LocalDateTime.now(), metaObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class PersonnelController extends BaseController {
|
||||||
@GetMapping("getPersonnelRetire")
|
@GetMapping("getPersonnelRetire")
|
||||||
@ApiOperation(value = "查看近两月是否有人退休")
|
@ApiOperation(value = "查看近两月是否有人退休")
|
||||||
//@Scheduled(cron = "0 0 7 * * ?") /*每天7点更新一次*/
|
//@Scheduled(cron = "0 0 7 * * ?") /*每天7点更新一次*/
|
||||||
//@Scheduled(cron = "0 */1 * * * ?") /*每天7点更新一次*/
|
@Scheduled(cron = "0 */1 * * * ?") /*每天7点更新一次*/
|
||||||
public void getPersonnelRetire(){
|
public void getPersonnelRetire(){
|
||||||
personnelService.getPersonnelRetire();
|
personnelService.getPersonnelRetire();
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,8 +59,11 @@ import com.ydool.system.mapper.ConfigMapper;
|
||||||
import com.ydool.system.mapper.DeptMapper;
|
import com.ydool.system.mapper.DeptMapper;
|
||||||
import com.ydool.system.mapper.UserMapper;
|
import com.ydool.system.mapper.UserMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
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.springframework.web.multipart.MultipartFile;
|
||||||
import org.thymeleaf.util.StringUtils;
|
import org.thymeleaf.util.StringUtils;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
@ -73,6 +76,7 @@ import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -817,7 +821,6 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue