|
@@ -21,6 +21,9 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.List;
|
|
|
+import java.util.concurrent.CountDownLatch;
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
+import java.util.concurrent.Executors;
|
|
|
|
|
|
/**
|
|
|
* SAI开项管理Service业务层处理
|
|
@@ -82,68 +85,85 @@ public class TSaiApplyServiceImpl implements ITSaiApplyService
|
|
|
// }
|
|
|
|
|
|
List<SysDictData> staffUnitDict = iSysDictTypeService.selectDictDataByType("STAFF_UNIT");
|
|
|
+
|
|
|
+ ExecutorService executorService = Executors.newFixedThreadPool(20);
|
|
|
+ final CountDownLatch latch = new CountDownLatch(tSaiApplies.size()); //相同线程数量的计数
|
|
|
+
|
|
|
for (TSaiApply saiApply : tSaiApplies) {
|
|
|
- String applicantDept = saiApply.getApplicantDept();
|
|
|
- String applicant = saiApply.getApplicant();
|
|
|
- String handler = saiApply.getHandler();
|
|
|
- String executor = saiApply.getExecutor();
|
|
|
- if (applicantDept != null) {
|
|
|
- for (SysDictData sysDictData : staffUnitDict) {
|
|
|
- if (sysDictData.getDictValue().equals(applicantDept)) {
|
|
|
- saiApply.setApplicantDeptName(sysDictData.getDictLabel());
|
|
|
+ executorService.execute(() -> {
|
|
|
+ try {
|
|
|
+ String applicantDept = saiApply.getApplicantDept();
|
|
|
+ String applicant = saiApply.getApplicant();
|
|
|
+ String handler = saiApply.getHandler();
|
|
|
+ String executor = saiApply.getExecutor();
|
|
|
+ if (applicantDept != null) {
|
|
|
+ for (SysDictData sysDictData : staffUnitDict) {
|
|
|
+ if (sysDictData.getDictValue().equals(applicantDept)) {
|
|
|
+ saiApply.setApplicantDeptName(sysDictData.getDictLabel());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- if (applicant != null) {
|
|
|
+ if (applicant != null) {
|
|
|
// saiApply.setApplicantName(sysUserMapper.selectUserById(Long.parseLong(applicant)).getNickName());
|
|
|
- SysUser sysUser = sysUserMapper.selectNickNameById(Long.parseLong(applicant));
|
|
|
- if (sysUser!=null) {
|
|
|
- String applicantName = sysUser.getNickName();
|
|
|
- if (applicantName != null && !"null".equals(applicantName)) {
|
|
|
- saiApply.setApplicantName(applicantName);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (handler != null) {
|
|
|
- if (handler.contains(",")) {
|
|
|
- String[] split = handler.split(",");
|
|
|
- StringBuilder handlerName = new StringBuilder();
|
|
|
- for (int i = 0; i < split.length; i++) {
|
|
|
-// handlerName += sysUserMapper.selectUserById(Long.parseLong(split[i])).getNickName();
|
|
|
- SysUser sysUser = sysUserMapper.selectNickNameById(Long.parseLong(split[i]));
|
|
|
+ SysUser sysUser = sysUserMapper.selectNickNameById(Long.parseLong(applicant));
|
|
|
if (sysUser!=null) {
|
|
|
- String name = sysUser.getNickName();
|
|
|
- if (name != null && !"null".equals(name)) {
|
|
|
- handlerName.append(name);
|
|
|
- if (i < split.length - 1) {
|
|
|
- handlerName.append(",");
|
|
|
- }
|
|
|
+ String applicantName = sysUser.getNickName();
|
|
|
+ if (applicantName != null && !"null".equals(applicantName)) {
|
|
|
+ saiApply.setApplicantName(applicantName);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- saiApply.setHandlerName(handlerName.toString());
|
|
|
- } else {
|
|
|
+ if (handler != null) {
|
|
|
+ if (handler.contains(",")) {
|
|
|
+ String[] split = handler.split(",");
|
|
|
+ StringBuilder handlerName = new StringBuilder();
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
+// handlerName += sysUserMapper.selectUserById(Long.parseLong(split[i])).getNickName();
|
|
|
+ SysUser sysUser = sysUserMapper.selectNickNameById(Long.parseLong(split[i]));
|
|
|
+ if (sysUser!=null) {
|
|
|
+ String name = sysUser.getNickName();
|
|
|
+ if (name != null && !"null".equals(name)) {
|
|
|
+ handlerName.append(name);
|
|
|
+ if (i < split.length - 1) {
|
|
|
+ handlerName.append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ saiApply.setHandlerName(handlerName.toString());
|
|
|
+ } else {
|
|
|
// saiApply.setHandlerName(sysUserMapper.selectUserById(Long.parseLong(handler)).getNickName());
|
|
|
- SysUser sysUser = sysUserMapper.selectNickNameById(Long.parseLong(handler));
|
|
|
- if (sysUser!=null) {
|
|
|
- String handlerName = sysUser.getNickName();
|
|
|
- if (handlerName != null && !"null".equals(handlerName)) {
|
|
|
- saiApply.setHandlerName(handlerName);
|
|
|
+ SysUser sysUser = sysUserMapper.selectNickNameById(Long.parseLong(handler));
|
|
|
+ if (sysUser!=null) {
|
|
|
+ String handlerName = sysUser.getNickName();
|
|
|
+ if (handlerName != null && !"null".equals(handlerName)) {
|
|
|
+ saiApply.setHandlerName(handlerName);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- if (executor != null) {
|
|
|
+ if (executor != null) {
|
|
|
// saiApply.setExecutorName(sysUserMapper.selectUserById(Long.parseLong(executor)).getNickName());
|
|
|
- SysUser sysUser = sysUserMapper.selectNickNameById(Long.parseLong(executor));
|
|
|
- if (sysUser!=null) {
|
|
|
- String executorName = sysUser.getNickName();
|
|
|
- if (executorName != null && !"null".equals(executorName)) {
|
|
|
- saiApply.setExecutorName(executorName);
|
|
|
+ SysUser sysUser = sysUserMapper.selectNickNameById(Long.parseLong(executor));
|
|
|
+ if (sysUser!=null) {
|
|
|
+ String executorName = sysUser.getNickName();
|
|
|
+ if (executorName != null && !"null".equals(executorName)) {
|
|
|
+ saiApply.setExecutorName(executorName);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ }finally {
|
|
|
+ latch.countDown(); //线程计数
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ latch.await(); //线程计数完毕后继续执行
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
+ executorService.shutdown();
|
|
|
+
|
|
|
boolean specialRole = this.isSpecialRole();
|
|
|
if (specialRole) { // 当前登录用户是特殊角色
|
|
|
for (TSaiApply saiApply : tSaiApplies) {
|