|
@@ -19,6 +19,7 @@ package org.springblade.manager.controller;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.mixsmart.utils.StringUtils;
|
|
|
import io.swagger.annotations.*;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import lombok.AllArgsConstructor;
|
|
@@ -74,6 +75,18 @@ public class SignPfxFileController extends BladeController {
|
|
|
|
|
|
private final ISignPfxDeputyService signPfxDeputyService;
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据合同段ID获取项目下的所有合同段
|
|
|
+ * @return 结果
|
|
|
+ */
|
|
|
+ @GetMapping("/queryContractList")
|
|
|
+ @ApiOperationSupport(order = 13)
|
|
|
+ @ApiOperation(value = "根据合同段ID获取项目下的所有合同段")
|
|
|
+ public R<List<ContractInfo>> queryContractList(@RequestParam String contractId){
|
|
|
+ ContractInfo contractInfo = this.contractInfoService.getById(contractId);
|
|
|
+ return R.data(this.contractInfoService.list(Wrappers.<ContractInfo>lambdaQuery().eq(ContractInfo::getPId, contractInfo.getPId())));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取当前系统下分配的一级角色
|
|
|
* @return 结果
|
|
@@ -152,15 +165,34 @@ public class SignPfxFileController extends BladeController {
|
|
|
|
|
|
//返回结果
|
|
|
List<RoleSignPfxUserVO> result = new ArrayList<>();
|
|
|
+
|
|
|
//企业章
|
|
|
-// RoleSignPfxUserVO pfxUnitVo = new RoleSignPfxUserVO();
|
|
|
-// pfxUnitVo.setRoleId(1L);
|
|
|
-// pfxUnitVo.setRoleName("单位证书");
|
|
|
-// List<SignPfxFile> unitPfxList = this.signPfxFileService.list(Wrappers.<SignPfxFile>lambdaQuery().eq(SignPfxFile::getContractId, contractId).eq(SignPfxFile::getIsDeleted, 0));
|
|
|
-// if(unitPfxList != null && unitPfxList.size() > 0){
|
|
|
-// pfxUnitVo.setSignPfxFileList(unitPfxList);
|
|
|
-// }
|
|
|
-// result.add(pfxUnitVo);
|
|
|
+ RoleSignPfxUserVO pfxUnitVo = new RoleSignPfxUserVO();
|
|
|
+ pfxUnitVo.setRoleId(1L);
|
|
|
+ pfxUnitVo.setRoleName("单位证书");
|
|
|
+ List<SignPfxFile> unitPfxList = this.signPfxFileService.list(Wrappers.<SignPfxFile>lambdaQuery().like(SignPfxFile::getProjectContractRole, contractId));
|
|
|
+ if(unitPfxList != null && unitPfxList.size() > 0){
|
|
|
+ RoleSignPfxUserVO pfxChildUnitVo = new RoleSignPfxUserVO();
|
|
|
+ pfxChildUnitVo.setRoleId(2L);
|
|
|
+ pfxChildUnitVo.setRoleName("单位证书");
|
|
|
+ pfxChildUnitVo.setSignPfxFileList(unitPfxList);
|
|
|
+ List<RoleSignPfxUserVO> list = new ArrayList<>();
|
|
|
+ list.add(pfxChildUnitVo);
|
|
|
+ pfxUnitVo.setChildRoleList(list);
|
|
|
+ }
|
|
|
+ result.add(pfxUnitVo);
|
|
|
+
|
|
|
+ //单独处理管理员
|
|
|
+ RoleVO adminRole = null;
|
|
|
+ Iterator<RoleVO> adminIterator = roleVOS.iterator();
|
|
|
+ while (adminIterator.hasNext()){
|
|
|
+ RoleVO next = adminIterator.next();
|
|
|
+ if("管理员".equals(next.getRoleName()) || "超级管理员".equals(next.getRoleName())){
|
|
|
+ adminRole = next;
|
|
|
+ adminIterator.remove();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//循环角色,对项目人员进行分组
|
|
|
for(RoleVO vo : roleVOS){
|
|
@@ -203,6 +235,42 @@ public class SignPfxFileController extends BladeController {
|
|
|
result.add(pfxUserVo);
|
|
|
}
|
|
|
|
|
|
+ //专门处理管理员
|
|
|
+ if(adminRole != null){
|
|
|
+ //设置实体
|
|
|
+ RoleSignPfxUserVO pfxUserVo = new RoleSignPfxUserVO();
|
|
|
+ pfxUserVo.setRoleId(adminRole.getId());
|
|
|
+ pfxUserVo.setRoleName(adminRole.getRoleName());
|
|
|
+
|
|
|
+ RoleSignPfxUserVO adminVo = new RoleSignPfxUserVO();
|
|
|
+ adminVo.setRoleId(adminRole.getId());
|
|
|
+ adminVo.setRoleName(adminRole.getRoleName());
|
|
|
+
|
|
|
+ if(contractUserList != null && contractUserList.size() > 0){
|
|
|
+ Iterator<SaveUserInfoByProjectDTO> iterator = contractUserList.iterator();
|
|
|
+ while (iterator.hasNext()){
|
|
|
+ SaveUserInfoByProjectDTO next = iterator.next();
|
|
|
+
|
|
|
+ if(next.getRoleId().equals(adminVo.getRoleId().toString())){
|
|
|
+ //角色相符
|
|
|
+ SignPfxFile userSignPfx = this.signPfxFileService.getOne(Wrappers.<SignPfxFile>lambdaQuery().eq(SignPfxFile::getCertificateUserId, next.getUserId()));
|
|
|
+ if(userSignPfx == null){
|
|
|
+ iterator.remove();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ //存在证书则设置进结果对象的证书集合中
|
|
|
+ adminVo.getSignPfxFileList().add(userSignPfx);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<RoleSignPfxUserVO> list = new ArrayList<>();
|
|
|
+ list.add(adminVo);
|
|
|
+ pfxUserVo.setChildRoleList(list);
|
|
|
+
|
|
|
+ result.add(pfxUserVo);
|
|
|
+ }
|
|
|
+
|
|
|
return R.data(result);
|
|
|
}
|
|
|
|
|
@@ -223,11 +291,11 @@ public class SignPfxFileController extends BladeController {
|
|
|
@ApiOperationSupport(order = 7)
|
|
|
@ApiOperation(value = "证书管理分页")
|
|
|
@ApiImplicitParam(name = "vo", value = "必传current、size, 选传projectId")
|
|
|
- public R<IPage<SingPfxManagementVO>> singPfxManagementPage(@RequestParam Integer current, @RequestParam Integer size, @RequestParam Long contractId){
|
|
|
+ public R<IPage<SingPfxManagementVO>> singPfxManagementPage(@RequestParam Integer current, @RequestParam Integer size, @RequestParam Long projectId){
|
|
|
SingPfxManagementVO vo = new SingPfxManagementVO();
|
|
|
vo.setCurrent(current);
|
|
|
vo.setSize(size);
|
|
|
- vo.setContractId(contractId);
|
|
|
+ vo.setProjectId(projectId);
|
|
|
|
|
|
Query query = new Query();
|
|
|
query.setSize(vo.getSize());
|
|
@@ -294,7 +362,7 @@ public class SignPfxFileController extends BladeController {
|
|
|
public R save(@Valid @RequestBody SignPfxFileVO vo) {
|
|
|
|
|
|
if(new Integer("2").equals(vo.getCertificateType())){
|
|
|
- this.saveSignPfxDeputy(vo);
|
|
|
+ this.saveSignPfxDeputy(vo, true);
|
|
|
}
|
|
|
|
|
|
return R.status(this.signPfxFileService.save(vo));
|
|
@@ -310,21 +378,24 @@ public class SignPfxFileController extends BladeController {
|
|
|
if(new Integer("2").equals(vo.getCertificateType())){
|
|
|
//查询旧数据
|
|
|
SignPfxFile oldData = this.signPfxFileService.getById(vo.getId());
|
|
|
- if(!vo.getProjectContractRole().trim().equals(oldData.getProjectContractRole().trim())){
|
|
|
+ if(StringUtils.isNotEmpty(oldData.getProjectContractRole()) && !vo.getProjectContractRole().trim().equals(oldData.getProjectContractRole().trim())){
|
|
|
//如果不匹配,先删除
|
|
|
this.signPfxDeputyService.update(Wrappers.<SignPfxDeputy>lambdaUpdate().set(SignPfxDeputy::getIsDeleted, 1).eq(SignPfxDeputy::getSignPfxFileId, vo.getId()));
|
|
|
- //再重新生成
|
|
|
- this.saveSignPfxDeputy(vo);
|
|
|
}
|
|
|
+
|
|
|
+ //再重新生成
|
|
|
+ this.saveSignPfxDeputy(vo, false);
|
|
|
}
|
|
|
return R.status(this.signPfxFileService.updateById(vo));
|
|
|
}
|
|
|
|
|
|
- private void saveSignPfxDeputy(SignPfxFileVO vo){
|
|
|
+ private void saveSignPfxDeputy(SignPfxFileVO vo, boolean isSave){
|
|
|
String[] projectContractRoles = vo.getProjectContractRole().trim().split(",");
|
|
|
//从表数据
|
|
|
List<SignPfxDeputy> insertList = new ArrayList<>();
|
|
|
- vo.setId(SnowFlakeUtil.getId());
|
|
|
+ if(isSave){
|
|
|
+ vo.setId(SnowFlakeUtil.getId());
|
|
|
+ }
|
|
|
for(String projectContractRole : projectContractRoles){
|
|
|
String[] array = projectContractRole.split("-");
|
|
|
//查询项目信息
|