|
9 | 9 | import com.codingapi.springboot.flow.error.OperatorResult;
|
10 | 10 | import com.codingapi.springboot.flow.pojo.FlowResult;
|
11 | 11 | import com.codingapi.springboot.flow.pojo.FlowSubmitResult;
|
| 12 | +import com.codingapi.springboot.flow.query.FlowRecordQuery; |
12 | 13 | import com.codingapi.springboot.flow.record.FlowRecord;
|
13 | 14 | import com.codingapi.springboot.flow.result.MessageResult;
|
14 | 15 | import com.codingapi.springboot.flow.service.FlowService;
|
@@ -67,8 +68,13 @@ public Object getBean(String beanName) {
|
67 | 68 | }
|
68 | 69 |
|
69 | 70 |
|
| 71 | + public <T> T getBean(Class<T> clazz) { |
| 72 | + return provider.getBean(clazz); |
| 73 | + } |
| 74 | + |
| 75 | + |
70 | 76 | /**
|
71 |
| - * 获取审批意见 |
| 77 | + * 获取审批意见 |
72 | 78 | */
|
73 | 79 | public String getAdvice() {
|
74 | 80 | if (opinion != null) {
|
@@ -179,16 +185,18 @@ public MessageResult rejectFlow() {
|
179 | 185 |
|
180 | 186 | /**
|
181 | 187 | * 是否为驳回状态
|
| 188 | + * |
182 | 189 | * @return 是否为驳回状态
|
183 | 190 | */
|
184 |
| - public boolean isRejectState(){ |
185 |
| - List<FlowRecord> historyRecords = this.historyRecords; |
186 |
| - if(historyRecords!=null) { |
187 |
| - for (FlowRecord record : historyRecords) { |
188 |
| - if (record.getId() == this.flowRecord.getPreId()) { |
189 |
| - return record.getFlowSourceDirection() == FlowSourceDirection.REJECT; |
190 |
| - } |
191 |
| - } |
| 191 | + public boolean isRejectState() { |
| 192 | + long preId = flowRecord.getPreId(); |
| 193 | + if (preId == 0) { |
| 194 | + return false; |
| 195 | + } |
| 196 | + FlowRecordQuery flowRecordQuery = getBean(FlowRecordQuery.class); |
| 197 | + FlowRecord preRecord = flowRecordQuery.getFlowRecordById(preId); |
| 198 | + if (preRecord != null) { |
| 199 | + return preRecord.getFlowSourceDirection() == FlowSourceDirection.REJECT; |
192 | 200 | }
|
193 | 201 | return false;
|
194 | 202 | }
|
|
0 commit comments