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
5a5eecc8
Commit
5a5eecc8
authored
Aug 01, 2025
by
wujipeng
Browse files
个人信息接口优化
parent
fbf5742e
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/platform/controller/UserController.java
View file @
5a5eecc8
...
@@ -18,8 +18,8 @@ public class UserController extends BaseController {
...
@@ -18,8 +18,8 @@ public class UserController extends BaseController {
@ApiOperation
(
value
=
"用户详情"
)
@ApiOperation
(
value
=
"用户详情"
)
@GetMapping
(
"/detail"
)
@GetMapping
(
"/detail"
)
public
Result
detail
(
@RequestParam
String
userName
)
{
public
Result
detail
(
@RequestParam
String
userName
,
@RequestParam
String
caseId
)
{
return
Result
.
data
(
userService
.
getDetail
(
userName
));
return
Result
.
data
(
userService
.
getDetail
(
userName
,
caseId
));
}
}
@ApiOperation
(
value
=
"编辑用户信息"
)
@ApiOperation
(
value
=
"编辑用户信息"
)
...
...
src/main/java/com/platform/mapper/ExcelDataMapper.java
View file @
5a5eecc8
...
@@ -3,8 +3,10 @@ package com.platform.mapper;
...
@@ -3,8 +3,10 @@ package com.platform.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.platform.model.dto.CaseDTO
;
import
com.platform.model.dto.CaseDTO
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.vo.AssociationVO
;
import
com.platform.model.vo.ExcelDataVO
;
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
;
import
java.util.List
;
...
@@ -19,4 +21,6 @@ public interface ExcelDataMapper extends BaseMapper<ExcelDataEntity> {
...
@@ -19,4 +21,6 @@ public interface ExcelDataMapper extends BaseMapper<ExcelDataEntity> {
List
<
ExcelDataVO
>
queryByCaseId
(
String
id
);
List
<
ExcelDataVO
>
queryByCaseId
(
String
id
);
List
<
ExcelDataEntity
>
queryList
(
CaseDTO
caseDTO
);
List
<
ExcelDataEntity
>
queryList
(
CaseDTO
caseDTO
);
List
<
AssociationVO
>
selectFinancialTransactions
(
@Param
(
"userName"
)
String
userName
,
@Param
(
"caseId"
)
String
caseId
);
}
}
src/main/java/com/platform/model/vo/AssociationVO.java
0 → 100644
View file @
5a5eecc8
package
com.platform.model.vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author : wujipeng
* @date : 2025/8/1 16:31
* @Version: 1.0
* @Desc : 描述信息
*/
@Data
public
class
AssociationVO
{
// @ApiModelProperty("关联类型")
// private String relationType;
//
// @ApiModelProperty("关联人员名称")
// private String relationName;
@ApiModelProperty
(
"关联描述"
)
private
String
relationDesc
;
@ApiModelProperty
(
"开始时间"
)
private
String
startTime
;
@ApiModelProperty
(
"结束时间"
)
private
String
endTime
;
@ApiModelProperty
(
"总金额"
)
private
String
totalAmount
;
@ApiModelProperty
(
"收款方"
)
private
String
payee
;
@ApiModelProperty
(
"付款方"
)
private
String
payment
;
@ApiModelProperty
(
"数量"
)
private
Integer
num
;
@ApiModelProperty
(
"方向"
)
private
String
direction
;
}
src/main/java/com/platform/model/vo/UserVO.java
View file @
5a5eecc8
...
@@ -2,12 +2,26 @@ package com.platform.model.vo;
...
@@ -2,12 +2,26 @@ package com.platform.model.vo;
import
com.platform.model.entity.UserAccountEntity
;
import
com.platform.model.entity.UserAccountEntity
;
import
com.platform.model.entity.UserEntity
;
import
com.platform.model.entity.UserEntity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
@Data
@Data
public
class
UserVO
extends
UserEntity
{
public
class
UserVO
extends
UserEntity
{
private
List
<
UserAccountEntity
>
userAccountList
;
private
List
<
UserAccountEntity
>
userAccountList
;
@ApiModelProperty
(
"本人账户数量"
)
private
Integer
accountNum
;
@ApiModelProperty
(
"关联人员数量"
)
private
Integer
headcount
;
@ApiModelProperty
(
"关联交易数量"
)
private
Integer
quantity
;
@ApiModelProperty
(
"资金类型,关联交易明细"
)
private
Map
<
String
,
List
<
AssociationVO
>>
detailsFunds
;
}
}
src/main/java/com/platform/service/ExcelDataService.java
View file @
5a5eecc8
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
com.platform.model.dto.CaseDTO
;
import
com.platform.model.dto.CaseDTO
;
import
com.platform.model.dto.ExcelDataDTO
;
import
com.platform.model.dto.ExcelDataDTO
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.vo.AssociationVO
;
import
com.platform.model.vo.ExcelDataVO
;
import
com.platform.model.vo.ExcelDataVO
;
import
java.util.List
;
import
java.util.List
;
...
@@ -46,4 +47,6 @@ public interface ExcelDataService extends IService<ExcelDataEntity> {
...
@@ -46,4 +47,6 @@ public interface ExcelDataService extends IService<ExcelDataEntity> {
List
<
ExcelDataEntity
>
queryListByCaseId
(
String
id
);
List
<
ExcelDataEntity
>
queryListByCaseId
(
String
id
);
List
<
ExcelDataEntity
>
queryList
(
CaseDTO
caseDTO
);
List
<
ExcelDataEntity
>
queryList
(
CaseDTO
caseDTO
);
List
<
AssociationVO
>
selectFinancialTransactions
(
String
userName
,
String
caseId
);
}
}
src/main/java/com/platform/service/UserService.java
View file @
5a5eecc8
...
@@ -6,7 +6,7 @@ import com.platform.model.entity.UserEntity;
...
@@ -6,7 +6,7 @@ import com.platform.model.entity.UserEntity;
import
com.platform.model.vo.UserVO
;
import
com.platform.model.vo.UserVO
;
public
interface
UserService
extends
IService
<
UserEntity
>
{
public
interface
UserService
extends
IService
<
UserEntity
>
{
UserVO
getDetail
(
String
userName
);
UserVO
getDetail
(
String
userName
,
String
caseId
);
boolean
updateUser
(
UserDTO
userDTO
);
boolean
updateUser
(
UserDTO
userDTO
);
...
...
src/main/java/com/platform/service/impl/ExcelDataServiceImpl.java
View file @
5a5eecc8
...
@@ -6,6 +6,7 @@ import com.platform.mapper.ExcelDataMapper;
...
@@ -6,6 +6,7 @@ import com.platform.mapper.ExcelDataMapper;
import
com.platform.model.dto.CaseDTO
;
import
com.platform.model.dto.CaseDTO
;
import
com.platform.model.dto.ExcelDataDTO
;
import
com.platform.model.dto.ExcelDataDTO
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.vo.AssociationVO
;
import
com.platform.model.vo.ExcelDataVO
;
import
com.platform.model.vo.ExcelDataVO
;
import
com.platform.service.ExcelDataService
;
import
com.platform.service.ExcelDataService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -60,4 +61,9 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
...
@@ -60,4 +61,9 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
public
List
<
ExcelDataEntity
>
queryList
(
CaseDTO
caseDTO
)
{
public
List
<
ExcelDataEntity
>
queryList
(
CaseDTO
caseDTO
)
{
return
baseMapper
.
queryList
(
caseDTO
);
return
baseMapper
.
queryList
(
caseDTO
);
}
}
@Override
public
List
<
AssociationVO
>
selectFinancialTransactions
(
String
userName
,
String
caseId
)
{
return
baseMapper
.
selectFinancialTransactions
(
userName
,
caseId
);
}
}
}
src/main/java/com/platform/service/impl/UserServiceImpl.java
View file @
5a5eecc8
...
@@ -4,22 +4,29 @@ import cn.hutool.core.collection.CollUtil;
...
@@ -4,22 +4,29 @@ import cn.hutool.core.collection.CollUtil;
import
cn.hutool.core.map.MapUtil
;
import
cn.hutool.core.map.MapUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Sets
;
import
com.platform.mapper.UserMapper
;
import
com.platform.mapper.UserMapper
;
import
com.platform.model.dto.UserDTO
;
import
com.platform.model.dto.UserDTO
;
import
com.platform.model.entity.UserAccountEntity
;
import
com.platform.model.entity.UserAccountEntity
;
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.AssociationVO
;
import
com.platform.model.vo.UserVO
;
import
com.platform.model.vo.UserVO
;
import
com.platform.service.ExcelDataService
;
import
com.platform.service.UserAccountService
;
import
com.platform.service.UserAccountService
;
import
com.platform.service.UserRelationService
;
import
com.platform.service.UserRelationService
;
import
com.platform.service.UserService
;
import
com.platform.service.UserService
;
import
com.platform.utils.DozerUtils
;
import
com.platform.utils.DozerUtils
;
import
com.platform.utils.IdCardUtils
;
import
com.platform.utils.IdCardUtils
;
import
org.checkerframework.checker.nullness.qual.Nullable
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -30,9 +37,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
...
@@ -30,9 +37,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
private
UserAccountService
userAccountService
;
private
UserAccountService
userAccountService
;
@Resource
@Resource
private
UserRelationService
userRelationService
;
private
UserRelationService
userRelationService
;
@Resource
private
ExcelDataService
excelDataService
;
@Override
@Override
public
UserVO
getDetail
(
String
userName
)
{
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
));
UserVO
userVO
=
DozerUtils
.
convertBean
(
userEntity
,
UserVO
.
class
);
UserVO
userVO
=
DozerUtils
.
convertBean
(
userEntity
,
UserVO
.
class
);
...
@@ -45,6 +54,52 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
...
@@ -45,6 +54,52 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
if
(!
ObjectUtils
.
isEmpty
(
relationShipList
)){
if
(!
ObjectUtils
.
isEmpty
(
relationShipList
)){
userVO
.
setRelationShipList
(
relationShipList
);
userVO
.
setRelationShipList
(
relationShipList
);
}
}
//本人账号数量
HashSet
<
String
>
account
=
Sets
.
newHashSet
();
//查询关联资金
List
<
AssociationVO
>
financialTransactions
=
excelDataService
.
selectFinancialTransactions
(
userName
,
caseId
);
Map
<
String
,
List
<
AssociationVO
>>
detailsFunds
=
Maps
.
newHashMap
();
for
(
AssociationVO
financialTransaction
:
financialTransactions
)
{
if
(
financialTransaction
.
getDirection
().
equals
(
"出账"
)){
if
(
detailsFunds
.
containsKey
(
financialTransaction
.
getPayee
())){
financialTransaction
.
setRelationDesc
(
detailsFunds
.
get
(
financialTransaction
.
getPayee
()).
size
()
+
"、"
+
financialTransaction
.
getStartTime
()
+
"-"
+
financialTransaction
.
getEndTime
()
+
financialTransaction
.
getPayee
()
+
"->"
+
financialTransaction
.
getPayment
()
+
","
+
financialTransaction
.
getTotalAmount
()
+
",交易"
+
financialTransaction
.
getNum
()
+
"次"
);
detailsFunds
.
get
(
financialTransaction
.
getPayee
()).
add
(
financialTransaction
);
account
.
add
(
financialTransaction
.
getPayment
());
}
else
{
List
<
AssociationVO
>
list
=
new
ArrayList
<>();
financialTransaction
.
setRelationDesc
(
"1、"
+
financialTransaction
.
getStartTime
()
+
"-"
+
financialTransaction
.
getEndTime
()
+
financialTransaction
.
getPayee
()
+
"->"
+
financialTransaction
.
getPayment
()
+
","
+
financialTransaction
.
getTotalAmount
()
+
",交易"
+
financialTransaction
.
getNum
()
+
"次"
);
list
.
add
(
financialTransaction
);
detailsFunds
.
put
(
financialTransaction
.
getPayee
(),
list
);
account
.
add
(
financialTransaction
.
getPayment
());
}
}
else
if
(
financialTransaction
.
getDirection
().
equals
(
"入账"
)){
if
(
detailsFunds
.
containsKey
(
financialTransaction
.
getPayment
())){
financialTransaction
.
setRelationDesc
(
detailsFunds
.
get
(
financialTransaction
.
getPayment
()).
size
()
+
"、"
+
financialTransaction
.
getStartTime
()
+
"-"
+
financialTransaction
.
getEndTime
()
+
financialTransaction
.
getPayee
()
+
"->"
+
financialTransaction
.
getPayment
()
+
","
+
financialTransaction
.
getTotalAmount
()
+
",交易"
+
financialTransaction
.
getNum
()
+
"次"
);
detailsFunds
.
get
(
financialTransaction
.
getPayment
()).
add
(
financialTransaction
);
account
.
add
(
financialTransaction
.
getPayee
());
}
else
{
List
<
AssociationVO
>
list
=
new
ArrayList
<>();
financialTransaction
.
setRelationDesc
(
"1、"
+
financialTransaction
.
getStartTime
()
+
"-"
+
financialTransaction
.
getEndTime
()
+
financialTransaction
.
getPayee
()
+
"->"
+
financialTransaction
.
getPayment
()
+
","
+
financialTransaction
.
getTotalAmount
()
+
",交易"
+
financialTransaction
.
getNum
()
+
"次"
);
list
.
add
(
financialTransaction
);
detailsFunds
.
put
(
financialTransaction
.
getPayment
(),
list
);
account
.
add
(
financialTransaction
.
getPayee
());
}
}
}
//关联人员数量
userVO
.
setHeadcount
(
detailsFunds
.
size
());
//关联交易次数
int
quantity
=
0
;
for
(
AssociationVO
financialTransaction
:
financialTransactions
)
{
quantity
+=
financialTransaction
.
getNum
();
}
userVO
.
setQuantity
(
quantity
);
//本人账户数量
userVO
.
setAccountNum
(
account
.
size
());
return
userVO
;
return
userVO
;
}
}
...
...
src/main/resources/com/platform/mapper/ExcelDataMapper.xml
View file @
5a5eecc8
...
@@ -38,4 +38,21 @@
...
@@ -38,4 +38,21 @@
and time betwenn #{startTime} and #{endTime}
and time betwenn #{startTime} and #{endTime}
</if>
</if>
</select>
</select>
<select
id=
"selectFinancialTransactions"
resultType=
"com.platform.model.vo.AssociationVO"
>
select
min(time) as startTime,
max(time) as endTime,
sum(amount) as totalAmount,
payee_account as payee,
payment_account as payment,
count(*) as num,
direction
from excel_data
where case_id = #{caseId}
and pay_user_name = #{userName}
group by
payee_account,
payment_account,
direction
</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