!513 优化代码生成498 解决解决 Set access token expire time to 0 报错问题和邮件发送用户编号为空问题

This commit is contained in:
YunaiV 2023-06-17 12:36:05 +08:00
parent eb44015b74
commit 20cb26fb05
2 changed files with 6 additions and 3 deletions

View File

@ -18,6 +18,7 @@ import javax.validation.Valid;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@Tag(name = "管理后台 - 邮件模版") @Tag(name = "管理后台 - 邮件模版")
@RestController @RestController
@ -81,7 +82,7 @@ public class MailTemplateController {
@Operation(summary = "发送短信") @Operation(summary = "发送短信")
@PreAuthorize("@ss.hasPermission('system:mail-template:send-mail')") @PreAuthorize("@ss.hasPermission('system:mail-template:send-mail')")
public CommonResult<Long> sendMail(@Valid @RequestBody MailTemplateSendReqVO sendReqVO) { public CommonResult<Long> sendMail(@Valid @RequestBody MailTemplateSendReqVO sendReqVO) {
return success(mailSendService.sendSingleMailToAdmin(sendReqVO.getMail(), null, return success(mailSendService.sendSingleMailToAdmin(sendReqVO.getMail(), getLoginUserId(),
sendReqVO.getTemplateCode(), sendReqVO.getTemplateParams())); sendReqVO.getTemplateCode(), sendReqVO.getTemplateParams()));
} }

View File

@ -37,7 +37,9 @@ public class OAuth2AccessTokenRedisDAO {
// 清理多余字段避免缓存 // 清理多余字段避免缓存
accessTokenDO.setUpdater(null).setUpdateTime(null).setCreateTime(null).setCreator(null).setDeleted(null); accessTokenDO.setUpdater(null).setUpdateTime(null).setCreateTime(null).setCreator(null).setDeleted(null);
long time = LocalDateTimeUtil.between(LocalDateTime.now(), accessTokenDO.getExpiresTime(), ChronoUnit.SECONDS); long time = LocalDateTimeUtil.between(LocalDateTime.now(), accessTokenDO.getExpiresTime(), ChronoUnit.SECONDS);
stringRedisTemplate.opsForValue().set(redisKey, JsonUtils.toJsonString(accessTokenDO), time, TimeUnit.SECONDS); if (time > 0) {
stringRedisTemplate.opsForValue().set(redisKey, JsonUtils.toJsonString(accessTokenDO), time, TimeUnit.SECONDS);
}
} }
public void delete(String accessToken) { public void delete(String accessToken) {