Browse Source

电签相关

huangjn 3 years ago
parent
commit
03f340e991

+ 28 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/RoleSignPfxUserVO.java

@@ -0,0 +1,28 @@
+package org.springblade.manager.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springblade.manager.entity.SignPfxFile;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class RoleSignPfxUserVO {
+
+    /**
+     * 角色ID
+     */
+    @ApiModelProperty(value = "角色ID")
+    private Long roleId;
+
+    /**
+     * 角色名
+     */
+    @ApiModelProperty(value = "角色名")
+    private String roleName;
+
+    @ApiModelProperty(value = "个人签章集合")
+    private List<SignPfxFile> signPfxFileList = new ArrayList<>();
+
+}

+ 1 - 1
blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClient.java

@@ -68,7 +68,7 @@ public interface ISysClient {
 	 * 角色信息查询
 	 */
 	@GetMapping(SEARCH)
-	R<List<RoleVO>> search(@RequestParam("roleName")String roleName, @RequestParam("parentId")Long parentId);
+	R<List<RoleVO>> search();
 
 	/**
 	 * 获取菜单

+ 1 - 1
blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClientFallback.java

@@ -32,7 +32,7 @@ import java.util.List;
 public class ISysClientFallback implements ISysClient {
 
 	@Override
-	public R<List<RoleVO>> search(String roleName, Long parentId) {
+	public R<List<RoleVO>> search() {
 		return R.fail("获取数据失败");
 	}
 

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

@@ -269,7 +269,7 @@ public class UserOpinionController extends BladeController {
 		//提交成功环节
 		saveFlowList.add(setUserData(new UserOpinionFlow(idKey, 2, 1, 1, "已提交", "已成功提交您的工单信息", manageTime, manageUser, manageUserName, manegeUserPhone)));
 		//分配维护人员环节
-		saveFlowList.add(setUserData(new UserOpinionFlow(idKey, 1, 1, 2, "已分配专属客服", "客服:" + manageUser + "<br>电话:" + manegeUserPhone, manageTime, manageUser, manageUserName, manegeUserPhone)));
+		saveFlowList.add(setUserData(new UserOpinionFlow(idKey, 1, 1, 2, "已分配专属客服", "客服:" + manageUserName + "<br>电话:" + manegeUserPhone, manageTime, manageUser, manageUserName, manegeUserPhone)));
 		//进入人工预处理环节
 		saveFlowList.add(setUserData(new UserOpinionFlow(idKey, 0, 1, 3, "进入人工预处理环节", "预计" + manageTime + "之前完成", manageTime, manageUser, manageUserName, manegeUserPhone)));
 		//问题已解决

+ 92 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/SignPfxFileController.java

@@ -16,6 +16,8 @@
  */
 package org.springblade.manager.controller;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import io.swagger.annotations.*;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
@@ -26,20 +28,26 @@ import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 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.service.IContractInfoService;
 import org.springblade.manager.service.IProjectInfoService;
-import org.springblade.manager.vo.SingPfxManagementVO;
+import org.springblade.manager.service.SaveUserInfoByProjectService;
+import org.springblade.manager.vo.*;
 import org.springblade.system.feign.ISysClient;
 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.manager.vo.SignPfxFileVO;
 import org.springblade.manager.service.ISignPfxFileService;
 import org.springblade.core.boot.ctrl.BladeController;
 
+import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 个人/企业证书信息表 控制器
@@ -57,16 +65,96 @@ public class SignPfxFileController extends BladeController {
 
 	private final IProjectInfoService projectInfoService;
 
+	private final IContractInfoService contractInfoService;
+
+	private final SaveUserInfoByProjectService saveUserInfoByProjectService;
+
 	private final ISysClient sysClient;
 
+	/**
+	 * 获取当前项目及其所有合同段
+	 * @return 项目及合同段列表
+	 */
+	@GetMapping("/queryProjectAndContract")
+	@ApiOperationSupport(order = 10)
+	@ApiOperation(value = "获取当前项目及其所有合同段")
+	public R<List<ProjectInfoVO>> queryProjectAndContract(){
+		List<ProjectInfoVO> result = new ArrayList<>();
+
+		//获取项目列表
+		List<ProjectInfo> projectResult = this.projectInfoService.list(Wrappers.<ProjectInfo>lambdaQuery().eq(ProjectInfo::getIsDeleted, 0));
+		if(projectResult != null && projectResult.size() > 0){
+			String projectIds = String.join(",", JSONArray.parseArray(JSONObject.toJSONString(projectResult.stream().map(ProjectInfo::getId).distinct().collect(Collectors.toList())), String.class));
+			//获取合同段
+			List<ContractInfo> contractInfos = this.contractInfoService.findContractInProject(projectIds);
+			if(contractInfos != null && contractInfos.size() > 0){
+				//转换实体
+				result = JSONArray.parseArray(JSONObject.toJSONString(projectResult), ProjectInfoVO.class);
+				List<ContractInfoVO> contractInfoVOS = JSONArray.parseArray(JSONObject.toJSONString(contractInfos), ContractInfoVO.class);
+				//设置合同段信息
+				result.forEach(project -> {
+					project.setName(project.getProjectName());
+					//获取合同段
+					Iterator<ContractInfoVO> iterator = contractInfoVOS.iterator();
+					while (iterator.hasNext()){
+						ContractInfoVO next = iterator.next();
+						next.setName(next.getContractName());
+						if(project.getId().toString().equals(next.getPId())){
+							project.getContractInfoList().add(next);
+							iterator.remove();
+						}
+					}
+				});
+			}
+		}
+
+		return R.data(result);
+	}
+
 	/**
 	 * 获取系统所有角色划分
 	 */
 	@GetMapping("/queryAllRoleList")
 	@ApiOperationSupport(order = 9)
 	@ApiOperation(value = "获取系统所有角色划分")
-	public R<List<RoleVO>> queryAllRoleList(){
-		return this.sysClient.search(null, null);
+	public R<List<RoleSignPfxUserVO>> queryAllRoleList(@RequestParam String contractId){
+		//获取当前系统配置的角色划分
+		List<RoleVO> roleVOS = this.sysClient.search().getData();
+		//获取项目人员
+		List<SaveUserInfoByProjectDTO> contractUserList = this.saveUserInfoByProjectService.list(Wrappers.<SaveUserInfoByProjectDTO>lambdaQuery().eq(SaveUserInfoByProjectDTO::getContractId, contractId).eq(SaveUserInfoByProjectDTO::getIsDeleted, 0));
+
+		//返回结果
+		List<RoleSignPfxUserVO> result = new ArrayList<>();
+
+		//循环角色,对项目人员进行分组
+		for(RoleVO vo : roleVOS){
+			//设置实体
+			RoleSignPfxUserVO pfxUserVo = new RoleSignPfxUserVO();
+			pfxUserVo.setRoleId(vo.getId());
+			pfxUserVo.setRoleName(vo.getRoleName());
+
+			//循环项目人员,获取个人证书,如果没有个人证书则删除
+			Iterator<SaveUserInfoByProjectDTO> iterator = contractUserList.iterator();
+			while (iterator.hasNext()){
+				SaveUserInfoByProjectDTO next = iterator.next();
+
+				if(next.getRoleId().equals(vo.getId().toString())){
+					//角色相符
+					SignPfxFile userSignPfx = this.signPfxFileService.getOne(Wrappers.<SignPfxFile>lambdaQuery().eq(SignPfxFile::getCertificateUserId, next.getUserId()));
+					if(userSignPfx == null){
+						iterator.remove();
+						continue;
+					}
+					//存在证书则设置进结果对象的证书集合中
+					pfxUserVo.getSignPfxFileList().add(userSignPfx);
+				}
+			}
+
+			//设置结果
+			result.add(pfxUserVo);
+		}
+
+		return R.data(result);
 	}
 
 	/**

+ 2 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ProjectInfoMapper.xml

@@ -44,8 +44,8 @@
         select
             pi.id,
             pi.project_name,
-            count(select id from m_sign_pfx_file where is_deleted = 0 and project_id = pi.id and certificate_type = 1) AS personalCount,
-            count(select id from m_sign_pfx_file where is_deleted = 0 and project_id = pi.id and certificate_type = 2) AS enterpriseCount
+            count((select id from m_sign_pfx_file where is_deleted = 0 and project_id = pi.id and certificate_type = 1)) AS personalCount,
+            count((select id from m_sign_pfx_file where is_deleted = 0 and project_id = pi.id and certificate_type = 2)) AS enterpriseCount
         from m_project_info AS pi where pi.is_deleted = 0
         <if test="vo.projectId != null">
             and pi.id = #{vo.projectId}

+ 2 - 2
blade-service/blade-system/src/main/java/org/springblade/system/feign/SysClient.java

@@ -56,8 +56,8 @@ public class SysClient implements ISysClient {
 	private final IRegionService regionService;
 
 	@Override
-	public R<List<RoleVO>> search(String roleName, Long parentId) {
-		return R.data(this.roleService.search(roleName, parentId));
+	public R<List<RoleVO>> search() {
+		return R.data(this.roleService.search(null, null));
 	}
 
 	@Override