diff --git a/pom.xml b/pom.xml
index 0816680b..e20e83e1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -282,6 +282,12 @@
itextpdf
5.5.13.2
+
+
+ org.springframework.boot
+ spring-boot-starter-websocket
+
+
diff --git a/src/main/java/com/ai/da/common/constant/CommonConstant.java b/src/main/java/com/ai/da/common/constant/CommonConstant.java
index 15372e9b..b167f4b6 100644
--- a/src/main/java/com/ai/da/common/constant/CommonConstant.java
+++ b/src/main/java/com/ai/da/common/constant/CommonConstant.java
@@ -59,4 +59,10 @@ public class CommonConstant {
public static final List IS_SUBSCRIBE = Arrays.asList("yes", "no");
+ public static final String DEFAULT_AVATAR = "aida-users/87/avatar/default.jpg";
+
+ /* 截止至2024/08/26,在Code-Create DB中pmr_users表中最大的用户id */
+ public static final Long MAXIMUM_USER_ID = 704L;
+// public static final Long MAXIMUM_USER_ID = 225L;
+
}
diff --git a/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java b/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java
index 0f61d591..bc6071c8 100644
--- a/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java
+++ b/src/main/java/com/ai/da/common/security/filter/AuthenticationFilter.java
@@ -1,133 +1,134 @@
-package com.ai.da.common.security.filter;
-
-import cn.hutool.core.util.StrUtil;
-import com.ai.da.common.context.UserContext;
-import com.ai.da.common.security.config.SecurityProperties;
-import com.ai.da.common.security.jwt.JWTTokenHelper;
-import com.ai.da.common.utils.LocalCacheUtils;
-import com.ai.da.common.utils.MultiReadHttpServletRequest;
-import com.ai.da.common.utils.MultiReadHttpServletResponse;
-import com.ai.da.common.utils.RequestInfoUtil;
-import com.ai.da.model.vo.AuthPrincipalVo;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.lang.NonNull;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.util.StopWatch;
-import org.springframework.util.StringUtils;
-import org.springframework.web.filter.OncePerRequestFilter;
-
-import javax.annotation.Resource;
-import javax.security.sasl.AuthenticationException;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * @author: dangweijian
- * @description: 认证拦截器
- * @create: 2020-07-10 16:50
- **/
-@Slf4j
-@Configuration
-public class AuthenticationFilter extends OncePerRequestFilter {
-
- @Resource
- private JWTTokenHelper jwtTokenHelper;
- @Resource
- private SecurityProperties properties;
-
- private static final List FILTER_URL =
- Arrays.asList("/favicon.ico", "/doc.html", "api/account/login", "api/account/preLogin", "api/account/sendEmail","api/account/noLoginRequired",
- "/webjars/", "/swagger-resources", "/v2/api-docs", "api/account/resetPwd",
- "/api/python/saveGeneratePicture", "/api/python/getLibraryByUserId",
- "/api/third/party/addUser","/api/third/party/addTrialUser", "/api/third/party/editUser", "/api/element/initDefaultSysFile",
- "/api/third/party/addNoLoginRequiredNew","/api/third/party/deleteNoLoginRequiredNew",
- "/api/third/party/existNoLoginRequired","/api/third/party/getRedirectUrl",
- "/api/python/flush","/api/account/healthy","/api/ali-pay/trade/notify","/api/paypal/ipn/back","/api/alipay-hk/trade/notify",
- "/api/portfolio/page", "/api/portfolio/detail", "/api/portfolio/commentPage", "/api/portfolio/viewsIncrease",
- "/api/account/designWorksRegister","/api/account/questionnaire","/api/stripe/trade/notify"
- );
-
- @Override
- protected void doFilterInternal(HttpServletRequest httpServletRequest, @NonNull HttpServletResponse httpServletResponse, @NonNull FilterChain filterChain) throws ServletException, IOException {
- String requestURI = httpServletRequest.getRequestURI();
-
- if (calculateUrl(requestURI) || hasAuthorizationToken(httpServletRequest)) {
- StopWatch stopWatch = new StopWatch();
- HttpServletRequest wrappedRequest = httpServletRequest;
- HttpServletResponse wrappedResponse = httpServletResponse;
- try {
- stopWatch.start();
- if ((httpServletRequest.getContentType() == null && httpServletRequest.getContentLength() > 0) || (httpServletRequest.getContentType() != null && !httpServletRequest.getContentType().contains("application/json"))) {
- extracted(wrappedRequest);
- filterChain.doFilter(wrappedRequest, wrappedResponse);
- } else {
- wrappedRequest = new MultiReadHttpServletRequest(httpServletRequest);
- wrappedResponse = new MultiReadHttpServletResponse(httpServletResponse);
- extracted(wrappedRequest);
- filterChain.doFilter(wrappedRequest, wrappedResponse);
- }
- } catch (Exception e) {
- SecurityContextHolder.clearContext();
- throw e;
- } finally {
- stopWatch.stop();
- }
- } else {
- filterChain.doFilter(httpServletRequest, httpServletResponse);
- }
- }
-
- private Boolean calculateUrl(String requestURI) {
- String filterUrl = FILTER_URL.stream().filter(url -> requestURI.contains(url)).findFirst().orElse(null);
- return null == filterUrl ? Boolean.TRUE : Boolean.FALSE;
- }
-
- private boolean hasAuthorizationToken(HttpServletRequest request) {
- String authorizationHeader = request.getHeader("Authorization");
- return authorizationHeader != null && authorizationHeader.startsWith("Bearer");
- }
-
- private void extracted(HttpServletRequest request) throws AuthenticationException {
- String jwtToken = request.getHeader(properties.getJwtTokenHeader());
-// log.debug("后台检查令牌:{}", jwtToken);
-
- if (StrUtil.isBlank(jwtToken)) {
- String ipAddress = RequestInfoUtil.getIpAddress(request);
- log.info("本次请求的ip为 : " + ipAddress);
- throw new RuntimeException("请传入token!");
- }
- if(jwtToken.equals("Bearer-eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiIyIiwic3ViIjoie1wiaWRcIjoyLFwidXNlcm5hbWVcIjpcImxpcnNcIn0iLCJpYXQiOjE2NjU3NDEwODcsImlzcyI6IkRXSiIsImF1dGhvcml0aWVzIjoiW10iLCJleHAiOjE2NzQzODEwODd9.ShM9R_NNFD7oo1OvxrEgg7PFeWinOuAKkuInUCMQupp66s64Hhv8tN0Wwr83nIN4rHPqtn95wmd4msWcvaFYJA")){
- //写死 暂时放行
- return;
- }
- // 检查token
- boolean validate = jwtTokenHelper.validateToken(jwtToken);
- if (validate) {
- AuthPrincipalVo principal = jwtTokenHelper.parserToUser(jwtToken);
- if (principal == null) {
- throw new RuntimeException("TOKEN已过期,请重新登录!");
- }
- //先清空当前线程变量,防止上一个线程遗留
- UserContext.delete();
- //存取用户信息到缓存
- UserContext.setUserHolder(principal);
- //校验token
- String cacheToken = LocalCacheUtils.getTokenCache(String.valueOf(principal.getId()));
-
- if(StringUtils.isEmpty(cacheToken)){
- throw new RuntimeException("TOKEN已过期,请重新登录!");
- }
- if(!cacheToken.equals(jwtToken) ){
- throw new RuntimeException("TOKEN已过期,请重新登录!");
- }
-// UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(null, null);
-// SecurityContextHolder.getContext().setAuthentication(authentication);
- }
- }
-}
+package com.ai.da.common.security.filter;
+
+import cn.hutool.core.util.StrUtil;
+import com.ai.da.common.context.UserContext;
+import com.ai.da.common.security.config.SecurityProperties;
+import com.ai.da.common.security.jwt.JWTTokenHelper;
+import com.ai.da.common.utils.LocalCacheUtils;
+import com.ai.da.common.utils.MultiReadHttpServletRequest;
+import com.ai.da.common.utils.MultiReadHttpServletResponse;
+import com.ai.da.common.utils.RequestInfoUtil;
+import com.ai.da.model.vo.AuthPrincipalVo;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.lang.NonNull;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.util.StopWatch;
+import org.springframework.util.StringUtils;
+import org.springframework.web.filter.OncePerRequestFilter;
+
+import javax.annotation.Resource;
+import javax.security.sasl.AuthenticationException;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author: dangweijian
+ * @description: 认证拦截器
+ * @create: 2020-07-10 16:50
+ **/
+@Slf4j
+@Configuration
+public class AuthenticationFilter extends OncePerRequestFilter {
+
+ @Resource
+ private JWTTokenHelper jwtTokenHelper;
+ @Resource
+ private SecurityProperties properties;
+
+ private static final List FILTER_URL =
+ Arrays.asList("/favicon.ico", "/doc.html", "api/account/login", "api/account/preLogin", "api/account/sendEmail","api/account/noLoginRequired",
+ "/webjars/", "/swagger-resources", "/v2/api-docs", "api/account/resetPwd",
+ "/api/python/saveGeneratePicture", "/api/python/getLibraryByUserId",
+ "/api/third/party/addUser","/api/third/party/addTrialUser", "/api/third/party/editUser", "/api/element/initDefaultSysFile",
+ "/api/third/party/addNoLoginRequiredNew","/api/third/party/deleteNoLoginRequiredNew",
+ "/api/third/party/existNoLoginRequired","/api/third/party/getRedirectUrl",
+ "/api/python/flush","/api/account/healthy","/api/ali-pay/trade/notify","/api/paypal/ipn/back","/api/alipay-hk/trade/notify",
+ "/api/portfolio/page", "/api/portfolio/detail", "/api/portfolio/commentPage", "/api/portfolio/viewsIncrease",
+ "/api/account/designWorksRegister","/api/account/questionnaire","/api/stripe/trade/notify",
+ "/notification"
+ );
+
+ @Override
+ protected void doFilterInternal(HttpServletRequest httpServletRequest, @NonNull HttpServletResponse httpServletResponse, @NonNull FilterChain filterChain) throws ServletException, IOException {
+ String requestURI = httpServletRequest.getRequestURI();
+
+ if (calculateUrl(requestURI) || hasAuthorizationToken(httpServletRequest)) {
+ StopWatch stopWatch = new StopWatch();
+ HttpServletRequest wrappedRequest = httpServletRequest;
+ HttpServletResponse wrappedResponse = httpServletResponse;
+ try {
+ stopWatch.start();
+ if ((httpServletRequest.getContentType() == null && httpServletRequest.getContentLength() > 0) || (httpServletRequest.getContentType() != null && !httpServletRequest.getContentType().contains("application/json"))) {
+ extracted(wrappedRequest);
+ filterChain.doFilter(wrappedRequest, wrappedResponse);
+ } else {
+ wrappedRequest = new MultiReadHttpServletRequest(httpServletRequest);
+ wrappedResponse = new MultiReadHttpServletResponse(httpServletResponse);
+ extracted(wrappedRequest);
+ filterChain.doFilter(wrappedRequest, wrappedResponse);
+ }
+ } catch (Exception e) {
+ SecurityContextHolder.clearContext();
+ throw e;
+ } finally {
+ stopWatch.stop();
+ }
+ } else {
+ filterChain.doFilter(httpServletRequest, httpServletResponse);
+ }
+ }
+
+ private Boolean calculateUrl(String requestURI) {
+ String filterUrl = FILTER_URL.stream().filter(url -> requestURI.contains(url)).findFirst().orElse(null);
+ return null == filterUrl ? Boolean.TRUE : Boolean.FALSE;
+ }
+
+ private boolean hasAuthorizationToken(HttpServletRequest request) {
+ String authorizationHeader = request.getHeader("Authorization");
+ return authorizationHeader != null && authorizationHeader.startsWith("Bearer");
+ }
+
+ private void extracted(HttpServletRequest request) throws AuthenticationException {
+ String jwtToken = request.getHeader(properties.getJwtTokenHeader());
+// log.debug("后台检查令牌:{}", jwtToken);
+
+ if (StrUtil.isBlank(jwtToken)) {
+ String ipAddress = RequestInfoUtil.getIpAddress(request);
+ log.info("本次请求的ip为 : " + ipAddress);
+ throw new RuntimeException("请传入token!");
+ }
+ if(jwtToken.equals("Bearer-eyJhbGciOiJIUzUxMiJ9.eyJqdGkiOiIyIiwic3ViIjoie1wiaWRcIjoyLFwidXNlcm5hbWVcIjpcImxpcnNcIn0iLCJpYXQiOjE2NjU3NDEwODcsImlzcyI6IkRXSiIsImF1dGhvcml0aWVzIjoiW10iLCJleHAiOjE2NzQzODEwODd9.ShM9R_NNFD7oo1OvxrEgg7PFeWinOuAKkuInUCMQupp66s64Hhv8tN0Wwr83nIN4rHPqtn95wmd4msWcvaFYJA")){
+ //写死 暂时放行
+ return;
+ }
+ // 检查token
+ boolean validate = jwtTokenHelper.validateToken(jwtToken);
+ if (validate) {
+ AuthPrincipalVo principal = jwtTokenHelper.parserToUser(jwtToken);
+ if (principal == null) {
+ throw new RuntimeException("TOKEN已过期,请重新登录!");
+ }
+ //先清空当前线程变量,防止上一个线程遗留
+ UserContext.delete();
+ //存取用户信息到缓存
+ UserContext.setUserHolder(principal);
+ //校验token
+ String cacheToken = LocalCacheUtils.getTokenCache(String.valueOf(principal.getId()));
+
+ if(StringUtils.isEmpty(cacheToken)){
+ throw new RuntimeException("TOKEN已过期,请重新登录!");
+ }
+ if(!cacheToken.equals(jwtToken) ){
+ throw new RuntimeException("TOKEN已过期,请重新登录!");
+ }
+// UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(null, null);
+// SecurityContextHolder.getContext().setAuthentication(authentication);
+ }
+ }
+}
diff --git a/src/main/java/com/ai/da/common/task/AccountTask.java b/src/main/java/com/ai/da/common/task/AccountTask.java
index 9e232d83..da5764b4 100644
--- a/src/main/java/com/ai/da/common/task/AccountTask.java
+++ b/src/main/java/com/ai/da/common/task/AccountTask.java
@@ -57,4 +57,12 @@ public class AccountTask {
accountService.toVisitor(account);
}
}
+
+ /**
+ * 将Code-Create上注册的用户添加为AiDA的游客
+ */
+ // @Scheduled(cron = "0 */5 * * * *") // Run every 5 minutes
+ public void registerUserToVisitor(){
+ accountService.registerUserToVisitor();
+ }
}
diff --git a/src/main/java/com/ai/da/common/utils/RedisUtil.java b/src/main/java/com/ai/da/common/utils/RedisUtil.java
index 0d5c6153..ffb0f424 100644
--- a/src/main/java/com/ai/da/common/utils/RedisUtil.java
+++ b/src/main/java/com/ai/da/common/utils/RedisUtil.java
@@ -216,4 +216,17 @@ public class RedisUtil {
return redisTemplate.opsForValue().increment(key, 0);
}
+ public final static String PERSONAL_HOMEPAGE_VIEW_KEY = "PersonalHomepage:view:";
+
+ public void increasePersonalHomepageViewCount(Long accountId) {
+ String key = PERSONAL_HOMEPAGE_VIEW_KEY + accountId;
+ redisTemplate.opsForValue().increment(key);
+ }
+
+ public Long getPersonalHomepageViewCount(Long accountId) {
+ String key = PERSONAL_HOMEPAGE_VIEW_KEY + accountId;
+ return redisTemplate.opsForValue().increment(key, 0);
+ }
+
+
}
diff --git a/src/main/java/com/ai/da/common/utils/SendEmailUtil.java b/src/main/java/com/ai/da/common/utils/SendEmailUtil.java
index 7f6706cc..16fcfe21 100644
--- a/src/main/java/com/ai/da/common/utils/SendEmailUtil.java
+++ b/src/main/java/com/ai/da/common/utils/SendEmailUtil.java
@@ -590,4 +590,40 @@ public class SendEmailUtil {
throw new BusinessException("failed.to.send.mail");
}
}
+
+ private final static Long NEW_USER_REGISTER_NOTIFICATION_EN = 126919L;
+
+ public static void notificationForRegisterUser(String receiverAddress){
+ try{
+ // 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
+ // 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
+ // 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
+ Credential cred = new Credential(SECRET_ID, SECRET_KEy);
+ // 实例化一个http选项,可选的,没有特殊需求可以跳过
+ HttpProfile httpProfile = new HttpProfile();
+ httpProfile.setEndpoint("ses.tencentcloudapi.com");
+ // 实例化一个client选项,可选的,没有特殊需求可以跳过
+ ClientProfile clientProfile = new ClientProfile();
+ clientProfile.setHttpProfile(httpProfile);
+ // 实例化要请求产品的client对象,clientProfile是可选的
+ SesClient client = new SesClient(cred, "ap-hongkong", clientProfile);
+ // 实例化一个请求对象,每个接口都会对应一个request对象
+ SendEmailRequest req = new SendEmailRequest();
+ req.setFromEmailAddress(SEND_ADDRESS);
+ req.setDestination(new String[]{receiverAddress});
+
+ req.setSubject("Welcome to AiDa");
+ Template template = new Template();
+ template.setTemplateID(NEW_USER_REGISTER_NOTIFICATION_EN);
+ template.setTemplateData("{\"email\":\" " + receiverAddress + "\"}");
+ req.setTemplate(template);
+
+ // 返回的resp是一个SendEmailResponse的实例,与请求对象对应
+ SendEmailResponse resp = client.SendEmail(req);
+ log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
+ } catch (TencentCloudSDKException e) {
+ log.info("邮件发送失败###{}", e.toString());
+ throw new BusinessException("failed.to.send.mail");
+ }
+ }
}
diff --git a/src/main/java/com/ai/da/common/websocket/NotificationConnection.java b/src/main/java/com/ai/da/common/websocket/NotificationConnection.java
new file mode 100644
index 00000000..f9a9cb52
--- /dev/null
+++ b/src/main/java/com/ai/da/common/websocket/NotificationConnection.java
@@ -0,0 +1,43 @@
+package com.ai.da.common.websocket;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import javax.websocket.*;
+import javax.websocket.server.ServerEndpoint;
+import java.io.IOException;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+
+@ServerEndpoint(value = "/notification")
+@Component
+@Slf4j
+public class NotificationConnection {
+
+ static Map sessionMap = new ConcurrentHashMap<>();
+ //连接建立时执行的操作
+ @OnOpen
+ public void onOpen(Session session){
+ sessionMap.put(session.getId(),session);
+ log.info("websocket is open");
+ }
+ //收到了客户端消息执行的操作
+ @OnMessage
+ public void onMessage(String text){
+ log.info("收到了一条消息:"+text);
+// return "已收到你的消息";
+ }
+ //连接关闭的时候执行的操作
+ @OnClose
+ public void onClose(Session session){
+ sessionMap.remove(session.getId());
+ log.info("websocket is close");
+ }
+
+ public void sendMsg(String message) throws IOException {
+ for(String key:sessionMap.keySet()){
+ sessionMap.get(key).getBasicRemote().sendText(message);
+ }
+ }
+}
diff --git a/src/main/java/com/ai/da/common/websocket/config/WebSocketConfig.java b/src/main/java/com/ai/da/common/websocket/config/WebSocketConfig.java
new file mode 100644
index 00000000..df5b252b
--- /dev/null
+++ b/src/main/java/com/ai/da/common/websocket/config/WebSocketConfig.java
@@ -0,0 +1,18 @@
+package com.ai.da.common.websocket.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.socket.server.standard.ServerEndpointExporter;
+
+/**
+ * Configuration of WebSocket
+ *
+ * @author db1995
+ */
+@Configuration
+public class WebSocketConfig {
+ @Bean
+ public ServerEndpointExporter serverEndpointExporter() {
+ return new ServerEndpointExporter();
+ }
+}
diff --git a/src/main/java/com/ai/da/controller/AccountController.java b/src/main/java/com/ai/da/controller/AccountController.java
index 4dadaf3d..8cf6a5a9 100644
--- a/src/main/java/com/ai/da/controller/AccountController.java
+++ b/src/main/java/com/ai/da/controller/AccountController.java
@@ -1,18 +1,21 @@
package com.ai.da.controller;
+import com.ai.da.common.config.exception.BusinessException;
import com.ai.da.common.response.PageBaseResponse;
import com.ai.da.common.response.Response;
-import com.ai.da.mapper.primary.entity.Account;
import com.ai.da.mapper.primary.entity.TrialOrder;
import com.ai.da.model.dto.*;
import com.ai.da.model.vo.AccountLoginVO;
import com.ai.da.model.vo.AccountPreLoginVO;
+import com.ai.da.model.vo.PersonalHomepageVO;
import com.ai.da.service.AccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
+import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -194,4 +197,26 @@ public class AccountController {
public Response> setUserValidToDayEnd(){
return Response.success(accountService.setUserValidToDayEnd());
}
+
+ // 用户上传头像
+ @ApiOperation(value = "上传头像")
+ @PostMapping(path = "/uploadAvatar")
+ public Response uploadAvatar(@RequestParam("file") MultipartFile file) {
+ if (null == file || StringUtils.isEmpty(file.getOriginalFilename())) {
+ throw new BusinessException("file.cannot.be.empty");
+ }
+ return Response.success(accountService.uploadAvatar(file));
+ }
+
+ @ApiOperation(value = "个人主页浏览量增加")
+ @GetMapping("/viewsIncrease")
+ public Response viewsGet(@RequestParam("id") Long id) {
+ return Response.success(accountService.viewsIncrease(id));
+ }
+
+ @ApiOperation(value = "获取个人主页信息")
+ @GetMapping("/personalHomepage")
+ public Response getPersonalHomepage(@RequestParam("id") Long id){
+ return Response.success(accountService.getPersonalHomepage(id));
+ }
}
diff --git a/src/main/java/com/ai/da/controller/ConvenientInquiryController.java b/src/main/java/com/ai/da/controller/ConvenientInquiryController.java
index 119baa5a..7953b74a 100644
--- a/src/main/java/com/ai/da/controller/ConvenientInquiryController.java
+++ b/src/main/java/com/ai/da/controller/ConvenientInquiryController.java
@@ -51,7 +51,8 @@ public class ConvenientInquiryController {
@ApiOperation("获取指定时间区间内所有用户design的使用情况")
@GetMapping("/getDesignStatistic")
- public Response> getDesignStatistic(@RequestParam String startTime, @RequestParam String endTime) {
+ public Response> getDesignStatistic(@RequestParam String startTime, @RequestParam String endTime,
+ @RequestParam(required = false) List ids, @RequestParam(required = false) String email) {
Long accountId = UserContext.getUserHolder().getId();
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L) || accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)) {
if (StringUtil.isNullOrEmpty(startTime)) startTime = "2024-02-01 00:00:00";
@@ -60,7 +61,10 @@ public class ConvenientInquiryController {
Date date = new Date();
endTime = simpleDateFormat.format(date);
}
- List designStatistic = designMapper.getDesignStatistic(startTime, endTime);
+ if (!StringUtil.isNullOrEmpty(email)){
+ email = email.trim();
+ }
+ List designStatistic = designMapper.getDesignStatistic(startTime, endTime, ids, email);
return Response.success(designStatistic);
} else {
return Response.fail("Sorry, you don't have permission");
diff --git a/src/main/java/com/ai/da/controller/MessageCenterController.java b/src/main/java/com/ai/da/controller/MessageCenterController.java
new file mode 100644
index 00000000..3f625cb8
--- /dev/null
+++ b/src/main/java/com/ai/da/controller/MessageCenterController.java
@@ -0,0 +1,63 @@
+package com.ai.da.controller;
+
+import com.ai.da.common.response.PageBaseResponse;
+import com.ai.da.common.response.Response;
+import com.ai.da.model.dto.GetNotificationDTO;
+import com.ai.da.model.vo.NotificationVO;
+import com.ai.da.model.dto.PublishSysNotificationDTO;
+import com.ai.da.service.MessageCenterService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.validation.Valid;
+import java.util.List;
+import java.util.Map;
+
+@Api(tags = "消息中心模块")
+@Slf4j
+@RestController
+@RequestMapping("/api/message")
+public class MessageCenterController {
+
+ @Resource
+ private MessageCenterService messageCenterService;
+
+ // 获取未读消息总数
+ @ApiOperation(value = "获取未读消息数")
+ @GetMapping("/getUnreadCount")
+ public Response