|
@@ -10,8 +10,11 @@ import com.wtkj.service.IProjectStageService;
|
|
import com.wtkj.service.ITypeAndStageService;
|
|
import com.wtkj.service.ITypeAndStageService;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
import org.springblade.core.secure.BladeUser;
|
|
import org.springblade.core.secure.BladeUser;
|
|
|
|
+import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.utils.DateUtil;
|
|
import org.springblade.core.tool.utils.DateUtil;
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
|
+import org.springblade.system.entity.Dept;
|
|
|
|
+import org.springblade.system.feign.ISysClient;
|
|
import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
@@ -19,6 +22,8 @@ import org.springframework.util.CollectionUtils;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
+import static com.wtkj.config.MagicValue.ZERO;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @author Blizzard
|
|
* @author Blizzard
|
|
* @create at 2023-09-13 16:32
|
|
* @create at 2023-09-13 16:32
|
|
@@ -31,6 +36,7 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
private final ITypeAndStageService typeAndStageService;
|
|
private final ITypeAndStageService typeAndStageService;
|
|
private final IProjectStageService stageService;
|
|
private final IProjectStageService stageService;
|
|
private final IProjectAuthService projectAuthService;
|
|
private final IProjectAuthService projectAuthService;
|
|
|
|
+ private final ISysClient sysClient;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -67,6 +73,16 @@ public class AsyncServiceImpl implements IAsyncService {
|
|
if (!deptId.equals(project.getCompetentUnit())) {
|
|
if (!deptId.equals(project.getCompetentUnit())) {
|
|
ProjectAuth auth = new ProjectAuth();
|
|
ProjectAuth auth = new ProjectAuth();
|
|
auth.setUserId(user.getUserId());
|
|
auth.setUserId(user.getUserId());
|
|
|
|
+ R<Dept> rpc = sysClient.getDept(deptId);
|
|
|
|
+ if (rpc.isSuccess()) {
|
|
|
|
+ String ancestors = rpc.getData().getAncestors();
|
|
|
|
+ if (ancestors != null && ancestors.contains(String.valueOf(ZERO))) {
|
|
|
|
+ List<Long> longList = Func.toLongList(ancestors);
|
|
|
|
+ if (!CollectionUtils.isEmpty(longList) && longList.size() > 2) {
|
|
|
|
+ auth.setTopDept(longList.get(1));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
auth.setUserDept(deptId);
|
|
auth.setUserDept(deptId);
|
|
auth.setProjectId(project.getId());
|
|
auth.setProjectId(project.getId());
|
|
projectAuthService.save(auth);
|
|
projectAuthService.save(auth);
|