This commit is contained in:
wucongxing8150 2025-06-10 09:59:11 +08:00
parent f09faeef6b
commit 6c4d7a90f8
10 changed files with 45 additions and 4 deletions

View File

@ -21,6 +21,7 @@ import com.example.caseData.request.caseExchangeRequest.getUserCaseExchangeComme
import com.example.caseData.request.clinicalRequest.getClinicalArticleSearchPage;
import com.example.caseData.service.CaseClinicalArticleService;
import com.example.caseData.utils.IntToString;
import com.example.caseData.utils.Replace;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.validation.annotation.Validated;
@ -317,6 +318,9 @@ public class CaseClinicalArticleController {
// 去除用户唯一标识
dto.setUserIden(null);
// 图片
dto.setCommentImage(Replace.addOssDomain(dto.getCommentImage()));
// 获取次级评论
if (request.getIsHaveSubComment() == 1){
if (dto.getRootId() == null){

View File

@ -18,6 +18,7 @@ import com.example.caseData.request.CaseClinicalVideoRequest.addClinicalVideoCom
import com.example.caseData.request.CaseClinicalVideoRequest.getClinicalVideoCommentPage;
import com.example.caseData.service.CaseClinicalVideoService;
import com.example.caseData.service.CaseClinicalVideoService;
import com.example.caseData.utils.Replace;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.validation.annotation.Validated;
@ -313,6 +314,9 @@ public class CaseClinicalVideoController {
// 去除用户唯一标识
dto.setUserIden(null);
// 图片
dto.setCommentImage(Replace.addOssDomain(dto.getCommentImage()));
// 获取次级评论
if (request.getIsHaveSubComment() == 1){
if (dto.getRootId() == null){

View File

@ -582,6 +582,9 @@ public class CaseExchangeController {
// 去除用户唯一标识
dto.setUserIden(null);
// 图片
dto.setCommentImage(Replace.addOssDomain(dto.getCommentImage()));
// 获取次级评论
if (request.getIsHaveSubComment() == 1){
if (dto.getRootId() == null){

View File

@ -75,6 +75,12 @@ public class UserCommentClinicalArticleDto {
@JsonProperty("content_word")
private String contentWord;
/**
* 评论图片
*/
@JsonProperty("comment_image")
private String commentImage;
/**
* 创建时间
*/

View File

@ -76,6 +76,12 @@ public class UserCommentClinicalVideoDto {
@JsonProperty("content_word")
private String contentWord;
/**
* 评论图片
*/
@JsonProperty("comment_image")
private String commentImage;
/**
* 创建时间
*/

View File

@ -179,7 +179,7 @@ public class CaseClinicalArticleService {
userCommentClinicalArticleData.setStatus(1);
userCommentClinicalArticleData.setIsSensitive(0);
userCommentClinicalArticleData.setContent(request.getContent());
userCommentClinicalArticleData.setCommentImage(Replace.addOssDomain(request.getCommentImage()));
userCommentClinicalArticleData.setCommentImage(Replace.removeOssDomain(request.getCommentImage()));
// 评论根id
if (request.getRootId() != null) {

View File

@ -173,7 +173,7 @@ public class CaseClinicalVideoService {
userCommentClinicalVideoData.setStatus(1);
userCommentClinicalVideoData.setIsSensitive(0);
userCommentClinicalVideoData.setContent(request.getContent());
userCommentClinicalVideoData.setCommentImage(Replace.addOssDomain(request.getCommentImage()));
userCommentClinicalVideoData.setCommentImage(Replace.removeOssDomain(request.getCommentImage()));
// 评论根id
if (request.getRootId() != null) {

View File

@ -279,7 +279,7 @@ public class CaseExchangeService {
userCommentExchangeData.setStatus(1);
userCommentExchangeData.setIsSensitive(0);
userCommentExchangeData.setContent(request.getContent());
userCommentExchangeData.setCommentImage(Replace.addOssDomain(request.getCommentImage()));
userCommentExchangeData.setCommentImage(Replace.removeOssDomain(request.getCommentImage()));
// 评论根id
if (request.getRootId() != null) {

View File

@ -27,4 +27,22 @@ public class Replace {
}
return ossConfig.getCustomDomainName() + url;
}
/**
* 去除OSS地址中的域名前缀
* @param url 可能包含域名的完整URL
* @return 去除了域名后的相对路径如果未匹配则返回原字符串
*/
public static String removeOssDomain(String url) {
if (url == null || url.isEmpty()) {
return "";
}
String customDomain = ossConfig.getCustomDomainName();
if (customDomain != null && url.startsWith(customDomain)) {
return url.substring(customDomain.length());
}
return url;
}
}

View File

@ -31,7 +31,7 @@
LEFT JOIN basic_hospital b ON a.hospital_id = b.hospital_id
WHERE b.source = 2
<if test="hospital_name != null and hospital_name != ''">
AND b.hospital_name LIKE CONCAT('%', #{hospitalName}, '%')
AND b.hospital_name LIKE CONCAT('%', #{hospital_name}, '%')
</if>
<if test="order != null and !order.isEmpty()">
ORDER BY