Commit 95cd4b1a authored by itcast's avatar itcast

服务库服务基础管理接口-修改版

parent 9bbbea24
......@@ -4,12 +4,8 @@ import com.pms.ocp.common.utils.ExcelUtils;
import com.pms.ocp.common.utils.FileExport;
import com.pms.ocp.common.utils.FileUtil;
import com.pms.ocp.model.QueryResponseResult;
import com.pms.ocp.model.dto.ApiBaseDto;
import com.pms.ocp.model.dto.ApiTreeGroupDto;
import com.pms.ocp.model.dto.OcpApiBaseDto;
import com.pms.ocp.model.entity.OcpApiBase;
import com.pms.ocp.model.entity.OcpApiGroup;
import com.pms.ocp.model.vo.OcpApiBaseVo;
import com.pms.ocp.model.vo.ResponseVO;
......@@ -186,28 +182,4 @@ public class ApiBasicManagementController {
}
@ApiOperation("服务列表")
@GetMapping("/apiListQuery")
public QueryResponseResult apiListQuery(HttpServletRequest request, ApiBaseDto ApiBaseReq) {
QueryResponseResult apiBaseList= apiBasicManagementService.getBaseByGroupCode(ApiBaseReq);
return apiBaseList;
}
@ApiOperation("服务树一级")
@GetMapping("/apiBaseTree")
public ResponseVO<List<OcpApiGroup>> apiBaseTree(String apiGroupCompanyCode) {
List<OcpApiGroup> apiTreeGroupDtos = apiBasicManagementService.apiBaseTree(apiGroupCompanyCode);
return ResponseVO.ok(apiTreeGroupDtos);
}
@ApiOperation("服务树次级")
@GetMapping("/apiBaseTreeOther")
public ResponseVO<List<OcpApiGroup>> apiBaseTreeOther(String apiGroupCompanyCode,String apiGroupPcode) {
List<OcpApiGroup> apiTreeGroupDtos = apiBasicManagementService.apiBaseTreeOther(apiGroupCompanyCode,apiGroupPcode);
return ResponseVO.ok(apiTreeGroupDtos);
}
@ApiOperation("服务列表树最低级")
@GetMapping("/apiBaseTreeApiList")
public ResponseVO<List<OcpApiBase>> apiBaseTreeApiList(String apiGroupCompanyCode,String apiGroupPcode) {
List<OcpApiBase> apiTreeGroupDtos = apiBasicManagementService.apiBaseTreeApiList(apiGroupCompanyCode,apiGroupPcode);
return ResponseVO.ok(apiTreeGroupDtos);
}
}
......@@ -2,9 +2,12 @@ package com.pms.ocp.controller;
import com.pms.ocp.model.dto.OcpApiBaseDto;
import com.pms.ocp.model.dto.OcpTenantBaseDto;
import com.pms.ocp.model.dto.OcpTenantGroupDto;
import com.pms.ocp.model.vo.ResponseVO;
import com.pms.ocp.service.TenantBasicManagementService;
import com.pms.ocp.service.TenantService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -21,6 +24,8 @@ import java.util.List;
public class TenantBasicManagementController {
@Autowired
private TenantBasicManagementService tenantBasicManagementService;
@Autowired
private TenantService tenantService;
@ApiOperation("条件查询")
@GetMapping("/queryOcpTenantBaseDto")
......@@ -69,11 +74,13 @@ public class TenantBasicManagementController {
return tenantBasicManagementService.tenantCancel(tenantCodes);
}
@ApiOperation("应用注册")
@PostMapping("/apply/register")
public ResponseVO TenantRegister(@RequestBody(required = false) OcpTenantBaseDto ocpTenantBaseDto){
public ResponseVO TenantRegister(@RequestBody(required = false) OcpTenantBaseDto ocpTenantBaseDto) {
return tenantBasicManagementService.applyRegister(ocpTenantBaseDto);
return ResponseVO.ok();
}
}
package com.pms.ocp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pms.ocp.model.entity.OcpTenantGroup;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface OcpTenantGroupMapper extends BaseMapper<OcpTenantGroup> {
}
package com.pms.ocp.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pms.ocp.model.entity.OcpTenantGroup;
public interface OcpTenantGroupService extends IService<OcpTenantGroup> {
}
......@@ -40,4 +40,10 @@ public interface TenantBasicManagementService extends IService<OcpTenantBase> {
* @param tenantCodes
*/
ResponseVO tenantCancel(String tenantCodes);
/**
* 应用注册
* @param ocpTenantBaseDto
*/
ResponseVO applyRegister(OcpTenantBaseDto ocpTenantBaseDto);
}
......@@ -24,7 +24,7 @@ import com.pms.ocp.model.vo.OcpApiBaseVo;
import com.pms.ocp.model.vo.ResponseVO;
import com.pms.ocp.service.ApiBasicManagementService;
import com.pms.ocp.service.OcpApiExtentService;
import com.pms.ocp.service.OcpApiSubsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......
package com.pms.ocp.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pms.ocp.mapper.OcpTenantGroupMapper;
import com.pms.ocp.model.entity.OcpTenantGroup;
import com.pms.ocp.service.OcpTenantGroupService;
import org.springframework.stereotype.Service;
@Service
public class OcpTenantGroupServiceImpl extends ServiceImpl<OcpTenantGroupMapper, OcpTenantGroup> implements OcpTenantGroupService {
}
......@@ -7,14 +7,12 @@ import com.pms.ocp.mapper.OcpTenantExtentMapper;
import com.pms.ocp.mapper.TenantBasicManagementMapper;
import com.pms.ocp.model.dto.OcpApiBaseDto;
import com.pms.ocp.model.dto.OcpTenantBaseDto;
import com.pms.ocp.model.entity.OcpApiExtent;
import com.pms.ocp.model.entity.OcpTenantBase;
import com.pms.ocp.model.entity.OcpTenantExtent;
import com.pms.ocp.model.entity.OcpTenantSubs;
import com.pms.ocp.model.entity.*;
import com.pms.ocp.model.vo.ResponseVO;
import com.pms.ocp.service.OcpTenantExtentService;
import com.pms.ocp.service.OcpTenantSubsService;
import com.pms.ocp.service.TenantBasicManagementService;
import com.pms.ocp.service.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.util.StringUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -31,6 +29,10 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan
private OcpTenantExtentMapper ocpTenantExtentMapper;
@Autowired
private OcpTenantSubsService ocpTenantSubsService;
@Autowired
private OcpApiTenantRelService ocpApiTenantRelService;
@Autowired
private OcpTenantGroupService ocpTenantGroupService;
/**
* 条件查询
......@@ -117,4 +119,57 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan
return ResponseVO.ok();
}
/**
* 应用注册
*
* @param ocpTenantBaseDto
*/
@Override
public ResponseVO applyRegister(OcpTenantBaseDto ocpTenantBaseDto) {
//OcpTenantBase
String tenantGroupName = ocpTenantBaseDto.getTenantGroupName();//应用分类名称
LambdaQueryWrapper<OcpTenantGroup> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(OcpTenantGroup::getTenantGroupName, tenantGroupName);
OcpTenantGroup one = ocpTenantGroupService.getOne(lambdaQueryWrapper);
if (one == null) {
return ResponseVO.error("该应用分类不存在");
}
//获取应用分类编码
String tenantGroupCode = one.getTenantGroupCode();
OcpTenantBase ocpTenantBase = new OcpTenantBase();
BeanUtils.copyProperties(ocpTenantBaseDto, ocpTenantBase);
ocpTenantBase.setTenantGroupCode(tenantGroupCode);
//OcpTenantBase
tenantBasicManagementMapper.insert(ocpTenantBase);
//ocp_tenant_extent
OcpTenantExtent ocpTenantExtent = new OcpTenantExtent();
BeanUtils.copyProperties(ocpTenantBaseDto, ocpTenantExtent);
ocpTenantExtent.setDepCompanyCode(null);
ocpTenantExtentMapper.insert(ocpTenantExtent);
//ocp_api_tenant_rel
String apiCodes = ocpTenantBaseDto.getApiCodes();
if (StringUtils.isEmpty(apiCodes)) {
return ResponseVO.error("服务编码为空");
} else {
OcpApiTenantRel ocpApiTenantRel = new OcpApiTenantRel();
String[] split = apiCodes.split(",");
List<String> apiCode = Arrays.asList(split);
String tenantCode = ocpTenantBaseDto.getTenantCode();
for (String s : apiCode) {
ocpApiTenantRel.setApiCode(s);
ocpApiTenantRel.setTenantDepCompanyCode(null);
ocpApiTenantRel.setApiDepCompanyCode(null);
ocpApiTenantRel.setTenantCode(tenantCode);
ocpApiTenantRel.setApiTenantRelCtime(Timestamp.valueOf(LocalDateTime.now()));
ocpApiTenantRel.setApiTenantRelMtime(Timestamp.valueOf(LocalDateTime.now()));
//保存到数据库
ocpApiTenantRelService.save(ocpApiTenantRel);
}
}
return ResponseVO.ok();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment