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
50016fb9
"...model/git@gitlab.ruzhoukj.com:wujipeng/relation.git" did not exist on "cab074815503cac10b4b58039655b88103ca1d6f"
Commit
50016fb9
authored
Jul 31, 2025
by
zhuxiang
Browse files
画布接口
parent
8c249aa2
Changes
11
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/platform/controller/CaseController.java
View file @
50016fb9
...
@@ -15,7 +15,7 @@ import java.util.List;
...
@@ -15,7 +15,7 @@ import java.util.List;
@RestController
@RestController
@RequestMapping
(
"/case"
)
@RequestMapping
(
"/case"
)
public
class
CaseController
extends
BaseController
{
public
class
CaseController
extends
BaseController
{
@Resource
@Resource
private
CaseService
caseService
;
private
CaseService
caseService
;
...
@@ -71,7 +71,13 @@ public class CaseController extends BaseController{
...
@@ -71,7 +71,13 @@ public class CaseController extends BaseController{
@ApiOperation
(
value
=
"合并人员"
)
@ApiOperation
(
value
=
"合并人员"
)
@PutMapping
(
"/detail/mergeUser"
)
@PutMapping
(
"/detail/mergeUser"
)
public
Result
mergeUser
(
@RequestBody
ExcelDataDTO
excelDataDTO
){
public
Result
mergeUser
(
@RequestBody
ExcelDataDTO
excelDataDTO
)
{
return
toAjax
(
caseService
.
mergeUser
(
excelDataDTO
));
return
toAjax
(
caseService
.
mergeUser
(
excelDataDTO
));
}
}
@ApiOperation
(
value
=
"画布"
)
@PostMapping
(
"/detail/draw"
)
public
Result
draw
(
@RequestBody
CaseDTO
caseDTO
)
{
return
Result
.
data
(
caseService
.
draw
(
caseDTO
));
}
}
}
src/main/java/com/platform/mapper/ExcelDataMapper.java
View file @
50016fb9
package
com.platform.mapper
;
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.entity.ExcelDataEntity
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.vo.ExcelDataVO
;
import
com.platform.model.vo.ExcelDataVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
...
@@ -16,4 +17,6 @@ import java.util.List;
...
@@ -16,4 +17,6 @@ import java.util.List;
@Mapper
@Mapper
public
interface
ExcelDataMapper
extends
BaseMapper
<
ExcelDataEntity
>
{
public
interface
ExcelDataMapper
extends
BaseMapper
<
ExcelDataEntity
>
{
List
<
ExcelDataVO
>
queryByCaseId
(
String
id
);
List
<
ExcelDataVO
>
queryByCaseId
(
String
id
);
List
<
ExcelDataEntity
>
queryList
(
CaseDTO
caseDTO
);
}
}
src/main/java/com/platform/model/dto/CaseDTO.java
View file @
50016fb9
...
@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
...
@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
/**
/**
* @author : wujipeng
* @author : wujipeng
* @date : 2025/7/31 10:47
* @date : 2025/7/31 10:47
...
@@ -21,4 +23,17 @@ public class CaseDTO extends CaseEntity {
...
@@ -21,4 +23,17 @@ public class CaseDTO extends CaseEntity {
@ApiModelProperty
(
value
=
"每页显示的数量"
,
example
=
"10"
)
@ApiModelProperty
(
value
=
"每页显示的数量"
,
example
=
"10"
)
private
Integer
pageSize
;
private
Integer
pageSize
;
@ApiModelProperty
(
value
=
"开始时间"
)
private
Date
startTime
;
private
Date
endTime
;
private
Integer
minTransaction
;
private
Integer
maxTransaction
;
private
Double
maxAmount
;
private
Double
minAmount
;
@ApiModelProperty
(
value
=
"主体类型 1、个人 2、对公"
)
private
Integer
principal
;
}
}
src/main/java/com/platform/model/vo/EdgeVO.java
0 → 100644
View file @
50016fb9
package
com.platform.model.vo
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
EdgeVO
{
private
String
id
;
private
String
source
;
private
String
target
;
// 总汇款笔数
private
int
totalTransactions
;
private
double
totalAmount
;
private
List
<
String
>
states
;
public
EdgeVO
(
String
id
,
String
source
,
String
target
,
int
totalTransactions
,
double
totalAmount
)
{
this
.
id
=
id
;
this
.
source
=
source
;
this
.
target
=
target
;
this
.
totalTransactions
=
totalTransactions
;
this
.
totalAmount
=
totalAmount
;
}
}
src/main/java/com/platform/model/vo/GraphVO.java
0 → 100644
View file @
50016fb9
package
com.platform.model.vo
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
@Data
public
class
GraphVO
{
private
List
<
NodeVO
>
nodes
;
private
List
<
EdgeVO
>
edges
;
public
GraphVO
()
{
this
.
nodes
=
new
ArrayList
<>();
this
.
edges
=
new
ArrayList
<>();
}
public
void
addNode
(
NodeVO
node
)
{
nodes
.
add
(
node
);
}
public
void
addEdge
(
EdgeVO
edge
)
{
edges
.
add
(
edge
);
}
}
src/main/java/com/platform/model/vo/NodeVO.java
0 → 100644
View file @
50016fb9
package
com.platform.model.vo
;
import
lombok.Data
;
@Data
public
class
NodeVO
{
private
String
node
;
public
NodeVO
(
String
node
)
{
this
.
node
=
node
;
}
}
src/main/java/com/platform/service/CaseService.java
View file @
50016fb9
...
@@ -5,6 +5,7 @@ import com.platform.model.dto.CaseDTO;
...
@@ -5,6 +5,7 @@ import com.platform.model.dto.CaseDTO;
import
com.platform.model.dto.ExcelDataDTO
;
import
com.platform.model.dto.ExcelDataDTO
;
import
com.platform.model.entity.CaseEntity
;
import
com.platform.model.entity.CaseEntity
;
import
com.platform.model.vo.CaseVO
;
import
com.platform.model.vo.CaseVO
;
import
com.platform.model.vo.GraphVO
;
import
java.util.List
;
import
java.util.List
;
...
@@ -17,6 +18,7 @@ public interface CaseService extends IService<CaseEntity> {
...
@@ -17,6 +18,7 @@ public interface CaseService extends IService<CaseEntity> {
* @return List<CaseVO>
* @return List<CaseVO>
*/
*/
List
<
CaseVO
>
pageCase
(
CaseDTO
caseDTO
);
List
<
CaseVO
>
pageCase
(
CaseDTO
caseDTO
);
List
<
CaseVO
>
queryDataList
(
String
id
);
List
<
CaseVO
>
queryDataList
(
String
id
);
/**
/**
...
@@ -35,15 +37,23 @@ public interface CaseService extends IService<CaseEntity> {
...
@@ -35,15 +37,23 @@ public interface CaseService extends IService<CaseEntity> {
/**
/**
* 更新是否使用
* 更新是否使用
*
* @param excelDataDTO
* @param excelDataDTO
* @return
* @return
*/
*/
boolean
updateExcelUse
(
ExcelDataDTO
excelDataDTO
);
boolean
updateExcelUse
(
ExcelDataDTO
excelDataDTO
);
/**
/**
*
* @param excelDataDTO
* @param excelDataDTO
* @return
* @return
*/
*/
boolean
mergeUser
(
ExcelDataDTO
excelDataDTO
);
boolean
mergeUser
(
ExcelDataDTO
excelDataDTO
);
/**
* 画布
*
* @param caseDTO caseDTO
* @return GraphVO
*/
GraphVO
draw
(
CaseDTO
caseDTO
);
}
}
src/main/java/com/platform/service/ExcelDataService.java
View file @
50016fb9
package
com.platform.service
;
package
com.platform.service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
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.ExcelDataVO
;
import
com.platform.model.vo.ExcelDataVO
;
...
@@ -36,4 +37,13 @@ public interface ExcelDataService extends IService<ExcelDataEntity> {
...
@@ -36,4 +37,13 @@ public interface ExcelDataService extends IService<ExcelDataEntity> {
* @return
* @return
*/
*/
List
<
ExcelDataEntity
>
queryListByCaseIdAndPayUserName
(
String
caseId
,
String
payUserName
);
List
<
ExcelDataEntity
>
queryListByCaseIdAndPayUserName
(
String
caseId
,
String
payUserName
);
/**
* 查看案件所有的人员
* @param id
* @return
*/
List
<
ExcelDataEntity
>
queryListByCaseId
(
String
id
);
List
<
ExcelDataEntity
>
queryList
(
CaseDTO
caseDTO
);
}
}
src/main/java/com/platform/service/impl/CaseServiceImpl.java
View file @
50016fb9
...
@@ -7,8 +7,7 @@ import com.platform.model.dto.CaseDTO;
...
@@ -7,8 +7,7 @@ import com.platform.model.dto.CaseDTO;
import
com.platform.model.dto.ExcelDataDTO
;
import
com.platform.model.dto.ExcelDataDTO
;
import
com.platform.model.entity.CaseEntity
;
import
com.platform.model.entity.CaseEntity
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.entity.ExcelDataEntity
;
import
com.platform.model.vo.CaseVO
;
import
com.platform.model.vo.*
;
import
com.platform.model.vo.ExcelDataVO
;
import
com.platform.service.CaseService
;
import
com.platform.service.CaseService
;
import
com.platform.service.ExcelDataService
;
import
com.platform.service.ExcelDataService
;
import
com.platform.utils.StringUtils
;
import
com.platform.utils.StringUtils
;
...
@@ -16,10 +15,7 @@ import org.apache.commons.compress.utils.Lists;
...
@@ -16,10 +15,7 @@ import org.apache.commons.compress.utils.Lists;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Service
@Service
public
class
CaseServiceImpl
extends
ServiceImpl
<
CaseMapper
,
CaseEntity
>
implements
CaseService
{
public
class
CaseServiceImpl
extends
ServiceImpl
<
CaseMapper
,
CaseEntity
>
implements
CaseService
{
...
@@ -93,6 +89,96 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CaseEntity> impleme
...
@@ -93,6 +89,96 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CaseEntity> impleme
return
Boolean
.
TRUE
;
return
Boolean
.
TRUE
;
}
}
@Override
public
GraphVO
draw
(
CaseDTO
caseDTO
)
{
// 初始化画布
GraphVO
graph
=
new
GraphVO
();
// 使用Map来存储边的信息,键为payer-payee组合,值为Edge对象
Map
<
String
,
EdgeVO
>
edgeMap
=
new
HashMap
<>();
//查看案件所有的人员
List
<
ExcelDataEntity
>
excelDataEntityList
=
excelDataService
.
queryList
(
caseDTO
);
if
(
CollUtil
.
isNotEmpty
(
excelDataEntityList
))
{
//初始化set集合
// 使用Set去重
Set
<
String
>
uniqueNodes
=
new
HashSet
<>();
excelDataEntityList
.
forEach
(
excelDataEntity
->
{
if
(
StringUtils
.
isNotEmpty
(
excelDataEntity
.
getPayUserName
())
&&
StringUtils
.
isNotEmpty
(
excelDataEntity
.
getPayeeName
()))
{
uniqueNodes
.
add
(
excelDataEntity
.
getPayUserName
());
uniqueNodes
.
add
(
excelDataEntity
.
getPayeeName
());
// 生成边的唯一标识
String
edgeKey
=
excelDataEntity
.
getPayUserName
()
+
"-"
+
excelDataEntity
.
getPayeeName
();
// 检查是否已经存在这条边
if
(
edgeMap
.
containsKey
(
edgeKey
))
{
// 如果存在,更新总笔数和总金额
EdgeVO
existingEdge
=
edgeMap
.
get
(
edgeKey
);
existingEdge
.
setTotalTransactions
(
existingEdge
.
getTotalTransactions
()
+
1
);
existingEdge
.
setTotalAmount
(
existingEdge
.
getTotalAmount
()
+
excelDataEntity
.
getAmount
());
}
else
{
// 如果不存在,创建新的边
String
edgeId
=
"line-"
+
excelDataEntity
.
getPayUserName
()
+
"-"
+
excelDataEntity
.
getPayeeName
();
EdgeVO
newEdge
=
new
EdgeVO
(
edgeId
,
excelDataEntity
.
getPayUserName
(),
excelDataEntity
.
getPayeeName
(),
1
,
excelDataEntity
.
getAmount
());
edgeMap
.
put
(
edgeKey
,
newEdge
);
}
}
});
// 添加去重后的节点
for
(
String
node
:
uniqueNodes
)
{
if
(
caseDTO
.
getPrincipal
()
!=
null
)
{
if
(
caseDTO
.
getPrincipal
()
==
1
)
{
//过滤掉收款人名称中带有公司的数据
if
(
node
.
contains
(
"公司"
)
||
node
.
length
()
>
4
)
{
continue
;
}
}
else
{
//过滤掉收款人名称中不含公司的数据
if
(!
node
.
contains
(
"公司"
)
||
node
.
length
()
>
4
)
{
continue
;
}
}
graph
.
addNode
(
new
NodeVO
(
node
));
continue
;
}
graph
.
addNode
(
new
NodeVO
(
node
));
}
// 添加边
for
(
EdgeVO
edge
:
edgeMap
.
values
())
{
if
(
caseDTO
.
getMinAmount
()
!=
null
&&
caseDTO
.
getMaxAmount
()
!=
null
)
{
if
(
edge
.
getTotalAmount
()
>=
caseDTO
.
getMinAmount
()
&&
edge
.
getTotalAmount
()
<=
caseDTO
.
getMaxAmount
())
{
graph
.
addEdge
(
edge
);
continue
;
}
}
if
(
caseDTO
.
getMaxTransaction
()
!=
null
&&
caseDTO
.
getMinTransaction
()
!=
null
)
{
if
(
edge
.
getTotalTransactions
()
>=
caseDTO
.
getMinTransaction
()
&&
edge
.
getTotalTransactions
()
<=
caseDTO
.
getMaxTransaction
())
{
graph
.
addEdge
(
edge
);
continue
;
}
}
if
(
caseDTO
.
getPrincipal
()
!=
null
)
{
if
(
caseDTO
.
getPrincipal
()
==
1
)
{
//过滤掉收款人名称中带有公司的数据
if
(
edge
.
getTarget
().
contains
(
"公司"
)
||
edge
.
getTarget
().
length
()
>
4
)
{
continue
;
}
}
else
{
//过滤掉收款人名称中不含公司的数据
if
(!
edge
.
getTarget
().
contains
(
"公司"
)
||
edge
.
getTarget
().
length
()
>
4
)
{
continue
;
}
}
graph
.
addEdge
(
edge
);
continue
;
}
graph
.
addEdge
(
edge
);
}
}
return
graph
;
}
private
Map
<
String
,
List
<
ExcelDataVO
>>
groupByPayUserName
(
List
<
ExcelDataVO
>
excelDataVOList
)
{
private
Map
<
String
,
List
<
ExcelDataVO
>>
groupByPayUserName
(
List
<
ExcelDataVO
>
excelDataVOList
)
{
Map
<
String
,
List
<
ExcelDataVO
>>
groupedMap
=
new
HashMap
<>();
Map
<
String
,
List
<
ExcelDataVO
>>
groupedMap
=
new
HashMap
<>();
...
@@ -105,6 +191,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CaseEntity> impleme
...
@@ -105,6 +191,7 @@ public class CaseServiceImpl extends ServiceImpl<CaseMapper, CaseEntity> impleme
}
}
return
groupedMap
;
return
groupedMap
;
}
}
@Override
@Override
public
List
<
CaseVO
>
pageCase
(
CaseDTO
caseDTO
)
{
public
List
<
CaseVO
>
pageCase
(
CaseDTO
caseDTO
)
{
return
baseMapper
.
pageCase
(
caseDTO
);
return
baseMapper
.
pageCase
(
caseDTO
);
...
...
src/main/java/com/platform/service/impl/ExcelDataServiceImpl.java
View file @
50016fb9
...
@@ -3,6 +3,7 @@ package com.platform.service.impl;
...
@@ -3,6 +3,7 @@ package com.platform.service.impl;
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.platform.mapper.ExcelDataMapper
;
import
com.platform.mapper.ExcelDataMapper
;
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.ExcelDataVO
;
import
com.platform.model.vo.ExcelDataVO
;
...
@@ -47,4 +48,16 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
...
@@ -47,4 +48,16 @@ public class ExcelDataServiceImpl extends ServiceImpl<ExcelDataMapper, ExcelData
.
eq
(
ExcelDataEntity:
:
getCaseId
,
caseId
)
.
eq
(
ExcelDataEntity:
:
getCaseId
,
caseId
)
.
eq
(
ExcelDataEntity:
:
getPayUserName
,
payUserName
));
.
eq
(
ExcelDataEntity:
:
getPayUserName
,
payUserName
));
}
}
@Override
public
List
<
ExcelDataEntity
>
queryListByCaseId
(
String
id
)
{
return
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
ExcelDataEntity
>()
.
eq
(
ExcelDataEntity:
:
getCaseId
,
id
)
.
eq
(
ExcelDataEntity:
:
getUseFlag
,
true
));
}
@Override
public
List
<
ExcelDataEntity
>
queryList
(
CaseDTO
caseDTO
)
{
return
baseMapper
.
queryList
(
caseDTO
);
}
}
}
src/main/resources/com/platform/mapper/ExcelDataMapper.xml
View file @
50016fb9
...
@@ -19,4 +19,18 @@
...
@@ -19,4 +19,18 @@
group by
group by
ed.file_id,ed.pay_user_name,fu.file_name,fu.path,ed.use_flag
ed.file_id,ed.pay_user_name,fu.file_name,fu.path,ed.use_flag
</select>
</select>
<select
id=
"queryList"
resultType=
"com.platform.model.entity.ExcelDataEntity"
>
select
pay_user_name payUserName,
payee_name payeeName,
amount amount
from
excel_data
where
use_flag = 1
<if
test=
"startTime != null and endTime != ''"
>
and time betwenn #{startTime} and #{endTime}
</if>
</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