MCPcopy Create free account
hub / github.com/diyhi/bbs / getHelp

Method getHelp

src/main/java/cms/service/help/impl/HelpServiceImpl.java:64–105  ·  view source on GitHub ↗

获取帮助 @param helpId 帮助Id @param host 域名 @param serverAddressList 文件服务器地址集合 @return

(Long helpId, String host,List<String> serverAddressList)

Source from the content-addressed store, hash-verified

62 * @return
63 */
64 public Help getHelp(Long helpId, String host,List<String> serverAddressList){
65 if (helpId == null || helpId < 0L) {
66 throw new BusinessException(Map.of("helpId", "帮助Id不存在"));
67 }
68 Help help = helpRepository.findById(helpId);
69 if(help == null){
70 throw new BusinessException(Map.of("helpId", "帮助不存在"));
71 }
72 HelpType helpType = helpTypeRepository.findById(help.getHelpTypeId());
73 if(helpType != null){
74 help.setHelpTypeName(helpType.getName());
75 }
76 SystemSetting systemSetting = settingRepository.findSystemSetting_cache();
77
78 //处理富文本路径
79 help.setContent(fileComponent.processRichTextFilePath(help.getContent(),"help"));
80
81 if(help.getContent() != null && !help.getContent().trim().isEmpty() && systemSetting.getFileSecureLinkSecret() != null && !systemSetting.getFileSecureLinkSecret().trim().isEmpty()){
82
83 //解析上传的文件完整路径名称
84 Map<String,String> analysisFullFileNameMap = textFilterComponent.analysisFullFileName(help.getContent(),"help",serverAddressList);
85 if(analysisFullFileNameMap != null && analysisFullFileNameMap.size() >0){
86
87
88 Map<String,String> newFullFileNameMap = new HashMap<String,String>();//新的完整路径名称 key: 完整路径名称 value: 重定向接口
89 for (Map.Entry<String,String> entry : analysisFullFileNameMap.entrySet()) {
90
91 newFullFileNameMap.put(entry.getKey(), host+ SecureLink.createDownloadRedirectLink(entry.getKey(),entry.getValue(),-1L,systemSetting.getFileSecureLinkSecret()));
92 }
93
94 help.setContent(textFilterComponent.processFullFileName(help.getContent(),"help",newFullFileNameMap,serverAddressList));
95
96 }
97 }
98
99 if(help.getContent() != null && !help.getContent().trim().isEmpty()){
100 //处理视频播放器标签
101 String content = textFilterComponent.processVideoPlayer(host,help.getContent(),-1L,systemSetting.getFileSecureLinkSecret());
102 help.setContent(content);
103 }
104 return help;
105 }
106
107 /**
108 * 获取帮助列表

Callers

nothing calls this directly

Calls 12

analysisFullFileNameMethod · 0.80
putMethod · 0.80
getKeyMethod · 0.80
processFullFileNameMethod · 0.80
processVideoPlayerMethod · 0.80
findByIdMethod · 0.65
getNameMethod · 0.45
isEmptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected