Compare commits
No commits in common. "master" and "master" have entirely different histories.
|
|
@ -43,7 +43,6 @@ nbdist/
|
|||
*.log
|
||||
*.xml.versionsBackup
|
||||
*.swp
|
||||
logs
|
||||
|
||||
!*/build/*.java
|
||||
!*/build/*.html
|
||||
|
|
|
|||
36
README.md
36
README.md
|
|
@ -1,36 +0,0 @@
|
|||
## 系统模块
|
||||
|
||||
~~~
|
||||
com.microservices
|
||||
├── microservices-ui // 前端框架
|
||||
├── microservices-gateway // 网关模块
|
||||
├── microservices-auth // 认证中心
|
||||
├── microservices-api // 接口模块
|
||||
│ └── microservices-api-system // 系统接口
|
||||
├── microservices-common // 通用模块
|
||||
│ └── microservices-common-async // 异步线程池配置
|
||||
│ └── microservices-common-core // 核心模块
|
||||
│ └── microservices-common-datascope // 权限范围
|
||||
│ └── microservices-common-datasource // 多数据源
|
||||
│ └── microservices-common-httpClient // http调用
|
||||
│ └── microservices-common-log // 日志记录
|
||||
│ └── microservices-common-redis // 缓存服务
|
||||
│ └── microservices-common-seata // seata分布式事务
|
||||
│ └── microservices-common-security // 安全模块
|
||||
│ └── microservices-common-swagger // 系统接口
|
||||
├── microservices-modules // 业务模块
|
||||
│ └── microservices-cms // 内容管理模块
|
||||
│ └── microservices-dms // 数据管理体系模块
|
||||
│ └── microservices-dss // 数据统计系统模块
|
||||
│ └── microservices-file // 文件服务
|
||||
│ └── microservices-gen // 代码生成
|
||||
│ └── microservices-job // 定时任务
|
||||
│ └── microservices-pms // 项目管理系统模块
|
||||
│ └── microservices-system // 系统模块
|
||||
│ └── microservices-wiki // Wiki模块
|
||||
│ └── microservices-zone // 特色专区系统模块
|
||||
├── microservices-visual // 图形化管理模块
|
||||
│ └── microservices-visual-monitor // 监控中心
|
||||
├──pom.xml // 公共依赖
|
||||
~~~
|
||||
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ import com.microservices.system.api.domain.SysLogininfor;
|
|||
import com.microservices.system.api.domain.SysOperLog;
|
||||
import com.microservices.system.api.factory.RemoteLogFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
|
||||
/**
|
||||
* 日志服务
|
||||
|
|
@ -38,20 +38,4 @@ public interface RemoteLogService
|
|||
*/
|
||||
@PostMapping("/logininfor")
|
||||
public R<Boolean> saveLogininfor(@RequestBody SysLogininfor sysLogininfor, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 获取操作日志列表
|
||||
*
|
||||
* @param title 日志标题
|
||||
* @param operUrl 操作地址
|
||||
* @param status 操作状态
|
||||
* @param topN 获取最新N条
|
||||
* @return 操作日志列表
|
||||
*/
|
||||
@GetMapping("/operlog/latest")
|
||||
R<List<SysOperLog>> getLatestOperLogList(@RequestParam(value = "title", required = false) String title,
|
||||
@RequestParam(value = "operUrl", required = false) String operUrl,
|
||||
@RequestParam(value = "status", required = false) Integer status,
|
||||
@RequestParam(value = "topN") Integer topN,
|
||||
@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}")
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 日志服务降级处理
|
||||
*
|
||||
|
|
@ -38,12 +36,6 @@ public class RemoteLogFallbackFactory implements FallbackFactory<RemoteLogServic
|
|||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<List<SysOperLog>> getLatestOperLogList(String title, String operUrl, Integer status, Integer topN, 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;
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
|||
|
||||
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
public static String YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm";
|
||||
|
||||
private static String[] parsePatterns = {
|
||||
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
|
||||
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
|
||||
|
|
@ -267,9 +265,4 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
|||
cal.add(Calendar.DATE, -7 * times);
|
||||
return DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, cal.getTime());
|
||||
}
|
||||
|
||||
public static long dateTimeToUnix(Date date) {
|
||||
// date.getTime() 返回当前 Date 对象表示的毫秒数,除以 1000 后得到以秒为单位的时间戳,即 10 位时间戳
|
||||
return date.getTime() / 1000;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -223,18 +231,18 @@ public class CmsDocController extends BaseController {
|
|||
public AjaxResult editCmsDIr(@ApiParam(name = "id", value = "栏目Id") @PathVariable Long id,
|
||||
@ApiParam(name = "cmsDirUpdateVo", value = "栏目更新对象") @RequestBody CmsDirUpdateVo cmsDirUpdateVo) {
|
||||
cmsDocService.updateCmsDir(id, cmsDirUpdateVo);
|
||||
return success("栏目信息更新成功");
|
||||
return success("异步更新栏目信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核文章信息
|
||||
*/
|
||||
@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());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询栏目列表
|
||||
*/
|
||||
|
|
@ -89,7 +68,7 @@ public class OpenController extends BaseController {
|
|||
public GenericsTableDataInfo<CmsDocBaseDto> docList(@ApiParam(name = "dirId", value = "栏目Id") @PathVariable("dirId") Long dirId
|
||||
, CmsDocSearchVo cmsDocSearchVo) {
|
||||
cmsDocSearchVo.setIsOpen(true);
|
||||
List<CmsDocBaseDto> list = cmsDocService.selectSetDefaultHeadImgCmsDocList(dirId, cmsDocSearchVo);
|
||||
List<CmsDocBaseDto> list = cmsDocService.selectCmsDocList(dirId, cmsDocSearchVo);
|
||||
return getAllGenericsDataTableToPage(list);
|
||||
}
|
||||
|
||||
|
|
@ -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("同步消息发送成功");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,9 +41,6 @@ public class CmsDir implements Comparable<CmsDir> {
|
|||
@ApiModelProperty(value = "排序", hidden = true)
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "文章头图")
|
||||
private String headImg;
|
||||
|
||||
public String getName() {
|
||||
if (name != null) {
|
||||
name = name.replaceAll(CmsConstants.DIR_SEPARATOR,
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ public class CmsDirUpdateVo {
|
|||
@ApiModelProperty(value = "顺序")
|
||||
private Integer order;
|
||||
|
||||
@ApiModelProperty(value = "文章头图")
|
||||
private String headImg;
|
||||
public CmsDir toCmsDir() {
|
||||
CmsDir cmsDir = new CmsDir();
|
||||
cmsDir.setName(name);
|
||||
return cmsDir;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,16 +162,10 @@ public class CmsDoc extends BaseSortEntity {
|
|||
*/
|
||||
private String keywords;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
public CmsDir copyToCmsDir() {
|
||||
CmsDir cmsDir = new CmsDir();
|
||||
cmsDir.setId(id);
|
||||
cmsDir.setName(name);
|
||||
cmsDir.setHeadImg(headImg);
|
||||
cmsDir.setSort(this.getSort());
|
||||
cmsDir.setCreatedAt(getCreateTime());
|
||||
return cmsDir;
|
||||
|
|
@ -201,8 +186,6 @@ public class CmsDoc extends BaseSortEntity {
|
|||
HotCmsDocDto hotCmsDocDto = new HotCmsDocDto();
|
||||
hotCmsDocDto.setId(id);
|
||||
hotCmsDocDto.setName(name);
|
||||
hotCmsDocDto.setSummary(summary);
|
||||
hotCmsDocDto.setPublishTime(publishTime);
|
||||
return hotCmsDocDto;
|
||||
}
|
||||
|
||||
|
|
@ -224,12 +207,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;
|
||||
}
|
||||
|
|
@ -1,13 +1,10 @@
|
|||
package com.microservices.cms.doc.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.microservices.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author otto
|
||||
*/
|
||||
|
|
@ -26,11 +23,4 @@ public class HotCmsDocDto {
|
|||
@Excel(name = "文章名称")
|
||||
@ApiModelProperty("文章名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("文章概要")
|
||||
private String summary;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty("发布时间")
|
||||
private Date publishTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package com.microservices.cms.doc.domain.gitlink;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
|
@ -24,12 +22,4 @@ public class EntryDto implements Comparable<EntryDto> {
|
|||
// 重写Comparable接口的compareTo方法,根据年龄升序排列,降序修改相减顺序即可
|
||||
return Math.toIntExact(entryDto.getCommit().getCreated_at_unix() - this.commit.getCreated_at_unix());
|
||||
}
|
||||
|
||||
public static EntryDto getEntryDtoFromJson(JSONObject subEntriesResult) {
|
||||
FileEntryDto fileEntryDto = subEntriesResult.toJavaObject(FileEntryDto.class);
|
||||
if (fileEntryDto == null || fileEntryDto.getEntries() == null) {
|
||||
throw new ServiceException("该文章不存在");
|
||||
}
|
||||
return fileEntryDto.getEntries();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
/**
|
||||
* 查询文章信息列表
|
||||
*
|
||||
|
|
@ -40,17 +31,6 @@ public interface CmsDocMapper {
|
|||
*/
|
||||
public List<CmsDoc> selectCmsDocList(CmsDocSearchVo cmsDocSearchVo);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询文章信息列表(设置默认头图为栏目头图)
|
||||
*
|
||||
* @param cmsDocSearchVo 文章信息
|
||||
* @return 文章信息集合
|
||||
*/
|
||||
List<CmsDoc> selectCmsDocListSetDefaultHeadImg(CmsDocSearchVo cmsDocSearchVo);
|
||||
|
||||
|
||||
/**
|
||||
* 新增文章信息
|
||||
*
|
||||
|
|
@ -91,11 +71,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);
|
||||
|
|
@ -197,50 +172,4 @@ public interface CmsDocMapper {
|
|||
Long getNotAuditCmsCountByDeptId(Long deptId);
|
||||
|
||||
Long getCmsDocVisitsByDeptId(Long deptId);
|
||||
|
||||
/**
|
||||
* 根据组织id获取专区下所有文章和栏目
|
||||
* @param deptId 组织id
|
||||
* @return 文章和栏目列表
|
||||
*/
|
||||
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
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public interface ICmsAsyncService {
|
|||
|
||||
void asyncCreateBranchAndDeleteFileAndCreatePR(CmsDoc newDocWithAudit, CmsProject cmsProject);
|
||||
|
||||
void asyncMoveFileToNewDir(CmsProject cmsProject, CmsDoc oldCmsDir, String newCmsDirName);
|
||||
void asyncMoveFileToNewDir(CmsProject cmsProject, CmsDoc oldCmsDir, CmsDoc newCmsDir);
|
||||
|
||||
/**
|
||||
* 推送文章数据到搜索引擎
|
||||
|
|
@ -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);
|
||||
|
||||
/**
|
||||
* 查询专区下文章数量
|
||||
*
|
||||
|
|
@ -300,12 +288,4 @@ public interface ICmsDocService {
|
|||
CmsDocBaseDto selectCmsDocBaseInfoById(Long id);
|
||||
|
||||
Long getCmsDocVisitsByDeptId(Long deptId);
|
||||
|
||||
List<CmsDocBaseDto> selectSetDefaultHeadImgCmsDocList(Long dirId, CmsDocSearchVo cmsDocSearchVo);
|
||||
|
||||
List<CmsDoc> selectCmsDocAndDirListByDept(Long deptId);
|
||||
|
||||
void updateCmsDocShaByPathAndDeptId(String sha, String filePath, Long deptId);
|
||||
|
||||
List<CmsDoc> getTmpDocList(CmsDoc cmsDoc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,18 +16,14 @@ import com.microservices.cms.project.service.ICmsProjectService;
|
|||
import com.microservices.cms.utils.CmsConstants;
|
||||
import com.microservices.cms.utils.CmsGitLinkRequestUrl;
|
||||
import com.microservices.cms.utils.CmsUtils;
|
||||
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;
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.common.core.utils.html.EscapeUtil;
|
||||
import com.microservices.common.core.utils.sign.Base64;
|
||||
import com.microservices.common.core.utils.uuid.IdUtils;
|
||||
import com.microservices.common.httpClient.constant.GitLinkConstants;
|
||||
import com.microservices.common.httpClient.service.HttpAPIService;
|
||||
|
|
@ -35,7 +31,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;
|
||||
|
|
@ -52,7 +47,6 @@ import org.springframework.util.DigestUtils;
|
|||
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -98,10 +92,7 @@ public class CmsAsyncServiceImpl implements ICmsAsyncService {
|
|||
@Autowired
|
||||
private RemoteZoneService remoteZoneService;
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
@Autowired
|
||||
private RequestConfig config;
|
||||
|
||||
/**
|
||||
* 异步设置文章更新时间
|
||||
*
|
||||
|
|
@ -118,7 +109,7 @@ public class CmsAsyncServiceImpl implements ICmsAsyncService {
|
|||
} else {
|
||||
redisService.setCacheObject(updateDocIntervalKey, cmsProject.getName(), 1L, TimeUnit.MINUTES);
|
||||
}
|
||||
CmsDocSearchVo cmsDocSearch = new CmsDocSearchVo();
|
||||
CmsDocSearchVo cmsDocSearch=new CmsDocSearchVo();
|
||||
cmsDocSearch.setDeptId(cmsProject.getDeptId());
|
||||
List<CmsDoc> cmsDocList = cmsDocMapper.selectCmsDocList(cmsDocSearch);
|
||||
for (EntryDto entryDto : entryDtoList) {
|
||||
|
|
@ -159,7 +150,7 @@ public class CmsAsyncServiceImpl implements ICmsAsyncService {
|
|||
webhook.put("eventCondition", "push");
|
||||
webhook.put("http_method", "POST");
|
||||
webhook.put("secret", "");
|
||||
webhook.put("url", gatewayUrl + "/cms/doc/open/dept/" + cmsProject.getDeptId());
|
||||
webhook.put("url", gatewayUrl+"/cms/doc/open/dept/"+cmsProject.getDeptId());
|
||||
webhook.put("events", new String[]{"push"});
|
||||
jsonObject.put("webhook", webhook);
|
||||
//增加Webhook
|
||||
|
|
@ -240,7 +231,7 @@ public class CmsAsyncServiceImpl implements ICmsAsyncService {
|
|||
}
|
||||
|
||||
private void syncDocAddedData(CmsProject cmsProject, List<String> addedList) {
|
||||
for (String addedFilePath : addedList) {
|
||||
for (String addedFilePath:addedList) {
|
||||
try {
|
||||
String[] filePathList = addedFilePath.split("/");
|
||||
if (filePathList.length != 2) {
|
||||
|
|
@ -256,27 +247,18 @@ 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) {
|
||||
}catch (Exception e){
|
||||
logger.error("[{}]同步新增文章发生异常:{}"
|
||||
, cmsProject.getName(), e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void syncDocRemovedData(CmsProject cmsProject, List<String> removedList) {
|
||||
for (String removedFilePath : removedList) {
|
||||
private void syncDocRemovedData(CmsProject cmsProject,List<String> removedList) {
|
||||
for (String removedFilePath:removedList) {
|
||||
try {
|
||||
String[] filePathList = removedFilePath.split("/");
|
||||
if (filePathList.length != 2) {
|
||||
|
|
@ -375,7 +357,7 @@ public class CmsAsyncServiceImpl implements ICmsAsyncService {
|
|||
cmsDocSearch.setDeptId(cmsDir.getDeptId());
|
||||
cmsDocSearch.setDirName(cmsDir.getName());
|
||||
cmsDocSearch.setIsDir(false);
|
||||
List<CmsDoc> cmsDocList = cmsDocMapper.selectCmsDocList(cmsDocSearch);
|
||||
List<CmsDoc> cmsDocList=cmsDocMapper.selectCmsDocList(cmsDocSearch);
|
||||
//获取数据库所有文件的filePath
|
||||
List<String> databaseFilePathList = cmsDocList.stream().map(CmsDoc::getFilePath).collect(Collectors.toList());
|
||||
//获取需要新增的文章
|
||||
|
|
@ -401,16 +383,16 @@ public class CmsAsyncServiceImpl implements ICmsAsyncService {
|
|||
@Override
|
||||
public void asyncDocData(Long deptId, String bodyStr) {
|
||||
//防止多次操作同时执行,将同步内容放入队列,根据先后时间执行同步动作
|
||||
String cmsSyncDeptIdKey = CacheConstants.CMS_SYNC_DEPT_ID_KEY + deptId;
|
||||
String cmsSyncDeptIdKey=CacheConstants.CMS_SYNC_DEPT_ID_KEY+deptId;
|
||||
//为当前同步操作生成UUID,若拿到的UUID为自身,则执行本次同步动作
|
||||
String UUID = IdUtils.fastSimpleUUID();
|
||||
String UUID= IdUtils.fastSimpleUUID();
|
||||
redisService.leftPush(cmsSyncDeptIdKey, UUID);
|
||||
//设置缓存过期时间,防止异常情况导致同步无法继续执行
|
||||
redisService.expire(cmsSyncDeptIdKey, 3600, TimeUnit.SECONDS);
|
||||
String currentUUID = String.valueOf(redisService.listIndexOf(cmsSyncDeptIdKey, -1));
|
||||
//设置最大循环阈值,防止意外情况导致死循环(7200次,约1小时左右)
|
||||
int threshold = 7200;
|
||||
while (!UUID.equals(currentUUID) && threshold != 0) {
|
||||
int threshold=7200;
|
||||
while (!UUID.equals(currentUUID)&&threshold!=0){
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
|
|
@ -420,41 +402,41 @@ public class CmsAsyncServiceImpl implements ICmsAsyncService {
|
|||
threshold--;
|
||||
}
|
||||
|
||||
try {
|
||||
CmsProject cmsProject = cmsProjectService.selectCmsProjectByDeptId(deptId);
|
||||
JSONObject body = JSONObject.parseObject(bodyStr);
|
||||
try{
|
||||
CmsProject cmsProject=cmsProjectService.selectCmsProjectByDeptId(deptId);
|
||||
JSONObject body=JSONObject.parseObject(bodyStr);
|
||||
//获取本次推送中Commit总数
|
||||
Integer totalCommits = body.getInteger("total_commits");
|
||||
Integer totalCommits=body.getInteger("total_commits");
|
||||
//从webhook请求中获取本次提交内容
|
||||
JSONArray commits = body.getJSONArray("commits");
|
||||
JSONArray commits=body.getJSONArray("commits");
|
||||
//当commit总数大于提交的列表数量时,代表此次PUSH未携带所有commit,此时进行一次全量同步
|
||||
if (totalCommits != null
|
||||
&& commits != null
|
||||
&& totalCommits > commits.size()) {
|
||||
if(totalCommits!=null
|
||||
&&commits!=null
|
||||
&&totalCommits>commits.size()){
|
||||
fullSyncDocData(cmsProject);
|
||||
} else {
|
||||
for (int i = commits.size() - 1; i >= 0; i--) {
|
||||
JSONObject commit = commits.getJSONObject(i);
|
||||
}else{
|
||||
for (int i = commits.size()-1; i >=0 ; i--) {
|
||||
JSONObject commit=commits.getJSONObject(i);
|
||||
//获取新增的文件列表
|
||||
JSONArray addedList = commit.getJSONArray("added");
|
||||
if (addedList != null) {
|
||||
syncDocAddedData(cmsProject, addedList.toJavaList(String.class));
|
||||
JSONArray addedList=commit.getJSONArray("added");
|
||||
if(addedList!=null){
|
||||
syncDocAddedData(cmsProject,addedList.toJavaList(String.class));
|
||||
}
|
||||
//获取删除的文件列表
|
||||
JSONArray removedList = commit.getJSONArray("removed");
|
||||
if (removedList != null) {
|
||||
syncDocRemovedData(cmsProject, removedList.toJavaList(String.class));
|
||||
JSONArray removedList=commit.getJSONArray("removed");
|
||||
if(removedList!=null){
|
||||
syncDocRemovedData(cmsProject,removedList.toJavaList(String.class));
|
||||
}
|
||||
//获取更新的文件列表
|
||||
JSONArray modifiedList = commit.getJSONArray("modified");
|
||||
if (modifiedList != null) {
|
||||
JSONArray modifiedList=commit.getJSONArray("modified");
|
||||
if(modifiedList!=null){
|
||||
syncDocModifiedData(cmsProject, modifiedList.toJavaList(String.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}catch (Exception e) {
|
||||
logger.error("同步文章时发送异常:{}", e.getMessage());
|
||||
} finally {
|
||||
}finally {
|
||||
//本次同步执行完成后,再弹出该UUID
|
||||
redisService.rightPop(cmsSyncDeptIdKey, 500, TimeUnit.MICROSECONDS);
|
||||
}
|
||||
|
|
@ -487,12 +469,12 @@ public class CmsAsyncServiceImpl implements ICmsAsyncService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void syncCreateDir(String dirName, EntryDto entry, CmsProject cmsProject, boolean isCreateKeep) {
|
||||
public void syncCreateDir(String dirName,EntryDto entry,CmsProject cmsProject,boolean isCreateKeep){
|
||||
CmsDoc cmsDir = new CmsDoc();
|
||||
cmsDir.setName(dirName);
|
||||
cmsDir.setCreateTime(entry.getCommit().getCreated_at());
|
||||
boolean insertResult;
|
||||
if (isCreateKeep) {
|
||||
if(isCreateKeep){
|
||||
//若该栏目不存在,检查文件夹中是否存在.keep文件
|
||||
JSONObject subEntriesResult = gitLinkRequestHelper.doGet(
|
||||
CmsGitLinkRequestUrl.GET_FILE_SUB_ENTRIES(cmsProject, cmsDir.getName(), CmsConstants.BRANCH_MASTER));
|
||||
|
|
@ -502,14 +484,14 @@ public class CmsAsyncServiceImpl implements ICmsAsyncService {
|
|||
|
||||
if (keepEntry != null) {
|
||||
//若存在,则在数据库中创建该栏目
|
||||
insertResult = createCmsDir(cmsDir, cmsProject.getDeptId(), keepEntry);
|
||||
insertResult=createCmsDir(cmsDir,cmsProject.getDeptId(),keepEntry);
|
||||
} else {
|
||||
//若不存在,则在数据库中创建该栏目,同时在仓库的该文件夹下创建.keep文件
|
||||
insertResult = cmsDocService.insertCmsDocDir(cmsProject.getDeptId(), cmsDir.copyToCmsDir());
|
||||
}
|
||||
} else {
|
||||
}else{
|
||||
//若不自动创建,则在数据库中创建根据文件名该栏目
|
||||
insertResult = createCmsDir(cmsDir, cmsProject.getDeptId(), entry);
|
||||
insertResult=createCmsDir(cmsDir,cmsProject.getDeptId(),entry);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -518,7 +500,7 @@ public class CmsAsyncServiceImpl implements ICmsAsyncService {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean createCmsDir(CmsDoc cmsDir, Long deptId, EntryDto entry) {
|
||||
private boolean createCmsDir(CmsDoc cmsDir,Long deptId,EntryDto entry){
|
||||
cmsDir.setIsDir(true);
|
||||
cmsDir.setFilePath(cmsDir.getDirPath());
|
||||
cmsDir.setDeptId(deptId);
|
||||
|
|
@ -632,12 +614,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);
|
||||
}
|
||||
|
||||
|
|
@ -697,7 +678,6 @@ public class CmsAsyncServiceImpl implements ICmsAsyncService {
|
|||
requestBody);
|
||||
cmsDoc.setAuditPrNumber(result.getString("pull_request_number") + "-" + result.getString("pull_request_id"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CmsDoc updateCmsDocDatabaseAndUpdateForGitLink(CmsDoc oldCmsDoc, CmsDocDto cmsDocDto, String branchName) {
|
||||
if (oldCmsDoc == null) {
|
||||
|
|
@ -738,8 +718,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;
|
||||
|
|
@ -891,87 +871,27 @@ public class CmsAsyncServiceImpl implements ICmsAsyncService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void asyncMoveFileToNewDir(CmsProject cmsProject, CmsDoc oldCmsDir, String newCmsDirName) {
|
||||
@Async
|
||||
public void asyncMoveFileToNewDir(CmsProject cmsProject, CmsDoc oldCmsDir, CmsDoc newCmsDir) {
|
||||
try {
|
||||
JSONObject dirFilesJson = gitLinkRequestHelper.doGet(CmsGitLinkRequestUrl.GET_DIR_SUB_ENTRIES(
|
||||
cmsProject,
|
||||
oldCmsDir.getName(),
|
||||
CmsConstants.BRANCH_MASTER));
|
||||
List<EntryDto> entryDtoList = cmsDocService.getEntriesFromRequestResult(dirFilesJson, cmsProject, false);
|
||||
CountDownLatch countDownLatch = new CountDownLatch(entryDtoList.size());
|
||||
// 异步获取每篇文章内容
|
||||
entryDtoList.forEach(entryDto -> {
|
||||
CustomExecutorFactory.threadPoolExecutor.execute(() -> {
|
||||
try {
|
||||
JSONObject fileSubEntriesResult = gitLinkRequestHelper.doGet(
|
||||
CmsGitLinkRequestUrl.GET_FILE_SUB_ENTRIES(
|
||||
cmsProject,
|
||||
entryDto.getPath(),
|
||||
CmsConstants.BRANCH_MASTER));
|
||||
EntryDto cmsDocEntryDto = EntryDto.getEntryDtoFromJson(fileSubEntriesResult);
|
||||
entryDto.setContent(cmsDocEntryDto.getContent());
|
||||
} finally {
|
||||
countDownLatch.countDown();
|
||||
}
|
||||
});
|
||||
});
|
||||
try {
|
||||
countDownLatch.await();
|
||||
} catch (InterruptedException e) {
|
||||
logger.error("栏目重命名失败(将对应代码库中文章移动至新文件夹失败):{}", e.getMessage());
|
||||
throw new ServiceException("栏目重命名失败");
|
||||
}
|
||||
|
||||
for (EntryDto entryDto : entryDtoList) {
|
||||
JSONObject updateFileBody = new JSONObject();
|
||||
updateFileBody.put("branch", CmsConstants.BRANCH_MASTER);
|
||||
updateFileBody.put("message", "移动文章至新栏目");
|
||||
updateFileBody.put("from_path", entryDto.getPath());
|
||||
String newFilePath = newCmsDirName + "/" + entryDto.getName();
|
||||
updateFileBody.put("filepath", newFilePath);
|
||||
updateFileBody.put("base64_filepath", Base64.contentToBase64(newFilePath));
|
||||
updateFileBody.put("sha", entryDto.getSha());
|
||||
String content = entryDto.getContent();
|
||||
if (content == null) {
|
||||
content = "";
|
||||
}
|
||||
updateFileBody.put("content", content);
|
||||
gitLinkRequestHelper.doPut(CmsGitLinkRequestUrl.UPDATE_FILE(cmsProject), updateFileBody);
|
||||
}
|
||||
CmsDoc newCmsDoc = oldCmsDir.copyToRenameCmsDir(newCmsDirName);
|
||||
//在数据库中重命名该栏目
|
||||
cmsDocService.updateCmsCommonDatabase(newCmsDoc, CmsConstants.BRANCH_MASTER);
|
||||
remoteZoneService.lockCmsByDeptId(cmsProject.getDeptId(), 1, SecurityConstants.INNER);
|
||||
//创建新栏目
|
||||
String message = String.format("重命名栏目:由[%s]重命名为[%s]", oldCmsDir.getName(), newCmsDir.getName());
|
||||
cmsDocService.createFileByGitLink(newCmsDir, message, "");
|
||||
//在数据库中重命名该栏目,防止后续操作推送的WebHook重复创建栏目
|
||||
cmsDocService.updateCmsCommonDatabase(newCmsDir, CmsConstants.BRANCH_MASTER);
|
||||
//将原栏目中所有文章移动到新栏目中
|
||||
moveCmsDocToNewCmsDir(cmsProject, oldCmsDir.getName(), newCmsDir.getName(), message);
|
||||
//删除旧栏目
|
||||
deleteCmsDocByGitLink(cmsProject, oldCmsDir);
|
||||
} catch (Exception e) {
|
||||
logger.error("重命名栏目失败(原栏目名称[{}],新栏目名称[{}]):{}", oldCmsDir.getName(), newCmsDirName, e.getMessage());
|
||||
throw new ServiceException("重命名栏目失败(原栏目名称[" + oldCmsDir.getName() + "],新栏目名称[" + newCmsDirName + "])");
|
||||
logger.error("重命名栏目失败(原栏目名称[{}],新栏目名称[{}]):{}", oldCmsDir.getName(), newCmsDir.getName(), e.getMessage());
|
||||
throw new ServiceException("重命名栏目失败(原栏目名称[" + oldCmsDir.getName() + "],新栏目名称[" + newCmsDir.getName() + "])");
|
||||
} finally {
|
||||
remoteZoneService.lockCmsByDeptId(cmsProject.getDeptId(), 0, SecurityConstants.INNER);
|
||||
}
|
||||
// finally {
|
||||
// remoteZoneService.lockCmsByDeptId(cmsProject.getDeptId(), 0, SecurityConstants.INNER);
|
||||
// }
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @Async
|
||||
// public void asyncMoveFileToNewDir(CmsProject cmsProject, CmsDoc oldCmsDir, CmsDoc newCmsDir) {
|
||||
// try {
|
||||
// remoteZoneService.lockCmsByDeptId(cmsProject.getDeptId(), 1, SecurityConstants.INNER);
|
||||
// //创建新栏目
|
||||
// String message = String.format("重命名栏目:由[%s]重命名为[%s]", oldCmsDir.getName(), newCmsDir.getName());
|
||||
// cmsDocService.createFileByGitLink(newCmsDir, message, "");
|
||||
// //在数据库中重命名该栏目,防止后续操作推送的WebHook重复创建栏目
|
||||
// cmsDocService.updateCmsCommonDatabase(newCmsDir, CmsConstants.BRANCH_MASTER);
|
||||
// //将原栏目中所有文章移动到新栏目中
|
||||
// moveCmsDocToNewCmsDir(cmsProject, oldCmsDir.getName(), newCmsDir.getName(), message);
|
||||
// //删除旧栏目
|
||||
// deleteCmsDocByGitLink(cmsProject, oldCmsDir);
|
||||
// } catch (Exception e) {
|
||||
// logger.error("重命名栏目失败(原栏目名称[{}],新栏目名称[{}]):{}", oldCmsDir.getName(), newCmsDir.getName(), e.getMessage());
|
||||
// throw new ServiceException("重命名栏目失败(原栏目名称[" + oldCmsDir.getName() + "],新栏目名称[" + newCmsDir.getName() + "])");
|
||||
// } finally {
|
||||
// remoteZoneService.lockCmsByDeptId(cmsProject.getDeptId(), 0, SecurityConstants.INNER);
|
||||
// }
|
||||
// }
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void pushDocDataSearchEngine(CmsDoc cmsDoc) {
|
||||
|
|
@ -1018,23 +938,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 +990,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);
|
||||
|
|
@ -228,21 +197,20 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
@Override
|
||||
public void updateCmsDir(Long id, CmsDirUpdateVo cmsDirUpdateVo) {
|
||||
CmsDoc oldCmsDir = selectCmsDir(id);
|
||||
checkCmsLockStatus(oldCmsDir.getDeptId());
|
||||
//设置栏目排序
|
||||
setCmsSort(cmsDirUpdateVo.getOrder(), oldCmsDir, false, null);
|
||||
oldCmsDir.setHeadImg(cmsDirUpdateVo.getHeadImg());
|
||||
updateCmsCommonDatabase(oldCmsDir, CmsConstants.BRANCH_MASTER);
|
||||
CmsProject cmsProject = cmsProjectService.selectCmsProjectByDeptId(oldCmsDir.getDeptId());
|
||||
String newCmsDirName = cmsDirUpdateVo.getName();
|
||||
CmsDoc newCmsDir = oldCmsDir.copyToRenameCmsDir(cmsDirUpdateVo.getName());
|
||||
|
||||
if (StringUtils.isNotEmpty(newCmsDirName) && !newCmsDirName.equals(oldCmsDir.getName())) {
|
||||
CmsDoc cmsDir = cmsDocMapper.selectCmsDocDirByNameAndDeptId(newCmsDirName, oldCmsDir.getDeptId());
|
||||
if (StringUtils.isNotEmpty(newCmsDir.getName()) && !newCmsDir.getName().equals(oldCmsDir.getName())) {
|
||||
CmsDoc cmsDir = cmsDocMapper.selectCmsDocDirByNameAndDeptId(newCmsDir.getName(), oldCmsDir.getDeptId());
|
||||
if (cmsDir != null) {
|
||||
throw new ServiceException("栏目名称已存在,不允许进行重命名(新栏目名称[" + newCmsDirName + "])");
|
||||
throw new ServiceException("栏目名称已存在,不允许进行重命名(新栏目名称[" + newCmsDir.getName() + "])");
|
||||
}
|
||||
cmsAsyncService.asyncMoveFileToNewDir(cmsProject, oldCmsDir, newCmsDir);
|
||||
}
|
||||
// 异步修改栏目名称(将仓库内原文件夹下所有文章移动到新文件夹下)
|
||||
cmsAsyncService.asyncMoveFileToNewDir(cmsProject, oldCmsDir, newCmsDirName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -263,14 +231,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<CmsDoc> cmsDocList = cmsDocMapper.selectCmsDocList(cmsDocSearchVo);
|
||||
List<CompletableFuture<CmsDocDetailDto>> futures = new ArrayList();
|
||||
for (CmsDoc cmsDoc : cmsDocList) {
|
||||
CompletableFuture<CmsDocDetailDto> future = CompletableFuture.supplyAsync(() -> {
|
||||
CmsDocDetailDto cmsDocDetailDto = cmsDoc.copyToCmsDocDetailDto();
|
||||
|
|
@ -315,21 +283,6 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
return selectCmsDocListByDatabase(dirId, cmsDocSearchVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CmsDocBaseDto> selectSetDefaultHeadImgCmsDocList(Long dirId, CmsDocSearchVo cmsDocSearchVo) {
|
||||
return selectCmsDocListSetDefaultHeadImgByDatabase(dirId, cmsDocSearchVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CmsDoc> selectCmsDocAndDirListByDept(Long deptId) {
|
||||
return cmsDocMapper.selectCmsDocAndDirListByDept(deptId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCmsDocShaByPathAndDeptId(String sha, String filePath, Long deptId) {
|
||||
cmsDocMapper.updateCmsDocShaByPathAndDeptId(sha, filePath, deptId);
|
||||
}
|
||||
|
||||
private List<CmsDocBaseDto> selectCmsDocListByDatabase(Long dirId, CmsDocSearchVo cmsDocSearchVo) {
|
||||
CmsDoc cmsDocDir = selectCmsDir(dirId);
|
||||
|
||||
|
|
@ -342,25 +295,6 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
return cmsDocList.stream().map(CmsDoc::copyToCmsDocBaseDto).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置文章默认头图为栏目头图
|
||||
*
|
||||
* @param dirId 栏目id
|
||||
* @param cmsDocSearchVo 文章查询条件
|
||||
* @return 文章列表
|
||||
*/
|
||||
private List<CmsDocBaseDto> selectCmsDocListSetDefaultHeadImgByDatabase(Long dirId, CmsDocSearchVo cmsDocSearchVo) {
|
||||
CmsDoc cmsDocDir = selectCmsDir(dirId);
|
||||
|
||||
cmsDocSearchVo.setDeptId(cmsDocDir.getDeptId());
|
||||
cmsDocSearchVo.setDirName(cmsDocDir.getName());
|
||||
List<CmsDoc> cmsDocList = cmsDocMapper.selectCmsDocListSetDefaultHeadImg(cmsDocSearchVo);
|
||||
if (cmsDocList == null || cmsDocList.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return cmsDocList.stream().map(CmsDoc::copyToCmsDocBaseDto).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查专区资讯是否处于锁定状态,若处于则抛出异常
|
||||
*
|
||||
|
|
@ -390,16 +324,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 +367,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 +387,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 +411,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 +459,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 +472,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 +492,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 +506,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 +525,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");
|
||||
|
|
@ -655,7 +552,6 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
throw new ServiceException("计算字符串Sha出错");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCmsSort(Integer order, CmsDoc oldCmsDoc, boolean isChangeOnDir, String isHomePage) {
|
||||
//调整文章/栏目顺序
|
||||
|
|
@ -775,47 +671,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())) {
|
||||
|
|
@ -828,16 +688,8 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
}
|
||||
checkDocName(cmsDocDto.getName(), oldCmsDoc.getDeptId(), dirName);
|
||||
}
|
||||
|
||||
// 当用户更新栏目时,需检查新栏目下是否已存在相同文章名
|
||||
if (cmsDocDto.getDirId() != null) {
|
||||
CmsDir cmsDir = selectCmsDirById(cmsDocDto.getDirId(), false);
|
||||
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直接更新,删除待审核更新类型文章
|
||||
|
|
@ -845,15 +697,14 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
Long originCmsDocId = Long.parseLong(oldCmsDoc.getAuditType().split("-")[1]);
|
||||
CmsDoc originCmsDoc = cmsDocMapper.selectCmsDocById(originCmsDocId);
|
||||
deleteTmpBranchIfBranchExist(oldCmsDoc);
|
||||
BeanUtils.copyProperties(originCmsDoc, oldCmsDoc);
|
||||
BeanUtils.copyProperties(originCmsDoc,oldCmsDoc);
|
||||
cmsDocMapper.deleteCmsDocById(id);
|
||||
} else
|
||||
//文章审核类型:create 直接新增文章
|
||||
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,62 +712,25 @@ 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,其余字段与待更新文章一致的新文章数据
|
||||
newDocWithAudit = insertDocWithAudit(oldCmsDoc,
|
||||
DocAndZoneOperation.OPERATION_UPDATE.getOperationCode() + "-" + id,
|
||||
DocAuditStatus.TO_BE_AUDIT.getAuditCode());
|
||||
}
|
||||
//1.创建一条auditType="update-原文章id",audit_status为2,其余字段与待更新文章一致的新文章数据
|
||||
newDocWithAudit = insertDocWithAudit(oldCmsDoc,
|
||||
DocAndZoneOperation.OPERATION_UPDATE.getOperationCode() + "-" + id,
|
||||
DocAuditStatus.TO_BE_AUDIT.getAuditCode());
|
||||
}
|
||||
cmsAsyncService.asyncUpdateBranchAndFileAndCreatePR(newDocWithAudit, cmsDocDto);
|
||||
return newDocWithAudit.getId();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -968,10 +782,10 @@ 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())) {
|
||||
if(!"分支不存在!".equals(e.getMessage())) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
@ -999,29 +813,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());
|
||||
|
|
@ -1063,7 +863,6 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
cmsDoc.setIsDir(true);
|
||||
cmsDoc.setFilePath(cmsDoc.getDirPath(cmsDir.getName()));
|
||||
cmsDoc.setDeptId(deptId);
|
||||
cmsDoc.setHeadImg(cmsDir.getHeadImg());
|
||||
cmsDoc.setName(cmsDir.getName());
|
||||
return insertCommonCmsDoc(cmsDoc, "创建栏目:" + cmsDir.getName(), "");
|
||||
}
|
||||
|
|
@ -1150,7 +949,7 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
List<CmsDoc> cmsDocList = cmsDocMapper.selectHotCmsDocList(cmsDocInput);
|
||||
if (cmsDocList != null) {
|
||||
//todo:需检查该文章是否在GitLink中存在
|
||||
return cmsDocList.stream().map(CmsDoc::copyToHotCmsDocDto).collect(Collectors.toList());
|
||||
return cmsDocList.stream().map(x -> x.copyToHotCmsDocDto()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
return new ArrayList<>();
|
||||
|
|
@ -1167,13 +966,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
|
||||
|
|
@ -1197,7 +990,7 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
for (CmsDoc cmsDir : cmsDirList) {
|
||||
CmsDocSearchVo cmsDocSearchVo = new CmsDocSearchVo();
|
||||
cmsDocSearchVo.setIsOpen(isOpen);
|
||||
List<CmsDocBaseDto> cmsDocBaseDtoList = selectSetDefaultHeadImgCmsDocList(cmsDir.getId(), cmsDocSearchVo);
|
||||
List<CmsDocBaseDto> cmsDocBaseDtoList = selectCmsDocList(cmsDir.getId(), cmsDocSearchVo);
|
||||
CmsDocOverviewDto cmsDocOverviewDto = new CmsDocOverviewDto();
|
||||
cmsDocOverviewDto.setId(cmsDir.getId());
|
||||
cmsDocOverviewDto.setName(cmsDir.getName());
|
||||
|
|
@ -1297,9 +1090,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);
|
||||
}
|
||||
|
|
@ -1314,7 +1104,7 @@ public class CmsDocServiceImpl implements ICmsDocService {
|
|||
CmsDocSearchVo cmsDocSearch = new CmsDocSearchVo();
|
||||
cmsDocSearch.setDeptId(deptId);
|
||||
cmsDocSearch.setIsHomepage(CmsConstants.TRUE);
|
||||
List<CmsDoc> cmsDocList = cmsDocMapper.selectCmsDocListSetDefaultHeadImg(cmsDocSearch);
|
||||
List<CmsDoc> cmsDocList = cmsDocMapper.selectCmsDocList(cmsDocSearch);
|
||||
List<CmsDocBaseDto> cmsDocBaseDtoList = new ArrayList<>();
|
||||
for (CmsDoc cmsDoc : cmsDocList) {
|
||||
CmsDocBaseDto cmsDocBaseDto = cmsDoc.copyToCmsDocBaseDto();
|
||||
|
|
@ -1323,41 +1113,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 +1259,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 +1268,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 +1293,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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询专区对应项目列表
|
||||
*/
|
||||
|
|
@ -105,12 +95,8 @@ public class CmsProjectController extends BaseController {
|
|||
@GetMapping("/getProjectByDeptId/{deptId}")
|
||||
public R<String> getProjectByDeptId(
|
||||
@ApiParam(name = "deptId", value = "组织Id") @PathVariable(value = "deptId") Long deptId) {
|
||||
CmsProject cmsProject = cmsProjectService.selectCmsProjectByDeptIdAndNoException(deptId);
|
||||
if (cmsProject == null) {
|
||||
return R.ok(null);
|
||||
} else {
|
||||
return R.ok(JSONObject.toJSONString(cmsProject));
|
||||
}
|
||||
CmsProject cmsProject = cmsProjectService.selectCmsProjectByDeptId(deptId);
|
||||
return R.ok(JSONObject.toJSONString(cmsProject));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -184,16 +170,4 @@ public class CmsProjectController extends BaseController {
|
|||
public R<Boolean> removeByDeptId(@PathVariable(value = "deptId") Long deptId) {
|
||||
return R.ok(cmsProjectService.deleteCmsProjectByDeptId(deptId) > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化专区对应项目
|
||||
*/
|
||||
@RequiresPermissions("zone:project:add")
|
||||
@ApiOperation("初始化专区对应项目")
|
||||
@Log(title = "初始化专区对应项目", businessType = BusinessType.INSERT)
|
||||
@PostMapping("initCmsProject/dept/{deptId}")
|
||||
public AjaxResult initCmsProject(
|
||||
@ApiParam(name = "deptId", value = "组织Id") @PathVariable(value = "deptId") Long deptId) {
|
||||
return toAjax(cmsProjectService.initZoneCmsProjectByDept(deptId));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,10 +78,4 @@ public interface ICmsProjectService {
|
|||
Boolean updateCmsProjectByDept(SysDept dept);
|
||||
|
||||
boolean operateProtectedBranchByZoneAuditSetting(String userName, String identifier, Long deptId, String operationType);
|
||||
|
||||
boolean initZoneCmsProjectByDept(Long deptId);
|
||||
|
||||
CmsProject selectCmsProjectByDeptIdAndNoException(Long deptId);
|
||||
|
||||
Boolean changeUserOrgRole(Long userId, Long operate);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,21 @@
|
|||
package com.microservices.cms.project.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.cms.doc.domain.*;
|
||||
import com.microservices.cms.doc.domain.CmsDir;
|
||||
import com.microservices.cms.doc.domain.CmsDocBaseDto;
|
||||
import com.microservices.cms.doc.domain.CmsDocSearchVo;
|
||||
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;
|
||||
import com.microservices.cms.utils.CmsGitLinkRequestUrl;
|
||||
import com.microservices.common.core.constant.HttpStatus;
|
||||
import com.microservices.common.core.constant.SecurityConstants;
|
||||
import com.microservices.common.core.enums.SystemRole;
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import com.microservices.common.core.utils.PinYinStringUtils;
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.common.datascope.annotation.DataScope;
|
||||
import com.microservices.common.httpClient.domain.GitLinkRequestUrl;
|
||||
import com.microservices.common.httpClient.util.GitLinkRequestHelper;
|
||||
import com.microservices.system.api.RemoteDeptService;
|
||||
import com.microservices.system.api.RemoteUserService;
|
||||
|
|
@ -26,7 +23,6 @@ import com.microservices.system.api.domain.SysDept;
|
|||
import com.microservices.system.api.domain.SysRole;
|
||||
import com.microservices.system.api.domain.SysUser;
|
||||
import com.microservices.system.api.utils.FeignUtils;
|
||||
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;
|
||||
|
|
@ -41,7 +37,6 @@ import java.util.List;
|
|||
* @author otto
|
||||
* @date 2023-03-27
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CmsProjectServiceImpl implements ICmsProjectService {
|
||||
@Autowired
|
||||
|
|
@ -233,75 +228,6 @@ public class CmsProjectServiceImpl implements ICmsProjectService {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initZoneCmsProjectByDept(Long deptId) {
|
||||
boolean initResult = false;
|
||||
CmsProject cmsProject = cmsProjectMapper.selectCmsProjectByDeptId(deptId);
|
||||
if (cmsProject != null) {
|
||||
JSONObject project = null;
|
||||
try {
|
||||
project = gitLinkRequestHelper.doGet(CmsGitLinkRequestUrl.GET_PROJECT_DETAIL(cmsProject.getUsername(), cmsProject.getIdentifier()));
|
||||
} catch (ServiceException e) {
|
||||
if (!e.getCode().equals(HttpStatus.NOT_FOUND)) {
|
||||
throw new ServiceException(e.getCode(), e.getMessage());
|
||||
}
|
||||
}
|
||||
if (project != null) {
|
||||
throw new ServiceException("专区对应项目已存在,不能重复初始化");
|
||||
} else {
|
||||
Long organizationId = getOrganizationId();
|
||||
// 创建专区对应项目
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("user_id", organizationId);
|
||||
jsonObject.put("name", cmsProject.getName());
|
||||
jsonObject.put("repository_name", cmsProject.getIdentifier());
|
||||
jsonObject.put("description", cmsProject.getDescription());
|
||||
jsonObject.put("private", false);
|
||||
//调用GitLink接口创建项目
|
||||
JSONObject result = gitLinkRequestHelper.doPost(CmsGitLinkRequestUrl.CREATE_PROJECT(), jsonObject);
|
||||
initResult = result != null && cmsProject.getIdentifier().equals(result.getString("identifier"));
|
||||
}
|
||||
} else {
|
||||
Long projectId = insertZoneCmsProjectByDept(deptId);
|
||||
if (projectId != null && projectId > 0) {
|
||||
cmsProject = cmsProjectMapper.selectCmsProjectById(projectId);
|
||||
initResult = true;
|
||||
}
|
||||
}
|
||||
if (initResult) {
|
||||
// 批量创建文章对应代码库文件
|
||||
List<CmsDoc> cmsDocAndDirList = cmsDocService.selectCmsDocAndDirListByDept(deptId);
|
||||
if (cmsDocAndDirList == null || cmsDocAndDirList.isEmpty()) {
|
||||
return initResult;
|
||||
}
|
||||
JSONObject docCommitJson = new JSONObject();
|
||||
docCommitJson.put("branch", CmsConstants.BRANCH_MASTER);
|
||||
docCommitJson.put("message", "初始化专区文章对应代码库文件");
|
||||
JSONArray docFiles = new JSONArray();
|
||||
for (CmsDoc cmsDoc : cmsDocAndDirList) {
|
||||
JSONObject docFile = new JSONObject();
|
||||
docFile.put("action_type", "create");
|
||||
docFile.put("content", "");
|
||||
docFile.put("encoding", "text");
|
||||
docFile.put("file_path", cmsDoc.getFilePath());
|
||||
docFiles.add(docFile);
|
||||
}
|
||||
docCommitJson.put("files", docFiles);
|
||||
JSONObject result = gitLinkRequestHelper.doPost(
|
||||
CmsGitLinkRequestUrl.BATCH_COMMIT(cmsProject.getUsername(), cmsProject.getIdentifier())
|
||||
, docCommitJson);
|
||||
if (result == null) {
|
||||
throw new ServiceException("专区对应项目初始化成功,但专区文章在项目中创建失败");
|
||||
}
|
||||
JSONArray resultContents = result.getJSONArray("contents");
|
||||
for (int i = 0; i < resultContents.size(); i++) {
|
||||
JSONObject contentJson = resultContents.getJSONObject(i);
|
||||
cmsDocService.updateCmsDocShaByPathAndDeptId(contentJson.getString("sha"), contentJson.getString("path"), deptId);
|
||||
}
|
||||
}
|
||||
return initResult;
|
||||
}
|
||||
|
||||
|
||||
private String handleSpecialCharacters(String name) {
|
||||
return StringUtils.replace(name, " ", "-");
|
||||
|
|
@ -316,45 +242,6 @@ public class CmsProjectServiceImpl implements ICmsProjectService {
|
|||
return cmsProject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CmsProject selectCmsProjectByDeptIdAndNoException(Long deptId) {
|
||||
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 +260,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>");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.microservices.cms.service.impl;
|
||||
package com.microservices.cms.common.service.impl;
|
||||
|
||||
import com.microservices.cms.common.service.ISysUserService;
|
||||
import com.microservices.common.core.constant.SecurityConstants;
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
);
|
||||
}
|
||||
|
|
@ -166,19 +148,19 @@ public class CmsGitLinkRequestUrl extends GitLinkRequestUrl {
|
|||
);
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl CREATE_PROTECTED_BRANCHES(String username, String identifier, Map<String, String> params, List<String> pushWhitelistUsernames) throws URISyntaxException {
|
||||
public static GitLinkRequestUrl CREATE_PROTECTED_BRANCHES(String username, String identifier, Map<String,String> params, List<String> pushWhitelistUsernames) throws URISyntaxException {
|
||||
String path = buildUri(String.format("/api/%s/%s/protected_branches.json", username, identifier), params);
|
||||
path = concatenateParametersAfterUrl(path, "push_whitelist_usernames[]", pushWhitelistUsernames);
|
||||
return getGitLinkRequestUrl(path);
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl UPDATE_PROTECTED_BRANCHES(String username, String identifier, Map<String, String> params, List<String> pushWhitelistUsernames) throws URISyntaxException {
|
||||
public static GitLinkRequestUrl UPDATE_PROTECTED_BRANCHES(String username, String identifier, Map<String,String> params, List<String> pushWhitelistUsernames) throws URISyntaxException {
|
||||
String path = buildUri(String.format("/api/%s/%s/protected_branches/master.json", username, identifier), params);
|
||||
path = concatenateParametersAfterUrl(path, "push_whitelist_usernames[]", pushWhitelistUsernames);
|
||||
return getGitLinkRequestUrl(path);
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl DELETE_PROTECTED_BRANCHES(String username, String identifier, Map<String, String> params, List<String> pushWhitelistUsernames) throws URISyntaxException {
|
||||
public static GitLinkRequestUrl DELETE_PROTECTED_BRANCHES(String username, String identifier, Map<String,String> params, List<String> pushWhitelistUsernames) throws URISyntaxException {
|
||||
String path = buildUri(String.format("/api/%s/%s/protected_branches/master.json", username, identifier), params);
|
||||
path = concatenateParametersAfterUrl(path, "push_whitelist_usernames[]", pushWhitelistUsernames);
|
||||
return getGitLinkRequestUrl(path);
|
||||
|
|
@ -215,12 +197,4 @@ public class CmsGitLinkRequestUrl extends GitLinkRequestUrl {
|
|||
public static String ZONE_DOC_URL(String gitlinkUrl, String zoneKey, Long docId) {
|
||||
return EscapeUtil.removeExtraSlashOfUrl(String.format("%s/zone/%s/newdetail/%d", gitlinkUrl, zoneKey, docId));
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl GET_PROJECT_DETAIL(String username, String identifier) {
|
||||
return getAdminGitLinkRequestUrl(String.format("/api/%s/%s/detail.json", username, identifier));
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl BATCH_COMMIT(String username, String identifier) {
|
||||
return getAdminGitLinkRequestUrl(String.format("/api/v1/%s/%s/contents/batch.json", username, identifier));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
package com.microservices.cms.utils;
|
||||
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import com.microservices.common.core.threadPool.ThreadPoolExecutorWrap;
|
||||
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 线程池工厂
|
||||
*
|
||||
* @author OTTO
|
||||
*/
|
||||
public class CustomExecutorFactory {
|
||||
/**
|
||||
* 创建线程池
|
||||
* 存在并发处理的情况,设置核心线程为2,设置有界队列长度为100,最大线程数为10
|
||||
* 当超出队列已满且达到最大线程数时抛出异常
|
||||
* Ncpu=CPU数量
|
||||
* Ucpu=目标CPU的使用率,0<=Ucpu<=1
|
||||
* W/C=任务等待时间与任务计算时间的比率
|
||||
* Nthreads =Ncpu*Ucpu*(1+W/C)
|
||||
*/
|
||||
public static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutorWrap(
|
||||
5
|
||||
, 10
|
||||
, 10
|
||||
, TimeUnit.SECONDS
|
||||
, new ArrayBlockingQueue<>(100)
|
||||
, Executors.defaultThreadFactory()
|
||||
, (r, executor) -> {
|
||||
throw new ServiceException("目前处理的人太多了,请稍后再试");
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -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,103 +103,10 @@
|
|||
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
|
||||
</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
|
||||
from cms_doc cd
|
||||
</sql>
|
||||
|
||||
<sql id="selectCmsDocAliasSetDefaultHeadImgVo">
|
||||
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,
|
||||
-- 处理文章和栏目头图为NULL或空字符串的情况
|
||||
CASE
|
||||
-- 文章头图不为空(非NULL且非空字符串)
|
||||
WHEN cd.head_img IS NOT NULL AND TRIM(cd.head_img) != '' THEN cd.head_img
|
||||
-- 栏目存在且头图不为空
|
||||
WHEN dir.head_img IS NOT NULL AND TRIM(dir.head_img) != '' THEN dir.head_img
|
||||
END AS 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,
|
||||
cd.remark
|
||||
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>
|
||||
|
||||
<select id="selectCmsDocAndDirListByDept" resultMap="CmsDocResult">
|
||||
<include refid="selectCmsDocVo"/>
|
||||
where dept_id=#{deptId}
|
||||
</select>
|
||||
|
||||
<select id="selectCmsDocList" parameterType="com.microservices.cms.doc.domain.CmsDocSearchVo"
|
||||
resultMap="CmsDocResult">
|
||||
<include refid="selectCmsDocVo"/>
|
||||
|
|
@ -217,19 +122,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>
|
||||
</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">
|
||||
|
|
@ -241,10 +137,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
|
||||
|
|
@ -258,13 +150,13 @@
|
|||
where file_path = #{filePath} and dept_id = #{deptId} and is_dir = 0
|
||||
</select>
|
||||
<select id="selectHotCmsDocList" parameterType="com.microservices.cms.doc.domain.CmsDoc" resultMap="CmsDocResult">
|
||||
<include refid="selectCmsDocAliasSetDefaultHeadImgVo"/>
|
||||
<include refid="selectListWhereAlias"/>
|
||||
<include refid="selectCmsDocVo"/>
|
||||
<include refid="selectListWhere"/>
|
||||
ORDER BY
|
||||
cd.visits DESC,
|
||||
cd.sort DESC,
|
||||
cd.update_time DESC,
|
||||
cd.create_time DESC
|
||||
visits DESC,
|
||||
sort DESC,
|
||||
update_time DESC,
|
||||
create_time DESC
|
||||
|
||||
</select>
|
||||
<select id="selectCmsDocCount" resultType="java.lang.Integer">
|
||||
|
|
@ -285,24 +177,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>
|
||||
|
||||
<sql id="selectListWhereAlias">
|
||||
<where>
|
||||
<if test="name != null and name != ''">and cd.name like concat('%', #{name}, '%')</if>
|
||||
<if test="keywords != null and keywords != ''">and cd.keywords like concat('%', #{keywords}, '%')</if>
|
||||
<if test="fileName != null and fileName != ''">and cd.file_name like concat('%', #{fileName}, '%')</if>
|
||||
<if test="filePath != null and filePath != ''">and cd.file_path = #{filePath}</if>
|
||||
<if test="publishTime != null ">and cd.publish_time = #{publishTime}</if>
|
||||
<if test="isDir != null ">and cd.is_dir = #{isDir}</if>
|
||||
<if test="dirName != null ">and cd.dir_name = #{dirName}</if>
|
||||
<if test="deptId != null ">and cd.dept_id = #{deptId}</if>
|
||||
<if test="isHomepage != null ">and cd.is_homepage = #{isHomepage}</if>
|
||||
<if test="auditStatus != null and auditStatus != '-1' ">and cd.audit_status = #{auditStatus}</if>
|
||||
<if test="auditStatus == null ">and cd.audit_status = '1'</if>
|
||||
<if test="createBy != null and createBy != '' ">and cd.create_by = #{createBy}</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
|
|
@ -409,15 +283,6 @@
|
|||
from cms_doc
|
||||
where dept_id = #{deptId};
|
||||
</select>
|
||||
<select id="selectCmsDocListSetDefaultHeadImg" parameterType="com.microservices.cms.doc.domain.CmsDocSearchVo"
|
||||
resultMap="CmsDocResult">
|
||||
<include refid="selectCmsDocAliasSetDefaultHeadImgVo"/>
|
||||
<include refid="selectListWhereAlias"/>
|
||||
ORDER BY
|
||||
cd.sort DESC,
|
||||
cd.update_time DESC,
|
||||
cd.create_time DESC
|
||||
</select>
|
||||
|
||||
<insert id="insertCmsDoc" parameterType="com.microservices.cms.doc.domain.CmsDoc" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
|
|
@ -523,7 +388,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>
|
||||
|
|
@ -541,12 +405,6 @@
|
|||
and dept_id = #{deptId}
|
||||
and is_dir = #{isDir};
|
||||
</update>
|
||||
<update id="updateCmsDocShaByPathAndDeptId">
|
||||
update cms_doc
|
||||
set file_sha=#{sha}
|
||||
where file_path=#{filePath}
|
||||
and dept_id=#{deptId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteCmsDocById" parameterType="Long">
|
||||
delete
|
||||
|
|
@ -560,70 +418,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>
|
||||
|
|
@ -87,10 +87,18 @@
|
|||
<groupId>com.microservices</groupId>
|
||||
<artifactId>microservices-common-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.microservices</groupId>
|
||||
<artifactId>microservices-common-swagger</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.microservices</groupId>
|
||||
<artifactId>microservices-common-log</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.microservices</groupId>
|
||||
<artifactId>microservices-common-core</artifactId>
|
||||
|
|
@ -122,11 +130,6 @@
|
|||
<artifactId>similarity</artifactId>
|
||||
<version>1.1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.hankcs</groupId>
|
||||
<artifactId>hanlp</artifactId>
|
||||
<version>portable-1.8.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
|
|
|
|||
|
|
@ -86,13 +86,6 @@ public class AchievementsController extends BaseController {
|
|||
return toAjax(achievementsService.deleteAchievementsByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("删除成果数据")
|
||||
@DeleteMapping("/deleteById")
|
||||
public AjaxResult deleteById(Long id) {
|
||||
return toAjax(achievementsService.deleteAchievementsById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取精选成果
|
||||
*
|
||||
|
|
@ -222,29 +215,12 @@ public class AchievementsController extends BaseController {
|
|||
return success(achievementsService.get7AddClickById(id,clickType));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("根据专家id,获取近7日成果点击数量(折线图)")
|
||||
@GetMapping("/getExpert7AddClickById")
|
||||
public AjaxResult getExpert7AddClickById(String id,@RequestParam(value = "clickType",required = false, defaultValue = "Experts")
|
||||
String clickType) {
|
||||
return success(achievementsService.get7AddClickById(id,clickType));
|
||||
}
|
||||
|
||||
@ApiOperation("根据成果ID,获取成果的相关行为数据统计(点击量、搜索量、附件下载量、收藏、关注)")
|
||||
@GetMapping("/getActDataStatisticById")
|
||||
public AjaxResult getActDataStatisticById(Long id) {
|
||||
return success(achievementsService.getActDataStatisticById(id));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("根据领域来源、领域分类名称,获取领域相关数据")
|
||||
@GetMapping("/getAllAreas")
|
||||
public AjaxResult getAllAreas(String areaName) {
|
||||
return success(achievementsService.getAllAreas(areaName));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation("根据领域,将成果数据进行分类")
|
||||
@GetMapping("/getAreaStatistic")
|
||||
public AjaxResult getAreaStatistic(String areaKey)
|
||||
|
|
@ -252,14 +228,6 @@ public class AchievementsController extends BaseController {
|
|||
return success(achievementsService.getAreaStatistic(areaKey));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("根据领域获取领域详情")
|
||||
@GetMapping("/getAreaDetail")
|
||||
public AjaxResult getAreaDetail(String areaKey,String kyxmSum,String source)
|
||||
{
|
||||
return success(achievementsService.getAreaDetail(areaKey,kyxmSum,source));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取开源项目的相关成果
|
||||
*/
|
||||
|
|
@ -306,5 +274,4 @@ public class AchievementsController extends BaseController {
|
|||
{
|
||||
return success(achievementsService.getSearchResult(achName,userId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,115 +1,31 @@
|
|||
package com.microservices.dms.achievementLibrary.controller;
|
||||
|
||||
import com.microservices.common.core.web.controller.BaseController;
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
import com.microservices.common.core.web.page.TableDataInfo;
|
||||
import com.microservices.dms.achievementLibrary.domain.BlockchainListQueryVo;
|
||||
import com.microservices.dms.achievementLibrary.domain.TokenListVo;
|
||||
import com.microservices.dms.achievementLibrary.domain.blockchain.InBlockchainData;
|
||||
import com.microservices.dms.achievementLibrary.domain.blockchain.InLinkProjectVo;
|
||||
import com.microservices.dms.achievementLibrary.domain.blockchain.UserVo;
|
||||
import com.microservices.dms.achievementLibrary.service.BlockChainService;
|
||||
import com.microservices.dms.achievementLibrary.service.InBlockchainDataServiceImpl;
|
||||
import com.microservices.dms.common.vo.UserCreateVo;
|
||||
import com.microservices.dms.achievementLibrary.service.IAchievementsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/blockChain")
|
||||
@Api(tags = "数据管理体系-数据产权子系统")
|
||||
@Api(tags = "数据产权子系统")
|
||||
public class BlockChainController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private BlockChainService blockChainService;
|
||||
|
||||
@Autowired
|
||||
private InBlockchainDataServiceImpl inBlockchainDataService;
|
||||
|
||||
@GetMapping("/projectTokenList")
|
||||
@ApiOperation(value = "项目token列表")
|
||||
public TableDataInfo projectTokenList(String projectName) {
|
||||
startPage();
|
||||
List<TokenListVo> list = blockChainService.projectTokenList(projectName);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/projectTokenDistribute")
|
||||
@ApiOperation(value = "项目token分配、点击token分配按钮,弹出框展示相关数据(项目名称、分配token、被分配人)")
|
||||
public AjaxResult projectTokenDistribute(InLinkProjectVo projectVo) {
|
||||
return blockChainService.projectTokenDistribute(projectVo);
|
||||
}
|
||||
|
||||
@GetMapping("/issueDataList")
|
||||
@ApiOperation(value = "入链issue列表")
|
||||
public TableDataInfo issueDataList(BlockchainListQueryVo queryVo) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = blockChainService.issueDataList(queryVo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/commitDataList")
|
||||
@ApiOperation(value = "入链commit列表")
|
||||
public TableDataInfo commitDataList(BlockchainListQueryVo queryVo) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = blockChainService.commitDataList(queryVo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/prDataList")
|
||||
@ApiOperation(value = "入链PR列表")
|
||||
public TableDataInfo prDataList(BlockchainListQueryVo queryVo) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = blockChainService.prDataList(queryVo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/userDataList")
|
||||
@ApiOperation(value = "入链user列表")
|
||||
public TableDataInfo userDataList(BlockchainListQueryVo queryVo) {
|
||||
List<Map> list = blockChainService.userDataList(queryVo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/userList")
|
||||
@ApiOperation(value = "用户列表列表")
|
||||
public TableDataInfo userList(UserVo userVo) {
|
||||
startPage();
|
||||
List<UserVo> list = blockChainService.userList(userVo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/InBlockchainDataList")
|
||||
@ApiOperation(value = "查询区块链数据入链列表")
|
||||
public TableDataInfo list(InBlockchainData inBlockchainData) {
|
||||
startPage();
|
||||
List<InBlockchainData> list = inBlockchainDataService.selectInBlockchainDataList(inBlockchainData);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("提供入链项目信息查询")
|
||||
@GetMapping("/queryBlockInfo")
|
||||
public AjaxResult queryBlockInfo (String type,String typeId) {
|
||||
return blockChainService.queryBlockInfo(type,typeId);
|
||||
}
|
||||
|
||||
@ApiOperation("根据项目id获取用户对应的token")
|
||||
@GetMapping("/getUserTokenByProjectId")
|
||||
public AjaxResult getUserTokenByProjectId (String type,String userName,String tokenName) {
|
||||
return blockChainService.getUserTokenByProjectId(type,userName,tokenName);
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户对应的所有项目token")
|
||||
@GetMapping("/getUserAllProjectToken")
|
||||
public AjaxResult getUserAllProjectToken (String userName) {
|
||||
return blockChainService.getUserAllProjectToken(userName);
|
||||
}
|
||||
private IAchievementsService achievementsService;
|
||||
|
||||
// @GetMapping("/projectTokenList")
|
||||
// @ApiOperation(value = "项目token列表")
|
||||
// public TableDataInfo projectTokenList() {
|
||||
// startPage();
|
||||
// List<TokenListVo> list = achievementsService.projectTokenList();
|
||||
// return getDataTable(list);
|
||||
// }
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.controller;
|
||||
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
import com.microservices.dms.achievementLibrary.service.BlockChainService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/blockFisco")
|
||||
@Api(tags = "数据管理体系-数据产权入链交易")
|
||||
public class BlockFiscoController {
|
||||
|
||||
@Autowired
|
||||
private BlockChainService blockChainService;
|
||||
|
||||
|
||||
@GetMapping("/getTransactionByHash")
|
||||
@ApiOperation(value = "通过交易哈希获取交易详情")
|
||||
public AjaxResult getTransactionByHash(String txHash) {
|
||||
return AjaxResult.success(blockChainService.getTransactionByHash(txHash));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "交易哈希获取交易回执")
|
||||
@GetMapping("/getTransactionReceipt")
|
||||
public AjaxResult getTransactionReceipt(String txHash) {
|
||||
return AjaxResult.success(blockChainService.getTransactionReceipt(txHash));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "获取最新区块号")
|
||||
@GetMapping("/blockNumber")
|
||||
public AjaxResult getBlockNumber() {
|
||||
return AjaxResult.success(blockChainService.getBlockNumber());
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "获取区块链总交易数")
|
||||
@GetMapping("/getTotalTransactionCount")
|
||||
public AjaxResult getTotalTransactionCount() {
|
||||
return AjaxResult.success(blockChainService.getTotalTransactionCount());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
package com.microservices.dms.achievementLibrary.controller;
|
||||
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.common.core.utils.poi.ExcelUtil;
|
||||
import com.microservices.common.core.web.controller.BaseController;
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
|
|
@ -83,10 +82,6 @@ public class SchoolEnterpriseAchievementsController extends BaseController
|
|||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SchoolEnterpriseAchievements schoolEnterpriseAchievements)
|
||||
{
|
||||
|
||||
if (!schoolEnterpriseAchievementsService.getCheckSchoolAchName(schoolEnterpriseAchievements)) {
|
||||
return error("新增校企成果'" + schoolEnterpriseAchievements.getAchievementName() + "'失败,成果名称已存在");
|
||||
}
|
||||
return AjaxResult.success(schoolEnterpriseAchievementsService.insertSchoolEnterpriseAchievements(schoolEnterpriseAchievements));
|
||||
}
|
||||
|
||||
|
|
@ -97,9 +92,6 @@ public class SchoolEnterpriseAchievementsController extends BaseController
|
|||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SchoolEnterpriseAchievements schoolEnterpriseAchievements)
|
||||
{
|
||||
// if (!schoolEnterpriseAchievementsService.getCheckSchoolAchName(schoolEnterpriseAchievements)) {
|
||||
// return error("修改校企成果'" + schoolEnterpriseAchievements.getAchievementName() + "'失败,成果名称已存在");
|
||||
// }
|
||||
return AjaxResult.success(schoolEnterpriseAchievementsService.updateSchoolEnterpriseAchievements(schoolEnterpriseAchievements));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AchDetailVo {
|
||||
private List<Achievements> achievementsList;
|
||||
private long clickSum;
|
||||
private long dockSum;
|
||||
private long favoriteSum;
|
||||
private long watcherSum;
|
||||
private String remark;
|
||||
}
|
||||
|
|
@ -176,18 +176,9 @@ public class Achievements extends BaseEntity {
|
|||
@Excel(name = "成果附件")
|
||||
private String attachments;
|
||||
|
||||
//成果小类
|
||||
private String ext1;
|
||||
//成果状态
|
||||
private String ext2;
|
||||
//成果团队名称
|
||||
private String ext3;
|
||||
|
||||
private Long clickSum;
|
||||
private Long watcherSum;
|
||||
private Long favoriteSum;
|
||||
private Long dockSum;
|
||||
private String filedDesc;
|
||||
private Float hotRank;
|
||||
private Long attachmentCount;
|
||||
private Integer isExpertAudit;
|
||||
|
|
@ -197,30 +188,6 @@ public class Achievements extends BaseEntity {
|
|||
private String userLogin;
|
||||
private List<Map<String,Object>> dockingUserInfo;
|
||||
|
||||
public String getExt1() {
|
||||
return ext1;
|
||||
}
|
||||
|
||||
public void setExt1(String ext1) {
|
||||
this.ext1 = ext1;
|
||||
}
|
||||
|
||||
public String getExt2() {
|
||||
return ext2;
|
||||
}
|
||||
|
||||
public void setExt2(String ext2) {
|
||||
this.ext2 = ext2;
|
||||
}
|
||||
|
||||
public String getExt3() {
|
||||
return ext3;
|
||||
}
|
||||
|
||||
public void setExt3(String ext3) {
|
||||
this.ext3 = ext3;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getDockingUserInfo() {
|
||||
return dockingUserInfo;
|
||||
}
|
||||
|
|
@ -229,22 +196,6 @@ public class Achievements extends BaseEntity {
|
|||
this.dockingUserInfo = dockingUserInfo;
|
||||
}
|
||||
|
||||
public String getFiledDesc() {
|
||||
return filedDesc;
|
||||
}
|
||||
|
||||
public void setFiledDesc(String filedDesc) {
|
||||
this.filedDesc = filedDesc;
|
||||
}
|
||||
|
||||
public Long getDockSum() {
|
||||
return dockSum;
|
||||
}
|
||||
|
||||
public void setDockSum(Long dockSum) {
|
||||
this.dockSum = dockSum;
|
||||
}
|
||||
|
||||
public String getShowAchievementName() {
|
||||
return showAchievementName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,15 +15,6 @@ public class AreaStatisticVo {
|
|||
private Long kfjsSum;
|
||||
//校企成果汇总
|
||||
private Long xqcgSum;
|
||||
private String source;
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public String getAreaName() {
|
||||
return areaName;
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BlockchainListQueryVo {
|
||||
private String projectName;
|
||||
private String issueName;
|
||||
private String prName;
|
||||
private String userName;
|
||||
private Long userId;
|
||||
}
|
||||
|
|
@ -146,8 +146,8 @@ public class SchoolEnterpriseAchievements extends BaseEntity {
|
|||
/**
|
||||
* 成果审核时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "成果审核时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "成果审核时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date reviewDate;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,22 +3,16 @@ package com.microservices.dms.achievementLibrary.domain;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class TokenListVo {
|
||||
|
||||
private Long id; // 项目ID
|
||||
private String name; // 项目名称
|
||||
private String userId;//用户id
|
||||
private Long totalToken; // 项目总Token
|
||||
private String createBy; // 创建人
|
||||
private Long issueToken;//issueToken
|
||||
private Long currentToken; // 当前Token
|
||||
private String repositoryName; // 仓库名称
|
||||
private Long repositoryId; // 仓库名称
|
||||
private Long applyToken;//已分配token
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createdOn; // 项目创建时间
|
||||
private Long ableApplyToken;//责任人可分配token
|
||||
private Data createdOn; // 项目创建时间(以毫秒为单位)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,81 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.domain.blockchain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.microservices.common.core.annotation.Excel;
|
||||
import com.microservices.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 区块链数据入链对象 in_blockchain_data
|
||||
*
|
||||
* @author microservices
|
||||
* @date 2025-05-27
|
||||
*/
|
||||
public class InBlockchainData extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 数据类型pr、issue、commit */
|
||||
@Excel(name = "数据类型pr、issue、commit")
|
||||
private String type;
|
||||
|
||||
/** 关联类型的唯一标识符 */
|
||||
@Excel(name = "关联类型的唯一标识符")
|
||||
private String typeId;
|
||||
|
||||
/** 交易哈希值 */
|
||||
@Excel(name = "交易哈希值")
|
||||
private String txHash;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
public void setTypeId(String typeId)
|
||||
{
|
||||
this.typeId = typeId;
|
||||
}
|
||||
|
||||
public String getTypeId()
|
||||
{
|
||||
return typeId;
|
||||
}
|
||||
public void setTxHash(String txHash)
|
||||
{
|
||||
this.txHash = txHash;
|
||||
}
|
||||
|
||||
public String getTxHash()
|
||||
{
|
||||
return txHash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("type", getType())
|
||||
.append("typeId", getTypeId())
|
||||
.append("txHash", getTxHash())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.domain.blockchain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class InLinkProjectVo implements Serializable {
|
||||
private Long amount;
|
||||
|
||||
private String projectId;
|
||||
|
||||
private String userId;
|
||||
|
||||
public Long getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public void setAmount(Long amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public String getProjectId() {
|
||||
return this.projectId;
|
||||
}
|
||||
|
||||
public void setProjectId(String projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,152 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.domain.blockchain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.microservices.common.core.annotation.Excel;
|
||||
import com.microservices.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 用户/项目转账信息记录对象 user_project_transfer_records
|
||||
*
|
||||
* @author microservices
|
||||
* @date 2025-05-27
|
||||
*/
|
||||
public class UserProjectTransferRecords extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 唯一标识每条记录 */
|
||||
private Long id;
|
||||
|
||||
/** 付款方ID */
|
||||
@Excel(name = "付款方ID")
|
||||
private String payerId;
|
||||
|
||||
/** 项目ID */
|
||||
@Excel(name = "项目ID")
|
||||
private String projectId;
|
||||
|
||||
/** 转账金额,支持高精度数值 */
|
||||
@Excel(name = "转账金额,支持高精度数值")
|
||||
private BigDecimal token;
|
||||
|
||||
/** 收款方ID */
|
||||
@Excel(name = "收款方ID")
|
||||
private String payeeId;
|
||||
|
||||
/** 交易哈希值,确保每一笔交易唯一 */
|
||||
@Excel(name = "交易哈希值,确保每一笔交易唯一")
|
||||
private String txHash;
|
||||
|
||||
/** 转账类型:project、user */
|
||||
@Excel(name = "转账类型:project、user")
|
||||
private String type;
|
||||
|
||||
/** 备用字段1 */
|
||||
@Excel(name = "备用字段1")
|
||||
private String reserve1;
|
||||
|
||||
/** 备用字段2 */
|
||||
@Excel(name = "备用字段2")
|
||||
private String reserve2;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setPayerId(String payerId)
|
||||
{
|
||||
this.payerId = payerId;
|
||||
}
|
||||
|
||||
public String getPayerId()
|
||||
{
|
||||
return payerId;
|
||||
}
|
||||
public void setProjectId(String projectId)
|
||||
{
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public String getProjectId()
|
||||
{
|
||||
return projectId;
|
||||
}
|
||||
public void setToken(BigDecimal token)
|
||||
{
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public BigDecimal getToken()
|
||||
{
|
||||
return token;
|
||||
}
|
||||
public void setPayeeId(String payeeId)
|
||||
{
|
||||
this.payeeId = payeeId;
|
||||
}
|
||||
|
||||
public String getPayeeId()
|
||||
{
|
||||
return payeeId;
|
||||
}
|
||||
public void setTxHash(String txHash)
|
||||
{
|
||||
this.txHash = txHash;
|
||||
}
|
||||
|
||||
public String getTxHash()
|
||||
{
|
||||
return txHash;
|
||||
}
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
public void setReserve1(String reserve1)
|
||||
{
|
||||
this.reserve1 = reserve1;
|
||||
}
|
||||
|
||||
public String getReserve1()
|
||||
{
|
||||
return reserve1;
|
||||
}
|
||||
public void setReserve2(String reserve2)
|
||||
{
|
||||
this.reserve2 = reserve2;
|
||||
}
|
||||
|
||||
public String getReserve2()
|
||||
{
|
||||
return reserve2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("payerId", getPayerId())
|
||||
.append("projectId", getProjectId())
|
||||
.append("token", getToken())
|
||||
.append("payeeId", getPayeeId())
|
||||
.append("txHash", getTxHash())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("type", getType())
|
||||
.append("reserve1", getReserve1())
|
||||
.append("reserve2", getReserve2())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.domain.blockchain;
|
||||
|
||||
public class UserVo {
|
||||
private Long id;
|
||||
private String nickname;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getNickname() {
|
||||
return nickname;
|
||||
}
|
||||
|
||||
public void setNickname(String nickname) {
|
||||
this.nickname = nickname;
|
||||
}
|
||||
}
|
||||
|
|
@ -12,7 +12,6 @@ import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
|||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.PropertyValues;
|
||||
|
||||
/**
|
||||
* 成果Mapper接口
|
||||
|
|
@ -125,7 +124,7 @@ public interface AchievementsMapper {
|
|||
|
||||
List<Long> getAllId();
|
||||
|
||||
List<AreaStatisticVo> getAreaStatistic(@Param("source")String source,@Param("areaKey") String areaKey);
|
||||
List<AreaStatisticVo> getAreaStatistic(@Param("areaKey") String areaKey);
|
||||
|
||||
List<AchRelatedVo> getRelatedAch(@Param("id")Long id, @Param("sourceId") List<Long> sourceId, @Param("paramYear")String paramYear);
|
||||
|
||||
|
|
@ -159,16 +158,4 @@ public interface AchievementsMapper {
|
|||
List<KeyValueVo> getAchievementActDataF(@Param("s") Date s, @Param("e") Date e);
|
||||
|
||||
List<Map<String, Object>> getDockingUserInfo(@Param("id") Long id);
|
||||
|
||||
List<Achievements> selectAchievementsByArea(AchQueryVo achQueryVo);
|
||||
|
||||
List<KeyValVo<String, Long>> getExperts(@Param("s") Date s, @Param("e") Date e);
|
||||
|
||||
List<KeyValueVo> getAllAreas(@Param("areaName") String areaName);
|
||||
|
||||
void updateRelationAchievements(@Param("source") String source,@Param("sourceId") Long sourceId);
|
||||
|
||||
List<Map<String, Object>> getDockingUserInfoList(@Param("id") Long id);
|
||||
|
||||
String getField1RemarkByParam(@Param("source")String source,@Param("areaKey") String areaKey);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,82 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.microservices.common.datasource.annotation.Slave;
|
||||
import com.microservices.dms.achievementLibrary.domain.BlockchainListQueryVo;
|
||||
import com.microservices.dms.achievementLibrary.domain.KeyValueVo;
|
||||
import com.microservices.dms.achievementLibrary.domain.blockchain.InBlockchainData;
|
||||
import com.microservices.dms.common.vo.CommitCreateVo;
|
||||
import com.microservices.dms.common.vo.CommitResultVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 区块链数据入链Mapper接口
|
||||
*
|
||||
* @author microservices
|
||||
* @date 2025-05-27
|
||||
*/
|
||||
@Mapper
|
||||
@Slave
|
||||
public interface InBlockchainDataMapper
|
||||
{
|
||||
/**
|
||||
* 查询区块链数据入链
|
||||
*
|
||||
* @param id 区块链数据入链主键
|
||||
* @return 区块链数据入链
|
||||
*/
|
||||
public InBlockchainData selectInBlockchainDataById(Long id);
|
||||
|
||||
/**
|
||||
* 查询区块链数据入链列表
|
||||
*
|
||||
* @param inBlockchainData 区块链数据入链
|
||||
* @return 区块链数据入链集合
|
||||
*/
|
||||
public List<InBlockchainData> selectInBlockchainDataList(InBlockchainData inBlockchainData);
|
||||
|
||||
/**
|
||||
* 新增区块链数据入链
|
||||
*
|
||||
* @param inBlockchainData 区块链数据入链
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertInBlockchainData(InBlockchainData inBlockchainData);
|
||||
|
||||
/**
|
||||
* 修改区块链数据入链
|
||||
*
|
||||
* @param inBlockchainData 区块链数据入链
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateInBlockchainData(InBlockchainData inBlockchainData);
|
||||
|
||||
/**
|
||||
* 删除区块链数据入链
|
||||
*
|
||||
* @param id 区块链数据入链主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteInBlockchainDataById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除区块链数据入链
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteInBlockchainDataByIds(Long[] ids);
|
||||
|
||||
List<Map<String, Object>> issueDataList(BlockchainListQueryVo queryVo);
|
||||
|
||||
List<Map<String, Object>> commitDataList(BlockchainListQueryVo queryVo);
|
||||
|
||||
List<Map<String, Object>> prDataList(BlockchainListQueryVo queryVo);
|
||||
|
||||
List<String> getNeedToBlockCommitList();
|
||||
|
||||
List<CommitResultVo> getCommitListById(@Param("projectId") String projectId);
|
||||
}
|
||||
|
|
@ -5,7 +5,6 @@ import java.util.List;
|
|||
import com.microservices.common.datasource.annotation.Slave;
|
||||
import com.microservices.dms.achievementLibrary.domain.SchoolEnterpriseAchievements;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 校企成果Mapper接口
|
||||
|
|
@ -66,6 +65,4 @@ public interface SchoolEnterpriseAchievementsMapper
|
|||
public int deleteSchoolEnterpriseAchievementsByIds(Long[] ids);
|
||||
|
||||
Long topStatistic(SchoolEnterpriseAchievements schoolEnterpriseAchievements);
|
||||
|
||||
SchoolEnterpriseAchievements selectSchoolEnterpriseAchievementsByName(@Param("achievementName") String achievementName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,73 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.microservices.common.datasource.annotation.Slave;
|
||||
import com.microservices.dms.achievementLibrary.domain.BlockchainListQueryVo;
|
||||
import com.microservices.dms.achievementLibrary.domain.blockchain.UserProjectTransferRecords;
|
||||
import com.microservices.dms.achievementLibrary.domain.blockchain.UserVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 用户/项目转账信息记录Mapper接口
|
||||
*
|
||||
* @author microservices
|
||||
* @date 2025-05-27
|
||||
*/
|
||||
@Mapper
|
||||
@Slave
|
||||
public interface UserProjectTransferRecordsMapper
|
||||
{
|
||||
/**
|
||||
* 查询用户/项目转账信息记录
|
||||
*
|
||||
* @param id 用户/项目转账信息记录主键
|
||||
* @return 用户/项目转账信息记录
|
||||
*/
|
||||
public UserProjectTransferRecords selectUserProjectTransferRecordsById(Long id);
|
||||
|
||||
/**
|
||||
* 查询用户/项目转账信息记录列表
|
||||
*
|
||||
* @param userProjectTransferRecords 用户/项目转账信息记录
|
||||
* @return 用户/项目转账信息记录集合
|
||||
*/
|
||||
public List<UserProjectTransferRecords> selectUserProjectTransferRecordsList(UserProjectTransferRecords userProjectTransferRecords);
|
||||
|
||||
/**
|
||||
* 新增用户/项目转账信息记录
|
||||
*
|
||||
* @param userProjectTransferRecords 用户/项目转账信息记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUserProjectTransferRecords(UserProjectTransferRecords userProjectTransferRecords);
|
||||
|
||||
/**
|
||||
* 修改用户/项目转账信息记录
|
||||
*
|
||||
* @param userProjectTransferRecords 用户/项目转账信息记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserProjectTransferRecords(UserProjectTransferRecords userProjectTransferRecords);
|
||||
|
||||
/**
|
||||
* 删除用户/项目转账信息记录
|
||||
*
|
||||
* @param id 用户/项目转账信息记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserProjectTransferRecordsById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除用户/项目转账信息记录
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserProjectTransferRecordsByIds(Long[] ids);
|
||||
|
||||
List<Map> userDataList(BlockchainListQueryVo queryVo);
|
||||
|
||||
List<UserVo> userList(UserVo userVo);
|
||||
}
|
||||
|
|
@ -21,17 +21,14 @@ public class BigScreenStatisticService {
|
|||
private final CompetitionResourceLibraryMapper competitionResourceLibraryMapper;
|
||||
|
||||
public Map<String, Object> getAchievementTopStatistic(String source) {
|
||||
//获取本周(近7天)的数据
|
||||
Date[] days = DateUtil.getDays(0, 6);
|
||||
Map<String, Long> m = achievementsMapper.getAchievement(days[0], days[1], source)
|
||||
.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV));
|
||||
List<String> dateStr = DateUtil.getDateStrMMDD(days[0], days[1]);
|
||||
//获取上周(7-14天前)的数据
|
||||
Date[] lastDays = DateUtil.getDays(7, 13);
|
||||
long lastSum = Optional.ofNullable(achievementsMapper.countAchievementBySource(lastDays[0], lastDays[1], source)).orElse(0L);
|
||||
long sum = Optional.ofNullable(achievementsMapper.countAchievementBySource(null, null, source)).orElse(0L);
|
||||
long cSum = m.values().stream().mapToLong(Long::longValue).sum();
|
||||
//计算本周/上周增长%
|
||||
double rate;
|
||||
if (lastSum == 0) rate = 100D;
|
||||
else {
|
||||
|
|
@ -186,7 +183,6 @@ public class BigScreenStatisticService {
|
|||
return competitionResourceLibraryMapper.getCompetitionHot();
|
||||
}
|
||||
|
||||
|
||||
public List<KeyValVo<String, Long>> getCompetitionYearlyPaperAdd() {
|
||||
Date[] currentYear = DateUtil.getLast12Months();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,614 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import com.microservices.common.core.utils.DateUtils;
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
import com.microservices.common.httpClient.service.HttpAPIService;
|
||||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.dms.achievementLibrary.domain.Achievements;
|
||||
import com.microservices.dms.achievementLibrary.domain.BlockchainListQueryVo;
|
||||
import com.microservices.dms.achievementLibrary.domain.KeyValueVo;
|
||||
import com.microservices.dms.achievementLibrary.domain.TokenListVo;
|
||||
import com.microservices.dms.achievementLibrary.domain.blockchain.InBlockchainData;
|
||||
import com.microservices.dms.achievementLibrary.domain.blockchain.InLinkProjectVo;
|
||||
import com.microservices.dms.achievementLibrary.domain.blockchain.UserProjectTransferRecords;
|
||||
import com.microservices.dms.achievementLibrary.domain.blockchain.UserVo;
|
||||
import com.microservices.dms.achievementLibrary.mapper.InBlockchainDataMapper;
|
||||
import com.microservices.dms.achievementLibrary.mapper.UserProjectTransferRecordsMapper;
|
||||
import com.microservices.dms.behaviorImage.domain.AchievementImageVo;
|
||||
import com.microservices.dms.common.vo.*;
|
||||
import com.microservices.dms.referral.mapper.TalentReferralMapper;
|
||||
import com.microservices.dms.resourceLibrary.mapper.ProjectResourceLibraryMapper;
|
||||
import com.microservices.dms.utils.DateUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
//import org.fisco.bcos.sdk.client.Client;
|
||||
//import org.fisco.bcos.sdk.client.protocol.request.Transaction;
|
||||
//import org.fisco.bcos.sdk.client.protocol.response.BcosTransaction;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
import static com.microservices.common.core.utils.DateUtils.YYYY_MM_DD_HH_MM_SS;
|
||||
import static com.microservices.common.core.utils.PageUtils.startPage;
|
||||
import static com.microservices.dms.constant.BlockChainFunConstants.*;
|
||||
import static com.microservices.dms.utils.DateUtil.formatLocalDateTimePlusH;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BlockChainService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ProjectResourceLibraryMapper projectResourceLibraryMapper;
|
||||
|
||||
@Value("${gitlink.fiscobcosUrl:localhost}")
|
||||
public String fiscobcosUrl;
|
||||
|
||||
@Autowired
|
||||
private HttpAPIService httpAPIService;
|
||||
|
||||
@Autowired
|
||||
private InBlockchainDataMapper inBlockchainDataMapper;
|
||||
|
||||
@Autowired
|
||||
private UserProjectTransferRecordsMapper userProjectTransferRecordsMapper;
|
||||
|
||||
@Autowired
|
||||
private TalentReferralMapper talentReferralMapper;
|
||||
|
||||
public List<TokenListVo> projectTokenList(String projectName) {
|
||||
List<TokenListVo> list = projectResourceLibraryMapper.selectProjectInfos(projectName);
|
||||
for (TokenListVo v : list) {
|
||||
JSONObject param = queryProjectInfo(v);
|
||||
if(param != null) {
|
||||
Long issueTokenSum = projectResourceLibraryMapper.sumProjectIssueToken(v.getId());
|
||||
v.setIssueToken(issueTokenSum);
|
||||
long totalToken = Long.parseLong(param.getString("total_supply"));//总token
|
||||
v.setTotalToken(totalToken);
|
||||
//根据创建人login,获取对应的用户id
|
||||
String userName = v.getUserId();
|
||||
//根据创建人、项目Id,获取创建人拥有token
|
||||
String tokenName = param.getString("token_name");
|
||||
Long applyToken= getUserBlanaceProjectId("userSingleInfo",userName,tokenName);
|
||||
v.setApplyToken(applyToken);
|
||||
v.setCurrentToken(totalToken - applyToken);
|
||||
}
|
||||
v.setCreatedOn(DateUtil.plusHours(v.getCreatedOn(), 8));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public Long getUserBlanaceProjectId(String type,String userName,String tokenName) {
|
||||
JSONObject params = new JSONObject();
|
||||
if(type.equals(USER_SINGLE_INFO)){
|
||||
params.put(REQUEST_TYPE, USER_SINGLE_REPO);
|
||||
params.put("token_name", tokenName);
|
||||
params.put("username", userName);
|
||||
}else if(type.equals(USER_ALL_INFO)){
|
||||
params.put(REQUEST_TYPE, USER_ALL_REPOS);
|
||||
params.put("username", userName);
|
||||
}
|
||||
Map<String, String> p = convertParams(params);
|
||||
params = JSONObject.from(p);
|
||||
JSONObject rsp = queryFiscobcos(params);
|
||||
if (rsp != null) {
|
||||
return Long.parseLong(rsp.getString("balance"));
|
||||
}
|
||||
return -1L;
|
||||
}
|
||||
|
||||
private JSONObject queryProjectInfo(TokenListVo v) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put(REQUEST_TYPE, QUERY_REPO);
|
||||
param.put("token_name", String.valueOf(v.getId()));
|
||||
|
||||
JSONObject jsonObject = queryFiscobcos(param);
|
||||
if (jsonObject != null) {
|
||||
return jsonObject;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private JSONObject queryFiscobcos(JSONObject param) {
|
||||
try {
|
||||
// Map<String,String> p = convertParams(param);
|
||||
// JSONObject from = JSONObject.from(p);
|
||||
JSONObject reps = httpAPIService.doPost(fiscobcosUrl, param);
|
||||
// if (result.getCode() != 200) {
|
||||
// return null;
|
||||
// }
|
||||
// JSONObject reps = JSONObject.parseObject(result.getContent());
|
||||
if (reps.containsKey(RESP_STATUS) && reps.getString(RESP_STATUS).equals("0")) {
|
||||
return reps;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("区块链接口请求失败", e);
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Map<String, String> convertParams(JSONObject param) {
|
||||
Set<String> keys = param.keySet();
|
||||
Map<String, String> r = new HashMap<>();
|
||||
// 遍历 key 集合并获取对应的 value
|
||||
for (String key : keys) {
|
||||
Object o = param.get(key);
|
||||
if (o != null) {
|
||||
if (o instanceof String || o instanceof Integer || o instanceof Long || o instanceof BigDecimal || o instanceof Double) {
|
||||
r.put(key, param.getString(key));
|
||||
} else if (o instanceof LocalDateTime) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
String format = formatter.format(LocalDateTime.parse(o.toString(), formatter));
|
||||
r.put(key, format);
|
||||
} else if (o instanceof Date) {
|
||||
String s = DateUtils.parseDateToStr(YYYY_MM_DD_HH_MM_SS, (Date) o);
|
||||
r.put(key, s);
|
||||
} else if (o instanceof List || o instanceof Map) {
|
||||
String jsonString = JSONObject.toJSONString(o);
|
||||
r.put(key, jsonString);
|
||||
}else {
|
||||
r.put(key, o.toString());
|
||||
}
|
||||
}else {
|
||||
r.put(key, null);
|
||||
}
|
||||
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
public AjaxResult projectTokenDistribute(InLinkProjectVo vo) {
|
||||
//根据项目ID,获取用户ID
|
||||
//根据项目id获取项目创建人
|
||||
String userId = projectResourceLibraryMapper.getProjectUserIdById(vo.getProjectId());
|
||||
validTokenCount(vo.getProjectId(), vo.getAmount(),userId);
|
||||
JSONObject params = new JSONObject();
|
||||
params.put(REQUEST_TYPE, TRANSFER_AMOUNT);
|
||||
params.put("token_name", vo.getProjectId());
|
||||
params.put("amount", vo.getAmount());
|
||||
params.put("payee", vo.getUserId());
|
||||
params.put("payer", userId);
|
||||
JSONObject rsp = queryFiscobcos(params);
|
||||
if (rsp != null) {
|
||||
String txHash = rsp.getString(TX_HASH);
|
||||
// insert to db 4、将3入链成功的数据存入表 :用户/项目转账信息记录表 (type:project、 payer_id:username)
|
||||
if (StringUtils.isNotEmpty(txHash)) {
|
||||
UserProjectTransferRecords records = new UserProjectTransferRecords();
|
||||
records.setPayerId(params.getString("payer"));//转账人
|
||||
records.setPayeeId(params.getString("payee"));//收款人
|
||||
records.setProjectId(vo.getProjectId());
|
||||
records.setToken(BigDecimal.valueOf(vo.getAmount()));
|
||||
records.setType("projectApply");//项目分配
|
||||
records.setCreateTime(DateUtils.getNowDate());
|
||||
records.setTxHash(txHash);
|
||||
records.setCreateBy(SecurityUtils.getUsername());
|
||||
userProjectTransferRecordsMapper.insertUserProjectTransferRecords(records);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
public AjaxResult userCreate(UserCreateVo userCreateVo) {
|
||||
//根据项目id获取项目创建人
|
||||
String userId = projectResourceLibraryMapper.getUserIdBYLogin(userCreateVo.getPayee());//收款人ID
|
||||
userCreateVo.setPayee(userId);
|
||||
String payerId = projectResourceLibraryMapper.getUserIdBYLogin(userCreateVo.getPayer());//转账人ID
|
||||
userCreateVo.setPayer(payerId);
|
||||
//转账人token充足
|
||||
validUserTokenCount(userCreateVo);
|
||||
//进行转账
|
||||
JSONObject params = JSONObject.from(userCreateVo);
|
||||
params.put(REQUEST_TYPE, TRANSFER_AMOUNT);
|
||||
JSONObject rsp = queryFiscobcos(params);
|
||||
if (rsp != null) {
|
||||
String txHash = rsp.getString(TX_HASH);
|
||||
// insert to db 将2入链成功的数据新增到用户/项目转账信息记录表 (type:user payer_id:payer)
|
||||
if (StringUtils.isNotEmpty(txHash)) {
|
||||
UserProjectTransferRecords records = new UserProjectTransferRecords();
|
||||
records.setPayerId(params.getString("payer"));
|
||||
records.setPayeeId(params.getString("payee"));
|
||||
records.setProjectId(params.getString("token_name"));
|
||||
records.setToken(params.getBigDecimal("amount"));
|
||||
records.setType("userTransfer");//用户转账
|
||||
records.setTxHash(txHash);
|
||||
records.setCreateTime(DateUtils.getNowDate());
|
||||
records.setCreateBy(SecurityUtils.getUsername());
|
||||
userProjectTransferRecordsMapper.insertUserProjectTransferRecords(records);
|
||||
return AjaxResult.success(rsp);
|
||||
}
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
//判断用户当前项目剩余token是否还支持分配
|
||||
private void validUserTokenCount(UserCreateVo userCreateVo) {
|
||||
//现根据用户id,以及项目名称查询对应用户拥有的token
|
||||
JSONObject params = new JSONObject();
|
||||
params.put(REQUEST_TYPE, USER_SINGLE_REPO);
|
||||
params.put("token_name", userCreateVo.getToken_name());
|
||||
params.put("username", userCreateVo.getPayer());
|
||||
Map<String, String> p = convertParams(params);
|
||||
params = JSONObject.from(p);
|
||||
JSONObject rsp = queryFiscobcos(params);
|
||||
if(rsp != null) {
|
||||
long curToken = Long.parseLong(rsp.getString("balance"));
|
||||
Long amount = userCreateVo.getAmount();
|
||||
if (curToken <amount) {
|
||||
throw new ServiceException("token数量不足");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//判断项目剩余token是否还支持分配
|
||||
private void validTokenCount(String tokenName, Long amount,String userName) {
|
||||
TokenListVo v = new TokenListVo();
|
||||
if(StringUtils.isEmpty(tokenName)) {
|
||||
throw new ServiceException("项目ID不能为空");
|
||||
}
|
||||
v.setId(Long.parseLong(Optional.ofNullable(tokenName).orElse("-1")));
|
||||
Long issueTokenSum = projectResourceLibraryMapper.sumProjectIssueToken(v.getId());
|
||||
v.setIssueToken(issueTokenSum);
|
||||
//根据创建人、项目Id,获取创建人拥有token
|
||||
Long applyToken= getUserBlanaceProjectId("userSingleInfo",userName,tokenName);
|
||||
v.setApplyToken(applyToken);
|
||||
long curToken = applyToken - issueTokenSum;
|
||||
if (curToken < amount) {
|
||||
throw new ServiceException("token数量不足");
|
||||
}
|
||||
}
|
||||
|
||||
private Long queryTotalToken(TokenListVo v) {
|
||||
if(v.getName().equals("区块链测试")){
|
||||
System.out.println("zzz");
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put(REQUEST_TYPE, QUERY_REPO);
|
||||
param.put("token_name", String.valueOf(v.getId()));
|
||||
|
||||
JSONObject jsonObject = queryFiscobcos(param);
|
||||
if (jsonObject != null) {
|
||||
return jsonObject.getLong("total_supply");
|
||||
}
|
||||
return -1L;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public AjaxResult prCreate(PrCreateVo prCreateVo) {
|
||||
Map<String, Object> res = projectResourceLibraryMapper.selectPrInfo(prCreateVo.getPr_id());
|
||||
if (res != null) {
|
||||
JSONObject params = JSONObject.from(res);
|
||||
Map<String, String> p = convertParams(params);
|
||||
params = JSONObject.from(p);
|
||||
params.put("updated_at", DataUtilsStr());
|
||||
params.put("pull_request_number", params.getLong("pull_request_number"));
|
||||
params.put(REQUEST_TYPE, CREATE_PR);
|
||||
JSONObject rsp = queryFiscobcos(params);
|
||||
if (rsp != null) {
|
||||
String txHash = rsp.getString(TX_HASH);
|
||||
//将对应的token todo
|
||||
// insert to db 新增表:pr入链关联(id,type,type_id,tx_hash,create_time) (type:pr,type_id:"pull_request_id)
|
||||
if (StringUtils.isNotEmpty(txHash)) {
|
||||
InBlockchainData inBlockchainData = new InBlockchainData();
|
||||
inBlockchainData.setType("pr");
|
||||
inBlockchainData.setTxHash(txHash);
|
||||
inBlockchainData.setTypeId(prCreateVo.getPr_id());
|
||||
inBlockchainData.setCreateTime(DateUtils.getNowDate());
|
||||
inBlockchainData.setCreateBy(SecurityUtils.getUsername());
|
||||
inBlockchainDataMapper.insertInBlockchainData(inBlockchainData);
|
||||
return AjaxResult.success(rsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
private String DataUtilsStr() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return sdf.format(DateUtils.getNowDate());
|
||||
}
|
||||
|
||||
|
||||
public AjaxResult issueCreateUpdate(IssueCreateVo issueCreateVo) {
|
||||
Map<String, Object> res = projectResourceLibraryMapper.selectIssueInfo(issueCreateVo.getIssue_id());
|
||||
if (res != null) {
|
||||
JSONObject params = JSONObject.from(res);
|
||||
params.put(REQUEST_TYPE, CREATE_UPDATE_ISSUE);
|
||||
params.put("updated_at", DataUtilsStr());
|
||||
Map<String, String> p = convertParams(params);
|
||||
params = JSONObject.from(p);
|
||||
JSONObject rsp = queryFiscobcos(params);
|
||||
if (rsp != null) {
|
||||
String txHash = rsp.getString(TX_HASH);
|
||||
// insert to db 4、 :数据入链表(id,type,type_id,tx_hash,create_time) (type:issue,type_id:issue_id)
|
||||
if (StringUtils.isNotEmpty(txHash)) {
|
||||
InBlockchainData inBlockchainData = new InBlockchainData();
|
||||
inBlockchainData.setType("issue");
|
||||
inBlockchainData.setTxHash(txHash);
|
||||
inBlockchainData.setTypeId(issueCreateVo.getIssue_id());
|
||||
inBlockchainData.setCreateTime(DateUtils.getNowDate());
|
||||
inBlockchainData.setCreateBy(SecurityUtils.getUsername());
|
||||
inBlockchainDataMapper.insertInBlockchainData(inBlockchainData);
|
||||
return AjaxResult.success(rsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> issueDataList(BlockchainListQueryVo queryVo) {
|
||||
List<Map<String, Object>> maps = inBlockchainDataMapper.issueDataList(queryVo);
|
||||
handleForgeDate(maps);
|
||||
return maps;
|
||||
}
|
||||
|
||||
private void handleForgeDate(List<Map<String, Object>> maps){
|
||||
for (Map<String, Object> m : maps) {
|
||||
LocalDateTime updatedAt = (LocalDateTime) m.get("updated_at");
|
||||
LocalDateTime createdAt = (LocalDateTime) m.get("created_at");
|
||||
m.put("updated_at",formatLocalDateTimePlusH(updatedAt,8));
|
||||
m.put("created_at",formatLocalDateTimePlusH(createdAt,8));
|
||||
|
||||
if (m.containsKey("committer_time")) {
|
||||
LocalDateTime committer_time = (LocalDateTime) m.get("committer_time");
|
||||
m.put("committer_time",formatLocalDateTimePlusH(committer_time,8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//定时任务,将commit数据入链
|
||||
// @Scheduled(cron = "${cron.commitPushBlock}")
|
||||
public void commitPushBlock() {
|
||||
//先查询需要入链的数据
|
||||
List<String> commitIdList = inBlockchainDataMapper.getNeedToBlockCommitList();
|
||||
if(commitIdList!=null && commitIdList.size()>0) {
|
||||
//遍历数据入区块链
|
||||
for(String commitId : commitIdList) {
|
||||
CommitCreateVo commitCreateVo = new CommitCreateVo();
|
||||
commitCreateVo.setCommit_id(commitId);
|
||||
commitCreate(commitCreateVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AjaxResult commitCreate(CommitCreateVo commitCreateVo) {
|
||||
List<CommitResultVo> CommitCreateVoList = new ArrayList<>();
|
||||
if(StringUtils.isEmpty(commitCreateVo.getCommit_id())) {
|
||||
String projectId = commitCreateVo.getProject_id();
|
||||
if (StringUtils.isNotEmpty(projectId)) {
|
||||
CommitCreateVoList = inBlockchainDataMapper.getCommitListById(projectId);
|
||||
}
|
||||
}else{
|
||||
CommitResultVo resultVo = new CommitResultVo();
|
||||
resultVo.setCommitId(commitCreateVo.getCommit_id());
|
||||
resultVo.setCommitDiff(commitCreateVo.getCommit_diff());
|
||||
CommitCreateVoList.add(resultVo);
|
||||
}
|
||||
if(CommitCreateVoList!=null && CommitCreateVoList.size()>0) {
|
||||
for(CommitResultVo commit : CommitCreateVoList) {
|
||||
commitDataTnBlock(commit);
|
||||
|
||||
//判断代码合并的时候issue
|
||||
String issue_id = commitCreateVo.getIssue_id();
|
||||
if(StringUtils.isNotEmpty(issue_id)) {
|
||||
//根据issue_id获取,判断是否要进行token转让
|
||||
UserProjectTransferRecords records = projectResourceLibraryMapper.selectIssueEndInfo(issue_id);
|
||||
if (Objects.nonNull(records)) {
|
||||
records.setType("issuePr");//pr合并关闭issue
|
||||
records.setTxHash("txHash");
|
||||
records.setCreateTime(DateUtils.getNowDate());
|
||||
records.setCreateBy(SecurityUtils.getUsername());
|
||||
userProjectTransferRecordsMapper.insertUserProjectTransferRecords(records);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
private AjaxResult commitDataTnBlock(CommitResultVo commitCreateVo) {
|
||||
String commitId = commitCreateVo.getCommitId();
|
||||
//根据项目id,查询对应的需要入链的commit
|
||||
Map<String, Object> res = projectResourceLibraryMapper.selectCommitInfo(commitId,commitCreateVo.getCommitDiff());
|
||||
JSONObject params = JSONObject.from(res);
|
||||
params.put(REQUEST_TYPE, CREATE_COMMIT);
|
||||
Map<String, String> p = convertParams(params);
|
||||
params = JSONObject.from(p);
|
||||
JSONObject rsp = queryFiscobcos(params);
|
||||
if (rsp != null) {
|
||||
String txHash = rsp.getString(TX_HASH);
|
||||
// insert to db 4、 :数据入链表(id,type,type_id,tx_hash,create_time) (type:issue,type_id:issue_id)
|
||||
if (StringUtils.isNotEmpty(txHash)) {
|
||||
InBlockchainData inBlockchainData = new InBlockchainData();
|
||||
inBlockchainData.setType("commit");
|
||||
inBlockchainData.setTxHash(txHash);
|
||||
inBlockchainData.setTypeId(commitId);
|
||||
inBlockchainData.setCreateTime(DateUtils.getNowDate());
|
||||
inBlockchainData.setCreateBy(SecurityUtils.getUsername());
|
||||
inBlockchainDataMapper.insertInBlockchainData(inBlockchainData);
|
||||
return AjaxResult.success(rsp);
|
||||
}
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> commitDataList(BlockchainListQueryVo queryVo) {
|
||||
List<Map<String, Object>> maps = inBlockchainDataMapper.commitDataList(queryVo);
|
||||
handleForgeDate(maps);
|
||||
return maps;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> prDataList(BlockchainListQueryVo queryVo) {
|
||||
List<Map<String, Object>> maps = inBlockchainDataMapper.prDataList(queryVo);
|
||||
handleForgeDate(maps);
|
||||
return maps;
|
||||
}
|
||||
//产权转让
|
||||
public List<Map> userDataList(BlockchainListQueryVo queryVo) {
|
||||
Long gitlinkUserId = SecurityUtils.getGitlinkUserId();
|
||||
Map<String, Object> stringObjectMap = Optional.ofNullable(talentReferralMapper.selectUsersById(gitlinkUserId)).orElse(new HashMap<>());
|
||||
if (!Objects.equals(stringObjectMap.get("admin"), "1")) {
|
||||
queryVo.setUserId(gitlinkUserId);
|
||||
}
|
||||
|
||||
startPage();
|
||||
return userProjectTransferRecordsMapper.userDataList(queryVo);
|
||||
}
|
||||
|
||||
public List<UserVo> userList(UserVo userVo) {
|
||||
return userProjectTransferRecordsMapper.userList(userVo);
|
||||
}
|
||||
|
||||
public AjaxResult projectCreate(ProjectCreateVo projectCreateVo) {
|
||||
//先根据项目id(token_name)判断项目是否存在,存在才入链
|
||||
String tokenName = projectCreateVo.getToken_name();
|
||||
int num = talentReferralMapper.selectProjectById(tokenName);
|
||||
if(num>0) {
|
||||
JSONObject params = new JSONObject();
|
||||
params.put(REQUEST_TYPE, CREATE_REPO);
|
||||
params.put("owner", projectCreateVo.getOwner());
|
||||
params.put("token_name", projectCreateVo.getToken_name());
|
||||
// params.put("cur_supply", projectCreateVo.getCur_supply());
|
||||
Map<String, String> p = convertParams(params);
|
||||
params = JSONObject.from(p);
|
||||
params.put("total_supply", projectCreateVo.getTotal_supply());
|
||||
JSONObject rsp = queryFiscobcos(params);
|
||||
if (rsp != null) {
|
||||
String txHash = rsp.getString(TX_HASH);
|
||||
// insert to db 4、 :数据入链表(id,type,type_id,tx_hash,create_time) (type:issue,type_id:issue_id)
|
||||
if (StringUtils.isNotEmpty(txHash)) {
|
||||
InBlockchainData inBlockchainData = new InBlockchainData();
|
||||
inBlockchainData.setType("project");
|
||||
inBlockchainData.setTxHash(txHash);
|
||||
inBlockchainData.setTypeId(projectCreateVo.getToken_name());
|
||||
inBlockchainData.setCreateTime(DateUtils.getNowDate());
|
||||
inBlockchainData.setCreateBy(SecurityUtils.getUsername());
|
||||
inBlockchainDataMapper.insertInBlockchainData(inBlockchainData);
|
||||
return AjaxResult.success(rsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
public AjaxResult queryBlockInfo(String type,String typeId) {
|
||||
JSONObject params = paramsQuery(type,typeId);
|
||||
Map<String, String> p = convertParams(params);
|
||||
params = JSONObject.from(p);
|
||||
JSONObject rsp = queryFiscobcos(params);
|
||||
return AjaxResult.success(rsp);
|
||||
}
|
||||
|
||||
private JSONObject paramsQuery(String type, String typeId) {
|
||||
JSONObject params = new JSONObject();
|
||||
if(type.equals(PROJECT_INFO)){
|
||||
params.put(REQUEST_TYPE, QUERY_REPO);
|
||||
params.put("token_name", typeId);
|
||||
}else if(type.equals(COMMIT_INTO)){
|
||||
params.put(REQUEST_TYPE, QUERY_COMMIT);
|
||||
params.put("commit_hash", typeId);
|
||||
}else if(type.equals(PR_LATEST_INFO)){
|
||||
params.put(REQUEST_TYPE, QUERY_PR_LATEST);
|
||||
params.put("pull_request_id", typeId);
|
||||
}else if(type.equals(PR_ALL_INFO)){
|
||||
params.put(REQUEST_TYPE, QUERY_PR_ALL);
|
||||
params.put("pull_request_id", typeId);
|
||||
}else if(type.equals(ISSUE_LATEST_INFO)){
|
||||
params.put(REQUEST_TYPE, QUERY_ISSUE_LATEST);
|
||||
params.put("issue_id", typeId);
|
||||
}else if(type.equals(ISSUE_ALL_INFO)){
|
||||
params.put(REQUEST_TYPE, QUERY_ISSUE_ALL);
|
||||
params.put("issue_id", typeId);
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
|
||||
public AjaxResult getTransactionByHash(String txHash) {
|
||||
JSONObject params = new JSONObject();
|
||||
params.put(REQUEST_TYPE, GET_TRANSACTION_BYHASH);
|
||||
params.put("tx_hash", txHash);
|
||||
Map<String, String> p = convertParams(params);
|
||||
params = JSONObject.from(p);
|
||||
JSONObject rsp = queryFiscobcos(params);
|
||||
return AjaxResult.success(rsp);
|
||||
}
|
||||
|
||||
public AjaxResult getTransactionReceipt(String txHash) {
|
||||
JSONObject params = new JSONObject();
|
||||
params.put(REQUEST_TYPE, GET_TRANSACTION_RECEIPT);
|
||||
params.put("tx_hash", txHash);
|
||||
Map<String, String> p = convertParams(params);
|
||||
params = JSONObject.from(p);
|
||||
JSONObject rsp = queryFiscobcos(params);
|
||||
return AjaxResult.success(rsp);
|
||||
}
|
||||
|
||||
public AjaxResult getTotalTransactionCount() {
|
||||
JSONObject params = new JSONObject();
|
||||
params.put(REQUEST_TYPE, GET_TOTAL_TRANSACTION_COUNTT);
|
||||
Map<String, String> p = convertParams(params);
|
||||
params = JSONObject.from(p);
|
||||
JSONObject rsp = queryFiscobcos(params);
|
||||
return AjaxResult.success(rsp);
|
||||
}
|
||||
|
||||
public AjaxResult getBlockNumber() {
|
||||
JSONObject params = new JSONObject();
|
||||
params.put(REQUEST_TYPE, GET_BLOCK_NUM);
|
||||
Map<String, String> p = convertParams(params);
|
||||
params = JSONObject.from(p);
|
||||
JSONObject rsp = queryFiscobcos(params);
|
||||
if (rsp != null) {
|
||||
return AjaxResult.success(rsp);
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
public AjaxResult getUserTokenByProjectId(String type,String userName,String tokenName) {
|
||||
JSONObject params = new JSONObject();
|
||||
if(type.equals(USER_SINGLE_INFO)){
|
||||
params.put(REQUEST_TYPE, USER_SINGLE_REPO);
|
||||
params.put("token_name", tokenName);
|
||||
params.put("username", userName);
|
||||
}else if(type.equals(USER_ALL_INFO)){
|
||||
params.put(REQUEST_TYPE, USER_ALL_REPOS);
|
||||
params.put("username", userName);
|
||||
}
|
||||
Map<String, String> p = convertParams(params);
|
||||
params = JSONObject.from(p);
|
||||
JSONObject rsp = queryFiscobcos(params);
|
||||
if (rsp != null) {
|
||||
return AjaxResult.success(rsp);
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
//
|
||||
public AjaxResult getUserAllProjectToken(String userName) {
|
||||
JSONObject params = new JSONObject();
|
||||
params.put(REQUEST_TYPE, USER_ALL_REPOS);
|
||||
params.put("username", userName);
|
||||
Map<String, String> p = convertParams(params);
|
||||
params = JSONObject.from(p);
|
||||
JSONObject rsp = queryFiscobcos(params);
|
||||
if (rsp != null) {
|
||||
return AjaxResult.success(rsp);
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -117,11 +117,4 @@ public interface IAchievementsService {
|
|||
List<TaskResourceLibrary> getRelatedAchTaskOfExpert(Long id);
|
||||
|
||||
List<CompetitionResourceLibrary> getRelatedAchCompetitionOfExpert(Long id);
|
||||
|
||||
AchDetailVo getAreaDetail(String areaKey,String kyxmSum, String source);
|
||||
|
||||
List<KeyValVo<String, Long>> get7DayAddExport(AchQueryVo achQueryVo);
|
||||
|
||||
List<KeyValueVo> getAllAreas(String areaName);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,4 @@ public interface ISchoolEnterpriseAchievementsService
|
|||
Long topStatistic(SchoolEnterpriseAchievements schoolEnterpriseAchievements);
|
||||
|
||||
List<SchoolEnterpriseAchievements> listFront(SchoolEnterpriseAchievements schoolEnterpriseAchievements);
|
||||
|
||||
boolean getCheckSchoolAchName(SchoolEnterpriseAchievements schoolEnterpriseAchievements);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,95 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.microservices.common.core.utils.DateUtils;
|
||||
import com.microservices.dms.achievementLibrary.domain.blockchain.InBlockchainData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.microservices.dms.achievementLibrary.mapper.InBlockchainDataMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 区块链数据入链Service业务层处理
|
||||
*
|
||||
* @author microservices
|
||||
* @date 2025-05-27
|
||||
*/
|
||||
@Service
|
||||
public class InBlockchainDataServiceImpl
|
||||
{
|
||||
@Autowired
|
||||
private InBlockchainDataMapper inBlockchainDataMapper;
|
||||
|
||||
/**
|
||||
* 查询区块链数据入链
|
||||
*
|
||||
* @param id 区块链数据入链主键
|
||||
* @return 区块链数据入链
|
||||
*/
|
||||
|
||||
public InBlockchainData selectInBlockchainDataById(Long id)
|
||||
{
|
||||
return inBlockchainDataMapper.selectInBlockchainDataById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询区块链数据入链列表
|
||||
*
|
||||
* @param inBlockchainData 区块链数据入链
|
||||
* @return 区块链数据入链
|
||||
*/
|
||||
|
||||
public List<InBlockchainData> selectInBlockchainDataList(InBlockchainData inBlockchainData)
|
||||
{
|
||||
return inBlockchainDataMapper.selectInBlockchainDataList(inBlockchainData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增区块链数据入链
|
||||
*
|
||||
* @param inBlockchainData 区块链数据入链
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
public int insertInBlockchainData(InBlockchainData inBlockchainData)
|
||||
{
|
||||
inBlockchainData.setCreateTime(DateUtils.getNowDate());
|
||||
return inBlockchainDataMapper.insertInBlockchainData(inBlockchainData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改区块链数据入链
|
||||
*
|
||||
* @param inBlockchainData 区块链数据入链
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
public int updateInBlockchainData(InBlockchainData inBlockchainData)
|
||||
{
|
||||
return inBlockchainDataMapper.updateInBlockchainData(inBlockchainData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除区块链数据入链
|
||||
*
|
||||
* @param ids 需要删除的区块链数据入链主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
public int deleteInBlockchainDataByIds(Long[] ids)
|
||||
{
|
||||
return inBlockchainDataMapper.deleteInBlockchainDataByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除区块链数据入链信息
|
||||
*
|
||||
* @param id 区块链数据入链主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
public int deleteInBlockchainDataById(Long id)
|
||||
{
|
||||
return inBlockchainDataMapper.deleteInBlockchainDataById(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -59,11 +59,9 @@ public class MemoDashboardService {
|
|||
* @return
|
||||
*/
|
||||
public List<KeyValueVo> getAddMemoStatistic() {
|
||||
Date[] currentYear = DateUtil.getLast12Months();
|
||||
return memoResourceLibraryMapper.getAddMemoStatistic(currentYear[0],currentYear[1]);
|
||||
return memoResourceLibraryMapper.getAddMemoStatistic();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 本年帖子热度top5(论坛评论、点击、点赞)
|
||||
* @return
|
||||
|
|
|
|||
|
|
@ -1,88 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.microservices.common.core.utils.DateUtils;
|
||||
import com.microservices.dms.achievementLibrary.domain.blockchain.UserProjectTransferRecords;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.microservices.dms.achievementLibrary.mapper.UserProjectTransferRecordsMapper;
|
||||
|
||||
/**
|
||||
* 用户/项目转账信息记录Service业务层处理
|
||||
*
|
||||
* @author microservices
|
||||
* @date 2025-05-27
|
||||
*/
|
||||
@Service
|
||||
public class UserProjectTransferRecordsServiceImpl
|
||||
{
|
||||
@Autowired
|
||||
private UserProjectTransferRecordsMapper userProjectTransferRecordsMapper;
|
||||
|
||||
/**
|
||||
* 查询用户/项目转账信息记录
|
||||
*
|
||||
* @param id 用户/项目转账信息记录主键
|
||||
* @return 用户/项目转账信息记录
|
||||
*/
|
||||
public UserProjectTransferRecords selectUserProjectTransferRecordsById(Long id)
|
||||
{
|
||||
return userProjectTransferRecordsMapper.selectUserProjectTransferRecordsById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户/项目转账信息记录列表
|
||||
*
|
||||
* @param userProjectTransferRecords 用户/项目转账信息记录
|
||||
* @return 用户/项目转账信息记录
|
||||
*/
|
||||
public List<UserProjectTransferRecords> selectUserProjectTransferRecordsList(UserProjectTransferRecords userProjectTransferRecords)
|
||||
{
|
||||
return userProjectTransferRecordsMapper.selectUserProjectTransferRecordsList(userProjectTransferRecords);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户/项目转账信息记录
|
||||
*
|
||||
* @param userProjectTransferRecords 用户/项目转账信息记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUserProjectTransferRecords(UserProjectTransferRecords userProjectTransferRecords)
|
||||
{
|
||||
userProjectTransferRecords.setCreateTime(DateUtils.getNowDate());
|
||||
return userProjectTransferRecordsMapper.insertUserProjectTransferRecords(userProjectTransferRecords);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户/项目转账信息记录
|
||||
*
|
||||
* @param userProjectTransferRecords 用户/项目转账信息记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserProjectTransferRecords(UserProjectTransferRecords userProjectTransferRecords)
|
||||
{
|
||||
return userProjectTransferRecordsMapper.updateUserProjectTransferRecords(userProjectTransferRecords);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户/项目转账信息记录
|
||||
*
|
||||
* @param ids 需要删除的用户/项目转账信息记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserProjectTransferRecordsByIds(Long[] ids)
|
||||
{
|
||||
return userProjectTransferRecordsMapper.deleteUserProjectTransferRecordsByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户/项目转账信息记录信息
|
||||
*
|
||||
* @param id 用户/项目转账信息记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserProjectTransferRecordsById(Long id)
|
||||
{
|
||||
return userProjectTransferRecordsMapper.deleteUserProjectTransferRecordsById(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,6 @@ import com.microservices.common.core.utils.StringUtils;
|
|||
import com.microservices.common.httpClient.service.HttpAPIService;
|
||||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.dms.achievementLibrary.domain.*;
|
||||
import com.microservices.dms.achievementLibrary.mapper.SchoolEnterpriseAchievementsMapper;
|
||||
import com.microservices.dms.behaviorImage.domain.AchievementBehaviorSumVo;
|
||||
import com.microservices.dms.behaviorImage.domain.AchievementImageVo;
|
||||
import com.microservices.dms.behaviorImage.service.IBehaviorImageService;
|
||||
|
|
@ -20,13 +19,11 @@ import com.microservices.dms.resourceLibrary.domain.CompetitionResourceLibrary;
|
|||
import com.microservices.dms.resourceLibrary.domain.Searcher;
|
||||
import com.microservices.dms.resourceLibrary.domain.TaskResourceLibrary;
|
||||
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
||||
import com.microservices.dms.resourceLibrary.mapper.CompetitionResourceLibraryMapper;
|
||||
import com.microservices.dms.resourceLibrary.mapper.ExpertResourceLibraryMapper;
|
||||
import com.microservices.dms.resourceLibrary.mapper.ProjectResourceLibraryMapper;
|
||||
import com.microservices.dms.resourceLibrary.mapper.TaskResourceLibraryMapper;
|
||||
import com.microservices.dms.utils.DateUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.checkerframework.checker.units.qual.K;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
|
@ -55,12 +52,11 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
@Autowired
|
||||
private ExpertResourceLibraryMapper expertResourceLibraryMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IBehaviorImageService behaviorImageService;
|
||||
|
||||
@Value("${makerSpaceUrl}")
|
||||
public String makerSpaceUrl;
|
||||
@Value("${markerSpaceUrl}")
|
||||
public String markerSpaceUrl;
|
||||
|
||||
@Value("${http.gitLinkUrl}")
|
||||
public String gitLinkUrl;
|
||||
|
|
@ -129,7 +125,7 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
a.setAttachments(buildFileInfoByIdents(a.getAttachments(), a.getSource()));
|
||||
|
||||
//拼接对接的用户信息
|
||||
List<Map<String,Object>> dockingUserInfo = achievementsMapper.getDockingUserInfoList(a.getId());
|
||||
List<Map<String,Object>> dockingUserInfo = achievementsMapper.getDockingUserInfo(a.getId());
|
||||
a.setDockingUserInfo(dockingUserInfo);
|
||||
}
|
||||
return list;
|
||||
|
|
@ -192,14 +188,6 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
*/
|
||||
@Override
|
||||
public int deleteAchievementsById(Long id) {
|
||||
//根据id,获取数据仓库该数据信息
|
||||
Achievements achievements = achievementsMapper.selectAchievementsById(id);
|
||||
if(achievements != null){
|
||||
String source = achievements.getSource();
|
||||
if(StringUtils.isNotEmpty(source)) {
|
||||
achievementsMapper.updateRelationAchievements(source,achievements.getSourceId());
|
||||
}
|
||||
}
|
||||
return achievementsMapper.deleteAchievementsById(id);
|
||||
}
|
||||
|
||||
|
|
@ -217,7 +205,7 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
}
|
||||
|
||||
if (Objects.equals(source, "2")) {
|
||||
concatUrl(list, makerSpaceUrl);
|
||||
concatUrl(list, markerSpaceUrl);
|
||||
}
|
||||
|
||||
if (Objects.equals(source, "4")) {
|
||||
|
|
@ -346,24 +334,6 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KeyValVo<String, Long>> get7DayAddExport(AchQueryVo achQueryVo) {
|
||||
Date[] days = DateUtil.getDays(0, 6);
|
||||
Map<String, Long> w = achievementsMapper.getExperts(days[0], days[1])
|
||||
.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV));
|
||||
|
||||
List<String> dateStr = DateUtil.getDateStrMMDD(days[0], days[1]);
|
||||
List<KeyValVo<String, Long>> res = new ArrayList<>();
|
||||
|
||||
for (String s : dateStr) {
|
||||
Long a = w.getOrDefault(s, 0L);
|
||||
KeyValVo<String, Long> k1 = new KeyValVo<>();
|
||||
k1.setK(s);
|
||||
k1.setV(a);
|
||||
res.add(k1);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@Override
|
||||
public Map<String, Long> indexProjectStatistic() {
|
||||
Map<String, Long> res = achievementsMapper.indexProjectStatistic();
|
||||
|
|
@ -400,10 +370,6 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页专家数据统计
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Long> indexExpertStatistic() {
|
||||
Map<String, Long> res = new HashMap<>();
|
||||
|
|
@ -474,19 +440,7 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
|
||||
@Override
|
||||
public List<AreaStatisticVo> getAreaStatistic(String areaKey) {
|
||||
List<AreaStatisticVo> areaStatisticVoList = new ArrayList<>();
|
||||
if(StringUtils.isNotEmpty(areaKey)) {
|
||||
//根据逗号进行分割
|
||||
String[] res =areaKey.split(",");
|
||||
for (String s : res) {
|
||||
String[] ss = s.split("_");
|
||||
List<AreaStatisticVo> tmpList = achievementsMapper.getAreaStatistic(ss[1],ss[0]);
|
||||
areaStatisticVoList.addAll(tmpList);
|
||||
}
|
||||
return areaStatisticVoList;
|
||||
}else{
|
||||
return achievementsMapper.getAreaStatistic(null,areaKey);
|
||||
}
|
||||
return achievementsMapper.getAreaStatistic(areaKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -494,17 +448,15 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
List<AchRelatedResult> relatedResultList = new ArrayList<>();
|
||||
//想根据开源项目id,获取对应的年度信息
|
||||
List<Long> allSourceId = achievementsMapper.getAllSourceId(id, sourceId);
|
||||
if(allSourceId != null && allSourceId.size() > 0) {
|
||||
List<String> allYear = achievementsMapper.getDistinctYear(id, allSourceId);
|
||||
if (StringUtils.isNotNull(allYear)) {
|
||||
//遍历年度信息,获取年度成果数据
|
||||
for (String paramYear : allYear) {
|
||||
AchRelatedResult relatedResult = new AchRelatedResult();
|
||||
relatedResult.setYear(paramYear);
|
||||
List<AchRelatedVo> tmpList = achievementsMapper.getRelatedAch(id, allSourceId, paramYear);
|
||||
relatedResult.setAchRelatedVoList(tmpList);
|
||||
relatedResultList.add(relatedResult);
|
||||
}
|
||||
List<String> allYear = achievementsMapper.getDistinctYear(id, allSourceId);
|
||||
if (StringUtils.isNotNull(allYear)) {
|
||||
//遍历年度信息,获取年度成果数据
|
||||
for (String paramYear : allYear) {
|
||||
AchRelatedResult relatedResult = new AchRelatedResult();
|
||||
relatedResult.setYear(paramYear);
|
||||
List<AchRelatedVo> tmpList = achievementsMapper.getRelatedAch(id, allSourceId, paramYear);
|
||||
relatedResult.setAchRelatedVoList(tmpList);
|
||||
relatedResultList.add(relatedResult);
|
||||
}
|
||||
}
|
||||
return relatedResultList;
|
||||
|
|
@ -596,37 +548,4 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
public List<String> getExpertAreasByName(String areaName) {
|
||||
return achievementsMapper.getExpertAreasByName(areaName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AchDetailVo getAreaDetail(String areaKey,String kyxmSum, String source) {
|
||||
AchDetailVo achDetailVo = new AchDetailVo();
|
||||
AchQueryVo achQueryVo = new AchQueryVo();
|
||||
achQueryVo.setAreaQuery(areaKey);
|
||||
achQueryVo.setSource(source);
|
||||
//根据kye,和source,查询领域描述
|
||||
String remark = achievementsMapper.getField1RemarkByParam(source,areaKey);
|
||||
achDetailVo.setRemark(remark);
|
||||
List<Achievements> achievementsList = achievementsMapper.selectAchievementsByArea(achQueryVo);
|
||||
if(achievementsList!=null && achievementsList.size()>0) {
|
||||
achDetailVo.setAchievementsList(achievementsList);
|
||||
long clickSum = achievementsList.stream().mapToLong(Achievements::getClickSum).sum();
|
||||
achDetailVo.setClickSum(clickSum);
|
||||
long dockSum = achievementsList.stream().mapToLong(Achievements::getDockSum).sum();
|
||||
achDetailVo.setDockSum(dockSum);
|
||||
long favoriteSum = achievementsList.stream().mapToLong(Achievements::getFavoriteSum).sum();
|
||||
achDetailVo.setFavoriteSum(favoriteSum);
|
||||
long watcherSum = achievementsList.stream().mapToLong(Achievements::getWatcherSum).sum();
|
||||
achDetailVo.setWatcherSum(watcherSum);
|
||||
}
|
||||
return achDetailVo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<KeyValueVo> getAllAreas(String areaName) {
|
||||
List<KeyValueVo> resultVal = achievementsMapper.getAllAreas(areaName);
|
||||
return resultVal;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package com.microservices.dms.achievementLibrary.service.impl;
|
|||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.microservices.common.core.constant.UserConstants;
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import com.microservices.common.core.utils.DateUtils;
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
|
|
@ -13,7 +12,6 @@ import com.microservices.dms.achievementLibrary.domain.Achievements;
|
|||
import com.microservices.dms.achievementLibrary.mapper.AchievementTeamMapper;
|
||||
import com.microservices.dms.achievementLibrary.mapper.AchievementsMapper;
|
||||
import com.microservices.dms.achievementLibrary.service.IAchievementsService;
|
||||
import com.microservices.system.api.domain.SysUser;
|
||||
import com.microservices.system.api.model.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -112,19 +110,6 @@ public class SchoolEnterpriseAchievementsServiceImpl implements ISchoolEnterpris
|
|||
return schoolEnterpriseAchievements.getId();
|
||||
}
|
||||
|
||||
//先判断是否存在名称一致的成果,存在则抛异常,已存在名称一样的成果
|
||||
@Override
|
||||
public boolean getCheckSchoolAchName(SchoolEnterpriseAchievements schoolEnterpriseAchievements) {
|
||||
Long achId = StringUtils.isNull(schoolEnterpriseAchievements.getId()) ? -1L : schoolEnterpriseAchievements.getId();
|
||||
SchoolEnterpriseAchievements info =schoolEnterpriseAchievementsMapper.selectSchoolEnterpriseAchievementsByName(schoolEnterpriseAchievements.getAchievementName());
|
||||
if (StringUtils.isNotNull(info) && info.getId().longValue() != achId.longValue())
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改校企成果
|
||||
*
|
||||
|
|
@ -135,13 +120,6 @@ public class SchoolEnterpriseAchievementsServiceImpl implements ISchoolEnterpris
|
|||
public int updateSchoolEnterpriseAchievements(SchoolEnterpriseAchievements schoolEnterpriseAchievements)
|
||||
{
|
||||
schoolEnterpriseAchievements.setUpdateTime(DateUtils.getNowDate());
|
||||
String status = schoolEnterpriseAchievements.getStatus();
|
||||
if(StringUtils.isNotEmpty(status)){
|
||||
schoolEnterpriseAchievements.setReviewDate(DateUtils.getNowDate());
|
||||
if (SecurityUtils.getLoginUser() != null) {
|
||||
schoolEnterpriseAchievements.setReviewer(SecurityUtils.getLoginUser().getUsername());
|
||||
}
|
||||
}
|
||||
return schoolEnterpriseAchievementsMapper.updateSchoolEnterpriseAchievements(schoolEnterpriseAchievements);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,8 +40,7 @@ public class BehaviorImageServiceImpl implements IBehaviorImageService {
|
|||
if(StringUtils.isNotNull(clickSum) && clickSum > 0) {
|
||||
Long click = behaviorImageMapper.getClickSumByAchievementId(id, BehaviorContant.ACHIEVEMENTS_IMAGE);
|
||||
if (StringUtils.isNotNull(click)) {
|
||||
// clickResult = click * weight / clickSum ;
|
||||
clickResult = click * weight / 100 ;
|
||||
clickResult = click * weight / clickSum ;
|
||||
}
|
||||
}
|
||||
} else if (bhavior.equals(BehaviorContant.FAVORITE_BEHAVIOR)) {//收藏
|
||||
|
|
@ -50,8 +49,7 @@ public class BehaviorImageServiceImpl implements IBehaviorImageService {
|
|||
if(StringUtils.isNotNull(favoriteSum) && favoriteSum > 0) {
|
||||
Long favorite = behaviorImageMapper.getFavoriteSumByAchievementId(id,BehaviorContant.ACHIEVEMENTS_IMAGE);
|
||||
if (StringUtils.isNotNull(favorite)) {
|
||||
// favoriteResult = favorite *weight / favoriteSum ;
|
||||
favoriteResult = favorite *weight / 100 ;
|
||||
favoriteResult = favorite *weight / favoriteSum ;
|
||||
}
|
||||
}
|
||||
} else if (bhavior.equals(BehaviorContant.SEARCH_BEHAVIOR)) {//搜索
|
||||
|
|
@ -60,8 +58,7 @@ public class BehaviorImageServiceImpl implements IBehaviorImageService {
|
|||
if(StringUtils.isNotNull(searchSum) && searchSum > 0) {
|
||||
Long search = behaviorImageMapper.getSearchSumByAchievementId(id, BehaviorContant.ACHIEVEMENTS_IMAGE);
|
||||
if (StringUtils.isNotNull(search)) {
|
||||
// searchResult = search *weight / searchSum;
|
||||
searchResult = search *weight / 100;
|
||||
searchResult = search *weight / searchSum;
|
||||
}
|
||||
}
|
||||
} else if (bhavior.equals(BehaviorContant.WATCH_BEHAVIOR)) {//关注
|
||||
|
|
@ -70,8 +67,7 @@ public class BehaviorImageServiceImpl implements IBehaviorImageService {
|
|||
if(StringUtils.isNotNull( watchSum) && watchSum > 0) {
|
||||
Long watch = behaviorImageMapper.getWatchSumByAchievementId(id,BehaviorContant.ACHIEVEMENTS_IMAGE);
|
||||
if (StringUtils.isNotNull( watch) ) {
|
||||
// watchResult = watch *weight / watchSum;
|
||||
watchResult = watch *weight / 100;
|
||||
watchResult = watch *weight / watchSum;
|
||||
}
|
||||
}
|
||||
} else if (bhavior.equals(BehaviorContant.FILE_DOWNLOAD_BEHAVIOR)) {//文件下载
|
||||
|
|
@ -80,8 +76,7 @@ public class BehaviorImageServiceImpl implements IBehaviorImageService {
|
|||
if(StringUtils.isNotNull(fileDownloadSum) && fileDownloadSum > 0) {
|
||||
Long fileDownload = behaviorImageMapper.getFileDownloadSumByAchievementId(id, BehaviorContant.ACHIEVEMENTS_IMAGE);
|
||||
if (StringUtils.isNotNull(fileDownload)) {
|
||||
// fileDownloadResult = fileDownload *weight / fileDownloadSum ;
|
||||
fileDownloadResult = fileDownload *weight / 100 ;
|
||||
fileDownloadResult = fileDownload *weight / fileDownloadSum ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,23 +4,28 @@ import com.microservices.common.core.web.controller.BaseController;
|
|||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
import com.microservices.common.core.web.page.TableDataInfo;
|
||||
import com.microservices.dms.achievementLibrary.domain.AchQueryVo;
|
||||
import com.microservices.dms.achievementLibrary.service.BlockChainService;
|
||||
import com.microservices.dms.achievementLibrary.service.IAchievementsService;
|
||||
import com.microservices.dms.common.vo.*;
|
||||
import com.microservices.dms.resourceLibrary.domain.ExpertResourceLibrary;
|
||||
import com.microservices.dms.resourceLibrary.service.IExpertResourceLibraryService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
|
@ -40,9 +45,6 @@ public class OpenController extends BaseController {
|
|||
@Autowired
|
||||
private IExpertResourceLibraryService expertResourceLibraryService;
|
||||
|
||||
@Autowired
|
||||
private BlockChainService blockChainService;
|
||||
|
||||
/**
|
||||
* 获取精选成果
|
||||
*
|
||||
|
|
@ -125,11 +127,6 @@ public class OpenController extends BaseController {
|
|||
return success(achievementsService.get7DayAdd(achQueryVo));
|
||||
}
|
||||
|
||||
@ApiOperation("七日新增专家")
|
||||
@GetMapping("/achievements/get7DayAddExpert")
|
||||
public AjaxResult get7DayAddExport(AchQueryVo achQueryVo) {
|
||||
return success(achievementsService.get7DayAddExport(achQueryVo));
|
||||
}
|
||||
|
||||
@ApiOperation("首页项目统计")
|
||||
@GetMapping("/achievements/indexProjectStatistic")
|
||||
|
|
@ -191,33 +188,4 @@ public class OpenController extends BaseController {
|
|||
.body(resource);
|
||||
}
|
||||
|
||||
// @ApiOperation("提供给开源项目那边新建项目,并且use_blockchain='1'的项目数据")
|
||||
// @PostMapping("/blockChain/projectCreate")
|
||||
// public AjaxResult projectCreate (@RequestBody ProjectCreateVo projectCreateVo) {
|
||||
// return blockChainService.projectCreate(projectCreateVo);
|
||||
// }
|
||||
|
||||
@ApiOperation("提供给开源项目那边新建issue、更新issue时调用,调用方法时传入相关数据(项目入链,并且悬赏金额不为空的issue数据才调用封装方法)")
|
||||
@PostMapping("/blockChain/issueCreateUpdate")
|
||||
public AjaxResult issueCreateUpdate (@RequestBody IssueCreateVo issueCreateVo) {
|
||||
return blockChainService.issueCreateUpdate(issueCreateVo);
|
||||
}
|
||||
|
||||
@ApiOperation("提供给开源项目那边提交commit调用,调用方法时传入相关数据(入链项目提交commit才调用)")
|
||||
@PostMapping("/blockChain/commitCreate")
|
||||
public AjaxResult commitCreate(@RequestBody CommitCreateVo commitCreateVo) {
|
||||
return blockChainService.commitCreate(commitCreateVo);
|
||||
}
|
||||
|
||||
@ApiOperation("提供给开源项目那边新建pr时调用,调用方法时传入相关数据(入链项目pr_合并代码才调用))")
|
||||
@PostMapping("/blockChain/prCreate")
|
||||
public AjaxResult prCreate(@RequestBody PrCreateVo prCreateVo) {
|
||||
return blockChainService.prCreate(prCreateVo);
|
||||
}
|
||||
|
||||
@ApiOperation("封装方法userCreate(入链项目2519,用户1向用户2转帐10个金币)")
|
||||
@PostMapping("/blockChain/userCreate")
|
||||
public AjaxResult userCreate(@RequestBody UserCreateVo userCreateVo) {
|
||||
return blockChainService.userCreate(userCreateVo);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
package com.microservices.dms.common.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CommitCreateVo {
|
||||
private String commit_id;
|
||||
|
||||
private String project_id;
|
||||
|
||||
private String commit_diff;
|
||||
|
||||
private String issue_id;
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
package com.microservices.dms.common.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CommitResultVo {
|
||||
private String commitId;
|
||||
|
||||
private String commitDiff;
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
package com.microservices.dms.common.vo;
|
||||
|
||||
public class IssueCreateVo {
|
||||
|
||||
public String getIssue_id() {
|
||||
return issue_id;
|
||||
}
|
||||
|
||||
public void setIssue_id(String issue_id) {
|
||||
this.issue_id = issue_id;
|
||||
}
|
||||
|
||||
private String issue_id;
|
||||
}
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
package com.microservices.dms.common.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
public class PrCreateQueryVo {
|
||||
|
||||
private String merge_user;
|
||||
|
||||
private String target_branch;
|
||||
|
||||
private String created_at;
|
||||
|
||||
private String title;
|
||||
|
||||
private String pull_request_id;
|
||||
|
||||
private String content;
|
||||
|
||||
private String source_branch;
|
||||
|
||||
private String reponame;
|
||||
|
||||
private String updated_at;
|
||||
|
||||
private String repo_id;
|
||||
|
||||
private Long pull_request_number;
|
||||
|
||||
private String action;
|
||||
|
||||
private String username;
|
||||
|
||||
public String getMerge_user() {
|
||||
return merge_user;
|
||||
}
|
||||
|
||||
public void setMerge_user(String merge_user) {
|
||||
this.merge_user = merge_user;
|
||||
}
|
||||
|
||||
public String getTarget_branch() {
|
||||
return target_branch;
|
||||
}
|
||||
|
||||
public void setTarget_branch(String target_branch) {
|
||||
this.target_branch = target_branch;
|
||||
}
|
||||
|
||||
public String getCreated_at() {
|
||||
return created_at;
|
||||
}
|
||||
|
||||
public void setCreated_at(String created_at) {
|
||||
this.created_at = created_at;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getPull_request_id() {
|
||||
return pull_request_id;
|
||||
}
|
||||
|
||||
public void setPull_request_id(String pull_request_id) {
|
||||
this.pull_request_id = pull_request_id;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getSource_branch() {
|
||||
return source_branch;
|
||||
}
|
||||
|
||||
public void setSource_branch(String source_branch) {
|
||||
this.source_branch = source_branch;
|
||||
}
|
||||
|
||||
public String getReponame() {
|
||||
return reponame;
|
||||
}
|
||||
|
||||
public void setReponame(String reponame) {
|
||||
this.reponame = reponame;
|
||||
}
|
||||
|
||||
public String getUpdated_at() {
|
||||
return updated_at;
|
||||
}
|
||||
|
||||
public void setUpdated_at(String updated_at) {
|
||||
this.updated_at = updated_at;
|
||||
}
|
||||
|
||||
public String getRepo_id() {
|
||||
return repo_id;
|
||||
}
|
||||
|
||||
public void setRepo_id(String repo_id) {
|
||||
this.repo_id = repo_id;
|
||||
}
|
||||
|
||||
public Long getPull_request_number() {
|
||||
return pull_request_number;
|
||||
}
|
||||
|
||||
public void setPull_request_number(Long pull_request_number) {
|
||||
this.pull_request_number = pull_request_number;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package com.microservices.dms.common.vo;
|
||||
|
||||
public class PrCreateVo {
|
||||
private String pr_id;
|
||||
|
||||
public String getPr_id() {
|
||||
return pr_id;
|
||||
}
|
||||
|
||||
public void setPr_id(String pr_id) {
|
||||
this.pr_id = pr_id;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
package com.microservices.dms.common.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ProjectCreateVo {
|
||||
private String owner;//项目创建者nickname
|
||||
private String token_name;//项目id
|
||||
private Long cur_supply;//项目创建者的初始token
|
||||
private Long total_supply;
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
package com.microservices.dms.common.vo;
|
||||
|
||||
public class UserCreateVo {
|
||||
private String payee;
|
||||
|
||||
private Long amount;
|
||||
|
||||
private String token_name;
|
||||
|
||||
private String payer;
|
||||
|
||||
private String actionType;
|
||||
|
||||
private String typeId;
|
||||
|
||||
public String getPayee() {
|
||||
return this.payee;
|
||||
}
|
||||
|
||||
public void setPayee(String payee) {
|
||||
this.payee = payee;
|
||||
}
|
||||
|
||||
public Long getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public void setAmount(Long amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public String getToken_name() {
|
||||
return this.token_name;
|
||||
}
|
||||
|
||||
public void setToken_name(String token_name) {
|
||||
this.token_name = token_name;
|
||||
}
|
||||
|
||||
public String getPayer() {
|
||||
return this.payer;
|
||||
}
|
||||
|
||||
public void setPayer(String payer) {
|
||||
this.payer = payer;
|
||||
}
|
||||
|
||||
public String getActionType() {
|
||||
return actionType;
|
||||
}
|
||||
|
||||
public void setActionType(String actionType) {
|
||||
this.actionType = actionType;
|
||||
}
|
||||
|
||||
public String getTypeId() {
|
||||
return typeId;
|
||||
}
|
||||
|
||||
public void setTypeId(String typeId) {
|
||||
this.typeId = typeId;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ public class BlockChainFunConstants {
|
|||
public static final String QUERY_PR_LATEST = "query pull request latest info"; //单个pr入链所有信息
|
||||
public static final String QUERY_PR_ALL = "query pull request all info"; //单个pr最后一次入链信息
|
||||
|
||||
public static final String CREATE_UPDATE_ISSUE = "upload issue info"; //Issue新增、修改入链
|
||||
public static final String CREATE_upDATE_issue = "upload issue info"; //Issue新增、修改入链
|
||||
public static final String QUERY_ISSUE_LATEST = "query issue latest info"; //单个Issue最后一次入链信息
|
||||
public static final String QUERY_ISSUE_ALL = "query issue all info"; //单个Issue入链所有信息
|
||||
|
||||
|
|
@ -24,27 +24,4 @@ public class BlockChainFunConstants {
|
|||
public static final String MINUS_USER_BALANCE = "minus user balance"; //项目分配token-用户token减少
|
||||
public static final String LOCK_USER_BALANCE = "lock user balance"; //用户转账token-将自己token分配给本项目中的其他用户
|
||||
|
||||
public static final String TRANSFER_AMOUNT = "transfer amount";
|
||||
|
||||
public static final String REQUEST_TYPE = "request-type";
|
||||
public static final String TX_HASH = "tx_hash";
|
||||
public static final String RESP_STATUS = "status";
|
||||
|
||||
public static final String GET_BLOCK_NUM = "getBlockNum";
|
||||
public static final String GET_TOTAL_TRANSACTION_COUNTT = "getTotalTransactionCountT";
|
||||
public static final String GET_TRANSACTION_BYHASH = "getTransactionByHash";
|
||||
public static final String GET_TRANSACTION_RECEIPT = "getTransactionReceipt";
|
||||
|
||||
|
||||
public static final String PROJECT_INFO = "projectInfo";
|
||||
public static final String COMMIT_INTO = "commitInfo";
|
||||
public static final String PR_LATEST_INFO = "prLatestInfo";
|
||||
public static final String PR_ALL_INFO = "prAllInfo";
|
||||
public static final String ISSUE_LATEST_INFO = "issueLatestInfo";
|
||||
public static final String ISSUE_ALL_INFO = "issueAllInfo";
|
||||
public static final String USER_SINGLE_INFO = "userSingleInfo";
|
||||
public static final String USER_ALL_INFO = "userAllInfo";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,5 +46,4 @@ public interface TalentReferralMapper {
|
|||
|
||||
PrInfoVo selectPRInfoById(@Param("id") Integer id);
|
||||
|
||||
int selectProjectById(@Param("tokenName") String tokenName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ import org.springframework.stereotype.Service;
|
|||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.microservices.dms.constant.TaskConstant.*;
|
||||
|
||||
/**
|
||||
* 人才推荐服务
|
||||
*/
|
||||
|
|
@ -48,7 +46,7 @@ public class TalentReferralService {
|
|||
// 获取项目贡献者数量
|
||||
JSONArray contributorsArray = dmsRequestHelper.getAllDataByPage(DmsGitLinkRequestUrl.CONTRIBUTORS(projectFullName), "list", "total_count");
|
||||
|
||||
return contributorsArray.stream().map(o -> (JSONObject) o).map(s -> s.getString("id")).filter(StringUtils::isNotBlank).mapToLong(Long::parseLong).boxed().collect(Collectors.toSet());
|
||||
return contributorsArray.stream().map(o -> (JSONObject) o).map(s -> s.getString("contributions")).filter(StringUtils::isNotBlank).mapToLong(Long::parseLong).boxed().collect(Collectors.toSet());
|
||||
|
||||
} catch (ServiceException e) {
|
||||
logger.error("【{}】获取项目贡献者数量失败:{}", projectFullName, e.getMessage());
|
||||
|
|
@ -93,7 +91,7 @@ public class TalentReferralService {
|
|||
return collaborators;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> doIssueTalentReferral(Long issueId, Long projectId) {
|
||||
public List<Map<String, Object>> doIssueTalentReferral(Long issueId , Long projectId) {
|
||||
List<Map.Entry<Long, Double>> entries = issueTalentReferral(projectId, issueId);
|
||||
return entries.stream().limit(3).map(s -> {
|
||||
Map<String, Object> mm = talentReferralMapper.selectUsersById(s.getKey());
|
||||
|
|
@ -110,13 +108,12 @@ public class TalentReferralService {
|
|||
|
||||
List<Long> curIssueAssigners = talentReferralMapper.selectIssuesAssigners(curIssue.getId());
|
||||
if (!curIssueAssigners.isEmpty()) {
|
||||
// return new ArrayList<>();
|
||||
// return new ArrayList<>();
|
||||
}
|
||||
|
||||
IssuesVo vo = new IssuesVo();
|
||||
vo.setProjectId(projectId);
|
||||
vo.setStatusIds(Lists.newArrayList(ReferralConstant.ISSUE_CLOSED, ReferralConstant.ISSUE_RESOLVED));
|
||||
vo.setIssueClassify("issue");
|
||||
vo.setStatusIds(Lists.newArrayList(ReferralConstant.ISSUE_CLOSED,ReferralConstant.ISSUE_RESOLVED));
|
||||
List<IssuesVo> issuesVos = talentReferralMapper.selectIssuesCondition(vo);
|
||||
Map<Long, Double> userFractionMap = new HashMap<>();
|
||||
// 计算与解决issue的相似度, 标题+描述
|
||||
|
|
@ -141,9 +138,7 @@ public class TalentReferralService {
|
|||
List<Map.Entry<Long, Double>> entryList = new ArrayList<>(userFractionMap.entrySet());
|
||||
entryList.sort((entry1, entry2) -> Double.compare(entry2.getValue(), entry1.getValue()));
|
||||
|
||||
// Set<Long> contributors = getContributorsByProjectId(projectId);
|
||||
// 贡献者改为项目成员
|
||||
Set<Long> contributors = getCollaboratorsByProjectId(projectId);
|
||||
Set<Long> contributors = getContributorsByProjectId(projectId);
|
||||
if (!contributors.isEmpty() && !entryList.isEmpty()) {
|
||||
entryList.removeIf(s -> !contributors.contains(s.getKey()));
|
||||
}
|
||||
|
|
@ -156,7 +151,7 @@ public class TalentReferralService {
|
|||
Map<String, Double> userNameFractionMap = new HashMap<>();
|
||||
Map<String, Set<String>> PRFilesMap = new HashMap<>();
|
||||
List<IssueDto> closedPullRequests = getPullRequests(projectId, "11").stream()
|
||||
.filter(e -> StringUtils.isNotBlank(e.getAssignUserLogin())).collect(Collectors.toList());
|
||||
.filter(e->StringUtils.isNotBlank(e.getAssignUserLogin())).collect(Collectors.toList());
|
||||
|
||||
for (IssueDto pr : prs) {
|
||||
PrInfoVo curPrInfoVo = talentReferralMapper.selectPRInfoById(pr.getPullRequestId());
|
||||
|
|
@ -273,7 +268,7 @@ public class TalentReferralService {
|
|||
public List<Achievements> taskAchievementTalentReferral(Long taskId) {
|
||||
TaskVo task = talentReferralMapper.selectTaskById(taskId);
|
||||
Achievements tCond = new Achievements();
|
||||
// tCond.setSourceId(taskId);
|
||||
tCond.setSourceId(taskId);
|
||||
tCond.setSource("2");
|
||||
tCond.setStatus("1");
|
||||
List<Achievements> taskAchievements = achievementsMapper.selectAchievementsList(tCond);
|
||||
|
|
@ -299,7 +294,7 @@ public class TalentReferralService {
|
|||
}
|
||||
|
||||
step1Map.forEach((k, v) -> step2Map.merge(k, v, Double::sum));
|
||||
step2Map.keySet().removeIf(step -> Double.compare(step2Map.get(step), 0.0D) <= 0.0D);
|
||||
step2Map.keySet().removeIf(step -> Double.compare(step2Map.get(step), 0.0D) > 0);
|
||||
|
||||
List<Map.Entry<Long, Double>> entryList = new ArrayList<>(step2Map.entrySet());
|
||||
entryList.sort((entry1, entry2) -> Double.compare(entry2.getValue(), entry1.getValue()));
|
||||
|
|
@ -318,7 +313,7 @@ public class TalentReferralService {
|
|||
public Object taskExpertTalentReferral(Long taskId) {
|
||||
TaskVo task = talentReferralMapper.selectTaskById(taskId);
|
||||
List<KeyValueVo> categories = achievementsMapper.getAreasByName(null);
|
||||
List<TaskVo> completedTasks = talentReferralMapper.selectTaskByStatus(Lists.newArrayList(TASK_COMPLETE_STATUS,TASK_PAPER_CHOOSING_STATUS,TASK_RESULT_PROOF_STATUS,TASK_SIGNING_STATUS,TASK_PAYING_STATUS));
|
||||
List<TaskVo> completedTasks = talentReferralMapper.selectTaskByStatus(Lists.newArrayList(TaskConstant.TASK_COMPLETE_STATUS));
|
||||
List<ExpertVo> allExperts = talentReferralMapper.selectExpertsBy(new ExpertVo());
|
||||
|
||||
List<Long> expertIds = doTaskExpertTalentReferral(task, categories, completedTasks, allExperts);
|
||||
|
|
@ -333,15 +328,8 @@ public class TalentReferralService {
|
|||
Map<Long, Double> step1Map = new TreeMap<>();
|
||||
Map<Long, Double> step2Map = new TreeMap<>();
|
||||
for (ExpertVo t1 : allExperts) {
|
||||
if (Objects.equals(taskDomain, t1.getReviewAreaOne())) {
|
||||
step1Map.merge(t1.getId(), 50.0D, Double::sum);
|
||||
}
|
||||
if (Objects.equals(taskDomain, t1.getReviewAreaTwo())) {
|
||||
step1Map.merge(t1.getId(), 50.0D, Double::sum);
|
||||
|
||||
}
|
||||
if (Objects.equals(taskDomain, t1.getReviewAreaThree())) {
|
||||
step1Map.merge(t1.getId(), 50.0D, Double::sum);
|
||||
if (Objects.equals(taskDomain, t1.getReviewAreaOne()) || Objects.equals(taskDomain, t1.getReviewAreaTwo()) || Objects.equals(taskDomain, t1.getReviewAreaThree())) {
|
||||
step1Map.put(t1.getId(), 50.0D);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -377,9 +365,6 @@ public class TalentReferralService {
|
|||
*/
|
||||
public Object competitionExpertTalentReferral(Long competitionId) {
|
||||
TaskVo task = talentReferralMapper.selectCompetitionById(competitionId);
|
||||
if (task == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<KeyValueVo> categories = new ArrayList<>();
|
||||
List<TaskVo> completedTasks = talentReferralMapper.selectCompetitionIdByStatus();
|
||||
List<ExpertVo> allExperts = talentReferralMapper.selectExpertsBy(new ExpertVo());
|
||||
|
|
@ -396,12 +381,12 @@ public class TalentReferralService {
|
|||
|
||||
|
||||
List<KeyValVo<Long, String>> allTaskWithExpertIds = talentReferralMapper.allTaskWithExpertIds("2");
|
||||
Map<String, String> t2e = allTaskWithExpertIds.stream().collect(Collectors.toMap(e->String.valueOf(e.getK()), KeyValVo::getV, (o, n) -> n));
|
||||
Map<Long, String> t2e = allTaskWithExpertIds.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV, (o, n) -> n));
|
||||
for (TaskVo t2 : completedTasks) {
|
||||
double subjectFraction = SimilarityService.sentence(task.getName(), t2.getName());
|
||||
double descFraction = SimilarityService.text(t2.getDescription(), task.getDescription());
|
||||
|
||||
String[] split = t2e.getOrDefault(String.valueOf(t2.getId()), "").split(",");
|
||||
String[] split = t2e.getOrDefault(t2.getId(), "").split(",");
|
||||
for (String s : split) {
|
||||
if (StringUtils.isNotBlank(s)) {
|
||||
step2Map.put(Long.parseLong(s), (subjectFraction + descFraction) * 100.0D);
|
||||
|
|
|
|||
|
|
@ -13,5 +13,4 @@ public class IssuesVo {
|
|||
private Long statusId;
|
||||
private List<Long> statusIds;
|
||||
private Long num;
|
||||
private String issueClassify;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import com.microservices.common.core.web.domain.AjaxResult;
|
|||
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.dms.achievementLibrary.domain.AchQueryVo;
|
||||
import com.microservices.dms.resourceLibrary.domain.ExpertResourceLibrary;
|
||||
import com.microservices.dms.resourceLibrary.service.IExpertResourceLibraryService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -139,5 +138,4 @@ public class ExpertResourceLibraryController extends BaseController
|
|||
public AjaxResult getActDataStatisticById(Long id) {
|
||||
return success(expertResourceLibraryService.getActDataStatisticById(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
package com.microservices.dms.resourceLibrary.domain;
|
||||
|
||||
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.microservices.common.core.annotation.Excel;
|
||||
import com.microservices.common.core.web.domain.BaseEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 专家资源库对象 expert_resource_library
|
||||
*
|
||||
|
|
@ -52,7 +48,7 @@ public class ExpertResourceLibrary extends BaseEntity {
|
|||
private String expertDomain;
|
||||
|
||||
private String titleRank;
|
||||
//准入状态
|
||||
|
||||
private Long status;
|
||||
//评审领域1
|
||||
private String reviewAreaOne;
|
||||
|
|
@ -82,26 +78,6 @@ public class ExpertResourceLibrary extends BaseEntity {
|
|||
private String userNickName;
|
||||
private String otherAttachments;
|
||||
|
||||
private String fullFileIds;
|
||||
|
||||
private List<KeyValVo<String, String>> attachmentList = new ArrayList<>();
|
||||
|
||||
public List<KeyValVo<String, String>> getAttachmentList() {
|
||||
return attachmentList;
|
||||
}
|
||||
|
||||
public void setAttachmentList(List<KeyValVo<String, String>> attachmentList) {
|
||||
this.attachmentList = attachmentList;
|
||||
}
|
||||
|
||||
public String getFullFileIds() {
|
||||
return fullFileIds;
|
||||
}
|
||||
|
||||
public void setFullFileIds(String fullFileIds) {
|
||||
this.fullFileIds = fullFileIds;
|
||||
}
|
||||
|
||||
public String getOtherAttachments() {
|
||||
return otherAttachments;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import com.microservices.dms.resourceLibrary.domain.vo.ExpertAttachmentVo;
|
|||
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.PropertyValues;
|
||||
|
||||
/**
|
||||
* 专家资源库Mapper接口
|
||||
|
|
@ -119,7 +118,7 @@ public interface ExpertResourceLibraryMapper
|
|||
|
||||
List<KeyValueVo> getForumSectionStatistic();
|
||||
|
||||
// List<KeyValueVo> getAddMemoStatistic();
|
||||
List<KeyValueVo> getAddMemoStatistic();
|
||||
|
||||
List<MemoTotalVo> getTop5Memos();
|
||||
|
||||
|
|
@ -128,8 +127,4 @@ public interface ExpertResourceLibraryMapper
|
|||
ExpertAttachmentVo getExpertInfoById(@Param("expertId") Long expertId);
|
||||
|
||||
Map<String, Object> getAttachmentInfo(@Param("id") Long id);
|
||||
|
||||
List<KeyValueVo> getAddMemoStatistic(@Param("s") Date s, @Param("e") Date e);
|
||||
|
||||
List<KeyValVo<String, String>> getAttachments(@Param("fullFileIds") String fullFileIds);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ package com.microservices.dms.resourceLibrary.mapper;
|
|||
|
||||
import com.microservices.common.datasource.annotation.Slave;
|
||||
import com.microservices.dms.achievementLibrary.domain.TokenListVo;
|
||||
import com.microservices.dms.achievementLibrary.domain.blockchain.UserProjectTransferRecords;
|
||||
import com.microservices.dms.common.vo.PrCreateQueryVo;
|
||||
import com.microservices.dms.resourceLibrary.domain.ProjectResourceLibrary;
|
||||
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
||||
import com.microservices.dms.resourceLibrary.domain.vo.ProjectListVo;
|
||||
|
|
@ -12,7 +10,6 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
@Slave
|
||||
|
|
@ -56,21 +53,7 @@ public interface ProjectResourceLibraryMapper {
|
|||
|
||||
String getProjectDomainNameByKey(@Param("projectDomain") String projectDomain );
|
||||
|
||||
List<TokenListVo> selectProjectInfos(@Param("name") String projectName);
|
||||
List<TokenListVo> selectProjectInfos();
|
||||
|
||||
Long sumProjectIssueToken(@Param("id") Long id);
|
||||
|
||||
Map<String, Object> selectCommitInfo(@Param("commitId") String commitId,@Param("commitDiff") String commitDiff);
|
||||
|
||||
Map<String, Object> selectPrInfo(@Param("prId") String prId);
|
||||
|
||||
Map<String, Object> selectIssueInfo(@Param("issueId") String issueId);
|
||||
|
||||
String getProjectUserIdById(@Param("tokenName")String tokenName);
|
||||
|
||||
Long getUsedApplyToken(@Param("tokenName")String tokenName,@Param("userName") String userName);
|
||||
|
||||
String getUserIdBYLogin(@Param("userId")String userId);
|
||||
|
||||
UserProjectTransferRecords selectIssueEndInfo(@Param("issueId") String issueId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
|||
import com.microservices.dms.resourceLibrary.mapper.CompetitionResourceLibraryMapper;
|
||||
import com.microservices.dms.resourceLibrary.domain.vo.UserActionDataVo;
|
||||
import com.microservices.dms.resourceLibrary.mapper.TaskResourceLibraryMapper;
|
||||
import com.microservices.dms.utils.DateUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -72,7 +71,6 @@ public class CompetitionResourceLibraryService {
|
|||
a.setV(String.format(PROJECT_DOWNLOAD_API, gitLinkUrl, v));
|
||||
}
|
||||
l.setAttachmentList(attachments);
|
||||
l.setSubmissionTime(DateUtil.plusHours(l.getSubmissionTime(), 8));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ import static com.microservices.dms.constant.TaskConstant.MARKER_SPACE_DOWNLOAD_
|
|||
public class TaskResourceLibraryService {
|
||||
private final TaskResourceLibraryMapper taskResourceLibraryMapper;
|
||||
|
||||
@Value("${makerSpaceUrl}")
|
||||
public String makerSpaceUrl;
|
||||
@Value("${markerSpaceUrl}")
|
||||
public String markerSpaceUrl;
|
||||
|
||||
public int addClick(Clicker click) {
|
||||
click.setCreatedAt(DateUtils.getNowDate());
|
||||
|
|
@ -104,7 +104,7 @@ public class TaskResourceLibraryService {
|
|||
List<KeyValVo<String, String>> attachments = taskResourceLibraryMapper.getAttachments(l.getPaperId());
|
||||
for (KeyValVo<String, String> a : attachments) {
|
||||
Object v = a.getV();
|
||||
a.setV(String.format(MARKER_SPACE_DOWNLOAD_API_BY_ID, makerSpaceUrl, v));
|
||||
a.setV(String.format(MARKER_SPACE_DOWNLOAD_API_BY_ID, markerSpaceUrl, v));
|
||||
}
|
||||
l.setAttachmentList(attachments);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import com.microservices.common.core.utils.StringUtils;
|
|||
import com.microservices.dms.behaviorImage.domain.AchievementBehaviorSumVo;
|
||||
import com.microservices.dms.resourceLibrary.domain.ExpertResourceLibrary;
|
||||
import com.microservices.dms.resourceLibrary.domain.vo.ExpertAttachmentVo;
|
||||
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
||||
import com.microservices.dms.resourceLibrary.mapper.ExpertResourceLibraryMapper;
|
||||
import com.microservices.dms.resourceLibrary.service.IExpertResourceLibraryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -18,8 +17,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import static com.microservices.dms.constant.TaskConstant.MARKER_SPACE_DOWNLOAD_API_BY_ID;
|
||||
import static com.microservices.dms.constant.TaskConstant.PROJECT_DOWNLOAD_API;
|
||||
import static com.microservices.dms.utils.UrlUtil.getUrlPath;
|
||||
|
||||
/**
|
||||
* 专家资源库Service业务层处理
|
||||
|
|
@ -32,8 +29,8 @@ public class ExpertResourceLibraryServiceImpl implements IExpertResourceLibraryS
|
|||
@Autowired
|
||||
private ExpertResourceLibraryMapper expertResourceLibraryMapper;
|
||||
|
||||
@Value("${makerSpaceUrl}")
|
||||
public String makerSpaceUrl;
|
||||
@Value("${markerSpaceUrl}")
|
||||
public String markerSpaceUrl;
|
||||
/**
|
||||
* 查询专家资源库
|
||||
*
|
||||
|
|
@ -77,12 +74,10 @@ public class ExpertResourceLibraryServiceImpl implements IExpertResourceLibraryS
|
|||
private void buildFullUrl(Map<String, Object> map) {
|
||||
if (map != null && map.containsKey("id") && map.get("id") != null) {
|
||||
String id = map.get("id").toString();
|
||||
map.put("url", String.format(MARKER_SPACE_DOWNLOAD_API_BY_ID, makerSpaceUrl, id));
|
||||
map.put("url", String.format(MARKER_SPACE_DOWNLOAD_API_BY_ID, markerSpaceUrl, id));
|
||||
}
|
||||
}
|
||||
|
||||
@Value("${http.gitLinkUrl}")
|
||||
public String gitLinkUrl;
|
||||
/**
|
||||
* 查询专家资源库列表
|
||||
*
|
||||
|
|
@ -93,31 +88,6 @@ public class ExpertResourceLibraryServiceImpl implements IExpertResourceLibraryS
|
|||
public List<ExpertResourceLibrary> selectExpertResourceLibraryList(ExpertResourceLibrary expertResourceLibrary) {
|
||||
List<ExpertResourceLibrary> expertResourceLibraryList = expertResourceLibraryMapper.selectExpertResourceLibraryList(expertResourceLibrary);
|
||||
for (ExpertResourceLibrary a : expertResourceLibraryList) {
|
||||
//附件组装
|
||||
String fullFileIds = a.getFullFileIds();
|
||||
if(StringUtils.isNotEmpty(fullFileIds)){
|
||||
List<KeyValVo<String, String>> attachments = expertResourceLibraryMapper.getAttachments(fullFileIds);
|
||||
for (KeyValVo<String, String> f: attachments) {
|
||||
String v = String.valueOf(f.getV());
|
||||
if (StringUtils.isNotEmpty(v)) {
|
||||
if (v.startsWith("http")) {
|
||||
String urlPath = getUrlPath(v);
|
||||
if (StringUtils.isNotEmpty(urlPath)) {
|
||||
if (urlPath.startsWith("/api")) {
|
||||
f.setV(gitLinkUrl + urlPath);
|
||||
}else {
|
||||
f.setV(gitLinkUrl +"/api"+ urlPath);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
f.setV(String.format(MARKER_SPACE_DOWNLOAD_API_BY_ID, gitLinkUrl, v));
|
||||
}
|
||||
}
|
||||
}
|
||||
a.setAttachmentList(attachments);
|
||||
a.setAttachments(JSON.toJSONString(attachments));
|
||||
}
|
||||
//头像组装
|
||||
String gender = a.getGender();
|
||||
String img = "images/avatars/User/boy.jpg";
|
||||
if(StringUtils.isNotEmpty(gender) && gender.equals("1")){
|
||||
|
|
|
|||
|
|
@ -112,28 +112,4 @@ public class DateUtil {
|
|||
LocalDateTime s = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
return Date.from(s.plusHours(plusHours).atZone(ZoneId.systemDefault()).toInstant());
|
||||
}
|
||||
|
||||
public static String formatLocalDateTimePlusH(LocalDateTime dateTime,long h) {
|
||||
if (dateTime == null) {return null;}
|
||||
|
||||
LocalDateTime localDateTime8 = dateTime.plusHours(h);
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
return formatter.format(localDateTime8);
|
||||
}
|
||||
|
||||
|
||||
public Date addHoursToDate(Date date, int hours) {
|
||||
if (date == null) {return null;}
|
||||
// 转换为LocalDateTime
|
||||
LocalDateTime localDateTime = date.toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDateTime();
|
||||
|
||||
// 增加小时
|
||||
localDateTime = localDateTime.plusHours(hours);
|
||||
|
||||
// 转回Date
|
||||
return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,185 +0,0 @@
|
|||
package com.microservices.dms.utils;
|
||||
|
||||
import org.apache.poi.xwpf.usermodel.*;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ExportWordUtil extends Component {
|
||||
|
||||
public static void exportToWord(String outputPath, List<Object[]> data) throws IOException {
|
||||
// 1. 从classpath加载模板文件
|
||||
// ClassLoader classLoader = ExportWordUtilCopy.class.getClassLoader();
|
||||
// try (InputStream is = classLoader.getResourceAsStream("template.docx");
|
||||
// XWPFDocument document = is != null ? new XWPFDocument(is) : null) {
|
||||
XWPFDocument document = new XWPFDocument();
|
||||
// 检查模板是否加载成功
|
||||
if (document == null) {
|
||||
throw new FileNotFoundException("模板文件未找到: template.docx");
|
||||
}
|
||||
// 添加5.1.1项目标题
|
||||
addTitle(document, "5.1.1项目", 1);
|
||||
// 添加迭代标题
|
||||
addTitle(document, "5.1.1.1迭代", 2);
|
||||
// 添加描述段落
|
||||
addParagraph(document, "迭代测试项共包含" + data.size() + "个测试用例,相关用例概述如表5-2所示。");
|
||||
// 设置表格标题
|
||||
setTableCaption(document, "表5-2 迭代功能测试用例概述表");
|
||||
// 创建表格-填充测试用例数据
|
||||
// setStyledTable(document,data);
|
||||
// 保存文档
|
||||
saveDocument(document, outputPath);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
private static void saveDocument(XWPFDocument document,String outputPath) throws IOException {
|
||||
File outputFile = new File(outputPath);
|
||||
try (FileOutputStream out = new FileOutputStream(outputFile)) {
|
||||
document.write(out);
|
||||
System.out.println("文件保存成功: " + outputFile.getAbsolutePath());
|
||||
System.out.println("文件大小: " + outputFile.length() + " bytes");
|
||||
}
|
||||
document.close();
|
||||
}
|
||||
|
||||
// 添加标题
|
||||
private static void addTitle(XWPFDocument document, String text, int level) {
|
||||
XWPFParagraph paragraph = document.createParagraph();
|
||||
paragraph.setStyle("Heading" + level);
|
||||
XWPFRun run = paragraph.createRun();
|
||||
run.setText(text);
|
||||
run.setBold(true);
|
||||
run.setFontSize(20 - level * 2);
|
||||
}
|
||||
|
||||
// 添加普通段落
|
||||
private static void addParagraph(XWPFDocument document, String text) {
|
||||
XWPFParagraph paragraph = document.createParagraph();
|
||||
XWPFRun run = paragraph.createRun();
|
||||
run.setText(text);
|
||||
}
|
||||
|
||||
// 设置表格标题
|
||||
private static void setTableCaption(XWPFDocument document, String caption) {
|
||||
XWPFParagraph paragraph = document.createParagraph();
|
||||
paragraph.setAlignment(ParagraphAlignment.CENTER);
|
||||
XWPFRun run = paragraph.createRun();
|
||||
run.setText(caption);
|
||||
run.setItalic(true);
|
||||
}
|
||||
|
||||
// 创建带样式的表格
|
||||
private static void setStyledTable(XWPFDocument document, List<Object[]> dataRows) throws IOException {
|
||||
// 3. 添加表格(保留模板样式)
|
||||
if (!dataRows.isEmpty()) {
|
||||
// 获取模板中的表格(假设第一个表格是模板)
|
||||
XWPFTable table = document.getTables().isEmpty() ?
|
||||
document.createTable() : document.getTables().get(0);
|
||||
|
||||
// 清空模板中原有的示例数据行(保留表头和样式行)
|
||||
while (table.getNumberOfRows() > 1) {
|
||||
table.removeRow(1);
|
||||
}
|
||||
|
||||
// 获取样式模板行(通常是第一行)
|
||||
XWPFTableRow styleRow = table.getRow(0);
|
||||
|
||||
// 添加数据行(保留样式)
|
||||
for (Object[] rowData : dataRows) {
|
||||
addStyledTableRow(table, styleRow, rowData);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 添加带样式的表格行
|
||||
private static void addStyledTableRow(XWPFTable table,
|
||||
XWPFTableRow styleRow,
|
||||
Object[] rowData) {
|
||||
// 创建新行
|
||||
XWPFTableRow newRow = table.createRow();
|
||||
|
||||
// 复制样式行的格式
|
||||
if (styleRow != null) {
|
||||
deepCopyStyle(styleRow, newRow);
|
||||
}
|
||||
|
||||
// 填充数据
|
||||
for (int i = 0; i < rowData.length; i++) {
|
||||
XWPFTableCell cell = newRow.getCell(i);
|
||||
if (cell == null) {
|
||||
cell = newRow.addNewTableCell();
|
||||
}
|
||||
|
||||
// 清空原有内容但保留样式
|
||||
cell.removeParagraph(0);
|
||||
XWPFParagraph para = cell.addParagraph();
|
||||
para.setAlignment(ParagraphAlignment.CENTER);
|
||||
|
||||
// 添加数据
|
||||
XWPFRun run = para.createRun();
|
||||
run.setText(rowData[i] != null ? rowData[i].toString() : "");
|
||||
run.setFontSize(10);
|
||||
run.setFontFamily("宋体");
|
||||
}
|
||||
}
|
||||
|
||||
// 深度复制样式(解决部分样式丢失问题)
|
||||
private static void deepCopyStyle(XWPFTableRow source, XWPFTableRow target) {
|
||||
CTRow ctSourceRow = source.getCtRow();
|
||||
CTRow ctTargetRow = target.getCtRow();
|
||||
|
||||
// 复制行属性
|
||||
if (ctSourceRow.getTrPr() != null) {
|
||||
ctTargetRow.setTrPr((CTTrPr) ctSourceRow.getTrPr().copy());
|
||||
}
|
||||
|
||||
// 复制单元格属性
|
||||
for (int i = 0; i < source.getTableCells().size(); i++) {
|
||||
CTTc sourceTc = source.getCell(i).getCTTc();
|
||||
CTTc targetTc = target.getCell(i).getCTTc();
|
||||
|
||||
// 复制单元格属性
|
||||
if (sourceTc.getTcPr() != null) {
|
||||
targetTc.setTcPr((CTTcPr) sourceTc.getTcPr().copy());
|
||||
}
|
||||
|
||||
// 复制段落样式
|
||||
if (!source.getCell(i).getParagraphs().isEmpty()) {
|
||||
XWPFParagraph sourcePara = source.getCell(i).getParagraphs().get(0);
|
||||
XWPFParagraph targetPara = target.getCell(i).getParagraphs().get(0);
|
||||
targetPara.getCTP().setPPr(sourcePara.getCTP().getPPr());
|
||||
}
|
||||
}
|
||||
}
|
||||
// 填充表头
|
||||
private static void fillTableHeader(XWPFTable table, String[] headers) {
|
||||
XWPFTableRow headerRow = table.getRow(0);
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
XWPFTableCell cell = headerRow.getCell(i);
|
||||
cell.removeParagraph(0);
|
||||
XWPFParagraph para = cell.addParagraph();
|
||||
para.setAlignment(ParagraphAlignment.CENTER);
|
||||
XWPFRun run = para.createRun();
|
||||
run.setText(headers[i]);
|
||||
run.setBold(true);
|
||||
|
||||
// 设置表头背景色
|
||||
CTShd shd = cell.getCTTc().addNewTcPr().addNewShd();
|
||||
shd.setFill("D3D3D3");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void setCellText(XWPFTableRow row, int col, String text) {
|
||||
XWPFTableCell cell = row.getCell(col);
|
||||
cell.removeParagraph(0);
|
||||
XWPFParagraph para = cell.addParagraph();
|
||||
para.setAlignment(ParagraphAlignment.CENTER);
|
||||
XWPFRun run = para.createRun();
|
||||
run.setText(text);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,347 +0,0 @@
|
|||
package com.microservices.dms.utils;
|
||||
|
||||
import org.apache.poi.xwpf.usermodel.*;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRow;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTrPr;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ExportWordUtilCopy extends Component {
|
||||
|
||||
public static void exportToWord(String outputPath,
|
||||
List<Object[]> dataRows) throws Exception {
|
||||
// 1. 从classpath加载模板文件
|
||||
ClassLoader classLoader = ExportWordUtilCopy.class.getClassLoader();
|
||||
try (InputStream is = classLoader.getResourceAsStream("template.docx");
|
||||
XWPFDocument document = is != null ? new XWPFDocument(is) : null) {
|
||||
|
||||
// 检查模板是否加载成功
|
||||
if (document == null) {
|
||||
throw new FileNotFoundException("模板文件未找到: template.docx");
|
||||
}
|
||||
|
||||
// 添加5.1.1项目标题
|
||||
addTitle(document, "5.1.1项目", 1);
|
||||
// 添加迭代标题
|
||||
addTitle(document, "5.1.1.1迭代", 2);
|
||||
// 添加描述段落
|
||||
addParagraph(document, "迭代测试项共包含" + dataRows.size() + "个测试用例,相关用例概述如表5-2所示。");
|
||||
// 设置表格标题
|
||||
setTableCaption(document, "表5-2 迭代功能测试用例概述表");
|
||||
|
||||
// 3. 添加表格(保留模板样式)
|
||||
if (!dataRows.isEmpty()) {
|
||||
// 获取模板中的表格(假设第一个表格是模板)
|
||||
XWPFTable table = document.getTables().isEmpty() ?
|
||||
document.createTable() : document.getTables().get(0);
|
||||
|
||||
// 清空模板中原有的示例数据行(保留表头和样式行)
|
||||
while (table.getNumberOfRows() > 1) {
|
||||
table.removeRow(1);
|
||||
}
|
||||
|
||||
// 获取样式模板行(通常是第一行)
|
||||
XWPFTableRow styleRow = table.getRow(0);
|
||||
|
||||
// 添加数据行(保留样式)
|
||||
for (Object[] rowData : dataRows) {
|
||||
addStyledTableRow(table, styleRow, rowData);
|
||||
}
|
||||
}
|
||||
//5.添加表尾
|
||||
addFooter(document);
|
||||
// 4. 保存文档
|
||||
saveDocument(document, outputPath);
|
||||
}
|
||||
System.out.println("导出完成: " + outputPath);
|
||||
}
|
||||
|
||||
// 设置表格标题
|
||||
private static void setTableCaption(XWPFDocument document, String caption) {
|
||||
XWPFParagraph paragraph = document.createParagraph();
|
||||
paragraph.setAlignment(ParagraphAlignment.CENTER);
|
||||
XWPFRun run = paragraph.createRun();
|
||||
run.setText(caption);
|
||||
run.setItalic(true);
|
||||
}
|
||||
|
||||
// 添加普通段落
|
||||
private static void addParagraph(XWPFDocument document, String text) {
|
||||
XWPFParagraph paragraph = document.createParagraph();
|
||||
XWPFRun run = paragraph.createRun();
|
||||
run.setText(text);
|
||||
}
|
||||
|
||||
// 添加带样式的表格行
|
||||
private static void addStyledTableRow(XWPFTable table,
|
||||
XWPFTableRow styleRow,
|
||||
Object[] rowData) {
|
||||
// 创建新行
|
||||
XWPFTableRow newRow = table.createRow();
|
||||
|
||||
// 复制样式行的格式
|
||||
if (styleRow != null) {
|
||||
deepCopyStyle(styleRow, newRow);
|
||||
}
|
||||
|
||||
// 填充数据
|
||||
for (int i = 0; i < rowData.length; i++) {
|
||||
XWPFTableCell cell = newRow.getCell(i);
|
||||
if (cell == null) {
|
||||
cell = newRow.addNewTableCell();
|
||||
}
|
||||
|
||||
// 清空原有内容但保留样式
|
||||
cell.removeParagraph(0);
|
||||
XWPFParagraph para = cell.addParagraph();
|
||||
para.setAlignment(ParagraphAlignment.CENTER);
|
||||
|
||||
// 添加数据
|
||||
XWPFRun run = para.createRun();
|
||||
run.setText(rowData[i] != null ? rowData[i].toString() : "");
|
||||
run.setFontSize(10);
|
||||
run.setFontFamily("宋体");
|
||||
}
|
||||
}
|
||||
|
||||
// 深度复制样式(解决部分样式丢失问题)
|
||||
private static void deepCopyStyle(XWPFTableRow source, XWPFTableRow target) {
|
||||
CTRow ctSourceRow = source.getCtRow();
|
||||
CTRow ctTargetRow = target.getCtRow();
|
||||
|
||||
// 复制行属性
|
||||
if (ctSourceRow.getTrPr() != null) {
|
||||
ctTargetRow.setTrPr((CTTrPr) ctSourceRow.getTrPr().copy());
|
||||
}
|
||||
|
||||
// 复制单元格属性
|
||||
for (int i = 0; i < source.getTableCells().size(); i++) {
|
||||
CTTc sourceTc = source.getCell(i).getCTTc();
|
||||
CTTc targetTc = target.getCell(i).getCTTc();
|
||||
|
||||
// 复制单元格属性
|
||||
if (sourceTc.getTcPr() != null) {
|
||||
targetTc.setTcPr((CTTcPr) sourceTc.getTcPr().copy());
|
||||
}
|
||||
|
||||
// 复制段落样式
|
||||
if (!source.getCell(i).getParagraphs().isEmpty()) {
|
||||
XWPFParagraph sourcePara = source.getCell(i).getParagraphs().get(0);
|
||||
XWPFParagraph targetPara = target.getCell(i).getParagraphs().get(0);
|
||||
targetPara.getCTP().setPPr(sourcePara.getCTP().getPPr());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addNoDataRow(XWPFTable table) {
|
||||
XWPFTableRow newRow = table.createRow();
|
||||
XWPFTableCell cell = newRow.getCell(0);
|
||||
if (cell == null) return;
|
||||
|
||||
cell.removeParagraph(0);
|
||||
XWPFParagraph para = cell.addParagraph();
|
||||
XWPFRun run = para.createRun();
|
||||
run.setText("查询结果为空");
|
||||
run.setBold(true);
|
||||
run.setColor("FF0000");
|
||||
}
|
||||
|
||||
// 复制行样式
|
||||
private static void copyRowStyle(XWPFTableRow source, XWPFTableRow target) {
|
||||
// 复制行属性
|
||||
if (source.getCtRow().getTrPr() != null) {
|
||||
target.getCtRow().setTrPr((CTTrPr) source.getCtRow().getTrPr().copy());
|
||||
}
|
||||
|
||||
// 复制单元格属性
|
||||
for (int i = 0; i < source.getTableCells().size(); i++) {
|
||||
XWPFTableCell sourceCell = source.getCell(i);
|
||||
XWPFTableCell targetCell = target.getCell(i);
|
||||
|
||||
if (sourceCell != null && targetCell != null) {
|
||||
// 复制单元格属性
|
||||
if (sourceCell.getCTTc().getTcPr() != null) {
|
||||
targetCell.getCTTc().setTcPr((CTTcPr) sourceCell.getCTTc().getTcPr().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void addDataRow(XWPFTable table, XWPFTableRow templateRow,
|
||||
Object[] rowData, int rowIndex) {
|
||||
XWPFTableRow newRow = table.createRow();
|
||||
|
||||
// 复制基础行样式
|
||||
if (templateRow.getCtRow().getTrPr() != null) {
|
||||
newRow.getCtRow().setTrPr(templateRow.getCtRow().getTrPr());
|
||||
}
|
||||
|
||||
// 确保单元格数量足够
|
||||
while (newRow.getTableCells().size() < rowData.length) {
|
||||
newRow.addNewTableCell();
|
||||
}
|
||||
|
||||
// 填充数据
|
||||
for (int i = 0; i < rowData.length; i++) {
|
||||
XWPFTableCell cell = newRow.getCell(i);
|
||||
if (cell == null) continue;
|
||||
|
||||
cell.removeParagraph(0);
|
||||
XWPFParagraph para = cell.addParagraph();
|
||||
para.setAlignment(ParagraphAlignment.CENTER);
|
||||
|
||||
XWPFRun run = para.createRun();
|
||||
run.setText(rowData[i] != null ? rowData[i].toString() : "NULL");
|
||||
run.setFontSize(10);
|
||||
// run.setFontFamily("宋体");
|
||||
// 特殊格式处理
|
||||
if (i == 0) {
|
||||
run.setBold(true); // 首列加粗
|
||||
}
|
||||
}
|
||||
// 进度提示
|
||||
if ((rowIndex + 1) % 100 == 0) {
|
||||
System.out.println("已处理 " + (rowIndex + 1) + " 行数据");
|
||||
}
|
||||
}
|
||||
|
||||
private static void saveDocument(XWPFDocument document,String outputPath) throws Exception {
|
||||
File outputFile = new File(outputPath);
|
||||
try (FileOutputStream out = new FileOutputStream(outputFile)) {
|
||||
document.write(out);
|
||||
System.out.println("文件保存成功: " + outputFile.getAbsolutePath());
|
||||
System.out.println("文件大小: " + outputFile.length() + " bytes");
|
||||
}
|
||||
}
|
||||
private static void addDataTable(XWPFDocument document,
|
||||
List<Object[]> dataRows) {
|
||||
// 获取模板中的表格(假设第一个表格是模板)
|
||||
XWPFTable table = document.getTables().isEmpty() ?
|
||||
document.createTable() : document.getTables().get(0);
|
||||
|
||||
// 清空模板中原有的示例数据行(保留表头和样式行)
|
||||
while (table.getNumberOfRows() > 1) {
|
||||
table.removeRow(1);
|
||||
}
|
||||
|
||||
// 3. 获取模板行(第一行)
|
||||
XWPFTableRow templateRow = table.getRow(0);
|
||||
if (templateRow == null) {
|
||||
throw new RuntimeException("模板行获取失败");
|
||||
}
|
||||
// 4. 处理数据
|
||||
System.out.println("待处理数据行数: " + dataRows.size());
|
||||
if (dataRows.isEmpty()) {
|
||||
System.out.println("警告: 无数据,添加提示行");
|
||||
addNoDataRow(table);
|
||||
} else {
|
||||
for (int i = 0; i < dataRows.size(); i++) {
|
||||
addDataRow(table, templateRow, dataRows.get(i), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 添加标题
|
||||
private static void addTitle(XWPFDocument document, String text, int level) {
|
||||
XWPFParagraph paragraph = document.createParagraph();
|
||||
paragraph.setStyle("Heading" + level);
|
||||
XWPFRun run = paragraph.createRun();
|
||||
run.setText(text);
|
||||
run.setBold(true);
|
||||
run.setFontSize(20 - level * 2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 模拟数据库数据
|
||||
public static List<Object[]> mockData() {
|
||||
List<Object[]> data = new ArrayList<>();
|
||||
data.add(new Object[]{1, "GN_RJGC_XM_DD_XJDDGLQX", "新建迭代关联缺陷", "关联缺陷","正常"});
|
||||
data.add(new Object[]{2, "GN_RJGC_XM_DD_XJDDGLRW", "新建迭代关联任务", "关联任务","正常"});
|
||||
data.add(new Object[]{3, "GN_RJGC_XM_DD_XJDDGLXQ", "新建迭代关联需求", "关联需求","正常"});
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
private File getExportDirectory(String locationType) {
|
||||
String userHome = System.getProperty("user.home");
|
||||
File exportDir;
|
||||
|
||||
switch (locationType) {
|
||||
case "用户文档目录":
|
||||
exportDir = new File(userHome, "Documents");
|
||||
break;
|
||||
case "桌面":
|
||||
exportDir = new File(userHome, "Desktop");
|
||||
break;
|
||||
case "临时目录":
|
||||
exportDir = new File(System.getProperty("java.io.tmpdir"));
|
||||
break;
|
||||
case "自定义路径":
|
||||
default:
|
||||
JFileChooser chooser = new JFileChooser();
|
||||
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
int result = chooser.showSaveDialog(this);
|
||||
if (result == JFileChooser.APPROVE_OPTION) {
|
||||
exportDir = chooser.getSelectedFile();
|
||||
} else {
|
||||
exportDir = new File(userHome);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// 确保目录存在
|
||||
if (!exportDir.exists()) {
|
||||
exportDir.mkdirs();
|
||||
}
|
||||
|
||||
return exportDir;
|
||||
}
|
||||
|
||||
private File getUniqueFile(File file) {
|
||||
if (!file.exists()) {
|
||||
return file;
|
||||
}
|
||||
|
||||
String name = file.getName();
|
||||
String baseName = name.substring(0, name.lastIndexOf('.'));
|
||||
String extension = name.substring(name.lastIndexOf('.'));
|
||||
|
||||
int counter = 1;
|
||||
File newFile;
|
||||
do {
|
||||
newFile = new File(file.getParentFile(), baseName + "(" + counter + ")" + extension);
|
||||
counter++;
|
||||
} while (newFile.exists());
|
||||
|
||||
return newFile;
|
||||
}
|
||||
|
||||
|
||||
private static void addFooter(XWPFDocument document) {
|
||||
// 添加空行
|
||||
document.createParagraph();
|
||||
|
||||
// 创建页脚段落
|
||||
XWPFParagraph footerPara = document.createParagraph();
|
||||
footerPara.setAlignment(ParagraphAlignment.CENTER);
|
||||
|
||||
XWPFRun footerRun = footerPara.createRun();
|
||||
footerRun.setText("© 2023 数据导出系统 | 自动生成报告");
|
||||
footerRun.setFontSize(9);
|
||||
footerRun.setFontFamily("宋体");
|
||||
footerRun.setColor("7F7F7F");
|
||||
footerRun.setItalic(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue