|
@@ -20,10 +20,12 @@ import com.zjugis.business.service.ContractService;
|
|
|
import com.zjugis.business.service.ProjectService;
|
|
|
import com.zjugis.framework.common.exception.ServiceException;
|
|
|
import com.zjugis.framework.common.pojo.CommonResult;
|
|
|
+import com.zjugis.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
import com.zjugis.framework.workflow.rpc.remote.WorkflowClient;
|
|
|
import com.zjugis.module.system.api.dept.DeptApi;
|
|
|
import com.zjugis.module.system.api.dept.dto.DeptRespDTO;
|
|
|
import com.zjugis.module.system.api.user.AdminUserApi;
|
|
|
+import com.zjugis.module.system.api.user.dto.AdminUserRespDTO;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -32,11 +34,16 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDate;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
+import static com.zjugis.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
+import static com.zjugis.module.system.enums.ErrorCodeConstants.AUTH_LOGIN_USER_UNLOGIN;
|
|
|
+
|
|
|
/**
|
|
|
* 项目表(Project)表服务实现类
|
|
|
*
|
|
@@ -336,5 +343,61 @@ public class ProjectServiceImpl implements ProjectService {
|
|
|
public List<String> selectAllIds() {
|
|
|
return projectMapper.selectAllIds();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ButtonResp infoButton(String projectId) {
|
|
|
+ String loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
+ if(StringUtils.isBlank(loginUserId)){
|
|
|
+ throw exception(AUTH_LOGIN_USER_UNLOGIN);
|
|
|
+ }
|
|
|
+ ButtonResp buttonResp = new ButtonResp();
|
|
|
+ ProjectResponse project = selectWithChildren(projectId);
|
|
|
+ String deptId = project.getZrbmId();
|
|
|
+ boolean xsry = loginUserId.equals(project.getXsryId());
|
|
|
+ boolean xmLeader = loginUserId.equals(project.getXmjlId());
|
|
|
+ boolean deptLeader = false,leaderLeader = false,segLeader = false;
|
|
|
+ if (StringUtils.isNotBlank(deptId)) {
|
|
|
+ DeptRespDTO dept = deptApi.getDept(deptId).getCheckedData();
|
|
|
+ if (dept != null && StringUtils.isNotBlank(dept.getLeaderUserId())) {
|
|
|
+ deptLeader = loginUserId.equals(dept.getLeaderUserId());
|
|
|
+ CommonResult<AdminUserRespDTO> userLeader = adminUserApi.getUserLeader(dept.getLeaderUserId());
|
|
|
+ String leaderLeaderId = userLeader.getCheckedData().getId();
|
|
|
+ leaderLeader = loginUserId.equals(leaderLeaderId);
|
|
|
+ }
|
|
|
+ DeptRespDTO secondDept = deptApi.getSecondDeptByDeptId(deptId).getCheckedData();
|
|
|
+ if (secondDept != null && StringUtils.isNotBlank(secondDept.getLeaderUserId())) {
|
|
|
+ segLeader = loginUserId.equals(secondDept.getLeaderUserId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(leaderLeader || segLeader){
|
|
|
+ buttonResp.setAll(true);
|
|
|
+ return buttonResp;
|
|
|
+ }
|
|
|
+ if(xmLeader || deptLeader){
|
|
|
+ buttonResp.setXmLeader(true);
|
|
|
+ }
|
|
|
+ if(xsry || deptLeader){
|
|
|
+ buttonResp.setXsLeader(true);
|
|
|
+ }
|
|
|
+ List<ProjectResponse> children = project.getChildren();
|
|
|
+ Map<String,Boolean> childBtn = new HashMap<>();
|
|
|
+ for (ProjectResponse child : children) {
|
|
|
+ boolean show = false;
|
|
|
+ if(loginUserId.equals(child.getXmjlId())){
|
|
|
+ show = true;
|
|
|
+ } else if(StringUtils.isNotBlank(child.getZrbmId())){
|
|
|
+ DeptRespDTO dept = deptApi.getDept(child.getZrbmId()).getCheckedData();
|
|
|
+ if (dept != null && StringUtils.isNotBlank(dept.getLeaderUserId())) {
|
|
|
+ show = loginUserId.equals(dept.getLeaderUserId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ childBtn.put(child.getId(),show);
|
|
|
+ }
|
|
|
+ buttonResp.setChildButton(childBtn);
|
|
|
+ return buttonResp;
|
|
|
+ }
|
|
|
}
|
|
|
|