|
@@ -17,15 +17,11 @@ import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
|
|
|
-import org.springblade.manager.entity.ContractInfo;
|
|
|
-import org.springblade.manager.entity.ProjectInfo;
|
|
|
-import org.springblade.manager.entity.SignPfxFile;
|
|
|
-import org.springblade.manager.feign.ContractClient;
|
|
|
-import org.springblade.manager.feign.ProjectAssignmentUserClient;
|
|
|
-import org.springblade.manager.feign.ProjectClient;
|
|
|
-import org.springblade.manager.feign.SignPfxClient;
|
|
|
+import org.springblade.manager.entity.*;
|
|
|
+import org.springblade.manager.feign.*;
|
|
|
import org.springblade.manager.vo.ContractInfoVO;
|
|
|
import org.springblade.manager.vo.ProjectInfoVO;
|
|
|
+import org.springblade.manager.vo.ProjectInfoWbsTypeVO;
|
|
|
import org.springblade.system.feign.ISysClient;
|
|
|
import org.springblade.system.user.entity.User;
|
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
@@ -33,6 +29,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.Iterator;
|
|
|
import java.util.List;
|
|
@@ -58,18 +56,20 @@ public class UserViewProjectContractController {
|
|
|
|
|
|
private final SignPfxClient signPfxClient;
|
|
|
|
|
|
+ private final WbsInfoClient wbsInfoClient;
|
|
|
+
|
|
|
/**
|
|
|
* 获取用户信息
|
|
|
*/
|
|
|
@PostMapping("/queryCurrentUserData")
|
|
|
@ApiOperationSupport(order = 2)
|
|
|
@ApiOperation(value = "获取用户信息")
|
|
|
- public R<UserVO> queryCurrentUserData(){
|
|
|
+ public R<UserVO> queryCurrentUserData() {
|
|
|
User user = this.userClient.userInfoById(AuthUtil.getUserId()).getData();
|
|
|
- if(user != null){
|
|
|
+ if (user != null) {
|
|
|
//获取部门
|
|
|
List<String> deptNames = this.sysClient.getDeptNames(user.getDeptId()).getData();
|
|
|
- if(deptNames != null && deptNames.size() > 0){
|
|
|
+ if (deptNames != null && deptNames.size() > 0) {
|
|
|
user.setDeptId(String.join(",", deptNames));
|
|
|
}
|
|
|
//数据对拷
|
|
@@ -78,13 +78,13 @@ public class UserViewProjectContractController {
|
|
|
|
|
|
//获取个人签字文件
|
|
|
List<SignPfxFile> pfxFiles = this.signPfxClient.querySignPfxByUserIdOrContractId(user.getId().toString(), "");
|
|
|
- if(pfxFiles != null && pfxFiles.size() > 0){
|
|
|
+ if (pfxFiles != null && pfxFiles.size() > 0) {
|
|
|
userVO.setSignatureUrl(pfxFiles.get(0).getSignatureFileUrl());
|
|
|
}
|
|
|
//获取角色信息
|
|
|
- if(StringUtils.isNotEmpty(userVO.getRoleId())){
|
|
|
+ if (StringUtils.isNotEmpty(userVO.getRoleId())) {
|
|
|
List<String> roleNames = this.sysClient.getRoleNames(userVO.getRoleId()).getData();
|
|
|
- if(roleNames != null && roleNames.size() > 0){
|
|
|
+ if (roleNames != null && roleNames.size() > 0) {
|
|
|
userVO.setRoleName(String.join(",", roleNames));
|
|
|
}
|
|
|
}
|
|
@@ -95,27 +95,28 @@ public class UserViewProjectContractController {
|
|
|
|
|
|
/**
|
|
|
* 获取客户端首页当前用户关联的项目及合同段信息
|
|
|
+ *
|
|
|
* @return 项目及合同段结果集
|
|
|
*/
|
|
|
@GetMapping("/queryUserViewProjectAndContract")
|
|
|
@ApiOperationSupport(order = 1)
|
|
|
@ApiOperation(value = "获取客户端首页当前用户关联的项目及合同段信息")
|
|
|
- public R<List<ProjectInfoVO>> queryUserViewProjectAndContract(){
|
|
|
+ public R<List<ProjectInfoVO>> queryUserViewProjectAndContract() {
|
|
|
BladeUser user = AuthUtil.getUser();
|
|
|
- if(user == null){
|
|
|
+ if (user == null) {
|
|
|
return R.data(null);
|
|
|
}
|
|
|
//获取当前用户的默认项目
|
|
|
- List<DefaultProject> defaultProjects = this.defaultProjectService.list(Wrappers.<DefaultProject>lambdaQuery().eq(DefaultProject::getUserId, AuthUtil.getUserId().toString()));
|
|
|
+ List<DefaultProject> defaultProjects = this.defaultProjectService.list(Wrappers.<DefaultProject>lambdaQuery().eq(DefaultProject::getUserId, AuthUtil.getUserId().toString()));
|
|
|
String defaultProject = null, defaultContract = null;
|
|
|
- if(defaultProjects != null && defaultProjects.size() > 0){
|
|
|
+ if (defaultProjects != null && defaultProjects.size() > 0) {
|
|
|
defaultProject = defaultProjects.get(0).getProjectId();
|
|
|
defaultContract = defaultProjects.get(0).getContractId();
|
|
|
}
|
|
|
|
|
|
//获取当前用户的所有相关项目及合同段ID
|
|
|
List<SaveUserInfoByProjectDTO> userDownAll = this.projectAssignmentUserClient.queryCurrentUserDownAllContractAndProjectId(user.getUserId());
|
|
|
- if(userDownAll.size() == 0){
|
|
|
+ if (userDownAll.size() == 0) {
|
|
|
return R.data(null);
|
|
|
}
|
|
|
|
|
@@ -126,14 +127,28 @@ public class UserViewProjectContractController {
|
|
|
|
|
|
//获取项目列表
|
|
|
List<ProjectInfo> projectInfos = this.projectClient.queryProjectList(projectIds);
|
|
|
- if(projectInfos != null && projectInfos.size() != 0){
|
|
|
+ if (projectInfos != null && projectInfos.size() != 0) {
|
|
|
List<Long> longProjectIds = projectInfos.stream().map(ProjectInfo::getId).distinct().collect(Collectors.toList());
|
|
|
//获取当前所有合同段
|
|
|
List<ContractInfo> contractInfos = this.contractClient.queryContractListByIds(longProjectIds);
|
|
|
|
|
|
+ //wbsType
|
|
|
+ List<ProjectInfoWbsTypeVO> wbsTypeVOList = new ArrayList<>();
|
|
|
+ for (ProjectInfo projectInfo : projectInfos) {
|
|
|
+ ProjectInfoWbsTypeVO projectInfoWbsTypeVO = new ProjectInfoWbsTypeVO();
|
|
|
+ Integer wbsType = wbsInfoClient.getWbsTypeByPrivateWbsId(projectInfo.getReferenceWbsTemplateId());
|
|
|
+ if (wbsType == null) {
|
|
|
+ projectInfoWbsTypeVO.setWbsType(-1);
|
|
|
+ } else {
|
|
|
+ projectInfoWbsTypeVO.setWbsType(wbsType);
|
|
|
+ }
|
|
|
+ projectInfoWbsTypeVO.setProjectId(projectInfo.getId());
|
|
|
+ wbsTypeVOList.add(projectInfoWbsTypeVO);
|
|
|
+ }
|
|
|
+
|
|
|
//转换VO
|
|
|
List<ProjectInfoVO> projectInfoVOS = JSONArray.parseArray(JSONObject.toJSONString(projectInfos), ProjectInfoVO.class);
|
|
|
- if(contractInfos != null && contractInfos.size() != 0){
|
|
|
+ if (contractInfos != null && contractInfos.size() != 0) {
|
|
|
//转换VO
|
|
|
List<ContractInfoVO> contractInfoVOS = JSONArray.parseArray(JSONObject.toJSONString(contractInfos), ContractInfoVO.class);
|
|
|
contractInfoVOS.removeIf(vo -> !contractIds.contains(String.valueOf(vo.getId())));
|
|
@@ -143,18 +158,25 @@ public class UserViewProjectContractController {
|
|
|
String finalDefaultContract = defaultContract;
|
|
|
|
|
|
projectInfoVOS.forEach(vo -> {
|
|
|
+ //wbsType
|
|
|
+ for (ProjectInfoWbsTypeVO projectInfoWbsTypeVO : wbsTypeVOList) {
|
|
|
+ if (vo.getId().equals(projectInfoWbsTypeVO.getProjectId())) {
|
|
|
+ vo.setWbsType(projectInfoWbsTypeVO.getWbsType());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//统一返回格式
|
|
|
vo.setName(vo.getProjectName());
|
|
|
vo.setIsDefault(StringUtils.isNotEmpty(finalDefaultProject) && vo.getId().toString().equals(finalDefaultProject) ? 1 : 0);
|
|
|
|
|
|
Iterator<ContractInfoVO> iterator = contractInfoVOS.iterator();
|
|
|
- while (iterator.hasNext()){
|
|
|
+ while (iterator.hasNext()) {
|
|
|
ContractInfoVO next = iterator.next();
|
|
|
//统一返回格式
|
|
|
next.setName(next.getContractName());
|
|
|
|
|
|
//找到对应的合同段
|
|
|
- if(String.valueOf(vo.getId()).equals(String.valueOf(next.getPId()))){
|
|
|
+ if (String.valueOf(vo.getId()).equals(String.valueOf(next.getPId()))) {
|
|
|
next.setIsDefault(StringUtils.isNotEmpty(finalDefaultContract) && next.getId().toString().equals(finalDefaultContract) ? 1 : 0);
|
|
|
vo.getContractInfoList().add(next);
|
|
|
iterator.remove();
|