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
bc10e8bc
Commit
bc10e8bc
authored
Aug 01, 2025
by
zhuxiang
Browse files
画布接口增加团体
parent
71cc9168
Changes
6
Show whitespace changes
Inline
Side-by-side
pom.xml
View file @
bc10e8bc
...
...
@@ -90,8 +90,8 @@
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
8
</source>
<target>
8
</target>
<source>
9
</source>
<target>
9
</target>
</configuration>
</plugin>
</plugins>
...
...
src/main/java/com/platform/controller/UserController.java
View file @
bc10e8bc
...
...
@@ -4,10 +4,7 @@ import com.platform.model.dto.UserDTO;
import
com.platform.model.resp.Result
;
import
com.platform.service.UserService
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
...
...
@@ -19,13 +16,13 @@ public class UserController extends BaseController {
private
UserService
userService
;
@ApiOperation
(
value
=
"用户详情"
)
@
Reques
tMapping
(
"/detail"
)
@
Ge
tMapping
(
"/detail"
)
public
Result
detail
(
@RequestParam
String
userName
)
{
return
Result
.
data
(
userService
.
getDetail
(
userName
));
}
@ApiOperation
(
value
=
"编辑用户信息"
)
@
Reques
tMapping
(
"/update"
)
@
Pu
tMapping
(
"/update"
)
public
Result
update
(
@RequestBody
UserDTO
userDTO
)
{
return
toAjax
(
userService
.
updateUser
(
userDTO
));
}
...
...
src/main/java/com/platform/model/vo/EdgeVO.java
View file @
bc10e8bc
...
...
@@ -18,14 +18,17 @@ public class EdgeVO {
private
double
totalAmount
;
private
String
groupId
;
private
List
<
String
>
states
;
public
EdgeVO
(
String
id
,
String
source
,
String
target
,
int
totalTransactions
,
double
totalAmount
)
{
public
EdgeVO
(
String
id
,
String
source
,
String
target
,
int
totalTransactions
,
double
totalAmount
,
String
groupId
)
{
this
.
id
=
id
;
this
.
source
=
source
;
this
.
target
=
target
;
this
.
totalTransactions
=
totalTransactions
;
this
.
totalAmount
=
totalAmount
;
this
.
groupId
=
groupId
;
}
}
src/main/java/com/platform/model/vo/GraphVO.java
View file @
bc10e8bc
...
...
@@ -12,9 +12,12 @@ public class GraphVO {
private
List
<
EdgeVO
>
edges
;
private
List
<
GroupVO
>
groups
;
public
GraphVO
()
{
this
.
nodes
=
new
ArrayList
<>();
this
.
edges
=
new
ArrayList
<>();
this
.
groups
=
new
ArrayList
<>();
}
public
void
addNode
(
NodeVO
node
)
{
...
...
@@ -24,4 +27,8 @@ public class GraphVO {
public
void
addEdge
(
EdgeVO
edge
)
{
edges
.
add
(
edge
);
}
public
void
addGroup
(
GroupVO
groupVO
)
{
groups
.
add
(
groupVO
);
}
}
src/main/java/com/platform/model/vo/GroupVO.java
0 → 100644
View file @
bc10e8bc
package
com.platform.model.vo
;
import
lombok.Data
;
@Data
public
class
GroupVO
{
private
String
groupName
;
// 团体名
private
int
groupSize
;
// 团体人数
private
double
totalAmount
;
// 团体资金总量
private
int
totalTransactions
;
// 交易总次数
public
GroupVO
(
String
groupName
,
int
groupSize
,
double
totalAmount
,
int
totalTransactions
)
{
this
.
groupName
=
groupName
;
this
.
groupSize
=
groupSize
;
this
.
totalAmount
=
totalAmount
;
this
.
totalTransactions
=
totalTransactions
;
}
}
src/main/java/com/platform/model/vo/UnionFindVO.java
0 → 100644
View file @
bc10e8bc
package
com.platform.model.vo
;
import
lombok.Data
;
import
java.util.HashMap
;
import
java.util.Map
;
@Data
public
class
UnionFindVO
{
private
Map
<
String
,
String
>
parent
;
private
Map
<
String
,
Integer
>
rank
;
public
UnionFindVO
()
{
parent
=
new
HashMap
<>();
rank
=
new
HashMap
<>();
}
public
void
makeSet
(
String
node
)
{
parent
.
put
(
node
,
node
);
rank
.
put
(
node
,
0
);
}
public
String
find
(
String
node
)
{
if
(!
parent
.
containsKey
(
node
))
{
makeSet
(
node
);
}
if
(!
parent
.
get
(
node
).
equals
(
node
))
{
parent
.
put
(
node
,
find
(
parent
.
get
(
node
)));
// 路径压缩
}
return
parent
.
get
(
node
);
}
public
void
union
(
String
node1
,
String
node2
)
{
String
root1
=
find
(
node1
);
String
root2
=
find
(
node2
);
if
(!
root1
.
equals
(
root2
))
{
if
(
rank
.
get
(
root1
)
>
rank
.
get
(
root2
))
{
parent
.
put
(
root2
,
root1
);
}
else
if
(
rank
.
get
(
root1
)
<
rank
.
get
(
root2
))
{
parent
.
put
(
root1
,
root2
);
}
else
{
parent
.
put
(
root2
,
root1
);
rank
.
put
(
root1
,
rank
.
get
(
root1
)
+
1
);
}
}
}
public
Map
<
String
,
String
>
getParent
()
{
return
parent
;
}
}
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