update 定时任务修改
This commit is contained in:
parent
608709d2d4
commit
31414e651f
|
@ -38,6 +38,11 @@ public class ConfigCache {
|
||||||
*/
|
*/
|
||||||
public static final String LOGIN_CAPTCHA_CODE = "login_captcha_code";
|
public static final String LOGIN_CAPTCHA_CODE = "login_captcha_code";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时任务参数
|
||||||
|
*/
|
||||||
|
public static final String SCHEDULED_CODE_PERSONNEL_RETIRE = "scheduled_code_personnel_retire";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户TOKEN密钥
|
* 用户TOKEN密钥
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
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.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
|
import com.ydool.common.cache.ConfigCache;
|
||||||
|
import com.ydool.common.utils.CacheUtil;
|
||||||
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.beans.factory.annotation.Autowired;
|
||||||
|
@ -22,10 +25,10 @@ public class CustomMetaObjectHandler implements MetaObjectHandler {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void insertFill(MetaObject metaObject) {
|
public void insertFill(MetaObject metaObject) {
|
||||||
|
String scheduled = getScheduled();
|
||||||
// this.setFieldValByName("createdId", StpUtil.getLoginIdAsString(), metaObject);
|
this.setFieldValByName("createdId", StrUtil.isNotBlank(scheduled) ? "":StpUtil.getLoginIdAsString(), metaObject);
|
||||||
this.setFieldValByName("createdAt", LocalDateTime.now(), metaObject);
|
this.setFieldValByName("createdAt", LocalDateTime.now(), metaObject);
|
||||||
// this.setFieldValByName("updatedId", StpUtil.getLoginIdAsString(), metaObject);
|
this.setFieldValByName("updatedId", StrUtil.isNotBlank(scheduled) ? "":StpUtil.getLoginIdAsString(), metaObject);
|
||||||
this.setFieldValByName("updatedAt", LocalDateTime.now(), metaObject);
|
this.setFieldValByName("updatedAt", LocalDateTime.now(), metaObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,8 +39,14 @@ public class CustomMetaObjectHandler implements MetaObjectHandler {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void updateFill(MetaObject metaObject) {
|
public void updateFill(MetaObject metaObject) {
|
||||||
// this.setFieldValByName("updatedId", StpUtil.getLoginIdAsString(), metaObject);
|
String scheduled = getScheduled();
|
||||||
|
this.setFieldValByName("updatedId", StrUtil.isNotBlank(scheduled) ? "":StpUtil.getLoginIdAsString(), metaObject);
|
||||||
this.setFieldValByName("updatedAt", LocalDateTime.now(), metaObject);
|
this.setFieldValByName("updatedAt", LocalDateTime.now(), metaObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getScheduled() {
|
||||||
|
String scheduled = CacheUtil.get(ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, "scheduled").toString();
|
||||||
|
return scheduled;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ import com.ydool.common.base.BaseService;
|
||||||
import com.ydool.common.cache.ConfigCache;
|
import com.ydool.common.cache.ConfigCache;
|
||||||
import com.ydool.common.constant.ArgsConst;
|
import com.ydool.common.constant.ArgsConst;
|
||||||
import com.ydool.common.data.dto.AjaxResult;
|
import com.ydool.common.data.dto.AjaxResult;
|
||||||
|
import com.ydool.common.utils.CacheUtil;
|
||||||
import com.ydool.common.utils.ColumnUtil;
|
import com.ydool.common.utils.ColumnUtil;
|
||||||
import com.ydool.common.utils.EasyExcelAlibabaUtil;
|
import com.ydool.common.utils.EasyExcelAlibabaUtil;
|
||||||
import com.ydool.oa.workFlow.data.entity.WorkFlowNotice;
|
import com.ydool.oa.workFlow.data.entity.WorkFlowNotice;
|
||||||
|
@ -804,6 +805,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
||||||
.ne(Personnel::getAlterationSign,1).eq(Personnel::getAuditState,3).eq(Personnel::getState,2)
|
.ne(Personnel::getAlterationSign,1).eq(Personnel::getAuditState,3).eq(Personnel::getState,2)
|
||||||
.eq(Personnel::getWorkState,"在职").between(Personnel::getRetirementTime, nowDate, starTime).eq(Personnel::getIsInfo,false).orderByDesc(Personnel::getRetirementTime));
|
.eq(Personnel::getWorkState,"在职").between(Personnel::getRetirementTime, nowDate, starTime).eq(Personnel::getIsInfo,false).orderByDesc(Personnel::getRetirementTime));
|
||||||
if (CollectionUtil.isNotEmpty(list)){
|
if (CollectionUtil.isNotEmpty(list)){
|
||||||
|
CacheUtil.put(ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, "scheduled", true);
|
||||||
Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP));
|
Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP));
|
||||||
User user = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue()));
|
User user = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue()));
|
||||||
for (Personnel personnel : list) {
|
for (Personnel personnel : list) {
|
||||||
|
@ -821,6 +823,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CacheUtil.clear(ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,16 @@
|
||||||
overflowToDisk="false">
|
overflowToDisk="false">
|
||||||
</cache>
|
</cache>
|
||||||
|
|
||||||
|
<!-- 登录手机验证码,缓存十分钟 -->
|
||||||
|
<cache name="scheduled_code_personnel_retire"
|
||||||
|
maxElementsInMemory="1"
|
||||||
|
maxEntriesLocalHeap="0"
|
||||||
|
eternal="false"
|
||||||
|
timeToIdleSeconds="600"
|
||||||
|
timeToLiveSeconds="600"
|
||||||
|
overflowToDisk="false">
|
||||||
|
</cache>
|
||||||
|
|
||||||
<!-- 前端用户修改手机号,手机验证码,缓存十分钟 -->
|
<!-- 前端用户修改手机号,手机验证码,缓存十分钟 -->
|
||||||
<cache name="sys_phone_code_user"
|
<cache name="sys_phone_code_user"
|
||||||
maxElementsInMemory="1"
|
maxElementsInMemory="1"
|
||||||
|
|
Loading…
Reference in New Issue