feat:报告类型发起权限

This commit is contained in:
FCL
2025-11-07 15:26:15 +08:00
parent da9db180ca
commit 52ab580346
15 changed files with 132 additions and 18 deletions

View File

@@ -8,6 +8,8 @@ import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.framework.security.core.LoginUser;
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigPermissionRespVO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigPermissionDO;
import com.zt.plat.module.qms.business.config.service.ConfigPermissionService;
@@ -15,6 +17,7 @@ import com.zt.plat.module.qms.business.reportdoc.controller.vo.*;
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentTypeDO;
import com.zt.plat.module.qms.business.reportdoc.service.ReportDocumentTypeService;
import com.zt.plat.module.qms.enums.QmsPermissionConstant;
import com.zt.plat.module.system.api.permission.PermissionApi;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -27,6 +30,7 @@ import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
import java.util.Set;
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
@@ -40,6 +44,7 @@ public class ReportDocumentTypeController implements BusinessControllerMarker {
@Resource private ReportDocumentTypeService reportDocumentTypeService;
@Resource private ConfigPermissionService configPermissionService;
@Resource private PermissionApi permissionApi;
@PostMapping("/save")
@Operation(summary = "更新报告类型配置")
@@ -88,6 +93,23 @@ public class ReportDocumentTypeController implements BusinessControllerMarker {
return success(BeanUtils.toBean(pageResult, ReportDocumentTypeRespVO.class));
}
@GetMapping("/selectListWithPermission")
@Operation(summary = "安权限查询报告类型")
//@PreAuthorize("@ss.hasPermission('qms:report-document-type:query')")
public CommonResult<List<ReportDocumentTypeRespVO>> selectListWithPermission(@Valid ReportDocumentTypePageReqVO pageReqVO) {
pageReqVO.setPermissionFilterFlag("1");
pageReqVO.setSrcPermissionType(QmsPermissionConstant.REPORT_DOCUMENT_TYPE_START);
//查询权限
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Long userId = loginUser.getId();
CommonResult<Set<Long>> roleRet = permissionApi.getUserRoleIdListByUserId(userId);
Set<Long> roleIds = roleRet.getData();
pageReqVO.setRoleIds(roleIds);
List<ReportDocumentTypeDO> list = reportDocumentTypeService.selectListWithPermission(pageReqVO);
return success(BeanUtils.toBean(list, ReportDocumentTypeRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出报告类型配置 Excel")
//@PreAuthorize("@ss.hasPermission('qms:report-document-type:export')")

View File

@@ -30,7 +30,7 @@ public class ReportDocumentMainPageReqVO extends PageParam {
private String currentNode;
@Schema(description = "报告编号")
private String documentCustomsDeclaration;
private String documentCode;
@Schema(description = "报告类型,【字典】【jy_doc_main_type】化验报告、典型性报告、检测报告", example = "2")
private String documentType;

View File

@@ -39,7 +39,7 @@ public class ReportDocumentMainRespVO {
@Schema(description = "报告编号")
@ExcelProperty("报告编号")
private String documentCustomsDeclaration;
private String documentCode;
@Schema(description = "报告类型,【字典】【jy_doc_main_type】化验报告、典型性报告、检测报告", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("报告类型,【字典】【jy_doc_main_type】化验报告、典型性报告、检测报告")

View File

@@ -31,7 +31,7 @@ public class ReportDocumentMainSaveReqVO {
private String currentNode;
@Schema(description = "报告编号")
private String documentCustomsDeclaration;
private String documentCode;
@Schema(description = "报告类型,【字典】【jy_doc_main_type】化验报告、典型性报告、检测报告", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private String documentType;

View File

@@ -8,6 +8,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.Set;
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@@ -28,7 +29,7 @@ public class ReportDocumentTypePageReqVO extends PageParam {
private String reportKey;
@Schema(description = "报告编号规则")
private String customsDeclarationRule;
private String codeRule;
@Schema(description = "报告分类")
private String documentType;
@@ -69,4 +70,15 @@ public class ReportDocumentTypePageReqVO extends PageParam {
@Schema(description = "前端组件(移动端)")
private String pageComponentMobile;
//===================扩展属性=====================
@Schema(description = "查询时进行权限过滤")
private String permissionFilterFlag;
@Schema(description = "查询用-权限角色")
private Set<Long> roleIds;
@Schema(description = "查询用-源权限类型")
private String srcPermissionType;
}

View File

@@ -38,7 +38,7 @@ public class ReportDocumentTypeRespVO {
@Schema(description = "报告编号规则", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("报告编号规则")
private String customsDeclarationRule;
private String codeRule;
@Schema(description = "报告分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty("报告分类")

View File

@@ -34,7 +34,7 @@ public class ReportDocumentTypeSaveReqVO {
@Schema(description = "报告编号规则", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "报告编号规则不能为空")
private String customsDeclarationRule;
private String codeRule;
@Schema(description = "报告分类,【字典】【jy_doc_main_type】化验报告、典型性报告、检测报告", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotEmpty(message = "报告分类,【字典】【jy_doc_main_type】化验报告、典型性报告、检测报告不能为空")

View File

@@ -2,7 +2,6 @@ package com.zt.plat.module.qms.business.reportdoc.dal.dataobject;
import com.baomidou.mybatisplus.annotation.*;
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
@@ -60,7 +59,7 @@ public class ReportDocumentMainDO extends BusinessBaseDO {
* 报告编号
*/
@TableField("DOC_CD")
private String documentCustomsDeclaration;
private String documentCode;
/**
* 报告类型,【字典】【jy_doc_main_type】化验报告、典型性报告、检测报告
*/

View File

@@ -52,7 +52,7 @@ public class ReportDocumentTypeDO extends BusinessBaseDO {
* 报告编号规则
*/
@TableField("CD_RUL")
private String customsDeclarationRule;
private String codeRule;
/**
* 报告分类,【字典】【jy_doc_main_type】化验报告、典型性报告、检测报告
*/

View File

@@ -31,7 +31,7 @@ public interface ReportDocumentMainMapper extends BaseMapperX<ReportDocumentMain
wrapper.eqIfPresent(ReportDocumentMainDO::getFlowKey, reqVO.getFlowKey());
wrapper.eqIfPresent(ReportDocumentMainDO::getFlowSerialNumber, reqVO.getFlowSerialNumber());
wrapper.eqIfPresent(ReportDocumentMainDO::getCurrentNode, reqVO.getCurrentNode());
wrapper.eqIfPresent(ReportDocumentMainDO::getDocumentCustomsDeclaration, reqVO.getDocumentCustomsDeclaration());
wrapper.eqIfPresent(ReportDocumentMainDO::getDocumentCode, reqVO.getDocumentCode());
wrapper.eqIfPresent(ReportDocumentMainDO::getDocumentType, reqVO.getDocumentType());
wrapper.eqIfPresent(ReportDocumentMainDO::getDocumentTitle, reqVO.getDocumentTitle());
wrapper.eqIfPresent(ReportDocumentMainDO::getDocumentConfig, reqVO.getDocumentConfig());

View File

@@ -6,6 +6,9 @@ import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.qms.business.reportdoc.controller.vo.*;
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentTypeDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 报告类型配置 Mapper
@@ -17,13 +20,13 @@ public interface ReportDocumentTypeMapper extends BaseMapperX<ReportDocumentType
default PageResult<ReportDocumentTypeDO> selectPage(ReportDocumentTypePageReqVO reqVO) {
LambdaQueryWrapperX<ReportDocumentTypeDO> wrapper = new LambdaQueryWrapperX<>();
wrapper.eqIfPresent(ReportDocumentTypeDO::getConfigReportTypeId, reqVO.getConfigReportTypeId());
wrapper.likeIfPresent(ReportDocumentTypeDO::getName, reqVO.getName());
wrapper.eqIfPresent(ReportDocumentTypeDO::getMainId, reqVO.getMainId());
wrapper.eqIfPresent(ReportDocumentTypeDO::getCurrentFlag, reqVO.getCurrentFlag());
wrapper.eqIfPresent(ReportDocumentTypeDO::getFlowKey, reqVO.getFlowKey());
wrapper.eqIfPresent(ReportDocumentTypeDO::getReportKey, reqVO.getReportKey());
wrapper.eqIfPresent(ReportDocumentTypeDO::getCustomsDeclarationRule, reqVO.getCustomsDeclarationRule());
wrapper.eqIfPresent(ReportDocumentTypeDO::getCodeRule, reqVO.getCodeRule());
wrapper.eqIfPresent(ReportDocumentTypeDO::getDocumentType, reqVO.getDocumentType());
wrapper.eqIfPresent(ReportDocumentTypeDO::getPermission, reqVO.getPermission());
wrapper.eqIfPresent(ReportDocumentTypeDO::getSampleCount, reqVO.getSampleCount());
@@ -43,4 +46,7 @@ public interface ReportDocumentTypeMapper extends BaseMapperX<ReportDocumentType
}
List<ReportDocumentTypeDO> selectListWithPermission(@Param("param") ReportDocumentTypePageReqVO param);
}

View File

@@ -64,4 +64,6 @@ public interface ReportDocumentTypeService {
*/
PageResult<ReportDocumentTypeDO> getReportDocumentTypePage(ReportDocumentTypePageReqVO pageReqVO);
List<ReportDocumentTypeDO> selectListWithPermission(ReportDocumentTypePageReqVO pageReqVO);
}

View File

@@ -4,18 +4,21 @@ import cn.hutool.core.collection.CollUtil;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.framework.security.core.LoginUser;
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigPermissionSaveReqVO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigPermissionDO;
import com.zt.plat.module.qms.business.config.service.ConfigPermissionService;
import com.zt.plat.module.qms.business.reportdoc.controller.vo.*;
import com.zt.plat.module.qms.business.reportdoc.dal.mapper.ReportDocumentTypeMapper;
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentTypeDO;
import com.zt.plat.module.system.api.permission.PermissionApi;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import java.util.List;
import java.util.Set;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.REPORT_DOCUMENT_TYPE_NOT_EXISTS;
@@ -32,6 +35,7 @@ public class ReportDocumentTypeServiceImpl implements ReportDocumentTypeService
@Resource private ReportDocumentTypeMapper reportDocumentTypeMapper;
@Resource private ConfigPermissionService configPermissionService;
@Override
@Transactional(rollbackFor = Exception.class)
public CommonResult<String> save(ReportDocumentTypeSaveReqVO reqVo) {
@@ -129,11 +133,11 @@ public class ReportDocumentTypeServiceImpl implements ReportDocumentTypeService
@Override
public PageResult<ReportDocumentTypeDO> getReportDocumentTypePage(ReportDocumentTypePageReqVO pageReqVO) {
//查询权限
return reportDocumentTypeMapper.selectPage(pageReqVO);
}
@Override
public List<ReportDocumentTypeDO> selectListWithPermission(ReportDocumentTypePageReqVO pageReqVO) {
return reportDocumentTypeMapper.selectListWithPermission(pageReqVO);
}
}

View File

@@ -4,6 +4,7 @@ import com.zt.plat.module.bpm.api.task.BpmProcessInstanceApi;
import com.zt.plat.module.bpm.api.task.BpmTaskApi;
import com.zt.plat.module.infra.api.file.FileApi;
import com.zt.plat.module.system.api.dept.DeptApi;
import com.zt.plat.module.system.api.permission.PermissionApi;
import com.zt.plat.module.system.api.sequence.SequenceApi;
import com.zt.plat.module.system.api.user.AdminUserApi;
@@ -11,6 +12,6 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Configuration;
@Configuration(value = "qmsRpcConfiguration", proxyBeanMethods = false)
@EnableFeignClients(clients = {FileApi.class, SequenceApi.class, AdminUserApi.class, DeptApi.class, BpmProcessInstanceApi.class, BpmTaskApi.class})
@EnableFeignClients(clients = {FileApi.class, SequenceApi.class, AdminUserApi.class, DeptApi.class, BpmProcessInstanceApi.class, BpmTaskApi.class, PermissionApi.class})
public class RpcConfiguration {
}

View File

@@ -9,4 +9,72 @@
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="selectListWithPermission" resultType="com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentTypeDO">
select
t.id as id,
t.CFG_RPT_TP_ID as configReportTypeId,
t.NAME as name,
t.FLW_KY as flowKey,
t.RPT_KY as reportKey,
t.CD_RUL as codeRule,
t.DOC_TP as documentType,
t.PERM as permission,
t.SMP_CNT as sampleCount,
t.CST_CFG as customConfig,
t.SYS_DEPT_CD as systemDepartmentCode,
t.RMK as remark,
t.VER as version,
t.SRT_NO as sortNo,
t.CRNT_FLG as currentFlag,
t.MAIN_ID as mainId,
t.PG_CPNT as pageComponent,
t.PG_CPNT_MOB as pageComponentMobile
from T_RPT_DOC_TP t
<where>
<if test="param.configReportTypeId != null and param.configReportTypeId != ''">
and t.CFG_RPT_TP_ID = #{param.configReportTypeId}
</if>
<if test="param.name != null and param.name != ''">
and t.NAME like concat('%',#{param.name},'%')
</if>
<if test="param.mainId != null">
and t.MAIN_ID = #{param.mainId}
</if>
<if test="param.documentType != null and param.documentType != ''">
and t.DOC_TP = #{param.documentType}
</if>
<if test="param.currentFlag != null">
and t.CRNT_FLG = #{param.currentFlag}
</if>
<if test="param.permissionFilterFlag != null and param.permissionFilterFlag != ''">
and (
<if test="param.roleIds != null and param.roleIds.size > 0">
exists(
select 1
from T_CFG_PERM p
where t.MAIN_ID = p.SRC_ID
and p.SRC_TP = #{param.srcPermissionType}
and p.TGT_ID in (
<foreach item="item" collection="param.roleIds" separator=",">
#{item}
</foreach>
)
and p.TGT_TP = 'role'
and p.DELETED = 0
)
or
</if>
not exists(
select 1 from T_CFG_PERM p where t.MAIN_ID = p.SRC_ID
and p.SRC_TP = #{param.srcPermissionType}
and p.DELETED = 0
)
)
</if>
and t.DELETED = 0
</where>
</select>
</mapper>