Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
邬吉朋
relation
Commits
75c9f5e7
Commit
75c9f5e7
authored
Aug 06, 2025
by
zhuxiang
Browse files
信息查询接口优化
parent
5b9c00a9
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/platform/mapper/UserMapper.java
View file @
75c9f5e7
...
@@ -2,8 +2,14 @@ package com.platform.mapper;
...
@@ -2,8 +2,14 @@ package com.platform.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.platform.model.entity.UserEntity
;
import
com.platform.model.entity.UserEntity
;
import
com.platform.model.vo.ExcelDataVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
@Mapper
@Mapper
public
interface
UserMapper
extends
BaseMapper
<
UserEntity
>
{
public
interface
UserMapper
extends
BaseMapper
<
UserEntity
>
{
List
<
ExcelDataVO
>
queryUserLabel
(
@Param
(
"userNameList"
)
List
<
String
>
userNameList
,
@Param
(
"caseId"
)
Integer
id
);
}
}
src/main/java/com/platform/service/UserService.java
View file @
75c9f5e7
...
@@ -6,6 +6,7 @@ import com.platform.model.entity.ExcelDataEntity;
...
@@ -6,6 +6,7 @@ import com.platform.model.entity.ExcelDataEntity;
import
com.platform.model.entity.UserEntity
;
import
com.platform.model.entity.UserEntity
;
import
com.platform.model.entity.UserRelationEntity
;
import
com.platform.model.entity.UserRelationEntity
;
import
com.platform.model.vo.EveryoneVO
;
import
com.platform.model.vo.EveryoneVO
;
import
com.platform.model.vo.ExcelDataVO
;
import
com.platform.model.vo.UserVO
;
import
com.platform.model.vo.UserVO
;
import
java.util.List
;
import
java.util.List
;
...
@@ -37,4 +38,6 @@ public interface UserService extends IService<UserEntity> {
...
@@ -37,4 +38,6 @@ public interface UserService extends IService<UserEntity> {
List
<
String
>
queryListByCaseId
(
Integer
id
);
List
<
String
>
queryListByCaseId
(
Integer
id
);
Boolean
relationSaveOrUpdate
(
List
<
UserRelationEntity
>
userRelationList
);
Boolean
relationSaveOrUpdate
(
List
<
UserRelationEntity
>
userRelationList
);
List
<
ExcelDataVO
>
queryUserLabel
(
List
<
String
>
userNameList
,
Integer
id
);
}
}
src/main/java/com/platform/service/impl/CaseServiceImpl.java
View file @
75c9f5e7
...
@@ -16,7 +16,6 @@ import org.springframework.util.ObjectUtils;
...
@@ -16,7 +16,6 @@ import org.springframework.util.ObjectUtils;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
@Service
public
class
CaseServiceImpl
extends
ServiceImpl
<
CaseMapper
,
CasesEntity
>
implements
CasesService
{
public
class
CaseServiceImpl
extends
ServiceImpl
<
CaseMapper
,
CasesEntity
>
implements
CasesService
{
...
@@ -437,25 +436,25 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
...
@@ -437,25 +436,25 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
}
}
//查看每个人的账号类型
//查看每个人的账号类型
List
<
String
>
userNameList
=
new
ArrayList
<>(
uniqueNodes
);
List
<
String
>
userNameList
=
new
ArrayList
<>(
uniqueNodes
);
List
<
ExcelDataVO
>
excelDataEntityListNew
=
excelDataService
.
queryListByPayUserList
(
userNameList
,
caseDTO
.
getId
());
//查看每个人的账号标签
//根据用户名分组
List
<
ExcelDataVO
>
excelDataEntityListNew
=
userService
.
queryUserLabel
(
userNameList
,
caseDTO
.
getId
());
List
<
ExcelDataVO
>
groupedObjects
=
excelDataEntityListNew
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
ExcelDataVO:
:
getPayUserName
))
for
(
ExcelDataVO
dataVO
:
excelDataEntityListNew
)
{
.
values
().
stream
()
for
(
Map
.
Entry
<
String
,
Integer
>
entry
:
nodeDegreeMap
.
entrySet
())
{
.
map
(
list
->
list
.
get
(
0
))
// 保留每组的第一个对象
String
key
=
entry
.
getKey
();
.
collect
(
Collectors
.
toList
());
Integer
value
=
entry
.
getValue
();
if
(
dataVO
.
getPayUserName
().
equals
(
key
))
{
groupedObjects
.
forEach
(
excelDataVO
->
{
if
(
key
.
contains
(
"公司"
))
{
//获取节点数量
dataVO
.
setAccountType
(
"银联"
);
int
nodeNum
=
nodeDegreeMap
.
get
(
excelDataVO
.
getPayUserName
());
}
else
{
excelDataVO
.
setNodeNum
(
nodeNum
);
dataVO
.
setAccountType
(
"个人"
);
if
(
excelDataVO
.
getPayeeName
().
contains
(
"公司"
))
{
}
excelDataVO
.
setAccountType
(
"银联"
);
dataVO
.
setNodeNum
(
value
);
}
else
{
}
excelDataVO
.
setAccountType
(
"个人"
);
}
}
});
}
Iterator
<
ExcelDataVO
>
iterator
=
groupedObjects
.
iterator
();
Iterator
<
ExcelDataVO
>
iterator
=
excelDataEntityListNew
.
iterator
();
while
(
iterator
.
hasNext
())
{
while
(
iterator
.
hasNext
())
{
ExcelDataVO
excelDataVO
=
iterator
.
next
();
ExcelDataVO
excelDataVO
=
iterator
.
next
();
if
(
caseDTO
.
getMinTransaction
()
!=
null
&&
caseDTO
.
getMaxTransaction
()
!=
null
)
{
if
(
caseDTO
.
getMinTransaction
()
!=
null
&&
caseDTO
.
getMaxTransaction
()
!=
null
)
{
...
@@ -469,22 +468,24 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
...
@@ -469,22 +468,24 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CasesEntity> implem
}
}
}
}
}
}
List
<
NodeVO
>
result
=
Lists
.
newArrayList
();
List
<
NodeVO
>
result
=
Lists
.
newArrayList
();
groupedObjects
.
forEach
(
excelDataVO
->
{
excelDataEntityListNew
.
forEach
(
excelDataVO
->
{
NodeVO
person
=
new
NodeVO
();
person
.
setNode
(
excelDataVO
.
getPayUserName
());
person
.
setNodeNum
(
excelDataVO
.
getNodeNum
());
person
.
setLabel
(
excelDataVO
.
getLabel
());
person
.
setNodeType
(
"个人"
);
result
.
add
(
person
);
NodeVO
org
=
new
NodeVO
();
NodeVO
org
=
new
NodeVO
();
if
(
excelDataVO
.
get
PayeeName
().
contain
s
(
"
公司
"
))
{
if
(
excelDataVO
.
get
AccountType
().
equal
s
(
"
银联
"
))
{
org
.
setNode
(
excelDataVO
.
getPay
ee
Name
());
org
.
setNode
(
excelDataVO
.
getPay
User
Name
());
org
.
setNodeNum
(
excelDataVO
.
getNodeNum
());
org
.
setNodeNum
(
excelDataVO
.
getNodeNum
());
org
.
setBankCode
(
excelDataVO
.
getPayeeBankCard
());
org
.
setBankCode
(
excelDataVO
.
getPayeeBankCard
());
org
.
setNodeType
(
"银联"
);
org
.
setNodeType
(
"银联"
);
result
.
add
(
org
);
result
.
add
(
org
);
}
else
{
NodeVO
person
=
new
NodeVO
();
person
.
setNode
(
excelDataVO
.
getPayUserName
());
person
.
setNodeNum
(
excelDataVO
.
getNodeNum
());
person
.
setLabel
(
excelDataVO
.
getLabel
());
person
.
setNodeType
(
"个人"
);
result
.
add
(
person
);
}
}
});
});
return
result
;
return
result
;
...
...
src/main/java/com/platform/service/impl/UserServiceImpl.java
View file @
75c9f5e7
...
@@ -16,6 +16,7 @@ import com.platform.model.entity.UserEntity;
...
@@ -16,6 +16,7 @@ import com.platform.model.entity.UserEntity;
import
com.platform.model.entity.UserRelationEntity
;
import
com.platform.model.entity.UserRelationEntity
;
import
com.platform.model.vo.AssociationVO
;
import
com.platform.model.vo.AssociationVO
;
import
com.platform.model.vo.EveryoneVO
;
import
com.platform.model.vo.EveryoneVO
;
import
com.platform.model.vo.ExcelDataVO
;
import
com.platform.model.vo.UserVO
;
import
com.platform.model.vo.UserVO
;
import
com.platform.service.ExcelDataService
;
import
com.platform.service.ExcelDataService
;
import
com.platform.service.UserAccountService
;
import
com.platform.service.UserAccountService
;
...
@@ -44,7 +45,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
...
@@ -44,7 +45,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
public
UserVO
getDetail
(
String
userName
,
String
caseId
)
{
public
UserVO
getDetail
(
String
userName
,
String
caseId
)
{
UserEntity
userEntity
=
baseMapper
.
selectOne
(
new
LambdaQueryWrapper
<
UserEntity
>()
UserEntity
userEntity
=
baseMapper
.
selectOne
(
new
LambdaQueryWrapper
<
UserEntity
>()
.
eq
(
UserEntity:
:
getUserName
,
userName
));
.
eq
(
UserEntity:
:
getUserName
,
userName
));
if
(
ObjectUtils
.
isEmpty
(
userEntity
)){
if
(
ObjectUtils
.
isEmpty
(
userEntity
))
{
return
null
;
return
null
;
}
}
UserVO
userVO
=
DozerUtils
.
convertBean
(
userEntity
,
UserVO
.
class
);
UserVO
userVO
=
DozerUtils
.
convertBean
(
userEntity
,
UserVO
.
class
);
...
@@ -216,4 +217,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
...
@@ -216,4 +217,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
public
Boolean
relationSaveOrUpdate
(
List
<
UserRelationEntity
>
userRelationList
)
{
public
Boolean
relationSaveOrUpdate
(
List
<
UserRelationEntity
>
userRelationList
)
{
return
userRelationService
.
saveOrUpdateBatch
(
userRelationList
);
return
userRelationService
.
saveOrUpdateBatch
(
userRelationList
);
}
}
@Override
public
List
<
ExcelDataVO
>
queryUserLabel
(
List
<
String
>
userNameList
,
Integer
id
)
{
return
baseMapper
.
queryUserLabel
(
userNameList
,
id
);
}
}
}
src/main/resources/com/platform/mapper/UserMapper.xml
View file @
75c9f5e7
...
@@ -3,4 +3,17 @@
...
@@ -3,4 +3,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.platform.mapper.UserMapper"
>
<mapper
namespace=
"com.platform.mapper.UserMapper"
>
<select
id=
"queryUserLabel"
resultType=
"com.platform.model.vo.ExcelDataVO"
>
SELECT
v.userName AS payUserName,
u.label
FROM
(
<foreach
collection=
"userNameList"
item=
"userName"
separator=
"UNION ALL"
>
SELECT #{userName} AS userName
</foreach>
) AS v
LEFT JOIN
user u ON u.user_name = v.userName AND u.case_id = #{caseId}
</select>
</mapper>
</mapper>
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