Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
enterprise-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
enterprise-platform
Commits
ee8846ec
Commit
ee8846ec
authored
Dec 09, 2024
by
廖旭伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
公司,产品富文本添加domain链接
parent
8edc7208
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
1 deletion
+34
-1
enterprise-manager/src/main/java/com/mortals/xhx/module/company/service/impl/CompanyServiceImpl.java
...s/xhx/module/company/service/impl/CompanyServiceImpl.java
+15
-0
enterprise-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductServiceImpl.java
...s/xhx/module/product/service/impl/ProductServiceImpl.java
+19
-1
No files found.
enterprise-manager/src/main/java/com/mortals/xhx/module/company/service/impl/CompanyServiceImpl.java
View file @
ee8846ec
...
...
@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
import
cn.hutool.core.util.StrUtil
;
import
com.mortals.framework.common.Rest
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.xhx.base.system.user.model.UserQuery
;
import
com.mortals.xhx.base.system.user.service.UserService
;
import
com.mortals.xhx.common.code.SourceEnum
;
...
...
@@ -32,6 +33,7 @@ import com.mortals.xhx.module.staff.model.StaffRecordEntity;
import
com.mortals.xhx.module.staff.model.StaffRecordQuery
;
import
com.mortals.xhx.module.staff.service.StaffRecordService
;
import
com.mortals.xhx.module.staff.service.StaffService
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.service.impl.AbstractCRUDServiceImpl
;
import
com.mortals.framework.exception.AppException
;
...
...
@@ -86,6 +88,9 @@ public class CompanyServiceImpl extends AbstractCRUDServiceImpl<CompanyDao, Comp
@Autowired
private
LabelsService
labelsService
;
@Value
(
"${domain.name:https://oa.xinhx.co}"
)
private
String
domain
;
@Override
protected
void
findAfter
(
CompanyEntity
params
,
PageInfo
pageInfo
,
Context
context
,
List
<
CompanyEntity
>
list
)
throws
AppException
{
fillSubData
(
list
);
...
...
@@ -98,6 +103,13 @@ public class CompanyServiceImpl extends AbstractCRUDServiceImpl<CompanyDao, Comp
}
private
void
fillSubData
(
List
<
CompanyEntity
>
list
)
{
String
regex
=
"src=\"file"
;
String
replacement
;
if
(
domain
.
endsWith
(
"/"
)){
replacement
=
"src=\""
+
domain
+
"file"
;
}
else
{
replacement
=
"src=\""
+
domain
+
"/file"
;
}
List
<
Long
>
idList
=
list
.
stream
().
map
(
i
->
i
.
getId
()).
collect
(
Collectors
.
toList
());
if
(
ObjectUtils
.
isEmpty
(
idList
))
return
;
Map
<
Long
,
List
<
CompanyLabelsEntity
>>
companyLabelsListMap
=
companyLabelsService
...
...
@@ -110,6 +122,9 @@ public class CompanyServiceImpl extends AbstractCRUDServiceImpl<CompanyDao, Comp
list
.
forEach
(
item
->
{
item
.
setCompanyLabelsList
(
companyLabelsListMap
.
get
(
item
.
getId
()));
item
.
setCompanyPatentsList
(
companyPatentListMap
.
get
(
item
.
getId
()));
if
(
StringUtils
.
isNotEmpty
(
item
.
getCompanyIntroduction
()))
{
item
.
setCompanyIntroduction
(
item
.
getCompanyIntroduction
().
replaceAll
(
regex
,
replacement
));
}
});
}
...
...
enterprise-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductServiceImpl.java
View file @
ee8846ec
...
...
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl
;
import
com.mortals.framework.util.StringUtils
;
import
com.mortals.xhx.module.category.model.CategoryEntity
;
import
com.mortals.xhx.module.category.service.CategoryService
;
import
com.mortals.xhx.module.company.model.CompanyEntity
;
...
...
@@ -13,6 +14,8 @@ import com.mortals.xhx.module.company.service.CompanyProductService;
import
com.mortals.xhx.module.company.service.CompanyService
;
import
com.mortals.xhx.module.product.model.*
;
import
com.mortals.xhx.module.product.service.ProductCategoryService
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
...
...
@@ -50,6 +53,8 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
@Autowired
private
CompanyService
companyService
;
@Value
(
"${domain.name:https://oa.xinhx.co}"
)
private
String
domain
;
@Override
public
Result
<
ProductEntity
>
find
(
ProductEntity
entity
,
PageInfo
pageInfo
,
Context
context
)
throws
AppException
{
...
...
@@ -104,7 +109,20 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
productEntityResult
.
setDict
(
companyProductEntityResult
.
getDict
());
}
}
if
(
CollectionUtils
.
isNotEmpty
(
productEntityResult
.
getList
())){
String
regex
=
"src=\"file"
;
String
replacement
;
if
(
domain
.
endsWith
(
"/"
)){
replacement
=
"src=\""
+
domain
+
"file"
;
}
else
{
replacement
=
"src=\""
+
domain
+
"/file"
;
}
productEntityResult
.
getList
().
forEach
(
item
->
{
if
(
StringUtils
.
isNotEmpty
(
item
.
getProductDetail
()))
{
item
.
setProductDetail
(
item
.
getProductDetail
().
replaceAll
(
regex
,
replacement
));
}
});
}
return
productEntityResult
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment