feat: (feature/REQ-3010) 迁移超管查询接口
This commit is contained in:
parent
18605180ce
commit
7a43be540c
@ -0,0 +1,40 @@
|
||||
package cn.axzo.tyr.client.common.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author cn
|
||||
* @version 1.0
|
||||
* @description
|
||||
* @date 2022/5/18 14:57
|
||||
*
|
||||
* @deprecated 这个类只用在历史代码迁移上,新的业务里不要用这个。
|
||||
* 因为一个Feature可能不只是属于一个产品类型。就像一个Feature不只是属于一个产品板块一样。
|
||||
* 这种单一化的判断会引来新的BUG。
|
||||
*
|
||||
*/
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
@Deprecated
|
||||
public enum ProductTypeEnum {
|
||||
|
||||
/**
|
||||
* 总包企业产品
|
||||
*/
|
||||
PT_ENT_ZB(1, "PT_ENT_ZB"), //原来叫CEMS,但这个名字跟terminal搅在一起了,所以重新做了枚举值来区分
|
||||
/**
|
||||
* 总包项目产品
|
||||
*/
|
||||
PT_PROJ(2, "PT_PROJ"), //原来叫PMS,但这个名字跟terminal搅在一起了,所以重新做了枚举值来区分
|
||||
PT_OMS(6, "PT_OMS") //
|
||||
;
|
||||
|
||||
//TODO:以后增加其他的产品类型 -- 3:政企产品 4:分包企业产品 5:班组产品
|
||||
|
||||
|
||||
@EnumValue
|
||||
private final Integer code;
|
||||
private final String name;
|
||||
}
|
||||
@ -184,4 +184,14 @@ public interface ProductApi {
|
||||
*/
|
||||
@PostMapping("api/product/listWithOutDelete")
|
||||
CommonResponse<List<ProductQueryResp>> listWithOutDelete(@RequestBody @Valid ProductQueryReq req);
|
||||
|
||||
/**
|
||||
* 用于创建/获取OMS的产品使用
|
||||
* 主要用于OMS第一次创建服务包时进行数据处理使用
|
||||
*
|
||||
* 首先会获取OMS类型的基础产品,获取成功就直接返回
|
||||
* 未获取到会直接创建一个类型是OMS的产品,默认选中所有的OMS类型菜单
|
||||
*/
|
||||
@PostMapping("api/product/createOrGetOmsProduct")
|
||||
CommonResponse<Long> createOrGetOmsProduct();
|
||||
}
|
||||
|
||||
@ -50,4 +50,10 @@ public interface SaasRoleApi {
|
||||
*/
|
||||
@PostMapping("api/saas/role/batchFindSuperAdmin")
|
||||
CommonResponse<List<SuperAminInfoResp>> batchFindSuperAdmin(@RequestBody @Valid List<QuerySuperAdminReq> adminReqs);
|
||||
|
||||
/**
|
||||
* 根据 工作台id + 单位id 查询已关联的人员列表 work for: 工作流
|
||||
*/
|
||||
@PostMapping("api/saas/role/findSuperAdmin")
|
||||
CommonResponse<SuperAminInfoResp> findSuperAdmin(@RequestBody @Valid QuerySuperAdminReq req);
|
||||
}
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
package cn.axzo.tyr.client.model.req;
|
||||
|
||||
/**
|
||||
* @author: wangli
|
||||
* @date: 2022/1/26 10:44
|
||||
*/
|
||||
public interface AddValidGroup {
|
||||
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package cn.axzo.tyr.client.model.req;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : liuchuntao
|
||||
* @date : 2022/5/16 15:15
|
||||
* @description : saas 产品新增或修改
|
||||
*/
|
||||
@Data
|
||||
public class SaasProductSaveOrUpdateReq {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@NotNull(message = "修改产品Id不能为空",groups = UpdateValidGroup.class)
|
||||
protected Long id;
|
||||
|
||||
/**
|
||||
* 1:总包企业产品 2:总包项目产品 3:政企产品 4:分包企业产品 5:班组产品
|
||||
*/
|
||||
@NotNull(message = "产品类型不能为空",groups = {AddValidGroup.class,UpdateValidGroup.class})
|
||||
private Integer productType;
|
||||
|
||||
/**
|
||||
* 产品名字
|
||||
*/
|
||||
@NotNull(message = "产品名字不能为空", groups = {AddValidGroup.class, UpdateValidGroup.class})
|
||||
@Length(max = 50, message = "产品名字长度不能超过50", groups = {AddValidGroup.class,
|
||||
UpdateValidGroup.class})
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 基础产品与否 0:基础产品 1:普通产品
|
||||
*/
|
||||
@NotNull(message = "基础产品与否不能为空",groups = {AddValidGroup.class,UpdateValidGroup.class})
|
||||
private Integer commonProduct;
|
||||
/**
|
||||
* 产品板块备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 功能列表
|
||||
*/
|
||||
@NotNull(message = "产品绑定的功能列表不能为空",groups = {AddValidGroup.class,UpdateValidGroup.class})
|
||||
private List<Long> featureIds;
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package cn.axzo.tyr.client.model.req;
|
||||
|
||||
/**
|
||||
* @author: wangli
|
||||
* @date: 2022/1/26 10:44
|
||||
*/
|
||||
public interface UpdateValidGroup {
|
||||
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package cn.axzo.tyr.client.model.res;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : liuchuntao
|
||||
* @date : 2022/5/16 15:33
|
||||
* @description :
|
||||
*/
|
||||
@Data
|
||||
public class SaasProductResp {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 1:总包企业产品 2:总包项目产品 3:政企产品 4:分包企业产品 5:班组产品
|
||||
*/
|
||||
private Integer productType;
|
||||
/**
|
||||
* 产品板块名字
|
||||
*/
|
||||
private String productName;
|
||||
/**
|
||||
* 基础产品与否 0:基础产品 1:普通产品
|
||||
*/
|
||||
private Integer commonProduct;
|
||||
/**
|
||||
* 产品板块备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
private Date createAt;
|
||||
|
||||
|
||||
private Date updateAt;
|
||||
|
||||
/**
|
||||
* 获取产品绑定的功能列表
|
||||
*/
|
||||
private List<Long> featureIds;
|
||||
|
||||
}
|
||||
@ -1,11 +1,15 @@
|
||||
package cn.axzo.tyr.server.controller.permission;
|
||||
|
||||
import cn.axzo.tyr.client.model.permission.IdentityKey;
|
||||
import cn.axzo.basics.profiles.api.IdentityProfileApi;
|
||||
import cn.axzo.basics.profiles.api.OperatorProfileServiceApi;
|
||||
import cn.axzo.basics.profiles.api.RegulatorProfileApi;
|
||||
import cn.axzo.basics.profiles.api.UserProfileServiceApi;
|
||||
import cn.axzo.basics.profiles.api.vo.profiles.PersonPostVo;
|
||||
import cn.axzo.basics.profiles.api.vo.profiles.PractitionerAndPersonPostVO;
|
||||
import cn.axzo.basics.profiles.api.vo.request.FindIdentityProfileReq;
|
||||
import cn.axzo.basics.profiles.common.enums.IdentityType;
|
||||
import cn.axzo.basics.profiles.dto.basic.IdentityProfileDto;
|
||||
import cn.axzo.basics.profiles.dto.basic.OperatorProfileDto;
|
||||
import cn.axzo.basics.profiles.dto.basic.PersonProfileDto;
|
||||
import cn.axzo.basics.profiles.dto.basic.PersonUnion;
|
||||
@ -31,6 +35,7 @@ import cn.axzo.tyr.server.util.RpcInternalUtil;
|
||||
import cn.azxo.framework.common.model.CommonResponse;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.extra.pinyin.PinyinUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import lombok.var;
|
||||
@ -57,6 +62,8 @@ public class SaasRoleApiImpl implements SaasRoleApi {
|
||||
private SaasAccountApi saasAccountApi;
|
||||
@Autowired
|
||||
private SaasRoleUserRelationService saasRoleUserRelationService;
|
||||
@Autowired
|
||||
private IdentityProfileApi identityProfileApi;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ -197,4 +204,38 @@ public class SaasRoleApiImpl implements SaasRoleApi {
|
||||
|
||||
return CommonResponse.success(saasRoleUserRelationService.findBathSuperAdmin(adminReqs));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResponse<SuperAminInfoResp> findSuperAdmin(QuerySuperAdminReq req) {
|
||||
return CommonResponse.success(doFindSuperAdmin(req));
|
||||
}
|
||||
|
||||
private SuperAminInfoResp doFindSuperAdmin(QuerySuperAdminReq req) {
|
||||
List<IdentityKey> ids = saasRoleUserRelationService.getSuperAdminIdsByWorkspaceAndOu(
|
||||
req.getWorkspaceId(), req.getOuId());
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
IdentityProfileDto profile = RpcInternalUtil.checkAndGetData(identityProfileApi.findIdentityProfile(FindIdentityProfileReq.builder()
|
||||
.identityId(ids.get(0).getIdentityId())
|
||||
.identityType(ids.get(0).getIdentityType())
|
||||
.build()));
|
||||
|
||||
if (profile == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SuperAminInfoResp resp = new SuperAminInfoResp();
|
||||
resp.setOuId(req.getOuId());
|
||||
resp.setIdentityId(ids.get(0).getIdentityId());
|
||||
resp.setIdentityType(ids.get(0).getIdentityType());
|
||||
if (profile.getPersonProfile() != null) {
|
||||
resp.setPhone(profile.getPersonProfile().getPhone());
|
||||
resp.setRealName(profile.getPersonProfile().getRealName());
|
||||
}
|
||||
resp.setWorkspaceId(req.getWorkspaceId());
|
||||
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,14 @@
|
||||
package cn.axzo.tyr.server.controller.product;
|
||||
|
||||
import cn.axzo.basics.common.BeanMapper;
|
||||
import cn.axzo.basics.common.page.PageResult;
|
||||
import cn.axzo.framework.auth.domain.TerminalInfo;
|
||||
import cn.axzo.framework.domain.web.result.ApiPageResult;
|
||||
import cn.axzo.framework.domain.web.result.ApiResult;
|
||||
import cn.axzo.pudge.core.service.ServiceException;
|
||||
import cn.axzo.tyr.client.common.enums.ProductTypeEnum;
|
||||
import cn.axzo.tyr.client.feign.ProductApi;
|
||||
import cn.axzo.tyr.client.model.permission.SaasFeatureBO;
|
||||
import cn.axzo.tyr.client.model.product.OldUpdateFeatureRelationRequestV2;
|
||||
import cn.axzo.tyr.client.model.product.ProductAddReq;
|
||||
import cn.axzo.tyr.client.model.product.ProductDetailReq;
|
||||
@ -17,16 +22,20 @@ import cn.axzo.tyr.client.model.product.ProductVO;
|
||||
import cn.axzo.tyr.client.model.req.ProductQueryReq;
|
||||
import cn.axzo.tyr.client.model.req.ProductSaveReq;
|
||||
import cn.axzo.tyr.client.model.req.SaasProductQueryReq;
|
||||
import cn.axzo.tyr.client.model.req.SaasProductSaveOrUpdateReq;
|
||||
import cn.axzo.tyr.client.model.req.UpdateProductStatusReq;
|
||||
import cn.axzo.tyr.client.model.res.GovernmentTerminalResp;
|
||||
import cn.axzo.tyr.client.model.res.ProductQueryResp;
|
||||
import cn.axzo.tyr.client.model.res.SaasProductResp;
|
||||
import cn.axzo.tyr.client.model.res.WorkspaceProductResp;
|
||||
import cn.axzo.tyr.server.model.PermissionCacheKey;
|
||||
import cn.axzo.tyr.server.repository.entity.ProductModule;
|
||||
import cn.axzo.tyr.server.service.PermissionCacheService;
|
||||
import cn.axzo.tyr.server.service.ProductFeatureRelationService;
|
||||
import cn.axzo.tyr.server.service.ProductService;
|
||||
import cn.axzo.tyr.server.service.SaasFeatureResourceService;
|
||||
import cn.azxo.framework.common.model.CommonResponse;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@ -35,6 +44,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 产品相关 API 实现
|
||||
@ -50,6 +60,8 @@ public class ProductController implements ProductApi {
|
||||
private final ProductService productService;
|
||||
private final ProductFeatureRelationService productFeatureRelationService;
|
||||
private final PermissionCacheService permissionCacheService;
|
||||
private final SaasFeatureResourceService saasFeatureResourceService;
|
||||
|
||||
/**
|
||||
* 获取产品基础信息的列表
|
||||
*
|
||||
@ -213,4 +225,37 @@ public class ProductController implements ProductApi {
|
||||
List<ProductQueryResp> resps = BeanMapper.copyList(respList,ProductQueryResp.class);
|
||||
return CommonResponse.success(resps);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResponse<Long> createOrGetOmsProduct() {
|
||||
SaasProductQueryReq saasProductQueryReq = new SaasProductQueryReq();
|
||||
saasProductQueryReq.setProductType(ProductTypeEnum.PT_OMS.getCode());
|
||||
saasProductQueryReq.setCommonProduct(0);
|
||||
|
||||
PageResult<SaasProductResp> saasProductRespPageResult = productService.saasProductList(saasProductQueryReq);
|
||||
Long totalCount = saasProductRespPageResult.getTotalCount();
|
||||
if (totalCount!=null&& totalCount> 0) {
|
||||
List<SaasProductResp> omsBaseProduct = saasProductRespPageResult.getData();
|
||||
if (CollectionUtil.isNotEmpty(omsBaseProduct)) {
|
||||
// 随便取哪一个ID都可以,主要用于数据初始化
|
||||
return CommonResponse.success(omsBaseProduct.get(0).getId());
|
||||
}
|
||||
}
|
||||
// 没有默认产品,创建
|
||||
SaasProductSaveOrUpdateReq saasProductSaveOrUpdateReq = new SaasProductSaveOrUpdateReq();
|
||||
saasProductSaveOrUpdateReq.setProductType(ProductTypeEnum.PT_OMS.getCode());
|
||||
saasProductSaveOrUpdateReq.setProductName("OMS基础产品");
|
||||
saasProductSaveOrUpdateReq.setCommonProduct(0);
|
||||
saasProductSaveOrUpdateReq.setRemark("OMS基础产品");
|
||||
|
||||
|
||||
List<SaasFeatureBO> saasFeatureBOS = saasFeatureResourceService.listAllFeatureByTerminal(TerminalInfo.NT_OMS_WEB);
|
||||
|
||||
if (CollectionUtil.isEmpty(saasFeatureBOS)) {
|
||||
throw new ServiceException("生成OMS产品错误,未维护对应的菜单");
|
||||
}
|
||||
saasProductSaveOrUpdateReq.setFeatureIds(saasFeatureBOS.stream().filter(e ->
|
||||
e.getFeatureType().equals(3)).map(SaasFeatureBO::getId).collect(Collectors.toList()));
|
||||
return CommonResponse.success(productService.productModuleCreate(saasProductSaveOrUpdateReq));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
package cn.axzo.tyr.server.repository.dao;
|
||||
|
||||
import cn.axzo.basics.common.constant.enums.TableIsDeleteEnum;
|
||||
import cn.axzo.basics.common.exception.ServiceException;
|
||||
import cn.axzo.tyr.client.model.req.SaasProductQueryReq;
|
||||
import cn.axzo.tyr.server.repository.entity.ProductModule;
|
||||
import cn.axzo.tyr.server.repository.mapper.ProductModuleMapper;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -29,5 +32,31 @@ public class ProductModuleDao extends ServiceImpl<ProductModuleMapper, ProductMo
|
||||
.orderByDesc(ProductModule::getCreateAt)
|
||||
.list();
|
||||
}
|
||||
|
||||
public IPage<ProductModule> listByNameType(SaasProductQueryReq req) {
|
||||
|
||||
if (StrUtil.isNotEmpty(req.getProductName()) && (req.getProductName().contains("%") || req.getProductName().contains("_"))) {
|
||||
throw new ServiceException("涉及模糊查询禁止传入特殊字符串");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return lambdaQuery().like(StrUtil.isNotEmpty(req.getProductName()), ProductModule::getProductName,
|
||||
req.getProductName())
|
||||
.eq(req.getProductType() != null, ProductModule::getProductType, req.getProductType())
|
||||
.eq(req.getCommonProduct() != null, ProductModule::getCommonProduct, req.getCommonProduct())
|
||||
.eq(ProductModule::getIsDelete, TableIsDeleteEnum.NORMAL.value)
|
||||
.orderByDesc(ProductModule::getCreateAt)
|
||||
.page(req.toPage());
|
||||
}
|
||||
|
||||
public ProductModule queryByName(String productName) {
|
||||
List<ProductModule> list = lambdaQuery().eq(ProductModule::getProductName, productName)
|
||||
.eq(ProductModule::getIsDelete, TableIsDeleteEnum.NORMAL.value).list();
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
return list.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package cn.axzo.tyr.server.repository.dao;
|
||||
|
||||
import cn.axzo.pudge.core.persistence.BaseEntity;
|
||||
import cn.axzo.tyr.server.repository.entity.SaasFeature;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@ -31,4 +32,6 @@ public interface SaasFeatureDao extends IService<SaasFeature> {
|
||||
List<SaasFeature> getChildByParentId(Long parentId);
|
||||
|
||||
List<SaasFeature> listAllFeature();
|
||||
|
||||
List<SaasFeature> listAllFeatureByTerminal(String terminal);
|
||||
}
|
||||
@ -8,6 +8,7 @@ import cn.axzo.tyr.client.model.BaseWorkspaceModel;
|
||||
import cn.axzo.tyr.client.model.enums.IdentityType;
|
||||
import cn.axzo.tyr.client.model.enums.SaasJobTypeEnum;
|
||||
import cn.axzo.tyr.client.model.permission.IdentityAndAccountDTO;
|
||||
import cn.axzo.tyr.client.model.permission.IdentityKey;
|
||||
import cn.axzo.tyr.client.model.permission.QueryIdentityByPermissionDTO;
|
||||
import cn.axzo.tyr.client.model.roleuser.dto.IdentityInfo;
|
||||
import cn.axzo.tyr.server.job.UserRoleRelationCleanJob;
|
||||
@ -233,5 +234,10 @@ public class SaasRoleUserRelationDao extends ServiceImpl<SaasRoleUserRelationMap
|
||||
public List<SaasRoleUserRelation> findBathSuperAdmin(List<ProjectWorkBaseDTO> req) {
|
||||
return saasRoleUserRelationMapper.findBathSuperAdmin(req);
|
||||
}
|
||||
|
||||
//TODO: 加一个roleIds
|
||||
public List<IdentityKey> listIdentityKeysByParams(QueryUserRoleReq req) {
|
||||
return saasRoleUserRelationMapper.listIdentityKeysByParams(req);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -65,4 +65,12 @@ public class SaasFeatureDaoImpl extends ServiceImpl<SaasFeatureMapper, SaasFeatu
|
||||
public List<SaasFeature> listAllFeature() {
|
||||
return lambdaQuery().eq(BaseEntity::getIsDelete, 0).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SaasFeature> listAllFeatureByTerminal(String terminal) {
|
||||
return lambdaQuery()
|
||||
.eq(BaseEntity::getIsDelete, 0)
|
||||
.eq(SaasFeature::getTerminal, terminal)
|
||||
.list();
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ import cn.axzo.basics.profiles.common.enums.IdentityType;
|
||||
import cn.axzo.karma.client.model.dto.ProjectWorkBaseDTO;
|
||||
import cn.axzo.tyr.client.model.enums.SaasJobTypeEnum;
|
||||
import cn.axzo.tyr.client.model.permission.IdentityAndAccountDTO;
|
||||
import cn.axzo.tyr.client.model.permission.IdentityKey;
|
||||
import cn.axzo.tyr.client.model.permission.QueryIdentityByPermissionDTO;
|
||||
import cn.axzo.tyr.server.model.QueryUserRoleReq;
|
||||
import cn.axzo.tyr.server.model.SaasUserRoleExBO;
|
||||
@ -51,6 +52,8 @@ public interface SaasRoleUserRelationMapper extends BaseMapper<SaasRoleUserRelat
|
||||
|
||||
List<SaasRoleUserRelation> findBathSuperAdmin(@Param("req") List<ProjectWorkBaseDTO> req);
|
||||
|
||||
List<IdentityKey> listIdentityKeysByParams(@Param("req") QueryUserRoleReq req);
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package cn.axzo.tyr.server.service;
|
||||
|
||||
import cn.axzo.basics.common.page.PageResult;
|
||||
import cn.axzo.framework.domain.web.result.ApiPageResult;
|
||||
import cn.axzo.framework.domain.web.result.ApiResult;
|
||||
import cn.axzo.tyr.client.model.product.ProductAddReq;
|
||||
@ -9,8 +10,10 @@ import cn.axzo.tyr.client.model.product.ProductUpdateReq;
|
||||
import cn.axzo.tyr.client.model.product.ProductVO;
|
||||
import cn.axzo.tyr.client.model.req.ProductSaveReq;
|
||||
import cn.axzo.tyr.client.model.req.SaasProductQueryReq;
|
||||
import cn.axzo.tyr.client.model.req.SaasProductSaveOrUpdateReq;
|
||||
import cn.axzo.tyr.client.model.req.UpdateProductStatusReq;
|
||||
import cn.axzo.tyr.client.model.res.GovernmentTerminalResp;
|
||||
import cn.axzo.tyr.client.model.res.SaasProductResp;
|
||||
import cn.axzo.tyr.client.model.res.WorkspaceProductResp;
|
||||
import cn.axzo.tyr.server.repository.entity.ProductModule;
|
||||
|
||||
@ -45,4 +48,17 @@ public interface ProductService {
|
||||
ApiResult<WorkspaceProductResp> getWorkspaceProduct(String workspaceType);
|
||||
|
||||
List<ProductModule> saasProductListWithOutDelete(SaasProductQueryReq queryReq);
|
||||
|
||||
/***
|
||||
* 获取产品列表
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
PageResult<SaasProductResp> saasProductList(SaasProductQueryReq req);
|
||||
|
||||
/**
|
||||
* 创建产品
|
||||
* @param req
|
||||
*/
|
||||
Long productModuleCreate(SaasProductSaveOrUpdateReq req);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package cn.axzo.tyr.server.service;
|
||||
|
||||
import cn.axzo.foundation.page.PageResp;
|
||||
import cn.axzo.tyr.client.model.permission.SaasFeatureBO;
|
||||
import cn.axzo.tyr.client.model.req.DeleteFeatureResourceReq;
|
||||
import cn.axzo.tyr.client.model.req.FeatureResourceTreeSaveReq;
|
||||
import cn.axzo.tyr.client.model.req.GetFeatureResourceTreeReq;
|
||||
@ -70,6 +71,8 @@ public interface SaasFeatureResourceService extends IService<SaasFeatureResource
|
||||
|
||||
void refreshCache(RefreshFeatureResourceCacheParam param);
|
||||
|
||||
List<SaasFeatureBO> listAllFeatureByTerminal(String terminal);
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
package cn.axzo.tyr.server.service;
|
||||
|
||||
|
||||
import cn.axzo.tyr.server.repository.entity.SaasProductModuleFeatureRelation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品-菜单关联关系(SaasProductModuleFeatureRelation)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2022-05-24 11:18:41
|
||||
*/
|
||||
public interface SaasProductModuleFeatureRelationService {
|
||||
|
||||
|
||||
boolean saveBatch(List<SaasProductModuleFeatureRelation> relations);
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package cn.axzo.tyr.server.service;
|
||||
import cn.axzo.basics.profiles.common.enums.IdentityType;
|
||||
import cn.axzo.framework.domain.page.PageResp;
|
||||
import cn.axzo.tyr.client.model.permission.IdentityAndAccountDTO;
|
||||
import cn.axzo.tyr.client.model.permission.IdentityKey;
|
||||
import cn.axzo.tyr.client.model.permission.QueryIdentityByPermissionDTO;
|
||||
import cn.axzo.tyr.client.model.req.QuerySuperAdminReq;
|
||||
import cn.axzo.tyr.client.model.req.UpdateUserJobReq;
|
||||
@ -47,4 +48,6 @@ public interface SaasRoleUserRelationService extends IService<SaasRoleUserRelati
|
||||
void updateWorkspaceUserRolesList(UpdateUserJobReq req);
|
||||
|
||||
List<SuperAminInfoResp> findBathSuperAdmin(List<QuerySuperAdminReq> req);
|
||||
|
||||
List<IdentityKey> getSuperAdminIdsByWorkspaceAndOu(Long workspaceId, Long ouId);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package cn.axzo.tyr.server.service.impl;
|
||||
|
||||
import cn.axzo.basics.common.BeanMapper;
|
||||
import cn.axzo.basics.common.page.PageResult;
|
||||
import cn.axzo.basics.common.util.AssertUtil;
|
||||
import cn.axzo.basics.profiles.api.UserProfileServiceApi;
|
||||
import cn.axzo.basics.profiles.dto.basic.PersonProfileDto;
|
||||
@ -8,6 +9,7 @@ import cn.axzo.framework.domain.page.PageResp;
|
||||
import cn.axzo.framework.domain.web.result.ApiPageResult;
|
||||
import cn.axzo.framework.domain.web.result.ApiResult;
|
||||
import cn.axzo.pokonyan.config.mybatisplus.BaseEntity;
|
||||
import cn.axzo.pudge.core.service.ServiceException;
|
||||
import cn.axzo.tyr.client.common.enums.PermissionRelationOperateLogSceneEnum;
|
||||
import cn.axzo.tyr.client.common.enums.ProductModuleFeatureRelationTypeEnum;
|
||||
import cn.axzo.tyr.client.model.dict.request.BasicDictQueryReq;
|
||||
@ -25,8 +27,10 @@ import cn.axzo.tyr.client.model.product.ProductVO;
|
||||
import cn.axzo.tyr.client.model.req.PermissionOperateLogReq;
|
||||
import cn.axzo.tyr.client.model.req.ProductSaveReq;
|
||||
import cn.axzo.tyr.client.model.req.SaasProductQueryReq;
|
||||
import cn.axzo.tyr.client.model.req.SaasProductSaveOrUpdateReq;
|
||||
import cn.axzo.tyr.client.model.req.UpdateProductStatusReq;
|
||||
import cn.axzo.tyr.client.model.res.GovernmentTerminalResp;
|
||||
import cn.axzo.tyr.client.model.res.SaasProductResp;
|
||||
import cn.axzo.tyr.client.model.res.WorkspaceProductResp;
|
||||
import cn.axzo.tyr.server.model.RelationOperateLogProductBindResourceDO;
|
||||
import cn.axzo.tyr.server.repository.dao.ProductModuleDao;
|
||||
@ -40,6 +44,7 @@ import cn.axzo.tyr.server.service.ProductService;
|
||||
import cn.axzo.tyr.server.service.SaasBasicDictService;
|
||||
import cn.axzo.tyr.server.service.SaasFeatureResourceService;
|
||||
import cn.axzo.tyr.server.service.SaasPgroupPermissionRelationOperateLogService;
|
||||
import cn.axzo.tyr.server.service.SaasProductModuleFeatureRelationService;
|
||||
import cn.axzo.tyr.server.util.RpcInternalUtil;
|
||||
import cn.azxo.framework.common.constatns.Constants;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
@ -89,6 +94,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
private final UserProfileServiceApi userProfileServiceApi;
|
||||
private final SaasPgroupPermissionRelationOperateLogService saasPgroupPermissionRelationOperateLogService;
|
||||
private final SaasFeatureResourceDao saasFeatureResourceDao;
|
||||
private final SaasProductModuleFeatureRelationService saasProductModuleFeatureRelationService;
|
||||
|
||||
@Override
|
||||
public ApiResult<List<ProductVO>> list(ProductSearchListReq req) {
|
||||
@ -578,4 +584,63 @@ public class ProductServiceImpl implements ProductService {
|
||||
|
||||
return productModuleDao.listByNameTypeWithOutDelete(queryReq);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品列表
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageResult<SaasProductResp> saasProductList(SaasProductQueryReq req) {
|
||||
PageResult result = new PageResult();
|
||||
IPage<ProductModule> productList = productModuleDao.listByNameType(req);
|
||||
if (com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isEmpty(productList.getRecords())) {
|
||||
return result;
|
||||
}
|
||||
List<SaasProductResp> respList = BeanMapper.mapList(productList.getRecords(),SaasProductResp.class);
|
||||
result.setData(respList);
|
||||
result.setTotalCount(productList.getTotal());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建产品
|
||||
* @param req
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long productModuleCreate(SaasProductSaveOrUpdateReq req) {
|
||||
ProductModule productModule = saasProductCreate(req);
|
||||
if(com.baomidou.mybatisplus.core.toolkit.CollectionUtils.isNotEmpty(req.getFeatureIds())){
|
||||
List<SaasProductModuleFeatureRelation> relations = new ArrayList<>();
|
||||
req.getFeatureIds().forEach(item -> {
|
||||
SaasProductModuleFeatureRelation relation = new SaasProductModuleFeatureRelation();
|
||||
relation.setFeatureId(item);
|
||||
relation.setProductModuleId(productModule.getId());
|
||||
relations.add(relation);
|
||||
});
|
||||
saasProductModuleFeatureRelationService.saveBatch(relations);
|
||||
|
||||
}
|
||||
return productModule.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建产品
|
||||
* @param req
|
||||
*/
|
||||
private ProductModule saasProductCreate(SaasProductSaveOrUpdateReq req) {
|
||||
//校验对应产品是否存在
|
||||
ProductModule productModule = productModuleDao.queryByName(req.getProductName());
|
||||
if (productModule != null) {
|
||||
throw new ServiceException("该名称对应产品已存在");
|
||||
}
|
||||
ProductModule product = new ProductModule();
|
||||
product.setProductType(req.getProductType());
|
||||
product.setProductName(req.getProductName());
|
||||
product.setCommonProduct(req.getCommonProduct());
|
||||
product.setRemark(req.getRemark());
|
||||
productModuleDao.save(product);
|
||||
return product;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import cn.axzo.tyr.client.common.enums.FeatureResourceStatus;
|
||||
import cn.axzo.tyr.client.common.enums.FeatureResourceType;
|
||||
import cn.axzo.tyr.client.common.enums.PageElementFeatureResourceRelationTypeEnum;
|
||||
import cn.axzo.tyr.client.model.enums.DelegatedType;
|
||||
import cn.axzo.tyr.client.model.permission.SaasFeatureBO;
|
||||
import cn.axzo.tyr.client.model.req.DeleteFeatureResourceReq;
|
||||
import cn.axzo.tyr.client.model.req.FeatureComponentSaveReq;
|
||||
import cn.axzo.tyr.client.model.req.FeatureResourceTreeSaveReq;
|
||||
@ -914,4 +915,12 @@ public class SaasFeatureResourceServiceImpl extends ServiceImpl<SaasFeatureResou
|
||||
allFeatureResources.addAll(saasFeatureResources);
|
||||
return allFeatureResources;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SaasFeatureBO> listAllFeatureByTerminal(String terminal) {
|
||||
|
||||
List<SaasFeature> saasFeatures = saasFeatureDao.listAllFeatureByTerminal(terminal);
|
||||
|
||||
return BeanMapper.mapList(saasFeatures, SaasFeatureBO.class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
package cn.axzo.tyr.server.service.impl;
|
||||
|
||||
import cn.axzo.tyr.server.repository.dao.SaasProductModuleFeatureRelationDao;
|
||||
import cn.axzo.tyr.server.repository.entity.SaasProductModuleFeatureRelation;
|
||||
import cn.axzo.tyr.server.service.SaasProductModuleFeatureRelationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : liuchuntao
|
||||
* @date : 2022/6/7 22:14
|
||||
* @description : 产品关联功能树实现
|
||||
*/
|
||||
@Service
|
||||
public class SaasProductModuleFeatureRelationServiceImpl implements
|
||||
SaasProductModuleFeatureRelationService {
|
||||
|
||||
@Autowired
|
||||
private SaasProductModuleFeatureRelationDao relationDao;
|
||||
|
||||
|
||||
/**
|
||||
* 产品-feature批量保存
|
||||
* @param relations
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean saveBatch(List<SaasProductModuleFeatureRelation> relations) {
|
||||
return relationDao.saveBatch(relations);
|
||||
}
|
||||
|
||||
}
|
||||
@ -22,6 +22,7 @@ import cn.axzo.pudge.core.service.ServiceException;
|
||||
import cn.axzo.tyr.client.common.enums.RoleTypeEnum;
|
||||
import cn.axzo.tyr.client.model.enums.SaasJobTypeEnum;
|
||||
import cn.axzo.tyr.client.model.permission.IdentityAndAccountDTO;
|
||||
import cn.axzo.tyr.client.model.permission.IdentityKey;
|
||||
import cn.axzo.tyr.client.model.permission.QueryIdentityByPermissionDTO;
|
||||
import cn.axzo.tyr.client.model.req.QuerySuperAdminReq;
|
||||
import cn.axzo.tyr.client.model.req.UpdateUserJobReq;
|
||||
@ -579,4 +580,14 @@ public class SaasRoleUserRelationServiceImpl extends ServiceImpl<SaasRoleUserRel
|
||||
return superAminInfoResp;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IdentityKey> getSuperAdminIdsByWorkspaceAndOu(Long workspaceId, Long ouId) {
|
||||
return saasRoleUserRelationDao.listIdentityKeysByParams(
|
||||
QueryUserRoleReq.builder()
|
||||
.workspaceId(workspaceId)
|
||||
.ouId(ouId)
|
||||
.roleTypes(Arrays.asList(RoleTypeEnum.SUPER_ADMIN.getValue()))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<select id="findBathSuperAdmin" resultType="cn.axzo.basics.auth.dto.SaasRoleUserRelation">
|
||||
<select id="findBathSuperAdmin" resultType="cn.axzo.tyr.server.repository.entity.SaasRoleUserRelation">
|
||||
SELECT t1.* FROM saas_role_user_relation t1 inner join saas_role t2 on t1.role_id = t2.id
|
||||
WHERE t2.role_type = 'super_admin'
|
||||
AND
|
||||
@ -161,4 +161,42 @@
|
||||
AND t1.is_delete = 0
|
||||
AND t2.is_delete = 0
|
||||
</select>
|
||||
|
||||
<select id="listIdentityKeysByParams" resultType="cn.axzo.tyr.client.model.permission.IdentityKey">
|
||||
select srur.identity_id identityId,
|
||||
srur.identity_type identityType
|
||||
from saas_role_user_relation srur
|
||||
left join saas_role sr on srur.role_id = sr.id
|
||||
where srur.is_delete = 0 and sr.is_delete = 0
|
||||
<if test="req.identityIds != null and req.identityIds.size() > 0">
|
||||
and rel.identity_id in
|
||||
<foreach collection="req.identityIds" item="item" separator=","
|
||||
open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="req.identityType != null">
|
||||
and srur.identity_type = #{req.identityType}
|
||||
</if>
|
||||
<if test="req.workspaceId != null">
|
||||
and srur.workspace_id = #{req.workspaceId}
|
||||
</if>
|
||||
<if test="req.ouId != null and req.ouId!=0">
|
||||
and srur.ou_id = #{req.ouId}
|
||||
</if>
|
||||
<if test="req.roleTypes != null and req.roleTypes.size() > 0">
|
||||
and sr.role_type in
|
||||
<foreach collection="req.roleTypes" item="item" separator=","
|
||||
open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="req.roleIds != null and req.roleIds.size() > 0">
|
||||
and sr.id in
|
||||
<foreach collection="req.roleIds" item="item" separator=","
|
||||
open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user