diff --git a/.vscode/settings.json b/.vscode/settings.json
index 7b016a8..e012065 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,3 +1,4 @@
{
- "java.compile.nullAnalysis.mode": "automatic"
+ "java.compile.nullAnalysis.mode": "automatic",
+ "java.configuration.updateBuildConfiguration": "interactive"
}
\ No newline at end of file
diff --git a/common-ruoyi/pom.xml b/common-ruoyi/pom.xml
index bc88f95..d4b57a1 100644
--- a/common-ruoyi/pom.xml
+++ b/common-ruoyi/pom.xml
@@ -16,7 +16,6 @@
ruoyi-common
ruoyi-generator
ruoyi-quartz
- ruoyi-system
ruoyi-framework
diff --git a/common-ruoyi/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java b/common-ruoyi/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java
index 82d994b..b257a77 100644
--- a/common-ruoyi/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java
+++ b/common-ruoyi/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java
@@ -61,4 +61,8 @@ public class CacheConstants
* 资源分类名称列表
*/
public static final String ATTACH_CLASSIFY_NAME_LIST = "attach_classify_name_list";
+ /**
+ * websocket用户session
+ */
+ public static final String WS_USER_SESSION = "ws_user_session:";
}
diff --git a/common-ruoyi/ruoyi-common/src/main/java/com/ruoyi/common/constant/DictType.java b/common-ruoyi/ruoyi-common/src/main/java/com/ruoyi/common/constant/DictType.java
index 08e1efe..7c1ee42 100644
--- a/common-ruoyi/ruoyi-common/src/main/java/com/ruoyi/common/constant/DictType.java
+++ b/common-ruoyi/ruoyi-common/src/main/java/com/ruoyi/common/constant/DictType.java
@@ -22,4 +22,6 @@ public class DictType {
public static final String NOTICE_LEVEL = "notice_level";
// 客户跟进方式
public static final String CUSTOMER_FOLLOW_TYPE = "customer_follow_type";
+ // 通知类型
+ public static final String NOTICE_TYPE = "notice_type";
}
diff --git a/common-ruoyi/ruoyi-framework/pom.xml b/common-ruoyi/ruoyi-framework/pom.xml
index 63cafa5..84b1877 100644
--- a/common-ruoyi/ruoyi-framework/pom.xml
+++ b/common-ruoyi/ruoyi-framework/pom.xml
@@ -56,7 +56,7 @@
com.ruoyi
- ruoyi-system
+ ruoyi-service
diff --git a/common-ruoyi/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/common-ruoyi/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
index e708bf3..594c763 100644
--- a/common-ruoyi/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
+++ b/common-ruoyi/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
@@ -1,10 +1,5 @@
package com.ruoyi.framework.config;
-import com.ruoyi.framework.config.properties.PermitAllUrlProperties;
-import com.ruoyi.framework.security.filter.CustomLoginAuthenticationProvider;
-import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter;
-import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl;
-import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -21,6 +16,12 @@ import org.springframework.security.web.authentication.UsernamePasswordAuthentic
import org.springframework.security.web.authentication.logout.LogoutFilter;
import org.springframework.web.filter.CorsFilter;
+import com.ruoyi.framework.config.properties.PermitAllUrlProperties;
+import com.ruoyi.framework.security.filter.CustomLoginAuthenticationProvider;
+import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter;
+import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl;
+import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl;
+
/**
* spring security配置
*
@@ -115,6 +116,8 @@ public class SecurityConfig
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
+ // 允许WebSocket连接
+ .antMatchers("/ws/**").permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated();
})
diff --git a/common-ruoyi/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java b/common-ruoyi/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java
index aa112da..bfcc93c 100644
--- a/common-ruoyi/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java
+++ b/common-ruoyi/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java
@@ -3,12 +3,15 @@ package com.ruoyi.framework.web.service;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
+
import javax.servlet.http.HttpServletRequest;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
+
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.model.LoginUser;
@@ -18,6 +21,7 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.ip.AddressUtils;
import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
+
import eu.bitwalker.useragentutils.UserAgent;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
@@ -63,6 +67,17 @@ public class TokenService
{
// 获取请求携带的令牌
String token = getToken(request);
+ return this.getLoginUser(token);
+ }
+
+ /**
+ * 获取用户身份信息
+ *
+ * @param token 令牌
+ * @return 用户信息
+ */
+ public LoginUser getLoginUser(String token)
+ {
if (StringUtils.isNotEmpty(token))
{
try
diff --git a/pom.xml b/pom.xml
index 631b8e2..87114f5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -171,7 +171,7 @@
com.ruoyi
- ruoyi-system
+ ruoyi-service
${ruoyi.version}
@@ -187,6 +187,7 @@
ruoyi-web
+ ruoyi-service
common-ruoyi
pom
diff --git a/common-ruoyi/ruoyi-system/pom.xml b/ruoyi-service/pom.xml
similarity index 79%
rename from common-ruoyi/ruoyi-system/pom.xml
rename to ruoyi-service/pom.xml
index bc9e184..6c5190b 100644
--- a/common-ruoyi/ruoyi-system/pom.xml
+++ b/ruoyi-service/pom.xml
@@ -3,26 +3,30 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- common-ruoyi
+ project-manager-java
com.ruoyi
3.8.8
4.0.0
- ruoyi-system
+ ruoyi-service
system系统模块
-
com.ruoyi
ruoyi-common
+
+
+ org.springframework.boot
+ spring-boot-starter-websocket
+
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/domain/Attach.java b/ruoyi-service/src/main/java/com/ruoyi/bst/attach/domain/Attach.java
similarity index 92%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/domain/Attach.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/attach/domain/Attach.java
index 7528081..0b31892 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/domain/Attach.java
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/attach/domain/Attach.java
@@ -43,4 +43,8 @@ public class Attach extends BaseEntity
@ApiModelProperty("创建人")
private Long createId;
+ @Excel(name = "所属部门")
+ @ApiModelProperty("所属部门")
+ private Long deptId;
+
}
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/domain/AttachQuery.java b/ruoyi-service/src/main/java/com/ruoyi/bst/attach/domain/AttachQuery.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/domain/AttachQuery.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/attach/domain/AttachQuery.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/domain/AttachVO.java b/ruoyi-service/src/main/java/com/ruoyi/bst/attach/domain/AttachVO.java
similarity index 81%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/domain/AttachVO.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/attach/domain/AttachVO.java
index c0310f0..bd5fb02 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/domain/AttachVO.java
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/attach/domain/AttachVO.java
@@ -11,5 +11,8 @@ public class AttachVO extends Attach {
@ApiModelProperty("创建人")
private String createName;
+
+ @ApiModelProperty("所属部门")
+ private String deptName;
}
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/mapper/AttachMapper.java b/ruoyi-service/src/main/java/com/ruoyi/bst/attach/mapper/AttachMapper.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/mapper/AttachMapper.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/attach/mapper/AttachMapper.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/mapper/AttachMapper.xml b/ruoyi-service/src/main/java/com/ruoyi/bst/attach/mapper/AttachMapper.xml
similarity index 88%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/mapper/AttachMapper.xml
rename to ruoyi-service/src/main/java/com/ruoyi/bst/attach/mapper/AttachMapper.xml
index 0f7abdf..06d00ba 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/mapper/AttachMapper.xml
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/attach/mapper/AttachMapper.xml
@@ -15,11 +15,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ba.create_id,
ba.create_time,
ba.deleted,
+ ba.dept_id,
bac.name as classify_name,
- su.nick_name as create_name
+ su.nick_name as create_name,
+ sd.dept_name as dept_name
from bst_attach ba
left join bst_attach_classify bac on bac.id = ba.classify_id
left join sys_user su on su.user_id = ba.create_id
+ left join sys_dept sd on sd.dept_id = ba.dept_id
@@ -33,6 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and ba.deleted = #{query.deleted}
and ba.deleted = false
and su.nick_name like concat('%', #{query.createName}, '%')
+ and ba.dept_id = #{query.deptId}
+ and sd.dept_name like concat('%', #{query.deptName}, '%')
and bac.id = #{query.classifyAncestorId} or find_in_set(#{query.classifyAncestorId}, bac.ancestors)
@@ -58,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
name,
url,
create_id,
+ dept_id,
create_time,
deleted,
@@ -66,6 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{name},
#{url},
#{createId},
+ #{deptId},
#{createTime},
#{deleted},
@@ -78,6 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
name,
url,
create_id,
+ dept_id,
create_time,
deleted,
@@ -92,6 +100,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
default,
#{i.createId},
default,
+ #{i.deptId},
+ default,
#{i.createTime},
default,
#{i.deleted},
@@ -163,6 +173,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+
+
+
+ WHEN #{item.id} THEN #{item.deptId}
+
+
+ WHEN #{item.id} THEN `dept_id`
+
+
+
where id in
@@ -184,6 +204,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
url = #{data.url},
create_id = #{data.createId},
create_time = #{data.createTime},
+ dept_id = #{data.deptId},
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/service/AttachConverter.java b/ruoyi-service/src/main/java/com/ruoyi/bst/attach/service/AttachConverter.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/service/AttachConverter.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/attach/service/AttachConverter.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/service/AttachService.java b/ruoyi-service/src/main/java/com/ruoyi/bst/attach/service/AttachService.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/service/AttachService.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/attach/service/AttachService.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/service/impl/AttachConverterImpl.java b/ruoyi-service/src/main/java/com/ruoyi/bst/attach/service/impl/AttachConverterImpl.java
similarity index 94%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/service/impl/AttachConverterImpl.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/attach/service/impl/AttachConverterImpl.java
index 12a366e..03f88b5 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/service/impl/AttachConverterImpl.java
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/attach/service/impl/AttachConverterImpl.java
@@ -29,6 +29,7 @@ public class AttachConverterImpl implements AttachConverter {
po.setCreateId(data.getCreateId());
po.setClassifyId(data.getClassifyId());
po.setCreateId(SecurityUtils.getUserId());
+ po.setDeptId(data.getDeptId());
result.add(po);
}
@@ -45,6 +46,7 @@ public class AttachConverterImpl implements AttachConverter {
po.setId(data.getId());
po.setClassifyId(data.getClassifyId());
po.setName(data.getName());
+ po.setDeptId(data.getDeptId());
return po;
}
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/service/impl/AttachServiceImpl.java b/ruoyi-service/src/main/java/com/ruoyi/bst/attach/service/impl/AttachServiceImpl.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attach/service/impl/AttachServiceImpl.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/attach/service/impl/AttachServiceImpl.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attachClassify/domain/AttachClassify.java b/ruoyi-service/src/main/java/com/ruoyi/bst/attachClassify/domain/AttachClassify.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attachClassify/domain/AttachClassify.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/attachClassify/domain/AttachClassify.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attachClassify/domain/AttachClassifyQuery.java b/ruoyi-service/src/main/java/com/ruoyi/bst/attachClassify/domain/AttachClassifyQuery.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attachClassify/domain/AttachClassifyQuery.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/attachClassify/domain/AttachClassifyQuery.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attachClassify/domain/AttachClassifyVO.java b/ruoyi-service/src/main/java/com/ruoyi/bst/attachClassify/domain/AttachClassifyVO.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attachClassify/domain/AttachClassifyVO.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/attachClassify/domain/AttachClassifyVO.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attachClassify/domain/vo/AttachClassifyNameVO.java b/ruoyi-service/src/main/java/com/ruoyi/bst/attachClassify/domain/vo/AttachClassifyNameVO.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attachClassify/domain/vo/AttachClassifyNameVO.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/attachClassify/domain/vo/AttachClassifyNameVO.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attachClassify/mapper/AttachClassifyMapper.java b/ruoyi-service/src/main/java/com/ruoyi/bst/attachClassify/mapper/AttachClassifyMapper.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attachClassify/mapper/AttachClassifyMapper.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/attachClassify/mapper/AttachClassifyMapper.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attachClassify/mapper/AttachClassifyMapper.xml b/ruoyi-service/src/main/java/com/ruoyi/bst/attachClassify/mapper/AttachClassifyMapper.xml
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attachClassify/mapper/AttachClassifyMapper.xml
rename to ruoyi-service/src/main/java/com/ruoyi/bst/attachClassify/mapper/AttachClassifyMapper.xml
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attachClassify/service/AttachClassifyService.java b/ruoyi-service/src/main/java/com/ruoyi/bst/attachClassify/service/AttachClassifyService.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attachClassify/service/AttachClassifyService.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/attachClassify/service/AttachClassifyService.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attachClassify/service/impl/AttachClassifyServiceImpl.java b/ruoyi-service/src/main/java/com/ruoyi/bst/attachClassify/service/impl/AttachClassifyServiceImpl.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/attachClassify/service/impl/AttachClassifyServiceImpl.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/attachClassify/service/impl/AttachClassifyServiceImpl.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/domain/Customer.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customer/domain/Customer.java
similarity index 83%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/domain/Customer.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customer/domain/Customer.java
index 8d243bb..286e93a 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/domain/Customer.java
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/customer/domain/Customer.java
@@ -92,4 +92,26 @@ public class Customer extends BaseEntity
@Excel(name = "创建人ID")
@ApiModelProperty("创建人ID")
private Long createId;
+
+ @Excel(name = "顾虑点")
+ @ApiModelProperty("顾虑点")
+ @Size(max = 200, message = "顾虑点长度不能超过200个字符")
+ private String concern;
+
+ @Excel(name = "痛点")
+ @ApiModelProperty("痛点")
+ @Size(max = 200, message = "痛点长度不能超过200个字符")
+ private String pain;
+
+ @Excel(name = "关注点")
+ @ApiModelProperty("关注点")
+ @Size(max = 200, message = "关注点长度不能超过200个字符")
+ private String attention;
+
+ @Excel(name = "需求")
+ @ApiModelProperty("需求")
+ @Size(max = 200, message = "需求长度不能超过200个字符")
+ private String demand;
+
+
}
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/domain/CustomerQuery.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customer/domain/CustomerQuery.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/domain/CustomerQuery.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customer/domain/CustomerQuery.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/domain/CustomerVO.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customer/domain/CustomerVO.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/domain/CustomerVO.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customer/domain/CustomerVO.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/domain/dto/CustomerAddDTO.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customer/domain/dto/CustomerAddDTO.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/domain/dto/CustomerAddDTO.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customer/domain/dto/CustomerAddDTO.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/domain/enums/CustomerStatus.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customer/domain/enums/CustomerStatus.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/domain/enums/CustomerStatus.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customer/domain/enums/CustomerStatus.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/mapper/CustomerMapper.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customer/mapper/CustomerMapper.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/mapper/CustomerMapper.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customer/mapper/CustomerMapper.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/mapper/CustomerMapper.xml b/ruoyi-service/src/main/java/com/ruoyi/bst/customer/mapper/CustomerMapper.xml
similarity index 86%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/mapper/CustomerMapper.xml
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customer/mapper/CustomerMapper.xml
index d8702b1..7526dc1 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/mapper/CustomerMapper.xml
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/customer/mapper/CustomerMapper.xml
@@ -26,6 +26,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bc.create_time,
bc.update_time,
bc.deleted,
+ bc.concern,
+ bc.pain,
+ bc.attention,
+ bc.demand,
suf.nick_name as follow_name,
su.nick_name as create_name
from bst_customer bc
@@ -53,6 +57,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and suf.nick_name like concat('%', #{query.followName}, '%')
and su.nick_name like concat('%', #{query.createName}, '%')
and su.user_id = #{query.createId}
+ and bc.concern like concat('%', #{query.concern}, '%')
+ and bc.pain like concat('%', #{query.pain}, '%')
+ and bc.attention like concat('%', #{query.attention}, '%')
+ and bc.demand like concat('%', #{query.demand}, '%')
and date(bc.create_time) >= #{query.createDateRange[0]}
and date(bc.create_time) <= #{query.createDateRange[1]}
@@ -69,6 +77,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item}
+ ${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
+ null,
+ "bc.create_id,bc.follow_id",
+ null,
+ null,
+ query.scope
+ )}
${query.params.dataScope}
@@ -103,6 +118,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
deleted,
create_id,
next_follow_time,
+ concern,
+ pain,
+ attention,
+ demand,
#{code},
@@ -121,6 +140,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{deleted},
#{createId},
#{nextFollowTime},
+ #{concern},
+ #{pain},
+ #{attention},
+ #{demand},
@@ -149,6 +172,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
deleted = #{data.deleted},
create_id = #{data.createId},
next_follow_time = #{data.nextFollowTime},
+ concern = #{data.concern},
+ pain = #{data.pain},
+ attention = #{data.attention},
+ demand = #{data.demand},
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/service/CustomerConverter.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customer/service/CustomerConverter.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/service/CustomerConverter.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customer/service/CustomerConverter.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/service/CustomerService.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customer/service/CustomerService.java
similarity index 87%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/service/CustomerService.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customer/service/CustomerService.java
index c6f7f3e..dffc156 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/service/CustomerService.java
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/customer/service/CustomerService.java
@@ -7,7 +7,6 @@ import com.ruoyi.bst.customer.domain.Customer;
import com.ruoyi.bst.customer.domain.CustomerQuery;
import com.ruoyi.bst.customer.domain.CustomerVO;
import com.ruoyi.bst.customer.domain.dto.CustomerAddDTO;
-import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.vo.LocalDateIntegerVO;
import com.ruoyi.common.vo.StringIntegerVO;
@@ -84,16 +83,6 @@ public interface CustomerService
*/
int updateFollowTime(Long customerId, LocalDateTime lastFollowTime, LocalDateTime nextFollowTime);
- /**
- * 查询客户列表,并根据数据权限过滤
- * @param query
- * @return
- */
- @DataScope(userAlias = "bc.create_id,bc.follow_id")
- default List selectCustomerListScope(CustomerQuery query) {
- return selectCustomerList(query);
- }
-
/**
* 逻辑删除
* @param ids
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/service/CustomerValidator.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customer/service/CustomerValidator.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/service/CustomerValidator.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customer/service/CustomerValidator.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/service/impl/CustomerConverterImpl.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customer/service/impl/CustomerConverterImpl.java
similarity index 84%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/service/impl/CustomerConverterImpl.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customer/service/impl/CustomerConverterImpl.java
index 0d7bb00..06f88c6 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/service/impl/CustomerConverterImpl.java
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/customer/service/impl/CustomerConverterImpl.java
@@ -10,7 +10,6 @@ import com.ruoyi.bst.customerFollow.domain.CustomerFollow;
@Service
public class CustomerConverterImpl implements CustomerConverter {
-
@Override
public CustomerAddDTO toDTOByCreate(CustomerAddDTO customer) {
if (customer == null) {
@@ -24,9 +23,13 @@ public class CustomerConverterImpl implements CustomerConverter {
po.setWechat(customer.getWechat());
po.setSource(customer.getSource());
po.setIntents(customer.getIntents());
- po.setFollowId(customer.getFollowId());
po.setRemark(customer.getRemark());
po.setFollow(customer.getFollow());
+ po.setFollowId(customer.getFollowId());
+ po.setConcern(customer.getConcern());
+ po.setPain(customer.getPain());
+ po.setAttention(customer.getAttention());
+ po.setDemand(customer.getDemand());
return po;
}
@@ -46,6 +49,10 @@ public class CustomerConverterImpl implements CustomerConverter {
po.setIntents(customer.getIntents());
po.setFollowId(customer.getFollowId());
po.setRemark(customer.getRemark());
+ po.setConcern(customer.getConcern());
+ po.setPain(customer.getPain());
+ po.setAttention(customer.getAttention());
+ po.setDemand(customer.getDemand());
return po;
}
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/service/impl/CustomerServiceImpl.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customer/service/impl/CustomerServiceImpl.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/service/impl/CustomerServiceImpl.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customer/service/impl/CustomerServiceImpl.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/service/impl/CustomerValidatorImpl.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customer/service/impl/CustomerValidatorImpl.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customer/service/impl/CustomerValidatorImpl.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customer/service/impl/CustomerValidatorImpl.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/domain/CustomerFollow.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/domain/CustomerFollow.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/domain/CustomerFollow.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/domain/CustomerFollow.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/domain/CustomerFollowQuery.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/domain/CustomerFollowQuery.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/domain/CustomerFollowQuery.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/domain/CustomerFollowQuery.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/domain/CustomerFollowVO.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/domain/CustomerFollowVO.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/domain/CustomerFollowVO.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/domain/CustomerFollowVO.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/mapper/CustomerFollowMapper.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/mapper/CustomerFollowMapper.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/mapper/CustomerFollowMapper.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/mapper/CustomerFollowMapper.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/mapper/CustomerFollowMapper.xml b/ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/mapper/CustomerFollowMapper.xml
similarity index 96%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/mapper/CustomerFollowMapper.xml
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/mapper/CustomerFollowMapper.xml
index 9f6457e..bf5906e 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/mapper/CustomerFollowMapper.xml
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/mapper/CustomerFollowMapper.xml
@@ -34,6 +34,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and bc.name like concat('%', #{query.customerName}, '%')
and bc.code like concat('%', #{query.customerCode}, '%')
and su.nick_name like concat('%', #{query.userName}, '%')
+ ${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
+ null,
+ "bcf.user_id",
+ null,
+ null,
+ query.scope
+ )}
${query.params.dataScope}
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/service/CustomerFollowConverter.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/service/CustomerFollowConverter.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/service/CustomerFollowConverter.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/service/CustomerFollowConverter.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/service/CustomerFollowService.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/service/CustomerFollowService.java
similarity index 82%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/service/CustomerFollowService.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/service/CustomerFollowService.java
index 819d307..d6dbb75 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/service/CustomerFollowService.java
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/service/CustomerFollowService.java
@@ -5,7 +5,6 @@ import java.util.List;
import com.ruoyi.bst.customerFollow.domain.CustomerFollow;
import com.ruoyi.bst.customerFollow.domain.CustomerFollowQuery;
import com.ruoyi.bst.customerFollow.domain.CustomerFollowVO;
-import com.ruoyi.common.annotation.DataScope;
/**
* 客户跟进记录Service接口
@@ -62,14 +61,4 @@ public interface CustomerFollowService
* @return 结果
*/
public int deleteCustomerFollowByFollowId(Long followId);
-
- /**
- * 查询客户跟进记录列表,并根据数据权限过滤
- * @param query
- * @return
- */
- @DataScope(userAlias = "bcf.user_id")
- default List selectCustomerFollowListScope(CustomerFollowQuery query) {
- return selectCustomerFollowList(query);
- }
}
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/service/impl/CustomerFollowConverterImpl.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/service/impl/CustomerFollowConverterImpl.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/service/impl/CustomerFollowConverterImpl.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/service/impl/CustomerFollowConverterImpl.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/service/impl/CustomerFollowServiceImpl.java b/ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/service/impl/CustomerFollowServiceImpl.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/customerFollow/service/impl/CustomerFollowServiceImpl.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/customerFollow/service/impl/CustomerFollowServiceImpl.java
diff --git a/ruoyi-service/src/main/java/com/ruoyi/bst/message/domain/Message.java b/ruoyi-service/src/main/java/com/ruoyi/bst/message/domain/Message.java
new file mode 100644
index 0000000..15f7e57
--- /dev/null
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/message/domain/Message.java
@@ -0,0 +1,55 @@
+package com.ruoyi.bst.message.domain;
+
+import java.time.LocalDateTime;
+
+import org.springframework.format.annotation.DateTimeFormat;
+
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 消息对象 bst_message
+ *
+ * @author ruoyi
+ * @date 2025-02-22
+ */
+@Data
+public class Message extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ private Long id;
+
+ @Excel(name = "接收人")
+ @ApiModelProperty("接收人")
+ private Long userId;
+
+ @Excel(name = "业务类型")
+ @ApiModelProperty("业务类型")
+ private String bstType;
+
+ @Excel(name = "业务ID")
+ @ApiModelProperty("业务ID")
+ private Long bstId;
+
+ @Excel(name = "标题")
+ @ApiModelProperty("标题")
+ private String title;
+
+ @Excel(name = "内容")
+ @ApiModelProperty("内容")
+ private String content;
+
+ @Excel(name = "是否已读")
+ @ApiModelProperty("是否已读")
+ private Boolean isRead;
+
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @Excel(name = "已读时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+ @ApiModelProperty("已读时间")
+ private LocalDateTime readTime;
+
+}
diff --git a/ruoyi-service/src/main/java/com/ruoyi/bst/message/domain/MessageQuery.java b/ruoyi-service/src/main/java/com/ruoyi/bst/message/domain/MessageQuery.java
new file mode 100644
index 0000000..036380d
--- /dev/null
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/message/domain/MessageQuery.java
@@ -0,0 +1,8 @@
+package com.ruoyi.bst.message.domain;
+
+import lombok.Data;
+
+@Data
+public class MessageQuery extends MessageVO {
+
+}
diff --git a/ruoyi-service/src/main/java/com/ruoyi/bst/message/domain/MessageVO.java b/ruoyi-service/src/main/java/com/ruoyi/bst/message/domain/MessageVO.java
new file mode 100644
index 0000000..a0af767
--- /dev/null
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/message/domain/MessageVO.java
@@ -0,0 +1,8 @@
+package com.ruoyi.bst.message.domain;
+
+import lombok.Data;
+
+@Data
+public class MessageVO extends Message{
+
+}
diff --git a/ruoyi-service/src/main/java/com/ruoyi/bst/message/domain/enums/MessageBstType.java b/ruoyi-service/src/main/java/com/ruoyi/bst/message/domain/enums/MessageBstType.java
new file mode 100644
index 0000000..58c8942
--- /dev/null
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/message/domain/enums/MessageBstType.java
@@ -0,0 +1,17 @@
+package com.ruoyi.bst.message.domain.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
+public enum MessageBstType {
+
+ TASK("task", "任务"),
+ TASK_SUBMIT("task_submit", "任务提交"),
+ CUSTOMER("customer", "客户");
+
+ private String value;
+ private String name;
+
+}
diff --git a/ruoyi-service/src/main/java/com/ruoyi/bst/message/mapper/MessageMapper.java b/ruoyi-service/src/main/java/com/ruoyi/bst/message/mapper/MessageMapper.java
new file mode 100644
index 0000000..262007c
--- /dev/null
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/message/mapper/MessageMapper.java
@@ -0,0 +1,88 @@
+package com.ruoyi.bst.message.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+
+import com.ruoyi.bst.message.domain.Message;
+import com.ruoyi.bst.message.domain.MessageQuery;
+import com.ruoyi.bst.message.domain.MessageVO;
+
+/**
+ * 消息Mapper接口
+ *
+ * @author ruoyi
+ * @date 2025-02-22
+ */
+public interface MessageMapper
+{
+ /**
+ * 查询消息
+ *
+ * @param id 消息主键
+ * @return 消息
+ */
+ MessageVO selectMessageById(Long id);
+
+ /**
+ * 查询消息列表
+ *
+ * @param query 消息
+ * @return 消息集合
+ */
+ List selectMessageList(@Param("query")MessageQuery query);
+
+ /**
+ * 新增消息
+ *
+ * @param message 消息
+ * @return 结果
+ */
+ int insertMessage(Message message);
+
+ /**
+ * 修改消息
+ *
+ * @param message 消息
+ * @return 结果
+ */
+ public int updateMessage(@Param("data") Message message);
+
+ /**
+ * 删除消息
+ *
+ * @param id 消息主键
+ * @return 结果
+ */
+ int deleteMessageById(Long id);
+
+ /**
+ * 批量删除消息
+ *
+ * @param ids 需要删除的数据主键集合
+ * @return 结果
+ */
+ public int deleteMessageByIds(Long[] ids);
+
+ /**
+ * 根据条件更新
+ * @param data
+ * @param query
+ * @return
+ */
+ int updateByQuery(@Param("data") Message data, @Param("query") MessageQuery query);
+
+ /**
+ * 查询数量
+ * @param query
+ * @return
+ */
+ int selectCount(@Param("query") MessageQuery query);
+
+ /**
+ * 批量插入消息
+ * @param list
+ * @return
+ */
+ int batchInsert(@Param("list") List list);
+}
diff --git a/ruoyi-service/src/main/java/com/ruoyi/bst/message/mapper/MessageMapper.xml b/ruoyi-service/src/main/java/com/ruoyi/bst/message/mapper/MessageMapper.xml
new file mode 100644
index 0000000..58bf0aa
--- /dev/null
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/message/mapper/MessageMapper.xml
@@ -0,0 +1,165 @@
+
+
+
+
+
+
+
+ select
+ bm.id,
+ bm.user_id,
+ bm.bst_type,
+ bm.bst_id,
+ bm.title,
+ bm.content,
+ bm.is_read,
+ bm.create_time,
+ bm.read_time
+ from bst_message bm
+
+
+
+ and bm.id = #{query.id}
+ and bm.user_id = #{query.userId}
+ and bm.bst_type = #{query.bstType}
+ and bm.bst_id = #{query.bstId}
+ and bm.title like concat('%', #{query.title}, '%')
+ and bm.content like concat('%', #{query.content}, '%')
+ and bm.is_read = #{query.isRead}
+ and bm.read_time = #{query.readTime}
+ ${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
+ null,
+ "bm.user_id",
+ null,
+ null,
+ query.scope
+ )}
+ ${query.params.dataScope}
+
+
+
+
+
+
+
+ insert into bst_message
+
+ user_id,
+ bst_type,
+ bst_id,
+ title,
+ content,
+ is_read,
+ create_time,
+ read_time,
+
+
+ #{userId},
+ #{bstType},
+ #{bstId},
+ #{title},
+ #{content},
+ #{isRead},
+ #{createTime},
+ #{readTime},
+
+
+
+
+
+ insert into bst_message
+
+ user_id,
+ bst_type,
+ bst_id,
+ title,
+ content,
+ is_read,
+ create_time,
+ read_time,
+
+ values
+
+
+ #{i.userId},
+ default,
+ #{i.bstType},
+ default,
+ #{i.bstId},
+ default,
+ #{i.title},
+ default,
+ #{i.content},
+ default,
+ #{i.isRead},
+ default,
+ #{i.createTime},
+ default,
+ #{i.readTime},
+ default,
+
+
+
+
+
+ update bst_message
+
+
+
+ where id = #{data.id}
+
+
+
+ user_id = #{data.userId},
+ bst_type = #{data.bstType},
+ bst_id = #{data.bstId},
+ title = #{data.title},
+ content = #{data.content},
+ is_read = #{data.isRead},
+ create_time = #{data.createTime},
+ read_time = #{data.readTime},
+
+
+
+ delete from bst_message where id = #{id}
+
+
+
+ delete from bst_message where id in
+
+ #{id}
+
+
+
+
+
+
+ update bst_message bm
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ruoyi-service/src/main/java/com/ruoyi/bst/message/service/MessageConverter.java b/ruoyi-service/src/main/java/com/ruoyi/bst/message/service/MessageConverter.java
new file mode 100644
index 0000000..e71ec06
--- /dev/null
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/message/service/MessageConverter.java
@@ -0,0 +1,46 @@
+package com.ruoyi.bst.message.service;
+
+import java.util.List;
+
+import com.ruoyi.bst.message.domain.Message;
+import com.ruoyi.bst.task.domain.TaskVO;
+import com.ruoyi.bst.taskSubmit.domain.TaskSubmitVO;
+
+public interface MessageConverter {
+
+ /**
+ * 将任务创建消息转换为消息实体
+ * @param vo
+ * @return
+ */
+ List toPoByTaskCreate(TaskVO vo);
+
+ /**
+ * 将任务更新消息转换为消息实体
+ * @param vo
+ * @return
+ */
+ List toPoByTaskUpdate(TaskVO vo);
+
+ /**
+ * 将任务提交消息转换为消息实体
+ * @param vo
+ * @return
+ */
+ List toPoByTaskSubmit(TaskSubmitVO vo);
+
+ /**
+ * 将任务完成消息转换为消息实体
+ * @param vo
+ * @return
+ */
+ List toPoByTaskPass(TaskVO vo);
+
+ /**
+ * 将任务取消消息转换为消息实体
+ * @param vo
+ * @return
+ */
+ List toPoByTaskCancel(TaskVO vo);
+
+}
diff --git a/ruoyi-service/src/main/java/com/ruoyi/bst/message/service/MessageService.java b/ruoyi-service/src/main/java/com/ruoyi/bst/message/service/MessageService.java
new file mode 100644
index 0000000..689f077
--- /dev/null
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/message/service/MessageService.java
@@ -0,0 +1,86 @@
+package com.ruoyi.bst.message.service;
+
+import java.util.List;
+
+import com.ruoyi.bst.message.domain.Message;
+import com.ruoyi.bst.message.domain.MessageQuery;
+import com.ruoyi.bst.message.domain.MessageVO;
+
+/**
+ * 消息Service接口
+ *
+ * @author ruoyi
+ * @date 2025-02-22
+ */
+public interface MessageService
+{
+ /**
+ * 查询消息
+ *
+ * @param id 消息主键
+ * @return 消息
+ */
+ public MessageVO selectMessageById(Long id);
+
+ /**
+ * 查询消息列表
+ *
+ * @param message 消息
+ * @return 消息集合
+ */
+ public List selectMessageList(MessageQuery message);
+
+ /**
+ * 新增消息
+ *
+ * @param message 消息
+ * @return 结果
+ */
+ public int insertMessage(Message message);
+
+ /**
+ * 修改消息
+ *
+ * @param message 消息
+ * @return 结果
+ */
+ public int updateMessage(Message message);
+
+ /**
+ * 批量删除消息
+ *
+ * @param ids 需要删除的消息主键集合
+ * @return 结果
+ */
+ public int deleteMessageByIds(Long[] ids);
+
+ /**
+ * 删除消息信息
+ *
+ * @param id 消息主键
+ * @return 结果
+ */
+ public int deleteMessageById(Long id);
+
+ /**
+ * 消息已读
+ * @param userId
+ * @param id
+ * @return
+ */
+ public int read(Long userId, Long id);
+
+ /**
+ * 查询未读消息数量
+ * @param query
+ * @return
+ */
+ public int selectCount(MessageQuery query);
+
+ /**
+ * 批量插入消息
+ * @param list
+ * @return
+ */
+ public int batchInsert(List list);
+}
diff --git a/ruoyi-service/src/main/java/com/ruoyi/bst/message/service/impl/MessageConverterImpl.java b/ruoyi-service/src/main/java/com/ruoyi/bst/message/service/impl/MessageConverterImpl.java
new file mode 100644
index 0000000..f3d9a3f
--- /dev/null
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/message/service/impl/MessageConverterImpl.java
@@ -0,0 +1,148 @@
+package com.ruoyi.bst.message.service.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.springframework.stereotype.Service;
+
+import com.google.common.base.Objects;
+import com.ruoyi.bst.message.domain.Message;
+import com.ruoyi.bst.message.domain.enums.MessageBstType;
+import com.ruoyi.bst.message.service.MessageConverter;
+import com.ruoyi.bst.task.domain.TaskVO;
+import com.ruoyi.bst.taskSubmit.domain.TaskSubmitVO;
+import com.ruoyi.common.utils.collection.CollectionUtils;
+
+@Service
+public class MessageConverterImpl implements MessageConverter {
+
+
+ @Override
+ public List toPoByTaskCreate(TaskVO vo) {
+ if (vo == null || CollectionUtils.isEmptyElement(vo.getOwnerIds())) {
+ return Collections.emptyList();
+ }
+
+ List result = new ArrayList<>();
+ String bstType = MessageBstType.TASK.getValue();
+ String title = "新任务";
+ String content = String.format("%s创建了一个新任务:%s\n截止时间:%s", vo.getCreateName(), vo.getDescription(), vo.getExpireTime());
+
+ for (Long ownerId : vo.getOwnerIds()) {
+ Message message = new Message();
+ message.setBstType(bstType);
+ message.setBstId(vo.getId());
+ message.setUserId(ownerId);
+ message.setTitle(title);
+ message.setContent(content);
+ result.add(message);
+ }
+
+ return result;
+ }
+
+ @Override
+ public List toPoByTaskUpdate(TaskVO vo) {
+ if (vo == null || CollectionUtils.isEmptyElement(vo.getOwnerIds())) {
+ return Collections.emptyList();
+ }
+
+ List result = new ArrayList<>();
+ String bstType = MessageBstType.TASK.getValue();
+ String title = "任务更新";
+ String content = String.format("新内容:%s", vo.getDescription());
+
+ for (Long ownerId : vo.getOwnerIds()) {
+ Message message = new Message();
+ message.setBstType(bstType);
+ message.setBstId(vo.getId());
+ message.setUserId(ownerId);
+ message.setTitle(title);
+ message.setContent(content);
+ result.add(message);
+ }
+
+ return result;
+ }
+
+ @Override
+ public List toPoByTaskSubmit(TaskSubmitVO vo) {
+ if (vo == null) {
+ return Collections.emptyList();
+ }
+
+ List result = new ArrayList<>();
+ String bstType = MessageBstType.TASK.getValue();
+ String title = "任务提交";
+ String remark = vo.getRemark() == null ? "--" : vo.getRemark();
+ String content = String.format("%s提交了任务:%s\n备注:%s", vo.getUserName(), vo.getTaskDescription(), remark);
+
+ // 获取通知人:任务创建人、除了提交人以外的任务负责人
+ List userIds = vo.getTaskOwnerIds() == null ? new ArrayList<>() : vo.getTaskOwnerIds();
+ userIds.add(vo.getTaskCreateId());
+ userIds = userIds.stream().filter(item -> {
+ return item != null && !Objects.equal(item, vo.getUserId());
+ }).collect(Collectors.toList());
+
+ for (Long ownerId : userIds) {
+ Message message = new Message();
+ message.setBstType(bstType);
+ message.setBstId(vo.getTaskId());
+ message.setUserId(ownerId);
+ message.setTitle(title);
+ message.setContent(content);
+ result.add(message);
+ }
+
+ return result;
+ }
+
+ @Override
+ public List toPoByTaskPass(TaskVO vo) {
+ if (vo == null) {
+ return Collections.emptyList();
+ }
+
+ List result = new ArrayList<>();
+ String bstType = MessageBstType.TASK.getValue();
+ String title = "任务完成";
+ String content = String.format("任务:%s已完成", vo.getDescription());
+
+ Message message = new Message();
+ message.setBstType(bstType);
+ message.setBstId(vo.getId());
+ message.setUserId(vo.getCreateId());
+ message.setTitle(title);
+ message.setContent(content);
+ result.add(message);
+
+ return result;
+ }
+
+ @Override
+ public List toPoByTaskCancel(TaskVO vo) {
+ if (vo == null) {
+ return Collections.emptyList();
+ }
+
+ List result = new ArrayList<>();
+ String bstType = MessageBstType.TASK.getValue();
+ String title = "任务取消";
+ String content = String.format("任务:%s已取消\n取消原因:%s", vo.getDescription(), vo.getCancelRemark());
+
+ for (Long ownerId : vo.getOwnerIds()) {
+ Message message = new Message();
+ message.setBstType(bstType);
+ message.setBstId(vo.getId());
+ message.setUserId(ownerId);
+ message.setTitle(title);
+ message.setContent(content);
+ result.add(message);
+ }
+
+ return result;
+ }
+
+}
diff --git a/ruoyi-service/src/main/java/com/ruoyi/bst/message/service/impl/MessageServiceImpl.java b/ruoyi-service/src/main/java/com/ruoyi/bst/message/service/impl/MessageServiceImpl.java
new file mode 100644
index 0000000..ed92052
--- /dev/null
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/message/service/impl/MessageServiceImpl.java
@@ -0,0 +1,163 @@
+package com.ruoyi.bst.message.service.impl;
+
+import java.time.LocalDateTime;
+import java.util.Date;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.ruoyi.bst.message.domain.Message;
+import com.ruoyi.bst.message.domain.MessageQuery;
+import com.ruoyi.bst.message.domain.MessageVO;
+import com.ruoyi.bst.message.mapper.MessageMapper;
+import com.ruoyi.bst.message.service.MessageService;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.collection.CollectionUtils;
+import com.ruoyi.ws.service.WebSocketService;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 消息Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2025-02-22
+ */
+@Service
+@Slf4j
+public class MessageServiceImpl implements MessageService
+{
+ @Autowired
+ private MessageMapper messageMapper;
+
+ @Autowired
+ private WebSocketService webSocketService;
+
+ /**
+ * 查询消息
+ *
+ * @param id 消息主键
+ * @return 消息
+ */
+ @Override
+ public MessageVO selectMessageById(Long id)
+ {
+ return messageMapper.selectMessageById(id);
+ }
+
+ /**
+ * 查询消息列表
+ *
+ * @param message 消息
+ * @return 消息
+ */
+ @Override
+ public List selectMessageList(MessageQuery message)
+ {
+ return messageMapper.selectMessageList(message);
+ }
+
+ /**
+ * 新增消息
+ *
+ * @param message 消息
+ * @return 结果
+ */
+ @Override
+ public int insertMessage(Message message)
+ {
+ message.setCreateTime(DateUtils.getNowDate());
+ int rows = messageMapper.insertMessage(message);
+ if (rows > 0) {
+ if (message.getUserId() != null) {
+ webSocketService.sendMessageToUser(message, message.getUserId());
+ }
+ }
+ return rows;
+ }
+
+ /**
+ * 修改消息
+ *
+ * @param message 消息
+ * @return 结果
+ */
+ @Override
+ public int updateMessage(Message message)
+ {
+ return messageMapper.updateMessage(message);
+ }
+
+ /**
+ * 批量删除消息
+ *
+ * @param ids 需要删除的消息主键
+ * @return 结果
+ */
+ @Override
+ public int deleteMessageByIds(Long[] ids)
+ {
+ return messageMapper.deleteMessageByIds(ids);
+ }
+
+ /**
+ * 删除消息信息
+ *
+ * @param id 消息主键
+ * @return 结果
+ */
+ @Override
+ public int deleteMessageById(Long id)
+ {
+ return messageMapper.deleteMessageById(id);
+ }
+
+ @Override
+ public int read(Long userId, Long id){
+ // 两个条件不允许同时为空
+ if (id == null && userId == null) {
+ return 0;
+ }
+ Message data = new Message();
+ data.setIsRead(true);
+ data.setReadTime(LocalDateTime.now());
+ MessageQuery query = new MessageQuery();
+ query.setUserId(userId);
+ query.setId(id);
+ query.setIsRead(false);
+ return messageMapper.updateByQuery(data, query);
+ }
+
+ @Override
+ public int selectCount(MessageQuery query)
+ {
+ return messageMapper.selectCount(query);
+ }
+
+ @Override
+ public int batchInsert(List list) {
+ if (CollectionUtils.isEmptyElement(list)) {
+ return 0;
+ }
+ Date now = DateUtils.getNowDate();
+ list.forEach(message -> {
+ message.setCreateTime(now);
+ });
+ int rows = messageMapper.batchInsert(list);
+
+ if (rows > 0) {
+ for (Message message : list) {
+ try {
+ if (message.getUserId() != null) {
+ webSocketService.sendMessageToUser(message, message.getUserId());
+ }
+ } catch (Exception e) {
+ log.error("发送消息给用户{}失败", message.getUserId(), e);
+ }
+ }
+ }
+
+ return rows;
+ }
+}
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/domain/Notice.java b/ruoyi-service/src/main/java/com/ruoyi/bst/notice/domain/Notice.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/domain/Notice.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/notice/domain/Notice.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/domain/NoticeQuery.java b/ruoyi-service/src/main/java/com/ruoyi/bst/notice/domain/NoticeQuery.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/domain/NoticeQuery.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/notice/domain/NoticeQuery.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/domain/NoticeVO.java b/ruoyi-service/src/main/java/com/ruoyi/bst/notice/domain/NoticeVO.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/domain/NoticeVO.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/notice/domain/NoticeVO.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/mapper/NoticeMapper.java b/ruoyi-service/src/main/java/com/ruoyi/bst/notice/mapper/NoticeMapper.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/mapper/NoticeMapper.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/notice/mapper/NoticeMapper.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/mapper/NoticeMapper.xml b/ruoyi-service/src/main/java/com/ruoyi/bst/notice/mapper/NoticeMapper.xml
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/mapper/NoticeMapper.xml
rename to ruoyi-service/src/main/java/com/ruoyi/bst/notice/mapper/NoticeMapper.xml
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/service/NoticeAssembler.java b/ruoyi-service/src/main/java/com/ruoyi/bst/notice/service/NoticeAssembler.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/service/NoticeAssembler.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/notice/service/NoticeAssembler.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/service/NoticeService.java b/ruoyi-service/src/main/java/com/ruoyi/bst/notice/service/NoticeService.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/service/NoticeService.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/notice/service/NoticeService.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/service/impl/NoticeAssemblerImpl.java b/ruoyi-service/src/main/java/com/ruoyi/bst/notice/service/impl/NoticeAssemblerImpl.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/service/impl/NoticeAssemblerImpl.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/notice/service/impl/NoticeAssemblerImpl.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/service/impl/NoticeServiceImpl.java b/ruoyi-service/src/main/java/com/ruoyi/bst/notice/service/impl/NoticeServiceImpl.java
similarity index 59%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/service/impl/NoticeServiceImpl.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/notice/service/impl/NoticeServiceImpl.java
index c5674f2..1bbb436 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/notice/service/impl/NoticeServiceImpl.java
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/notice/service/impl/NoticeServiceImpl.java
@@ -1,16 +1,21 @@
package com.ruoyi.bst.notice.service.impl;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import com.ruoyi.bst.message.domain.Message;
import com.ruoyi.bst.notice.domain.Notice;
import com.ruoyi.bst.notice.domain.NoticeQuery;
import com.ruoyi.bst.notice.domain.NoticeVO;
import com.ruoyi.bst.notice.mapper.NoticeMapper;
import com.ruoyi.bst.notice.service.NoticeService;
import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.system.user.service.UserService;
+import com.ruoyi.ws.service.WebSocketService;
/**
* 公告Service业务层处理
@@ -24,6 +29,13 @@ public class NoticeServiceImpl implements NoticeService
@Autowired
private NoticeMapper noticeMapper;
+ @Autowired
+ private WebSocketService webSocketService;
+
+ @Autowired
+ private UserService userService;
+
+
/**
* 查询公告
*
@@ -58,7 +70,12 @@ public class NoticeServiceImpl implements NoticeService
public int insertNotice(Notice notice)
{
notice.setCreateTime(DateUtils.getNowDate());
- return noticeMapper.insertNotice(notice);
+ int rows = noticeMapper.insertNotice(notice);
+
+ // 发送消息给接收人
+ this.sendNotice(notice.getId());
+
+ return rows;
}
/**
@@ -70,7 +87,36 @@ public class NoticeServiceImpl implements NoticeService
@Override
public int updateNotice(Notice notice)
{
- return noticeMapper.updateNotice(notice);
+ int rows = noticeMapper.updateNotice(notice);
+
+ // 发送消息给接收人
+ this.sendNotice(notice.getId());
+
+ return rows;
+ }
+
+
+ /**
+ * 发送消息给接收人
+ * @param id
+ */
+ private boolean sendNotice(Long id) {
+ NoticeVO vo = this.selectNoticeById(id);
+ if (vo == null) {
+ return false;
+ }
+
+ // 获取接收人ID列表
+ Set userIds = vo.getReceiveUserIds() == null ? new HashSet<>() : new HashSet<>(vo.getReceiveUserIds());
+ userIds.addAll(userService.selectUserIdsByDeptIds(vo.getReceiveDeptIds()));
+
+ // 发送消息给接收人
+ Message message = new Message();
+ message.setTitle("【公告】" + vo.getTitle());
+ message.setContent(vo.getContent());
+ webSocketService.sendMessageToUser(message, userIds);
+
+ return true;
}
/**
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/domain/Project.java b/ruoyi-service/src/main/java/com/ruoyi/bst/project/domain/Project.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/domain/Project.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/project/domain/Project.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/domain/ProjectQuery.java b/ruoyi-service/src/main/java/com/ruoyi/bst/project/domain/ProjectQuery.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/domain/ProjectQuery.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/project/domain/ProjectQuery.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/domain/ProjectVO.java b/ruoyi-service/src/main/java/com/ruoyi/bst/project/domain/ProjectVO.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/domain/ProjectVO.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/project/domain/ProjectVO.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/domain/dto/ProjectMaintenanceDTO.java b/ruoyi-service/src/main/java/com/ruoyi/bst/project/domain/dto/ProjectMaintenanceDTO.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/domain/dto/ProjectMaintenanceDTO.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/project/domain/dto/ProjectMaintenanceDTO.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/domain/dto/ProjectStartDTO.java b/ruoyi-service/src/main/java/com/ruoyi/bst/project/domain/dto/ProjectStartDTO.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/domain/dto/ProjectStartDTO.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/project/domain/dto/ProjectStartDTO.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/domain/enums/ProjectStatus.java b/ruoyi-service/src/main/java/com/ruoyi/bst/project/domain/enums/ProjectStatus.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/domain/enums/ProjectStatus.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/project/domain/enums/ProjectStatus.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/domain/vo/ProjectNameVO.java b/ruoyi-service/src/main/java/com/ruoyi/bst/project/domain/vo/ProjectNameVO.java
similarity index 52%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/domain/vo/ProjectNameVO.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/project/domain/vo/ProjectNameVO.java
index 1c73fa3..b6abc56 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/domain/vo/ProjectNameVO.java
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/project/domain/vo/ProjectNameVO.java
@@ -1,5 +1,7 @@
package com.ruoyi.bst.project.domain.vo;
+import java.util.List;
+
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -12,4 +14,13 @@ public class ProjectNameVO {
@ApiModelProperty("项目名称")
private String name;
+ @ApiModelProperty("项目负责人ID")
+ private Long ownerId;
+
+ @ApiModelProperty("项目跟进人ID")
+ private Long followId;
+
+ @ApiModelProperty("项目成员ID列表")
+ private List memberIds;
+
}
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/mapper/ProjectMapper.java b/ruoyi-service/src/main/java/com/ruoyi/bst/project/mapper/ProjectMapper.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/mapper/ProjectMapper.java
rename to ruoyi-service/src/main/java/com/ruoyi/bst/project/mapper/ProjectMapper.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/mapper/ProjectMapper.xml b/ruoyi-service/src/main/java/com/ruoyi/bst/project/mapper/ProjectMapper.xml
similarity index 97%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/mapper/ProjectMapper.xml
rename to ruoyi-service/src/main/java/com/ruoyi/bst/project/mapper/ProjectMapper.xml
index aae23c0..1ada96a 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/bst/project/mapper/ProjectMapper.xml
+++ b/ruoyi-service/src/main/java/com/ruoyi/bst/project/mapper/ProjectMapper.xml
@@ -199,10 +199,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and deleted = false
-
+
+ select user_id
+ from sys_user u
+
+
+
+
+
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/user/service/UserService.java b/ruoyi-service/src/main/java/com/ruoyi/system/user/service/UserService.java
similarity index 97%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/user/service/UserService.java
rename to ruoyi-service/src/main/java/com/ruoyi/system/user/service/UserService.java
index 104e0d2..08ce394 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/user/service/UserService.java
+++ b/ruoyi-service/src/main/java/com/ruoyi/system/user/service/UserService.java
@@ -250,4 +250,11 @@ public interface UserService
* @return
*/
List selectByIds(List ids);
+
+ /**
+ * 根据部门ID列表查询用户ID列表
+ * @param deptIds
+ * @return
+ */
+ List selectUserIdsByDeptIds(List deptIds);
}
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/user/service/UserValidator.java b/ruoyi-service/src/main/java/com/ruoyi/system/user/service/UserValidator.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/user/service/UserValidator.java
rename to ruoyi-service/src/main/java/com/ruoyi/system/user/service/UserValidator.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/user/service/impl/UserServiceImpl.java b/ruoyi-service/src/main/java/com/ruoyi/system/user/service/impl/UserServiceImpl.java
similarity index 97%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/user/service/impl/UserServiceImpl.java
rename to ruoyi-service/src/main/java/com/ruoyi/system/user/service/impl/UserServiceImpl.java
index d478592..93fe6e5 100644
--- a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/user/service/impl/UserServiceImpl.java
+++ b/ruoyi-service/src/main/java/com/ruoyi/system/user/service/impl/UserServiceImpl.java
@@ -724,7 +724,9 @@ public class UserServiceImpl implements UserService
public List selectAllUserNameList() {
List list = redisCache.getCacheList(CacheConstants.USER_NAME_LIST);
if (CollectionUtils.isEmptyElement(list)) {
- list = userMapper.selectNameList(new SysUserQuery());
+ SysUserQuery query = new SysUserQuery();
+ query.setExcludeUserId(1L);
+ list = userMapper.selectNameList(query);
if (CollectionUtils.isNotEmptyElement(list)) {
redisCache.setCacheList(CacheConstants.USER_NAME_LIST, list);
}
@@ -761,4 +763,14 @@ public class UserServiceImpl implements UserService
query.setNickNames(nickNames);
return userMapper.selectUserList(query);
}
+
+ @Override
+ public List selectUserIdsByDeptIds(List deptIds) {
+ if (CollectionUtils.isEmptyElement(deptIds)) {
+ return Collections.emptyList();
+ }
+ SysUserQuery query = new SysUserQuery();
+ query.setDeptIds(deptIds);
+ return userMapper.selectUserIds(query);
+ }
}
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/user/service/impl/UserValidatorImpl.java b/ruoyi-service/src/main/java/com/ruoyi/system/user/service/impl/UserValidatorImpl.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/user/service/impl/UserValidatorImpl.java
rename to ruoyi-service/src/main/java/com/ruoyi/system/user/service/impl/UserValidatorImpl.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/valid/DictValid.java b/ruoyi-service/src/main/java/com/ruoyi/system/valid/DictValid.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/valid/DictValid.java
rename to ruoyi-service/src/main/java/com/ruoyi/system/valid/DictValid.java
diff --git a/common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/valid/DictValidator.java b/ruoyi-service/src/main/java/com/ruoyi/system/valid/DictValidator.java
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/java/com/ruoyi/system/valid/DictValidator.java
rename to ruoyi-service/src/main/java/com/ruoyi/system/valid/DictValidator.java
diff --git a/ruoyi-service/src/main/java/com/ruoyi/ws/service/WebSocketService.java b/ruoyi-service/src/main/java/com/ruoyi/ws/service/WebSocketService.java
new file mode 100644
index 0000000..9a9df92
--- /dev/null
+++ b/ruoyi-service/src/main/java/com/ruoyi/ws/service/WebSocketService.java
@@ -0,0 +1,195 @@
+package com.ruoyi.ws.service;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import javax.websocket.Session;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.alibaba.fastjson2.JSON;
+import com.ruoyi.system.user.service.UserService;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * WebSocket工具类
+ */
+@Service
+@Slf4j
+public class WebSocketService {
+
+ @Autowired
+ private UserService userService;
+
+ // 使用ConcurrentHashMap存储会话
+ private static final Map SESSION_POOL = new ConcurrentHashMap<>();
+
+ // 创建线程池
+ private static final ExecutorService MESSAGE_EXECUTOR = Executors.newFixedThreadPool(10);
+
+ // 批处理大小
+ private static final int BATCH_SIZE = 100;
+
+ // 最大重试次数
+ private static final int MAX_RETRY = 3;
+
+ /**
+ * 添加用户WebSocket会话
+ */
+ public void addSession(Long userId, Session session) {
+ if (userId != null && session != null) {
+ SESSION_POOL.put(userId, session);
+ log.info("用户{}的WebSocket会话已添加", userId);
+ }
+ }
+
+ /**
+ * 移除用户WebSocket会话
+ */
+ public void removeSession(Long userId) {
+ if (userId != null) {
+ SESSION_POOL.remove(userId);
+ log.info("用户{}的WebSocket会话已移除", userId);
+ }
+ }
+
+ /**
+ * 获取用户WebSocket会话
+ */
+ public Session getSession(Long userId) {
+ return userId != null ? SESSION_POOL.get(userId) : null;
+ }
+
+ /**
+ * 向指定用户发送消息
+ *
+ * @param message 消息内容
+ * @param userIds 目标用户ID数组
+ */
+ public void sendMessageToUser(Object message, Long... userIds) {
+ if (message == null) {
+ return;
+ }
+ this.sendMessageToUser(message, Arrays.asList(userIds));
+ }
+
+ /**
+ * 向指定用户发送消息
+ *
+ * @param message 消息内容
+ * @param userIds 目标用户ID数组
+ */
+ public void sendMessageToUser(Object message, Collection userIds) {
+ if (message == null) {
+ return;
+ }
+
+ String msg = JSON.toJSONString(message);
+ for (Long userId : userIds) {
+ Session session = this.getSession(userId);
+ if (session != null) {
+ try {
+ if (session.isOpen()) {
+ session.getBasicRemote().sendText(msg);
+ log.info("向用户{}发送消息成功: {}", userId, msg);
+ }
+ } catch (Exception e) {
+ log.error("发送消息给用户{}失败", userId, e);
+ }
+ }
+ }
+ }
+
+ /**
+ * 向所有在线用户发送消息
+ *
+ * @param message 消息内容
+ */
+ public void sendMessageToAll(Object message) {
+ if (message == null) {
+ return;
+ }
+
+ String msg = JSON.toJSONString(message);
+
+ // 将在线用户分批处理
+ List>> batches = new ArrayList<>();
+ List> currentBatch = new ArrayList<>();
+
+ for (Map.Entry entry : SESSION_POOL.entrySet()) {
+ currentBatch.add(entry);
+ if (currentBatch.size() >= BATCH_SIZE) {
+ batches.add(new ArrayList<>(currentBatch));
+ currentBatch.clear();
+ }
+ }
+
+ if (!currentBatch.isEmpty()) {
+ batches.add(currentBatch);
+ }
+
+ // 并行处理每个批次
+ List> futures = new ArrayList<>();
+
+ for (List> batch : batches) {
+ CompletableFuture future = CompletableFuture.runAsync(() -> {
+ processBatch(batch, msg);
+ }, MESSAGE_EXECUTOR);
+
+ futures.add(future);
+ }
+
+ // 等待所有批次处理完成
+ CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
+
+ log.info("向所有在线用户发送消息完成: {}", msg);
+ }
+
+ /**
+ * 处理一个批次的消息发送
+ */
+ private void processBatch(List> batch, String msg) {
+ for (Map.Entry entry : batch) {
+ Long userId = entry.getKey();
+ Session session = entry.getValue();
+
+ if (session != null) {
+ sendMessageWithRetry(userId, session, msg, 0);
+ }
+ }
+ }
+
+ /**
+ * 带重试机制的消息发送
+ */
+ private void sendMessageWithRetry(Long userId, Session session, String msg, int retryCount) {
+ try {
+ synchronized (session) {
+ if (session.isOpen()) {
+ session.getBasicRemote().sendText(msg);
+ }
+ }
+ } catch (Exception e) {
+ if (retryCount < MAX_RETRY) {
+ log.warn("向用户{}发送消息失败,准备第{}次重试", userId, retryCount + 1);
+ try {
+ Thread.sleep(100 * (retryCount + 1)); // 递增延迟重试
+ sendMessageWithRetry(userId, session, msg, retryCount + 1);
+ } catch (InterruptedException ie) {
+ Thread.currentThread().interrupt();
+ }
+ } else {
+ log.error("向用户{}发送全局消息失败,已重试{}次", userId, MAX_RETRY, e);
+ }
+ }
+ }
+}
diff --git a/common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml b/ruoyi-service/src/main/resources/mapper/system/SysConfigMapper.xml
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml
rename to ruoyi-service/src/main/resources/mapper/system/SysConfigMapper.xml
diff --git a/common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml b/ruoyi-service/src/main/resources/mapper/system/SysDictDataMapper.xml
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml
rename to ruoyi-service/src/main/resources/mapper/system/SysDictDataMapper.xml
diff --git a/common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml b/ruoyi-service/src/main/resources/mapper/system/SysDictTypeMapper.xml
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
rename to ruoyi-service/src/main/resources/mapper/system/SysDictTypeMapper.xml
diff --git a/common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml b/ruoyi-service/src/main/resources/mapper/system/SysLogininforMapper.xml
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysLogininforMapper.xml
rename to ruoyi-service/src/main/resources/mapper/system/SysLogininforMapper.xml
diff --git a/common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml b/ruoyi-service/src/main/resources/mapper/system/SysMenuMapper.xml
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
rename to ruoyi-service/src/main/resources/mapper/system/SysMenuMapper.xml
diff --git a/common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml b/ruoyi-service/src/main/resources/mapper/system/SysNoticeMapper.xml
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml
rename to ruoyi-service/src/main/resources/mapper/system/SysNoticeMapper.xml
diff --git a/common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml b/ruoyi-service/src/main/resources/mapper/system/SysPostMapper.xml
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml
rename to ruoyi-service/src/main/resources/mapper/system/SysPostMapper.xml
diff --git a/common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml b/ruoyi-service/src/main/resources/mapper/system/SysRoleDeptMapper.xml
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml
rename to ruoyi-service/src/main/resources/mapper/system/SysRoleDeptMapper.xml
diff --git a/common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml b/ruoyi-service/src/main/resources/mapper/system/SysRoleMapper.xml
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml
rename to ruoyi-service/src/main/resources/mapper/system/SysRoleMapper.xml
diff --git a/common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml b/ruoyi-service/src/main/resources/mapper/system/SysRoleMenuMapper.xml
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml
rename to ruoyi-service/src/main/resources/mapper/system/SysRoleMenuMapper.xml
diff --git a/common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml b/ruoyi-service/src/main/resources/mapper/system/SysUserPostMapper.xml
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml
rename to ruoyi-service/src/main/resources/mapper/system/SysUserPostMapper.xml
diff --git a/common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml b/ruoyi-service/src/main/resources/mapper/system/SysUserRoleMapper.xml
similarity index 100%
rename from common-ruoyi/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml
rename to ruoyi-service/src/main/resources/mapper/system/SysUserRoleMapper.xml
diff --git a/ruoyi-web/pom.xml b/ruoyi-web/pom.xml
index 6691949..e847fbe 100644
--- a/ruoyi-web/pom.xml
+++ b/ruoyi-web/pom.xml
@@ -48,6 +48,12 @@
ruoyi-generator
+
+
+ org.springframework.boot
+ spring-boot-starter-websocket
+
+
diff --git a/ruoyi-web/src/main/java/com/ruoyi/web/app/AppMessageController.java b/ruoyi-web/src/main/java/com/ruoyi/web/app/AppMessageController.java
new file mode 100644
index 0000000..8b0dcd9
--- /dev/null
+++ b/ruoyi-web/src/main/java/com/ruoyi/web/app/AppMessageController.java
@@ -0,0 +1,53 @@
+package com.ruoyi.web.app;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.github.pagehelper.PageHelper;
+import com.ruoyi.bst.message.domain.MessageQuery;
+import com.ruoyi.bst.message.domain.MessageVO;
+import com.ruoyi.bst.message.service.MessageService;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+import io.swagger.annotations.ApiOperation;
+
+@RestController
+@RequestMapping("/app/message")
+public class AppMessageController extends BaseController {
+
+ @Autowired
+ private MessageService messageService;
+
+ @ApiOperation("获取本人接收的消息列表")
+ @GetMapping("/receiveList")
+ public TableDataInfo receiveList(MessageQuery query) {
+ startPage();
+ PageHelper.orderBy("is_read asc, create_time desc");
+ query.setUserId(getUserId());
+ List list = messageService.selectMessageList(query);
+ return getDataTable(list);
+ }
+
+ @ApiOperation("消息已读,id为空时,则将本人所有未读消息设置为已读")
+ @PostMapping("/read")
+ public AjaxResult read(@RequestParam(required = false) Long id) {
+ return success(messageService.read(getUserId(), id));
+ }
+
+ @ApiOperation("查询本人未读消息数量")
+ @GetMapping("/unreadCount")
+ public AjaxResult unreadCount() {
+ MessageQuery query = new MessageQuery();
+ query.setUserId(getUserId());
+ query.setIsRead(false);
+ return success(messageService.selectCount(query));
+ }
+}
diff --git a/ruoyi-web/src/main/java/com/ruoyi/web/bst/CustomerController.java b/ruoyi-web/src/main/java/com/ruoyi/web/bst/CustomerController.java
index 31ba847..295483d 100644
--- a/ruoyi-web/src/main/java/com/ruoyi/web/bst/CustomerController.java
+++ b/ruoyi-web/src/main/java/com/ruoyi/web/bst/CustomerController.java
@@ -23,12 +23,14 @@ import com.ruoyi.bst.customer.domain.dto.CustomerAddDTO;
import com.ruoyi.bst.customer.service.CustomerConverter;
import com.ruoyi.bst.customer.service.CustomerService;
import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.constants.RoleConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.validate.ValidGroup;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.web.service.PermissionService;
/**
* 客户Controller
@@ -46,6 +48,9 @@ public class CustomerController extends BaseController
@Autowired
private CustomerConverter customerConverter;
+ @Autowired
+ private PermissionService permissionService;
+
/**
* 查询客户列表
*/
@@ -55,7 +60,8 @@ public class CustomerController extends BaseController
{
startPage();
startOrderBy();
- List list = customerService.selectCustomerListScope(query);
+ query.setScope(true);
+ List list = customerService.selectCustomerList(query);
return getDataTable(list);
}
@@ -101,6 +107,10 @@ public class CustomerController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody @Validated(ValidGroup.Create.class) CustomerAddDTO customer)
{
+ // 若用户不是管理员,则跟进人设置为自己
+ if (!permissionService.hasRole(RoleConstants.ADMIN) && !permissionService.hasRole(RoleConstants.SYS_ADMIN)) {
+ customer.setFollowId(getUserId());
+ }
customer = customerConverter.toDTOByCreate(customer);
return toAjax(customerService.insertCustomer(customer));
}
@@ -113,6 +123,10 @@ public class CustomerController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody @Validated(ValidGroup.Update.class) Customer customer)
{
+ // 若用户不是管理员,则不允许修改跟进人
+ if (!permissionService.hasRole(RoleConstants.ADMIN) && !permissionService.hasRole(RoleConstants.SYS_ADMIN)) {
+ customer.setFollowId(null);
+ }
customer = customerConverter.toPoByUpdate(customer);
return toAjax(customerService.updateCustomer(customer));
}
diff --git a/ruoyi-web/src/main/java/com/ruoyi/web/bst/CustomerFollowController.java b/ruoyi-web/src/main/java/com/ruoyi/web/bst/CustomerFollowController.java
index 2cd07e6..b73ed6b 100644
--- a/ruoyi-web/src/main/java/com/ruoyi/web/bst/CustomerFollowController.java
+++ b/ruoyi-web/src/main/java/com/ruoyi/web/bst/CustomerFollowController.java
@@ -50,7 +50,8 @@ public class CustomerFollowController extends BaseController
{
startPage();
startOrderBy();
- List list = customerFollowService.selectCustomerFollowListScope(query);
+ query.setScope(true);
+ List list = customerFollowService.selectCustomerFollowList(query);
return getDataTable(list);
}
diff --git a/ruoyi-web/src/main/java/com/ruoyi/web/bst/MessageController.java b/ruoyi-web/src/main/java/com/ruoyi/web/bst/MessageController.java
new file mode 100644
index 0000000..c70e7c0
--- /dev/null
+++ b/ruoyi-web/src/main/java/com/ruoyi/web/bst/MessageController.java
@@ -0,0 +1,107 @@
+package com.ruoyi.web.bst;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ruoyi.bst.message.domain.MessageQuery;
+import com.ruoyi.bst.message.domain.MessageVO;
+import com.ruoyi.bst.message.service.MessageService;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+
+/**
+ * 消息Controller
+ *
+ * @author ruoyi
+ * @date 2025-02-22
+ */
+@RestController
+@RequestMapping("/bst/message")
+public class MessageController extends BaseController
+{
+ @Autowired
+ private MessageService messageService;
+
+ /**
+ * 查询消息列表
+ */
+ @PreAuthorize("@ss.hasPermi('bst:message:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(MessageQuery query)
+ {
+ startPage();
+ startOrderBy();
+ query.setScope(true);
+ List list = messageService.selectMessageList(query);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出消息列表
+ */
+ @PreAuthorize("@ss.hasPermi('bst:message:export')")
+ @Log(title = "消息", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, MessageQuery query)
+ {
+ List list = messageService.selectMessageList(query);
+ ExcelUtil util = new ExcelUtil(MessageVO.class);
+ util.exportExcel(response, list, "消息数据");
+ }
+
+ /**
+ * 获取消息详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('bst:message:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id)
+ {
+ return success(messageService.selectMessageById(id));
+ }
+
+ /**
+ * 新增消息
+ */
+ // @PreAuthorize("@ss.hasPermi('bst:message:add')")
+ // @Log(title = "消息", businessType = BusinessType.INSERT)
+ // @PostMapping
+ // public AjaxResult add(@RequestBody Message message)
+ // {
+ // return toAjax(messageService.insertMessage(message));
+ // }
+
+ // /**
+ // * 修改消息
+ // */
+ // @PreAuthorize("@ss.hasPermi('bst:message:edit')")
+ // @Log(title = "消息", businessType = BusinessType.UPDATE)
+ // @PutMapping
+ // public AjaxResult edit(@RequestBody Message message)
+ // {
+ // return toAjax(messageService.updateMessage(message));
+ // }
+
+ // /**
+ // * 删除消息
+ // */
+ // @PreAuthorize("@ss.hasPermi('bst:message:remove')")
+ // @Log(title = "消息", businessType = BusinessType.DELETE)
+ // @DeleteMapping("/{ids}")
+ // public AjaxResult remove(@PathVariable Long[] ids)
+ // {
+ // return toAjax(messageService.deleteMessageByIds(ids));
+ // }
+}
diff --git a/ruoyi-web/src/main/java/com/ruoyi/web/bst/TaskController.java b/ruoyi-web/src/main/java/com/ruoyi/web/bst/TaskController.java
index 70a8bf9..febf424 100644
--- a/ruoyi-web/src/main/java/com/ruoyi/web/bst/TaskController.java
+++ b/ruoyi-web/src/main/java/com/ruoyi/web/bst/TaskController.java
@@ -68,6 +68,8 @@ public class TaskController extends BaseController
query.setScope(true);
List list = taskService.selectTaskList(query);
taskAssembler.assembleOwnerList(list);
+ taskAssembler.assembleSubmitCount(list);
+ taskAssembler.assemblePassCount(list);
return getDataTable(list);
}
diff --git a/ruoyi-web/src/main/java/com/ruoyi/web/system/SysUserController.java b/ruoyi-web/src/main/java/com/ruoyi/web/system/SysUserController.java
index 3491f48..83630ce 100644
--- a/ruoyi-web/src/main/java/com/ruoyi/web/system/SysUserController.java
+++ b/ruoyi-web/src/main/java/com/ruoyi/web/system/SysUserController.java
@@ -64,10 +64,11 @@ public class SysUserController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/list")
- public TableDataInfo list(SysUserQuery user)
+ public TableDataInfo list(SysUserQuery query)
{
startPage();
- List list = userService.selectUserListScope(user);
+ query.setExcludeUserId(1L);
+ List list = userService.selectUserListScope(query);
return getDataTable(list);
}
@@ -97,9 +98,10 @@ public class SysUserController extends BaseController
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:user:export')")
@PostMapping("/export")
- public void export(HttpServletResponse response, SysUserQuery user)
+ public void export(HttpServletResponse response, SysUserQuery query)
{
- List list = userService.selectUserListScope(user);
+ query.setExcludeUserId(1L);
+ List list = userService.selectUserListScope(query);
ExcelUtil util = new ExcelUtil(SysUserVO.class);
util.exportExcel(response, list, "用户数据");
}
diff --git a/ruoyi-web/src/main/java/com/ruoyi/ws/MessageWebSocket.java b/ruoyi-web/src/main/java/com/ruoyi/ws/MessageWebSocket.java
new file mode 100644
index 0000000..f654310
--- /dev/null
+++ b/ruoyi-web/src/main/java/com/ruoyi/ws/MessageWebSocket.java
@@ -0,0 +1,79 @@
+package com.ruoyi.ws;
+
+import javax.websocket.CloseReason;
+import javax.websocket.EndpointConfig;
+import javax.websocket.OnClose;
+import javax.websocket.OnError;
+import javax.websocket.OnOpen;
+import javax.websocket.Session;
+import javax.websocket.server.ServerEndpoint;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.ws.config.WebSocketAuthConfigurator;
+import com.ruoyi.ws.service.WebSocketService;
+
+/**
+ * WebSocket服务类
+ */
+@ServerEndpoint(value = "/ws/message", configurator = WebSocketAuthConfigurator.class)
+@Component
+@Slf4j
+public class MessageWebSocket {
+ /**
+ * 建立连接
+ */
+ @OnOpen
+ public void onOpen(Session session, EndpointConfig config) {
+ try {
+ String token = (String) config.getUserProperties().get("token");
+ if (token != null) {
+ TokenService tokenService = SpringUtils.getBean(TokenService.class);
+ WebSocketService webSocketService = SpringUtils.getBean(WebSocketService.class);
+ LoginUser loginUser = tokenService.getLoginUser(token);
+ tokenService.verifyToken(loginUser);
+ if (loginUser != null) {
+ Long userId = loginUser.getUserId();
+ webSocketService.addSession(userId, session);
+ log.info("用户{}连接WebSocket成功", userId);
+ return;
+ }
+ }
+ session.close(new CloseReason(CloseReason.CloseCodes.VIOLATED_POLICY, "未认证"));
+ } catch (Exception e) {
+ log.error("WebSocket连接异常", e);
+ }
+ }
+
+ /**
+ * 关闭连接
+ */
+ @OnClose
+ public void onClose() {
+ try {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ if (loginUser != null) {
+ Long userId = loginUser.getUserId();
+ WebSocketService webSocketService = SpringUtils.getBean(WebSocketService.class);
+ webSocketService.removeSession(userId);
+ log.info("用户{}断开WebSocket连接", userId);
+ }
+ } catch (Exception e) {
+ log.error("WebSocket关闭异常", e);
+ }
+ }
+
+ /**
+ * 错误处理
+ */
+ @OnError
+ public void onError(Session session, Throwable error) {
+ log.error("WebSocket发生错误", error);
+ }
+}
diff --git a/ruoyi-web/src/main/java/com/ruoyi/ws/config/WebSocketAuthConfigurator.java b/ruoyi-web/src/main/java/com/ruoyi/ws/config/WebSocketAuthConfigurator.java
new file mode 100644
index 0000000..c1c7f54
--- /dev/null
+++ b/ruoyi-web/src/main/java/com/ruoyi/ws/config/WebSocketAuthConfigurator.java
@@ -0,0 +1,19 @@
+package com.ruoyi.ws.config;
+
+import javax.websocket.HandshakeResponse;
+import javax.websocket.server.HandshakeRequest;
+import javax.websocket.server.ServerEndpointConfig;
+
+/**
+ * WebSocket认证配置器
+ */
+public class WebSocketAuthConfigurator extends ServerEndpointConfig.Configurator {
+ @Override
+ public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {
+ String token = null;
+ if (!request.getParameterMap().isEmpty()) {
+ token = request.getParameterMap().get("token").get(0);
+ }
+ sec.getUserProperties().put("token", token);
+ }
+}
\ No newline at end of file
diff --git a/ruoyi-web/src/main/java/com/ruoyi/ws/config/WebSocketConfig.java b/ruoyi-web/src/main/java/com/ruoyi/ws/config/WebSocketConfig.java
new file mode 100644
index 0000000..0e6794d
--- /dev/null
+++ b/ruoyi-web/src/main/java/com/ruoyi/ws/config/WebSocketConfig.java
@@ -0,0 +1,26 @@
+package com.ruoyi.ws.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.socket.server.standard.ServerEndpointExporter;
+import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean;
+
+/**
+ * WebSocket配置类
+ */
+@Configuration
+public class WebSocketConfig {
+
+ @Bean
+ public ServerEndpointExporter serverEndpointExporter() {
+ return new ServerEndpointExporter();
+ }
+
+ @Bean
+ public ServletServerContainerFactoryBean createWebSocketContainer() {
+ ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean();
+ container.setMaxTextMessageBufferSize(8192);
+ container.setMaxBinaryMessageBufferSize(8192);
+ return container;
+ }
+}
\ No newline at end of file