Browse Source

bug相关

liuyc 1 year ago
parent
commit
d79d006305

+ 14 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/UserViewProjectContractController.java

@@ -14,6 +14,7 @@ import org.apache.commons.lang.StringUtils;
 import org.springblade.business.entity.DefaultProject;
 import org.springblade.business.service.IDefaultProjectService;
 import org.springblade.business.vo.UserVO;
+import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
@@ -166,6 +167,19 @@ public class UserViewProjectContractController {
             //获取当前所有合同段
             List<ContractInfo> contractInfos = this.contractClient.queryContractListByIds(longProjectIds);
 
+            /*//如果没有设置默认项目合同段,那么选择一个设置固定的
+            if (ObjectUtil.isEmpty(defaultProject) || ObjectUtil.isEmpty(defaultContract)) {
+                ProjectInfo projectInfo = projectInfos.get(0); //默认选第一个
+                ContractInfo contractInfo = contractInfos.stream().filter(f -> f.getPId().contains(projectInfo.getId().toString()) && f.getContractType() == 1).findAny().orElse(null);
+                if (projectInfo != null && contractInfo != null) {
+                    defaultProject = projectInfo.getId().toString();
+                    defaultContract = contractInfo.getId().toString();
+                }
+            }
+            if (StringUtils.isEmpty(defaultProject) || StringUtils.isEmpty(defaultContract)) {
+                throw new ServiceException("获取默认项目合同段信息失败,请联系管理员");
+            }*/
+
             //如果是监理,那么移除施工合同段信息
             if (var) {
                 contractInfos.removeIf(next -> next.getContractType() == 1);
@@ -181,7 +195,6 @@ public class UserViewProjectContractController {
                 //用户默认的项目及合同段
                 String finalDefaultProject = defaultProject;
                 String finalDefaultContract = defaultContract;
-
                 projectInfoVOS.forEach(vo -> {
                     //统一返回格式
                     vo.setName(vo.getProjectName());