|
@@ -20,6 +20,7 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.mixsmart.utils.StringUtils;
|
|
|
+import feign.Contract;
|
|
|
import io.swagger.annotations.*;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import lombok.AllArgsConstructor;
|
|
@@ -32,9 +33,8 @@ import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
|
|
|
-import org.springblade.manager.entity.ContractInfo;
|
|
|
-import org.springblade.manager.entity.ProjectInfo;
|
|
|
-import org.springblade.manager.entity.SignPfxDeputy;
|
|
|
+import org.springblade.manager.entity.*;
|
|
|
+import org.springblade.manager.feign.ProjectAssignmentUserClient;
|
|
|
import org.springblade.manager.service.*;
|
|
|
import org.springblade.manager.vo.*;
|
|
|
import org.springblade.system.entity.DictBiz;
|
|
@@ -47,7 +47,6 @@ import org.springblade.system.vo.RoleVO;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import org.springblade.manager.entity.SignPfxFile;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
@@ -84,6 +83,8 @@ public class SignPfxFileController extends BladeController {
|
|
|
|
|
|
private final IUserClient userClient;
|
|
|
|
|
|
+ private final ProjectAssignmentUserClient projectAssignmentUserClient;
|
|
|
+
|
|
|
/**
|
|
|
* 根据合同段ID获取项目下的所有合同段
|
|
|
* @return 结果
|
|
@@ -307,7 +308,41 @@ public class SignPfxFileController extends BladeController {
|
|
|
@ApiOperationSupport(order = 8)
|
|
|
@ApiOperation(value = "获取所有有效项目")
|
|
|
public R<List<ProjectInfo>> queryProjectList(){
|
|
|
- return R.data(this.projectInfoService.list(Wrappers.<ProjectInfo>lambdaQuery().eq(ProjectInfo::getIsDeleted, 0)));
|
|
|
+ List<ProjectInfo> projectInfos = this.projectInfoService.list(Wrappers.<ProjectInfo>lambdaQuery().eq(ProjectInfo::getIsDeleted, 0));
|
|
|
+
|
|
|
+ Iterator<ProjectInfo> iterator = projectInfos.iterator();
|
|
|
+ while (iterator.hasNext()){
|
|
|
+ ProjectInfo next = iterator.next();
|
|
|
+ //首先先看是否有项目证书
|
|
|
+ long count = this.signPfxFileService.count(Wrappers.<SignPfxFile>lambdaQuery().like(SignPfxFile::getProjectContractRole, next.getId()));
|
|
|
+ if(count <= 0){
|
|
|
+ //如果没有项目证书,再查询项目人员是否有个人证书
|
|
|
+ List<ContractInfo> contracts = this.contractInfoService.selectContractInfoPageByPid(next.getId().toString());
|
|
|
+ if(contracts != null && contracts.size() > 0){
|
|
|
+ boolean remove = true;
|
|
|
+ //循环合同段,只要有一个合同段的人员有数据
|
|
|
+ for(ContractInfo contract : contracts){
|
|
|
+ List<SaveUserInfoByProjectDTO> users = this.projectAssignmentUserClient.queryContractDownAllUser(contract.getId().toString());
|
|
|
+ if(users != null && users.size() > 0){
|
|
|
+ //获取人员ID
|
|
|
+ List<String> userList = users.stream().map(SaveUserInfoByProjectDTO::getUserId).distinct().collect(Collectors.toList());
|
|
|
+ count = this.signPfxFileService.count(Wrappers.<SignPfxFile>lambdaQuery().in(SignPfxFile::getCertificateUserId, userList));
|
|
|
+ if(count > 0){
|
|
|
+ //只要有一个,保留
|
|
|
+ remove = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(remove){
|
|
|
+ //找不到个人证书,删除当前项目
|
|
|
+ iterator.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.data(projectInfos);
|
|
|
}
|
|
|
|
|
|
/**
|