feat(REQ-2186): 政务端产品接口更新
This commit is contained in:
parent
d1a3082851
commit
b810f9b569
@ -12,7 +12,7 @@ import cn.axzo.tyr.client.model.product.ProductUpdateReq;
|
|||||||
import cn.axzo.tyr.client.model.product.ProductVO;
|
import cn.axzo.tyr.client.model.product.ProductVO;
|
||||||
import cn.axzo.tyr.client.model.req.ProductSaveReq;
|
import cn.axzo.tyr.client.model.req.ProductSaveReq;
|
||||||
import cn.axzo.tyr.client.model.req.UpdateProductStatusReq;
|
import cn.axzo.tyr.client.model.req.UpdateProductStatusReq;
|
||||||
import cn.axzo.tyr.client.model.res.ChiefTerminalResp;
|
import cn.axzo.tyr.client.model.res.GovernmentTerminalResp;
|
||||||
import cn.axzo.tyr.client.model.res.WorkspaceProductResp;
|
import cn.axzo.tyr.client.model.res.WorkspaceProductResp;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -142,10 +142,10 @@ public interface ProductApi {
|
|||||||
* 获取政务端列表
|
* 获取政务端列表
|
||||||
*
|
*
|
||||||
* @param terminal 政务端
|
* @param terminal 政务端
|
||||||
* @return {@link ChiefTerminalResp}
|
* @return {@link GovernmentTerminalResp}
|
||||||
*/
|
*/
|
||||||
@GetMapping("api/auth/product/getChiefTerminal")
|
@GetMapping("api/auth/product/getGovernmentTerminal")
|
||||||
ApiResult<List<ChiefTerminalResp>> getChiefTerminal(@RequestParam @NotNull(message = "terminal不能为空") String terminal);
|
ApiResult<List<GovernmentTerminalResp>> getGovernmentTerminal(@RequestParam @NotNull(message = "terminal不能为空") String terminal);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据租户类型查询产品信息(新增租户、开通管理)
|
* 根据租户类型查询产品信息(新增租户、开通管理)
|
||||||
|
|||||||
@ -32,7 +32,7 @@ public enum WorkspaceTypeCodeEnum {
|
|||||||
/**
|
/**
|
||||||
* 政务
|
* 政务
|
||||||
*/
|
*/
|
||||||
CHIEF("3", "政务"),
|
GOVERNMENT("3", "政务"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 班组
|
* 班组
|
||||||
@ -68,5 +68,5 @@ public enum WorkspaceTypeCodeEnum {
|
|||||||
/**
|
/**
|
||||||
* 后台允许新增的租户类型
|
* 后台允许新增的租户类型
|
||||||
*/
|
*/
|
||||||
public static final List<WorkspaceTypeCodeEnum> ALLOW_ADD_WORKSPACE_TYPE_CODE_ENUM = Lists.newArrayList(GENERAL_ENT, GENERAL_PROJECT, CHIEF);
|
public static final List<WorkspaceTypeCodeEnum> ALLOW_ADD_WORKSPACE_TYPE_CODE_ENUM = Lists.newArrayList(GENERAL_ENT, GENERAL_PROJECT, GOVERNMENT);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -202,6 +202,6 @@ public class ProductVO {
|
|||||||
/**
|
/**
|
||||||
* 政务端featureResourceId
|
* 政务端featureResourceId
|
||||||
*/
|
*/
|
||||||
private Long chiefFeatureResourceId;
|
private Long governmentFeatureResourceId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -162,6 +162,6 @@ public class ProductSaveReq {
|
|||||||
/**
|
/**
|
||||||
* 政务端featureResourceId
|
* 政务端featureResourceId
|
||||||
*/
|
*/
|
||||||
private Long chiefFeatureResourceId;
|
private Long governmentFeatureResourceId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import lombok.NoArgsConstructor;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class ChiefTerminalResp {
|
public class GovernmentTerminalResp {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 功能资源ID
|
* 功能资源ID
|
||||||
@ -42,7 +42,7 @@ public class WorkspaceProductResp {
|
|||||||
/**
|
/**
|
||||||
* 政务产品
|
* 政务产品
|
||||||
*/
|
*/
|
||||||
private List<Product> chiefProduct;
|
private List<Product> governmentProduct;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
@ -77,7 +77,7 @@ public class WorkspaceProductResp {
|
|||||||
.addValueServices(Lists.newArrayList())
|
.addValueServices(Lists.newArrayList())
|
||||||
.generalServices(Lists.newArrayList())
|
.generalServices(Lists.newArrayList())
|
||||||
.hardware(Lists.newArrayList())
|
.hardware(Lists.newArrayList())
|
||||||
.chiefProduct(Lists.newArrayList())
|
.governmentProduct(Lists.newArrayList())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import cn.axzo.tyr.client.model.product.ProductUpdateReq;
|
|||||||
import cn.axzo.tyr.client.model.product.ProductVO;
|
import cn.axzo.tyr.client.model.product.ProductVO;
|
||||||
import cn.axzo.tyr.client.model.req.ProductSaveReq;
|
import cn.axzo.tyr.client.model.req.ProductSaveReq;
|
||||||
import cn.axzo.tyr.client.model.req.UpdateProductStatusReq;
|
import cn.axzo.tyr.client.model.req.UpdateProductStatusReq;
|
||||||
import cn.axzo.tyr.client.model.res.ChiefTerminalResp;
|
import cn.axzo.tyr.client.model.res.GovernmentTerminalResp;
|
||||||
import cn.axzo.tyr.client.model.res.WorkspaceProductResp;
|
import cn.axzo.tyr.client.model.res.WorkspaceProductResp;
|
||||||
import cn.axzo.tyr.server.model.PermissionCacheKey;
|
import cn.axzo.tyr.server.model.PermissionCacheKey;
|
||||||
import cn.axzo.tyr.server.service.PermissionCacheService;
|
import cn.axzo.tyr.server.service.PermissionCacheService;
|
||||||
@ -169,8 +169,8 @@ public class ProductController implements ProductApi {
|
|||||||
* @return 返回端列表
|
* @return 返回端列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ApiResult<List<ChiefTerminalResp>> getChiefTerminal(String terminal) {
|
public ApiResult<List<GovernmentTerminalResp>> getGovernmentTerminal(String terminal) {
|
||||||
return productService.getChiefTerminal(terminal);
|
return productService.getGovernmentTerminal(terminal);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import cn.axzo.tyr.client.model.product.ProductUpdateReq;
|
|||||||
import cn.axzo.tyr.client.model.product.ProductVO;
|
import cn.axzo.tyr.client.model.product.ProductVO;
|
||||||
import cn.axzo.tyr.client.model.req.ProductSaveReq;
|
import cn.axzo.tyr.client.model.req.ProductSaveReq;
|
||||||
import cn.axzo.tyr.client.model.req.UpdateProductStatusReq;
|
import cn.axzo.tyr.client.model.req.UpdateProductStatusReq;
|
||||||
import cn.axzo.tyr.client.model.res.ChiefTerminalResp;
|
import cn.axzo.tyr.client.model.res.GovernmentTerminalResp;
|
||||||
import cn.axzo.tyr.client.model.res.WorkspaceProductResp;
|
import cn.axzo.tyr.client.model.res.WorkspaceProductResp;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -38,7 +38,7 @@ public interface ProductService {
|
|||||||
|
|
||||||
ApiResult<Long> saveOrUpdate(ProductSaveReq req);
|
ApiResult<Long> saveOrUpdate(ProductSaveReq req);
|
||||||
|
|
||||||
ApiResult<List<ChiefTerminalResp>> getChiefTerminal(String terminal);
|
ApiResult<List<GovernmentTerminalResp>> getGovernmentTerminal(String terminal);
|
||||||
|
|
||||||
ApiResult<WorkspaceProductResp> getWorkspaceProduct(String workspaceType);
|
ApiResult<WorkspaceProductResp> getWorkspaceProduct(String workspaceType);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package cn.axzo.tyr.server.service.impl;
|
|||||||
|
|
||||||
import cn.axzo.basics.common.BeanMapper;
|
import cn.axzo.basics.common.BeanMapper;
|
||||||
import cn.axzo.basics.common.util.AssertUtil;
|
import cn.axzo.basics.common.util.AssertUtil;
|
||||||
|
import cn.axzo.framework.auth.domain.TerminalInfo;
|
||||||
import cn.axzo.framework.domain.page.PageResp;
|
import cn.axzo.framework.domain.page.PageResp;
|
||||||
import cn.axzo.framework.domain.web.result.ApiPageResult;
|
import cn.axzo.framework.domain.web.result.ApiPageResult;
|
||||||
import cn.axzo.framework.domain.web.result.ApiResult;
|
import cn.axzo.framework.domain.web.result.ApiResult;
|
||||||
@ -12,7 +13,7 @@ import cn.axzo.tyr.client.model.enums.WorkspaceTypeCodeEnum;
|
|||||||
import cn.axzo.tyr.client.model.product.*;
|
import cn.axzo.tyr.client.model.product.*;
|
||||||
import cn.axzo.tyr.client.model.req.ProductSaveReq;
|
import cn.axzo.tyr.client.model.req.ProductSaveReq;
|
||||||
import cn.axzo.tyr.client.model.req.UpdateProductStatusReq;
|
import cn.axzo.tyr.client.model.req.UpdateProductStatusReq;
|
||||||
import cn.axzo.tyr.client.model.res.ChiefTerminalResp;
|
import cn.axzo.tyr.client.model.res.GovernmentTerminalResp;
|
||||||
import cn.axzo.tyr.client.model.res.WorkspaceProductResp;
|
import cn.axzo.tyr.client.model.res.WorkspaceProductResp;
|
||||||
import cn.axzo.tyr.server.repository.entity.ProductModule;
|
import cn.axzo.tyr.server.repository.entity.ProductModule;
|
||||||
import cn.axzo.tyr.server.repository.dao.ProductModuleDao;
|
import cn.axzo.tyr.server.repository.dao.ProductModuleDao;
|
||||||
@ -52,9 +53,6 @@ public class ProductServiceImpl implements ProductService {
|
|||||||
private final SaasFeatureResourceService saasFeatureResourceService;
|
private final SaasFeatureResourceService saasFeatureResourceService;
|
||||||
private final SaasBasicDictService saasBasicDictService;
|
private final SaasBasicDictService saasBasicDictService;
|
||||||
|
|
||||||
// todo 政务端最终使用常量
|
|
||||||
private final static String CHIEF_TERMINAL = "NT_CHIEF";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResult<List<ProductVO>> list(ProductSearchListReq req) {
|
public ApiResult<List<ProductVO>> list(ProductSearchListReq req) {
|
||||||
LambdaQueryChainWrapper<ProductModule> eq = productModuleDao.lambdaQuery()
|
LambdaQueryChainWrapper<ProductModule> eq = productModuleDao.lambdaQuery()
|
||||||
@ -122,7 +120,7 @@ public class ProductServiceImpl implements ProductService {
|
|||||||
.videos(byId.getMaterial().getVideos())
|
.videos(byId.getMaterial().getVideos())
|
||||||
.detailImages(byId.getMaterial().getDetailImages())
|
.detailImages(byId.getMaterial().getDetailImages())
|
||||||
.build());
|
.build());
|
||||||
if (WorkspaceTypeCodeEnum.CHIEF.getCode().equals(productVO.getDictWorkspaceTypeCode())) {
|
if (WorkspaceTypeCodeEnum.GOVERNMENT.getCode().equals(productVO.getDictWorkspaceTypeCode())) {
|
||||||
fillFeatureScope(productVO);
|
fillFeatureScope(productVO);
|
||||||
}
|
}
|
||||||
return ApiResult.ok(productVO);
|
return ApiResult.ok(productVO);
|
||||||
@ -214,16 +212,16 @@ public class ProductServiceImpl implements ProductService {
|
|||||||
productModuleDao.save(productModule);
|
productModuleDao.save(productModule);
|
||||||
}
|
}
|
||||||
// 保存商品权限信息
|
// 保存商品权限信息
|
||||||
if (WorkspaceTypeCodeEnum.CHIEF.getCode().equals(productModule.getDictWorkspaceTypeCode())) {
|
if (WorkspaceTypeCodeEnum.GOVERNMENT.getCode().equals(productModule.getDictWorkspaceTypeCode())) {
|
||||||
saveChiefFeatureResource(productModule.getId(), productModule.getDictWorkspaceTypeId(), productModule.getDictWorkspaceTypeCode(), req.getFeatureScope().getChiefFeatureResourceId());
|
saveGovernmentFeatureResource(productModule.getId(), productModule.getDictWorkspaceTypeId(), productModule.getDictWorkspaceTypeCode(), req.getFeatureScope().getGovernmentFeatureResourceId());
|
||||||
}
|
}
|
||||||
return ApiResult.ok(productModule.getId());
|
return ApiResult.ok(productModule.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResult<List<ChiefTerminalResp>> getChiefTerminal(String terminal) {
|
public ApiResult<List<GovernmentTerminalResp>> getGovernmentTerminal(String terminal) {
|
||||||
List<SaasFeatureResource> featureResources = saasFeatureResourceService.listByParentIdAndTerminalAndIds(0L, terminal, null);
|
List<SaasFeatureResource> featureResources = saasFeatureResourceService.listByParentIdAndTerminalAndIds(0L, terminal, null);
|
||||||
List<ChiefTerminalResp> resps = CollectionUtil.isEmpty(featureResources) ? Collections.emptyList() : featureResources.stream().map(e -> ChiefTerminalResp.builder()
|
List<GovernmentTerminalResp> resps = CollectionUtil.isEmpty(featureResources) ? Collections.emptyList() : featureResources.stream().map(e -> GovernmentTerminalResp.builder()
|
||||||
.featureResourceId(e.getId())
|
.featureResourceId(e.getId())
|
||||||
.featureResourceName(e.getFeatureName())
|
.featureResourceName(e.getFeatureName())
|
||||||
.build()).collect(Collectors.toList());
|
.build()).collect(Collectors.toList());
|
||||||
@ -245,8 +243,8 @@ public class ProductServiceImpl implements ProductService {
|
|||||||
Map<String, List<ProductModule>> categoryMap = productModules.stream().collect(Collectors.groupingBy(ProductModule::getCategory));
|
Map<String, List<ProductModule>> categoryMap = productModules.stream().collect(Collectors.groupingBy(ProductModule::getCategory));
|
||||||
categoryMap.forEach((k,v) -> {
|
categoryMap.forEach((k,v) -> {
|
||||||
// 政务产品
|
// 政务产品
|
||||||
if (WorkspaceTypeCodeEnum.CHIEF.getCode().equals(workspaceType)) {
|
if (WorkspaceTypeCodeEnum.GOVERNMENT.getCode().equals(workspaceType)) {
|
||||||
resp.getChiefProduct().addAll(v.stream().map(e -> WorkspaceProductResp.Product.builder()
|
resp.getGovernmentProduct().addAll(v.stream().map(e -> WorkspaceProductResp.Product.builder()
|
||||||
.productId(e.getId())
|
.productId(e.getId())
|
||||||
.productName(e.getProductName())
|
.productName(e.getProductName())
|
||||||
.build()).collect(Collectors.toList()));
|
.build()).collect(Collectors.toList()));
|
||||||
@ -306,9 +304,9 @@ public class ProductServiceImpl implements ProductService {
|
|||||||
AssertUtil.notNull(req.getMaxPersonCount(), "人数上限不能为空");
|
AssertUtil.notNull(req.getMaxPersonCount(), "人数上限不能为空");
|
||||||
AssertUtil.notNull(req.getPrice(), "价格不能为空");
|
AssertUtil.notNull(req.getPrice(), "价格不能为空");
|
||||||
}
|
}
|
||||||
if (WorkspaceTypeCodeEnum.CHIEF.equals(workspaceTypeCodeEnum)) {
|
if (WorkspaceTypeCodeEnum.GOVERNMENT.equals(workspaceTypeCodeEnum)) {
|
||||||
AssertUtil.isTrue(Objects.nonNull(req.getFeatureScope()) && Objects.nonNull(req.getFeatureScope().getChiefFeatureResourceId())
|
AssertUtil.isTrue(Objects.nonNull(req.getFeatureScope()) && Objects.nonNull(req.getFeatureScope().getGovernmentFeatureResourceId())
|
||||||
&& req.getFeatureScope().getChiefFeatureResourceId() > 0, "功能范围选择有误");
|
&& req.getFeatureScope().getGovernmentFeatureResourceId() > 0, "功能范围选择有误");
|
||||||
}
|
}
|
||||||
productModule.setProductName(req.getProductName());
|
productModule.setProductName(req.getProductName());
|
||||||
productModule.setIcon(req.getIcon());
|
productModule.setIcon(req.getIcon());
|
||||||
@ -338,10 +336,10 @@ public class ProductServiceImpl implements ProductService {
|
|||||||
/**
|
/**
|
||||||
* 保存政务端产品功能权限
|
* 保存政务端产品功能权限
|
||||||
*/
|
*/
|
||||||
private void saveChiefFeatureResource(Long productId, Long dictWorkspaceTypeId, String dictWorkspaceTypeCode, Long rootFeatureId) {
|
private void saveGovernmentFeatureResource(Long productId, Long dictWorkspaceTypeId, String dictWorkspaceTypeCode, Long rootFeatureId) {
|
||||||
SaasFeatureResource saasFeatureResource = saasFeatureResourceService.featureResourceById(rootFeatureId);
|
SaasFeatureResource saasFeatureResource = saasFeatureResourceService.featureResourceById(rootFeatureId);
|
||||||
AssertUtil.notNull(saasFeatureResource, "功能范围选择端不能为空");
|
AssertUtil.notNull(saasFeatureResource, "功能范围选择端不能为空");
|
||||||
AssertUtil.isTrue(saasFeatureResource.getParentId() == 0 && CHIEF_TERMINAL.equals(saasFeatureResource.getTerminal()), "功能范围选择端有误");
|
AssertUtil.isTrue(saasFeatureResource.getParentId() == 0 && TerminalInfo.NT_PC_GA_GENERAL.equals(saasFeatureResource.getTerminal()), "功能范围选择端有误");
|
||||||
|
|
||||||
List<SaasFeatureResource> saasFeatureResources = saasFeatureResourceService.listDescendant(rootFeatureId);
|
List<SaasFeatureResource> saasFeatureResources = saasFeatureResourceService.listDescendant(rootFeatureId);
|
||||||
ProductFeatureRelationUpdateReq req = new ProductFeatureRelationUpdateReq();
|
ProductFeatureRelationUpdateReq req = new ProductFeatureRelationUpdateReq();
|
||||||
@ -366,9 +364,9 @@ public class ProductServiceImpl implements ProductService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<Long> featureIds = result.getData().stream().map(ProductFeatureRelationVO::getFeatureId).collect(Collectors.toList());
|
List<Long> featureIds = result.getData().stream().map(ProductFeatureRelationVO::getFeatureId).collect(Collectors.toList());
|
||||||
List<SaasFeatureResource> featureResources = saasFeatureResourceService.listByParentIdAndTerminalAndIds(0L, CHIEF_TERMINAL, featureIds);
|
List<SaasFeatureResource> featureResources = saasFeatureResourceService.listByParentIdAndTerminalAndIds(0L, TerminalInfo.NT_PC_GA_GENERAL, featureIds);
|
||||||
if (CollectionUtil.isNotEmpty(featureResources)) {
|
if (CollectionUtil.isNotEmpty(featureResources)) {
|
||||||
product.setFeatureScope(ProductVO.FeatureScope.builder().chiefFeatureResourceId(featureResources.get(0).getId()).build());
|
product.setFeatureScope(ProductVO.FeatureScope.builder().governmentFeatureResourceId(featureResources.get(0).getId()).build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user