fix(消息通知): 修复发送通知时用户ID取值的问题

This commit is contained in:
CaptainB 2022-03-17 13:53:49 +08:00 committed by 刘瑞斌
parent 9033f2c25b
commit 8912eb4809
3 changed files with 7 additions and 3 deletions

View File

@ -11,6 +11,7 @@ import io.metersphere.base.domain.ReportStatisticsWithBLOBs;
import io.metersphere.base.domain.ShareInfo;
import io.metersphere.base.domain.User;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.reportstatistics.dto.ReportStatisticsSaveRequest;
import io.metersphere.reportstatistics.service.ReportStatisticsService;
import io.metersphere.service.UserService;
@ -88,6 +89,7 @@ public class ShareInfoController {
@PostMapping("/generateApiDocumentShareInfo")
public ShareInfoDTO generateApiDocumentShareInfo(@RequestBody ApiDocumentShareRequest request) {
request.setCreateUserId(SessionUtils.getUserId());
ShareInfo apiShare = shareInfoService.generateApiDocumentShareInfo(request);
ShareInfoDTO returnDTO = shareInfoService.conversionShareInfoToDTO(apiShare);
return returnDTO;
@ -95,6 +97,7 @@ public class ShareInfoController {
@PostMapping("/generateShareInfoWithExpired")
public ShareInfoDTO generateShareInfo(@RequestBody ShareInfo request) {
request.setCreateUserId(SessionUtils.getUserId());
ShareInfo apiShare = shareInfoService.createShareInfo(request);
ShareInfoDTO returnDTO = shareInfoService.conversionShareInfoToDTO(apiShare);
return returnDTO;

View File

@ -477,7 +477,7 @@ public class ShareInfoService {
ShareInfo shareInfo = new ShareInfo();
shareInfo.setId(UUID.randomUUID().toString());
shareInfo.setCustomData(request.getCustomData());
shareInfo.setCreateUserId(SessionUtils.getUserId());
shareInfo.setCreateUserId(request.getCreateUserId());
shareInfo.setCreateTime(createTime);
shareInfo.setUpdateTime(createTime);
shareInfo.setShareType(request.getShareType());
@ -511,10 +511,11 @@ public class ShareInfoService {
return returnDTO;
}
public String getTestPlanShareUrl(String testPlanReportId) {
public String getTestPlanShareUrl(String testPlanReportId, String userId) {
ShareInfo shareRequest = new ShareInfo();
shareRequest.setCustomData(testPlanReportId);
shareRequest.setShareType(ShareType.PLAN_DB_REPORT.name());
shareRequest.setCreateUserId(userId);
ShareInfo shareInfo = generateShareInfo(shareRequest);
return conversionShareInfoToDTO(shareInfo).getShareUrl();
}

View File

@ -671,7 +671,7 @@ public class TestPlanReportService {
String successfulMailTemplate = "TestPlanSuccessfulNotification";
String errfoMailTemplate = "TestPlanFailedNotification";
String testPlanShareUrl = shareInfoService.getTestPlanShareUrl(testPlanReport.getId());
String testPlanShareUrl = shareInfoService.getTestPlanShareUrl(testPlanReport.getId(), creator);
paramMap.put("planShareUrl", baseSystemConfigDTO.getUrl() + "/sharePlanReport" + testPlanShareUrl);
NoticeModel noticeModel = NoticeModel.builder()