forked from Gitlink/microservices
Compare commits
13 Commits
master
...
aiResource
| Author | SHA1 | Date |
|---|---|---|
|
|
57dad99399 | |
|
|
965cedc275 | |
|
|
b26825084b | |
|
|
53ff26058f | |
|
|
46b1b9ed81 | |
|
|
20bd41ebf7 | |
|
|
a416b7c856 | |
|
|
d662395f1e | |
|
|
58bdc10a4b | |
|
|
343d31024e | |
|
|
020472c4c1 | |
|
|
356ffd8915 | |
|
|
3a2560f700 |
|
|
@ -9,8 +9,6 @@ import com.microservices.system.api.factory.RemoteCmsFallbackFactory;
|
|||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户服务
|
||||
*
|
||||
|
|
@ -160,22 +158,4 @@ public interface RemoteCmsService {
|
|||
@GetMapping("/doc/getJSONObject/{cmsDocId}")
|
||||
R<JSONObject> selectCmsDocJSONObjectById(@PathVariable(value = "cmsDocId") Long cmsDocId
|
||||
, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
@PutMapping("/project/changeOrgRole/user/{userId}/operate/{operate}")
|
||||
R<Boolean> changeUserOrgRole(@PathVariable("userId") Long userId, @PathVariable("operate") int operate
|
||||
, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 首页文章合并列表(接收置顶文章 docId 有序列表,返回合并去重后的结果)
|
||||
* 供 Zone 服务 /open/getTopDoc 改造后调用
|
||||
*
|
||||
* @param zoneId 专区ID
|
||||
* @param topDocIds 置顶文章 docId 有序列表
|
||||
* @param source 来源
|
||||
* @return 合并后的首页文章 JSONObject 列表
|
||||
*/
|
||||
@PostMapping("/doc/homePageDocMergeList/{zoneId}")
|
||||
R<List<JSONObject>> selectHomePageDocMergeList(@PathVariable("zoneId") Long zoneId,
|
||||
@RequestBody List<Long> topDocIds,
|
||||
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public interface RemoteDeptService {
|
|||
* 根据组织id删除部门
|
||||
*
|
||||
* @param deptId 部门id
|
||||
* @param source 请求来源
|
||||
* @param source 请求来源
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@DeleteMapping("/dept/deleteDeptByDeptId")
|
||||
|
|
@ -105,7 +105,7 @@ public interface RemoteDeptService {
|
|||
* 通过用户名查询用户下组织及组织对应角色列表
|
||||
*
|
||||
* @param deptId 组织ID
|
||||
* @param source 请求来源
|
||||
* @param source 请求来源
|
||||
* @return 用户下组织及组织对应角色列表
|
||||
*/
|
||||
@GetMapping("/SysUserDeptRole/userByDeptId/{deptId}/list")
|
||||
|
|
@ -115,7 +115,7 @@ public interface RemoteDeptService {
|
|||
/**
|
||||
* 查询组织编号下拥有传入角色权限字符串的用户名
|
||||
*
|
||||
* @param deptId 组织编号
|
||||
* @param deptId 组织编号
|
||||
* @param roleKeys 角色权限字符串
|
||||
* @return 组织下拥有传入角色权限字符串的用户名列表
|
||||
*/
|
||||
|
|
@ -126,7 +126,7 @@ public interface RemoteDeptService {
|
|||
* 检查用户是否在指定部门下具有指定角色
|
||||
*
|
||||
* @param currentDeptId 组织编号
|
||||
* @param roleKey 角色权限字符串
|
||||
* @param roleKey 角色权限字符串
|
||||
* @return 组织下拥有传入角色权限字符串的用户名列表
|
||||
*/
|
||||
@GetMapping("/SysUserDeptRole/checkUserInDeptHasRole")
|
||||
|
|
@ -143,17 +143,6 @@ public interface RemoteDeptService {
|
|||
@GetMapping("/SysUserDeptRole/checkUserInDeptHasPerms")
|
||||
R<Boolean> checkUserInDeptHasPerms(@RequestParam("currentDeptId") Long currentDeptId, @RequestParam("userId") Long userId, @RequestParam("perms") String perms, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 检查用户是否在指定部门或指定部门的父级部门下具有指定菜单权限
|
||||
*
|
||||
* @param deptId 指定组织id
|
||||
* @param userId 用户id
|
||||
* @param perms 菜单权限
|
||||
* @return 用户是否在指定部门下具有菜单权限 是true 否false
|
||||
*/
|
||||
@GetMapping("/SysUserDeptRole/checkUserInDeptOrParentDeptHasPerms")
|
||||
R<Boolean> checkUserInDeptOrParentDeptHasPerms(@RequestParam("deptId") Long deptId, @RequestParam("userId") Long userId, @RequestParam("perms") String perms, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 检查用户是否在指定部门下
|
||||
*
|
||||
|
|
@ -163,7 +152,4 @@ public interface RemoteDeptService {
|
|||
*/
|
||||
@GetMapping("/SysUserDeptRole/checkUserInDept")
|
||||
R<Boolean> checkUserInDept(@RequestParam("currentDeptId") Long currentDeptId, @RequestParam("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
@GetMapping("/SysUserDeptRole/getSysUserDeptRoleByDeptIdAndUserId")
|
||||
R<SysUserDeptRole> getSysUserDeptRoleByDeptIdAndUserId(@RequestParam("deptId") Long deptId, @RequestParam("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,15 +57,6 @@ public interface RemoteUserService {
|
|||
@GetMapping("/user/getSysUserByUserId/{userId}")
|
||||
public R<SysUser> getSysUserByUserId(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 通过用户ID数组批量获取用户信息(POST方法,解决URL长度限制)
|
||||
*
|
||||
* @param userIds 用户ID数组
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/user/getSysUserListByUserIds")
|
||||
R<List<SysUser>> postSysUserListByUserIds(@RequestBody Long[] userIds, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 组织下新增用户身份
|
||||
|
|
@ -73,7 +64,7 @@ public interface RemoteUserService {
|
|||
* @param deptId
|
||||
* @param userId
|
||||
* @param roleKey
|
||||
* @param source 请求来源
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/SysUserDeptRole/dept/{deptId}/user/{userId}/role/{roleKey}")
|
||||
|
|
@ -83,13 +74,14 @@ public interface RemoteUserService {
|
|||
, @PathVariable("roleKey") String roleKey
|
||||
, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
|
||||
/**
|
||||
* 组织下删除用户身份
|
||||
*
|
||||
* @param deptId
|
||||
* @param userId
|
||||
* @param roleKey
|
||||
* @param source 请求来源
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@DeleteMapping("/SysUserDeptRole/dept/{deptId}/user/{userId}/role/{roleKey}")
|
||||
|
|
@ -99,16 +91,18 @@ public interface RemoteUserService {
|
|||
@PathVariable("roleKey") String roleKey,
|
||||
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
*
|
||||
* @param sysUser 用户信息
|
||||
* @param source 请求来源
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/user/register")
|
||||
public R<Boolean> registerUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
|
||||
/**
|
||||
* 通过GitLinkToken获取本系统Token
|
||||
*
|
||||
|
|
@ -129,6 +123,7 @@ public interface RemoteUserService {
|
|||
@GetMapping("/SysUserDeptRole/userByUserName/{userName}/list")
|
||||
public R<List<SysUserDeptRole>> getSysUserDeptRoleListByUserName(@PathVariable("userName") String userName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户下第一个身份
|
||||
*
|
||||
|
|
@ -200,7 +195,7 @@ public interface RemoteUserService {
|
|||
/**
|
||||
* 通过GitLink用户Id创建用户
|
||||
*
|
||||
* @param gitLinkUserId GitLinkUserId
|
||||
* @param gitLinkUserId GitLink用户Id
|
||||
* @param source 请求来源
|
||||
* @return 系统用户
|
||||
*/
|
||||
|
|
@ -211,7 +206,7 @@ public interface RemoteUserService {
|
|||
* 根据角色Key获取菜单权限集合
|
||||
*
|
||||
* @param roleKey 角色Key
|
||||
* @param source 请求来源
|
||||
* @param source 请求来源
|
||||
* @return 菜单权限集合
|
||||
*/
|
||||
@GetMapping("/menu/roleMenuPermissionByRoleKey/{roleKey}")
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@ import lombok.Data;
|
|||
@Data
|
||||
public class SysFile
|
||||
{
|
||||
/**
|
||||
* 文件标识
|
||||
*/
|
||||
private Long fileId;
|
||||
/**
|
||||
* 文件标识
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 内容管理服务降级处理
|
||||
*
|
||||
|
|
@ -85,16 +83,6 @@ public class RemoteCmsFallbackFactory implements FallbackFactory<RemoteCmsServic
|
|||
public R<JSONObject> selectCmsDocJSONObjectById(Long cmsDocId, String source) {
|
||||
return R.fail("获取文章JSON对象失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Boolean> changeUserOrgRole(Long userId, int operate, String source) {
|
||||
return R.fail("更新组织权限失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<List<JSONObject>> selectHomePageDocMergeList(Long zoneId, List<Long> topDocIds, String source) {
|
||||
return R.fail("获取首页文章合并列表失败:" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,20 +83,10 @@ public class RemoteDeptFallbackFactory implements FallbackFactory<RemoteDeptServ
|
|||
return R.fail("检查用户是否在指定部门下具有指定菜单权限失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Boolean> checkUserInDeptOrParentDeptHasPerms(Long deptId, Long userId, String perms, String source) {
|
||||
return R.fail("检查用户是否在指定部门或指定部门的父级部门下具有指定菜单权限失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Boolean> checkUserInDept(Long currentDeptId, Long userId, String source) {
|
||||
return R.fail("检查用户是否在指定部门下失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<SysUserDeptRole> getSysUserDeptRoleByDeptIdAndUserId(Long deptId, Long userId, String source) {
|
||||
return R.fail("获取用户在指定部门下的角色失败:" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,12 +52,6 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
|||
return R.fail("获取用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<List<SysUser>> postSysUserListByUserIds(Long[] userIds, String source) {
|
||||
|
||||
return R.fail("批量获取用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Boolean> addUserIdentify(Long deptId, Long userId, String roleKey, String source) {
|
||||
return R.fail("组织下新增用户身份失败:" + throwable.getMessage());
|
||||
|
|
|
|||
|
|
@ -80,10 +80,6 @@ public class CacheConstants {
|
|||
* 通过组织Id获取专区详情JSON对象
|
||||
*/
|
||||
public final static String ZONE_JSON_OF_DEPT_ID_KEY = "zoneJSONOfDeptId:";
|
||||
/**
|
||||
* 积分发放部门
|
||||
*/
|
||||
public final static String ZONE_POINTS_DEPT_ID_KEY = "zonePointsDeptId";
|
||||
/**
|
||||
* 内容管理同步缓存前缀
|
||||
*/
|
||||
|
|
@ -249,18 +245,6 @@ public class CacheConstants {
|
|||
return ZONE_PROJECT_SORT_BY_SCORE + "*:" + zoneId + ":*";
|
||||
}
|
||||
|
||||
/**
|
||||
* 专区统计数据缓存前缀
|
||||
*/
|
||||
private final static String ZONE_STATISTICS_KEY = "zone:statistics:";
|
||||
|
||||
/**
|
||||
* 获取专区统计数据缓存key
|
||||
*/
|
||||
public static String getZoneStatisticsKey(Long zoneId) {
|
||||
return ZONE_STATISTICS_KEY + zoneId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件打包是否完成(0:代表未完成;1:代表已完成;-1:代表打包失败,需要重新打包)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ package com.microservices.common.core.constant;
|
|||
*
|
||||
* @author microservices
|
||||
*/
|
||||
public class UserConstants {
|
||||
public class UserConstants
|
||||
{
|
||||
/**
|
||||
* 平台内系统用户的唯一标志
|
||||
*/
|
||||
|
|
@ -27,89 +28,55 @@ public class UserConstants {
|
|||
*/
|
||||
public static final String DEL_FLAG_FALSE = "0";
|
||||
|
||||
/**
|
||||
* 正常状态
|
||||
*/
|
||||
/** 正常状态 */
|
||||
public static final String NORMAL = "0";
|
||||
|
||||
/**
|
||||
* 异常状态
|
||||
*/
|
||||
/** 异常状态 */
|
||||
public static final String EXCEPTION = "1";
|
||||
|
||||
/**
|
||||
* 用户封禁状态
|
||||
*/
|
||||
/** 用户封禁状态 */
|
||||
public static final String USER_DISABLE = "1";
|
||||
|
||||
/**
|
||||
* 角色封禁状态
|
||||
*/
|
||||
/** 角色封禁状态 */
|
||||
public static final String ROLE_DISABLE = "1";
|
||||
|
||||
/**
|
||||
* 部门正常状态
|
||||
*/
|
||||
/** 部门正常状态 */
|
||||
public static final String DEPT_NORMAL = "0";
|
||||
|
||||
/**
|
||||
* 部门停用状态
|
||||
*/
|
||||
/** 部门停用状态 */
|
||||
public static final String DEPT_DISABLE = "1";
|
||||
|
||||
/**
|
||||
* 字典正常状态
|
||||
*/
|
||||
/** 字典正常状态 */
|
||||
public static final String DICT_NORMAL = "0";
|
||||
|
||||
/**
|
||||
* 是否为系统默认(是)
|
||||
*/
|
||||
/** 是否为系统默认(是) */
|
||||
public static final String YES = "Y";
|
||||
|
||||
/**
|
||||
* 是否菜单外链(是)
|
||||
*/
|
||||
/** 是否菜单外链(是) */
|
||||
public static final String YES_FRAME = "0";
|
||||
|
||||
/**
|
||||
* 是否菜单外链(否)
|
||||
*/
|
||||
/** 是否菜单外链(否) */
|
||||
public static final String NO_FRAME = "1";
|
||||
|
||||
/**
|
||||
* 菜单类型(目录)
|
||||
*/
|
||||
/** 菜单类型(目录) */
|
||||
public static final String TYPE_DIR = "M";
|
||||
|
||||
/**
|
||||
* 菜单类型(菜单)
|
||||
*/
|
||||
/** 菜单类型(菜单) */
|
||||
public static final String TYPE_MENU = "C";
|
||||
|
||||
/**
|
||||
* 菜单类型(按钮)
|
||||
*/
|
||||
/** 菜单类型(按钮) */
|
||||
public static final String TYPE_BUTTON = "F";
|
||||
|
||||
/**
|
||||
* Layout组件标识
|
||||
*/
|
||||
/** Layout组件标识 */
|
||||
public final static String LAYOUT = "Layout";
|
||||
|
||||
/**
|
||||
* ParentView组件标识
|
||||
*/
|
||||
/** ParentView组件标识 */
|
||||
public final static String PARENT_VIEW = "ParentView";
|
||||
|
||||
/**
|
||||
* InnerLink组件标识
|
||||
*/
|
||||
/** InnerLink组件标识 */
|
||||
public final static String INNER_LINK = "InnerLink";
|
||||
|
||||
/**
|
||||
* 校验是否唯一的返回标识
|
||||
*/
|
||||
/** 校验是否唯一的返回标识 */
|
||||
public final static boolean UNIQUE = true;
|
||||
public final static boolean NOT_UNIQUE = false;
|
||||
|
||||
|
|
@ -155,28 +122,4 @@ public class UserConstants {
|
|||
* 项目管理-知识库管理权限
|
||||
*/
|
||||
public static final String PMS_PERMS_DOCS_MANAGE = "pms:docs:manage";
|
||||
/**
|
||||
* 文章管理-文章删除权限
|
||||
*/
|
||||
public static final String CMS_PERMS_DOCS_DELETE = "cms:doc:remove";
|
||||
/**
|
||||
* 文章管理-新增文章权限
|
||||
*/
|
||||
public static final String CMS_PERMS_DOCS_ADD = "cms:doc:add";
|
||||
/**
|
||||
* 文章管理-编辑文章权限
|
||||
*/
|
||||
public static final String CMS_PERMS_DOCS_EDIT = "cms:doc:edit";
|
||||
/**
|
||||
* 文章管理-审核文章权限
|
||||
*/
|
||||
public static final String CMS_PERMS_DOCS_AUDIT = "cms:doc:audit";
|
||||
/**
|
||||
* 专区管理-审核项目权限
|
||||
*/
|
||||
public static final String ZONE_PERMS_PROJECT_AUDIT = "zone:project:audit";
|
||||
/**
|
||||
* 专区管理-审核资源权限
|
||||
*/
|
||||
public static final String ZONE_PERMS_RESOURCE_AUDIT = "zone:resource:audit";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ package com.microservices.common.core.enums;
|
|||
public enum DocAndZoneOperation
|
||||
{
|
||||
OPERATION_CREATE("创建", "create"), OPERATION_UPDATE("更新", "update"),
|
||||
OPERATION_DELETE("删除", "delete"), OPERATION_NON_REPO_UPDATE("非仓库更新", "nonRepoUpdate");
|
||||
OPERATION_DELETE("删除", "delete");
|
||||
|
||||
private final String operationName;
|
||||
private final String operationCode;
|
||||
|
|
|
|||
|
|
@ -211,17 +211,6 @@ public class HttpAPIService {
|
|||
return doRequest(httpDelete, headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 不带Header的get请求
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public JSONObject doGet(String url) throws Exception {
|
||||
return doGet(url, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 带Header的get请求
|
||||
*
|
||||
|
|
|
|||
|
|
@ -115,7 +115,8 @@ public class AuthLogic {
|
|||
* @param permission 权限字符串
|
||||
* @return 用户是否具备某权限
|
||||
*/
|
||||
public boolean hasPermi(String permission) {
|
||||
public boolean hasPermi(String permission)
|
||||
{
|
||||
return hasPermi(tokenService.getMenuPermissions(), permission);
|
||||
}
|
||||
|
||||
|
|
@ -125,8 +126,10 @@ public class AuthLogic {
|
|||
* @param permission 权限字符串
|
||||
* @return 用户是否具备某权限
|
||||
*/
|
||||
public void checkPermi(String permission) {
|
||||
if (!hasPermi(tokenService.getMenuPermissions(), permission)) {
|
||||
public void checkPermi(String permission)
|
||||
{
|
||||
if (!hasPermi(tokenService.getMenuPermissions(), permission))
|
||||
{
|
||||
throw new NotPermissionException(permission);
|
||||
}
|
||||
}
|
||||
|
|
@ -150,10 +153,13 @@ public class AuthLogic {
|
|||
*
|
||||
* @param permissions 权限列表
|
||||
*/
|
||||
public void checkPermiAnd(String... permissions) {
|
||||
public void checkPermiAnd(String... permissions)
|
||||
{
|
||||
Set<String> permissionList = tokenService.getMenuPermissions();
|
||||
for (String permission : permissions) {
|
||||
if (!hasPermi(permissionList, permission)) {
|
||||
for (String permission : permissions)
|
||||
{
|
||||
if (!hasPermi(permissionList, permission))
|
||||
{
|
||||
throw new NotPermissionException(permission);
|
||||
}
|
||||
}
|
||||
|
|
@ -164,10 +170,13 @@ public class AuthLogic {
|
|||
*
|
||||
* @param permissions 权限码数组
|
||||
*/
|
||||
public void checkPermiOr(String... permissions) {
|
||||
public void checkPermiOr(String... permissions)
|
||||
{
|
||||
Set<String> permissionList = tokenService.getMenuPermissions();
|
||||
for (String permission : permissions) {
|
||||
if (hasPermi(permissionList, permission)) {
|
||||
for (String permission : permissions)
|
||||
{
|
||||
if (hasPermi(permissionList, permission))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -182,7 +191,8 @@ public class AuthLogic {
|
|||
* @param role 角色标识
|
||||
* @return 用户是否具备某角色
|
||||
*/
|
||||
public boolean hasRole(String role) {
|
||||
public boolean hasRole(String role)
|
||||
{
|
||||
return hasRole(tokenService.getRolePermissions(), role);
|
||||
}
|
||||
|
||||
|
|
@ -215,10 +225,13 @@ public class AuthLogic {
|
|||
*
|
||||
* @param roles 角色标识数组
|
||||
*/
|
||||
public void checkRoleAnd(String... roles) {
|
||||
public void checkRoleAnd(String... roles)
|
||||
{
|
||||
Set<String> roleList = tokenService.getRolePermissions();
|
||||
for (String role : roles) {
|
||||
if (!hasRole(roleList, role)) {
|
||||
for (String role : roles)
|
||||
{
|
||||
if (!hasRole(roleList, role))
|
||||
{
|
||||
throw new NotRoleException(role);
|
||||
}
|
||||
}
|
||||
|
|
@ -229,14 +242,18 @@ public class AuthLogic {
|
|||
*
|
||||
* @param roles 角色标识数组
|
||||
*/
|
||||
public void checkRoleOr(String... roles) {
|
||||
public void checkRoleOr(String... roles)
|
||||
{
|
||||
Set<String> roleList = tokenService.getRolePermissions();
|
||||
for (String role : roles) {
|
||||
if (hasRole(roleList, role)) {
|
||||
for (String role : roles)
|
||||
{
|
||||
if (hasRole(roleList, role))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (roles.length > 0) {
|
||||
if (roles.length > 0)
|
||||
{
|
||||
throw new NotRoleException(roles);
|
||||
}
|
||||
}
|
||||
|
|
@ -306,9 +323,6 @@ public class AuthLogic {
|
|||
public boolean hasUserIdentity(Long deptId, String roleKey) {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
List<SysUserDeptRole> sysUserDeptRoleList = tokenService.getAllUserIdentity(loginUser.getUsername());
|
||||
if (sysUserDeptRoleList == null) {
|
||||
return false;
|
||||
}
|
||||
return sysUserDeptRoleList.stream()
|
||||
.anyMatch(x -> {
|
||||
if (x.getDeptId() != null && x.getSysRole() != null && x.getDeptId().equals(deptId)) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.microservices.common.security.feign;
|
|||
import feign.RequestInterceptor;
|
||||
import feign.codec.Encoder;
|
||||
import feign.form.FormEncoder;
|
||||
import feign.form.spring.SpringFormEncoder;
|
||||
import org.springframework.beans.factory.ObjectFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
||||
|
|
@ -33,6 +34,6 @@ public class FeignAutoConfiguration
|
|||
// 重要的是返回类型要是 Encoder 并且实现类必须是 FormEncoder 或者其子类
|
||||
@Bean
|
||||
public Encoder feignFormEncoder() {
|
||||
return new FormEncoder(new SpringEncoder(messageConverters));
|
||||
return new SpringFormEncoder(new SpringEncoder(messageConverters));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import com.microservices.common.core.utils.uuid.IdUtils;
|
|||
import com.microservices.common.redis.service.RedisService;
|
||||
import com.microservices.common.security.interceptor.HeaderInterceptor;
|
||||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.system.api.RemoteDeptService;
|
||||
import com.microservices.system.api.RemoteUserService;
|
||||
import com.microservices.system.api.domain.SysRole;
|
||||
import com.microservices.system.api.domain.SysUser;
|
||||
|
|
@ -39,8 +38,6 @@ public class TokenService {
|
|||
private RedisService redisService;
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
@Autowired
|
||||
private RemoteDeptService remoteDeptService;
|
||||
|
||||
protected static final long MILLIS_SECOND = 1000;
|
||||
|
||||
|
|
@ -332,16 +329,4 @@ public class TokenService {
|
|||
}
|
||||
return loginUser.getSysUser();
|
||||
}
|
||||
|
||||
public Boolean hasDeptPerms(Long deptId, String perms) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Boolean hasPerms = FeignUtils.getReturnData(
|
||||
remoteDeptService.checkUserInDeptOrParentDeptHasPerms(deptId, loginUser.getUserId(), perms, SecurityConstants.INNER)
|
||||
);
|
||||
|
||||
if (hasPerms == null) {
|
||||
hasPerms = false;
|
||||
}
|
||||
return hasPerms;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,6 @@ package com.microservices.cms.doc.controller;
|
|||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.cms.doc.domain.*;
|
||||
import com.microservices.cms.doc.service.ICmsDocService;
|
||||
import com.microservices.common.core.constant.UserConstants;
|
||||
import com.microservices.common.core.domain.R;
|
||||
import com.microservices.common.core.web.controller.BaseController;
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
|
|
@ -18,7 +17,6 @@ import io.swagger.annotations.*;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -108,13 +106,23 @@ public class CmsDocController extends BaseController {
|
|||
@ApiImplicitParam(name = "pageNum", value = "当前记录起始索引", paramType = "query", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示记录数", paramType = "query", dataType = "Integer"),
|
||||
})
|
||||
public GenericsTableDataInfo<CmsDocAllDto> docListByZone(
|
||||
public TableDataInfo docListByZone(
|
||||
@ApiParam(name = "zoneId", value = "专区Id") @PathVariable("zoneId") Long zoneId
|
||||
, CmsDocSearchVo cmsDocSearchVo) {
|
||||
Long deptId = cmsDocService.getDeptIdByZoneId(zoneId);
|
||||
cmsDocSearchVo.setIsOpen(true);
|
||||
cmsDocSearchVo.setIsOpen(false);
|
||||
startPage();
|
||||
return cmsDocService.selectAllDocList(deptId, cmsDocSearchVo);
|
||||
List<CmsDocAllDto> list = cmsDocService.selectCmsDocListByDept(deptId, cmsDocSearchVo);
|
||||
list.forEach(x -> {
|
||||
String docDetailUrl = cmsDocService.getDocDetailUrl(x.getDeptId(), x.getId());
|
||||
x.setDocDetailUrl(docDetailUrl);
|
||||
|
||||
Boolean editable = cmsDocService.isCmsDocEditable(x);
|
||||
x.setEditable(editable);
|
||||
|
||||
});
|
||||
int count = cmsDocService.selectCmsDocCountByDept(deptId, cmsDocSearchVo);
|
||||
return getDataTable(list, count);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -156,7 +164,7 @@ public class CmsDocController extends BaseController {
|
|||
/**
|
||||
* 新增文章信息
|
||||
*/
|
||||
@RequiresPermissions(UserConstants.CMS_PERMS_DOCS_ADD)
|
||||
@RequiresPermissions("cms:doc:add")
|
||||
@Log(title = "文章信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/dir/{dirId}")
|
||||
@ApiOperation("在栏目下创建文章")
|
||||
|
|
@ -193,7 +201,7 @@ public class CmsDocController extends BaseController {
|
|||
/**
|
||||
* 删除文章
|
||||
*/
|
||||
@RequiresPermissions(UserConstants.CMS_PERMS_DOCS_DELETE)
|
||||
@RequiresPermissions("cms:doc:remove")
|
||||
@Log(title = "文章信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除文章/栏目")
|
||||
|
|
@ -204,13 +212,13 @@ public class CmsDocController extends BaseController {
|
|||
/**
|
||||
* 修改文章信息
|
||||
*/
|
||||
@RequiresPermissions(UserConstants.CMS_PERMS_DOCS_EDIT)
|
||||
@RequiresPermissions("cms:doc:edit")
|
||||
@Log(title = "文章信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation("更新文章")
|
||||
public AjaxResult edit(@ApiParam(name = "id", value = "文章Id") @PathVariable Long id,
|
||||
@ApiParam(name = "cmsDoc", value = "文章实体对象") @RequestBody CmsDocDto cmsDocDto) {
|
||||
return success(cmsDocService.updateCmsDoc(id, cmsDocDto));
|
||||
return toAjax(cmsDocService.updateCmsDoc(id, cmsDocDto));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -229,12 +237,12 @@ public class CmsDocController extends BaseController {
|
|||
/**
|
||||
* 审核文章信息
|
||||
*/
|
||||
@RequiresPermissions(UserConstants.CMS_PERMS_DOCS_AUDIT)
|
||||
@RequiresPermissions("cms:doc:audit")
|
||||
@Log(title = "文章信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{id}/audit")
|
||||
@ApiOperation("审核文章")
|
||||
public AjaxResult audit(@ApiParam(name = "id", value = "文章Id") @PathVariable Long id,
|
||||
@ApiParam(name = "cmsDocAuditVo", value = "文章审核对象") @RequestBody CmsDocAuditVo cmsDocAuditVo) {
|
||||
@ApiParam(name = "cmsDocAuditVo", value = "文章审核对象") @RequestBody CmsDocAuditVo cmsDocAuditVo) {
|
||||
return toAjax(cmsDocService.auditCmsDoc(id, cmsDocAuditVo));
|
||||
}
|
||||
|
||||
|
|
@ -307,24 +315,6 @@ public class CmsDocController extends BaseController {
|
|||
return R.ok(cmsDocJSONObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 内部接口:首页文章合并列表(接收置顶文章 docId 有序列表,返回合并去重后的结果)
|
||||
* 供 Zone 服务 Feign 调用,用于 /open/getTopDoc 改造
|
||||
*/
|
||||
@InnerAuth
|
||||
@PostMapping("/homePageDocMergeList/{zoneId}")
|
||||
@ApiOperation(value = "首页文章合并列表", hidden = true)
|
||||
public R<List<JSONObject>> selectHomePageDocMergeList(
|
||||
@PathVariable("zoneId") Long zoneId,
|
||||
@RequestBody List<Long> topDocIds) {
|
||||
List<CmsDocBaseDto> list = cmsDocService.selectHomePageDocMergeList(zoneId, topDocIds);
|
||||
List<JSONObject> result = new ArrayList<>();
|
||||
for (CmsDocBaseDto dto : list) {
|
||||
result.add(JSONObject.from(dto));
|
||||
}
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过组织Id获取专区下文章阅读数量
|
||||
*
|
||||
|
|
|
|||
|
|
@ -5,17 +5,12 @@ import com.microservices.cms.doc.domain.*;
|
|||
import com.microservices.cms.doc.service.ICmsDocCommentService;
|
||||
import com.microservices.cms.doc.service.ICmsDocService;
|
||||
import com.microservices.cms.doc.service.ICmsWechatService;
|
||||
import com.microservices.cms.search.dto.DocSearchResult;
|
||||
import com.microservices.common.core.web.controller.BaseController;
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
import com.microservices.common.core.web.domain.GenericsAjaxResult;
|
||||
import com.microservices.common.core.web.page.GenericsTableDataInfo;
|
||||
import com.microservices.common.core.web.page.TableDataInfo;
|
||||
import com.microservices.common.log.annotation.Log;
|
||||
import com.microservices.common.log.enums.BusinessType;
|
||||
import com.microservices.cms.search.dto.DocSearchRequest;
|
||||
import com.microservices.cms.search.dto.DocSearchResponse;
|
||||
import com.microservices.cms.search.service.IGlobalSearchService;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -40,22 +35,6 @@ public class OpenController extends BaseController {
|
|||
@Autowired
|
||||
private ICmsWechatService cmsWechatService;
|
||||
|
||||
@Autowired
|
||||
private IGlobalSearchService globalSearchService;
|
||||
|
||||
/**
|
||||
* 文章搜索接口
|
||||
*
|
||||
* @return 搜索结果
|
||||
*/
|
||||
@ApiOperation("文章搜索")
|
||||
@PostMapping("/search")
|
||||
public GenericsTableDataInfo<DocSearchResult> docSearch(@RequestBody DocSearchRequest docSearchRequest) {
|
||||
logger.info("文章搜索请求: keyword={}", docSearchRequest.getKeyword());
|
||||
DocSearchResponse response = globalSearchService.docSearch(docSearchRequest);
|
||||
return new GenericsTableDataInfo<>(response.getResults(), response.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询栏目列表
|
||||
*/
|
||||
|
|
@ -121,19 +100,6 @@ public class OpenController extends BaseController {
|
|||
return getAllGenericsDataTableToPage(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文章列表(不区分栏目)
|
||||
*/
|
||||
@GetMapping("/zone/{zoneId}/allDocList")
|
||||
@ApiOperation("查询文章列表(不区分栏目)")
|
||||
public GenericsTableDataInfo<CmsDocAllDto> allDocList(@ApiParam(name = "zoneId", value = "专区Id") @PathVariable("zoneId") Long zoneId,
|
||||
CmsDocSearchVo cmsDocSearchVo) {
|
||||
Long deptId = cmsDocService.getDeptIdByZoneId(zoneId);
|
||||
cmsDocSearchVo.setIsOpen(true);
|
||||
startPage();
|
||||
return cmsDocService.selectAllDocList(deptId, cmsDocSearchVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询首页文章列表
|
||||
*/
|
||||
|
|
@ -209,9 +175,9 @@ public class OpenController extends BaseController {
|
|||
@Log(title = "同步文章数据", businessType = BusinessType.UPDATE)
|
||||
public AjaxResult syncDocData(
|
||||
@ApiParam(name = "deptId", value = "组织Id", required = true) @PathVariable("deptId") Long deptId
|
||||
, @RequestBody() String bodyStr
|
||||
,@RequestBody() String bodyStr
|
||||
, HttpServletRequest request) {
|
||||
cmsDocService.syncDocData(deptId, bodyStr);
|
||||
cmsDocService.syncDocData(deptId,bodyStr);
|
||||
return AjaxResult.success("同步消息发送成功");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package com.microservices.cms.doc.domain;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.microservices.cms.utils.CmsConstants;
|
||||
import com.microservices.common.core.annotation.Excel;
|
||||
import com.microservices.common.core.utils.bean.BeanUtils;
|
||||
import com.microservices.common.core.web.domain.BaseSortEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
|
@ -37,27 +36,19 @@ public class CmsDoc extends BaseSortEntity {
|
|||
@Excel(name = "文件名称")
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
/** 文件路径 */
|
||||
@Excel(name = "文件路径")
|
||||
private String filePath;
|
||||
|
||||
/**
|
||||
* 文件SHA
|
||||
*/
|
||||
/** 文件SHA */
|
||||
@Excel(name = "文件SHA")
|
||||
private String fileSha;
|
||||
|
||||
/**
|
||||
* 文件大小
|
||||
*/
|
||||
/** 文件大小 */
|
||||
@Excel(name = "文件大小")
|
||||
private Long fileSize;
|
||||
|
||||
/**
|
||||
* 文件URL
|
||||
*/
|
||||
/** 文件URL */
|
||||
@Excel(name = "文件URL")
|
||||
private String fileUrl;
|
||||
|
||||
|
|
@ -171,11 +162,6 @@ public class CmsDoc extends BaseSortEntity {
|
|||
*/
|
||||
private String keywords;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
public CmsDir copyToCmsDir() {
|
||||
CmsDir cmsDir = new CmsDir();
|
||||
cmsDir.setId(id);
|
||||
|
|
@ -224,12 +210,30 @@ public class CmsDoc extends BaseSortEntity {
|
|||
}
|
||||
|
||||
private CmsDocBaseDto getCmsDocBaseDto(CmsDocBaseDto cmsDocDto) {
|
||||
BeanUtils.copyProperties(this, cmsDocDto);
|
||||
cmsDocDto.setId(id);
|
||||
cmsDocDto.setName(name);
|
||||
cmsDocDto.setHeadImg(headImg);
|
||||
cmsDocDto.setIsHomepage(isHomepage);
|
||||
cmsDocDto.setSummary(summary);
|
||||
cmsDocDto.setEditorType(editorType);
|
||||
cmsDocDto.setDeptId(deptId);
|
||||
|
||||
if (visits == null) {
|
||||
cmsDocDto.setVisits(0L);
|
||||
} else {
|
||||
cmsDocDto.setVisits(visits);
|
||||
}
|
||||
|
||||
cmsDocDto.setPublishTime(publishTime);
|
||||
cmsDocDto.setPublishUser(publishUser);
|
||||
cmsDocDto.setPublishUserUrl(publishUserUrl);
|
||||
cmsDocDto.setPublishUserImage(publishUserImage);
|
||||
cmsDocDto.setPublishUserNickname(publishUserNickname);
|
||||
cmsDocDto.setAuditStatus(auditStatus);
|
||||
cmsDocDto.setAuditType(auditType);
|
||||
cmsDocDto.setCreateBy(createBy);
|
||||
cmsDocDto.setKeywords(keywords);
|
||||
|
||||
return cmsDocDto;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,10 +20,4 @@ public class CmsDocAuditVo {
|
|||
*/
|
||||
@ApiModelProperty(value = "是否重新编辑: 0不允许重新编辑 1允许重新编辑")
|
||||
private Integer reedit;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "审核备注")
|
||||
private String remark;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,10 +101,6 @@ public class CmsDocBaseDto {
|
|||
*/
|
||||
@ApiModelProperty("关键词")
|
||||
private String keywords;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
public void setPublishTime(Date publishTime) {
|
||||
if (publishTime != null) {
|
||||
|
|
|
|||
|
|
@ -83,10 +83,4 @@ public class CmsDocSearchVo {
|
|||
*/
|
||||
@ApiModelProperty("关键词")
|
||||
private String keywords;
|
||||
|
||||
/**
|
||||
* 排除文章Id
|
||||
*/
|
||||
@ApiModelProperty(value = "排除文章Id", hidden = true)
|
||||
private Long excludeId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
package com.microservices.cms.doc.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* CmsDoc with full-text search score
|
||||
* 用于全局搜索结果,包含全文搜索相关度评分
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CmsDocWithScore extends CmsDoc implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 全文搜索相关度评分(来自 MySQL MATCH...AGAINST)
|
||||
*/
|
||||
private Double searchScore;
|
||||
}
|
||||
|
|
@ -2,7 +2,6 @@ package com.microservices.cms.doc.mapper;
|
|||
|
||||
import com.microservices.cms.doc.domain.CmsDoc;
|
||||
import com.microservices.cms.doc.domain.CmsDocSearchVo;
|
||||
import com.microservices.cms.doc.domain.CmsDocWithScore;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
|
@ -24,14 +23,6 @@ public interface CmsDocMapper {
|
|||
*/
|
||||
public CmsDoc selectCmsDocById(Long id);
|
||||
|
||||
/**
|
||||
* 批量查询文章信息
|
||||
*
|
||||
* @param ids 文章ID列表
|
||||
* @return 文章信息列表
|
||||
*/
|
||||
List<CmsDoc> selectCmsDocByIds(@Param("ids") List<Long> ids);
|
||||
|
||||
/**
|
||||
* 查询文章信息列表
|
||||
*
|
||||
|
|
@ -91,11 +82,6 @@ public interface CmsDocMapper {
|
|||
|
||||
CmsDoc selectCmsDocByFilePathAndDeptId(@Param("filePath") String filePath, @Param("deptId") Long deptId);
|
||||
|
||||
/**
|
||||
* 按文章名+deptId查询(忽略dirName),用于Webhook防重判断
|
||||
*/
|
||||
CmsDoc selectCmsDocByNameAndDeptIdIgnoreDirName(@Param("name") String name, @Param("deptId") Long deptId);
|
||||
|
||||
List<CmsDoc> selectHotCmsDocList(CmsDoc cmsDocInput);
|
||||
|
||||
List<CmsDoc> selectCmsDocDirByDeptIdAndInName(@Param("deptId") Long deptId, @Param("cmsDirNameList") List<String> cmsDirNameList);
|
||||
|
|
@ -206,41 +192,4 @@ public interface CmsDocMapper {
|
|||
List<CmsDoc> selectCmsDocAndDirListByDept(Long deptId);
|
||||
|
||||
void updateCmsDocShaByPathAndDeptId(@Param("sha") String sha, @Param("filePath") String filePath, @Param("deptId") Long deptId);
|
||||
|
||||
/**
|
||||
* 全局搜索 - 全文索引查询
|
||||
*
|
||||
* @param keyword 搜索关键词
|
||||
* @param deptId 组织ID(可选)
|
||||
* @param offset 偏移量
|
||||
* @param pageSize 每页数量
|
||||
* @return 搜索结果列表
|
||||
*/
|
||||
List<CmsDoc> globalSearch(@Param("keyword") String keyword, @Param("deptId") Long deptId,
|
||||
@Param("offset") int offset, @Param("pageSize") int pageSize);
|
||||
|
||||
/**
|
||||
* 全局搜索结果计数
|
||||
*
|
||||
* @param keyword 搜索关键词
|
||||
* @param deptId 组织ID(可选)
|
||||
* @return 结果数量
|
||||
*/
|
||||
Long globalSearchCount(@Param("keyword") String keyword, @Param("deptId") Long deptId);
|
||||
|
||||
/**
|
||||
* 全局搜索 - 全文索引查询(含评分)
|
||||
*
|
||||
* @param keyword 搜索关键词
|
||||
* @param deptId 组织ID(可选)
|
||||
* @param offset 偏移量
|
||||
* @param pageSize 每页数量
|
||||
* @return 搜索结果列表(含评分)
|
||||
*/
|
||||
List<CmsDocWithScore> globalSearchWithScore(
|
||||
@Param("keyword") String keyword,
|
||||
@Param("deptId") Long deptId,
|
||||
@Param("offset") int offset,
|
||||
@Param("pageSize") int pageSize
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,38 +99,4 @@ public interface ICmsAsyncService {
|
|||
* @param cmsDoc 文章
|
||||
*/
|
||||
void pushDocDataSearchEngine(CmsDoc cmsDoc);
|
||||
|
||||
void clearTmpDoc(CmsProject cmsProject,List<CmsDoc> tmpDocList);
|
||||
|
||||
/**
|
||||
* 异步增加文章发布积分
|
||||
*
|
||||
* @param deptId 组织ID
|
||||
* @param createBy 创建人用户名
|
||||
* @param docId 文章ID
|
||||
* @param subjectDesc 文章标题
|
||||
*/
|
||||
void addPublishDocPointsAsync(Long deptId, String createBy, Long docId, String subjectDesc);
|
||||
|
||||
/**
|
||||
* 异步增加文章浏览积分(每满100次+2,上限50)
|
||||
*
|
||||
* @param deptId 组织ID
|
||||
* @param createBy 创建人用户名
|
||||
* @param docId 文章ID
|
||||
* @param docName 文章名称
|
||||
* @param totalVisits 累计阅读次数
|
||||
* @param pointsTriggerCount 当前第几次增加积分
|
||||
*/
|
||||
void addVisitsDocPointsAsync(Long deptId, String createBy, Long docId, String docName, Long totalVisits);
|
||||
|
||||
/**
|
||||
* 异步增加文章被设为精选的积分
|
||||
*
|
||||
* @param deptId 组织ID
|
||||
* @param createBy 创建人用户名
|
||||
* @param docId 文章ID
|
||||
* @param subjectDesc 文章标题
|
||||
*/
|
||||
void addFeaturedDocPointsAsync(Long deptId, String createBy, Long docId, String subjectDesc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import com.microservices.cms.doc.domain.*;
|
|||
import com.microservices.cms.doc.domain.gitlink.EntryDto;
|
||||
import com.microservices.cms.doc.domain.gitlink.FileEntryDto;
|
||||
import com.microservices.cms.project.domain.CmsProject;
|
||||
import com.microservices.common.core.web.page.GenericsTableDataInfo;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
|
@ -57,9 +56,9 @@ public interface ICmsDocService {
|
|||
*
|
||||
* @param id
|
||||
* @param cmsDocDto 文章信息
|
||||
* @return 结果 文章id
|
||||
* @return 结果
|
||||
*/
|
||||
public Long updateCmsDoc(Long id, CmsDocDto cmsDocDto);
|
||||
public boolean updateCmsDoc(Long id, CmsDocDto cmsDocDto);
|
||||
|
||||
/**
|
||||
* 批量删除文章信息
|
||||
|
|
@ -145,15 +144,6 @@ public interface ICmsDocService {
|
|||
*/
|
||||
List<CmsDocBaseDto> selectHomePageDocList(Long deptId);
|
||||
|
||||
/**
|
||||
* 查询首页文章合并列表(积分置顶文章 + 首页推荐文章,自动去重,置顶在前)
|
||||
*
|
||||
* @param zoneId 专区ID
|
||||
* @param topDocIds 置顶文章 docId 有序列表(前端按此顺序排列)
|
||||
* @return 合并后的首页文章列表(isTop=true 标识置顶文章)
|
||||
*/
|
||||
List<CmsDocBaseDto> selectHomePageDocMergeList(Long zoneId, List<Long> topDocIds);
|
||||
|
||||
/**
|
||||
* 初始化栏目
|
||||
*
|
||||
|
|
@ -208,8 +198,6 @@ public interface ICmsDocService {
|
|||
*/
|
||||
List<CmsDocAllDto> selectCmsDocListByDept(Long deptId, CmsDocSearchVo cmsDocSearchVo);
|
||||
|
||||
GenericsTableDataInfo<CmsDocAllDto> selectAllDocList(Long deptId, CmsDocSearchVo cmsDocSearchVo);
|
||||
|
||||
/**
|
||||
* 查询专区下文章数量
|
||||
*
|
||||
|
|
@ -306,6 +294,4 @@ public interface ICmsDocService {
|
|||
List<CmsDoc> selectCmsDocAndDirListByDept(Long deptId);
|
||||
|
||||
void updateCmsDocShaByPathAndDeptId(String sha, String filePath, Long deptId);
|
||||
|
||||
List<CmsDoc> getTmpDocList(CmsDoc cmsDoc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ import com.microservices.cms.utils.CustomExecutorFactory;
|
|||
import com.microservices.common.core.constant.CacheConstants;
|
||||
import com.microservices.common.core.constant.Constants;
|
||||
import com.microservices.common.core.constant.SecurityConstants;
|
||||
import com.microservices.common.core.enums.DocAndZoneOperation;
|
||||
import com.microservices.common.core.enums.DocAuditStatus;
|
||||
import com.microservices.common.core.enums.SystemRole;
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import com.microservices.common.core.utils.DateUtils;
|
||||
|
|
@ -35,7 +33,6 @@ import com.microservices.common.httpClient.util.GitLinkRequestHelper;
|
|||
import com.microservices.common.redis.service.RedisService;
|
||||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.system.api.RemoteDeptService;
|
||||
import com.microservices.system.api.RemoteUserService;
|
||||
import com.microservices.system.api.RemoteZoneService;
|
||||
import com.microservices.system.api.utils.FeignUtils;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
|
|
@ -98,8 +95,6 @@ public class CmsAsyncServiceImpl implements ICmsAsyncService {
|
|||
@Autowired
|
||||
private RemoteZoneService remoteZoneService;
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
@Autowired
|
||||
private RequestConfig config;
|
||||
|
||||
/**
|
||||
|
|
@ -256,16 +251,7 @@ public class CmsAsyncServiceImpl implements ICmsAsyncService {
|
|||
}
|
||||
CmsDoc cmsDoc = cmsDocMapper.selectCmsDocByNameAndDeptId(CmsUtils.getFileNameNoSuffix(entry.getName()), cmsProject.getDeptId(), dirName);
|
||||
if (cmsDoc == null) {
|
||||
// 防重:按文章名+deptId查一次,排除正在移动栏目的已有记录
|
||||
String docName = CmsUtils.getFileNameNoSuffix(entry.getName());
|
||||
CmsDoc existingDoc = cmsDocMapper.selectCmsDocByNameAndDeptIdIgnoreDirName(docName, cmsProject.getDeptId());
|
||||
if (existingDoc != null) {
|
||||
existingDoc.setDirName(dirName);
|
||||
existingDoc.setFilePath(dirName + "/" + existingDoc.getFileName());
|
||||
cmsDocMapper.updateCmsDoc(existingDoc);
|
||||
} else {
|
||||
syncCreateDoc(entry, dirName, cmsProject.getDeptId(), fileEntry.getLast_commit());
|
||||
}
|
||||
syncCreateDoc(entry, dirName, cmsProject.getDeptId(), fileEntry.getLast_commit());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
@ -632,12 +618,11 @@ public class CmsAsyncServiceImpl implements ICmsAsyncService {
|
|||
100, "..."), tmpBranchName);
|
||||
} catch (ServiceException e) {
|
||||
//忽略重复创建PR异常
|
||||
if (!e.getMessage().contains("合并请求已存在")) {
|
||||
if (!"请求GitLink失败(合并请求已存在)".equals(e.getMessage())) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cmsDocService.updateCmsCommonDatabase(cmsDoc, tmpBranchName);
|
||||
}
|
||||
|
||||
|
|
@ -738,8 +723,8 @@ public class CmsAsyncServiceImpl implements ICmsAsyncService {
|
|||
|
||||
if (isChangeName || isChangeDir) {
|
||||
oldCmsDoc = renameAndChangeDirCmsDoc(oldCmsDoc, cmsProject, newName, newDirName, branchName);
|
||||
// 立即更新数据库中的dirName/filePath,避免GitLink Webhook回调时查不到记录导致重复INSERT
|
||||
cmsDocMapper.updateCmsDoc(oldCmsDoc);
|
||||
//todo 此处是否需要更新数据库待讨论
|
||||
//updateCmsCommonDatabase(oldCmsDoc);
|
||||
}
|
||||
|
||||
boolean isChangeContent = false;
|
||||
|
|
@ -1018,23 +1003,6 @@ public class CmsAsyncServiceImpl implements ICmsAsyncService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearTmpDoc(CmsProject cmsProject, List<CmsDoc> tmpDocList) {
|
||||
CustomExecutorFactory.threadPoolExecutor.execute(() -> {
|
||||
for (CmsDoc tmpDoc : tmpDocList) {
|
||||
//拒绝GitLink合并请求
|
||||
String gitLinkPullRequestNumber = tmpDoc.getAuditPrNumber().split("-")[0];
|
||||
gitLinkRequestHelper.doPost(
|
||||
CmsGitLinkRequestUrl.REFUSE_MERGE_PULL_REQUEST(cmsProject, gitLinkPullRequestNumber), null);
|
||||
gitLinkRequestHelper.doPost(CmsGitLinkRequestUrl.DELETE_BRANCH(cmsProject, tmpDoc.getAuditTmpBranchName()), null);
|
||||
// 所有删除操作调整为将审核状态设置为已拒绝
|
||||
tmpDoc.setAuditStatus(DocAuditStatus.AUDIT_FAIL.getAuditCode());
|
||||
tmpDoc.setRemark("管理员删除");
|
||||
cmsDocMapper.updateCmsDoc(tmpDoc);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void moveCmsDocToNewCmsDir(CmsProject cmsProject, String oldDirName, String newDirName, String message) {
|
||||
CmsDocSearchVo cmsDocSearch = new CmsDocSearchVo();
|
||||
cmsDocSearch.setIsDir(false);
|
||||
|
|
@ -1087,127 +1055,4 @@ public class CmsAsyncServiceImpl implements ICmsAsyncService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否为积分部门
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 是否为积分部门
|
||||
*/
|
||||
private boolean isPointsDept(Long deptId) {
|
||||
Long cachedPointsDeptId = redisService.getCacheObject(CacheConstants.ZONE_POINTS_DEPT_ID_KEY);
|
||||
return cachedPointsDeptId != null && cachedPointsDeptId > 0 && cachedPointsDeptId.equals(deptId);
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void addPublishDocPointsAsync(Long deptId, String createBy, Long docId, String subjectDesc) {
|
||||
try {
|
||||
if (deptId == null || createBy == null) {
|
||||
logger.warn("文章审核通过增加积分失败,deptId或createBy为空,docId={}", docId);
|
||||
return;
|
||||
}
|
||||
// 检查是否为积分部门
|
||||
if (!isPointsDept(deptId)) {
|
||||
logger.info("文章审核通过增加积分跳过,非积分部门,deptId={},docId={}", deptId, docId);
|
||||
return;
|
||||
}
|
||||
// 获取用户ID
|
||||
com.microservices.system.api.domain.SysUser sysUser = FeignUtils.getReturnData(
|
||||
remoteUserService.getSysUserByUserName(createBy, SecurityConstants.INNER));
|
||||
if (sysUser == null || sysUser.getUserId() == null) {
|
||||
logger.warn("文章审核通过增加积分失败,未找到用户信息,createBy={},docId={}", createBy, docId);
|
||||
return;
|
||||
}
|
||||
|
||||
// 直接写入 Redis 积分队列,由 Zone 模块定时任务消费
|
||||
JSONObject task = new JSONObject();
|
||||
task.put("sourceType", CmsConstants.PUBLISH_DOC);
|
||||
task.put("userId", sysUser.getUserId());
|
||||
task.put("deptId", deptId);
|
||||
task.put("sourceId", docId);
|
||||
task.put("subjectDesc", subjectDesc);
|
||||
task.put("operatorId", sysUser.getUserId());
|
||||
redisService.leftPush(CmsConstants.ZONE_POINTS_ASYNC_QUEUE_KEY, task.toJSONString());
|
||||
logger.info("文章审核通过增加积分任务已写入队列,docId={},userId={},deptId={}", docId, sysUser.getUserId(), deptId);
|
||||
} catch (Exception e) {
|
||||
// 捕获异常,确保不影响主事务
|
||||
logger.error("文章审核通过增加积分异常,docId={}", docId, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void addVisitsDocPointsAsync(Long deptId, String createBy, Long docId, String docName, Long totalVisits) {
|
||||
try {
|
||||
if (deptId == null || createBy == null) {
|
||||
logger.warn("文章浏览增加积分失败,参数不合法,deptId={},createBy={}", deptId, createBy);
|
||||
return;
|
||||
}
|
||||
// 检查是否为积分部门
|
||||
if (!isPointsDept(deptId)) {
|
||||
logger.info("文章浏览增加积分跳过,非积分部门,deptId={},docId={}", deptId, docId);
|
||||
return;
|
||||
}
|
||||
// 获取用户ID
|
||||
com.microservices.system.api.domain.SysUser sysUser = FeignUtils.getReturnData(
|
||||
remoteUserService.getSysUserByUserName(createBy, SecurityConstants.INNER));
|
||||
if (sysUser == null || sysUser.getUserId() == null) {
|
||||
logger.warn("文章浏览增加积分失败,未找到用户信息,createBy={},docId={}", createBy, docId);
|
||||
return;
|
||||
}
|
||||
// 直接写入 Redis 积分队列,由 Zone 模块定时任务消费
|
||||
JSONObject task = new JSONObject();
|
||||
task.put("sourceType", CmsConstants.VISITS_DOC);
|
||||
task.put("userId", sysUser.getUserId());
|
||||
task.put("deptId", deptId);
|
||||
task.put("sourceId", docId);
|
||||
// JSONObject sourceData = new JSONObject();
|
||||
// sourceData.put("totalVisits", totalVisits);
|
||||
// sourceData.put("currentIncrement", pointsTriggerCount);
|
||||
task.put("sourceData", totalVisits);
|
||||
task.put("subjectDesc", docName);
|
||||
task.put("operatorId", SecurityUtils.getUserId());
|
||||
redisService.leftPush(CmsConstants.ZONE_POINTS_ASYNC_QUEUE_KEY, task.toJSONString());
|
||||
logger.info("文章浏览增加积分任务已写入队列,docId={},userId={},deptId={},totalVisits={}", docId, sysUser.getUserId(), deptId, totalVisits);
|
||||
} catch (Exception e) {
|
||||
// 捕获异常,确保不影响主事务
|
||||
logger.error("文章浏览增加积分异常,docId={}", docId, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void addFeaturedDocPointsAsync(Long deptId, String createBy, Long docId, String subjectDesc) {
|
||||
try {
|
||||
if (deptId == null || createBy == null) {
|
||||
logger.warn("积分-文章精选:参数不合法,deptId={},createBy={}", deptId, createBy);
|
||||
return;
|
||||
}
|
||||
// 检查是否为积分部门
|
||||
if (!isPointsDept(deptId)) {
|
||||
logger.info("积分-文章精选:非积分部门,deptId={},docId={}", deptId, docId);
|
||||
return;
|
||||
}
|
||||
// 获取用户ID
|
||||
com.microservices.system.api.domain.SysUser sysUser = FeignUtils.getReturnData(
|
||||
remoteUserService.getSysUserByUserName(createBy, SecurityConstants.INNER));
|
||||
if (sysUser == null || sysUser.getUserId() == null) {
|
||||
logger.warn("积分-文章精选:未找到用户信息,createBy={},docId={}", createBy, docId);
|
||||
return;
|
||||
}
|
||||
// 直接写入 Redis 积分队列,由 Zone 模块定时任务消费
|
||||
JSONObject task = new JSONObject();
|
||||
task.put("sourceType", CmsConstants.FEATURED_DOC);
|
||||
task.put("userId", sysUser.getUserId());
|
||||
task.put("deptId", deptId);
|
||||
task.put("sourceId", docId);
|
||||
task.put("subjectDesc", "《" + subjectDesc + "》管理员标记");
|
||||
task.put("operatorId", SecurityUtils.getUserId());
|
||||
redisService.leftPush(CmsConstants.ZONE_POINTS_ASYNC_QUEUE_KEY, task.toJSONString());
|
||||
logger.info("文章被设为精选增加积分任务已写入队列,docId={},userId={},deptId={}", docId, sysUser.getUserId(), deptId);
|
||||
} catch (Exception e) {
|
||||
// 捕获异常,确保不影响主事务
|
||||
logger.error("文章被设为精选增加积分异常,docId={}", docId, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import com.microservices.cms.utils.CmsGitLinkRequestUrl;
|
|||
import com.microservices.common.core.constant.CacheConstants;
|
||||
import com.microservices.common.core.constant.HttpStatus;
|
||||
import com.microservices.common.core.constant.SecurityConstants;
|
||||
import com.microservices.common.core.constant.UserConstants;
|
||||
import com.microservices.common.core.enums.DocAndZoneOperation;
|
||||
import com.microservices.common.core.enums.DocAuditStatus;
|
||||
import com.microservices.common.core.enums.SystemRole;
|
||||
|
|
@ -24,12 +23,10 @@ import com.microservices.common.core.utils.DateUtils;
|
|||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.common.core.utils.bean.BeanUtils;
|
||||
import com.microservices.common.core.utils.html.EscapeUtil;
|
||||
import com.microservices.common.core.web.page.GenericsTableDataInfo;
|
||||
import com.microservices.common.httpClient.constant.GitLinkConstants;
|
||||
import com.microservices.common.httpClient.util.GitLinkRequestHelper;
|
||||
import com.microservices.common.redis.service.RedisService;
|
||||
import com.microservices.common.security.auth.AuthUtil;
|
||||
import com.microservices.common.security.service.TokenService;
|
||||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.system.api.RemoteDeptService;
|
||||
import com.microservices.system.api.RemoteUserService;
|
||||
|
|
@ -50,11 +47,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import java.security.MessageDigest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -86,8 +79,6 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
@Autowired
|
||||
private RemoteDeptService remoteDeptService;
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private ICmsDocCommentService cmsDocCommentService;
|
||||
@Value("${cms.detailPath:/newdetail}")
|
||||
|
|
@ -97,7 +88,7 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
* 查询文章信息
|
||||
*
|
||||
* @param id 文章信息主键
|
||||
* @param isOpen 是否公开访问
|
||||
* @param isOpen
|
||||
* @return 文章信息
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -112,14 +103,7 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
|
||||
CmsProject cmsProject = cmsProjectService.selectCmsProjectByDeptId(cmsDoc.getDeptId());
|
||||
|
||||
// 确定查询文件的分支:已发布文章或非仓库改动使用 master,其他使用临时分支
|
||||
String branchName;
|
||||
if (DocAuditStatus.AUDIT_PASS.getAuditCode().equals(cmsDoc.getAuditStatus())
|
||||
|| (cmsDoc.getAuditType() != null && cmsDoc.getAuditType().contains(DocAndZoneOperation.OPERATION_NON_REPO_UPDATE.getOperationCode()))) {
|
||||
branchName = CmsConstants.BRANCH_MASTER;
|
||||
} else {
|
||||
branchName = cmsDoc.getAuditTmpBranchName();
|
||||
}
|
||||
String branchName = DocAuditStatus.AUDIT_PASS.getAuditCode().equals(cmsDoc.getAuditStatus()) ? CmsConstants.BRANCH_MASTER : cmsDoc.getAuditTmpBranchName();
|
||||
FileEntryDto fileEntryDto = getFileEntryDto(cmsProject, cmsDoc.getFilePath(), branchName);
|
||||
EntryDto entryDto = fileEntryDto.getEntries();
|
||||
|
||||
|
|
@ -130,7 +114,7 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
if (cmsDoc.getPublishTime() != null && cmsDoc.getPublishTime().after(cmsDoc.getCreateTime())) {
|
||||
cmsDocDto.setIsFirstPublish(false);
|
||||
}
|
||||
if (isOpen && DocAuditStatus.AUDIT_PASS.getAuditCode().equals(cmsDoc.getAuditStatus())) {
|
||||
if (isOpen) {
|
||||
updateVisits(cmsDocDto.getId());
|
||||
}
|
||||
return cmsDocDto;
|
||||
|
|
@ -186,21 +170,6 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
return cmsDocList.stream().map(CmsDoc::copyToCmsDocAllDto).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public GenericsTableDataInfo<CmsDocAllDto> selectAllDocList(Long deptId, CmsDocSearchVo cmsDocSearchVo) {
|
||||
List<CmsDocAllDto> list = selectCmsDocListByDept(deptId, cmsDocSearchVo);
|
||||
list.forEach(x -> {
|
||||
String docDetailUrl = getDocDetailUrl(x.getDeptId(), x.getId());
|
||||
x.setDocDetailUrl(docDetailUrl);
|
||||
|
||||
Boolean editable = isCmsDocEditable(x);
|
||||
x.setEditable(editable);
|
||||
|
||||
});
|
||||
int count = selectCmsDocCountByDept(deptId, cmsDocSearchVo);
|
||||
return new GenericsTableDataInfo<>(list, Long.valueOf(count));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selectCmsDocCountByDept(Long deptId, CmsDocSearchVo cmsDocSearchVo) {
|
||||
cmsDocSearchVo.setDeptId(deptId);
|
||||
|
|
@ -263,14 +232,14 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
@Override
|
||||
public List<CmsDocDetailDto> selectCmsDocDetailList(Long dirId) {
|
||||
List<CmsDocDetailDto> cmsDocDetailDtoList = new ArrayList<>();
|
||||
CmsDoc cmsDir = selectCmsDir(dirId);
|
||||
CmsDoc cmsDir = cmsDocMapper.selectCmsDocDirById(dirId);
|
||||
CmsProject cmsProject = cmsProjectService.selectCmsProjectByDeptId(cmsDir.getDeptId());
|
||||
CmsDocSearchVo cmsDocSearchVo = new CmsDocSearchVo();
|
||||
cmsDocSearchVo.setDirName(cmsDir.getName());
|
||||
cmsDocSearchVo.setDeptId(cmsDir.getDeptId());
|
||||
cmsDocSearchVo.setIsDir(false);
|
||||
List<CmsDoc> cmsDocList = cmsDocMapper.selectCmsDocListSetDefaultHeadImg(cmsDocSearchVo);
|
||||
List<CompletableFuture<CmsDocDetailDto>> futures = new ArrayList<>();
|
||||
List<CompletableFuture<CmsDocDetailDto>> futures = new ArrayList();
|
||||
for (CmsDoc cmsDoc : cmsDocList) {
|
||||
CompletableFuture<CmsDocDetailDto> future = CompletableFuture.supplyAsync(() -> {
|
||||
CmsDocDetailDto cmsDocDetailDto = cmsDoc.copyToCmsDocDetailDto();
|
||||
|
|
@ -327,7 +296,7 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
|
||||
@Override
|
||||
public void updateCmsDocShaByPathAndDeptId(String sha, String filePath, Long deptId) {
|
||||
cmsDocMapper.updateCmsDocShaByPathAndDeptId(sha, filePath, deptId);
|
||||
cmsDocMapper.updateCmsDocShaByPathAndDeptId(sha,filePath,deptId);
|
||||
}
|
||||
|
||||
private List<CmsDocBaseDto> selectCmsDocListByDatabase(Long dirId, CmsDocSearchVo cmsDocSearchVo) {
|
||||
|
|
@ -344,8 +313,7 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
|
||||
/**
|
||||
* 设置文章默认头图为栏目头图
|
||||
*
|
||||
* @param dirId 栏目id
|
||||
* @param dirId 栏目id
|
||||
* @param cmsDocSearchVo 文章查询条件
|
||||
* @return 文章列表
|
||||
*/
|
||||
|
|
@ -390,16 +358,12 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
checkCmsLockStatus(dirDoc.getDeptId());
|
||||
CmsDoc cmsDoc = cmsDocInputDto.toCmsDoc(dirDoc);
|
||||
|
||||
if (isNoAuditRequired(dirDoc.getDeptId()) || tokenService.hasDeptPerms(dirDoc.getDeptId(), UserConstants.CMS_PERMS_DOCS_AUDIT)) {
|
||||
if (isNoAuditRequired(dirDoc.getDeptId()) || isCurrentUserZoneAdmin(dirDoc.getDeptId())) {
|
||||
//文章自动置为审核通过状态值
|
||||
cmsDoc.setAuditStatus(DocAuditStatus.AUDIT_PASS.getAuditCode());
|
||||
boolean success = insertCommonCmsDoc(cmsDoc,
|
||||
"创建文章:" + StringUtils.truncateStringAndConcatenatingSpecifiedString(cmsDoc.getName(), 100, "..."),
|
||||
cmsDocInputDto.getContent());
|
||||
if (success) {
|
||||
// 自动审核通过时也需要增加积分
|
||||
cmsAsyncService.addPublishDocPointsAsync(cmsDoc.getDeptId(), cmsDoc.getCreateBy(), cmsDoc.getId(), cmsDoc.getName());
|
||||
}
|
||||
return success ? cmsDoc.getId().intValue() : null;
|
||||
} else {
|
||||
//创建临时分支,创建文件,创建PR
|
||||
|
|
@ -437,9 +401,7 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
public String getCmsDocFileContent(CmsProject cmsProject, CmsDoc cmsDoc) {
|
||||
String branchName = CmsConstants.BRANCH_MASTER;
|
||||
if (!DocAuditStatus.AUDIT_PASS.getAuditCode().equals(cmsDoc.getAuditStatus())) {
|
||||
if (StringUtils.isNotEmpty(cmsDoc.getAuditTmpBranchName())) {
|
||||
branchName = cmsDoc.getAuditTmpBranchName();
|
||||
}
|
||||
branchName = cmsDoc.getAuditTmpBranchName();
|
||||
}
|
||||
//当删除文章为文件夹时,判断该文件夹下是否存在文章,若存在需先删除所有文章
|
||||
JSONObject getSubEntriesResult = gitLinkRequestHelper.doGet(
|
||||
|
|
@ -459,34 +421,9 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean auditCmsDoc(Long docId, CmsDocAuditVo cmsDocAuditVo) {
|
||||
CmsDoc cmsDoc = cmsDocMapper.selectCmsDocById(docId);
|
||||
if (cmsDoc == null) {
|
||||
throw new ServiceException("该文章不存在");
|
||||
}
|
||||
checkCmsLockStatus(cmsDoc.getDeptId());
|
||||
CmsProject cmsProject = cmsProjectService.selectCmsProjectByDeptId(cmsDoc.getDeptId());
|
||||
|
||||
// 设置审核备注
|
||||
cmsDoc.setRemark(cmsDocAuditVo.getRemark());
|
||||
|
||||
if (cmsDocAuditVo.getPass() == 1) {
|
||||
// 处理非仓库改动的审核通过
|
||||
if (cmsDoc.getAuditType() != null
|
||||
&& cmsDoc.getAuditType().contains(DocAndZoneOperation.OPERATION_NON_REPO_UPDATE.getOperationCode())) {
|
||||
Long oldCmsDocId = Long.parseLong(cmsDoc.getAuditType().split("-")[1]);
|
||||
CmsDoc oldCmsDoc = cmsDocMapper.selectCmsDocById(oldCmsDocId);
|
||||
|
||||
// 用新文章的非仓库字段更新旧文章
|
||||
oldCmsDoc.setHeadImg(cmsDoc.getHeadImg());
|
||||
oldCmsDoc.setSummary(cmsDoc.getSummary());
|
||||
oldCmsDoc.setKeywords(cmsDoc.getKeywords());
|
||||
oldCmsDoc.setRemark(cmsDoc.getRemark());
|
||||
cmsDocMapper.updateCmsDoc(oldCmsDoc);
|
||||
|
||||
// 删除待审核记录
|
||||
cmsDocMapper.deleteCmsDocById(cmsDoc.getId());
|
||||
return true;
|
||||
}
|
||||
|
||||
//同意合并请求
|
||||
JSONObject result = mergePullRequestByGitLink(cmsProject, cmsDoc);
|
||||
if (result.containsKey(GitLinkConstants.STATUS_KEY)) {
|
||||
|
|
@ -508,16 +445,8 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
}
|
||||
}
|
||||
if (cmsDocAuditVo.getPass() == 0) {
|
||||
// 处理非仓库改动的审核拒绝
|
||||
if (cmsDoc.getAuditType().contains(DocAndZoneOperation.OPERATION_NON_REPO_UPDATE.getOperationCode())) {
|
||||
handleCmsDocWithNoPassByReedit(cmsDocAuditVo, cmsDoc, cmsProject);
|
||||
return true;
|
||||
}
|
||||
|
||||
//拒绝GitLink合并请求
|
||||
String gitLinkPullRequestNumber = cmsDoc.getAuditPrNumber().split("-")[0];
|
||||
JSONObject result = gitLinkRequestHelper.doPost(
|
||||
CmsGitLinkRequestUrl.REFUSE_MERGE_PULL_REQUEST(cmsProject, gitLinkPullRequestNumber), null);
|
||||
JSONObject result = refuseMergePullRequestByGitLink(cmsDoc, cmsProject);
|
||||
if (result.containsKey(GitLinkConstants.STATUS_KEY)) {
|
||||
//2.若拒绝GitLink合并请求操作返回正确的状态值,更新数据库
|
||||
if (result.getInteger(GitLinkConstants.STATUS_KEY).equals(1)) {
|
||||
|
|
@ -564,10 +493,8 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
if (cmsDocAuditVo.getReedit().equals(0)) {
|
||||
//删除待审核文章
|
||||
cmsDocMapper.deleteCmsDocById(cmsDoc.getId());
|
||||
// 删除分支(如果有)
|
||||
if (StringUtils.isNotEmpty(cmsDoc.getAuditTmpBranchName())) {
|
||||
gitLinkRequestHelper.doPost(CmsGitLinkRequestUrl.DELETE_BRANCH(cmsProject, cmsDoc.getAuditTmpBranchName()), null);
|
||||
}
|
||||
//删除分支
|
||||
gitLinkRequestHelper.doDelete(CmsGitLinkRequestUrl.DELETE_BRANCH(cmsProject, cmsDoc.getAuditTmpBranchName()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -579,7 +506,7 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
int success = deleteCmsDocDatabaseById(ids);
|
||||
if (success == ids.length) {
|
||||
//删除临时分支
|
||||
gitLinkRequestHelper.doPost(CmsGitLinkRequestUrl.DELETE_BRANCH(cmsProject, cmsDoc.getAuditTmpBranchName()), null);
|
||||
gitLinkRequestHelper.doDelete(CmsGitLinkRequestUrl.DELETE_BRANCH(cmsProject, cmsDoc.getAuditTmpBranchName()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -599,7 +526,7 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
int success = cmsDocMapper.deleteCmsDocById(newDocId);
|
||||
if (success > 0) {
|
||||
//删除临时分支
|
||||
gitLinkRequestHelper.doPost(CmsGitLinkRequestUrl.DELETE_BRANCH(cmsProject, cmsDoc.getAuditTmpBranchName()), null);
|
||||
gitLinkRequestHelper.doDelete(CmsGitLinkRequestUrl.DELETE_BRANCH(cmsProject, cmsDoc.getAuditTmpBranchName()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -613,13 +540,11 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
int success = cmsDocMapper.updateCmsDoc(cmsDoc);
|
||||
if (success > 0) {
|
||||
//删除临时分支
|
||||
gitLinkRequestHelper.doPost(CmsGitLinkRequestUrl.DELETE_BRANCH(cmsProject, cmsDoc.getAuditTmpBranchName()), null);
|
||||
gitLinkRequestHelper.doDelete(CmsGitLinkRequestUrl.DELETE_BRANCH(cmsProject, cmsDoc.getAuditTmpBranchName()));
|
||||
}
|
||||
|
||||
// 推送文章地址到搜索引擎
|
||||
cmsAsyncService.pushDocDataSearchEngine(cmsDoc);
|
||||
// 文章审核通过后,给作者增加积分(异步执行,不影响主事务)
|
||||
cmsAsyncService.addPublishDocPointsAsync(cmsDoc.getDeptId(), cmsDoc.getCreateBy(), cmsDoc.getId(), cmsDoc.getName());
|
||||
}
|
||||
|
||||
private JSONObject mergePullRequestByGitLink(CmsProject cmsProject, CmsDoc cmsDoc) {
|
||||
|
|
@ -634,6 +559,12 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
CmsGitLinkRequestUrl.MERGE_PULL_REQUEST(cmsProject, gitLinkPullRequestId), requestBody);
|
||||
}
|
||||
|
||||
private JSONObject refuseMergePullRequestByGitLink(CmsDoc cmsDoc, CmsProject cmsProject) {
|
||||
//1.调用gitlink拒绝合并请求接口
|
||||
return gitLinkRequestHelper.doPost(
|
||||
CmsGitLinkRequestUrl.REFUSE_MERGE_PULL_REQUEST(cmsProject, cmsDoc.getAuditPrNumber()), null);
|
||||
}
|
||||
|
||||
public static String sha1(String data) {
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance("SHA1");
|
||||
|
|
@ -775,47 +706,11 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long updateCmsDoc(Long id, CmsDocDto cmsDocDto) {
|
||||
public boolean updateCmsDoc(Long id, CmsDocDto cmsDocDto) {
|
||||
CmsDoc oldCmsDoc = cmsDocMapper.selectCmsDocById(id);
|
||||
checkCmsLockStatus(oldCmsDoc.getDeptId());
|
||||
if (!hasRepoRelatedChanged(oldCmsDoc, cmsDocDto)) {
|
||||
// 更新非仓库字段到原文章对象
|
||||
if (StringUtils.isNotEmpty(cmsDocDto.getHeadImg())) {
|
||||
oldCmsDoc.setHeadImg(cmsDocDto.getHeadImg());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(cmsDocDto.getSummary())) {
|
||||
oldCmsDoc.setSummary(cmsDocDto.getSummary());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(cmsDocDto.getKeywords())) {
|
||||
oldCmsDoc.setKeywords(cmsDocDto.getKeywords());
|
||||
}
|
||||
|
||||
// 管理员或免审核:直接更新原记录
|
||||
if (tokenService.hasDeptPerms(oldCmsDoc.getDeptId(), UserConstants.CMS_PERMS_DOCS_AUDIT)
|
||||
|| isNoAuditRequired(oldCmsDoc.getDeptId())) {
|
||||
cmsDocMapper.updateCmsDoc(oldCmsDoc);
|
||||
return oldCmsDoc.getId();
|
||||
}
|
||||
|
||||
// 需要审核:创建新的待审核记录(与仓库改动逻辑一致)
|
||||
if (oldCmsDoc.getAuditStatus().equals(DocAuditStatus.AUDIT_PASS.getAuditCode())) {
|
||||
CmsDoc newDocWithAudit = insertDocWithAudit(oldCmsDoc,
|
||||
DocAndZoneOperation.OPERATION_NON_REPO_UPDATE.getOperationCode() + "-" + oldCmsDoc.getId(),
|
||||
DocAuditStatus.TO_BE_AUDIT.getAuditCode());
|
||||
return newDocWithAudit.getId();
|
||||
}
|
||||
oldCmsDoc.setAuditStatus(DocAuditStatus.TO_BE_AUDIT.getAuditCode());
|
||||
if (oldCmsDoc.getAuditType().contains(DocAndZoneOperation.OPERATION_CREATE.getOperationCode())
|
||||
|| oldCmsDoc.getAuditType().contains(DocAndZoneOperation.OPERATION_UPDATE.getOperationCode())) {
|
||||
CmsProject cmsProject = cmsProjectService.selectCmsProjectByDeptId(oldCmsDoc.getDeptId());
|
||||
// 重新开启PR
|
||||
String gitLinkPullRequestNumber = oldCmsDoc.getAuditPrNumber().split("-")[0];
|
||||
gitLinkRequestHelper.doPost(CmsGitLinkRequestUrl.REOPEN_PULL_REQUEST(cmsProject, gitLinkPullRequestNumber), null);
|
||||
}
|
||||
// 待审核/未通过文章重新编辑
|
||||
cmsDocMapper.updateCmsDoc(oldCmsDoc);
|
||||
return oldCmsDoc.getId();
|
||||
return cmsDocMapper.updateCmsDoc(oldCmsDoc) > 0;
|
||||
}
|
||||
// 当文章名称发生更改时,判断文章名是否在当前栏目下已存在
|
||||
if (StringUtils.isNotEmpty(cmsDocDto.getName()) && !cmsDocDto.getName().equals(oldCmsDoc.getName())) {
|
||||
|
|
@ -830,14 +725,14 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
}
|
||||
|
||||
// 当用户更新栏目时,需检查新栏目下是否已存在相同文章名
|
||||
if (cmsDocDto.getDirId() != null) {
|
||||
if(cmsDocDto.getDirId()!=null){
|
||||
CmsDir cmsDir = selectCmsDirById(cmsDocDto.getDirId(), false);
|
||||
if (cmsDir != null && !cmsDir.getName().equals(oldCmsDoc.getDirName())) {
|
||||
if(cmsDir!=null&&!cmsDir.getName().equals(oldCmsDoc.getDirName())){
|
||||
checkDocName(cmsDocDto.getName(), oldCmsDoc.getDeptId(), cmsDir.getName());
|
||||
}
|
||||
}
|
||||
//用户为专区管理员或专区无审核机制时,直接更新文章及仓库主分支
|
||||
if (tokenService.hasDeptPerms(oldCmsDoc.getDeptId(), UserConstants.CMS_PERMS_DOCS_AUDIT) || isNoAuditRequired(oldCmsDoc.getDeptId())) {
|
||||
if (isCurrentUserZoneAdmin(oldCmsDoc.getDeptId()) || isNoAuditRequired(oldCmsDoc.getDeptId())) {
|
||||
//专区管理员重新编辑并提交审核未通过文章 或 重新编辑并提交待审核文章时专区不需审核机制
|
||||
if (!oldCmsDoc.getAuditStatus().equals(DocAuditStatus.AUDIT_PASS.getAuditCode())) {
|
||||
//文章审核类型:update-原文章id 取出原文章id直接更新,删除待审核更新类型文章
|
||||
|
|
@ -852,8 +747,7 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
if (oldCmsDoc.getAuditType() != null && oldCmsDoc.getAuditType().contains(DocAndZoneOperation.OPERATION_CREATE.getOperationCode())) {
|
||||
deleteTmpBranchIfBranchExist(oldCmsDoc);
|
||||
cmsDocMapper.deleteCmsDocById(id);
|
||||
directlyInsertAuditedCmsDocWhenZoneHasNoAuditRequired(cmsDocDto, oldCmsDoc);
|
||||
return oldCmsDoc.getId();
|
||||
return directlyInsertAuditedCmsDocWhenZoneHasNoAuditRequired(cmsDocDto, oldCmsDoc);
|
||||
}
|
||||
}
|
||||
String branchName = CmsConstants.BRANCH_MASTER;
|
||||
|
|
@ -861,52 +755,16 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
oldCmsDoc.setAuditStatus(DocAuditStatus.AUDIT_PASS.getAuditCode());
|
||||
oldCmsDoc.setAuditTmpBranchName(null);
|
||||
oldCmsDoc.setKeywords(cmsDocDto.getKeywords());
|
||||
updateCmsCommonDatabase(oldCmsDoc, CmsConstants.BRANCH_MASTER);
|
||||
return oldCmsDoc.getId();
|
||||
return updateCmsCommonDatabase(oldCmsDoc, CmsConstants.BRANCH_MASTER) > 0;
|
||||
} else {
|
||||
|
||||
CmsDoc newDocWithAudit = new CmsDoc();
|
||||
//待审核、未通过文章重新编辑并提交
|
||||
if (DocAuditStatus.AUDIT_FAIL.getAuditCode().equals(oldCmsDoc.getAuditStatus())
|
||||
|| DocAuditStatus.TO_BE_AUDIT.getAuditCode().equals(oldCmsDoc.getAuditStatus())) {
|
||||
|
||||
// 非仓库改动待审核记录:检查是否有仓库改动
|
||||
if (oldCmsDoc.getAuditType() != null
|
||||
&& oldCmsDoc.getAuditType().contains(DocAndZoneOperation.OPERATION_NON_REPO_UPDATE.getOperationCode())) {
|
||||
|
||||
if (!hasRepoRelatedChanged(oldCmsDoc, cmsDocDto)) {
|
||||
// 纯非仓库改动:继续在当前记录上更新
|
||||
oldCmsDoc.setAuditStatus(DocAuditStatus.TO_BE_AUDIT.getAuditCode());
|
||||
if (StringUtils.isNotEmpty(cmsDocDto.getHeadImg())) {
|
||||
oldCmsDoc.setHeadImg(cmsDocDto.getHeadImg());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(cmsDocDto.getSummary())) {
|
||||
oldCmsDoc.setSummary(cmsDocDto.getSummary());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(cmsDocDto.getKeywords())) {
|
||||
oldCmsDoc.setKeywords(cmsDocDto.getKeywords());
|
||||
}
|
||||
cmsDocMapper.updateCmsDoc(oldCmsDoc);
|
||||
return oldCmsDoc.getId();
|
||||
} else {
|
||||
// 有仓库改动:转为仓库改动类型,删除当前记录,重新创建
|
||||
Long oldCmsDocId = Long.parseLong(oldCmsDoc.getAuditType().split("-")[1]);
|
||||
CmsDoc originCmsDoc = cmsDocMapper.selectCmsDocById(oldCmsDocId);
|
||||
cmsDocMapper.deleteCmsDocById(oldCmsDoc.getId());
|
||||
|
||||
// 按照仓库改动逻辑重新创建
|
||||
newDocWithAudit = insertDocWithAudit(originCmsDoc,
|
||||
DocAndZoneOperation.OPERATION_UPDATE.getOperationCode() + "-" + oldCmsDocId,
|
||||
DocAuditStatus.TO_BE_AUDIT.getAuditCode());
|
||||
cmsAsyncService.asyncUpdateBranchAndFileAndCreatePR(newDocWithAudit, cmsDocDto);
|
||||
return newDocWithAudit.getId();
|
||||
}
|
||||
}
|
||||
|
||||
// 仓库改动待审核记录:继续在当前记录上更新
|
||||
oldCmsDoc.setAuditStatus(DocAuditStatus.TO_BE_AUDIT.getAuditCode());
|
||||
newDocWithAudit = oldCmsDoc;
|
||||
} else {
|
||||
} else
|
||||
//更新已发布文章
|
||||
if (oldCmsDoc.getAuditStatus().equals(DocAuditStatus.AUDIT_PASS.getAuditCode())) {
|
||||
//1.创建一条auditType="update-原文章id",audit_status为2,其余字段与待更新文章一致的新文章数据
|
||||
|
|
@ -914,9 +772,8 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
DocAndZoneOperation.OPERATION_UPDATE.getOperationCode() + "-" + id,
|
||||
DocAuditStatus.TO_BE_AUDIT.getAuditCode());
|
||||
}
|
||||
}
|
||||
cmsAsyncService.asyncUpdateBranchAndFileAndCreatePR(newDocWithAudit, cmsDocDto);
|
||||
return newDocWithAudit.getId();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -968,7 +825,7 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
private void deleteTmpBranchIfBranchExist(CmsDoc cmsDoc) {
|
||||
CmsProject cmsProject = cmsProjectService.selectCmsProjectByDeptId(cmsDoc.getDeptId());
|
||||
try {
|
||||
gitLinkRequestHelper.doPost(CmsGitLinkRequestUrl.DELETE_BRANCH(cmsProject, cmsDoc.getAuditTmpBranchName()), null);
|
||||
gitLinkRequestHelper.doDelete(CmsGitLinkRequestUrl.DELETE_BRANCH(cmsProject, cmsDoc.getAuditTmpBranchName()));
|
||||
} catch (ServiceException e) {
|
||||
//忽略分支不存在异常
|
||||
if (!"分支不存在!".equals(e.getMessage())) {
|
||||
|
|
@ -999,29 +856,15 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
}
|
||||
|
||||
private CmsDoc insertDocWithAudit(CmsDoc oldCmsDoc, String auditType, String auditStatus) {
|
||||
List<CmsDoc> tmpDocList = getTmpDocList(oldCmsDoc);
|
||||
if (!tmpDocList.isEmpty()) {
|
||||
throw new ServiceException("已存在待审核操作,请等待审核完成后再进行操作");
|
||||
}
|
||||
oldCmsDoc.setId(null);
|
||||
oldCmsDoc.setAuditType(auditType);
|
||||
oldCmsDoc.setAuditStatus(auditStatus);
|
||||
oldCmsDoc.setCreateBy(SecurityUtils.getUsername());
|
||||
|
||||
// 非 repo 改动:显式设置 auditTmpBranchName 为 null(没有对应的分支)
|
||||
if (auditType != null && auditType.contains(DocAndZoneOperation.OPERATION_NON_REPO_UPDATE.getOperationCode())) {
|
||||
oldCmsDoc.setAuditTmpBranchName(null);
|
||||
}
|
||||
|
||||
cmsDocMapper.insertCmsDoc(oldCmsDoc);
|
||||
return oldCmsDoc;
|
||||
}
|
||||
|
||||
private CmsDoc insertDeletedDocWithAudit(CmsDoc oldCmsDoc, Long oldCmsDocId) {
|
||||
List<CmsDoc> tmpDocList = getTmpDocList(oldCmsDoc);
|
||||
if (!tmpDocList.isEmpty()) {
|
||||
throw new ServiceException("已存在待审核操作,请等待审核完成后再进行操作");
|
||||
}
|
||||
oldCmsDoc.setId(null);
|
||||
oldCmsDoc.setAuditType(DocAndZoneOperation.OPERATION_DELETE.getOperationCode() + "-" + oldCmsDocId);
|
||||
oldCmsDoc.setAuditStatus(DocAuditStatus.TO_BE_AUDIT.getAuditCode());
|
||||
|
|
@ -1167,13 +1010,7 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
visits = visits + cmsDoc.getVisits();
|
||||
}
|
||||
cmsDoc.setVisits(visits);
|
||||
int rows = cmsDocMapper.updateCmsDoc(cmsDoc);
|
||||
if (rows > 0) {
|
||||
cmsAsyncService.addVisitsDocPointsAsync(cmsDoc.getDeptId(), cmsDoc.getCreateBy(),
|
||||
cmsDoc.getId(), cmsDoc.getName(), cmsDoc.getVisits());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return cmsDocMapper.updateCmsDoc(cmsDoc) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1297,9 +1134,6 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
//首页推荐时,需将顺序设置为1
|
||||
setCmsSort(1, cmsDoc, false, null);
|
||||
cmsDoc.setIsHomepage(CmsConstants.TRUE);
|
||||
// 文章被设为精选,异步增加作者积分
|
||||
cmsAsyncService.addFeaturedDocPointsAsync(cmsDoc.getDeptId(), cmsDoc.getCreateBy(),
|
||||
cmsDoc.getId(), cmsDoc.getName());
|
||||
}
|
||||
return cmsDocMapper.updateCmsDoc(cmsDoc);
|
||||
}
|
||||
|
|
@ -1323,41 +1157,6 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
return cmsDocBaseDtoList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CmsDocBaseDto> selectHomePageDocMergeList(Long zoneId, List<Long> topDocIds) {
|
||||
Long deptId = getDeptIdByZoneId(zoneId);
|
||||
Set<Long> addedDocIds = new HashSet<>();
|
||||
|
||||
// 1. 获取首页推荐文章列表
|
||||
List<CmsDocBaseDto> homePageDocs = selectHomePageDocList(deptId);
|
||||
List<CmsDocBaseDto> result = new ArrayList<>();
|
||||
|
||||
// 2. 批量查询置顶文章完整数据,按传入顺序放入结果头部
|
||||
if (topDocIds != null && !topDocIds.isEmpty()) {
|
||||
List<CmsDoc> topCmsDocs = cmsDocMapper.selectCmsDocByIds(topDocIds);
|
||||
Map<Long, CmsDoc> topDocMap = new HashMap<>();
|
||||
for (CmsDoc doc : topCmsDocs) {
|
||||
topDocMap.put(doc.getId(), doc);
|
||||
}
|
||||
for (Long docId : topDocIds) {
|
||||
CmsDoc doc = topDocMap.get(docId);
|
||||
if (doc != null) {
|
||||
result.add(doc.copyToCmsDocBaseDto());
|
||||
addedDocIds.add(docId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 追加首页推荐文章(跳过已在置顶列表中的)
|
||||
for (CmsDocBaseDto doc : homePageDocs) {
|
||||
if (!addedDocIds.contains(doc.getId())) {
|
||||
result.add(doc);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CmsDir initCmsDir(Long deptId, CmsDir cmsDirInput) {
|
||||
|
|
@ -1504,17 +1303,6 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
cmsAsyncService.updateCmsPublishDataByGitLink(cmsProject, cmsDoc, branchName);
|
||||
}
|
||||
|
||||
private int deleteCmsDir(CmsProject cmsProject, CmsDoc cmsDir) {
|
||||
if (!isNoAuditRequired(cmsDir.getDeptId()) || tokenService.hasDeptPerms(cmsDir.getDeptId(), UserConstants.CMS_PERMS_DOCS_AUDIT)) {
|
||||
boolean deleteResult = cmsAsyncService.deleteCmsDocForGitLink(cmsDir, cmsProject, CmsConstants.BRANCH_MASTER);
|
||||
if (deleteResult) {
|
||||
return cmsDocMapper.deleteCmsDocById(cmsDir.getId());
|
||||
}
|
||||
throw new ServiceException("栏目删除失败");
|
||||
}
|
||||
throw new ServiceException("无权限删除栏目");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteCmsDocById(Long id) {
|
||||
CmsDoc cmsDoc = cmsDocMapper.selectCmsDocById(id);
|
||||
|
|
@ -1524,42 +1312,22 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
checkCmsLockStatus(cmsDoc.getDeptId());
|
||||
//2、获取专区项目
|
||||
CmsProject cmsProject = cmsProjectService.selectCmsProjectByDeptId(cmsDoc.getDeptId());
|
||||
if (cmsDoc.getIsDir()) {
|
||||
return deleteCmsDir(cmsProject, cmsDoc);
|
||||
}
|
||||
|
||||
//删除待审核、审核未通过文章——删除临时分支,拒绝合并请求
|
||||
if (DocAuditStatus.TO_BE_AUDIT.getAuditCode().equals(cmsDoc.getAuditStatus())) {
|
||||
// 非仓库改动类型直接删除
|
||||
if (cmsDoc.getAuditType().contains(DocAndZoneOperation.OPERATION_NON_REPO_UPDATE.getOperationCode())) {
|
||||
return cmsDocMapper.deleteCmsDocById(cmsDoc.getId());
|
||||
}
|
||||
|
||||
//拒绝GitLink合并请求
|
||||
String gitLinkPullRequestNumber = cmsDoc.getAuditPrNumber().split("-")[0];
|
||||
gitLinkRequestHelper.doPost(
|
||||
CmsGitLinkRequestUrl.REFUSE_MERGE_PULL_REQUEST(cmsProject, gitLinkPullRequestNumber), null);
|
||||
gitLinkRequestHelper.doPost(CmsGitLinkRequestUrl.DELETE_BRANCH(cmsProject, cmsDoc.getAuditTmpBranchName()), null);
|
||||
return cmsDocMapper.deleteCmsDocById(cmsDoc.getId());
|
||||
if (DocAuditStatus.TO_BE_AUDIT.getAuditCode().equals(cmsDoc.getAuditStatus())
|
||||
|| DocAuditStatus.AUDIT_FAIL.getAuditCode().equals(cmsDoc.getAuditStatus())) {
|
||||
gitLinkRequestHelper.doDelete(CmsGitLinkRequestUrl.DELETE_BRANCH(cmsProject, cmsDoc.getAuditTmpBranchName()));
|
||||
cmsDocMapper.deleteCmsDocById(id);
|
||||
return 1;
|
||||
}
|
||||
if (DocAuditStatus.AUDIT_FAIL.getAuditCode().equals(cmsDoc.getAuditStatus())) {
|
||||
return cmsDocMapper.deleteCmsDocById(cmsDoc.getId());
|
||||
}
|
||||
// 判读当前用户是否拥有文章直接删除权限
|
||||
if (tokenService.hasDeptPerms(cmsDoc.getDeptId(), UserConstants.CMS_PERMS_DOCS_AUDIT) //当前用户为专区管理员
|
||||
if (isCurrentUserZoneAdmin(cmsDoc.getDeptId()) //当前用户为专区管理员
|
||||
|| isNoAuditRequired(cmsDoc.getDeptId()) //当前专区文章发布无需审核机制
|
||||
) {
|
||||
String branchName = CmsConstants.BRANCH_MASTER;
|
||||
boolean deleteResult = cmsAsyncService.deleteCmsDocForGitLink(cmsDoc, cmsProject, branchName);
|
||||
if (deleteResult) {
|
||||
// 拒绝相关合并请求并清理所有临时分支,同时删除所有临时申请
|
||||
List<CmsDoc> tmpDocList = getTmpDocList(cmsDoc);
|
||||
cmsAsyncService.clearTmpDoc(cmsProject, tmpDocList);
|
||||
cmsDoc.setAuditStatus(DocAuditStatus.AUDIT_FAIL.getAuditCode());
|
||||
cmsDoc.setRemark("管理员删除");
|
||||
return cmsDocMapper.updateCmsDoc(cmsDoc);
|
||||
return deleteCmsDocDatabaseById(cmsDoc.getId());
|
||||
}
|
||||
|
||||
} else {
|
||||
//1.创建一条auditType="delete-原文章id",audit_status=2,其余字段与待删除文章一致的新文章数据
|
||||
CmsDoc newDocWithAudit = insertDeletedDocWithAudit(cmsDoc, id);
|
||||
|
|
@ -1569,18 +1337,6 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
throw new ServiceException("文件删除失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CmsDoc> getTmpDocList(CmsDoc cmsDoc) {
|
||||
CmsDocSearchVo cmsDocSearchVo = new CmsDocSearchVo();
|
||||
cmsDocSearchVo.setName(cmsDoc.getName());
|
||||
cmsDocSearchVo.setDeptId(cmsDoc.getDeptId());
|
||||
cmsDocSearchVo.setIsDir(false);
|
||||
cmsDocSearchVo.setDirName(cmsDoc.getDirName());
|
||||
cmsDocSearchVo.setAuditStatus(DocAuditStatus.TO_BE_AUDIT.getAuditCode());
|
||||
// 拒绝相关合并请求并清理所有临时分支,同时删除所有临时申请
|
||||
return cmsDocMapper.selectCmsDocList(cmsDocSearchVo);
|
||||
}
|
||||
|
||||
public int deleteCmsDocDatabaseById(Long id) {
|
||||
CmsDoc cmsDoc = cmsDocMapper.selectCmsDocById(id);
|
||||
if (cmsDoc != null && !cmsDoc.getIsDir()) {
|
||||
|
|
|
|||
|
|
@ -49,16 +49,6 @@ public class CmsProjectController extends BaseController {
|
|||
return R.ok(changeRoleResult);
|
||||
}
|
||||
|
||||
@InnerAuth
|
||||
@PutMapping("/changeOrgRole/user/{userId}/operate/{operate}")
|
||||
@ApiOperation(value = "修改用户所在GItLink组织中的权限", hidden = true)
|
||||
public R<Boolean> changeUserOrgRole(@PathVariable("userId") Long userId, @PathVariable("operate") Long operate
|
||||
) {
|
||||
Boolean changeRoleResult = cmsProjectService.changeUserOrgRole(userId, operate);
|
||||
return R.ok(changeRoleResult);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询专区对应项目列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
package com.microservices.cms.project.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
public class GitlinkOrganizationTeamVo implements Serializable {
|
||||
@ApiModelProperty(value = "团队权限")
|
||||
private String authorize;
|
||||
@ApiModelProperty(value = "团队Id")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "团队名称")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "团队昵称")
|
||||
private String nickname;
|
||||
}
|
||||
|
|
@ -2,7 +2,6 @@ package com.microservices.cms.project.mapper;
|
|||
|
||||
import com.microservices.cms.project.domain.CmsProject;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -65,25 +64,4 @@ public interface CmsProjectMapper {
|
|||
CmsProject selectCmsProjectByDeptId(Long deptId);
|
||||
|
||||
CmsProject selectCmsProjectByIdentifier(String identifier);
|
||||
|
||||
/**
|
||||
* 全局搜索 - 全文索引查询
|
||||
*
|
||||
* @param keyword 搜索关键词
|
||||
* @param deptId 组织ID(可选)
|
||||
* @param offset 偏移量
|
||||
* @param pageSize 每页数量
|
||||
* @return 搜索结果列表
|
||||
*/
|
||||
List<CmsProject> globalSearch(@Param("keyword") String keyword, @Param("deptId") Long deptId,
|
||||
@Param("offset") int offset, @Param("pageSize") int pageSize);
|
||||
|
||||
/**
|
||||
* 全局搜索结果计数
|
||||
*
|
||||
* @param keyword 搜索关键词
|
||||
* @param deptId 组织ID(可选)
|
||||
* @return 结果数量
|
||||
*/
|
||||
Long globalSearchCount(@Param("keyword") String keyword, @Param("deptId") Long deptId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,4 @@ public interface ICmsProjectService {
|
|||
boolean initZoneCmsProjectByDept(Long deptId);
|
||||
|
||||
CmsProject selectCmsProjectByDeptIdAndNoException(Long deptId);
|
||||
|
||||
Boolean changeUserOrgRole(Long userId, Long operate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import com.microservices.cms.doc.domain.*;
|
|||
import com.microservices.cms.doc.service.ICmsAsyncService;
|
||||
import com.microservices.cms.doc.service.ICmsDocService;
|
||||
import com.microservices.cms.project.domain.CmsProject;
|
||||
import com.microservices.cms.project.domain.GitlinkOrganizationTeamVo;
|
||||
import com.microservices.cms.project.mapper.CmsProjectMapper;
|
||||
import com.microservices.cms.project.service.ICmsProjectService;
|
||||
import com.microservices.cms.utils.CmsConstants;
|
||||
|
|
@ -321,40 +320,6 @@ public class CmsProjectServiceImpl implements ICmsProjectService {
|
|||
return cmsProjectMapper.selectCmsProjectByDeptId(deptId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean changeUserOrgRole(Long userId, Long operate) {
|
||||
Long gitlinkOrgId = getOrganizationId();
|
||||
SysUser sysUser = FeignUtils.getReturnData(remoteUserService.getSysUserByUserId(userId, SecurityConstants.INNER));
|
||||
if (sysUser == null) {
|
||||
return false;
|
||||
}
|
||||
List<GitlinkOrganizationTeamVo> gitlinkOrganizationTeamVoList = gitLinkRequestHelper.getAllDataByPage(
|
||||
CmsGitLinkRequestUrl.TEAMS_BY_ORGANIZATION_URL(gitlinkOrgId), "teams", GitlinkOrganizationTeamVo.class
|
||||
);
|
||||
GitlinkOrganizationTeamVo ownerTeam = gitlinkOrganizationTeamVoList.stream().filter(x -> "owner".equals(x.getAuthorize())).findFirst().orElse(null);
|
||||
if (ownerTeam == null) {
|
||||
return false;
|
||||
}
|
||||
if (operate == 1) {
|
||||
JSONObject addUserToTeam = new JSONObject();
|
||||
addUserToTeam.put("username", sysUser.getUserName());
|
||||
gitLinkRequestHelper.doPost(
|
||||
CmsGitLinkRequestUrl.ADD_USER_TO_ORGANIZATION_TEAM(gitLinkOrganization, ownerTeam.getId()), addUserToTeam);
|
||||
}
|
||||
if (operate == 3) {
|
||||
try {
|
||||
gitLinkRequestHelper.doDelete(CmsGitLinkRequestUrl.DELETE_USER_FROM_ORGANIZATION_TEAM(
|
||||
gitLinkOrganization,
|
||||
ownerTeam.getId(),
|
||||
sysUser.getUserName()
|
||||
));
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean changeUserRole(Long userId, Long oldDeptId, Long newDeptId, Long oldRoleId, Long newRoleId) {
|
||||
SysUser sysUser = FeignUtils.getReturnData(remoteUserService.getSysUserByUserId(userId, SecurityConstants.INNER));
|
||||
|
|
@ -373,10 +338,9 @@ public class CmsProjectServiceImpl implements ICmsProjectService {
|
|||
try {
|
||||
gitLinkRequestHelper.doDelete(CmsGitLinkRequestUrl.REMOVE_USER_FROM_PROJECT(oldCmsProject), requestBody);
|
||||
} catch (ServiceException e) {
|
||||
log.error("将用户从原项目中移除发生异常:{}", e.getMessage());
|
||||
// if (!e.getMessage().contains("用户为组织成员,请到组织下操作")||!e.getMessage().contains("还不是项目成员")) {
|
||||
// throw new ServiceException(e.getMessage());
|
||||
// }
|
||||
if (!e.getMessage().contains("用户为组织成员,请到组织下操作")) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
//将用户加入新的项目
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
package com.microservices.cms.search.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 文章搜索请求对象
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("文章搜索请求对象")
|
||||
public class DocSearchRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 搜索关键词
|
||||
*/
|
||||
@ApiModelProperty(value = "搜索关键词", required = true)
|
||||
private String keyword;
|
||||
|
||||
/**
|
||||
* 专区ID
|
||||
*/
|
||||
@ApiModelProperty(value = "专区ID")
|
||||
private Long zoneId;
|
||||
|
||||
/**
|
||||
* 页码
|
||||
*/
|
||||
@ApiModelProperty(value = "页码")
|
||||
private Integer pageNum = 1;
|
||||
|
||||
/**
|
||||
* 每页数量
|
||||
*/
|
||||
@ApiModelProperty(value = "每页数量")
|
||||
private Integer pageSize = 20;
|
||||
}
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
package com.microservices.cms.search.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 全局搜索响应对象
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("文章搜索响应对象")
|
||||
public class DocSearchResponse implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 总结果数
|
||||
*/
|
||||
@ApiModelProperty(value = "总结果数")
|
||||
private Long total;
|
||||
|
||||
/**
|
||||
* 搜索结果列表
|
||||
*/
|
||||
@ApiModelProperty(value = "搜索结果列表")
|
||||
private List<DocSearchResult> results;
|
||||
|
||||
/**
|
||||
* 各类型结果数量统计
|
||||
*/
|
||||
@ApiModelProperty(value = "各类型结果数量统计")
|
||||
private Map<String, Long> typeCounts;
|
||||
|
||||
/**
|
||||
* 搜索耗时(毫秒)
|
||||
*/
|
||||
@ApiModelProperty(value = "搜索耗时(毫秒)")
|
||||
private Long searchTime;
|
||||
|
||||
/**
|
||||
* 搜索关键词
|
||||
*/
|
||||
@ApiModelProperty(value = "搜索关键词")
|
||||
private String keyword;
|
||||
|
||||
/**
|
||||
* 当前页码
|
||||
*/
|
||||
@ApiModelProperty(value = "当前页码")
|
||||
private Integer pageNum;
|
||||
|
||||
/**
|
||||
* 每页数量
|
||||
*/
|
||||
@ApiModelProperty(value = "每页数量")
|
||||
private Integer pageSize;
|
||||
}
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
package com.microservices.cms.search.dto;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 文章搜索结果对象
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("文章搜索结果对象")
|
||||
public class DocSearchResult implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@ApiModelProperty(value = "ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 内容摘要
|
||||
*/
|
||||
@ApiModelProperty(value = "内容摘要")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 组织ID
|
||||
*/
|
||||
@ApiModelProperty(value = "组织ID")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 相关度评分
|
||||
*/
|
||||
@ApiModelProperty(value = "相关度评分")
|
||||
private Double score;
|
||||
|
||||
/**
|
||||
* 扩展数据(JSON格式)
|
||||
*/
|
||||
@ApiModelProperty(value = "扩展数据")
|
||||
private JSONObject extendData;
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
package com.microservices.cms.search.service;
|
||||
|
||||
import com.microservices.cms.search.dto.DocSearchRequest;
|
||||
import com.microservices.cms.search.dto.DocSearchResponse;
|
||||
|
||||
/**
|
||||
* 全局搜索服务接口
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
public interface IGlobalSearchService {
|
||||
|
||||
/**
|
||||
* 全局搜索
|
||||
*
|
||||
* @param request 搜索请求
|
||||
* @return 搜索响应
|
||||
*/
|
||||
DocSearchResponse docSearch(DocSearchRequest request);
|
||||
}
|
||||
|
|
@ -1,215 +0,0 @@
|
|||
package com.microservices.cms.search.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.cms.doc.domain.CmsDoc;
|
||||
import com.microservices.cms.doc.domain.CmsDocWithScore;
|
||||
import com.microservices.cms.doc.mapper.CmsDocMapper;
|
||||
import com.microservices.cms.doc.service.ICmsDocService;
|
||||
import com.microservices.cms.search.service.IGlobalSearchService;
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.common.redis.service.RedisService;
|
||||
import com.microservices.cms.search.dto.DocSearchRequest;
|
||||
import com.microservices.cms.search.dto.DocSearchResponse;
|
||||
import com.microservices.cms.search.dto.DocSearchResult;
|
||||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.system.api.model.LoginUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 全局搜索服务实现
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@Service
|
||||
public class GlobalSearchServiceImpl implements IGlobalSearchService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GlobalSearchServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private CmsDocMapper cmsDocMapper;
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
@Autowired
|
||||
private ICmsDocService cmsDocService;
|
||||
|
||||
private static final String SEARCH_CACHE_PREFIX = "search:cache:";
|
||||
private static final Long CACHE_EXPIRE_SECONDS = 300L; // 5分钟
|
||||
|
||||
@Override
|
||||
public DocSearchResponse docSearch(DocSearchRequest request) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
// 参数校验
|
||||
if (StringUtils.isEmpty(request.getKeyword())) {
|
||||
return buildEmptyResponse(request);
|
||||
}
|
||||
|
||||
// 1. 尝试从缓存获取(仅第一页)
|
||||
if (request.getPageNum() == 1) {
|
||||
String cacheKey = buildCacheKey(request);
|
||||
|
||||
DocSearchResponse cached = redisService.getCacheObject(SEARCH_CACHE_PREFIX + cacheKey);
|
||||
if (cached != null) {
|
||||
cached.setSearchTime(System.currentTimeMillis() - startTime);
|
||||
return cached;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 并行搜索各类型
|
||||
List<DocSearchResult> allResults = new ArrayList<>();
|
||||
Map<String, Long> typeCounts = new HashMap<>();
|
||||
|
||||
// 获取当前用户信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
|
||||
// 搜索CMS文章
|
||||
List<DocSearchResult> docResults = searchDocs(request);
|
||||
allResults.addAll(docResults);
|
||||
typeCounts.put("doc", (long) docResults.size());
|
||||
|
||||
// 3. 按相关度评分排序
|
||||
allResults.sort((a, b) -> {
|
||||
if (b.getScore() != null && a.getScore() != null) {
|
||||
return b.getScore().compareTo(a.getScore());
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
// 4. 分页
|
||||
int total = allResults.size();
|
||||
int start = (request.getPageNum() - 1) * request.getPageSize();
|
||||
int end = Math.min(start + request.getPageSize(), total);
|
||||
List<DocSearchResult> pagedResults = start < total ?
|
||||
allResults.subList(start, end) : new ArrayList<>();
|
||||
|
||||
// 5. 构建响应
|
||||
DocSearchResponse response = new DocSearchResponse();
|
||||
response.setTotal((long) total);
|
||||
response.setResults(pagedResults);
|
||||
response.setTypeCounts(typeCounts);
|
||||
response.setKeyword(request.getKeyword());
|
||||
response.setPageNum(request.getPageNum());
|
||||
response.setPageSize(request.getPageSize());
|
||||
response.setSearchTime(System.currentTimeMillis() - startTime);
|
||||
|
||||
// 6. 缓存结果(仅第一页)
|
||||
if (request.getPageNum() == 1) {
|
||||
String cacheKey = buildCacheKey(request);
|
||||
redisService.setCacheObject(SEARCH_CACHE_PREFIX + cacheKey, response, CACHE_EXPIRE_SECONDS, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
// 7. 记录搜索日志
|
||||
recordSearchLog(request, response, loginUser);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录搜索日志
|
||||
*/
|
||||
private void recordSearchLog(DocSearchRequest request, DocSearchResponse response, LoginUser loginUser) {
|
||||
Long userId = loginUser != null ? loginUser.getUserId() : null;
|
||||
String searchTypes = "文章";
|
||||
Long deptId = cmsDocService.getDeptIdByZoneId(request.getZoneId());
|
||||
logger.info("全局搜索 - 关键词: {}, 用户ID: {}, 耗时: {}ms, 结果数: {}, 类型: {}, 专区Id: {}, 组织ID: {}",
|
||||
request.getKeyword(),
|
||||
userId,
|
||||
response.getSearchTime(),
|
||||
response.getTotal(),
|
||||
searchTypes,
|
||||
request.getZoneId(),
|
||||
deptId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索CMS文章
|
||||
*/
|
||||
private List<DocSearchResult> searchDocs(DocSearchRequest request) {
|
||||
List<DocSearchResult> results = new ArrayList<>();
|
||||
try {
|
||||
// 使用部门ID参数
|
||||
Long deptId = cmsDocService.getDeptIdByZoneId(request.getZoneId());
|
||||
|
||||
// 使用新的带评分的查询方法
|
||||
List<CmsDocWithScore> docs = cmsDocMapper.globalSearchWithScore(
|
||||
request.getKeyword(),
|
||||
deptId,
|
||||
(request.getPageNum() - 1) * request.getPageSize(),
|
||||
request.getPageSize()
|
||||
);
|
||||
|
||||
for (CmsDocWithScore doc : docs) {
|
||||
DocSearchResult result = new DocSearchResult();
|
||||
result.setId(doc.getId());
|
||||
result.setTitle(highlightKeyword(doc.getName(), request.getKeyword()));
|
||||
result.setContent(highlightKeyword(doc.getSummary(), request.getKeyword()));
|
||||
result.setDeptId(doc.getDeptId());
|
||||
result.setCreateTime(doc.getCreateTime());
|
||||
|
||||
// 使用数据库返回的实际搜索评分
|
||||
Double score = doc.getSearchScore();
|
||||
if (score == null || score == 0.0) {
|
||||
// 对于 LIKE 匹配(无全文评分),赋予最小评分
|
||||
score = 0.1;
|
||||
}
|
||||
result.setScore(score);
|
||||
|
||||
JSONObject extendData = new JSONObject();
|
||||
extendData.put("visits", doc.getVisits());
|
||||
extendData.put("publishTime", doc.getPublishTime());
|
||||
result.setExtendData(extendData);
|
||||
results.add(result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 记录错误但继续处理其他类型
|
||||
System.err.println("搜索CMS文章失败: " + e.getMessage());
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建缓存键
|
||||
*/
|
||||
private String buildCacheKey(DocSearchRequest request) {
|
||||
Long deptId = cmsDocService.getDeptIdByZoneId(request.getZoneId());
|
||||
StringBuilder key = new StringBuilder(request.getKeyword());
|
||||
key.append(":").append(String.join(",", "Doc"));
|
||||
if (deptId != null) {
|
||||
key.append(":dept=").append(deptId);
|
||||
}
|
||||
return key.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建空响应
|
||||
*/
|
||||
private DocSearchResponse buildEmptyResponse(DocSearchRequest request) {
|
||||
DocSearchResponse response = new DocSearchResponse();
|
||||
response.setTotal(0L);
|
||||
response.setResults(new ArrayList<>());
|
||||
response.setTypeCounts(new HashMap<>());
|
||||
response.setKeyword(request.getKeyword());
|
||||
response.setPageNum(request.getPageNum());
|
||||
response.setPageSize(request.getPageSize());
|
||||
response.setSearchTime(0L);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将文本中的关键词用 <em> 标签包裹(不区分大小写)
|
||||
*/
|
||||
private String highlightKeyword(String text, String keyword) {
|
||||
if (StringUtils.isEmpty(text) || StringUtils.isEmpty(keyword)) {
|
||||
return text;
|
||||
}
|
||||
return text.replaceAll("(?i)(" + Pattern.quote(keyword) + ")", "<em>$1</em>");
|
||||
}
|
||||
}
|
||||
|
|
@ -25,24 +25,4 @@ public class CmsConstants {
|
|||
* 是
|
||||
*/
|
||||
public final static String TRUE = "1";
|
||||
|
||||
/**
|
||||
* 专区积分异步队列 Redis Key(与 Zone 模块保持一致)
|
||||
*/
|
||||
public final static String ZONE_POINTS_ASYNC_QUEUE_KEY = "zone:points:async:queue";
|
||||
|
||||
/**
|
||||
* 发布文章积分类型
|
||||
*/
|
||||
public final static String PUBLISH_DOC = "publishDoc";
|
||||
|
||||
/**
|
||||
* 浏览文章积分类型
|
||||
*/
|
||||
public final static String VISITS_DOC = "visitsDoc";
|
||||
|
||||
/**
|
||||
* 精选文章积分类型
|
||||
*/
|
||||
public final static String FEATURED_DOC = "featuredDoc";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,18 +12,6 @@ import java.util.Map;
|
|||
|
||||
public class CmsGitLinkRequestUrl extends GitLinkRequestUrl {
|
||||
|
||||
public static GitLinkRequestUrl ADD_USER_TO_ORGANIZATION_TEAM(String orgIdentifier, Long teamId) {
|
||||
return getAdminGitLinkRequestUrl(String.format("/api/organizations/%s/teams/%d/team_users.json", orgIdentifier, teamId));
|
||||
}
|
||||
|
||||
public static String TEAMS_BY_ORGANIZATION_URL(Long orgId) {
|
||||
return String.format("/api/organizations/%s/teams.json", orgId);
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl DELETE_USER_FROM_ORGANIZATION_TEAM(String orgIdentifier, Long teamId, String username) {
|
||||
return getAdminGitLinkRequestUrl(String.format("/api/organizations/%s/teams/%d/team_users/%s.json", orgIdentifier, teamId, username));
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建项目
|
||||
*/
|
||||
|
|
@ -78,7 +66,7 @@ public class CmsGitLinkRequestUrl extends GitLinkRequestUrl {
|
|||
|
||||
public static GitLinkRequestUrl DELETE_BRANCH(CmsProject cmsProject, String branchName) {
|
||||
return getGitLinkRequestUrl(
|
||||
String.format("/api/v1/%s/%s/branches/delete.json?branch_name=%s", cmsProject.getUsername(), cmsProject.getIdentifier(), branchName)
|
||||
String.format("/api/v1/%s/%s/branches/%s.json", cmsProject.getUsername(), cmsProject.getIdentifier(), branchName)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -88,12 +76,6 @@ public class CmsGitLinkRequestUrl extends GitLinkRequestUrl {
|
|||
);
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl REOPEN_PULL_REQUEST(CmsProject cmsProject, String giteaPrNumber) {
|
||||
return getGitLinkRequestUrl(
|
||||
String.format("/api/v1/%s/%s/pulls/%s/reopen", cmsProject.getUsername(), cmsProject.getIdentifier(), giteaPrNumber)
|
||||
);
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl GET_PULL_REQUEST_DETAILS(CmsProject cmsProject, String giteaPrNumber) {
|
||||
return getGitLinkRequestUrl(
|
||||
String.format("/api/%s/%s/pulls/%s.json", cmsProject.getUsername(), cmsProject.getIdentifier(), giteaPrNumber)
|
||||
|
|
@ -119,7 +101,7 @@ public class CmsGitLinkRequestUrl extends GitLinkRequestUrl {
|
|||
}
|
||||
|
||||
public static GitLinkRequestUrl ADD_USER_FROM_PROJECT(CmsProject cmsProject) {
|
||||
return getAdminGitLinkRequestUrl(
|
||||
return getGitLinkRequestUrl(
|
||||
String.format("/api/%s/%s/collaborators.json", cmsProject.getUsername(), cmsProject.getIdentifier())
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
<result property="auditTmpBranchName" column="audit_tmp_branch_name"/>
|
||||
<result property="auditPrNumber" column="audit_pr_number"/>
|
||||
<result property="keywords" column="keywords"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCmsDocVo">
|
||||
|
|
@ -72,8 +71,7 @@
|
|||
audit_type,
|
||||
audit_tmp_branch_name,
|
||||
keywords,
|
||||
audit_pr_number,
|
||||
remark
|
||||
audit_pr_number
|
||||
from cms_doc
|
||||
</sql>
|
||||
|
||||
|
|
@ -105,51 +103,7 @@
|
|||
cd.is_homepage,
|
||||
cd.editor_type,
|
||||
cd.keywords,
|
||||
cd.is_dir,
|
||||
cd.audit_status,
|
||||
cd.audit_type,
|
||||
cd.audit_tmp_branch_name,
|
||||
cd.audit_pr_number,
|
||||
cd.remark
|
||||
from cms_doc cd
|
||||
</sql>
|
||||
|
||||
<sql id="selectCmsDocWithScoreVo">
|
||||
select cd.id,
|
||||
cd.create_by,
|
||||
cd.create_time,
|
||||
cd.update_by,
|
||||
cd.update_time,
|
||||
cd.name,
|
||||
cd.file_name,
|
||||
cd.file_path,
|
||||
cd.file_sha,
|
||||
cd.file_size,
|
||||
cd.file_url,
|
||||
cd.html_url,
|
||||
cd.visits,
|
||||
cd.sort,
|
||||
cd.publish_time,
|
||||
cd.publish_user,
|
||||
cd.publish_user_image,
|
||||
cd.publish_user_url,
|
||||
cd.publish_user_nickname,
|
||||
cd.summary,
|
||||
cd.head_img,
|
||||
cd.dir_name,
|
||||
cd.dept_id,
|
||||
cd.issue_id,
|
||||
cd.is_homepage,
|
||||
cd.editor_type,
|
||||
cd.keywords,
|
||||
cd.is_dir,
|
||||
cd.audit_status,
|
||||
cd.audit_type,
|
||||
cd.audit_tmp_branch_name,
|
||||
cd.audit_pr_number,
|
||||
-- 计算全文搜索相关度评分
|
||||
MATCH(cd.name, cd.summary) AGAINST(#{keyword} IN NATURAL LANGUAGE MODE) AS search_score,
|
||||
cd.remark
|
||||
cd.is_dir
|
||||
from cms_doc cd
|
||||
</sql>
|
||||
|
||||
|
|
@ -187,12 +141,7 @@
|
|||
cd.is_homepage,
|
||||
cd.editor_type,
|
||||
cd.keywords,
|
||||
cd.is_dir,
|
||||
cd.audit_status,
|
||||
cd.audit_type,
|
||||
cd.audit_tmp_branch_name,
|
||||
cd.audit_pr_number,
|
||||
cd.remark
|
||||
cd.is_dir
|
||||
from cms_doc cd
|
||||
left join cms_doc dir on cd.dir_name = dir.name and cd.dept_id = dir.dept_id and dir.is_dir=1
|
||||
</sql>
|
||||
|
|
@ -217,20 +166,10 @@
|
|||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectCmsDocByIds" resultMap="CmsDocResult">
|
||||
<include refid="selectCmsDocVo"/>
|
||||
where id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
and audit_status = '1'
|
||||
</select>
|
||||
|
||||
<select id="selectCmsDocByNameAndDeptId" resultMap="CmsDocResult">
|
||||
<include refid="selectCmsDocVo"/>
|
||||
<where>
|
||||
and name = #{name}
|
||||
and audit_status != 0
|
||||
and dept_id = #{deptId}
|
||||
<choose>
|
||||
<when test="dirName != null">
|
||||
|
|
@ -242,10 +181,6 @@
|
|||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectCmsDocByNameAndDeptIdIgnoreDirName" resultMap="CmsDocResult">
|
||||
<include refid="selectCmsDocVo"/>
|
||||
where name = #{name} and dept_id = #{deptId} and is_dir = 0
|
||||
</select>
|
||||
<select id="selectCmsDocDirByNameAndDeptId" resultMap="CmsDocResult">
|
||||
<include refid="selectCmsDocVo"/>
|
||||
where name = #{name} and dept_id = #{deptId} and is_dir = 1
|
||||
|
|
@ -286,7 +221,6 @@
|
|||
<if test="auditStatus != null and auditStatus != '-1' ">and audit_status = #{auditStatus}</if>
|
||||
<if test="auditStatus == null ">and audit_status = '1'</if>
|
||||
<if test="createBy != null and createBy != '' ">and create_by = #{createBy}</if>
|
||||
<if test="excludeId != null ">and id != #{excludeId}</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
|
|
@ -524,7 +458,6 @@
|
|||
<if test="auditTmpBranchName != null">audit_tmp_branch_name = #{auditTmpBranchName},</if>
|
||||
<if test="auditPrNumber != null">audit_pr_number = #{auditPrNumber},</if>
|
||||
<if test="keywords != null">keywords = #{keywords},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
|
@ -561,70 +494,4 @@
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 全局搜索 - 全文索引查询(含 LIKE 后备搜索) -->
|
||||
<select id="globalSearch" resultMap="CmsDocResult">
|
||||
<include refid="selectCmsDocAliasVo"/>
|
||||
WHERE
|
||||
cd.is_dir = 0
|
||||
AND cd.audit_status = '1'
|
||||
AND (
|
||||
MATCH(cd.name, cd.summary) AGAINST(#{keyword} IN BOOLEAN MODE)
|
||||
OR cd.name LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR cd.summary LIKE CONCAT('%', #{keyword}, '%')
|
||||
)
|
||||
<if test="deptId != null">
|
||||
AND cd.dept_id = #{deptId}
|
||||
</if>
|
||||
ORDER BY
|
||||
CASE
|
||||
WHEN MATCH(cd.name, cd.summary) AGAINST(#{keyword} IN BOOLEAN MODE) > 0 THEN 1
|
||||
ELSE 2
|
||||
END,
|
||||
cd.update_time DESC
|
||||
LIMIT #{offset}, #{pageSize}
|
||||
</select>
|
||||
|
||||
<select id="globalSearchCount" resultType="java.lang.Long">
|
||||
SELECT COUNT(*)
|
||||
FROM cms_doc cd
|
||||
WHERE
|
||||
cd.is_dir = 0
|
||||
AND cd.audit_status = '1'
|
||||
AND (
|
||||
MATCH(cd.name, cd.summary) AGAINST(#{keyword} IN BOOLEAN MODE)
|
||||
OR cd.name LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR cd.summary LIKE CONCAT('%', #{keyword}, '%')
|
||||
)
|
||||
<if test="deptId != null">
|
||||
AND cd.dept_id = #{deptId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- ResultMap for CmsDocWithScore -->
|
||||
<resultMap type="com.microservices.cms.doc.domain.CmsDocWithScore" id="CmsDocWithScoreResult" extends="CmsDocResult">
|
||||
<result property="searchScore" column="search_score"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 全局搜索 - 带评分的全文索引查询 -->
|
||||
<select id="globalSearchWithScore" resultMap="CmsDocWithScoreResult">
|
||||
<include refid="selectCmsDocWithScoreVo"/>
|
||||
WHERE
|
||||
cd.is_dir = 0
|
||||
AND cd.audit_status = '1'
|
||||
AND (
|
||||
MATCH(cd.name, cd.summary) AGAINST(#{keyword} IN BOOLEAN MODE)
|
||||
OR cd.name LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR cd.summary LIKE CONCAT('%', #{keyword}, '%')
|
||||
)
|
||||
<if test="deptId != null">
|
||||
AND cd.dept_id = #{deptId}
|
||||
</if>
|
||||
ORDER BY
|
||||
-- 主要排序:按相关度评分降序
|
||||
search_score DESC,
|
||||
-- 次要排序:更新时间降序
|
||||
cd.update_time DESC
|
||||
LIMIT #{offset}, #{pageSize}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -159,38 +159,4 @@
|
|||
item="id" collection="array" open="(" separator="," close=")">#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 全局搜索 - 全文索引查询 -->
|
||||
<select id="globalSearch" resultMap="CmsProjectResult">
|
||||
SELECT id,
|
||||
name,
|
||||
description,
|
||||
user_id,
|
||||
dept_id,
|
||||
identifier,
|
||||
username,
|
||||
create_by,
|
||||
create_time,
|
||||
update_time
|
||||
FROM cms_project cp
|
||||
WHERE
|
||||
MATCH(cp.name) AGAINST(#{keyword} IN NATURAL LANGUAGE MODE)
|
||||
<if test="deptId != null">
|
||||
AND cp.dept_id = #{deptId}
|
||||
</if>
|
||||
ORDER BY
|
||||
MATCH(cp.name) AGAINST(#{keyword} IN NATURAL LANGUAGE MODE) DESC,
|
||||
cp.update_time DESC
|
||||
LIMIT #{offset}, #{pageSize}
|
||||
</select>
|
||||
|
||||
<select id="globalSearchCount" resultType="java.lang.Long">
|
||||
SELECT COUNT(*)
|
||||
FROM cms_project cp
|
||||
WHERE
|
||||
MATCH(cp.name) AGAINST(#{keyword} IN NATURAL LANGUAGE MODE)
|
||||
<if test="deptId != null">
|
||||
AND cp.dept_id = #{deptId}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
package com.microservices.file.controller;
|
||||
|
||||
import com.microservices.common.core.domain.R;
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
import com.microservices.file.service.ISysFileInfoService;
|
||||
import com.microservices.system.api.domain.SysFileInfo;
|
||||
|
|
@ -121,20 +120,19 @@ public class OpenController {
|
|||
@ApiImplicitParam(name = "hierarchy", value = "层级结构(eg: pms项目管理中{enterpriseIdentifier}/products,{enterpriseIdentifier}/projects,{enterpriseIdentifier}/docs/{projectId})", paramType = "query", dataType = "String")
|
||||
})
|
||||
public AjaxResult uploadFile(@RequestPart("file") MultipartFile file, String type, String hierarchy) {
|
||||
throw new ServiceException("该接口已弃用!");
|
||||
// SysFileInfo sysFileInfo = sysFileInfoService.upload(file, type, hierarchy);
|
||||
// AjaxResult ajax = AjaxResult.success();
|
||||
// ajax.put("url", sysFileInfo.getDownloadUrl());
|
||||
// if (sysFileInfo.getFileIdentifier() != null) {
|
||||
// ajax.put("fileIdentifier", sysFileInfo.getFileIdentifier());
|
||||
// }
|
||||
// ajax.put("fileName", sysFileInfo.getFilePath());
|
||||
// if (sysFileInfo.getFileId() != null) {
|
||||
// ajax.put("fileId", sysFileInfo.getFileId());
|
||||
// }
|
||||
// ajax.put("fileOriginName", sysFileInfo.getFileOriginName());
|
||||
// ajax.put("fileSuffix", sysFileInfo.getFileSuffix());
|
||||
// ajax.put("fileSize", sysFileInfo.getFileSizeInfo());
|
||||
// return ajax;
|
||||
SysFileInfo sysFileInfo = sysFileInfoService.upload(file, type, hierarchy);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("url", sysFileInfo.getDownloadUrl());
|
||||
if (sysFileInfo.getFileIdentifier() != null) {
|
||||
ajax.put("fileIdentifier", sysFileInfo.getFileIdentifier());
|
||||
}
|
||||
ajax.put("fileName", sysFileInfo.getFilePath());
|
||||
if (sysFileInfo.getFileId() != null) {
|
||||
ajax.put("fileId", sysFileInfo.getFileId());
|
||||
}
|
||||
ajax.put("fileOriginName", sysFileInfo.getFileOriginName());
|
||||
ajax.put("fileSuffix", sysFileInfo.getFileSuffix());
|
||||
ajax.put("fileSize", sysFileInfo.getFileSizeInfo());
|
||||
return ajax;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
|
@ -33,7 +34,7 @@ public class SysFileController extends BaseController {
|
|||
*/
|
||||
@InnerAuth
|
||||
@PostMapping("upload")
|
||||
public R<SysFile> upload(MultipartFile file,
|
||||
public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file,
|
||||
@RequestParam("type") String type,
|
||||
@RequestParam("hierarchy") String hierarchy) {
|
||||
try {
|
||||
|
|
@ -43,6 +44,7 @@ public class SysFileController extends BaseController {
|
|||
sysFile.setName(fileInfo.getFilePath());
|
||||
sysFile.setUrl(fileInfo.getDownloadUrl());
|
||||
sysFile.setFileIdentifier(fileInfo.getFileIdentifier());
|
||||
sysFile.setFileId(fileInfo.getFileId());
|
||||
return R.ok(sysFile);
|
||||
} catch (Exception e) {
|
||||
log.error("上传文件失败", e);
|
||||
|
|
|
|||
|
|
@ -96,11 +96,6 @@ public class SysFileInfoServiceImpl implements ISysFileInfoService {
|
|||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
/** 积分异步任务 Redis 队列 Key */
|
||||
private static final String ZONE_POINTS_ASYNC_QUEUE_KEY = "zone:points:async:queue";
|
||||
/** 资源下载积分任务 sourceType */
|
||||
private static final String DOWNLOAD_RESOURCE_SOURCE_TYPE = "downloadResource";
|
||||
|
||||
@Override
|
||||
public SysFileInfo selectSysFileInfoByFileObjectName(String fileObjectName) {
|
||||
return sysFileInfoMapper.selectSysFileInfoByFileObjectName(fileObjectName);
|
||||
|
|
@ -276,9 +271,9 @@ public class SysFileInfoServiceImpl implements ISysFileInfoService {
|
|||
@Override
|
||||
public void fileDownloadById(Long fileId, HttpServletResponse response, HttpServletRequest request) {
|
||||
SysFileInfo sysFileInfo = selectSysFileInfoByFileId(fileId);
|
||||
if (StringUtils.isNotEmpty(sysFileInfo.getFileIdentifier())) {
|
||||
throw new ServiceException("当前文件无法下载");
|
||||
}
|
||||
// if (StringUtils.isNotEmpty(sysFileInfo.getFileIdentifier())) {
|
||||
// throw new ServiceException("当前文件无法下载");
|
||||
// }
|
||||
fileDownload(sysFileInfo, response);
|
||||
}
|
||||
|
||||
|
|
@ -402,6 +397,7 @@ public class SysFileInfoServiceImpl implements ISysFileInfoService {
|
|||
hierarchy = validPathSafety(hierarchy);
|
||||
}
|
||||
boolean isLocalUpload = true;
|
||||
boolean isHierarchyPath = false;
|
||||
Long fileId = null;
|
||||
switch (fileType) {
|
||||
case "pms-gitlink":
|
||||
|
|
@ -436,6 +432,7 @@ public class SysFileInfoServiceImpl implements ISysFileInfoService {
|
|||
sysFileInfo.setFileIdentifier(genFileIdentifier());
|
||||
baseFilePath += "/" + fileType + "/" + hierarchy + "/";
|
||||
isCommonFileType = false;
|
||||
isHierarchyPath = true;
|
||||
break;
|
||||
}
|
||||
case "dms": {
|
||||
|
|
@ -450,6 +447,13 @@ public class SysFileInfoServiceImpl implements ISysFileInfoService {
|
|||
isCommonFileType = false;
|
||||
break;
|
||||
}
|
||||
case "ai-resource": {
|
||||
sysFileInfo.setFileIdentifier(genFileIdentifier());
|
||||
baseFilePath += "/" + fileType + "/" + hierarchy + "/";
|
||||
isCommonFileType = false;
|
||||
isHierarchyPath = true;
|
||||
break;
|
||||
}
|
||||
case "zone-identifier": {
|
||||
// 生成唯一标识,防止用户通过id递增访问
|
||||
sysFileInfo.setFileIdentifier(genFileIdentifier());
|
||||
|
|
@ -512,7 +516,7 @@ public class SysFileInfoServiceImpl implements ISysFileInfoService {
|
|||
sysFileInfo.setFileOriginName(session.getFileName());
|
||||
}
|
||||
if (!isCommonFileType) {
|
||||
if ("pms".equals(fileType)) {
|
||||
if (isHierarchyPath) {
|
||||
filePath = EscapeUtil.removeExtraSlashOfUrl("/" + fileType + "/" + hierarchy + "/" + filePath);
|
||||
} else {
|
||||
filePath = EscapeUtil.removeExtraSlashOfUrl("/" + fileType + "/" + filePath);
|
||||
|
|
@ -621,15 +625,6 @@ public class SysFileInfoServiceImpl implements ISysFileInfoService {
|
|||
sysFileInfo.setDownloadCount(downloadCount);
|
||||
updateSysFileInfo(sysFileInfo);
|
||||
|
||||
// 触发资源下载积分任务(直接写入 Redis 异步队列)
|
||||
try {
|
||||
JSONObject task = new JSONObject();
|
||||
task.put("sourceType", DOWNLOAD_RESOURCE_SOURCE_TYPE);
|
||||
task.put("sourceId", sysFileInfo.getFileId());
|
||||
redisService.leftPush(ZONE_POINTS_ASYNC_QUEUE_KEY, JSONObject.toJSONString(task));
|
||||
} catch (Exception e) {
|
||||
logger.warn("触发资源下载积分任务失败 fileId={} error={}", sysFileInfo.getFileId(), e.getMessage());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("文件下载异常:%s", e.getMessage());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import io.swagger.annotations.ApiModel;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -72,18 +71,12 @@ public class PmsProjectTestcaseDataVo extends BaseEntityVo {
|
|||
@ApiModelProperty(value = "关联产品需求")
|
||||
private PmsProductRequirement productReqSpecs;
|
||||
|
||||
@ApiModelProperty(value = "测试追踪")
|
||||
private String testTracking;
|
||||
|
||||
/**
|
||||
* 用例索引
|
||||
*/
|
||||
@ApiModelProperty(value = "用例索引")
|
||||
private Long index;
|
||||
|
||||
@ApiModelProperty(value = "测试用例标识")
|
||||
private String identifier;
|
||||
|
||||
|
||||
public PmsProjectTestcaseDetailVo toPmsProjectTestcaseDetailVo() {
|
||||
PmsProjectTestcaseDetailVo target = new PmsProjectTestcaseDetailVo();
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
<result property="testMethod" column="test_method"/>
|
||||
<result property="terminationConditions" column="termination_conditions"/>
|
||||
<result property="identifier" column="identifier"/>
|
||||
<result property="testTracking" column="test_tracking"/>
|
||||
<result property="testTracking" column="test_track"/>
|
||||
<result property="productReqSpecsId" column="product_req_specs_id"/>
|
||||
<result property="isImport" column="is_import"/>
|
||||
</resultMap>
|
||||
|
|
@ -33,7 +33,6 @@
|
|||
<sql id="selectPmsProjectTestcaseVo">
|
||||
select id,
|
||||
title,
|
||||
test_tracking,
|
||||
assignee_gitlink_id,
|
||||
pms_project_id,
|
||||
type_id,
|
||||
|
|
@ -187,7 +186,7 @@
|
|||
<if test="testMethod != null">test_method = #{testMethod},</if>
|
||||
<if test="terminationConditions != null">termination_conditions = #{terminationConditions},</if>
|
||||
<if test="identifier != null">identifier = #{identifier},</if>
|
||||
<if test="testTracking != null">test_tracking = #{testTracking},</if>
|
||||
<if test="testTracking != null">#{testTracking},</if>
|
||||
<if test="productReqSpecsId != null">#{productReqSpecsId},</if>
|
||||
<if test="isImport != null">#{isImport},</if>
|
||||
</trim>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.microservices.system.controller;
|
||||
|
||||
import com.microservices.common.core.constant.SecurityConstants;
|
||||
import com.microservices.common.core.domain.R;
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
|
|
@ -204,26 +203,6 @@ public class SysUserController extends BaseController {
|
|||
return R.ok(sysUser);
|
||||
}
|
||||
|
||||
@InnerAuth
|
||||
@GetMapping("/getSysUserListByUserIds")
|
||||
R<List<SysUser>> getSysUserListByUserIds(@RequestParam("userIds") Long[] userIds) {
|
||||
List<SysUser> sysUserList = userService.selectUserListFromUserIds(userIds);
|
||||
return R.ok(sysUserList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过用户ID数组批量获取用户信息(POST方法,解决URL长度限制)
|
||||
*
|
||||
* @param userIds 用户ID数组
|
||||
* @return 用户列表
|
||||
*/
|
||||
@InnerAuth
|
||||
@PostMapping("/getSysUserListByUserIds")
|
||||
R<List<SysUser>> postSysUserListByUserIds(@RequestBody Long[] userIds) {
|
||||
List<SysUser> sysUserList = userService.selectUserListFromUserIds(userIds);
|
||||
return R.ok(sysUserList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过GitLinkToken获取本系统Token
|
||||
*
|
||||
|
|
|
|||
|
|
@ -289,24 +289,6 @@ public class SysUserDeptRoleController extends BaseController {
|
|||
return R.ok(userInDeptHasRole);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查用户是否在指定部门或父级部门下具有指定菜单权限
|
||||
*
|
||||
* @param deptId 组织id
|
||||
* @param userId 用户id
|
||||
* @param perms 菜单权限
|
||||
* @return 用户是否指定部门或父级部门下具有菜单权限 是true 否false
|
||||
*/
|
||||
@ApiOperation(value = "检查用户是否在指定部门或父级部门下具有指定菜单权限", hidden = true)
|
||||
@InnerAuth
|
||||
@GetMapping("/checkUserInDeptOrParentDeptHasPerms")
|
||||
public R<Boolean> checkUserInDeptOrParentDeptHasPerms(@ApiParam(name = "deptId", value = "组织id", required = true) Long deptId,
|
||||
@ApiParam(name = "userId", value = "用户id", required = true) Long userId,
|
||||
@ApiParam(name = "perms", value = "菜单权限", required = true) String perms) {
|
||||
Boolean userInDeptHasRole = sysUserDeptRoleService.checkUserInDeptOrParentDeptHasPerms(deptId, userId, perms);
|
||||
return R.ok(userInDeptHasRole);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查用户是否在指定部门下
|
||||
*
|
||||
|
|
@ -322,12 +304,4 @@ public class SysUserDeptRoleController extends BaseController {
|
|||
Boolean userInDept = sysUserDeptRoleService.checkUserInDept(currentDeptId, userId);
|
||||
return R.ok(userInDept);
|
||||
}
|
||||
@ApiOperation(value = "用户是否在指定部门下", hidden = true)
|
||||
@InnerAuth
|
||||
@GetMapping("/getSysUserDeptRoleByDeptIdAndUserId")
|
||||
public R<SysUserDeptRole> getSysUserDeptRoleByDeptIdAndUserId(@ApiParam(name = "deptId", value = "组织id", required = true) Long deptId,
|
||||
@ApiParam(name = "userId", value = "用户id", required = true) Long userId) {
|
||||
SysUserDeptRole userIdentifier = sysUserDeptRoleService.getSysUserDeptRoleByDeptIdAndUserId(deptId, userId);
|
||||
return R.ok(userIdentifier);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,6 +151,4 @@ public interface SysUserDeptRoleMapper {
|
|||
* @param state 状态
|
||||
*/
|
||||
void updateUserIdentifyStateByUserId(@Param("userId") Long userId, @Param("state") String state);
|
||||
|
||||
int selectUserInDeptOrParentDeptHasPermsCount(@Param("deptId") Long deptId, @Param("userId") Long userId, @Param("perms") String perms);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,6 +131,4 @@ public interface SysUserMapper
|
|||
public SysUser checkEmailUnique(String email);
|
||||
|
||||
SysUser selectUserByGitLinkUserId(Long gitLinkUserId);
|
||||
|
||||
List<SysUser> selectUserListFromUserIds(Long[] ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,8 +160,4 @@ public interface ISysUserDeptRoleService {
|
|||
* @param userId 用户Id
|
||||
*/
|
||||
void deleteSysUserDeptRoleByDeleteUser(@Param("userId") Long userId);
|
||||
|
||||
Boolean checkUserInDeptOrParentDeptHasPerms(Long deptId, Long userId, String perms);
|
||||
|
||||
SysUserDeptRole getSysUserDeptRoleByDeptIdAndUserId(Long deptId, Long userId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -222,6 +222,4 @@ public interface ISysUserService
|
|||
String getUserNameByGitLinkToken(String gitLinkToken);
|
||||
|
||||
SysUser gitlinkUserToUpdateSysUser(SysUser sysUser, ForgeUser forgeUser);
|
||||
|
||||
List<SysUser> selectUserListFromUserIds(Long[] userIds);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ public class SysUserDeptRoleServiceImpl implements ISysUserDeptRoleService {
|
|||
* 查询用户与部门及部门内角色关联列表
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param deptId 组织Id
|
||||
* @param roleId 角色Id
|
||||
* @param deptId 组织Id
|
||||
* @param roleId 角色Id
|
||||
* @return 用户与部门及部门内角色关联
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -124,10 +124,7 @@ public class SysUserDeptRoleServiceImpl implements ISysUserDeptRoleService {
|
|||
}
|
||||
for (Long userId : userIds) {
|
||||
SysUserDeptRole userIdentify = sysUserDeptRoleMapper.selectSysUserDeptRoleByUserIdAndDeptId(userId, deptId);
|
||||
if (userIdentify != null) {
|
||||
updateUserGitLinkRole(userId, deptId, userIdentify.getRoleId(), null, OPERATE_REMOVE);
|
||||
}
|
||||
|
||||
updateUserGitLinkRole(userId, deptId, userIdentify.getRoleId(), null, OPERATE_REMOVE);
|
||||
}
|
||||
int success = deleteUserIdentityByDeptIdAndUserIds(sysDept, userIds);
|
||||
for (Long userId : userIds) {
|
||||
|
|
@ -169,11 +166,8 @@ public class SysUserDeptRoleServiceImpl implements ISysUserDeptRoleService {
|
|||
if (sysUser == null) {
|
||||
return;
|
||||
}
|
||||
String redisKey = CacheConstants.getUserIdentifyListKey(sysUser.getUserName());
|
||||
// 删除缓存中该用户身份列表信息
|
||||
redisService.deleteObject(CacheConstants.getUserIdentifyListKey(redisKey));
|
||||
List<SysUserDeptRole> userIdentifyList = selectSysUserDeptRoleListByUserName(sysUser.getUserName());
|
||||
redisService.setCacheObject(redisKey, userIdentifyList);
|
||||
redisService.deleteObject(CacheConstants.getUserIdentifyListKey(sysUser.getUserName()));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -237,13 +231,8 @@ public class SysUserDeptRoleServiceImpl implements ISysUserDeptRoleService {
|
|||
if (secondaryDeptIds == null) {
|
||||
return;
|
||||
}
|
||||
SysDept parentDept = sysDeptMapper.selectDeptById(dept.getParentId());
|
||||
if (parentDept == null) {
|
||||
return;
|
||||
}
|
||||
if (dept.getParentId() == 0L || (parentDept.getParentId() == 0L && dept.getDeptType() == CacheConstants.DEPT_TYPE_TSZQ)) {
|
||||
remoteCmsService.changeUserOrgRole(userId, operate, SecurityConstants.INNER);
|
||||
} else if (!secondaryDeptIds.contains(dept.getDeptId())) {
|
||||
|
||||
if (!secondaryDeptIds.contains(dept.getDeptId())) {
|
||||
if (secondaryDeptIds.contains(dept.getParentId())) {
|
||||
switch (dept.getDeptType()) {
|
||||
case CacheConstants.DEPT_TYPE_TSZQ: {
|
||||
|
|
@ -579,17 +568,6 @@ public class SysUserDeptRoleServiceImpl implements ISysUserDeptRoleService {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean checkUserInDeptOrParentDeptHasPerms(Long deptId, Long userId, String perms) {
|
||||
int hasPermsCount = sysUserDeptRoleMapper.selectUserInDeptOrParentDeptHasPermsCount(deptId, userId, perms);
|
||||
return hasPermsCount > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUserDeptRole getSysUserDeptRoleByDeptIdAndUserId(Long deptId, Long userId) {
|
||||
return sysUserDeptRoleMapper.selectSysUserDeptRoleByUserIdAndDeptId(userId, deptId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean checkUserInDept(Long currentDeptId, Long userId) {
|
||||
SysUserDeptRole sysUserDeptRole = sysUserDeptRoleMapper.selectSysUserDeptRoleByUserIdAndDeptId(userId, currentDeptId);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,10 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.validation.Validator;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -681,9 +684,4 @@ public class SysUserServiceImpl implements ISysUserService {
|
|||
return sysUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> selectUserListFromUserIds(Long[] userIds) {
|
||||
return userMapper.selectUserListFromUserIds(userIds);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,24 +121,19 @@ public class SyncGitLinkUserInfoJob {
|
|||
for (ForgeUserAction forgeUserAction : forgeUserActionList) {
|
||||
String userActionDataBank = forgeUserAction.getDataBank();
|
||||
if (StringUtils.isNotEmpty(userActionDataBank)) {
|
||||
try {
|
||||
JSONObject jsonObject = JSON.parseObject(userActionDataBank);
|
||||
if (jsonObject != null) {
|
||||
Long userId = jsonObject.getLong("id");
|
||||
if (userId != null) {
|
||||
SysUser sysUser = sysUserMapper.selectUserByGitLinkUserId(forgeUserAction.getUserId());
|
||||
if (sysUser != null && UserConstants.DEL_FLAG_FALSE.equals(sysUser.getDelFlag())) {
|
||||
log.info("检测到用户{}在Forge端已注销,将该用户在微服务平台的所有身份标记为已注销同时逻辑删除该用户", sysUser.getUserName());
|
||||
// 更新用户所有身份为已注销
|
||||
sysUserDeptRoleService.deleteSysUserDeptRoleByDeleteUser(sysUser.getUserId());
|
||||
// 逻辑删除该用户
|
||||
sysUserService.deleteUserById(sysUser.getUserId());
|
||||
}
|
||||
JSONObject jsonObject = JSON.parseObject(userActionDataBank);
|
||||
if (jsonObject != null) {
|
||||
Long userId = jsonObject.getLong("id");
|
||||
if (userId != null) {
|
||||
SysUser sysUser = sysUserMapper.selectUserByGitLinkUserId(forgeUserAction.getUserId());
|
||||
if (sysUser != null && UserConstants.DEL_FLAG_FALSE.equals(sysUser.getDelFlag())) {
|
||||
log.info("检测到用户{}在Forge端已注销,将该用户在微服务平台的所有身份标记为已注销同时逻辑删除该用户", sysUser.getUserName());
|
||||
// 更新用户所有身份为已注销
|
||||
sysUserDeptRoleService.deleteSysUserDeptRoleByDeleteUser(sysUser.getUserId());
|
||||
// 逻辑删除该用户
|
||||
sysUserService.deleteUserById(sysUser.getUserId());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("解析Forge用户操作JSON失败,forgeUserActionId: {}, userId: {}, dataBank: {}, 错误信息: {}",
|
||||
forgeUserAction.getId(), forgeUserAction.getUserId(), userActionDataBank, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -234,18 +234,6 @@
|
|||
and udr.dept_id = #{deptId}
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectUserInDeptOrParentDeptHasPermsCount" resultType="java.lang.Integer">
|
||||
SELECT count(DISTINCT sm.menu_id)
|
||||
FROM sys_menu sm
|
||||
INNER JOIN sys_role_menu srm ON sm.menu_id = srm.menu_id
|
||||
INNER JOIN sys_user_dept_role sudr ON srm.role_id = sudr.role_id
|
||||
CROSS JOIN (SELECT CONCAT(ancestors, ',', dept_id) AS dept_ancestors
|
||||
FROM sys_dept
|
||||
WHERE dept_id = #{deptId}) vars
|
||||
WHERE sudr.user_id = #{userId}
|
||||
AND FIND_IN_SET(sudr.dept_id, vars.dept_ancestors)
|
||||
AND sm.perms = #{perms};
|
||||
</select>
|
||||
|
||||
<insert id="insertSysUserDeptRole" parameterType="com.microservices.system.api.domain.SysUserDeptRole">
|
||||
insert into sys_user_dept_role
|
||||
|
|
|
|||
|
|
@ -200,15 +200,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where u.gitlink_user_id = #{gitLinkUserId}
|
||||
limit 1
|
||||
</select>
|
||||
<select id="selectUserListFromUserIds" resultMap="SysUserResult">
|
||||
<include refid="selectOnlyUserVo"/>
|
||||
where user_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
insert into sys_user(
|
||||
<if test="userId != null and userId != 0">user_id,</if>
|
||||
<if test="gitlinkUserId != null and gitlinkUserId != 0">gitlink_user_id,</if>
|
||||
|
|
|
|||
|
|
@ -54,12 +54,6 @@
|
|||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Microservices Common Redis -->
|
||||
<dependency>
|
||||
<groupId>com.microservices</groupId>
|
||||
<artifactId>microservices-common-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Microservices Common Async -->
|
||||
<dependency>
|
||||
<groupId>com.microservices</groupId>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.microservices.zone.common.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.web.controller.BaseController;
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
import com.microservices.common.core.web.domain.GenericsAjaxResult;
|
||||
|
|
@ -11,26 +10,15 @@ import com.microservices.common.security.annotation.RequiresPermissions;
|
|||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.zone.detail.domain.vo.ZoneFrontRoleVo;
|
||||
import com.microservices.zone.detail.service.IZoneDetailService;
|
||||
import com.microservices.zone.project.domain.vo.*;
|
||||
import com.microservices.zone.project.service.IZoneProjectService;
|
||||
import com.microservices.zone.member.service.IZonePointsAccountService;
|
||||
import com.microservices.zone.project.service.IZoneProjectTypeService;
|
||||
import com.microservices.zone.resource.domain.ZoneResource;
|
||||
import com.microservices.zone.utils.ZoneConstants;
|
||||
import com.microservices.zone.resource.domain.vo.ZoneResourceDataVo;
|
||||
import com.microservices.zone.resource.domain.vo.ZoneResourceInputVo;
|
||||
import com.microservices.zone.resource.domain.vo.ZoneResourceSearchVo;
|
||||
import com.microservices.zone.resource.domain.vo.ZoneResourceUpdateVo;
|
||||
import com.microservices.zone.resource.domain.vo.*;
|
||||
import com.microservices.zone.resource.service.IAiSkillParseService;
|
||||
import com.microservices.zone.resource.service.IZoneResourceService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* @author otto
|
||||
|
|
@ -44,17 +32,11 @@ public class FrontController extends BaseController {
|
|||
private IZoneResourceService zoneResourceService;
|
||||
|
||||
@Autowired
|
||||
private IZoneProjectService zoneProjectService;
|
||||
private IAiSkillParseService aiSkillParseService;
|
||||
|
||||
@Autowired
|
||||
private IZoneDetailService zoneDetailService;
|
||||
|
||||
@Autowired
|
||||
private IZoneProjectTypeService zoneProjectTypeService;
|
||||
|
||||
@Autowired
|
||||
private IZonePointsAccountService zonePointsAccountService;
|
||||
|
||||
/**
|
||||
* 查询我的资源列表
|
||||
*/
|
||||
|
|
@ -111,72 +93,6 @@ public class FrontController extends BaseController {
|
|||
return toAjax(zoneResourceService.deleteMyZoneResourceByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询GitLink项目列表
|
||||
*/
|
||||
@GetMapping("/zone/{zoneId}/myGitlinkProjectList")
|
||||
@ApiOperation("查询专区下我的GitLink项目列表")
|
||||
public GenericsTableDataInfo<JSONObject> selectMyGitlinkProjectListByZone(
|
||||
@ApiParam(name = "zoneId", value = "专区Id") @PathVariable Long zoneId
|
||||
, MyGitLinkProjectSearchVo myGitLinkProjectSearchVo) {
|
||||
return zoneProjectService.selectMyGitlinkProjectListByZone(zoneId, myGitLinkProjectSearchVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我的项目列表
|
||||
*/
|
||||
@RequiresPermissions("zone:front:project:myList")
|
||||
@GetMapping("/myProjectList")
|
||||
@ApiOperation(value = "查询我的项目聚合列表")
|
||||
public GenericsTableDataInfo<ZoneProjectDataVo> myProjectList(ZoneProjectSearchVo zoneProjectSearchVo) {
|
||||
zoneProjectSearchVo.setCreateBy(SecurityUtils.getUsername());
|
||||
return zoneProjectService.selectMyZoneProjectList(zoneProjectSearchVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我的项目详情
|
||||
*/
|
||||
@RequiresPermissions("zone:front:project:query")
|
||||
@GetMapping("/myProject/{id}")
|
||||
@ApiOperation(value = "查询我的项目聚合详情")
|
||||
public GenericsAjaxResult<ZoneProjectDataVo> myProject(@PathVariable("id") Long id) {
|
||||
return genericsSuccess(zoneProjectService.selectZoneProjectDataById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增项目
|
||||
*/
|
||||
@RequiresPermissions("zone:front:project:add")
|
||||
@Log(title = "专区前台项目操作", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/addProject")
|
||||
@ApiOperation(value = "新增项目聚合")
|
||||
public AjaxResult addProject(@RequestBody @Validated List<ZoneProjectInputVo> zoneProjectInputVoList) {
|
||||
return success(zoneProjectService.insertBatchZoneProject(zoneProjectInputVoList));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑项目
|
||||
*/
|
||||
@RequiresPermissions("zone:front:project:edit")
|
||||
@Log(title = "专区前台项目操作", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/editProject/{projectId}")
|
||||
@ApiOperation(value = "编辑项目聚合")
|
||||
public AjaxResult editProject(@PathVariable("projectId") Long projectId,@RequestBody ZoneProjectFrontUpdateVo zoneProjectFrontUpdateVo) {
|
||||
return success(zoneProjectService.updateMyZoneProject(projectId, zoneProjectFrontUpdateVo.toZoneProjectUpdateVo()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除项目
|
||||
*/
|
||||
@RequiresPermissions("zone:front:project:remove")
|
||||
@Log(title = "专区前台项目操作", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/removeProject/{ids}")
|
||||
@ApiOperation(value = "删除项目聚合")
|
||||
public AjaxResult removeProject(@PathVariable Long[] ids) {
|
||||
return toAjax(zoneProjectService.deleteMyZoneProjectByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查当前登录用户在当前专区下角色
|
||||
*/
|
||||
|
|
@ -187,11 +103,81 @@ public class FrontController extends BaseController {
|
|||
"3、当权限为None时,不展示前台操作按钮\n" +
|
||||
"4、检测到用户登录后才能调用该接口,否则不展示前台操作按钮")
|
||||
public GenericsAjaxResult<ZoneFrontRoleVo> checkCurrentRole(@PathVariable Long zoneId) {
|
||||
ZoneFrontRoleVo zoneFrontRoleVo = zoneDetailService.checkCurrentRoleInZone(zoneId);
|
||||
// 专区普通会员,触发每日首次访问积分+1
|
||||
if (ZoneConstants.FRONT_ROLE_MEMBER.equals(zoneFrontRoleVo.getRole())) {
|
||||
zonePointsAccountService.addDailyVisitPointsAsync(zoneId);
|
||||
}
|
||||
return genericsSuccess(zoneFrontRoleVo);
|
||||
return genericsSuccess(zoneDetailService.checkCurrentRoleInZone(zoneId));
|
||||
}
|
||||
|
||||
// ==================== Skill资源广场 - 我的资源管理 ====================
|
||||
|
||||
/**
|
||||
* 上传ZIP并解析
|
||||
*/
|
||||
// @RequiresPermissions("zone:front:skill:add")
|
||||
@PostMapping("/skill/parse")
|
||||
@ApiOperation("上传ZIP并解析Skill包")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "file", value = "文件实体", paramType = "form", dataType = "_file"),
|
||||
})
|
||||
public GenericsAjaxResult<AiSkillParseResultVo> parseSkillZip(@RequestPart("file") MultipartFile file) {
|
||||
return genericsSuccess(aiSkillParseService.parseSkillZip(file));
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建Skill资源
|
||||
*/
|
||||
// @RequiresPermissions("zone:front:skill:add")
|
||||
@Log(title = "创建Skill资源", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/skill")
|
||||
@ApiOperation("创建Skill资源")
|
||||
public AjaxResult addSkill(@RequestBody @Validated AiSkillInputVo inputVo) {
|
||||
return success(zoneResourceService.insertAiSkillResource(inputVo));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 重新提交被驳回的Skill资源
|
||||
*/
|
||||
// @RequiresPermissions("zone:front:skill:add")
|
||||
@Log(title = "重新提交Skill资源", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/skillResource/{id}/resubmit")
|
||||
@ApiOperation(value = "重新提交被驳回的资源")
|
||||
public AjaxResult resubmitAiResource(
|
||||
@ApiParam(value = "资源ID", required = true) @PathVariable("id") Long id) {
|
||||
return toAjax(zoneResourceService.resubmitAiResource(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤回审核中的Skill资源
|
||||
*/
|
||||
// @RequiresPermissions("zone:front:skill:edit")
|
||||
@Log(title = "撤回Skill资源", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/skillResource/{id}/withdraw")
|
||||
@ApiOperation(value = "撤回审核中的资源")
|
||||
public AjaxResult withdrawAiResource(
|
||||
@ApiParam(value = "资源ID", required = true) @PathVariable("id") Long id) {
|
||||
return toAjax(zoneResourceService.withdrawAiResource(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下架资源
|
||||
*/
|
||||
// @RequiresPermissions("ai:resource:audit")
|
||||
@Log(title = "下架资源", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{id}/takeDown")
|
||||
@ApiOperation("下架资源")
|
||||
public AjaxResult takeDownResource(
|
||||
@ApiParam(value = "资源ID", required = true) @PathVariable("id") Long id,
|
||||
@RequestParam(value = "reason", required = false) String reason) {
|
||||
return toAjax(zoneResourceService.takeDownAiResource(id, reason));
|
||||
}
|
||||
/**
|
||||
* 点赞/取消点赞
|
||||
*/
|
||||
// @RequiresPermissions("ai:resource:skill:query")
|
||||
@PostMapping("/{id}/like")
|
||||
@ApiOperation("点赞/取消点赞AI资源")
|
||||
public AjaxResult toggleLike(
|
||||
@ApiParam(value = "资源ID", required = true) @PathVariable("id") Long id) {
|
||||
boolean liked = zoneResourceService.toggleAiResourceLike(id);
|
||||
return success(liked ? "已点赞" : "已取消点赞");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.microservices.zone.common.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.common.core.web.controller.BaseController;
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
|
|
@ -17,15 +16,13 @@ import com.microservices.zone.dataset.service.IZoneDataSetService;
|
|||
import com.microservices.zone.detail.domain.vo.ZoneBaseDataVo;
|
||||
import com.microservices.zone.detail.domain.vo.ZoneDetailDataVo;
|
||||
import com.microservices.zone.detail.service.IZoneDetailService;
|
||||
import com.microservices.zone.journals.domain.ZoneJournals;
|
||||
import com.microservices.zone.journals.domain.vo.ZoneJournalsParentDataVo;
|
||||
import com.microservices.zone.journals.domain.vo.ZoneJournalsSearchVo;
|
||||
import com.microservices.zone.member.domain.vo.ZoneMemberDataVo;
|
||||
import com.microservices.zone.member.domain.vo.ZoneMemberOpenSearchVo;
|
||||
import com.microservices.zone.member.domain.vo.ZoneMemberOverviewVo;
|
||||
import com.microservices.zone.member.domain.vo.ZoneMemberSearchVo;
|
||||
import com.microservices.zone.member.domain.vo.ZoneMemberTypeCountVo;
|
||||
import com.microservices.zone.member.domain.vo.ZonePointsTopDocVo;
|
||||
import com.microservices.zone.member.service.IZoneMemberService;
|
||||
import com.microservices.zone.member.service.IZoneMemberTypeService;
|
||||
import com.microservices.zone.member.service.IZonePointsAccountService;
|
||||
import com.microservices.zone.partners.domain.vo.ZonePartnersOverviewVo;
|
||||
import com.microservices.zone.partners.service.IZonePartnersService;
|
||||
import com.microservices.zone.project.domain.ZoneProjectType;
|
||||
|
|
@ -35,17 +32,15 @@ import com.microservices.zone.project.domain.vo.ZoneProjectSearchVo;
|
|||
import com.microservices.zone.project.domain.vo.ZoneStatisticsVo;
|
||||
import com.microservices.zone.project.service.IZoneProjectService;
|
||||
import com.microservices.zone.project.service.IZoneProjectTypeService;
|
||||
import com.microservices.zone.resource.domain.ZoneResource;
|
||||
import com.microservices.zone.resource.domain.ZoneResourceDomain;
|
||||
import com.microservices.zone.resource.domain.ZoneResourceType;
|
||||
import com.microservices.zone.resource.domain.vo.ZoneResourceDataVo;
|
||||
import com.microservices.zone.resource.domain.vo.ZoneResourceOpenSearchVo;
|
||||
import com.microservices.zone.resource.enums.AiResourceType;
|
||||
import com.microservices.zone.resource.service.IZoneResourceDomainService;
|
||||
import com.microservices.zone.resource.service.IZoneResourceService;
|
||||
import com.microservices.zone.resource.service.IZoneResourceTypeService;
|
||||
import com.microservices.zone.search.dto.GlobalSearchRequest;
|
||||
import com.microservices.zone.search.dto.GlobalSearchResponse;
|
||||
import com.microservices.zone.search.dto.GlobalSearchResult;
|
||||
import com.microservices.zone.search.service.IGlobalSearchService;
|
||||
import com.microservices.zone.specialProject.domain.ZoneSpecialProject;
|
||||
import com.microservices.zone.specialProject.domain.ZoneSpecialProjectRelevancy;
|
||||
import com.microservices.zone.specialProject.domain.ZoneSpecialProjectReport;
|
||||
|
|
@ -63,7 +58,6 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -79,8 +73,6 @@ public class OpenController extends BaseController {
|
|||
@Autowired
|
||||
private IZoneMemberService zoneMemberService;
|
||||
@Autowired
|
||||
private IZoneMemberTypeService zoneMemberTypeService;
|
||||
@Autowired
|
||||
private IZonePartnersService zonePartnersService;
|
||||
@Autowired
|
||||
private IZoneProjectService zoneProjectService;
|
||||
|
|
@ -89,8 +81,6 @@ public class OpenController extends BaseController {
|
|||
@Autowired
|
||||
private IZoneDetailService zoneDetailService;
|
||||
@Autowired
|
||||
private IZonePointsAccountService zonePointsAccountService;
|
||||
@Autowired
|
||||
private IZoneResourceService zoneResourceService;
|
||||
@Autowired
|
||||
private IZoneDataSetService zoneDataSetService;
|
||||
|
|
@ -225,27 +215,6 @@ public class OpenController extends BaseController {
|
|||
return genericsSuccess(zoneDetailService.getZoneStatistics(zoneId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询专区置顶文章列表(含首页推荐文章,去重,置顶在前)
|
||||
*/
|
||||
@GetMapping("/getTopDoc/{zoneId}")
|
||||
@ApiOperation(value = "查询专区置顶文章列表(含首页推荐,去重)")
|
||||
public GenericsAjaxResult<List<ZonePointsTopDocVo>> getTopDoc(@PathVariable("zoneId") Long zoneId) {
|
||||
return genericsSuccess(zonePointsAccountService.selectHomePageDocMergeList(zoneId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询专区置顶项目列表
|
||||
*/
|
||||
@GetMapping("/getTopProject/{zoneId}")
|
||||
@ApiOperation(value = "查询专区置顶项目列表")
|
||||
public GenericsAjaxResult<List<ZoneProjectDataVo>> getTopProject(@PathVariable("zoneId") Long zoneId) {
|
||||
if (!zoneDetailService.isPointsZone(zoneId)) {
|
||||
return genericsSuccess(Collections.emptyList());
|
||||
}
|
||||
return genericsSuccess(zoneProjectService.selectTopProjectList(zoneId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询特色专区项目分类列表
|
||||
*/
|
||||
|
|
@ -280,41 +249,6 @@ public class OpenController extends BaseController {
|
|||
return getGenericsDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取特色专区会员分类列表(含各分类下已审核会员数量)
|
||||
*/
|
||||
@GetMapping("/{zoneId}/memberType/list")
|
||||
@ApiOperation("获取特色专区会员分类列表(含已审核会员数量)")
|
||||
public GenericsTableDataInfo<ZoneMemberTypeCountVo> memberTypeList(
|
||||
@ApiParam(name = "zoneId", value = "专区Id", required = true) @PathVariable("zoneId") Long zoneId,
|
||||
@ApiParam(name = "name", value = "会员分类名称") String name) {
|
||||
List<ZoneMemberTypeCountVo> list = zoneMemberTypeService.selectZoneMemberTypeListWithCount(zoneId, name);
|
||||
return getGenericsDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取特色专区会员列表(仅已审核会员,支持名称模糊搜索及分类/等级过滤)
|
||||
*/
|
||||
@GetMapping("/{zoneId}/member/list")
|
||||
@ApiOperation("获取特色专区会员列表")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNum", value = "当前页码", paramType = "query", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示记录数(未传默认100)", paramType = "query", dataType = "Integer")
|
||||
})
|
||||
public GenericsTableDataInfo<ZoneMemberDataVo> memberList(
|
||||
@ApiParam(name = "zoneId", value = "专区Id", required = true) @PathVariable("zoneId") Long zoneId,
|
||||
ZoneMemberSearchVo zoneMemberSearchVo,
|
||||
@RequestParam(value = "pageNum", required = false) Integer pageNum,
|
||||
@RequestParam(value = "pageSize", required = false) Integer pageSize) {
|
||||
zoneMemberSearchVo.setZoneId(zoneId);
|
||||
if (pageNum == null || pageNum < 1) {
|
||||
pageNum = 1;
|
||||
}
|
||||
int effectivePageSize = (pageSize == null || pageSize < 1) ? 100 : pageSize;
|
||||
PageHelper.startPage(pageNum, effectivePageSize);
|
||||
return zoneMemberService.selectOpenZoneMemberList(zoneMemberSearchVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查当前用户是否有该专区的权限
|
||||
*/
|
||||
|
|
@ -482,19 +416,66 @@ public class OpenController extends BaseController {
|
|||
return getGenericsDataTable(list);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private IGlobalSearchService globalSearchService;
|
||||
// ==================== AI资源广场 - 开放接口 ====================
|
||||
|
||||
/**
|
||||
* 全局搜索接口(POST方法)
|
||||
*
|
||||
* @return 搜索结果
|
||||
* 广场首页-Skill推荐列表(前4名)
|
||||
*/
|
||||
@ApiOperation("全局搜索")
|
||||
@PostMapping("/global")
|
||||
public GenericsTableDataInfo<GlobalSearchResult> globalSearch(@RequestBody GlobalSearchRequest globalSearchRequest) {
|
||||
logger.info("全局搜索请求: keyword={}, types={}", globalSearchRequest.getKeyword(), globalSearchRequest.getTypes());
|
||||
GlobalSearchResponse response = globalSearchService.globalSearch(globalSearchRequest);
|
||||
return new GenericsTableDataInfo<>(response.getResults(), response.getTotal());
|
||||
@GetMapping("/ai-square/skills")
|
||||
@ApiOperation("广场首页-Skill推荐列表")
|
||||
public GenericsAjaxResult<List<ZoneResourceDataVo>> skillRecommendations() {
|
||||
return genericsSuccess(zoneResourceService.selectSkillRecommendations(4));
|
||||
}
|
||||
|
||||
/**
|
||||
* 公开-Skill详情
|
||||
*/
|
||||
@GetMapping("/ai-square/skill/{id}")
|
||||
@ApiOperation("公开-Skill详情")
|
||||
public GenericsAjaxResult<ZoneResourceDataVo> skillDetail(
|
||||
@ApiParam(name = "id", value = "资源ID", required = true) @PathVariable("id") Long id) {
|
||||
// 增加浏览次数
|
||||
zoneResourceService.incrementViewCount(id);
|
||||
return genericsSuccess(zoneResourceService.selectAiSkillResourceById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 公开-Skill列表(搜索)
|
||||
*/
|
||||
@GetMapping("/ai-square/skill/list")
|
||||
@ApiOperation("公开-Skill列表搜索")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNum", value = "当前记录起始索引", paramType = "query", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示记录数", paramType = "query", dataType = "Integer")
|
||||
})
|
||||
public GenericsTableDataInfo<ZoneResourceDataVo> skillList(ZoneResource zoneResource) {
|
||||
// 公开接口只查询已发布的
|
||||
zoneResource.setAuditStatus("1");
|
||||
zoneResource.setResourceCategory(AiResourceType.SKILL.getCode());
|
||||
startPage();
|
||||
return zoneResourceService.selectAiSkillResourceList(zoneResource);
|
||||
}
|
||||
|
||||
// ==================== 通用评论 - 开放接口 ====================
|
||||
|
||||
@Autowired
|
||||
private com.microservices.zone.journals.service.IZoneJournalsService zoneJournalsService;
|
||||
|
||||
/**
|
||||
* 公开-资源评论列表
|
||||
*/
|
||||
@GetMapping("/ai-square/{resourceId}/journals")
|
||||
@ApiOperation("公开-资源评论列表")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNum", value = "当前记录起始索引", paramType = "query", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示记录数", paramType = "query", dataType = "Integer")
|
||||
})
|
||||
public GenericsTableDataInfo<ZoneJournalsParentDataVo> journalsList(
|
||||
@ApiParam(name = "resourceId", value = "资源ID", required = true) @PathVariable("resourceId") Long resourceId,
|
||||
ZoneJournalsSearchVo searchVo) {
|
||||
searchVo.setJournalized_id(resourceId);
|
||||
searchVo.setJournalized_type(ZoneJournals.JOURNAL_TYPE_AI_SKILL);
|
||||
startPage();
|
||||
return new GenericsTableDataInfo<>(zoneJournalsService.selectJournalsList(searchVo));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
package com.microservices.zone.common.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.zone.detail.domain.ZoneDetail;
|
||||
import com.microservices.zone.project.domain.ZoneProject;
|
||||
import com.microservices.zone.resource.domain.ZoneResourceType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 特色专区异步Service接口
|
||||
*
|
||||
|
|
@ -54,16 +51,4 @@ public interface IZoneAsyncService {
|
|||
void setProjectGitlinkInfoCache(ZoneProject zoneProject);
|
||||
|
||||
void clearZoneProjectSortByScoreCache(ZoneProject zoneProject);
|
||||
|
||||
List<JSONObject> getGitlinkProjectsDetail(List<String> gitLinkProjectIdList);
|
||||
|
||||
/**
|
||||
* 异步发放项目审核通过积分
|
||||
*
|
||||
* @param zoneId 专区ID
|
||||
* @param createBy 项目创建人用户名
|
||||
* @param projectId 项目ID
|
||||
* @param projectName 项目名称
|
||||
*/
|
||||
void addPublishProjectPointsAsync(Long zoneId, String createBy, Long projectId, String projectName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.microservices.zone.common.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.constant.CacheConstants;
|
||||
|
|
@ -11,7 +10,6 @@ import com.microservices.common.core.utils.StringUtils;
|
|||
import com.microservices.common.httpClient.util.GitLinkRequestHelper;
|
||||
import com.microservices.common.redis.service.RedisService;
|
||||
import com.microservices.system.api.RemoteCmsService;
|
||||
import com.microservices.system.api.RemoteUserService;
|
||||
import com.microservices.system.api.utils.FeignUtils;
|
||||
import com.microservices.zone.common.service.IZoneAsyncService;
|
||||
import com.microservices.zone.detail.domain.ZoneDetail;
|
||||
|
|
@ -62,10 +60,12 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -80,8 +80,6 @@ public class ZoneAsyncServiceImpl implements IZoneAsyncService {
|
|||
@Autowired
|
||||
private RemoteCmsService remoteCmsService;
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private IZoneProjectTypeService zoneProjectTypeService;
|
||||
@Autowired
|
||||
|
|
@ -144,21 +142,6 @@ public class ZoneAsyncServiceImpl implements IZoneAsyncService {
|
|||
|
||||
@Value("${zone.needCalcScoreZoneIds:}")
|
||||
private String needCalcScoreZoneIds;
|
||||
|
||||
@Value("${zone.pointsDeptId:0}")
|
||||
private Long pointsDeptId;
|
||||
|
||||
/**
|
||||
* 项目启动时,初始化积分部门ID到缓存
|
||||
*/
|
||||
@PostConstruct
|
||||
public void initPointsDeptId() {
|
||||
if (pointsDeptId != null && pointsDeptId > 0) {
|
||||
redisService.setCacheObject(CacheConstants.ZONE_POINTS_DEPT_ID_KEY, pointsDeptId);
|
||||
logger.info("积分部门ID初始化到缓存完成,pointsDeptId={}", pointsDeptId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建线程池
|
||||
* 初始化专区耗时长在初始化文章,经实验在文章初始化完成前其他步骤均已执行完成,故设核心线程数为2
|
||||
|
|
@ -170,11 +153,11 @@ public class ZoneAsyncServiceImpl implements IZoneAsyncService {
|
|||
* Nthreads =Ncpu*Ucpu*(1+W/C)
|
||||
*/
|
||||
static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
|
||||
5
|
||||
2
|
||||
, 10
|
||||
, 10
|
||||
, TimeUnit.SECONDS
|
||||
, new ArrayBlockingQueue<>(10000)
|
||||
, new ArrayBlockingQueue<>(100)
|
||||
, Executors.defaultThreadFactory()
|
||||
, (r, executor) -> {
|
||||
throw new ServiceException("【%s】目前创建的人太多了,请稍后再试", DateUtils.getNowDate());
|
||||
|
|
@ -485,6 +468,11 @@ public class ZoneAsyncServiceImpl implements IZoneAsyncService {
|
|||
List<ZoneProject> zoneProjectList = zoneProjectMapper.selectZoneProjectList(zoneProjectSearchVo);
|
||||
for (ZoneProject zoneProject : zoneProjectList) {
|
||||
setProjectGitlinkInfoCache(zoneProject);
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
} catch (InterruptedException e) {
|
||||
logger.error("初始化gitlink项目统计的定时任务延时被中断");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -534,44 +522,6 @@ public class ZoneAsyncServiceImpl implements IZoneAsyncService {
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> getGitlinkProjectsDetail(List<String> gitLinkProjectIdList) {
|
||||
int total = gitLinkProjectIdList.size();
|
||||
if (total == 0) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 向上取整分片:修复原 size/50+1 在整除时多出一个空分片(会发出一次 ids 为空的请求)
|
||||
int queryCount = (total + 49) / 50;
|
||||
CountDownLatch countDownLatch = new CountDownLatch(queryCount);
|
||||
// 使用线程安全的 ConcurrentLinkedQueue 收集结果:修复原 ArrayList 在多线程并发 addAll 下丢数据/越界的隐患
|
||||
ConcurrentLinkedQueue<JSONObject> gitLinkProjectQueue = new ConcurrentLinkedQueue<>();
|
||||
for (int i = 0; i < queryCount; i++) {
|
||||
int finalI = i;
|
||||
threadPoolExecutor.execute(() -> {
|
||||
try {
|
||||
int pageMaxCount = Math.min((finalI + 1) * 50, total);
|
||||
List<String> tmpIdList = gitLinkProjectIdList.subList(finalI * 50, pageMaxCount);
|
||||
JSONObject result = gitLinkRequestHelper.doGet(
|
||||
ZoneGitLinkRequestUrl.PROJECTS("?ids=" + String.join(ZoneConstants.ARRAY_SPLIT_SYMBOLS, tmpIdList))
|
||||
);
|
||||
|
||||
gitLinkProjectQueue.addAll(result.getList(ZoneConstants.GITLINK_RESPONSE_PROJECTS_KEY, JSONObject.class));
|
||||
} catch (Exception e) {
|
||||
logger.error("异步批量获取项目详细信息失败:{}", e.getMessage());
|
||||
} finally {
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
});
|
||||
}
|
||||
try {
|
||||
countDownLatch.await();
|
||||
} catch (InterruptedException e) {
|
||||
logger.error("根据gitlinkProjectId调用Gitlink接口批量获取项目详细信息失败:{}", e.getMessage());
|
||||
throw new ServiceException("获取平台项目详细信息失败");
|
||||
}
|
||||
return new ArrayList<>(gitLinkProjectQueue);
|
||||
}
|
||||
|
||||
private Double calcProjectScore(ZoneProject zoneProject, String startDate, String endDate) {
|
||||
Double theWeekScore = forgeProjectStatisticsMapper
|
||||
.selectLastWeekScoreByProjectId(zoneProject.getGitlinkProjectId(), startDate, endDate);
|
||||
|
|
@ -587,35 +537,4 @@ public class ZoneAsyncServiceImpl implements IZoneAsyncService {
|
|||
return theWeekScore;
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void addPublishProjectPointsAsync(Long zoneId, String createBy, Long projectId, String projectName) {
|
||||
try {
|
||||
if (zoneId == null || createBy == null) {
|
||||
logger.warn("项目审核通过增加积分失败,zoneId或createBy为空,projectId={}", projectId);
|
||||
return;
|
||||
}
|
||||
// 获取用户ID
|
||||
com.microservices.system.api.domain.SysUser sysUser = FeignUtils.getReturnData(
|
||||
remoteUserService.getSysUserByUserName(createBy, SecurityConstants.INNER));
|
||||
if (sysUser == null || sysUser.getUserId() == null) {
|
||||
logger.warn("项目审核通过增加积分失败,未找到用户信息,createBy={},projectId={}", createBy, projectId);
|
||||
return;
|
||||
}
|
||||
|
||||
// 写入 Redis 积分队列
|
||||
JSONObject task = new JSONObject();
|
||||
task.put("sourceType", ZoneConstants.PublishProject.SOURCE_TYPE);
|
||||
task.put("userId", sysUser.getUserId());
|
||||
task.put("zoneId", zoneId);
|
||||
task.put("sourceId", projectId);
|
||||
task.put("subjectDesc", projectName);
|
||||
task.put("operatorId", sysUser.getUserId());
|
||||
redisService.leftPush(ZoneConstants.ZONE_POINTS_ASYNC_QUEUE_KEY, JSON.toJSONString(task));
|
||||
logger.info("项目审核通过增加积分任务已提交 userId={} projectId={} projectName={}", sysUser.getUserId(), projectId, projectName);
|
||||
} catch (Exception e) {
|
||||
logger.error("项目审核通过增加积分任务提交失败 projectId={} error={}", projectId, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,11 +190,6 @@ public class ZoneDetail extends BaseEntity {
|
|||
@ApiModelProperty(value = "资源是否需要审核(0:不需要审核,1:需要审核)")
|
||||
private Integer resourceNeedAudit;
|
||||
|
||||
/**
|
||||
* 项目是否需要审核(0:不需要,1:需要)
|
||||
*/
|
||||
@ApiModelProperty(value = "项目是否需要审核(0:不需要审核,1:需要审核)")
|
||||
private Integer projectNeedAudit;
|
||||
|
||||
/**
|
||||
* 资讯是否锁定中(0:未锁定,1:锁定)
|
||||
|
|
|
|||
|
|
@ -155,12 +155,6 @@ public class ZoneDetailDataVo extends BaseEntity {
|
|||
@ApiModelProperty(value = "资源是否需要审核(0:不需要审核,1:需要审核)")
|
||||
private Integer resourceNeedAudit;
|
||||
|
||||
/**
|
||||
* 项目是否需要审核(0:不需要,1:需要)
|
||||
*/
|
||||
@ApiModelProperty(value = "项目是否需要审核(0:不需要审核,1:需要审核)")
|
||||
private Integer projectNeedAudit;
|
||||
|
||||
/**
|
||||
* 资讯是否锁定中(0:未锁定,1:锁定)
|
||||
*/
|
||||
|
|
@ -186,12 +180,6 @@ public class ZoneDetailDataVo extends BaseEntity {
|
|||
@ApiModelProperty(value = "会员板块是否展示(0:不展示,1:展示)")
|
||||
private Integer sectionMemberShow;
|
||||
|
||||
/**
|
||||
* 积分板块是否展示(0:不展示,1:展示)
|
||||
*/
|
||||
@ApiModelProperty(value = "积分板块是否展示(0:不展示,1:展示)")
|
||||
private Integer sectionPointsShow;
|
||||
|
||||
/**
|
||||
* 帮助中心板块是否展示(0:不展示,1:展示)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -123,12 +123,6 @@ public class ZoneDetailUpdateVo {
|
|||
@ApiModelProperty(value = "资源是否需要审核(0:不需要审核,1:需要审核)")
|
||||
private Integer resourceNeedAudit;
|
||||
|
||||
/**
|
||||
* 项目是否需要审核(0:不需要,1:需要)
|
||||
*/
|
||||
@ApiModelProperty(value = "项目是否需要审核(0:不需要审核,1:需要审核)")
|
||||
private Integer projectNeedAudit;
|
||||
|
||||
/**
|
||||
* 资讯是否锁定中(0:未锁定,1:锁定)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -20,12 +20,6 @@ public class ZoneFrontRoleVo {
|
|||
@ApiModelProperty(value = "资讯管理访问地址")
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String docManageUrl;
|
||||
@ApiModelProperty(value = "项目管理访问地址")
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String projectManageUrl;
|
||||
@ApiModelProperty(value = "用户访问组织Id")
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private Long deptId;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,7 +172,6 @@ public interface IZoneDetailService {
|
|||
|
||||
ZoneFrontRoleVo checkCurrentRoleInZone(Long zoneId);
|
||||
|
||||
ZoneFrontRoleVo checkUserRoleInZone(Long zoneId, Long userId);
|
||||
/**
|
||||
* 通过组织id锁定/解锁专区资讯
|
||||
*
|
||||
|
|
@ -236,20 +235,4 @@ public interface IZoneDetailService {
|
|||
ZoneDetail selectZoneDetailByIdNotVerifiedDataScope(Long zoneId);
|
||||
|
||||
ZoneStatisticsVo getZoneStatistics(Long zoneId);
|
||||
|
||||
/**
|
||||
* 计算专区统计数据(内部方法,用于定时任务调用)
|
||||
*
|
||||
* @param zoneId 专区ID
|
||||
* @return 统计数据
|
||||
*/
|
||||
ZoneStatisticsVo calculateZoneStatistics(Long zoneId);
|
||||
|
||||
/**
|
||||
* 判断专区是否为积分专区
|
||||
*
|
||||
* @param zoneId 专区ID
|
||||
* @return true=是积分专区,false=不是积分专区
|
||||
*/
|
||||
boolean isPointsZone(Long zoneId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,7 @@ import com.microservices.system.api.RemoteDeptService;
|
|||
import com.microservices.system.api.RemoteUserService;
|
||||
import com.microservices.system.api.domain.SysDept;
|
||||
import com.microservices.system.api.domain.SysDictData;
|
||||
import com.microservices.system.api.domain.SysUser;
|
||||
import com.microservices.system.api.domain.SysUserDeptRole;
|
||||
import com.microservices.system.api.model.LoginUser;
|
||||
import com.microservices.system.api.utils.FeignUtils;
|
||||
import com.microservices.zone.common.service.IZoneAsyncService;
|
||||
import com.microservices.zone.detail.domain.ZoneDetail;
|
||||
|
|
@ -33,14 +31,10 @@ import com.microservices.zone.detail.domain.vo.*;
|
|||
import com.microservices.zone.detail.mapper.ZoneDetailMapper;
|
||||
import com.microservices.zone.detail.service.IZoneDetailService;
|
||||
import com.microservices.zone.member.domain.ZoneMember;
|
||||
import com.microservices.zone.member.domain.ZoneMemberLevel;
|
||||
import com.microservices.zone.member.domain.ZoneMemberType;
|
||||
import com.microservices.zone.member.domain.vo.ZoneMemberInputVo;
|
||||
import com.microservices.zone.member.domain.vo.ZoneMemberSearchVo;
|
||||
import com.microservices.zone.member.mapper.ZoneMemberLevelMapper;
|
||||
import com.microservices.zone.member.mapper.ZoneMemberMapper;
|
||||
import com.microservices.zone.member.mapper.ZoneMemberTypeMapper;
|
||||
import com.microservices.zone.member.service.IZoneMemberService;
|
||||
import com.microservices.zone.partners.mapper.ZonePartnersMapper;
|
||||
import com.microservices.zone.partners.mapper.ZonePartnersTypeMapper;
|
||||
import com.microservices.zone.project.domain.ZoneProject;
|
||||
|
|
@ -56,7 +50,6 @@ import com.microservices.zone.resource.mapper.ZoneResourceTypeMapper;
|
|||
import com.microservices.zone.specialProject.domain.ZoneSpecialProject;
|
||||
import com.microservices.zone.specialProject.service.IZoneSpecialProjectService;
|
||||
import com.microservices.zone.utils.ZoneConstants;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
|
|
@ -68,7 +61,6 @@ import java.time.LocalDate;
|
|||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -78,7 +70,6 @@ import java.util.stream.Collectors;
|
|||
* @date 2023-05-09
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ZoneDetailServiceImpl implements IZoneDetailService {
|
||||
@Autowired
|
||||
private ZoneDetailMapper zoneDetailMapper;
|
||||
|
|
@ -115,32 +106,16 @@ public class ZoneDetailServiceImpl implements IZoneDetailService {
|
|||
@Autowired
|
||||
@Lazy
|
||||
private IZoneSpecialProjectService zoneSpecialProjectService;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private IZoneMemberService zoneMemberService;
|
||||
|
||||
@Value("${zone.zoneAdminUrl}")
|
||||
private String zoneAdminUrl;
|
||||
@Value("${zone.zoneConfigurationPath:/zone/configuration}")
|
||||
private String zoneConfigurationPath;
|
||||
@Value("${zone.zoneConfigurationUrl}")
|
||||
private String zoneConfigurationUrl;
|
||||
@Value("${zone.adminUrl}")
|
||||
private String adminUrl;
|
||||
@Value("${zone.resourceManagePath:/zone/resource/resource}")
|
||||
private String resourceManagePath;
|
||||
@Value("${zone.docManagePath:/zone/content/doc}")
|
||||
private String docManagePath;
|
||||
@Value("${zone.projectManagePath:/zone/project/list}")
|
||||
private String projectManagePath;
|
||||
@Value("${zone.resourceManageUrl}")
|
||||
private String resourceManageUrl;
|
||||
@Value("${zone.docManageUrl}")
|
||||
private String docManageUrl;
|
||||
@Value("${zone.autoMemberZoneIds:}")
|
||||
private String autoMemberZoneIds;
|
||||
@Value("${zone.autoMemberTypeName:}")
|
||||
private String autoMemberTypeName;
|
||||
@Value("${zone.autoMemberLevelName:}")
|
||||
private String autoMemberLevelName;
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
|
|
@ -302,16 +277,6 @@ public class ZoneDetailServiceImpl implements IZoneDetailService {
|
|||
throw new ServiceException("当前专区下存在待审核资源,需完成审核后才能将专区资源修改为不需要审核(专区名称[%s],待审核资源数量[%d])", oldZoneDetail.getName(), notAuditCount);
|
||||
}
|
||||
}
|
||||
// 专区项目聚合审核设置由需要审核修改为不需要审核时,需检查当前专区下是否存在待审核项目聚合,如果存在,需要处理完成后再修改配置
|
||||
if (zoneDetail.getProjectNeedAudit() != null && (0 == zoneDetail.getProjectNeedAudit())) {
|
||||
ZoneProjectSearchVo zoneProjectSearchVo = new ZoneProjectSearchVo();
|
||||
zoneProjectSearchVo.setZoneId(zoneDetail.getId());
|
||||
zoneProjectSearchVo.setAuditStatus(ZoneConstants.PROJECT_NOT_AUDIT);
|
||||
Integer notAuditCount = zoneProjectMapper.selectZoneProjectListCount(zoneProjectSearchVo);
|
||||
if (notAuditCount > 0) {
|
||||
throw new ServiceException("当前专区下存在待审核项目聚合,需完成审核后才能将专区项目聚合修改为不需要审核(专区名称[%s],待审核项目聚合数量[%d])", oldZoneDetail.getName(), notAuditCount);
|
||||
}
|
||||
}
|
||||
// 专区资讯审核设置由需要审核修改为不需要审核时,需检查当前专区下是否存在待审核资讯,如果存在,需要处理完成后再修改配置
|
||||
if (zoneDetail.getDocNeedAudit() != null && (0 == zoneDetail.getDocNeedAudit())) {
|
||||
Long notAuditCount = FeignUtils.getReturnData(
|
||||
|
|
@ -540,14 +505,14 @@ public class ZoneDetailServiceImpl implements IZoneDetailService {
|
|||
.filter(x -> zoneDetail.getDeptId().equals(x.getDeptId()))
|
||||
.findFirst().orElse(null);
|
||||
if (userIdentify != null) {
|
||||
return genChangeCurrentUserIdentityUrl(userIdentify, zoneId, notMemberParentUserIdentify);
|
||||
return genChangeCurrentUserIdentityUrl(userIdentify, gitLinkToken, zoneId, notMemberParentUserIdentify);
|
||||
}
|
||||
// 当不存在当前专区对应的管理权限时查找在父级组织中是否存在身份
|
||||
userIdentify = userIdentifyList.stream()
|
||||
.filter(x -> deptAncestors.contains(String.valueOf(x.getDeptId())))
|
||||
.findFirst().orElse(null);
|
||||
if (userIdentify != null) {
|
||||
return genChangeCurrentUserIdentityUrl(userIdentify, zoneId, notMemberParentUserIdentify);
|
||||
return genChangeCurrentUserIdentityUrl(userIdentify, gitLinkToken, zoneId, notMemberParentUserIdentify);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
@ -560,11 +525,12 @@ public class ZoneDetailServiceImpl implements IZoneDetailService {
|
|||
* <a href="https://www.gitlink.org.cn/Gitlink/forgeplus/issues/3523">参照需求</a>
|
||||
*
|
||||
* @param userIdentify
|
||||
* @param gitLinkToken
|
||||
* @param zoneId
|
||||
* @param notMemberParentUserIdentify
|
||||
* @return
|
||||
*/
|
||||
private String genChangeCurrentUserIdentityUrl(SysUserDeptRole userIdentify, Long zoneId, SysUserDeptRole notMemberParentUserIdentify) {
|
||||
private String genChangeCurrentUserIdentityUrl(SysUserDeptRole userIdentify, String gitLinkToken, Long zoneId, SysUserDeptRole notMemberParentUserIdentify) {
|
||||
String roleKey = userIdentify.getSysRole().getRoleKey();
|
||||
Long deptId = userIdentify.getDeptId();
|
||||
if (SystemRole.ZONE_MEMBER.getRoleKey().equals(roleKey)) {
|
||||
|
|
@ -575,10 +541,10 @@ public class ZoneDetailServiceImpl implements IZoneDetailService {
|
|||
}
|
||||
if (SystemRole.ZONE_ADMIN.getRoleKey().equals(roleKey)
|
||||
|| SystemRole.ZONE_OPERATOR.getRoleKey().equals(roleKey)) {
|
||||
return adminUrl + zoneConfigurationPath + "?changeCurrentUserIdentity=" + deptId;
|
||||
return zoneConfigurationUrl + "?changeCurrentUserIdentity=" + deptId;
|
||||
}
|
||||
if (SystemRole.PLATFORM_ADMIN.getRoleKey().equals(roleKey)) {
|
||||
return adminUrl + zoneConfigurationPath + "/" + zoneId + "?changeCurrentUserIdentity=" + deptId;
|
||||
return zoneConfigurationUrl + "/" + zoneId + "?changeCurrentUserIdentity=" + deptId;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -633,16 +599,9 @@ public class ZoneDetailServiceImpl implements IZoneDetailService {
|
|||
if (zoneDetail == null) {
|
||||
throw new ServiceException(HttpStatus.NOT_FOUND, "该特色专区不存在或无权限访问(专区标识[" + zoneKey + "])");
|
||||
}
|
||||
ZoneDetailDataVo zoneDetailDataVo = getZoneDetailDataVoAndCmsProject(zoneDetail);
|
||||
// 判断当前zone的deptId是否为redis中对应的ZONE_POINTS_DEPT_ID_KEY
|
||||
Long cachedPointsDeptId = redisService.getCacheObject(CacheConstants.ZONE_POINTS_DEPT_ID_KEY);
|
||||
if (zoneDetail.getDeptId() != null && cachedPointsDeptId != null
|
||||
&& zoneDetail.getDeptId().equals(cachedPointsDeptId)) {
|
||||
zoneDetailDataVo.setSectionPointsShow(1);
|
||||
} else {
|
||||
zoneDetailDataVo.setSectionPointsShow(0);
|
||||
}
|
||||
return zoneDetailDataVo;
|
||||
// zoneTemplateCheck(template,zoneDetailDataVo);
|
||||
return getZoneDetailDataVoAndCmsProject(zoneDetail);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -672,175 +631,23 @@ public class ZoneDetailServiceImpl implements IZoneDetailService {
|
|||
return JSON.toJSONString(zoneDetail);
|
||||
}
|
||||
|
||||
private ZoneMemberInputVo newZoneMemberInputVo(Long zoneId, SysUser sysUser) {
|
||||
if (sysUser.getGitlinkUserId() == null) {
|
||||
return null;
|
||||
}
|
||||
ZoneMemberInputVo zoneMemberInputVo = new ZoneMemberInputVo();
|
||||
zoneMemberInputVo.setGitLinkUserId(sysUser.getGitlinkUserId());
|
||||
zoneMemberInputVo.setName(sysUser.getNickName());
|
||||
zoneMemberInputVo.setImageUrl(sysUser.getAvatar());
|
||||
ZoneMemberType zoneMemberTypeSearch = new ZoneMemberType();
|
||||
zoneMemberTypeSearch.setZoneId(zoneId);
|
||||
List<ZoneMemberType> zoneMemberTypes = zoneMemberTypeMapper.selectZoneMemberTypeList(zoneMemberTypeSearch);
|
||||
if (zoneMemberTypes == null || zoneMemberTypes.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
Long zoneMemberTypeId = zoneMemberTypes.get(0).getId();
|
||||
if (StringUtils.isNotEmpty(autoMemberTypeName)) {
|
||||
zoneMemberTypeId = zoneMemberTypes.stream().filter(x -> autoMemberTypeName.equals(x.getName())).map(ZoneMemberType::getId).findFirst().orElse(zoneMemberTypeId);
|
||||
}
|
||||
zoneMemberInputVo.setMemberTypeId(zoneMemberTypeId);
|
||||
ZoneMemberLevel zoneMemberLevelSearch = new ZoneMemberLevel();
|
||||
zoneMemberLevelSearch.setZoneId(zoneId);
|
||||
List<ZoneMemberLevel> zoneMemberLevels = zoneMemberLevelMapper.selectZoneMemberLevelList(zoneMemberLevelSearch);
|
||||
if (zoneMemberLevels == null || zoneMemberLevels.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
Long zoneMemberLevelId = zoneMemberLevels.get(0).getId();
|
||||
if (StringUtils.isNotEmpty(autoMemberLevelName)) {
|
||||
zoneMemberLevelId = zoneMemberLevels.stream().filter(x -> autoMemberLevelName.equals(x.getName())).map(ZoneMemberLevel::getId).findFirst().orElse(zoneMemberLevelId);
|
||||
}
|
||||
zoneMemberInputVo.setMemberLevelId(zoneMemberLevelId);
|
||||
zoneMemberInputVo.setIsSendInvitation(false);
|
||||
zoneMemberInputVo.setZoneId(zoneId);
|
||||
return zoneMemberInputVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZoneFrontRoleVo checkCurrentRoleInZone(Long zoneId) {
|
||||
ZoneFrontRoleVo zoneFrontRoleVo = new ZoneFrontRoleVo();
|
||||
ZoneDetail zoneDetail = selectZoneDetailById(zoneId);
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
// 当前专区为指定专区时,用户将自动成为专区会员
|
||||
if (StringUtils.isNotEmpty(autoMemberZoneIds)) {
|
||||
String[] idArr = autoMemberZoneIds.split(",");
|
||||
for (String s : idArr) {
|
||||
if (s.equals(String.valueOf(zoneId))) {
|
||||
ZoneMember zoneMember = zoneMemberMapper.selectZoneMemberByZoneIdAndUserId(zoneId, loginUser.getUserId());
|
||||
if (zoneMember == null) {
|
||||
ZoneMemberInputVo zoneMemberInputVo = newZoneMemberInputVo(zoneId, loginUser.getSysUser());
|
||||
if (zoneMemberInputVo == null) {
|
||||
break;
|
||||
}
|
||||
zoneMemberService.insertZoneMember(zoneMemberInputVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SysDept sysDept = FeignUtils.getReturnData(remoteDeptService.getDeptByDeptId(zoneDetail.getDeptId(), SecurityConstants.INNER));
|
||||
List<SysUserDeptRole> userIdentifyList = FeignUtils.getReturnData(
|
||||
remoteUserService.getSysUserDeptRoleListByUserName(loginUser.getUsername(), SecurityConstants.INNER)
|
||||
);
|
||||
if (sysDept == null || userIdentifyList == null) {
|
||||
zoneFrontRoleVo.setRole(ZoneConstants.FRONT_ROLE_NONE);
|
||||
return zoneFrontRoleVo;
|
||||
boolean isZoneAdmin = AuthUtil.hasUserIdentity(zoneDetail.getDeptId(), SystemRole.ZONE_ADMIN.getRoleKey());
|
||||
boolean isZoneOperator = AuthUtil.hasUserIdentity(zoneDetail.getDeptId(), SystemRole.ZONE_OPERATOR.getRoleKey());
|
||||
boolean isZoneMember = AuthUtil.hasUserIdentity(zoneDetail.getDeptId(), SystemRole.ZONE_MEMBER.getRoleKey());
|
||||
if (isZoneAdmin || isZoneOperator) {
|
||||
zoneFrontRoleVo.setRole(ZoneConstants.FRONT_ROLE_MANAGER);
|
||||
zoneFrontRoleVo.setResourceManageUrl(resourceManageUrl);
|
||||
zoneFrontRoleVo.setDocManageUrl(docManageUrl);
|
||||
} else if (isZoneMember) {
|
||||
zoneFrontRoleVo.setRole(ZoneConstants.FRONT_ROLE_MEMBER);
|
||||
} else {
|
||||
List<String> deptIdList = Arrays.asList(sysDept.getAncestors().split(","));
|
||||
SysUserDeptRole parentDeptUserIdentify = userIdentifyList
|
||||
.stream()
|
||||
.filter(x -> deptIdList.contains(String.valueOf(x.getDeptId())))
|
||||
.filter(x -> !x.getSysRole().getRoleKey().equals(SystemRole.ZONE_MEMBER.getRoleKey()))
|
||||
.findFirst().orElse(null);
|
||||
SysUserDeptRole currentUserIdentify = userIdentifyList.stream().filter(x -> x.getDeptId().equals(zoneDetail.getDeptId())).findFirst().orElse(null);
|
||||
String resourceManageUrl = adminUrl + resourceManagePath + "?changeCurrentUserIdentity=";
|
||||
String docManageUrl = adminUrl + docManagePath + "?changeCurrentUserIdentity=";
|
||||
String projectManageUrl = adminUrl + projectManagePath + "?changeCurrentUserIdentity=";
|
||||
if (currentUserIdentify != null) {
|
||||
if (currentUserIdentify.getSysRole().getRoleKey().equals(SystemRole.ZONE_MEMBER.getRoleKey())) {
|
||||
if (parentDeptUserIdentify != null) {
|
||||
zoneFrontRoleVo.setRole(ZoneConstants.FRONT_ROLE_MANAGER);
|
||||
zoneFrontRoleVo.setResourceManageUrl(resourceManageUrl + parentDeptUserIdentify.getDeptId());
|
||||
zoneFrontRoleVo.setDocManageUrl(docManageUrl + parentDeptUserIdentify.getDeptId());
|
||||
zoneFrontRoleVo.setProjectManageUrl(projectManageUrl + parentDeptUserIdentify.getDeptId());
|
||||
zoneFrontRoleVo.setDeptId(parentDeptUserIdentify.getDeptId());
|
||||
} else {
|
||||
zoneFrontRoleVo.setRole(ZoneConstants.FRONT_ROLE_MEMBER);
|
||||
zoneFrontRoleVo.setDeptId(currentUserIdentify.getDeptId());
|
||||
}
|
||||
} else {
|
||||
zoneFrontRoleVo.setRole(ZoneConstants.FRONT_ROLE_MANAGER);
|
||||
zoneFrontRoleVo.setResourceManageUrl(resourceManageUrl + currentUserIdentify.getDeptId());
|
||||
zoneFrontRoleVo.setDocManageUrl(docManageUrl + currentUserIdentify.getDeptId());
|
||||
zoneFrontRoleVo.setProjectManageUrl(projectManageUrl + currentUserIdentify.getDeptId());
|
||||
zoneFrontRoleVo.setDeptId(currentUserIdentify.getDeptId());
|
||||
}
|
||||
return zoneFrontRoleVo;
|
||||
} else if (parentDeptUserIdentify != null) {
|
||||
zoneFrontRoleVo.setRole(ZoneConstants.FRONT_ROLE_MANAGER);
|
||||
zoneFrontRoleVo.setResourceManageUrl(resourceManageUrl + parentDeptUserIdentify.getDeptId());
|
||||
zoneFrontRoleVo.setDocManageUrl(docManageUrl + parentDeptUserIdentify.getDeptId());
|
||||
zoneFrontRoleVo.setProjectManageUrl(projectManageUrl + parentDeptUserIdentify.getDeptId());
|
||||
zoneFrontRoleVo.setDeptId(parentDeptUserIdentify.getDeptId());
|
||||
return zoneFrontRoleVo;
|
||||
}
|
||||
}
|
||||
|
||||
zoneFrontRoleVo.setRole(ZoneConstants.FRONT_ROLE_NONE);
|
||||
return zoneFrontRoleVo;
|
||||
}
|
||||
|
||||
public ZoneFrontRoleVo checkUserRoleInZone(Long zoneId, Long userId) {
|
||||
ZoneFrontRoleVo zoneFrontRoleVo = new ZoneFrontRoleVo();
|
||||
ZoneDetail zoneDetail = selectZoneDetailById(zoneId);
|
||||
|
||||
SysUser sysUser = FeignUtils.getReturnData(
|
||||
remoteUserService.getSysUserByUserId(userId, SecurityConstants.INNER)
|
||||
);
|
||||
if (sysUser == null) {
|
||||
zoneFrontRoleVo.setRole(ZoneConstants.FRONT_ROLE_NONE);
|
||||
return zoneFrontRoleVo;
|
||||
}
|
||||
|
||||
SysDept sysDept = FeignUtils.getReturnData(remoteDeptService.getDeptByDeptId(zoneDetail.getDeptId(), SecurityConstants.INNER));
|
||||
List<SysUserDeptRole> userIdentifyList = FeignUtils.getReturnData(
|
||||
remoteUserService.getSysUserDeptRoleListByUserName(sysUser.getUserName(), SecurityConstants.INNER)
|
||||
);
|
||||
if (sysDept == null || userIdentifyList == null) {
|
||||
zoneFrontRoleVo.setRole(ZoneConstants.FRONT_ROLE_NONE);
|
||||
return zoneFrontRoleVo;
|
||||
} else {
|
||||
List<String> deptIdList = Arrays.asList(sysDept.getAncestors().split(","));
|
||||
SysUserDeptRole parentDeptUserIdentify = userIdentifyList
|
||||
.stream()
|
||||
.filter(x -> deptIdList.contains(String.valueOf(x.getDeptId())))
|
||||
.filter(x -> !x.getSysRole().getRoleKey().equals(SystemRole.ZONE_MEMBER.getRoleKey()))
|
||||
.findFirst().orElse(null);
|
||||
SysUserDeptRole currentUserIdentify = userIdentifyList.stream().filter(x -> x.getDeptId().equals(zoneDetail.getDeptId())).findFirst().orElse(null);
|
||||
String resourceManageUrl = adminUrl + resourceManagePath + "?changeCurrentUserIdentity=";
|
||||
String docManageUrl = adminUrl + docManagePath + "?changeCurrentUserIdentity=";
|
||||
String projectManageUrl = adminUrl + projectManagePath + "?changeCurrentUserIdentity=";
|
||||
if (currentUserIdentify != null) {
|
||||
if (currentUserIdentify.getSysRole().getRoleKey().equals(SystemRole.ZONE_MEMBER.getRoleKey())) {
|
||||
if (parentDeptUserIdentify != null) {
|
||||
zoneFrontRoleVo.setRole(ZoneConstants.FRONT_ROLE_MANAGER);
|
||||
zoneFrontRoleVo.setResourceManageUrl(resourceManageUrl + parentDeptUserIdentify.getDeptId());
|
||||
zoneFrontRoleVo.setDocManageUrl(docManageUrl + parentDeptUserIdentify.getDeptId());
|
||||
zoneFrontRoleVo.setProjectManageUrl(projectManageUrl + parentDeptUserIdentify.getDeptId());
|
||||
zoneFrontRoleVo.setDeptId(parentDeptUserIdentify.getDeptId());
|
||||
} else {
|
||||
zoneFrontRoleVo.setRole(ZoneConstants.FRONT_ROLE_MEMBER);
|
||||
zoneFrontRoleVo.setDeptId(currentUserIdentify.getDeptId());
|
||||
}
|
||||
} else {
|
||||
zoneFrontRoleVo.setRole(ZoneConstants.FRONT_ROLE_MANAGER);
|
||||
zoneFrontRoleVo.setResourceManageUrl(resourceManageUrl + currentUserIdentify.getDeptId());
|
||||
zoneFrontRoleVo.setDocManageUrl(docManageUrl + currentUserIdentify.getDeptId());
|
||||
zoneFrontRoleVo.setProjectManageUrl(projectManageUrl + currentUserIdentify.getDeptId());
|
||||
zoneFrontRoleVo.setDeptId(currentUserIdentify.getDeptId());
|
||||
}
|
||||
return zoneFrontRoleVo;
|
||||
} else if (parentDeptUserIdentify != null) {
|
||||
zoneFrontRoleVo.setRole(ZoneConstants.FRONT_ROLE_MANAGER);
|
||||
zoneFrontRoleVo.setResourceManageUrl(resourceManageUrl + parentDeptUserIdentify.getDeptId());
|
||||
zoneFrontRoleVo.setDocManageUrl(docManageUrl + parentDeptUserIdentify.getDeptId());
|
||||
zoneFrontRoleVo.setProjectManageUrl(projectManageUrl + parentDeptUserIdentify.getDeptId());
|
||||
zoneFrontRoleVo.setDeptId(parentDeptUserIdentify.getDeptId());
|
||||
return zoneFrontRoleVo;
|
||||
}
|
||||
}
|
||||
|
||||
zoneFrontRoleVo.setRole(ZoneConstants.FRONT_ROLE_NONE);
|
||||
return zoneFrontRoleVo;
|
||||
}
|
||||
|
||||
|
|
@ -871,14 +678,14 @@ public class ZoneDetailServiceImpl implements IZoneDetailService {
|
|||
}
|
||||
if (SystemRole.ZONE_ADMIN.getRoleKey().equals(roleKey)
|
||||
|| SystemRole.ZONE_OPERATOR.getRoleKey().equals(roleKey)) {
|
||||
return adminUrl + zoneConfigurationPath;
|
||||
return zoneConfigurationUrl;
|
||||
}
|
||||
if (SystemRole.PLATFORM_ADMIN.getRoleKey().equals(roleKey)) {
|
||||
ZoneDetail zoneDetail = zoneDetailMapper.selectZoneDetailByDeptId(deptId);
|
||||
if (zoneDetail == null) {
|
||||
return zoneAdminUrl;
|
||||
}
|
||||
return adminUrl + zoneConfigurationPath + "/" + zoneDetail.getId();
|
||||
return zoneConfigurationUrl + "/" + zoneDetail.getId();
|
||||
}
|
||||
|
||||
return adminUrl;
|
||||
|
|
@ -920,7 +727,7 @@ public class ZoneDetailServiceImpl implements IZoneDetailService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ZoneStatisticsVo calculateZoneStatistics(Long zoneId) {
|
||||
public ZoneStatisticsVo getZoneStatistics(Long zoneId) {
|
||||
ZoneStatisticsVo zoneStatisticsVo = new ZoneStatisticsVo();
|
||||
|
||||
ZoneDetail zoneDetail = zoneDetailMapper.selectZoneDetailById(zoneId);
|
||||
|
|
@ -985,45 +792,6 @@ public class ZoneDetailServiceImpl implements IZoneDetailService {
|
|||
return zoneStatisticsVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZoneStatisticsVo getZoneStatistics(Long zoneId) {
|
||||
String cacheKey = CacheConstants.getZoneStatisticsKey(zoneId);
|
||||
|
||||
try {
|
||||
// 1. 尝试从Redis缓存获取
|
||||
ZoneStatisticsVo cachedStatistics = redisService.getCacheObject(cacheKey);
|
||||
if (cachedStatistics != null) {
|
||||
log.debug("专区[{}]统计数据来自缓存", zoneId);
|
||||
return cachedStatistics;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("专区[{}]统计数据缓存读取失败,执行降级逻辑", zoneId, e);
|
||||
}
|
||||
|
||||
// 2. 缓存异常或未命中,执行实时计算
|
||||
log.info("专区[{}]统计数据缓存未命中,执行实时计算", zoneId);
|
||||
ZoneStatisticsVo statistics = calculateZoneStatistics(zoneId);
|
||||
|
||||
// 3. 尝试缓存计算结果(失败不影响主流程)
|
||||
try {
|
||||
redisService.setCacheObject(cacheKey, statistics, 7200L, TimeUnit.SECONDS);
|
||||
} catch (Exception e) {
|
||||
log.warn("专区[{}]统计数据缓存写入失败", zoneId, e);
|
||||
}
|
||||
|
||||
return statistics;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPointsZone(Long zoneId) {
|
||||
ZoneDetail zoneDetail = zoneDetailMapper.selectZoneDetailById(zoneId);
|
||||
if (zoneDetail == null || zoneDetail.getDeptId() == null) {
|
||||
return false;
|
||||
}
|
||||
Long cachedPointsDeptId = redisService.getCacheObject(CacheConstants.ZONE_POINTS_DEPT_ID_KEY);
|
||||
return cachedPointsDeptId != null && zoneDetail.getDeptId().equals(cachedPointsDeptId);
|
||||
}
|
||||
|
||||
public Date[] getLastWeek() {
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate startOfWeek = today.with(java.time.DayOfWeek.MONDAY).minusDays(7);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,109 @@
|
|||
package com.microservices.zone.journals.controller;
|
||||
|
||||
import com.microservices.common.core.web.controller.BaseController;
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
import com.microservices.common.core.web.page.GenericsTableDataInfo;
|
||||
import com.microservices.common.core.web.page.TableDataInfo;
|
||||
import com.microservices.common.log.annotation.Log;
|
||||
import com.microservices.common.log.enums.BusinessType;
|
||||
import com.microservices.common.security.annotation.RequiresPermissions;
|
||||
import com.microservices.zone.journals.domain.ZoneJournals;
|
||||
import com.microservices.zone.journals.domain.vo.ZoneJournalsInputVo;
|
||||
import com.microservices.zone.journals.domain.vo.ZoneJournalsParentDataVo;
|
||||
import com.microservices.zone.journals.domain.vo.ZoneJournalsSearchVo;
|
||||
import com.microservices.zone.journals.domain.vo.ZoneJournalsUpdateVo;
|
||||
import com.microservices.zone.journals.service.IZoneJournalsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通用评论Controller
|
||||
*
|
||||
* @author otto
|
||||
* @date 2025-04-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/zone/journals")
|
||||
@Api(tags = "通用评论接口")
|
||||
public class ZoneJournalsController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IZoneJournalsService zoneJournalsService;
|
||||
|
||||
/**
|
||||
* 查询评论列表(二级结构)
|
||||
*/
|
||||
// @RequiresPermissions("zone:journals:list")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询评论列表")
|
||||
public GenericsTableDataInfo<ZoneJournalsParentDataVo> list(ZoneJournalsSearchVo searchVo) {
|
||||
startPage();
|
||||
List<ZoneJournalsParentDataVo> list = zoneJournalsService.selectJournalsList(searchVo);
|
||||
return new GenericsTableDataInfo<>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评论详细信息
|
||||
*/
|
||||
// @RequiresPermissions("zone:journals:query")
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation("获取评论详细信息")
|
||||
public AjaxResult getInfo(@ApiParam(value = "评论ID", required = true) @PathVariable("id") Long id) {
|
||||
ZoneJournals zoneJournals = zoneJournalsService.selectZoneJournalsById(id);
|
||||
return success(zoneJournals);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增评论
|
||||
*/
|
||||
// @RequiresPermissions("zone:journals:add")
|
||||
@Log(title = "新增评论", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增评论")
|
||||
public AjaxResult add(@RequestBody @Validated ZoneJournalsInputVo inputVo) {
|
||||
Long journalId = zoneJournalsService.insertJournals(inputVo);
|
||||
return success(journalId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改评论
|
||||
*/
|
||||
// @RequiresPermissions("zone:journals:edit")
|
||||
@Log(title = "修改评论", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改评论")
|
||||
public AjaxResult edit(@RequestBody @Validated ZoneJournalsUpdateVo updateVo) {
|
||||
int result = zoneJournalsService.updateJournals(updateVo);
|
||||
return toAjax(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除评论
|
||||
*/
|
||||
// @RequiresPermissions("zone:journals:remove")
|
||||
@Log(title = "删除评论", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation("删除评论")
|
||||
public AjaxResult remove(@ApiParam(value = "评论ID", required = true) @PathVariable("id") Long id) {
|
||||
int result = zoneJournalsService.deleteJournalsById(id);
|
||||
return toAjax(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除评论
|
||||
*/
|
||||
// @RequiresPermissions("zone:journals:remove")
|
||||
@Log(title = "批量删除评论", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/batch/{ids}")
|
||||
@ApiOperation("批量删除评论")
|
||||
public AjaxResult removeBatch(@ApiParam(value = "评论ID数组", required = true) @PathVariable Long[] ids) {
|
||||
int result = zoneJournalsService.deleteJournalsByIds(ids);
|
||||
return toAjax(result);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
package com.microservices.zone.journals.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.microservices.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 通用评论对象 zone_journals
|
||||
*
|
||||
* @author otto
|
||||
* @date 2025-04-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("通用评论对象")
|
||||
public class ZoneJournals extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 评论对象类型常量
|
||||
*/
|
||||
public static final String JOURNAL_TYPE_AI_SKILL = "aiSkill";
|
||||
public static final String JOURNAL_TYPE_AI_MODEL = "aiModel";
|
||||
public static final String JOURNAL_TYPE_AI_DATASET = "aiDataset";
|
||||
public static final String JOURNAL_TYPE_ZONE_RESOURCE = "zoneResource";
|
||||
|
||||
/** 评论ID */
|
||||
@ApiModelProperty(value = "评论ID")
|
||||
private Long id;
|
||||
|
||||
/** 评论对象ID */
|
||||
@ApiModelProperty(value = "评论对象ID")
|
||||
private Long journalizedId;
|
||||
|
||||
/** 评论对象类型 */
|
||||
@ApiModelProperty(value = "评论对象类型")
|
||||
private String journalizedType;
|
||||
|
||||
/** GitLink用户ID */
|
||||
@ApiModelProperty(value = "GitLink用户ID")
|
||||
private Long userId;
|
||||
|
||||
/** 评论内容 */
|
||||
@ApiModelProperty(value = "评论内容")
|
||||
private String notes;
|
||||
|
||||
/** 父级评论ID */
|
||||
@ApiModelProperty(value = "父级评论ID")
|
||||
private Long parentId;
|
||||
|
||||
/** 回复的评论ID */
|
||||
@ApiModelProperty(value = "回复的评论ID")
|
||||
private Long replyId;
|
||||
|
||||
/** 评论数量 */
|
||||
@ApiModelProperty(value = "评论数量")
|
||||
private Integer commentsCount;
|
||||
|
||||
/** 附件标识列表 */
|
||||
@ApiModelProperty(value = "附件标识列表")
|
||||
private String attachmentIdentifiers;
|
||||
|
||||
/** @用户列表 */
|
||||
@ApiModelProperty(value = "@用户列表")
|
||||
private String receiversLogin;
|
||||
|
||||
/** 是否隐私评论 */
|
||||
@ApiModelProperty(value = "是否隐私评论")
|
||||
private String privateNotes;
|
||||
|
||||
/** 删除标志 */
|
||||
@ApiModelProperty(value = "删除标志")
|
||||
private String delFlag;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createdOn;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updatedOn;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.microservices.zone.journals.domain.vo;
|
||||
|
||||
import com.microservices.system.api.domain.SimpleSysUser;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 通用评论子级评论数据VO
|
||||
*
|
||||
* @author otto
|
||||
* @date 2025-04-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("子级评论数据对象")
|
||||
public class ZoneJournalsChildrenDataVo extends ZoneJournalsDataVo {
|
||||
|
||||
/** 回复的用户 */
|
||||
@ApiModelProperty(value = "回复的用户")
|
||||
private SimpleSysUser reply_user;
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.microservices.zone.journals.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.microservices.system.api.domain.SysFileInfo;
|
||||
import com.microservices.system.api.domain.SimpleSysUser;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通用评论基础数据VO
|
||||
*
|
||||
* @author otto
|
||||
* @date 2025-04-30
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("评论数据对象")
|
||||
public class ZoneJournalsDataVo {
|
||||
|
||||
/** 评论ID */
|
||||
@ApiModelProperty(value = "评论ID")
|
||||
private Long id;
|
||||
|
||||
/** 评论用户 */
|
||||
@ApiModelProperty(value = "评论用户")
|
||||
private SimpleSysUser user;
|
||||
|
||||
/** 评论内容 */
|
||||
@ApiModelProperty(value = "评论内容")
|
||||
private String notes;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date created_on;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updated_on;
|
||||
|
||||
/** 附件列表 */
|
||||
@ApiModelProperty(value = "附件列表")
|
||||
private List<SysFileInfo> attachments;
|
||||
|
||||
/** 评论数量 */
|
||||
@ApiModelProperty(value = "评论数量")
|
||||
private Integer comments_count = 0;
|
||||
|
||||
/** 是否详情 */
|
||||
@ApiModelProperty(value = "是否详情")
|
||||
private Boolean is_journal_detail = false;
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
package com.microservices.zone.journals.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 通用评论输入VO
|
||||
*
|
||||
* @author otto
|
||||
* @date 2025-04-30
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("评论输入对象")
|
||||
public class ZoneJournalsInputVo {
|
||||
|
||||
/** 评论对象ID */
|
||||
@NotNull(message = "评论对象ID不能为空")
|
||||
@ApiModelProperty(value = "评论对象ID", required = true)
|
||||
private Long journalized_id;
|
||||
|
||||
/** 评论对象类型 */
|
||||
@NotBlank(message = "评论对象类型不能为空")
|
||||
@ApiModelProperty(value = "评论对象类型", required = true)
|
||||
private String journalized_type;
|
||||
|
||||
/** 父级评论ID */
|
||||
@ApiModelProperty(value = "父级评论ID")
|
||||
private Long parent_id;
|
||||
|
||||
/** 回复的评论ID */
|
||||
@ApiModelProperty(value = "回复的评论ID")
|
||||
private Long reply_id;
|
||||
|
||||
/** 评论内容 */
|
||||
@NotBlank(message = "评论内容不能为空")
|
||||
@Size(max = 2000, message = "评论内容不能超过2000个字符")
|
||||
@ApiModelProperty(value = "评论内容", required = true)
|
||||
private String notes;
|
||||
|
||||
/** @用户列表 */
|
||||
@ApiModelProperty(value = "@用户列表")
|
||||
private String[] receivers_login;
|
||||
|
||||
/** 附件标识列表 */
|
||||
@ApiModelProperty(value = "附件标识列表")
|
||||
private String attachment_identifiers;
|
||||
|
||||
/** 是否隐私评论 */
|
||||
@ApiModelProperty(value = "是否隐私评论")
|
||||
private String private_notes;
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.microservices.zone.journals.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通用评论父级评论数据VO
|
||||
*
|
||||
* @author otto
|
||||
* @date 2025-04-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("父级评论数据对象")
|
||||
public class ZoneJournalsParentDataVo extends ZoneJournalsDataVo {
|
||||
|
||||
/** 子级评论列表 */
|
||||
@ApiModelProperty(value = "子级评论列表")
|
||||
private List<ZoneJournalsChildrenDataVo> children_journals;
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.microservices.zone.journals.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 通用评论查询VO
|
||||
*
|
||||
* @author otto
|
||||
* @date 2025-04-30
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("评论查询对象")
|
||||
public class ZoneJournalsSearchVo {
|
||||
|
||||
/** 评论对象ID */
|
||||
@ApiModelProperty(value = "评论对象ID")
|
||||
private Long journalized_id;
|
||||
|
||||
/** 评论对象类型 */
|
||||
@ApiModelProperty(value = "评论对象类型")
|
||||
private String journalized_type;
|
||||
|
||||
/** 评论用户ID */
|
||||
@ApiModelProperty(value = "评论用户ID")
|
||||
private Long user_id;
|
||||
|
||||
/** 是否隐私评论 */
|
||||
@ApiModelProperty(value = "是否隐私评论")
|
||||
private String private_notes;
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.microservices.zone.journals.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 通用评论更新VO
|
||||
*
|
||||
* @author otto
|
||||
* @date 2025-04-30
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("评论更新对象")
|
||||
public class ZoneJournalsUpdateVo {
|
||||
|
||||
/** 评论ID */
|
||||
@NotNull(message = "评论ID不能为空")
|
||||
@ApiModelProperty(value = "评论ID", required = true)
|
||||
private Long id;
|
||||
|
||||
/** 评论内容 */
|
||||
@NotBlank(message = "评论内容不能为空")
|
||||
@Size(max = 2000, message = "评论内容不能超过2000个字符")
|
||||
@ApiModelProperty(value = "评论内容", required = true)
|
||||
private String notes;
|
||||
|
||||
/** @用户列表 */
|
||||
@ApiModelProperty(value = "@用户列表")
|
||||
private String[] receivers_login;
|
||||
|
||||
/** 附件标识列表 */
|
||||
@ApiModelProperty(value = "附件标识列表")
|
||||
private String attachment_identifiers;
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package com.microservices.zone.journals.mapper;
|
||||
|
||||
import com.microservices.zone.journals.domain.ZoneJournals;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通用评论Mapper接口
|
||||
*
|
||||
* @author otto
|
||||
* @date 2025-04-30
|
||||
*/
|
||||
@Mapper
|
||||
public interface ZoneJournalsMapper {
|
||||
|
||||
/**
|
||||
* 查询评论
|
||||
*
|
||||
* @param id 评论主键
|
||||
* @return 评论
|
||||
*/
|
||||
ZoneJournals selectZoneJournalsById(Long id);
|
||||
|
||||
/**
|
||||
* 查询评论列表(父评论)
|
||||
*
|
||||
* @param zoneJournals 评论查询条件
|
||||
* @return 评论集合
|
||||
*/
|
||||
List<ZoneJournals> selectZoneJournalsList(ZoneJournals zoneJournals);
|
||||
|
||||
/**
|
||||
* 查询子评论列表
|
||||
*
|
||||
* @param parentId 父评论ID
|
||||
* @return 子评论集合
|
||||
*/
|
||||
List<ZoneJournals> selectChildrenZoneJournalsList(@Param("parentId") Long parentId);
|
||||
|
||||
/**
|
||||
* 新增评论
|
||||
*
|
||||
* @param zoneJournals 评论
|
||||
* @return 结果
|
||||
*/
|
||||
int insertZoneJournals(ZoneJournals zoneJournals);
|
||||
|
||||
/**
|
||||
* 修改评论
|
||||
*
|
||||
* @param zoneJournals 评论
|
||||
* @return 结果
|
||||
*/
|
||||
int updateZoneJournals(ZoneJournals zoneJournals);
|
||||
|
||||
/**
|
||||
* 删除评论(逻辑删除)
|
||||
*
|
||||
* @param id 评论主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteZoneJournalsById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除评论(逻辑删除)
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteZoneJournalsByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除子评论(逻辑删除)
|
||||
*
|
||||
* @param parentId 父评论ID
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteZoneJournalsByParentId(@Param("parentId") Long parentId);
|
||||
|
||||
/**
|
||||
* 根据类型和评论对象Id删除所有评论
|
||||
*
|
||||
* @param type 类型
|
||||
* @param journalId 评论对象Id
|
||||
*/
|
||||
void deleteZoneJournalsByTypeAndJournalId(@Param("type") String type, @Param("journalId") Long journalId);
|
||||
|
||||
/**
|
||||
* 批量更新关联ID
|
||||
*
|
||||
* @param type 类型
|
||||
* @param oldJournalId 旧评论对象Id
|
||||
* @param journalId 新评论对象Id
|
||||
*/
|
||||
void updateJournalsIdByTypeAndOldId(@Param("type") String type, @Param("oldJournalId") Long oldJournalId, @Param("journalId") Long journalId);
|
||||
|
||||
/**
|
||||
* 更新父评论的子评论数量
|
||||
*
|
||||
* @param id 父评论ID
|
||||
* @return 结果
|
||||
*/
|
||||
int updateCommentsCountById(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 统计评论数量
|
||||
*
|
||||
* @param journalizedId 评论对象ID
|
||||
* @param journalizedType 评论对象类型
|
||||
* @return 评论数量
|
||||
*/
|
||||
int countByJournalized(@Param("journalizedId") Long journalizedId, @Param("journalizedType") String journalizedType);
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package com.microservices.zone.journals.service;
|
||||
|
||||
import com.microservices.zone.journals.domain.ZoneJournals;
|
||||
import com.microservices.zone.journals.domain.vo.ZoneJournalsInputVo;
|
||||
import com.microservices.zone.journals.domain.vo.ZoneJournalsParentDataVo;
|
||||
import com.microservices.zone.journals.domain.vo.ZoneJournalsSearchVo;
|
||||
import com.microservices.zone.journals.domain.vo.ZoneJournalsUpdateVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通用评论Service接口
|
||||
*
|
||||
* @author otto
|
||||
* @date 2025-04-30
|
||||
*/
|
||||
public interface IZoneJournalsService {
|
||||
|
||||
/**
|
||||
* 查询评论
|
||||
*
|
||||
* @param id 评论主键
|
||||
* @return 评论
|
||||
*/
|
||||
ZoneJournals selectZoneJournalsById(Long id);
|
||||
|
||||
/**
|
||||
* 查询评论列表(二级结构)
|
||||
*
|
||||
* @param searchVo 查询条件
|
||||
* @return 评论列表(父评论包含子评论)
|
||||
*/
|
||||
List<ZoneJournalsParentDataVo> selectJournalsList(ZoneJournalsSearchVo searchVo);
|
||||
|
||||
/**
|
||||
* 新增评论
|
||||
*
|
||||
* @param inputVo 评论输入信息
|
||||
* @return 评论ID
|
||||
*/
|
||||
Long insertJournals(ZoneJournalsInputVo inputVo);
|
||||
|
||||
/**
|
||||
* 修改评论
|
||||
*
|
||||
* @param updateVo 评论更新信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateJournals(ZoneJournalsUpdateVo updateVo);
|
||||
|
||||
/**
|
||||
* 删除评论(级联删除子评论)
|
||||
*
|
||||
* @param id 评论主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteJournalsById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除评论
|
||||
*
|
||||
* @param ids 需要删除的评论主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteJournalsByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据类型和评论对象Id删除所有评论
|
||||
*
|
||||
* @param type 类型
|
||||
* @param journalId 评论对象Id
|
||||
*/
|
||||
void deleteJournalsByTypeAndJournalId(String type, Long journalId);
|
||||
|
||||
/**
|
||||
* 批量更新关联ID
|
||||
*
|
||||
* @param type 类型
|
||||
* @param oldJournalId 旧评论对象Id
|
||||
* @param journalId 新评论对象Id
|
||||
*/
|
||||
void updateJournalsIdByTypeAndOldId(String type, Long oldJournalId, Long journalId);
|
||||
}
|
||||
|
|
@ -0,0 +1,414 @@
|
|||
package com.microservices.zone.journals.service.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import com.microservices.common.core.utils.DateUtils;
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.system.api.RemoteFileService;
|
||||
import com.microservices.system.api.domain.SysFileInfo;
|
||||
import com.microservices.system.api.domain.SimpleSysUser;
|
||||
import com.microservices.system.api.utils.FeignUtils;
|
||||
import com.microservices.zone.common.service.IZoneCommonService;
|
||||
import com.microservices.zone.journals.domain.ZoneJournals;
|
||||
import com.microservices.zone.journals.domain.vo.ZoneJournalsChildrenDataVo;
|
||||
import com.microservices.zone.journals.domain.vo.ZoneJournalsInputVo;
|
||||
import com.microservices.zone.journals.domain.vo.ZoneJournalsParentDataVo;
|
||||
import com.microservices.zone.journals.domain.vo.ZoneJournalsSearchVo;
|
||||
import com.microservices.zone.journals.domain.vo.ZoneJournalsUpdateVo;
|
||||
import com.microservices.zone.journals.mapper.ZoneJournalsMapper;
|
||||
import com.microservices.zone.journals.service.IZoneJournalsService;
|
||||
import com.microservices.zone.resource.service.IZoneResourceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 通用评论Service业务层处理
|
||||
*
|
||||
* @author otto
|
||||
* @date 2025-04-30
|
||||
*/
|
||||
@Service
|
||||
public class ZoneJournalsServiceImpl implements IZoneJournalsService {
|
||||
|
||||
@Autowired
|
||||
private ZoneJournalsMapper zoneJournalsMapper;
|
||||
|
||||
@Autowired
|
||||
private IZoneCommonService zoneCommonService;
|
||||
|
||||
@Autowired
|
||||
private IZoneResourceService zoneResourceService;
|
||||
|
||||
@Autowired
|
||||
private RemoteFileService remoteFileService;
|
||||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
/**
|
||||
* 查询评论
|
||||
*
|
||||
* @param id 评论主键
|
||||
* @return 评论
|
||||
*/
|
||||
@Override
|
||||
public ZoneJournals selectZoneJournalsById(Long id) {
|
||||
ZoneJournals zoneJournals = zoneJournalsMapper.selectZoneJournalsById(id);
|
||||
if (zoneJournals == null) {
|
||||
throw new ServiceException("该评论不存在(评论Id[%d])", id);
|
||||
}
|
||||
// 校验评论对象是否存在
|
||||
checkByType(zoneJournals);
|
||||
return zoneJournals;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询评论列表(二级结构)
|
||||
*
|
||||
* @param searchVo 查询条件
|
||||
* @return 评论列表(父评论包含子评论)
|
||||
*/
|
||||
@Override
|
||||
public List<ZoneJournalsParentDataVo> selectJournalsList(ZoneJournalsSearchVo searchVo) {
|
||||
// 校验评论对象是否存在
|
||||
ZoneJournals checkJournal = new ZoneJournals();
|
||||
checkJournal.setJournalizedId(searchVo.getJournalized_id());
|
||||
checkJournal.setJournalizedType(searchVo.getJournalized_type());
|
||||
checkByType(checkJournal);
|
||||
|
||||
// 查询父评论列表
|
||||
ZoneJournals query = new ZoneJournals();
|
||||
query.setJournalizedId(searchVo.getJournalized_id());
|
||||
query.setJournalizedType(searchVo.getJournalized_type());
|
||||
query.setUserId(searchVo.getUser_id());
|
||||
query.setPrivateNotes(searchVo.getPrivate_notes());
|
||||
List<ZoneJournals> parentJournalsList = zoneJournalsMapper.selectZoneJournalsList(query);
|
||||
|
||||
// 转换为VO并组装子评论
|
||||
return parentJournalsList.stream()
|
||||
.map(this::toParentDataVo)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增评论
|
||||
*
|
||||
* @param inputVo 评论输入信息
|
||||
* @return 评论ID
|
||||
*/
|
||||
@Override
|
||||
public Long insertJournals(ZoneJournalsInputVo inputVo) {
|
||||
// 校验评论对象类型
|
||||
ZoneJournals zoneJournals = new ZoneJournals();
|
||||
zoneJournals.setJournalizedId(inputVo.getJournalized_id());
|
||||
zoneJournals.setJournalizedType(inputVo.getJournalized_type());
|
||||
checkByType(zoneJournals);
|
||||
|
||||
// 如果是子评论,校验父评论
|
||||
if (inputVo.getParent_id() != null) {
|
||||
ZoneJournals parentJournal = selectZoneJournalsById(inputVo.getParent_id());
|
||||
if (parentJournal.getParentId() != null) {
|
||||
throw new ServiceException("该评论非父级评论(评论ID[%d])", parentJournal.getId());
|
||||
}
|
||||
if (!parentJournal.getJournalizedType().equals(inputVo.getJournalized_type())) {
|
||||
throw new ServiceException("当前父级评论与当前评论类型不相同");
|
||||
}
|
||||
if (!parentJournal.getJournalizedId().equals(inputVo.getJournalized_id())) {
|
||||
throw new ServiceException("当前父级评论与当前评论对象不相同");
|
||||
}
|
||||
}
|
||||
|
||||
// 如果有回复评论,校验回复评论
|
||||
if (inputVo.getReply_id() != null) {
|
||||
if (inputVo.getParent_id() == null) {
|
||||
throw new ServiceException("一级评论不能进行回复操作");
|
||||
}
|
||||
ZoneJournals replyJournal = selectZoneJournalsById(inputVo.getReply_id());
|
||||
if (!replyJournal.getJournalizedType().equals(inputVo.getJournalized_type())) {
|
||||
throw new ServiceException("当前回复评论与当前评论类型不相同");
|
||||
}
|
||||
if (!replyJournal.getJournalizedId().equals(inputVo.getJournalized_id())) {
|
||||
throw new ServiceException("当前回复评论与当前评论对象不相同");
|
||||
}
|
||||
}
|
||||
|
||||
// 校验附件列表
|
||||
checkAttachments(inputVo.getAttachment_identifiers());
|
||||
|
||||
// 构建评论对象
|
||||
ZoneJournals newJournal = new ZoneJournals();
|
||||
newJournal.setJournalizedId(inputVo.getJournalized_id());
|
||||
newJournal.setJournalizedType(inputVo.getJournalized_type());
|
||||
newJournal.setParentId(inputVo.getParent_id());
|
||||
newJournal.setReplyId(inputVo.getReply_id());
|
||||
newJournal.setNotes(inputVo.getNotes());
|
||||
newJournal.setPrivateNotes(StringUtils.isEmpty(inputVo.getPrivate_notes()) ? "0" : inputVo.getPrivate_notes());
|
||||
newJournal.setAttachmentIdentifiers(inputVo.getAttachment_identifiers());
|
||||
|
||||
// 处理@用户列表
|
||||
if (inputVo.getReceivers_login() != null && inputVo.getReceivers_login().length > 0) {
|
||||
try {
|
||||
newJournal.setReceiversLogin(objectMapper.writeValueAsString(inputVo.getReceivers_login()));
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("@用户列表格式错误");
|
||||
}
|
||||
}
|
||||
|
||||
// 获取当前用户ID
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
if (userId == null || userId == 0) {
|
||||
throw new ServiceException("无法获取当前用户信息");
|
||||
}
|
||||
newJournal.setUserId(userId);
|
||||
newJournal.setCreateBy(SecurityUtils.getUsername());
|
||||
newJournal.setCreatedOn(DateUtils.getNowDate());
|
||||
|
||||
// 插入评论
|
||||
zoneJournalsMapper.insertZoneJournals(newJournal);
|
||||
|
||||
// 如果是子评论,更新父评论的子评论数量
|
||||
if (inputVo.getParent_id() != null) {
|
||||
zoneJournalsMapper.updateCommentsCountById(inputVo.getParent_id());
|
||||
}
|
||||
|
||||
return newJournal.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改评论
|
||||
*
|
||||
* @param updateVo 评论更新信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateJournals(ZoneJournalsUpdateVo updateVo) {
|
||||
// 查询原评论并校验
|
||||
ZoneJournals oldJournal = selectZoneJournalsById(updateVo.getId());
|
||||
|
||||
// 校验是否为评论创建者
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
if (!oldJournal.getUserId().equals(userId)) {
|
||||
throw new ServiceException("只能修改自己的评论");
|
||||
}
|
||||
|
||||
// 校验附件列表
|
||||
checkAttachments(updateVo.getAttachment_identifiers());
|
||||
|
||||
// 构建更新对象
|
||||
ZoneJournals updateJournal = new ZoneJournals();
|
||||
updateJournal.setId(updateVo.getId());
|
||||
updateJournal.setNotes(updateVo.getNotes());
|
||||
updateJournal.setAttachmentIdentifiers(updateVo.getAttachment_identifiers());
|
||||
|
||||
// 处理@用户列表
|
||||
if (updateVo.getReceivers_login() != null && updateVo.getReceivers_login().length > 0) {
|
||||
try {
|
||||
updateJournal.setReceiversLogin(objectMapper.writeValueAsString(updateVo.getReceivers_login()));
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("@用户列表格式错误");
|
||||
}
|
||||
}
|
||||
|
||||
updateJournal.setUpdateBy(SecurityUtils.getUsername());
|
||||
updateJournal.setUpdatedOn(DateUtils.getNowDate());
|
||||
|
||||
return zoneJournalsMapper.updateZoneJournals(updateJournal);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除评论(级联删除子评论)
|
||||
*
|
||||
* @param id 评论主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteJournalsById(Long id) {
|
||||
ZoneJournals zoneJournals = selectZoneJournalsById(id);
|
||||
|
||||
// 校验是否为评论创建者
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
if (!zoneJournals.getUserId().equals(userId)) {
|
||||
throw new ServiceException("只能删除自己的评论");
|
||||
}
|
||||
|
||||
// 如果是父级评论,先删除所有子评论
|
||||
if (zoneJournals.getParentId() == null) {
|
||||
List<ZoneJournals> childrenJournalsList = zoneJournalsMapper.selectChildrenZoneJournalsList(zoneJournals.getId());
|
||||
for (ZoneJournals childrenJournal : childrenJournalsList) {
|
||||
zoneJournalsMapper.deleteZoneJournalsById(childrenJournal.getId());
|
||||
}
|
||||
}
|
||||
|
||||
return zoneJournalsMapper.deleteZoneJournalsById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除评论
|
||||
*
|
||||
* @param ids 需要删除的评论主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteJournalsByIds(Long[] ids) {
|
||||
int success = 0;
|
||||
for (Long id : ids) {
|
||||
success += deleteJournalsById(id);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据类型和评论对象Id删除所有评论
|
||||
*
|
||||
* @param type 类型
|
||||
* @param journalId 评论对象Id
|
||||
*/
|
||||
@Override
|
||||
public void deleteJournalsByTypeAndJournalId(String type, Long journalId) {
|
||||
zoneJournalsMapper.deleteZoneJournalsByTypeAndJournalId(type, journalId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新关联ID
|
||||
*
|
||||
* @param type 类型
|
||||
* @param oldJournalId 旧评论对象Id
|
||||
* @param journalId 新评论对象Id
|
||||
*/
|
||||
@Override
|
||||
public void updateJournalsIdByTypeAndOldId(String type, Long oldJournalId, Long journalId) {
|
||||
zoneJournalsMapper.updateJournalsIdByTypeAndOldId(type, oldJournalId, journalId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据类型校验评论对象是否存在
|
||||
*
|
||||
* @param zoneJournals 评论对象
|
||||
*/
|
||||
private void checkByType(ZoneJournals zoneJournals) {
|
||||
switch (zoneJournals.getJournalizedType()) {
|
||||
case ZoneJournals.JOURNAL_TYPE_AI_SKILL:
|
||||
case ZoneJournals.JOURNAL_TYPE_AI_MODEL:
|
||||
case ZoneJournals.JOURNAL_TYPE_AI_DATASET:
|
||||
case ZoneJournals.JOURNAL_TYPE_ZONE_RESOURCE:
|
||||
// 校验资源是否存在
|
||||
zoneResourceService.selectZoneResourceById(zoneJournals.getJournalizedId());
|
||||
break;
|
||||
default:
|
||||
throw new ServiceException("当前不支持该类型评论(评论类型[%s])", zoneJournals.getJournalizedType());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验附件列表
|
||||
*
|
||||
* @param attachmentIdentifiers 附件标识列表
|
||||
*/
|
||||
private void checkAttachments(String attachmentIdentifiers) {
|
||||
if (StringUtils.isEmpty(attachmentIdentifiers)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
List<SysFileInfo> fileInfos = FeignUtils.getReturnData(
|
||||
remoteFileService.getFileListByIdentifier(attachmentIdentifiers)
|
||||
);
|
||||
if (CollectionUtils.isEmpty(fileInfos)) {
|
||||
throw new ServiceException("附件不存在或已被删除");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("附件校验失败:%s", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换为父评论VO
|
||||
*
|
||||
* @param zoneJournals 评论实体
|
||||
* @return 父评论VO
|
||||
*/
|
||||
private ZoneJournalsParentDataVo toParentDataVo(ZoneJournals zoneJournals) {
|
||||
ZoneJournalsParentDataVo parentVo = new ZoneJournalsParentDataVo();
|
||||
parentVo.setId(zoneJournals.getId());
|
||||
parentVo.setNotes(zoneJournals.getNotes());
|
||||
parentVo.setCreated_on(zoneJournals.getCreatedOn());
|
||||
parentVo.setUpdated_on(zoneJournals.getUpdatedOn());
|
||||
|
||||
// 获取用户信息
|
||||
SimpleSysUser user = zoneCommonService.getSimpleSysUserByUserId(zoneJournals.getUserId());
|
||||
parentVo.setUser(user);
|
||||
|
||||
// 获取附件列表
|
||||
parentVo.setAttachments(getAttachments(zoneJournals.getAttachmentIdentifiers()));
|
||||
|
||||
// 获取子评论列表
|
||||
List<ZoneJournals> childrenJournalsList = zoneJournalsMapper.selectChildrenZoneJournalsList(zoneJournals.getId());
|
||||
List<ZoneJournalsChildrenDataVo> childrenVoList = childrenJournalsList.stream()
|
||||
.map(this::toChildrenDataVo)
|
||||
.collect(Collectors.toList());
|
||||
parentVo.setChildren_journals(childrenVoList);
|
||||
parentVo.setComments_count(childrenVoList.size());
|
||||
|
||||
return parentVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换为子评论VO
|
||||
*
|
||||
* @param zoneJournals 评论实体
|
||||
* @return 子评论VO
|
||||
*/
|
||||
private ZoneJournalsChildrenDataVo toChildrenDataVo(ZoneJournals zoneJournals) {
|
||||
ZoneJournalsChildrenDataVo childrenVo = new ZoneJournalsChildrenDataVo();
|
||||
childrenVo.setId(zoneJournals.getId());
|
||||
childrenVo.setNotes(zoneJournals.getNotes());
|
||||
childrenVo.setCreated_on(zoneJournals.getCreatedOn());
|
||||
childrenVo.setUpdated_on(zoneJournals.getUpdatedOn());
|
||||
|
||||
// 获取用户信息
|
||||
SimpleSysUser user = zoneCommonService.getSimpleSysUserByUserId(zoneJournals.getUserId());
|
||||
childrenVo.setUser(user);
|
||||
|
||||
// 获取附件列表
|
||||
childrenVo.setAttachments(getAttachments(zoneJournals.getAttachmentIdentifiers()));
|
||||
|
||||
// 获取回复用户信息
|
||||
if (zoneJournals.getReplyId() != null) {
|
||||
ZoneJournals replyJournal = zoneJournalsMapper.selectZoneJournalsById(zoneJournals.getReplyId());
|
||||
if (replyJournal != null) {
|
||||
SimpleSysUser replyUser = zoneCommonService.getSimpleSysUserByUserId(replyJournal.getUserId());
|
||||
childrenVo.setReply_user(replyUser);
|
||||
}
|
||||
}
|
||||
|
||||
return childrenVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取附件列表
|
||||
*
|
||||
* @param attachmentIdentifiers 附件标识列表
|
||||
* @return 附件列表
|
||||
*/
|
||||
private List<SysFileInfo> getAttachments(String attachmentIdentifiers) {
|
||||
if (StringUtils.isEmpty(attachmentIdentifiers)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
try {
|
||||
List<SysFileInfo> fileInfos = FeignUtils.getReturnData(
|
||||
remoteFileService.getFileListByIdentifier(attachmentIdentifiers)
|
||||
);
|
||||
return CollectionUtils.isEmpty(fileInfos) ? new ArrayList<>() : fileInfos;
|
||||
} catch (Exception e) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -67,16 +67,6 @@ public class ZoneMemberController extends BaseController {
|
|||
return AjaxResult.success("审核状态获取成功",auditStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前登录用户会员审核状态
|
||||
*/
|
||||
@GetMapping("/zone/{zoneId}/memberInfo")
|
||||
@ApiOperation("查询当前登录用户会员信息")
|
||||
public AjaxResult getMemberInfo(@PathVariable("zoneId") Long zoneId) {
|
||||
ZoneMember memberInfo = zoneMemberService.selectZoneMemberInfo(zoneId);
|
||||
return AjaxResult.success("审核状态获取成功",memberInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询GitLink用户列表
|
||||
*/
|
||||
|
|
@ -118,16 +108,6 @@ public class ZoneMemberController extends BaseController {
|
|||
return genericsSuccess(zoneMemberService.selectZoneMemberById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据专区ID修改当前登录用户会员信息
|
||||
*/
|
||||
@PutMapping(value = "/customEdit/zone/{zoneId}")
|
||||
@ApiOperation("根据专区ID修改当前登录用户会员信息")
|
||||
@Log(title = "特色专区会员", businessType = BusinessType.UPDATE)
|
||||
public AjaxResult customEdit(@PathVariable("zoneId") Long zoneId, @RequestBody ZoneMemberUpdateVo zoneMemberUpdateVo) {
|
||||
return toAjax(zoneMemberService.updateZoneMemberByMember(zoneId, zoneMemberUpdateVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查并获取组织下的会员列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,218 +0,0 @@
|
|||
package com.microservices.zone.member.controller;
|
||||
|
||||
import com.microservices.common.core.domain.R;
|
||||
import com.microservices.common.core.web.controller.BaseController;
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
import com.microservices.common.core.web.domain.GenericsAjaxResult;
|
||||
import com.microservices.common.core.web.page.GenericsTableDataInfo;
|
||||
import com.microservices.common.log.annotation.Log;
|
||||
import com.microservices.common.log.enums.BusinessType;
|
||||
import com.microservices.common.security.annotation.RequiresPermissions;
|
||||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.zone.member.domain.points.ZonePointsAccount;
|
||||
import com.microservices.zone.member.domain.vo.*;
|
||||
import com.microservices.zone.member.service.IZonePointsAccountService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 专区积分账户Controller
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/points/account")
|
||||
@Api(tags = "专区积分账户接口")
|
||||
public class ZonePointsAccountController extends BaseController {
|
||||
@Autowired
|
||||
private IZonePointsAccountService zonePointsAccountService;
|
||||
|
||||
/**
|
||||
* 查询专区积分账户列表
|
||||
*/
|
||||
@RequiresPermissions("zone:points:account:list")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询专区积分账户列表")
|
||||
public GenericsTableDataInfo<ZonePointsAccount> list(ZonePointsAccountSearchVo searchVo) {
|
||||
startPage();
|
||||
List<ZonePointsAccount> list = zonePointsAccountService.selectZonePointsAccountList(searchVo.toZonePointsAccount());
|
||||
return getGenericsDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取专区积分账户详细信息
|
||||
*/
|
||||
@RequiresPermissions("zone:points:account:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation(value = "获取专区积分账户详细信息")
|
||||
public GenericsAjaxResult<ZonePointsAccount> getInfo(@PathVariable("id") Long id) {
|
||||
return genericsSuccess(zonePointsAccountService.selectZonePointsAccountById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增专区积分账户
|
||||
*/
|
||||
@RequiresPermissions("zone:points:account:add")
|
||||
@Log(title = "专区积分账户", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增专区积分账户")
|
||||
public AjaxResult add(@RequestBody ZonePointsAccountInputVo inputVo) {
|
||||
return toAjax(zonePointsAccountService.insertZonePointsAccount(inputVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改专区积分账户
|
||||
*/
|
||||
@RequiresPermissions("zone:points:account:edit")
|
||||
@Log(title = "专区积分账户", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改专区积分账户")
|
||||
public AjaxResult edit(@RequestBody ZonePointsAccountUpdateVo updateVo) {
|
||||
return toAjax(zonePointsAccountService.updateZonePointsAccount(updateVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除专区积分账户
|
||||
*/
|
||||
@RequiresPermissions("zone:points:account:remove")
|
||||
@Log(title = "专区积分账户", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation(value = "删除专区积分账户")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(zonePointsAccountService.deleteZonePointsAccountByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID和专区ID查询积分账户
|
||||
*/
|
||||
@RequiresPermissions("zone:points:account:query")
|
||||
@GetMapping("/user/{userId}/zone/{zoneId}")
|
||||
@ApiOperation(value = "根据用户ID和专区ID查询积分账户")
|
||||
public GenericsAjaxResult<ZonePointsAccount> getByUserIdAndZoneId(@PathVariable("userId") Long userId,
|
||||
@PathVariable("zoneId") Long zoneId) {
|
||||
return genericsSuccess(zonePointsAccountService.selectZonePointsAccountByUserIdAndZoneId(userId, zoneId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据会员ID查询积分账户列表
|
||||
*/
|
||||
@RequiresPermissions("zone:points:account:query")
|
||||
@GetMapping("/member/{memberId}")
|
||||
@ApiOperation(value = "根据会员ID查询积分账户列表")
|
||||
public GenericsAjaxResult<List<ZonePointsAccount>> getByMemberId(@PathVariable("memberId") Long memberId) {
|
||||
return genericsSuccess(zonePointsAccountService.selectZonePointsAccountByMemberId(memberId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录用户的积分账户总览信息
|
||||
*/
|
||||
@GetMapping("/overview/{zoneId}")
|
||||
@ApiOperation(value = "获取当前登录用户的积分账户总览信息")
|
||||
public GenericsAjaxResult<ZonePointsOverviewVo> getCurrentUserPointsOverview(@PathVariable("zoneId") Long zoneId) {
|
||||
return genericsSuccess(zonePointsAccountService.getCurrentUserPointsOverview(zoneId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 电子证书积分扣减(前台用户操作,业务层已做会员身份+积分专区+幂等+积分校验)
|
||||
*/
|
||||
@PostMapping("/certificate/redeem")
|
||||
@ApiOperation(value = "电子证书积分扣减")
|
||||
public AjaxResult redeemCertificate(@RequestBody ZonePointsTransactionInputVo inputVo) {
|
||||
zonePointsAccountService.deductPointsForCertificate(inputVo);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 文章置顶积分扣减(前台用户操作,业务层已做会员身份+积分专区+积分校验)
|
||||
* 用户使用当前登录用户
|
||||
*/
|
||||
@PostMapping("/article/top")
|
||||
@ApiOperation(value = "文章置顶积分扣减")
|
||||
public AjaxResult topArticle(@RequestBody ZonePointsArticleTopInputVo inputVo) {
|
||||
zonePointsAccountService.deductPointsForArticleTop(inputVo.getZoneId(), inputVo.getId(), inputVo.getName());
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录用户的置顶文章信息
|
||||
*/
|
||||
@GetMapping("/article/top/{zoneId}")
|
||||
@ApiOperation(value = "获取当前登录用户的置顶文章信息")
|
||||
public GenericsAjaxResult<ZonePointsTopDocVo> getCurrentUserPointsTopDoc(@PathVariable("zoneId") Long zoneId) {
|
||||
return genericsSuccess(zonePointsAccountService.getCurrentUserPointsTopDoc(zoneId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录用户的置顶项目信息
|
||||
*/
|
||||
@GetMapping("/project/top/{zoneId}")
|
||||
@ApiOperation(value = "获取当前登录用户的置顶项目信息")
|
||||
public GenericsAjaxResult<ZonePointsTopProjectVo> getZonePointsTopProject(@PathVariable("zoneId") Long zoneId) {
|
||||
return genericsSuccess(zonePointsAccountService.getZonePointsTopProject(zoneId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目置顶积分扣减(前台用户操作,业务层已做会员身份+积分专区+积分校验)
|
||||
* 用户使用当前登录用户
|
||||
*/
|
||||
@PostMapping("/project/top")
|
||||
@ApiOperation(value = "项目置顶积分扣减")
|
||||
public AjaxResult topProject(@RequestBody ZonePointsProjectTopInputVo inputVo) {
|
||||
zonePointsAccountService.deductPointsForProjectTop(inputVo.getZoneId(), inputVo.getId(), inputVo.getName());
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 线下活动积分冻结(前台用户操作,业务层已做会员身份+积分专区+幂等+积分校验)
|
||||
*/
|
||||
@PostMapping("/offlineActivity/freeze")
|
||||
@ApiOperation(value = "线下活动积分冻结")
|
||||
public AjaxResult freezePointsForOfflineActivity(@RequestBody ZonePointsApplyInputVo inputVo) {
|
||||
zonePointsAccountService.freezePointsForOfflineActivity(inputVo);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 专家答疑积分冻结(前台用户操作,业务层已做会员身份+积分专区+幂等+积分校验)
|
||||
*/
|
||||
@PostMapping("/expert/qa/freeze")
|
||||
@ApiOperation(value = "专家答疑积分冻结")
|
||||
public AjaxResult freezePointsForExpertQa(@RequestBody ZonePointsApplyInputVo inputVo) {
|
||||
zonePointsAccountService.freezePointsForExpertQa(inputVo);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 驳回积分申请(管理员操作)
|
||||
* 查询对应申请记录(pending状态),更新状态为fail,
|
||||
* 同时更新pointsEvent的subject括号内容为"已退回"、replyContent为驳回原因,
|
||||
* 并触发积分解冻操作
|
||||
*/
|
||||
@RequiresPermissions("zone:points:account:reject")
|
||||
@Log(title = "驳回积分申请", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/apply/reject")
|
||||
@ApiOperation(value = "驳回积分申请")
|
||||
public AjaxResult rejectPointsApply(@RequestBody ZonePointsApplyInputVo inputVo) {
|
||||
zonePointsAccountService.rejectPointsApply(inputVo);
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过积分申请(管理员操作)
|
||||
* 查询对应申请记录(pending状态),更新状态为success,
|
||||
* 同时更新pointsEvent的subject去除原括号内容,
|
||||
* 并从冻结积分中正式扣减积分(含总积分扣减)
|
||||
*/
|
||||
@RequiresPermissions("zone:points:account:approve")
|
||||
@Log(title = "通过积分申请", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/apply/approve")
|
||||
@ApiOperation(value = "通过积分申请")
|
||||
public AjaxResult approvePointsApply(@RequestBody ZonePointsApplyInputVo inputVo) {
|
||||
zonePointsAccountService.approvePointsApply(inputVo);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
package com.microservices.zone.member.controller;
|
||||
|
||||
import com.microservices.common.core.web.controller.BaseController;
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
import com.microservices.common.core.web.domain.GenericsAjaxResult;
|
||||
import com.microservices.common.core.web.page.GenericsTableDataInfo;
|
||||
import com.microservices.common.log.annotation.Log;
|
||||
import com.microservices.common.log.enums.BusinessType;
|
||||
import com.microservices.common.security.annotation.RequiresPermissions;
|
||||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.zone.member.domain.points.ZonePointsApply;
|
||||
import com.microservices.zone.member.domain.vo.ZonePointsApplyDetailVo;
|
||||
import com.microservices.zone.member.domain.vo.ZonePointsApplyInputVo;
|
||||
import com.microservices.zone.member.domain.vo.ZonePointsApplySearchVo;
|
||||
import com.microservices.zone.member.domain.vo.ZonePointsApplyUpdateVo;
|
||||
import com.microservices.zone.member.service.IZonePointsApplyService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 积分申请表Controller
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/points/apply")
|
||||
@Api(tags = "积分申请表接口")
|
||||
public class ZonePointsApplyController extends BaseController {
|
||||
@Autowired
|
||||
private IZonePointsApplyService zonePointsApplyService;
|
||||
|
||||
/**
|
||||
* 查询积分申请列表
|
||||
*/
|
||||
@RequiresPermissions("zone:points:apply:list")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询积分申请列表")
|
||||
public GenericsTableDataInfo<ZonePointsApplyDetailVo> list(ZonePointsApplySearchVo searchVo) {
|
||||
startPage();
|
||||
return zonePointsApplyService.selectZonePointsApplyList(searchVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我的积分申请列表
|
||||
*/
|
||||
@GetMapping("/my/list")
|
||||
@ApiOperation("查询我的积分申请列表")
|
||||
public GenericsTableDataInfo<ZonePointsApplyDetailVo> myList(ZonePointsApplySearchVo searchVo) {
|
||||
startPage();
|
||||
searchVo.setUserId(SecurityUtils.getUserId());
|
||||
return zonePointsApplyService.selectZonePointsApplyList(searchVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取积分申请详细信息
|
||||
*/
|
||||
@RequiresPermissions("zone:points:apply:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation(value = "获取积分申请详细信息")
|
||||
public GenericsAjaxResult<ZonePointsApply> getInfo(@PathVariable("id") Long id) {
|
||||
return genericsSuccess(zonePointsApplyService.selectZonePointsApplyById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增积分申请
|
||||
*/
|
||||
@RequiresPermissions("zone:points:apply:add")
|
||||
@Log(title = "积分申请", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增积分申请")
|
||||
public AjaxResult add(@RequestBody ZonePointsApplyInputVo inputVo) {
|
||||
return toAjax(zonePointsApplyService.insertZonePointsApply(inputVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改积分申请
|
||||
*/
|
||||
@RequiresPermissions("zone:points:apply:edit")
|
||||
@Log(title = "积分申请", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改积分申请")
|
||||
public AjaxResult edit(@RequestBody ZonePointsApplyUpdateVo updateVo) {
|
||||
return toAjax(zonePointsApplyService.updateZonePointsApply(updateVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除积分申请
|
||||
*/
|
||||
@RequiresPermissions("zone:points:apply:remove")
|
||||
@Log(title = "积分申请", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation(value = "删除积分申请")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(zonePointsApplyService.deleteZonePointsApplyByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID和专区ID查询积分申请列表
|
||||
*/
|
||||
@RequiresPermissions("zone:points:apply:query")
|
||||
@GetMapping("/user/{userId}/zone/{zoneId}")
|
||||
@ApiOperation(value = "根据用户ID和专区ID查询积分申请列表")
|
||||
public GenericsAjaxResult<List<ZonePointsApply>> getByUserIdAndZoneId(@PathVariable("userId") Long userId,
|
||||
@PathVariable("zoneId") Long zoneId) {
|
||||
return genericsSuccess(zonePointsApplyService.selectZonePointsApplyByUserIdAndZoneId(userId, zoneId));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
package com.microservices.zone.member.controller;
|
||||
|
||||
import com.microservices.common.core.web.controller.BaseController;
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
import com.microservices.common.core.web.domain.GenericsAjaxResult;
|
||||
import com.microservices.common.core.web.page.GenericsTableDataInfo;
|
||||
import com.microservices.common.log.annotation.Log;
|
||||
import com.microservices.common.log.enums.BusinessType;
|
||||
import com.microservices.common.security.annotation.RequiresPermissions;
|
||||
import com.microservices.zone.member.domain.points.ZonePointsTransaction;
|
||||
import com.microservices.zone.member.domain.vo.ZonePointsTransactionInputVo;
|
||||
import com.microservices.zone.member.domain.vo.ZonePointsTransactionSearchVo;
|
||||
import com.microservices.zone.member.domain.vo.ZonePointsTransactionUpdateVo;
|
||||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.zone.member.service.IZonePointsTransactionService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 专区积分流水Controller
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/points/transaction")
|
||||
@Api(tags = "专区积分流水接口")
|
||||
public class ZonePointsTransactionController extends BaseController {
|
||||
@Autowired
|
||||
private IZonePointsTransactionService zonePointsTransactionService;
|
||||
|
||||
/**
|
||||
* 查询专区积分流水列表
|
||||
*/
|
||||
@RequiresPermissions("zone:points:transaction:list")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询专区积分流水列表")
|
||||
public GenericsTableDataInfo<ZonePointsTransaction> list(ZonePointsTransactionSearchVo searchVo) {
|
||||
startPage();
|
||||
List<ZonePointsTransaction> list = zonePointsTransactionService.selectZonePointsTransactionList(searchVo.toZonePointsTransaction());
|
||||
return getGenericsDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取专区积分流水详细信息
|
||||
*/
|
||||
@RequiresPermissions("zone:points:transaction:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation(value = "获取专区积分流水详细信息")
|
||||
public GenericsAjaxResult<ZonePointsTransaction> getInfo(@PathVariable("id") Long id) {
|
||||
return genericsSuccess(zonePointsTransactionService.selectZonePointsTransactionById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据事件ID查询流水列表
|
||||
*/
|
||||
@RequiresPermissions("zone:points:transaction:query")
|
||||
@GetMapping("/event/{eventId}")
|
||||
@ApiOperation(value = "根据事件ID查询流水列表")
|
||||
public GenericsAjaxResult<List<ZonePointsTransaction>> getByEventId(@PathVariable("eventId") String eventId) {
|
||||
return genericsSuccess(zonePointsTransactionService.selectZonePointsTransactionByEventId(eventId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据账户ID查询流水列表
|
||||
*/
|
||||
@RequiresPermissions("zone:points:transaction:query")
|
||||
@GetMapping("/account/{accountId}")
|
||||
@ApiOperation(value = "根据账户ID查询流水列表")
|
||||
public GenericsAjaxResult<List<ZonePointsTransaction>> getByAccountId(@PathVariable("accountId") Long accountId) {
|
||||
return genericsSuccess(zonePointsTransactionService.selectZonePointsTransactionByAccountId(accountId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID和专区ID查询流水列表
|
||||
*/
|
||||
@RequiresPermissions("zone:points:transaction:query")
|
||||
@GetMapping("/user/{userId}/zone/{zoneId}")
|
||||
@ApiOperation(value = "根据用户ID和专区ID查询流水列表")
|
||||
public GenericsAjaxResult<List<ZonePointsTransaction>> getByUserIdAndZoneId(@PathVariable("userId") Long userId,
|
||||
@PathVariable("zoneId") Long zoneId) {
|
||||
return genericsSuccess(zonePointsTransactionService.selectZonePointsTransactionByUserIdAndZoneId(userId, zoneId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据专区ID获取当前用户积分明细(分页)
|
||||
*/
|
||||
@GetMapping("/my/{zoneId}")
|
||||
@ApiOperation(value = "根据专区ID获取当前用户积分明细(分页)")
|
||||
public GenericsTableDataInfo<ZonePointsTransaction> getMyPointsDetailsByZone(@PathVariable("zoneId") Long zoneId,
|
||||
ZonePointsTransactionSearchVo searchVo) {
|
||||
startPage();
|
||||
List<ZonePointsTransaction> list = zonePointsTransactionService.selectMyPointsTransactionDetailsByZone(zoneId, SecurityUtils.getUserId(), searchVo.getTransactionType());
|
||||
return getGenericsDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询当前登录用户流水列表(合并后所有业务字段已包含在流水中)
|
||||
*/
|
||||
@GetMapping("/currentUser/{zoneId}")
|
||||
@ApiOperation(value = "分页查询当前登录用户流水列表")
|
||||
public GenericsTableDataInfo<ZonePointsTransaction> getCurrentUserTransactionList(@PathVariable("zoneId") Long zoneId) {
|
||||
startPage();
|
||||
List<ZonePointsTransaction> list = zonePointsTransactionService.selectCurrentUserTransactionWithEvent(SecurityUtils.getUserId(), zoneId);
|
||||
return getGenericsDataTable(list);
|
||||
}
|
||||
}
|
||||
|
|
@ -5,14 +5,10 @@ import com.microservices.common.core.annotation.Excel;
|
|||
import com.microservices.common.core.web.domain.BaseEntity;
|
||||
import com.microservices.system.api.domain.SysDept;
|
||||
import com.microservices.system.api.domain.SysUser;
|
||||
import com.microservices.zone.member.domain.points.ZonePointsAccount;
|
||||
import com.microservices.zone.member.domain.points.ZonePointsApply;
|
||||
import com.microservices.zone.member.domain.points.ZonePointsTransaction;
|
||||
import com.microservices.zone.member.domain.vo.ZoneMemberDataVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 特色专区会员对象 zone_member
|
||||
|
|
@ -96,18 +92,6 @@ public class ZoneMember extends BaseEntity {
|
|||
private SysUser sysUser;
|
||||
private SysDept sysDept;
|
||||
private ZoneMemberLevel zoneMemberLevel;
|
||||
private ZonePointsAccount zonePointsAccount;
|
||||
|
||||
/**
|
||||
* 积分流水(合并后由 zone_points_transaction 表承载事件信息)
|
||||
*/
|
||||
private ZonePointsTransaction pointsEvent;
|
||||
|
||||
/**
|
||||
* 积分申请列表
|
||||
*/
|
||||
private List<ZonePointsApply> applyList;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date auditTime;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
package com.microservices.zone.member.domain;
|
||||
|
||||
import com.microservices.zone.member.domain.ZoneMember;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* ZoneMember with full-text search score
|
||||
* 用于全局搜索结果,包含全文搜索相关度评分
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ZoneMemberWithScore extends ZoneMember implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 全文搜索相关度评分(来自 MySQL MATCH...AGAINST)
|
||||
*/
|
||||
private Double searchScore;
|
||||
|
||||
private String memberTypeName;
|
||||
|
||||
private String memberLevelName;
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
package com.microservices.zone.member.domain.points;
|
||||
|
||||
import com.microservices.common.core.annotation.Excel;
|
||||
import com.microservices.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 专区积分账户对象 zone_points_account
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
public class ZonePointsAccount extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 积分账户主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 专区ID(积分按专区隔离)
|
||||
*/
|
||||
@Excel(name = "专区ID")
|
||||
private Long zoneId;
|
||||
|
||||
/**
|
||||
* 累计积分
|
||||
*/
|
||||
@Excel(name = "累计积分")
|
||||
private Integer totalPoints;
|
||||
|
||||
/**
|
||||
* 累计获取积分
|
||||
*/
|
||||
@Excel(name = "累计获取积分")
|
||||
private Integer totalEarnedPoints;
|
||||
|
||||
/**
|
||||
* 累计消费积分
|
||||
*/
|
||||
@Excel(name = "累计消费积分")
|
||||
private Integer totalConsumedPoints;
|
||||
|
||||
/**
|
||||
* 可用积分
|
||||
*/
|
||||
@Excel(name = "可用积分")
|
||||
private Integer availablePoints;
|
||||
|
||||
/**
|
||||
* 冻结积分
|
||||
*/
|
||||
@Excel(name = "冻结积分")
|
||||
private Integer frozenPoints;
|
||||
|
||||
/**
|
||||
* 所属组织ID
|
||||
*/
|
||||
@Excel(name = "所属组织ID")
|
||||
private Long deptId;
|
||||
}
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
package com.microservices.zone.member.domain.points;
|
||||
|
||||
import com.microservices.common.core.annotation.Excel;
|
||||
import com.microservices.common.core.web.domain.BaseEntity;
|
||||
import com.microservices.system.api.domain.SysUser;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 积分申请表 zone_points_apply
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
public class ZonePointsApply extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Excel(name = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 专区ID
|
||||
*/
|
||||
@Excel(name = "专区ID")
|
||||
private Long zoneId;
|
||||
|
||||
/**
|
||||
* 组织ID
|
||||
*/
|
||||
@Excel(name = "组织ID")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 申请类型(如:download下载/redeem兑换等)
|
||||
*/
|
||||
@Excel(name = "申请类型")
|
||||
private String applyType;
|
||||
|
||||
/**
|
||||
* 事件ID(关联积分流水事件)
|
||||
*/
|
||||
@Excel(name = "事件ID")
|
||||
private String eventId;
|
||||
|
||||
/**
|
||||
* 回复/响应内容
|
||||
*/
|
||||
@Excel(name = "回复/响应内容")
|
||||
private String reply;
|
||||
|
||||
/**
|
||||
* 状态:pending待处理/success成功/fail失败/rejected已拒绝
|
||||
*/
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 申请积分数量
|
||||
*/
|
||||
@Excel(name = "申请积分数量")
|
||||
private Integer points;
|
||||
|
||||
/**
|
||||
* 回复人ID
|
||||
*/
|
||||
@Excel(name = "回复人ID")
|
||||
private Long replyId;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Excel(name = "手机号")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 真实姓名
|
||||
*/
|
||||
@Excel(name = "真实姓名")
|
||||
private String realName;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Excel(name = "描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 组织
|
||||
*/
|
||||
@Excel(name = "组织")
|
||||
private String organization;
|
||||
|
||||
/**
|
||||
* 微信号
|
||||
*/
|
||||
@Excel(name = "微信号")
|
||||
private String wechat;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
@Excel(name = "邮箱")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 专区成员名称
|
||||
*/
|
||||
private String memberName;
|
||||
|
||||
/**
|
||||
* 系统用户信息
|
||||
*/
|
||||
private SysUser sysUser;
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
package com.microservices.zone.member.domain.points;
|
||||
|
||||
import com.microservices.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 专区积分文档对象 zone_points_doc
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
public class ZonePointsDoc extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 专区ID
|
||||
*/
|
||||
private Long zoneId;
|
||||
|
||||
/**
|
||||
* 文章ID
|
||||
*/
|
||||
private Long docId;
|
||||
|
||||
/**
|
||||
* 初始访问次数
|
||||
*/
|
||||
private Integer pointsStartVisits;
|
||||
|
||||
/**
|
||||
* 已触发积分次数
|
||||
*/
|
||||
private Integer pointsTriggerCount;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
private Date expiryTime;
|
||||
|
||||
/**
|
||||
* 是否积分置顶(0代表不置顶 1代表置顶)
|
||||
*/
|
||||
private Boolean isPointsTop;
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
package com.microservices.zone.member.domain.points;
|
||||
|
||||
import com.microservices.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 积分异步任务失败记录对象 zone_points_fail_log
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
public class ZonePointsFailLog extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 任务完整JSON数据
|
||||
*/
|
||||
private String taskData;
|
||||
|
||||
/**
|
||||
* 失败时间
|
||||
*/
|
||||
private Date failTime;
|
||||
|
||||
/**
|
||||
* 最后失败原因
|
||||
*/
|
||||
private String lastError;
|
||||
|
||||
/**
|
||||
* 处理状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 处理时间
|
||||
*/
|
||||
private Date processTime;
|
||||
|
||||
/**
|
||||
* 人工处理备注
|
||||
*/
|
||||
private String processRemark;
|
||||
}
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
package com.microservices.zone.member.domain.points;
|
||||
|
||||
import com.microservices.common.core.annotation.Excel;
|
||||
import com.microservices.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 专区积分流水对象 zone_points_transaction(合并事件+流水)
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
public class ZonePointsTransaction extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 流水主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 事件ID(关联同一事件的所有操作)
|
||||
*/
|
||||
@Excel(name = "事件ID")
|
||||
private String eventId;
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*/
|
||||
@Excel(name = "事件类型")
|
||||
private String eventType;
|
||||
|
||||
/**
|
||||
* 积分账户ID
|
||||
*/
|
||||
@Excel(name = "积分账户ID")
|
||||
private Long accountId;
|
||||
|
||||
/**
|
||||
* 类型:add增/reduce减/freezed冻结/unfreezed解冻
|
||||
*/
|
||||
@Excel(name = "类型")
|
||||
private String transactionType;
|
||||
|
||||
/**
|
||||
* 积分数量(正数)
|
||||
*/
|
||||
@Excel(name = "积分数量")
|
||||
private Integer points;
|
||||
|
||||
/**
|
||||
* 变动后可用积分
|
||||
*/
|
||||
@Excel(name = "变动后可用积分")
|
||||
private Integer availableAfter;
|
||||
|
||||
/**
|
||||
* 变动后冻结积分
|
||||
*/
|
||||
@Excel(name = "变动后冻结积分")
|
||||
private Integer frozenAfter;
|
||||
|
||||
/**
|
||||
* 操作人ID
|
||||
*/
|
||||
@Excel(name = "操作人ID")
|
||||
private Long operatorId;
|
||||
|
||||
/**
|
||||
* 变动原因
|
||||
*/
|
||||
@Excel(name = "变动原因")
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 回复内容
|
||||
*/
|
||||
@Excel(name = "回复内容")
|
||||
private String replyContent;
|
||||
|
||||
/**
|
||||
* 来源ID
|
||||
*/
|
||||
@Excel(name = "来源ID")
|
||||
private Long sourceId;
|
||||
|
||||
/**
|
||||
* 来源数据
|
||||
*/
|
||||
@Excel(name = "来源数据")
|
||||
private String sourceData;
|
||||
|
||||
/**
|
||||
* 主题
|
||||
*/
|
||||
@Excel(name = "主题")
|
||||
private String subject;
|
||||
|
||||
/**
|
||||
* 主题描述
|
||||
*/
|
||||
@Excel(name = "主题描述")
|
||||
private String subjectDesc;
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
package com.microservices.zone.member.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 专区会员分类(含已审核会员数量)对象
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("专区会员分类(含已审核会员数量)对象")
|
||||
public class ZoneMemberTypeCountVo {
|
||||
@ApiModelProperty(value = "专区会员分类Id")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "专区会员分类名称")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "专区会员分类简介")
|
||||
private String introduction;
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
@ApiModelProperty(value = "已审核会员数量")
|
||||
private Long memberCount;
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
package com.microservices.zone.member.domain.vo;
|
||||
|
||||
import com.microservices.zone.member.domain.points.ZonePointsAccount;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 积分账户输入对象
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("积分账户输入对象")
|
||||
public class ZonePointsAccountInputVo {
|
||||
@ApiModelProperty(value = "用户ID", required = true)
|
||||
@NotNull
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "专区ID", required = true)
|
||||
@NotNull
|
||||
private Long zoneId;
|
||||
|
||||
@ApiModelProperty(value = "累计积分")
|
||||
private Integer totalPoints;
|
||||
|
||||
@ApiModelProperty(value = "累计获取积分")
|
||||
private Integer totalEarnedPoints;
|
||||
|
||||
@ApiModelProperty(value = "累计消费积分")
|
||||
private Integer totalConsumedPoints;
|
||||
|
||||
@ApiModelProperty(value = "可用积分")
|
||||
private Integer availablePoints;
|
||||
|
||||
@ApiModelProperty(value = "冻结积分")
|
||||
private Integer frozenPoints;
|
||||
|
||||
public ZonePointsAccount toZonePointsAccount() {
|
||||
ZonePointsAccount zonePointsAccount = new ZonePointsAccount();
|
||||
zonePointsAccount.setUserId(userId);
|
||||
zonePointsAccount.setZoneId(zoneId);
|
||||
zonePointsAccount.setTotalPoints(totalPoints != null ? totalPoints : 0);
|
||||
zonePointsAccount.setTotalEarnedPoints(totalEarnedPoints != null ? totalEarnedPoints : 0);
|
||||
zonePointsAccount.setTotalConsumedPoints(totalConsumedPoints != null ? totalConsumedPoints : 0);
|
||||
zonePointsAccount.setAvailablePoints(availablePoints != null ? availablePoints : 0);
|
||||
zonePointsAccount.setFrozenPoints(frozenPoints != null ? frozenPoints : 0);
|
||||
return zonePointsAccount;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
package com.microservices.zone.member.domain.vo;
|
||||
|
||||
import com.microservices.zone.member.domain.points.ZonePointsAccount;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 积分账户搜索对象
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("积分账户搜索对象")
|
||||
public class ZonePointsAccountSearchVo {
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "专区ID")
|
||||
private Long zoneId;
|
||||
|
||||
public ZonePointsAccount toZonePointsAccount() {
|
||||
ZonePointsAccount zonePointsAccount = new ZonePointsAccount();
|
||||
zonePointsAccount.setUserId(userId);
|
||||
zonePointsAccount.setZoneId(zoneId);
|
||||
return zonePointsAccount;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
package com.microservices.zone.member.domain.vo;
|
||||
|
||||
import com.microservices.zone.member.domain.points.ZonePointsAccount;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 积分账户更新对象
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("积分账户更新对象")
|
||||
public class ZonePointsAccountUpdateVo {
|
||||
|
||||
@ApiModelProperty(value = "积分账户ID", required = true)
|
||||
@NotNull
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "累计积分")
|
||||
private int totalPoints;
|
||||
|
||||
@ApiModelProperty(value = "累计获取积分")
|
||||
private int totalEarnedPoints;
|
||||
|
||||
@ApiModelProperty(value = "累计消费积分")
|
||||
private int totalConsumedPoints;
|
||||
|
||||
@ApiModelProperty(value = "可用积分")
|
||||
private int availablePoints;
|
||||
|
||||
@ApiModelProperty(value = "冻结积分")
|
||||
private int frozenPoints;
|
||||
|
||||
public ZonePointsAccount toZonePointsAccount() {
|
||||
ZonePointsAccount zonePointsAccount = new ZonePointsAccount();
|
||||
zonePointsAccount.setId(id);
|
||||
zonePointsAccount.setTotalPoints(totalPoints);
|
||||
zonePointsAccount.setTotalEarnedPoints(totalEarnedPoints);
|
||||
zonePointsAccount.setTotalConsumedPoints(totalConsumedPoints);
|
||||
zonePointsAccount.setAvailablePoints(availablePoints);
|
||||
zonePointsAccount.setFrozenPoints(frozenPoints);
|
||||
return zonePointsAccount;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.microservices.zone.member.domain.vo;
|
||||
|
||||
import com.microservices.zone.member.domain.points.ZonePointsApply;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 积分申请详情VO(含系统用户信息)
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
public class ZonePointsApplyDetailVo extends ZonePointsApply {
|
||||
@ApiModelProperty("GitLink账号")
|
||||
private String userName;
|
||||
@ApiModelProperty("GitLink个人主页地址")
|
||||
private String gitLinkUserUrl;
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
package com.microservices.zone.member.domain.vo;
|
||||
|
||||
import com.microservices.zone.member.domain.points.ZonePointsApply;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 积分申请输入对象
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("积分申请输入对象")
|
||||
public class ZonePointsApplyInputVo {
|
||||
@ApiModelProperty(value = "申请记录ID(驳回操作时必填)")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "用户ID", required = true)
|
||||
@NotNull
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "专区ID", required = true)
|
||||
@NotNull
|
||||
private Long zoneId;
|
||||
|
||||
@ApiModelProperty(value = "组织ID", required = true)
|
||||
@NotNull
|
||||
private Long deptId;
|
||||
|
||||
@ApiModelProperty(value = "申请类型(如:download下载/redeem兑换等)", required = true)
|
||||
@NotNull
|
||||
private String applyType;
|
||||
|
||||
@ApiModelProperty(value = "事件ID(关联积分流水事件)")
|
||||
private String eventId;
|
||||
|
||||
@ApiModelProperty(value = "申请积分数量")
|
||||
private Integer points;
|
||||
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "真实姓名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty(value = "描述")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty(value = "回复/驳回内容")
|
||||
private String reply;
|
||||
|
||||
@ApiModelProperty(value = "组织")
|
||||
private String organization;
|
||||
|
||||
@ApiModelProperty(value = "微信号")
|
||||
private String wechat;
|
||||
|
||||
@ApiModelProperty(value = "邮箱")
|
||||
private String email;
|
||||
|
||||
public ZonePointsApply toZonePointsApply() {
|
||||
ZonePointsApply zonePointsApply = new ZonePointsApply();
|
||||
zonePointsApply.setUserId(userId);
|
||||
zonePointsApply.setZoneId(zoneId);
|
||||
zonePointsApply.setDeptId(deptId);
|
||||
zonePointsApply.setApplyType(applyType);
|
||||
zonePointsApply.setEventId(eventId);
|
||||
zonePointsApply.setPoints(points);
|
||||
zonePointsApply.setStatus("pending");
|
||||
zonePointsApply.setPhone(phone);
|
||||
zonePointsApply.setRealName(realName);
|
||||
zonePointsApply.setDescription(description);
|
||||
zonePointsApply.setOrganization(organization);
|
||||
zonePointsApply.setWechat(wechat);
|
||||
zonePointsApply.setEmail(email);
|
||||
return zonePointsApply;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
package com.microservices.zone.member.domain.vo;
|
||||
|
||||
import com.microservices.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 积分申请搜索对象
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("积分申请搜索对象")
|
||||
public class ZonePointsApplySearchVo extends BaseEntity {
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "专区ID")
|
||||
private Long zoneId;
|
||||
|
||||
@ApiModelProperty(value = "申请类型")
|
||||
private String applyType;
|
||||
|
||||
@ApiModelProperty(value = "事件ID")
|
||||
private String eventId;
|
||||
|
||||
@ApiModelProperty(value = "状态")
|
||||
private String status;
|
||||
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "真实姓名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty(value = "邮箱")
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty(value = "成员名称")
|
||||
private String memberName;
|
||||
|
||||
@ApiModelProperty(value = "系统用户名")
|
||||
private String userName;
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
package com.microservices.zone.member.domain.vo;
|
||||
|
||||
import com.microservices.zone.member.domain.points.ZonePointsApply;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 积分申请修改对象
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("积分申请修改对象")
|
||||
public class ZonePointsApplyUpdateVo {
|
||||
@ApiModelProperty(value = "主键ID", required = true)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "回复/响应内容")
|
||||
private String reply;
|
||||
|
||||
@ApiModelProperty(value = "状态:pending待处理/success成功/fail失败/rejected已拒绝")
|
||||
private String status;
|
||||
|
||||
@ApiModelProperty(value = "事件ID(关联积分流水事件)")
|
||||
private String eventId;
|
||||
|
||||
@ApiModelProperty(value = "回复人ID")
|
||||
private Long replyId;
|
||||
|
||||
public ZonePointsApply toZonePointsApply() {
|
||||
ZonePointsApply zonePointsApply = new ZonePointsApply();
|
||||
zonePointsApply.setId(id);
|
||||
zonePointsApply.setReply(reply);
|
||||
zonePointsApply.setStatus(status);
|
||||
zonePointsApply.setEventId(eventId);
|
||||
zonePointsApply.setReplyId(replyId);
|
||||
return zonePointsApply;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
package com.microservices.zone.member.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 文章置顶积分扣减输入对象
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("文章置顶积分扣减请求")
|
||||
public class ZonePointsArticleTopInputVo {
|
||||
|
||||
@ApiModelProperty(value = "组织ID", required = true)
|
||||
private Long deptId;
|
||||
|
||||
@ApiModelProperty(value = "专区ID", required = true)
|
||||
private Long zoneId;
|
||||
|
||||
@ApiModelProperty(value = "文章ID", required = true)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "文章名称", required = true)
|
||||
private String name;
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
package com.microservices.zone.member.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 专区积分账户总览对象
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("专区积分账户总览对象")
|
||||
public class ZonePointsOverviewVo {
|
||||
@ApiModelProperty(value = "积分账户ID")
|
||||
private Long accountId;
|
||||
|
||||
@ApiModelProperty(value = "专区ID")
|
||||
private Long zoneId;
|
||||
|
||||
@ApiModelProperty(value = "累计获取积分")
|
||||
private Integer totalEarnedPoints;
|
||||
|
||||
@ApiModelProperty(value = "累计消费积分")
|
||||
private Integer totalConsumedPoints;
|
||||
|
||||
@ApiModelProperty(value = "当前可用积分")
|
||||
private Integer availablePoints;
|
||||
|
||||
@ApiModelProperty(value = "冻结积分")
|
||||
private Integer frozenPoints;
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
package com.microservices.zone.member.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 项目置顶积分扣减输入对象
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("项目置顶积分扣减请求")
|
||||
public class ZonePointsProjectTopInputVo {
|
||||
|
||||
@ApiModelProperty(value = "组织ID", required = true)
|
||||
private Long deptId;
|
||||
|
||||
@ApiModelProperty(value = "专区ID", required = true)
|
||||
private Long zoneId;
|
||||
|
||||
@ApiModelProperty(value = "项目ID", required = true)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "项目名称", required = true)
|
||||
private String name;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue