parent
c8f45f2d91
commit
33d7bb3342
File diff suppressed because one or more lines are too long
@ -0,0 +1,24 @@
|
|||||||
|
// 声明类所在的包
|
||||||
|
package com.farm.wcp.util;
|
||||||
|
|
||||||
|
// 导入用于获取系统参数的服务类
|
||||||
|
import com.farm.parameter.FarmParameterService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 该类提供了与主题路径相关的工具方法。
|
||||||
|
*/
|
||||||
|
public class ThemesUtil {
|
||||||
|
/**
|
||||||
|
* 获取系统配置的主题路径。
|
||||||
|
*
|
||||||
|
* 此方法通过调用 FarmParameterService 类的实例来获取名为 "config.sys.web.themes.path" 的系统参数值。
|
||||||
|
* 该参数值代表了系统中配置的主题路径。
|
||||||
|
*
|
||||||
|
* @return 系统配置的主题路径字符串。
|
||||||
|
*/
|
||||||
|
public static String getThemePath() {
|
||||||
|
// 通过单例模式获取 FarmParameterService 实例,并调用其 getParameter 方法获取指定参数的值
|
||||||
|
return FarmParameterService.getInstance().getParameter("config.sys.web.themes.path");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,184 @@
|
|||||||
|
package com.farm.web.rmi.impl;
|
||||||
|
|
||||||
|
// 导入远程异常类,用于处理 RMI 调用过程中可能出现的异常
|
||||||
|
import java.rmi.RemoteException;
|
||||||
|
// 导入单播远程对象类,是实现 RMI 服务的基础类
|
||||||
|
import java.rmi.server.UnicastRemoteObject;
|
||||||
|
// 导入 HashMap 类,用于存储键值对数据
|
||||||
|
import java.util.HashMap;
|
||||||
|
// 导入 List 接口,用于存储一组对象
|
||||||
|
import java.util.List;
|
||||||
|
// 导入 Map 接口,用于存储键值对映射
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
// 导入农场权限服务类
|
||||||
|
import com.farm.authority.FarmAuthorityService;
|
||||||
|
// 导入登录用户实体类
|
||||||
|
import com.farm.core.auth.domain.LoginUser;
|
||||||
|
// 导入数据结果类,用于封装查询结果
|
||||||
|
import com.farm.core.sql.result.DataResult;
|
||||||
|
// 导入文档完整信息实体类
|
||||||
|
import com.farm.doc.domain.ex.DocEntire;
|
||||||
|
// 导入文档类型简要信息实体类
|
||||||
|
import com.farm.doc.domain.ex.TypeBrief;
|
||||||
|
// 导入农场文档管理接口
|
||||||
|
import com.farm.doc.server.FarmDocManagerInter;
|
||||||
|
// 导入农场文档操作权限接口及权限类型枚举
|
||||||
|
import com.farm.doc.server.FarmDocOperateRightInter.POP_TYPE;
|
||||||
|
// 导入农场文档类型管理接口
|
||||||
|
import com.farm.doc.server.FarmDocTypeInter;
|
||||||
|
// 导入农场文件索引管理接口
|
||||||
|
import com.farm.doc.server.FarmFileIndexManagerInter;
|
||||||
|
// 导入农场文件管理接口
|
||||||
|
import com.farm.doc.server.FarmFileManagerInter;
|
||||||
|
// 导入 Spring 工具类,用于获取 Spring 容器中的 Bean
|
||||||
|
import com.farm.util.spring.BeanFactory;
|
||||||
|
// 导入 Wcp 应用接口
|
||||||
|
import com.farm.wcp.api.WcpAppInter;
|
||||||
|
// 导入文档创建错误异常类
|
||||||
|
import com.farm.wcp.api.exception.DocCreatErrorExcepiton;
|
||||||
|
// 导入结果实体类
|
||||||
|
import com.farm.wcp.domain.Results;
|
||||||
|
// 导入知识服务接口
|
||||||
|
import com.farm.wcp.know.service.KnowServiceInter;
|
||||||
|
|
||||||
|
// 定义 WcpAppImpl 类,继承 UnicastRemoteObject 并实现 WcpAppInter 接口
|
||||||
|
public class WcpAppImpl extends UnicastRemoteObject implements WcpAppInter {
|
||||||
|
// 构造函数,抛出 RemoteException 异常
|
||||||
|
public WcpAppImpl() throws RemoteException {
|
||||||
|
// 调用父类的构造函数
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 定义农场文件索引管理实现类对象,通过 Spring 工厂获取 Bean
|
||||||
|
private FarmFileIndexManagerInter farmFileIndexManagerImpl = (FarmFileIndexManagerInter) BeanFactory
|
||||||
|
.getBean("farmFileIndexManagerImpl");
|
||||||
|
|
||||||
|
// 定义农场文件管理实现类对象,通过 Spring 工厂获取 Bean
|
||||||
|
private FarmFileManagerInter farmFileManagerImpl = (FarmFileManagerInter) BeanFactory
|
||||||
|
.getBean("farmFileManagerImpl");
|
||||||
|
|
||||||
|
// 定义农场文档管理实现类对象,通过 Spring 工厂获取 Bean
|
||||||
|
private FarmDocManagerInter farmDocManagerImpl = (FarmDocManagerInter) BeanFactory.getBean("farmDocManagerImpl");
|
||||||
|
// 定义知识服务实现类对象,通过 Spring 工厂获取 Bean
|
||||||
|
private KnowServiceInter KnowServiceImpl = (KnowServiceInter) BeanFactory.getBean("knowServiceImpl");
|
||||||
|
|
||||||
|
// 定义农场文档类型管理实现类对象,通过 Spring 工厂获取 Bean
|
||||||
|
private FarmDocTypeInter farmDocTypeManagerImpl = (FarmDocTypeInter) BeanFactory.getBean("farmDocTypeManagerImpl");
|
||||||
|
|
||||||
|
// 定义序列化版本号
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建 HTML 知识文档
|
||||||
|
* @param knowtitle 知识文档标题
|
||||||
|
* @param knowtypeId 知识文档类型 ID
|
||||||
|
* @param text 知识文档内容
|
||||||
|
* @param knowtag 知识文档标签
|
||||||
|
* @param currentUserId 当前用户 ID
|
||||||
|
* @return 新创建文档的 ID
|
||||||
|
* @throws RemoteException 远程调用异常
|
||||||
|
* @throws DocCreatErrorExcepiton 文档创建错误异常
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String creatHTMLKnow(String knowtitle, String knowtypeId, String text, String knowtag, String currentUserId)
|
||||||
|
throws RemoteException, DocCreatErrorExcepiton {
|
||||||
|
// 定义文档完整信息对象
|
||||||
|
DocEntire doc = null;
|
||||||
|
try {
|
||||||
|
// 调用知识服务的创建知识方法
|
||||||
|
doc = KnowServiceImpl.creatKnow(knowtitle, knowtypeId, text, knowtag, POP_TYPE.PUB, POP_TYPE.PUB, null,
|
||||||
|
null);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 捕获异常并抛出文档创建错误异常
|
||||||
|
throw new DocCreatErrorExcepiton(e);
|
||||||
|
}
|
||||||
|
// 返回新创建文档的 ID
|
||||||
|
return doc.getDoc().getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定类型的文档列表
|
||||||
|
* @param typeid 文档类型 ID
|
||||||
|
* @param pagesize 每页显示的文档数量
|
||||||
|
* @param currentpage 当前页码
|
||||||
|
* @param loginname 登录用户名
|
||||||
|
* @return 包含文档列表的结果对象
|
||||||
|
* @throws RemoteException 远程调用异常
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Results getTypeDocs(String typeid, int pagesize, int currentpage, String loginname) throws RemoteException {
|
||||||
|
// 根据登录名获取登录用户对象
|
||||||
|
LoginUser user = FarmAuthorityService.getInstance().getUserByLoginName(loginname);
|
||||||
|
// 调用文档类型管理接口的方法获取指定类型的文档数据结果
|
||||||
|
DataResult docs = farmDocTypeManagerImpl.getTypeDocs(user, typeid, pagesize, currentpage);
|
||||||
|
// 创建结果对象
|
||||||
|
Results result = new Results();
|
||||||
|
// 设置结果对象的文档列表
|
||||||
|
result.setList(docs.getResultList());
|
||||||
|
// 设置结果对象的当前页码
|
||||||
|
result.setCurrentpage(currentpage);
|
||||||
|
// 设置结果对象的每页显示数量
|
||||||
|
result.setPagesize(pagesize);
|
||||||
|
// 设置结果对象的总记录数
|
||||||
|
result.setTotalsize(docs.getTotalSize());
|
||||||
|
// 返回结果对象
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有文档类型信息
|
||||||
|
* @param loginname 登录用户名
|
||||||
|
* @return 包含文档类型信息的结果对象
|
||||||
|
* @throws RemoteException 远程调用异常
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Results getAllTypes(String loginname) throws RemoteException {
|
||||||
|
// 根据登录名获取登录用户对象
|
||||||
|
LoginUser user = FarmAuthorityService.getInstance().getUserByLoginName(loginname);
|
||||||
|
// 调用文档类型管理接口的方法获取可供阅读文档的公开类型列表
|
||||||
|
List<TypeBrief> types = farmDocTypeManagerImpl.getPopTypesForReadDoc(user);
|
||||||
|
// 创建结果对象
|
||||||
|
Results result = new Results();
|
||||||
|
// 遍历文档类型列表
|
||||||
|
for (TypeBrief node : types) {
|
||||||
|
// 创建一个 HashMap 用于存储文档类型信息
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
// 存储文档类型名称
|
||||||
|
map.put("NAME", node.getName());
|
||||||
|
// 存储文档类型 ID
|
||||||
|
map.put("ID", node.getId());
|
||||||
|
// 存储文档类型父 ID
|
||||||
|
map.put("PARENTID", node.getParentid());
|
||||||
|
// 存储文档类型相关数量
|
||||||
|
map.put("NUM", node.getNum());
|
||||||
|
// 存储文档类型
|
||||||
|
map.put("TYPE", node.getType());
|
||||||
|
// 将文档类型信息添加到结果对象的列表中
|
||||||
|
result.getList().add(map);
|
||||||
|
}
|
||||||
|
// 设置结果对象的当前页码为 0
|
||||||
|
result.setCurrentpage(0);
|
||||||
|
// 设置结果对象的每页显示数量为 1
|
||||||
|
result.setPagesize(1);
|
||||||
|
// 设置结果对象的总记录数为文档类型列表的大小
|
||||||
|
result.setTotalsize(types.size());
|
||||||
|
// 返回结果对象
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运行 Lucene 索引
|
||||||
|
* @param fileid 文件 ID
|
||||||
|
* @param docid 文档 ID
|
||||||
|
* @param text 文本内容
|
||||||
|
* @throws RemoteException 远程调用异常
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
|
public void runLuceneIndex(String fileid, String docid, String text) throws RemoteException {
|
||||||
|
// 调用文件索引管理接口的方法添加文件的 Lucene 索引
|
||||||
|
farmFileIndexManagerImpl.addFileLuceneIndex(fileid, farmDocManagerImpl.getDoc(docid), text);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue