Browse Source

bug修复

huangjn 2 years ago
parent
commit
6ce4495490

+ 1 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/SignPfxFile.java

@@ -52,7 +52,7 @@ public class SignPfxFile extends BaseEntity {
      * 证书ID
      */
     @ApiModelProperty("证书ID")
-    private Long certificateId;
+    private String certificateId;
     /**
      * 证书编号
      */

+ 4 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/SignPfxFileVO.java

@@ -48,6 +48,10 @@ public class SignPfxFileVO extends SignPfxFile {
 	@ApiModelProperty("是否注册,true为已注册")
 	private Boolean isRegisterBoolean;
 
+	private String projectId;
+
+	private List<String> userIds;
+
 	@ApiModelProperty("项目合同段信息")
 	private List<SignPfxDeputy> signPfxDeputieList;
 

+ 13 - 0
blade-service/blade-business/src/main/java/org/springblade/business/controller/ImageClassificationFileController.java

@@ -171,8 +171,21 @@ public class ImageClassificationFileController extends BladeController {
 					}
 				}
 			});
+
+			//获取项目阶段字典
+			List<Dict> dictBizList = this.dictClient.getList("project_stage").getData();
+
 			//处理没有显隐的数据
 			sysClassifyConfigVoList.forEach(vo -> {
+				//转换项目阶段
+				for(Dict biz : dictBizList){
+					if(biz.getDictKey().equals(vo.getProjectStage())){
+						vo.setProjectStage(biz.getDictValue());
+						break;
+					}
+				}
+
+
 				if(StringUtils.isEmpty(String.valueOf(vo.getShowId()))){
 					//默认为不显示
 					vo.setIsShow(false);

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/UserOpinionMapper.xml

@@ -66,7 +66,7 @@
                 and sort = 4 order by number DESC
             ) as uof group by uof.user_opinion_id
         ) as uof on uof.user_opinion_id = uo.id
-        where uo.is_deleted = 0
+        where uo.is_deleted = 0 order by uo.create_time DESC
     </select>
 
     <select id="queryCurrentUserOpinionList" resultMap="userOpinionResultMap">

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/UserOpinionServiceImpl.java

@@ -96,7 +96,7 @@ public class UserOpinionServiceImpl extends BaseServiceImpl<UserOpinionMapper, U
 						//如果有权限则获取当前正在进行的操作环节
 						for(UserOpinionFlowVO flowVo : newFlow){
 							//依次找到正在执行的环节
-							if(new Integer("2").equals(flowVo.getSort())){
+							if(new Integer("2").equals(flowVo.getSort()) || new Integer("3").equals(flowVo.getSort())){
 								//设置当前用户操作权限(如果当前用户的流程次数和主表次数一致,认为可以操作)
 								if(StringUtils.isNotEmpty(currentUserId)){
 									vo.setOperation(vo.getNumber().equals(vo.getNewNumber()));

+ 87 - 16
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/SignPfxFileController.java

@@ -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("-");
 			//查询项目信息

+ 9 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/SaveUserInfoByProjectMapper.xml

@@ -63,9 +63,15 @@
         LEFT JOIN blade_role AS br ON pau.role_id = br.id
         where
           pau.is_deleted = 0
-        and pau.project_id = #{projectId}
-        and pau.contract_id = #{contractId}
-        AND br.id is null
+        <if test="projectId != null">
+            and pau.project_id = #{projectId}
+        </if>
+        <if test="contractId != null">
+            and pau.contract_id = #{contractId}
+        </if>
+        <if test="projectId != null and contractId != null">
+            AND br.id is null
+        </if>
     </select>
     <select id="selectByIds" resultType="org.springblade.manager.dto.SaveUserInfoByProjectDTO">
         SELECT u.user_id,u.role_id FROM m_project_assignment_user u

+ 48 - 15
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/SignPfxFileMapper.xml

@@ -26,30 +26,63 @@
     </resultMap>
 
     <select id="queryPersonalOrEnterpriseCount" resultType="java.lang.Integer">
-        select
-          count(result.id)
-        from
-        (
+        <if test="type == 1">
             select
-              spf.id
+                count(result.id)
             from
-              m_sign_pfx_file AS spf
-            left join m_project_assignment_user AS pau on spf.certificate_user_id = pau.user_id
-            where
-              spf.is_deleted = 0
-            and pau.is_deleted = 0
-            and pau.project_id = #{projectId}
-            and spf.certificate_type = #{type}
-            group by spf.id
-        ) AS result
+            (
+                select
+                    spf.id
+                from
+                    m_sign_pfx_file AS spf
+                    left join m_project_assignment_user AS pau on spf.certificate_user_id = pau.user_id
+                where
+                    spf.is_deleted = 0
+                and pau.is_deleted = 0
+                and pau.project_id = #{projectId}
+                and spf.certificate_type = 1
+                group by spf.id
+            ) AS result
+        </if>
+        <if test="type == 2">
+            SELECT
+                count( result.id )
+            FROM
+            (
+                SELECT
+                    spf.id
+                FROM
+                    m_sign_pfx_file AS spf
+                LEFT JOIN m_sign_pfx_deputy AS spd ON spf.id = spd.sign_pfx_file_id
+                WHERE
+                    spf.is_deleted = 0
+                AND spd.is_deleted = 0
+                AND spd.project_id = #{projectId}
+                AND spf.certificate_type = 2
+                GROUP BY spf.id
+            ) AS result
+        </if>
     </select>
 
     <select id="countSignPfxFile" resultType="java.lang.Integer">
         select count(id) from m_sign_pfx_file where is_deleted = 0
+        <if test="vo.userIds != null">
+            and certificate_user_id in
+            <foreach collection="vo.userIds" item="userId" open="(" separator="," close=")">
+                #{userId}
+            </foreach>
+        </if>
     </select>
 
     <select id="selectSignPfxFilePage" resultMap="signPfxFileResultMap">
-        select * from m_sign_pfx_file where is_deleted = 0 order by create_time DESC limit #{current},#{size}
+        select * from m_sign_pfx_file where is_deleted = 0
+        <if test="vo.userIds != null">
+            and certificate_user_id in
+            <foreach collection="vo.userIds" item="userId" open="(" separator="," close=")">
+                #{userId}
+            </foreach>
+        </if>
+        order by create_time DESC limit #{current},#{size}
     </select>
 
 </mapper>

+ 14 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/SignPfxFileServiceImpl.java

@@ -23,9 +23,11 @@ import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.springblade.core.tool.api.R;
 import org.springblade.manager.dto.MakeSealDTO;
+import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
 import org.springblade.manager.entity.ProjectInfo;
 import org.springblade.manager.entity.SignPfxFile;
 import org.springblade.manager.service.IProjectInfoService;
+import org.springblade.manager.service.SaveUserInfoByProjectService;
 import org.springblade.manager.vo.SignPfxFileVO;
 import org.springblade.manager.mapper.SignPfxFileMapper;
 import org.springblade.manager.service.ISignPfxFileService;
@@ -37,6 +39,7 @@ import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 个人/企业证书信息表 服务实现类
@@ -52,6 +55,8 @@ public class SignPfxFileServiceImpl extends BaseServiceImpl<SignPfxFileMapper, S
 
 	private final IProjectInfoService projectInfoService;
 
+	private final SaveUserInfoByProjectService saveUserInfoByProjectService;
+
 	@Override
 	public IPage<SingPfxManagementVO> singPfxManagementPage(IPage<SingPfxManagementVO> page, SingPfxManagementVO vo) {
 		//获取项目列表
@@ -105,6 +110,15 @@ public class SignPfxFileServiceImpl extends BaseServiceImpl<SignPfxFileMapper, S
 	@Override
 	public IPage<SignPfxFileVO> selectSignPfxFilePage(IPage<SignPfxFileVO> page, SignPfxFileVO vo) {
 		long current = (page.getCurrent() - 1L) * page.getSize();
+		if(StringUtils.isNotEmpty(vo.getProjectId())){
+			//项目不为空,获取当前项目下的所有人员
+			List<SaveUserInfoByProjectDTO> projectUserList = this.saveUserInfoByProjectService.queryProjectBusinessUser(Long.parseLong(vo.getProjectId()), null);
+			if(projectUserList != null && projectUserList.size() > 0){
+				//设置用户
+				vo.setUserIds(projectUserList.stream().map(SaveUserInfoByProjectDTO::getUserId).distinct().collect(Collectors.toList()));
+			}
+		}
+
 		//汇总
 		Integer count = this.baseMapper.countSignPfxFile(vo);
 		//设置总数