update 定时任务时间1

This commit is contained in:
mash 2023-11-02 11:32:55 +08:00
parent 7e942a09ec
commit 0f02e687df
3 changed files with 16 additions and 11 deletions

View File

@ -25,10 +25,10 @@ public class CustomMetaObjectHandler implements MetaObjectHandler {
*/
@Override
public void insertFill(MetaObject metaObject) {
String scheduled = getScheduled();
this.setFieldValByName("createdId", StrUtil.isNotBlank(scheduled) ? "":StpUtil.getLoginIdAsString(), metaObject);
Boolean flag = getScheduled();
this.setFieldValByName("createdId", flag ? null:StpUtil.getLoginIdAsString(), metaObject);
this.setFieldValByName("createdAt", LocalDateTime.now(), metaObject);
this.setFieldValByName("updatedId", StrUtil.isNotBlank(scheduled) ? "":StpUtil.getLoginIdAsString(), metaObject);
this.setFieldValByName("updatedId", flag ? null:StpUtil.getLoginIdAsString(), metaObject);
this.setFieldValByName("updatedAt", LocalDateTime.now(), metaObject);
}
@ -39,14 +39,18 @@ public class CustomMetaObjectHandler implements MetaObjectHandler {
*/
@Override
public void updateFill(MetaObject metaObject) {
String scheduled = getScheduled();
this.setFieldValByName("updatedId", StrUtil.isNotBlank(scheduled) ? "":StpUtil.getLoginIdAsString(), metaObject);
Boolean flag = getScheduled();
this.setFieldValByName("updatedId", flag ? null:StpUtil.getLoginIdAsString(), metaObject);
this.setFieldValByName("updatedAt", LocalDateTime.now(), metaObject);
}
public String getScheduled() {
public Boolean getScheduled() {
Boolean flag= false;
String scheduled = CacheUtil.get(ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, "scheduled").toString();
return scheduled;
if ("true".equals(scheduled)){
return flag = true;
}
return flag;
}
}

View File

@ -12,6 +12,7 @@ import com.ydool.common.base.BaseService;
import com.ydool.common.cache.ConfigCache;
import com.ydool.common.constant.UrlConstant;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.common.utils.CacheUtil;
import com.ydool.common.utils.HttpServletUtil;
import com.ydool.common.utils.PasswordUtil;
import com.ydool.common.utils.RsaUtil;
@ -84,7 +85,7 @@ public class AuthServiceImpl extends BaseService<UserMapper, User> implements IA
// 第1步先登录上
StpUtil.login(loginUser.getId());
CacheUtil.put(ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, "scheduled", false);
boolean flag = updateById(loginUser);
if (flag) {

View File

@ -97,13 +97,13 @@
overflowToDisk="false">
</cache>
<!-- 登录手机验证码,缓存十分钟 -->
<!-- 定时任务编码,缓存十分钟 -->
<cache name="scheduled_code_personnel_retire"
maxElementsInMemory="1"
maxEntriesLocalHeap="0"
eternal="false"
timeToIdleSeconds="600"
timeToLiveSeconds="600"
timeToIdleSeconds="86400"
timeToLiveSeconds="86400"
overflowToDisk="false">
</cache>