From 325d2fbc3d907dcf3f574d8e1f30d0269ddc1937 Mon Sep 17 00:00:00 2001 From: houzhongjian <houzhongyi@126.com> Date: 星期三, 24 七月 2024 08:28:47 +0800 Subject: [PATCH] 1、请求租户不存在时,记录访问日志、操作日志异常的问题 2、LoginUser 新增过期时间,方便判断 token 过期 3、增加 ConfigApi,支持参数配置的读取 --- iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/api/config/ConfigApiImpl.java | 54 +++++------------------------------------------------- 1 files changed, 5 insertions(+), 49 deletions(-) diff --git a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/api/config/ConfigApiImpl.java b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/api/config/ConfigApiImpl.java index 521559f..9c1a38d 100644 --- a/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/api/config/ConfigApiImpl.java +++ b/iailab-module-infra/iailab-module-infra-biz/src/main/java/com/iailab/module/infra/api/config/ConfigApiImpl.java @@ -1,18 +1,12 @@ package com.iailab.module.infra.api.config; import com.iailab.framework.common.pojo.CommonResult; -import com.iailab.module.infra.api.file.FileApi; -import com.iailab.module.infra.api.file.dto.FileCreateReqDTO; +import com.iailab.module.infra.dal.dataobject.config.ConfigDO; import com.iailab.module.infra.service.config.ConfigService; -import com.iailab.module.infra.service.file.FileService; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; - -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; import static com.iailab.framework.common.pojo.CommonResult.success; @@ -23,49 +17,11 @@ @Resource private ConfigService configService; -// /** -// * 查月初或者年初(根据code) -// * -// * @return -// */ -// @Override -// public String queryConfigByCode(String configCode, String type){ -// String result = ""; -// String value = configService.getValue(configCode); -// Calendar calendar = Calendar.getInstance(); -// calendar.setTime(new Date()); -// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); -// if("month".equals(type)){ -// int nowDay = calendar.get(Calendar.DAY_OF_MONTH); -// if(nowDay < Integer.parseInt(value)){ -// calendar.add(Calendar.MONTH, -1); -// } -// calendar.set(Calendar.DAY_OF_MONTH, Integer.parseInt(value)); -// } else { -// int month = Integer.parseInt(value.substring(0,value.indexOf("-"))); -// int day = Integer.parseInt(value.substring(value.indexOf("-") + 1)); -// int nowMonth = calendar.get(Calendar.MONTH) + 1; -// int nowDay = calendar.get(Calendar.DAY_OF_MONTH); -// -// if(nowMonth == month) { -// if(nowDay < day){ -// calendar.add(Calendar.YEAR, -1); -// } -// } else if(nowMonth < month) { -// calendar.add(Calendar.YEAR, -1); -// } -// calendar.set(Calendar.MONTH, month - 1); -// calendar.set(Calendar.DAY_OF_MONTH, day); -// } -// -// result = sdf.format(calendar.getTime()); -// -// return result; -// } - @Override - public String queryConfigByCode(String configCode) { - return configService.getValue(configCode); + public CommonResult<String> getConfigValueByKey(String key) { + ConfigDO config = configService.getConfigByKey(key); + return success(config != null ? config.getValue() : null); } + } -- Gitblit v1.9.3