1010
1111public class FlowRecordConvertor {
1212
13- public static FlowRecordEntity convert (FlowRecord flowRecord , UserRepository userRepository ) {
13+ public static FlowRecordEntity convert (FlowRecord flowRecord ) {
1414 if (flowRecord == null ) {
1515 return null ;
1616 }
@@ -22,7 +22,7 @@ public static FlowRecordEntity convert(FlowRecord flowRecord, UserRepository use
2222 entity .setProcessId (flowRecord .getProcessId ());
2323 entity .setNodeCode (flowRecord .getNodeCode ());
2424 entity .setTitle (flowRecord .getTitle ());
25- entity .setCurrentOperatorId (flowRecord .getCurrentOperatorId ());
25+ entity .setCurrentOperatorId (flowRecord .getCurrentOperator (). getUserId ());
2626 entity .setFlowType (flowRecord .getFlowType ().name ());
2727 if (flowRecord .getFlowSourceDirection () != null ) {
2828 entity .setFlowSourceDirection (flowRecord .getFlowSourceDirection ().name ());
@@ -32,32 +32,34 @@ public static FlowRecordEntity convert(FlowRecord flowRecord, UserRepository use
3232 entity .setFinishTime (flowRecord .getFinishTime ());
3333 entity .setTimeoutTime (flowRecord .getTimeoutTime ());
3434 entity .setPostponedCount (flowRecord .getPostponedCount ());
35- entity .setCreateOperatorId (flowRecord .getCreateOperatorId ());
35+ entity .setCreateOperatorId (flowRecord .getCreateOperator (). getUserId ());
3636 if (flowRecord .getOpinion () != null ) {
3737 entity .setOpinionAdvice (flowRecord .getOpinion ().getAdvice ());
3838 entity .setOpinionType (flowRecord .getOpinion ().getType ());
3939 entity .setOpinionResult (flowRecord .getOpinion ().getResult ());
4040 }
4141
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 ());
4445
4546 entity .setFlowStatus (flowRecord .getFlowStatus ().name ());
4647 entity .setErrMessage (flowRecord .getErrMessage ());
4748 entity .setBindClass (flowRecord .getBindClass ());
4849 entity .setSnapshotId (flowRecord .getSnapshotId ());
4950 entity .setRead (flowRecord .isRead ());
5051 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 ());
5456 }
5557 entity .setReadTime (flowRecord .getReadTime ());
5658 return entity ;
5759 }
5860
5961
60- public static FlowRecord convert (FlowRecordEntity entity ) {
62+ public static FlowRecord convert (FlowRecordEntity entity , UserRepository userRepository ) {
6163 if (entity == null ) {
6264 return null ;
6365 }
@@ -69,15 +71,15 @@ public static FlowRecord convert(FlowRecordEntity entity) {
6971 flowRecord .setProcessId (entity .getProcessId ());
7072 flowRecord .setNodeCode (entity .getNodeCode ());
7173 flowRecord .setTitle (entity .getTitle ());
72- flowRecord .setCurrentOperatorId ( entity .getCurrentOperatorId ());
74+ flowRecord .setCurrentOperator ( userRepository . getUserById ( entity .getCurrentOperatorId () ));
7375 flowRecord .setFlowType (FlowType .parser (entity .getFlowType ()));
7476 flowRecord .setFlowSourceDirection (FlowSourceDirection .parser (entity .getFlowSourceDirection ()));
7577 flowRecord .setCreateTime (entity .getCreateTime ());
7678 flowRecord .setUpdateTime (entity .getUpdateTime ());
7779 flowRecord .setFinishTime (entity .getFinishTime ());
7880 flowRecord .setTimeoutTime (entity .getTimeoutTime ());
7981 flowRecord .setPostponedCount (entity .getPostponedCount ());
80- flowRecord .setCreateOperatorId ( entity .getCreateOperatorId ());
82+ flowRecord .setCreateOperator ( userRepository . getUserById ( entity .getCreateOperatorId () ));
8183 if (entity .getOpinionResult () != null && entity .getOpinionType () != null ) {
8284 flowRecord .setOpinion (new Opinion (entity .getOpinionAdvice (), entity .getOpinionResult (), entity .getOpinionType ()));
8385 }
@@ -87,6 +89,9 @@ public static FlowRecord convert(FlowRecordEntity entity) {
8789 flowRecord .setSnapshotId (entity .getSnapshotId ());
8890 flowRecord .setRead (entity .getRead ());
8991 flowRecord .setInterfere (entity .getInterfere ());
92+ if (entity .getInterferedOperatorId ()!=null ) {
93+ flowRecord .setInterferedOperator (userRepository .getUserById (entity .getInterferedOperatorId ()));
94+ }
9095 flowRecord .setReadTime (entity .getReadTime ());
9196 return flowRecord ;
9297 }
0 commit comments