|
|
@@ -18,10 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
18
|
18
|
import org.springframework.stereotype.Service;
|
|
19
|
19
|
import tk.mybatis.mapper.entity.Example;
|
|
20
|
20
|
|
|
21
|
|
-import java.util.ArrayList;
|
|
22
|
|
-import java.util.HashMap;
|
|
23
|
|
-import java.util.List;
|
|
24
|
|
-import java.util.Map;
|
|
|
21
|
+import java.util.*;
|
|
25
|
22
|
import java.util.stream.Collectors;
|
|
26
|
23
|
|
|
27
|
24
|
@Service
|
|
|
@@ -270,4 +267,64 @@ public class CaseFlowServiceImpl implements CaseFlowService {
|
|
270
|
267
|
}
|
|
271
|
268
|
return false;
|
|
272
|
269
|
}
|
|
|
270
|
+
|
|
|
271
|
+ /**
|
|
|
272
|
+ * 查询用户角色关联的案件状态
|
|
|
273
|
+ *
|
|
|
274
|
+ * @param roles
|
|
|
275
|
+ * @return
|
|
|
276
|
+ */
|
|
|
277
|
+ @Override
|
|
|
278
|
+ public Set<Integer> getCaseStatusIdByRoleKey(Set<String> roles) {
|
|
|
279
|
+ boolean isall = false;
|
|
|
280
|
+ List<Long> roleIds = new ArrayList<>();
|
|
|
281
|
+ //TODO
|
|
|
282
|
+// if (roles != null && roles.size() > 0) {
|
|
|
283
|
+// for (String role : roles) {
|
|
|
284
|
+// if (role.equals("admin")) {
|
|
|
285
|
+// isall = true;
|
|
|
286
|
+// break;
|
|
|
287
|
+// }
|
|
|
288
|
+// }
|
|
|
289
|
+// }
|
|
|
290
|
+ if (!isall) {
|
|
|
291
|
+ for (String rolekey : roles) {
|
|
|
292
|
+ SysRole sysRole = sysRoleMapper.checkRoleKeyUnique(rolekey);
|
|
|
293
|
+ if (sysRole != null) {
|
|
|
294
|
+ roleIds.add(sysRole.getRoleId());
|
|
|
295
|
+ }
|
|
|
296
|
+ }
|
|
|
297
|
+ }
|
|
|
298
|
+ /**
|
|
|
299
|
+ * 查询角色的案件状态id
|
|
|
300
|
+ */
|
|
|
301
|
+ Set<Integer> caseStatusIds = getCaseStatusIdByRoleId(roleIds, isall);
|
|
|
302
|
+ return caseStatusIds;
|
|
|
303
|
+ }
|
|
|
304
|
+
|
|
|
305
|
+ /**
|
|
|
306
|
+ * 查询角色的案件状态id
|
|
|
307
|
+ *
|
|
|
308
|
+ * @param roleIds
|
|
|
309
|
+ * @param isall
|
|
|
310
|
+ * @return
|
|
|
311
|
+ */
|
|
|
312
|
+ private Set<Integer> getCaseStatusIdByRoleId(List<Long> roleIds, boolean isall) {
|
|
|
313
|
+ Set<Integer> result = new HashSet<>();
|
|
|
314
|
+ Example example = new Example(MsCaseFlowRoleRelated.class);
|
|
|
315
|
+ Example.Criteria criteria = example.createCriteria();
|
|
|
316
|
+ if (isall) {
|
|
|
317
|
+ List<MsCaseFlowRoleRelated> msCaseFlowRoleRelateds = msCaseFlowRoleRelatedMapper.selectAll();
|
|
|
318
|
+ if (msCaseFlowRoleRelateds != null && msCaseFlowRoleRelateds.size() > 0) {
|
|
|
319
|
+ result = msCaseFlowRoleRelateds.stream().filter(s -> s.getFlowId() != null).map(MsCaseFlowRoleRelated::getFlowId).collect(Collectors.toSet());
|
|
|
320
|
+ }
|
|
|
321
|
+ } else if (roleIds != null && roleIds.size() > 0) {
|
|
|
322
|
+ criteria.andIn("roleid", roleIds);
|
|
|
323
|
+ List<MsCaseFlowRoleRelated> msCaseFlowRoleRelateds = msCaseFlowRoleRelatedMapper.selectByExample(example);
|
|
|
324
|
+ if (msCaseFlowRoleRelateds != null && msCaseFlowRoleRelateds.size() > 0) {
|
|
|
325
|
+ result = msCaseFlowRoleRelateds.stream().filter(s -> s.getFlowId() != null).map(MsCaseFlowRoleRelated::getFlowId).collect(Collectors.toSet());
|
|
|
326
|
+ }
|
|
|
327
|
+ }
|
|
|
328
|
+ return result;
|
|
|
329
|
+ }
|
|
273
|
330
|
}
|