10
10
11
11
public class FlowRecordConvertor {
12
12
13
- public static FlowRecordEntity convert (FlowRecord flowRecord , UserRepository userRepository ) {
13
+ public static FlowRecordEntity convert (FlowRecord flowRecord ) {
14
14
if (flowRecord == null ) {
15
15
return null ;
16
16
}
@@ -22,7 +22,7 @@ public static FlowRecordEntity convert(FlowRecord flowRecord, UserRepository use
22
22
entity .setProcessId (flowRecord .getProcessId ());
23
23
entity .setNodeCode (flowRecord .getNodeCode ());
24
24
entity .setTitle (flowRecord .getTitle ());
25
- entity .setCurrentOperatorId (flowRecord .getCurrentOperatorId ());
25
+ entity .setCurrentOperatorId (flowRecord .getCurrentOperator (). getUserId ());
26
26
entity .setFlowType (flowRecord .getFlowType ().name ());
27
27
if (flowRecord .getFlowSourceDirection () != null ) {
28
28
entity .setFlowSourceDirection (flowRecord .getFlowSourceDirection ().name ());
@@ -32,32 +32,34 @@ public static FlowRecordEntity convert(FlowRecord flowRecord, UserRepository use
32
32
entity .setFinishTime (flowRecord .getFinishTime ());
33
33
entity .setTimeoutTime (flowRecord .getTimeoutTime ());
34
34
entity .setPostponedCount (flowRecord .getPostponedCount ());
35
- entity .setCreateOperatorId (flowRecord .getCreateOperatorId ());
35
+ entity .setCreateOperatorId (flowRecord .getCreateOperator (). getUserId ());
36
36
if (flowRecord .getOpinion () != null ) {
37
37
entity .setOpinionAdvice (flowRecord .getOpinion ().getAdvice ());
38
38
entity .setOpinionType (flowRecord .getOpinion ().getType ());
39
39
entity .setOpinionResult (flowRecord .getOpinion ().getResult ());
40
40
}
41
41
42
- entity .setCurrentOperatorName (userRepository .getUserById (flowRecord .getCurrentOperatorId ()).getName ());
43
- entity .setCreateOperatorName (userRepository .getUserById (flowRecord .getCreateOperatorId ()).getName ());
42
+
43
+ entity .setCurrentOperatorName (flowRecord .getCurrentOperator ().getName ());
44
+ entity .setCreateOperatorName (flowRecord .getCreateOperator ().getName ());
44
45
45
46
entity .setFlowStatus (flowRecord .getFlowStatus ().name ());
46
47
entity .setErrMessage (flowRecord .getErrMessage ());
47
48
entity .setBindClass (flowRecord .getBindClass ());
48
49
entity .setSnapshotId (flowRecord .getSnapshotId ());
49
50
entity .setRead (flowRecord .isRead ());
50
51
entity .setInterfere (flowRecord .isInterfere ());
51
- entity .setInterferedOperatorId (flowRecord .getInterferedOperatorId ());
52
- if (flowRecord .isInterfere () && flowRecord .getInterferedOperatorId () > 0 ) {
53
- entity .setInterferedOperatorName (userRepository .getUserById (flowRecord .getInterferedOperatorId ()).getName ());
52
+
53
+ if (flowRecord .getInterferedOperator ()!=null ) {
54
+ entity .setInterferedOperatorId (flowRecord .getInterferedOperator ().getUserId ());
55
+ entity .setInterferedOperatorName (flowRecord .getInterferedOperator ().getName ());
54
56
}
55
57
entity .setReadTime (flowRecord .getReadTime ());
56
58
return entity ;
57
59
}
58
60
59
61
60
- public static FlowRecord convert (FlowRecordEntity entity ) {
62
+ public static FlowRecord convert (FlowRecordEntity entity , UserRepository userRepository ) {
61
63
if (entity == null ) {
62
64
return null ;
63
65
}
@@ -69,15 +71,15 @@ public static FlowRecord convert(FlowRecordEntity entity) {
69
71
flowRecord .setProcessId (entity .getProcessId ());
70
72
flowRecord .setNodeCode (entity .getNodeCode ());
71
73
flowRecord .setTitle (entity .getTitle ());
72
- flowRecord .setCurrentOperatorId ( entity .getCurrentOperatorId ());
74
+ flowRecord .setCurrentOperator ( userRepository . getUserById ( entity .getCurrentOperatorId () ));
73
75
flowRecord .setFlowType (FlowType .parser (entity .getFlowType ()));
74
76
flowRecord .setFlowSourceDirection (FlowSourceDirection .parser (entity .getFlowSourceDirection ()));
75
77
flowRecord .setCreateTime (entity .getCreateTime ());
76
78
flowRecord .setUpdateTime (entity .getUpdateTime ());
77
79
flowRecord .setFinishTime (entity .getFinishTime ());
78
80
flowRecord .setTimeoutTime (entity .getTimeoutTime ());
79
81
flowRecord .setPostponedCount (entity .getPostponedCount ());
80
- flowRecord .setCreateOperatorId ( entity .getCreateOperatorId ());
82
+ flowRecord .setCreateOperator ( userRepository . getUserById ( entity .getCreateOperatorId () ));
81
83
if (entity .getOpinionResult () != null && entity .getOpinionType () != null ) {
82
84
flowRecord .setOpinion (new Opinion (entity .getOpinionAdvice (), entity .getOpinionResult (), entity .getOpinionType ()));
83
85
}
@@ -87,6 +89,9 @@ public static FlowRecord convert(FlowRecordEntity entity) {
87
89
flowRecord .setSnapshotId (entity .getSnapshotId ());
88
90
flowRecord .setRead (entity .getRead ());
89
91
flowRecord .setInterfere (entity .getInterfere ());
92
+ if (entity .getInterferedOperatorId ()!=null ) {
93
+ flowRecord .setInterferedOperator (userRepository .getUserById (entity .getInterferedOperatorId ()));
94
+ }
90
95
flowRecord .setReadTime (entity .getReadTime ());
91
96
return flowRecord ;
92
97
}
0 commit comments