Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
0ef4f21a
Commit
0ef4f21a
authored
Sep 06, 2019
by
libin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
客服功能
parent
25becb30
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
CustomerServiceBiz.java
...ain/java/com/xxfc/platform/im/biz/CustomerServiceBiz.java
+14
-3
CustomerServiceRepository.java
...com/xxfc/platform/im/repos/CustomerServiceRepository.java
+7
-2
No files found.
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/biz/CustomerServiceBiz.java
View file @
0ef4f21a
...
...
@@ -15,6 +15,8 @@ import lombok.RequiredArgsConstructor;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Example
;
import
org.springframework.data.domain.ExampleMatcher
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
...
...
@@ -88,10 +90,19 @@ public class CustomerServiceBiz {
customerServiceRepository
.
save
(
customerService
);
}
/**
* 1: mongoTemplate.find(Query.query(Criteria.where("isDel").is(false)), CustomerService.class);
*
* 2. customerServiceRepository.findByIsDelEquals(false);
* @return
*/
public
List
<
CustomerServiceVO
>
findAll
()
{
List
<
CustomerServiceVO
>
customerServiceVOS
=
new
ArrayList
<>();
// List<CustomerService> customerServices = mongoTemplate.find(Query.query(Criteria.where("isDel").is(false)), CustomerService.class);
List
<
CustomerService
>
customerServices
=
customerServiceRepository
.
findByIsDelEquals
(
false
);
CustomerService
customer_service
=
new
CustomerService
();
Example
<
CustomerService
>
customerServiceExample
=
Example
.
of
(
customer_service
,
ExampleMatcher
.
matchingAll
());
List
<
CustomerService
>
customerServices
=
customerServiceRepository
.
findAll
(
customerServiceExample
);
CustomerServiceVO
customerServiceVO
;
if
(
CollectionUtils
.
isNotEmpty
(
customerServices
)){
List
<
Integer
>
imUserIds
=
customerServices
.
stream
().
map
(
CustomerService:
:
getImUserId
).
collect
(
Collectors
.
toList
());
...
...
@@ -117,7 +128,7 @@ public class CustomerServiceBiz {
public
void
updateCustomerServiceIsDelToTrue
(
String
id
,
Integer
imUserId
){
Query
query
=
query
(
Criteria
.
where
(
"_id"
).
is
(
id
));
Update
update
=
update
(
"is_del"
,
true
).
set
(
"update_time"
,
Instant
.
now
().
toEpochMilli
());
UpdateResult
customer_service
=
mongoTemplate
.
updateFirst
(
query
,
update
,
Map
.
class
,
"customer_service"
);
mongoTemplate
.
updateFirst
(
query
,
update
,
Map
.
class
,
"customer_service"
);
userBiz
.
deleteById
(
imUserId
);
}
}
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/repos/CustomerServiceRepository.java
View file @
0ef4f21a
...
...
@@ -2,6 +2,8 @@ package com.xxfc.platform.im.repos;
import
com.xxfc.platform.im.model.CustomerService
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
import
org.springframework.data.mongodb.repository.Query
;
import
org.springframework.data.repository.query.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
...
...
@@ -17,10 +19,13 @@ public interface CustomerServiceRepository extends MongoRepository<CustomerServi
/**
* 查询客服
* @param isDel 删除状态
*
* @param isDel 删除状态
* @return
*/
List
<
CustomerService
>
findByIsDelEquals
(
Boolean
isDel
);
List
<
CustomerService
>
findByIsDel
(
Boolean
isDel
);
// @Query(value = "{'is_del':?0}",fields ="{'telphone':1}",sort = "{'create_time':-1}")
@Query
(
value
=
"{'is_del':?#{[0]}}"
,
fields
=
"{'name':1}"
,
sort
=
"{'create_time':-1}"
)
List
<
CustomerService
>
findByIsDelState
(
Boolean
isDel
);
}
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