Commit 760df5fe authored by itcast's avatar itcast

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

parent e08331f8
package com.pms.ocp.common.utils;
import com.pms.ocp.model.vo.Menu;
import java.util.ArrayList;
import java.util.List;
public class MenuTree {
private List<Menu> menuList = new ArrayList<Menu>();
public MenuTree(List<Menu> menuList) {
this.menuList=menuList;
}
//建立树形结构
public List<Menu> builTree(){
List<Menu> treeMenus =new ArrayList<Menu>();
for(Menu menuNode : getRootNode()) {
menuNode=buildChilTree(menuNode);
treeMenus.add(menuNode);
}
return treeMenus;
}
//递归,建立子树形结构
private Menu buildChilTree(Menu pNode){
List<Menu> chilMenus =new ArrayList<Menu>();
for(Menu menuNode : menuList) {
if(menuNode.getParentId().equals(pNode.getId())) {
chilMenus.add(buildChilTree(menuNode));
}
}
pNode.setChildren(chilMenus);
return pNode;
}
//获取根节点
private List<Menu> getRootNode() {
List<Menu> rootMenuLists =new ArrayList<Menu>();
for(Menu menuNode : menuList) {
if("0".equals(menuNode.getParentId())) {
rootMenuLists.add(menuNode);
}
}
return rootMenuLists;
}
}
\ No newline at end of file
...@@ -9,6 +9,7 @@ import com.pms.ocp.model.QueryResponseResult; ...@@ -9,6 +9,7 @@ import com.pms.ocp.model.QueryResponseResult;
import com.pms.ocp.model.dto.ApiBaseDto; import com.pms.ocp.model.dto.ApiBaseDto;
import com.pms.ocp.model.dto.ApiTreeGroupDto; import com.pms.ocp.model.dto.ApiTreeGroupDto;
import com.pms.ocp.model.dto.OcpApiBaseDto; import com.pms.ocp.model.dto.OcpApiBaseDto;
import com.pms.ocp.model.dto.WholeLinkParamDto;
import com.pms.ocp.model.entity.OcpApiBase; import com.pms.ocp.model.entity.OcpApiBase;
import com.pms.ocp.model.entity.OcpApiGroup; import com.pms.ocp.model.entity.OcpApiGroup;
import com.pms.ocp.model.vo.OcpApiBaseVo; import com.pms.ocp.model.vo.OcpApiBaseVo;
...@@ -16,11 +17,12 @@ import com.pms.ocp.model.vo.ResponseVO; ...@@ -16,11 +17,12 @@ import com.pms.ocp.model.vo.ResponseVO;
import com.pms.ocp.service.ApiBasicManagementService; import com.pms.ocp.service.ApiBasicManagementService;
import com.pms.ocp.service.ApiDetailsService; import com.pms.ocp.service.ApiDetailsService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.omg.PortableInterceptor.Interceptor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -41,6 +43,7 @@ public class ApiBasicManagementController { ...@@ -41,6 +43,7 @@ public class ApiBasicManagementController {
@Autowired @Autowired
private ApiBasicManagementService apiBasicManagementService; private ApiBasicManagementService apiBasicManagementService;
@ApiOperation("条件查询") @ApiOperation("条件查询")
@GetMapping("/queryOcpApiBaseDto") @GetMapping("/queryOcpApiBaseDto")
public ResponseVO<List<OcpApiBaseVo>> queryOcpApiBaseDto(@RequestParam(required = false) String apiCode, public ResponseVO<List<OcpApiBaseVo>> queryOcpApiBaseDto(@RequestParam(required = false) String apiCode,
...@@ -208,4 +211,11 @@ public class ApiBasicManagementController { ...@@ -208,4 +211,11 @@ public class ApiBasicManagementController {
return ResponseVO.ok(apiTreeGroupDtos); return ResponseVO.ok(apiTreeGroupDtos);
} }
// @PostMapping("/apiTree")
// @ApiOperation("服务列表2")
// public ResponseVO queryTreeData(@RequestBody WholeLinkParamDto wholeLinkParamDto) {
// return apiBasicManagementService.queryApiTreeData(wholeLinkParamDto);
// }
} }
package com.pms.ocp.controller; package com.pms.ocp.controller;
import com.pms.ocp.model.dto.OcpApiBaseDto; import com.github.pagehelper.PageInfo;
import com.pms.ocp.model.dto.OcpTenantBaseDto; import com.pms.ocp.model.dto.*;
import com.pms.ocp.model.dto.OcpTenantGroupDto;
import com.pms.ocp.model.entity.OcpApiGroup; import com.pms.ocp.model.entity.OcpApiGroup;
import com.pms.ocp.model.entity.OcpTenantGroup; import com.pms.ocp.model.entity.OcpTenantGroup;
import com.pms.ocp.model.vo.OcpApiBaseVo;
import com.pms.ocp.model.vo.ResponseVO; import com.pms.ocp.model.vo.ResponseVO;
import com.pms.ocp.service.TenantBasicManagementService; import com.pms.ocp.service.TenantBasicManagementService;
import com.pms.ocp.service.TenantService; import com.pms.ocp.service.TenantService;
...@@ -16,6 +16,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -16,6 +16,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List; import java.util.List;
...@@ -47,25 +48,20 @@ public class TenantBasicManagementController { ...@@ -47,25 +48,20 @@ public class TenantBasicManagementController {
@ApiOperation("应用发布") @ApiOperation("应用发布")
@PostMapping("/issue") @PostMapping("/issue")
public ResponseVO TenantIssue(@RequestParam(required = false) String tenantPromotion, public ResponseVO TenantIssue(
@RequestParam(required = false) String tenantCodes) { @RequestParam(required = false) String tenantCodes) {
// if (StringUtils.isEmpty(tenantPromotion) || tenantPromotion.equals("0")) {
// return ResponseVO.error("统招");
// } else {
return tenantBasicManagementService.tenantIssue(tenantCodes); return tenantBasicManagementService.tenantIssue(tenantCodes);
// }
} }
@ApiOperation("应用订阅") @ApiOperation("应用订阅")
@PostMapping("/login") @PostMapping("/login")
public ResponseVO TenantLogin(@RequestParam(required = false) String tenantPromotion, public ResponseVO TenantLogin(
@RequestParam(required = false) String tenantCodes) { @RequestParam(required = false) String tenantCodes,
// if (StringUtils.isEmpty(tenantPromotion) || tenantPromotion.equals("0")) { @RequestParam(required = false) String companyCode) {
// return ResponseVO.error("统招");
// } else { return tenantBasicManagementService.tenantLogin(tenantCodes,companyCode);
tenantBasicManagementService.tenantLogin(tenantCodes);
return ResponseVO.ok();
// }
} }
...@@ -84,11 +80,18 @@ public class TenantBasicManagementController { ...@@ -84,11 +80,18 @@ public class TenantBasicManagementController {
} }
@ApiOperation("应用树层级") @ApiOperation("应用树层级")
@GetMapping("/apiBaseTreeOther") @GetMapping("/tenantBaseTreeOther")
public ResponseVO<List<OcpTenantGroup>> tenantBaseTreeOther(String tenantGroupCode, String tenantGroupPcode) { public ResponseVO<List<OcpTenantGroup>> tenantBaseTreeOther(String tenantGroupCode, String tenantGroupPcode) {
List<OcpTenantGroup> ocpApiGroups = tenantBasicManagementService.tenantBaseTreeOther(tenantGroupCode,tenantGroupPcode); List<OcpTenantGroup> ocpApiGroups = tenantBasicManagementService.tenantBaseTreeOther(tenantGroupCode,tenantGroupPcode);
return ResponseVO.ok(ocpApiGroups); return ResponseVO.ok(ocpApiGroups);
} }
@ApiOperation("应用列表")
@GetMapping("/tenantListQuery")
public ResponseVO<PageInfo<OcpTenantBaseDto>> tenantListQuery(HttpServletRequest request, TenantDto tenantDto) {
return tenantBasicManagementService.getBaseByGroupCode(tenantDto);
}
} }
...@@ -5,6 +5,7 @@ import com.pms.ocp.model.dto.ApiBaseDto; ...@@ -5,6 +5,7 @@ import com.pms.ocp.model.dto.ApiBaseDto;
import com.pms.ocp.model.entity.OcpApiBase; import com.pms.ocp.model.entity.OcpApiBase;
import com.pms.ocp.model.entity.OcpApiGroup; import com.pms.ocp.model.entity.OcpApiGroup;
import com.pms.ocp.model.vo.OcpApiBaseVo; import com.pms.ocp.model.vo.OcpApiBaseVo;
import com.pms.ocp.model.vo.WholeLinkTreeVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
...@@ -19,4 +20,6 @@ public interface OcpApiGroupMapper extends BaseMapper<OcpApiGroup> { ...@@ -19,4 +20,6 @@ public interface OcpApiGroupMapper extends BaseMapper<OcpApiGroup> {
List<OcpApiBase> selectByPcode(String code); List<OcpApiBase> selectByPcode(String code);
List<OcpApiBaseVo> selectPageLists(ApiBaseDto apiBaseReq); List<OcpApiBaseVo> selectPageLists(ApiBaseDto apiBaseReq);
// List<WholeLinkTreeVo> queryApiTreeData1();
} }
...@@ -2,6 +2,8 @@ package com.pms.ocp.mapper; ...@@ -2,6 +2,8 @@ package com.pms.ocp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pms.ocp.model.dto.OcpTenantBaseDto;
import com.pms.ocp.model.dto.TenantDto;
import com.pms.ocp.model.entity.OcpTenantGroup; import com.pms.ocp.model.entity.OcpTenantGroup;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -11,4 +13,6 @@ import java.util.List; ...@@ -11,4 +13,6 @@ import java.util.List;
@Mapper @Mapper
public interface OcpTenantGroupMapper extends BaseMapper<OcpTenantGroup> { public interface OcpTenantGroupMapper extends BaseMapper<OcpTenantGroup> {
List<OcpTenantGroup> tenantBaseTreeOther(@Param("tenantGroupCode") String tenantGroupCode, @Param("tenantGroupPcode") String tenantGroupPcode); List<OcpTenantGroup> tenantBaseTreeOther(@Param("tenantGroupCode") String tenantGroupCode, @Param("tenantGroupPcode") String tenantGroupPcode);
List<OcpTenantBaseDto> selectPageLists(TenantDto tenantDto);
} }
...@@ -14,7 +14,7 @@ import java.sql.Timestamp; ...@@ -14,7 +14,7 @@ import java.sql.Timestamp;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ApiModel("应用列表查询参数") @ApiModel("服务列表查询参数")
public class ApiBaseDto implements Serializable { public class ApiBaseDto implements Serializable {
@ApiModelProperty("服务编码") @ApiModelProperty("服务编码")
......
package com.pms.ocp.model.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.sql.Timestamp;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("服务列表查询参数")
public class TenantDto implements Serializable {
@ApiModelProperty("应用编码")
private String tenantCode;
@ApiModelProperty("应用分类编码")
private String tenantGroupCode;
@ApiModelProperty("应用分类公司")
private String tenantGroupCompanyCode;
@ApiModelProperty("建设单位")
private String tenantUnit;
// @ApiModelProperty("推广类型0:统建;1:自建")
// private Integer apiPromotion;
@ApiModelProperty("注册时段-开始")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Timestamp startTime;
@ApiModelProperty("注册时段-结束")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Timestamp endTime;
@ApiModelProperty("注册开始")
private String startCTime;
@ApiModelProperty("注册结束")
private String endCTime;
@ApiModelProperty("关键字")
private String keyword;
@ApiModelProperty("当前页")
private Integer pageNum;
@ApiModelProperty("每页条数")
private Integer pageSize;
// public Integer getApiPromotion() {
// return apiPromotion;
// }
//
// public void setApiPromotion(Integer apiPromotion) {
// this.apiPromotion = apiPromotion;
// }
public String getTenantCode() {
return tenantCode;
}
public void setTenantCode(String tenantCode) {
this.tenantCode = tenantCode;
}
public String getTenantGroupCode() {
return tenantGroupCode;
}
public void setTenantGroupCode(String tenantGroupCode) {
this.tenantGroupCode = tenantGroupCode;
}
public String getTenantGroupCompanyCode() {
return tenantGroupCompanyCode;
}
public void setTenantGroupCompanyCode(String tenantGroupCompanyCode) {
this.tenantGroupCompanyCode = tenantGroupCompanyCode;
}
public String getTenantUnit() {
return tenantUnit;
}
public void setTenantUnit(String tenantUnit) {
this.tenantUnit = tenantUnit;
}
public Timestamp getStartTime() {
return startTime;
}
public void setStartTime(Timestamp startTime) {
this.startTime = startTime;
}
public Timestamp getEndTime() {
return endTime;
}
public void setEndTime(Timestamp endTime) {
this.endTime = endTime;
}
public String getStartCTime() {
return startCTime;
}
public void setStartCTime(String startCTime) {
this.startCTime = startCTime;
}
public String getEndCTime() {
return endCTime;
}
public void setEndCTime(String endCTime) {
this.endCTime = endCTime;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
public Integer getPageNum() {
return pageNum;
}
public void setPageNum(Integer pageNum) {
this.pageNum = pageNum;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
}
package com.pms.ocp.model.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@ApiModel(value = "全链路拓扑图传输参数")
@Data
public class WholeLinkParamDto implements Serializable {
@ApiModelProperty(value = "开始时间")
private String beginTime;
@ApiModelProperty(value = "结束时间")
private String endTime;
@ApiModelProperty(value = "服务code")
private String apiCode;
@ApiModelProperty(value = "应用code")
private String tenantCode;
@ApiModelProperty(value = "公司code")
private String companyCode;
}
...@@ -143,11 +143,11 @@ public class OcpTenantSubs implements Serializable { ...@@ -143,11 +143,11 @@ public class OcpTenantSubs implements Serializable {
*/ */
@ApiModelProperty("应用状态0:设计态;1:运行态") @ApiModelProperty("应用状态0:设计态;1:运行态")
private Short tenantState; private Short tenantState;
/** // /**
* 推广类型0:统建;1:自建 // * 推广类型0:统建;1:自建
*/ // */
@ApiModelProperty("推广类型0:统建;1:自建") // @ApiModelProperty("推广类型0:统建;1:自建")
private long tenantPromotion; // private long tenantPromotion;
/** /**
* 建设单位 * 建设单位
*/ */
......
package com.pms.ocp.model.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
@ApiModel(value = "菜单栏目Vo", description = "菜单栏目Vo")
public class Menu implements Serializable {
@ApiModelProperty(value = "id")
private String id;
@ApiModelProperty(value = "parentId")
private String parentId;
@ApiModelProperty(value = "内容")
private String text;
@ApiModelProperty(value = "类型")
private String type;
@ApiModelProperty(value = "子集")
private List<Menu> children;
public Menu() {
this.id=id;
this.parentId=parentId;
this.text=text;
this.type=type;
}
}
\ No newline at end of file
package com.pms.ocp.model.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.io.Serializable;
@Data
@AllArgsConstructor
@ApiModel(value = "全链路拓扑图树信息", description = "全链路拓扑图树信息")
public class WholeLinkTreeVo implements Serializable {
// @ApiModelProperty(value = "推广类型(0-统建,1-自建)")
// private String apiPromotion;
@ApiModelProperty(value = "服务分类code")
private String apiGroupCode;
@ApiModelProperty(value = "服务分类名称")
private String apiGroupName;
@ApiModelProperty(value = "服务分类父节点code")
private String apiGroupPcode;
@ApiModelProperty(value = "推广类型")
private String apiGroupPromotionType;
}
...@@ -6,6 +6,7 @@ import com.pms.ocp.model.QueryResponseResult; ...@@ -6,6 +6,7 @@ import com.pms.ocp.model.QueryResponseResult;
import com.pms.ocp.model.dto.ApiBaseDto; import com.pms.ocp.model.dto.ApiBaseDto;
import com.pms.ocp.model.dto.ApiTreeGroupDto; import com.pms.ocp.model.dto.ApiTreeGroupDto;
import com.pms.ocp.model.dto.OcpApiBaseDto; import com.pms.ocp.model.dto.OcpApiBaseDto;
import com.pms.ocp.model.dto.WholeLinkParamDto;
import com.pms.ocp.model.entity.OcpApiBase; import com.pms.ocp.model.entity.OcpApiBase;
import com.pms.ocp.model.entity.OcpApiExtent; import com.pms.ocp.model.entity.OcpApiExtent;
import com.pms.ocp.model.entity.OcpApiGroup; import com.pms.ocp.model.entity.OcpApiGroup;
...@@ -88,4 +89,11 @@ public interface ApiBasicManagementService extends IService<OcpApiBase> { ...@@ -88,4 +89,11 @@ public interface ApiBasicManagementService extends IService<OcpApiBase> {
* @return * @return
*/ */
List<OcpApiBase> apiBaseTreeApiList(String apiGroupCompanyCode, String apiGroupPcode); List<OcpApiBase> apiBaseTreeApiList(String apiGroupCompanyCode, String apiGroupPcode);
// /**
// * 服务列表2
// * @param wholeLinkParamDto
// * @return
// */
// ResponseVO queryApiTreeData(WholeLinkParamDto wholeLinkParamDto);
} }
package com.pms.ocp.service; package com.pms.ocp.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.pms.ocp.model.dto.OcpTenantBaseDto; import com.pms.ocp.model.dto.OcpTenantBaseDto;
import com.pms.ocp.model.dto.TenantDto;
import com.pms.ocp.model.entity.OcpApiGroup; import com.pms.ocp.model.entity.OcpApiGroup;
import com.pms.ocp.model.entity.OcpTenantBase; import com.pms.ocp.model.entity.OcpTenantBase;
import com.pms.ocp.model.entity.OcpTenantGroup; import com.pms.ocp.model.entity.OcpTenantGroup;
import com.pms.ocp.model.vo.OcpApiBaseVo;
import com.pms.ocp.model.vo.ResponseVO; import com.pms.ocp.model.vo.ResponseVO;
import java.sql.Timestamp; import java.sql.Timestamp;
...@@ -35,11 +38,12 @@ public interface TenantBasicManagementService extends IService<OcpTenantBase> { ...@@ -35,11 +38,12 @@ public interface TenantBasicManagementService extends IService<OcpTenantBase> {
* 应用订阅 * 应用订阅
* @param tenantCodes * @param tenantCodes
*/ */
void tenantLogin(String tenantCodes); ResponseVO tenantLogin(String tenantCodes,String companyCode);
/** /**
* 应用下线 * 下线
* @param tenantCodes * @param tenantCodes
* @return
*/ */
ResponseVO tenantCancel(String tenantCodes); ResponseVO tenantCancel(String tenantCodes);
...@@ -56,4 +60,11 @@ public interface TenantBasicManagementService extends IService<OcpTenantBase> { ...@@ -56,4 +60,11 @@ public interface TenantBasicManagementService extends IService<OcpTenantBase> {
* @return * @return
*/ */
List<OcpTenantGroup> tenantBaseTreeOther(String tenantGroupCode, String tenantGroupPcode); List<OcpTenantGroup> tenantBaseTreeOther(String tenantGroupCode, String tenantGroupPcode);
/**
* 应用列表
* @param tenantDto
* @return
*/
ResponseVO<PageInfo<OcpTenantBaseDto>> getBaseByGroupCode(TenantDto tenantDto);
} }
...@@ -10,6 +10,7 @@ import com.github.pagehelper.PageHelper; ...@@ -10,6 +10,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.pms.ocp.common.constants.StringUtils; import com.pms.ocp.common.constants.StringUtils;
import com.pms.ocp.common.exception.BeagleException; import com.pms.ocp.common.exception.BeagleException;
import com.pms.ocp.common.utils.MenuTree;
import com.pms.ocp.mapper.ApiBasicManagementMapper; import com.pms.ocp.mapper.ApiBasicManagementMapper;
import com.pms.ocp.mapper.OcpApiExtentMapper; import com.pms.ocp.mapper.OcpApiExtentMapper;
import com.pms.ocp.mapper.OcpApiGroupMapper; import com.pms.ocp.mapper.OcpApiGroupMapper;
...@@ -18,13 +19,12 @@ import com.pms.ocp.model.CommonCode; ...@@ -18,13 +19,12 @@ import com.pms.ocp.model.CommonCode;
import com.pms.ocp.model.QueryResponseResult; import com.pms.ocp.model.QueryResponseResult;
import com.pms.ocp.model.dto.ApiBaseDto; import com.pms.ocp.model.dto.ApiBaseDto;
import com.pms.ocp.model.dto.OcpApiBaseDto; import com.pms.ocp.model.dto.OcpApiBaseDto;
import com.pms.ocp.model.dto.WholeLinkParamDto;
import com.pms.ocp.model.entity.OcpApiBase; import com.pms.ocp.model.entity.OcpApiBase;
import com.pms.ocp.model.entity.OcpApiExtent; import com.pms.ocp.model.entity.OcpApiExtent;
import com.pms.ocp.model.entity.OcpApiGroup; import com.pms.ocp.model.entity.OcpApiGroup;
import com.pms.ocp.model.entity.OcpApiSubs; import com.pms.ocp.model.entity.OcpApiSubs;
import com.pms.ocp.model.vo.OcpApiBaseVo; import com.pms.ocp.model.vo.*;
import com.pms.ocp.model.vo.OcpModelGroupVO;
import com.pms.ocp.model.vo.ResponseVO;
import com.pms.ocp.service.ApiBasicManagementService; import com.pms.ocp.service.ApiBasicManagementService;
import com.pms.ocp.service.OcpApiExtentService; import com.pms.ocp.service.OcpApiExtentService;
...@@ -216,6 +216,28 @@ public class ApiBasicManagementServiceImpl extends ServiceImpl<ApiBasicManagemen ...@@ -216,6 +216,28 @@ public class ApiBasicManagementServiceImpl extends ServiceImpl<ApiBasicManagemen
return apiBasicManagementMapper.selectList(qw); return apiBasicManagementMapper.selectList(qw);
} }
// /**
// * 服务列表2
// * @param wholeLinkParamDto
// * @return
// */
// @Override
// public ResponseVO queryApiTreeData(WholeLinkParamDto wholeLinkParamDto) {
// List<WholeLinkTreeVo> apiTreeDataList = ocpApiGroupMapper.queryApiTreeData1();
// List<Menu> list = new ArrayList<>();
// for (WholeLinkTreeVo wholeLinkTreeVo : apiTreeDataList) {
// Menu menu = new Menu();
// menu.setId(wholeLinkTreeVo.getApiGroupCode());
// menu.setParentId(wholeLinkTreeVo.getApiGroupPcode());
// menu.setText(wholeLinkTreeVo.getApiGroupName());
// menu.setType(wholeLinkTreeVo.getApiGroupPromotionType());
// list.add(menu);
// }
// MenuTree menuTree = new MenuTree(list);
// list = menuTree.builTree();
// return ResponseVO.ok(list);
// }
/** /**
* 分组权限分组使用in查询 * 分组权限分组使用in查询
* *
......
...@@ -3,12 +3,16 @@ package com.pms.ocp.service.impl; ...@@ -3,12 +3,16 @@ package com.pms.ocp.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pms.ocp.mapper.OcpTenantExtentMapper; import com.pms.ocp.mapper.OcpTenantExtentMapper;
import com.pms.ocp.mapper.OcpTenantGroupMapper; import com.pms.ocp.mapper.OcpTenantGroupMapper;
import com.pms.ocp.mapper.TenantBasicManagementMapper; import com.pms.ocp.mapper.TenantBasicManagementMapper;
import com.pms.ocp.model.dto.OcpApiBaseDto; import com.pms.ocp.model.dto.OcpApiBaseDto;
import com.pms.ocp.model.dto.OcpTenantBaseDto; import com.pms.ocp.model.dto.OcpTenantBaseDto;
import com.pms.ocp.model.dto.TenantDto;
import com.pms.ocp.model.entity.*; import com.pms.ocp.model.entity.*;
import com.pms.ocp.model.vo.OcpApiBaseVo;
import com.pms.ocp.model.vo.ResponseVO; import com.pms.ocp.model.vo.ResponseVO;
import com.pms.ocp.service.*; import com.pms.ocp.service.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -19,8 +23,10 @@ import org.springframework.stereotype.Service; ...@@ -19,8 +23,10 @@ import org.springframework.stereotype.Service;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicManagementMapper, OcpTenantBase> implements TenantBasicManagementService { public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicManagementMapper, OcpTenantBase> implements TenantBasicManagementService {
...@@ -37,6 +43,8 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan ...@@ -37,6 +43,8 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan
@Autowired @Autowired
private OcpTenantGroupMapper ocpTenantGroupMapper; private OcpTenantGroupMapper ocpTenantGroupMapper;
List<String> tenantGroupCode = new ArrayList<>();
/** /**
* 条件查询 * 条件查询
* *
...@@ -63,6 +71,9 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan ...@@ -63,6 +71,9 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan
*/ */
@Override @Override
public ResponseVO tenantIssue(String tenantCodes) { public ResponseVO tenantIssue(String tenantCodes) {
if (StringUtils.isEmpty(tenantCodes)) {
return ResponseVO.error("请选择要下线的应用");
}
String[] split = tenantCodes.split(","); String[] split = tenantCodes.split(",");
List<String> list = Arrays.asList(split); List<String> list = Arrays.asList(split);
LambdaQueryWrapper<OcpTenantExtent> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OcpTenantExtent> lambdaQueryWrapper = new LambdaQueryWrapper<>();
...@@ -85,18 +96,26 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan ...@@ -85,18 +96,26 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan
* @param tenantCodes * @param tenantCodes
*/ */
@Override @Override
public void tenantLogin(String tenantCodes) { public ResponseVO tenantLogin(String tenantCodes, String companyCode) {
if (StringUtils.isEmpty(tenantCodes)) {
return ResponseVO.error("请选择要下线的应用");
}
if (StringUtils.isEmpty(companyCode)) {
return ResponseVO.error("公司编码为空");
}
String[] split = tenantCodes.split(","); String[] split = tenantCodes.split(",");
List<String> tenantCode = Arrays.asList(split); List<String> tenantCode = Arrays.asList(split);
for (String s : tenantCode) { for (String s : tenantCode) {
OcpTenantSubs ocpTenantSubs = new OcpTenantSubs(); OcpTenantSubs ocpTenantSubs = new OcpTenantSubs();
ocpTenantSubs.setTenantCode(s); ocpTenantSubs.setTenantCode(s);
ocpTenantSubs.setSubsCompanyCode(null); ocpTenantSubs.setSubsCompanyCode(companyCode);
ocpTenantSubs.setSubsLogTenantAtime(Timestamp.valueOf(LocalDateTime.now())); ocpTenantSubs.setSubsLogTenantAtime(Timestamp.valueOf(LocalDateTime.now()));
ocpTenantSubs.setSubsLogTenantCtime(Timestamp.valueOf(LocalDateTime.now())); ocpTenantSubs.setSubsLogTenantCtime(Timestamp.valueOf(LocalDateTime.now()));
ocpTenantSubs.setSubsLogTenantMtime(Timestamp.valueOf(LocalDateTime.now())); ocpTenantSubs.setSubsLogTenantMtime(Timestamp.valueOf(LocalDateTime.now()));
ocpTenantSubs.setIsDelete((short) 0);
ocpTenantSubsService.save(ocpTenantSubs); ocpTenantSubsService.save(ocpTenantSubs);
} }
return ResponseVO.ok("订阅成功");
} }
/** /**
...@@ -106,20 +125,29 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan ...@@ -106,20 +125,29 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan
*/ */
@Override @Override
public ResponseVO tenantCancel(String tenantCodes) { public ResponseVO tenantCancel(String tenantCodes) {
if (StringUtils.isEmpty(tenantCodes)) {
return ResponseVO.error("请选择要下线的应用");
}
String[] split = tenantCodes.split(","); String[] split = tenantCodes.split(",");
List<String> list = Arrays.asList(split); List<String> list = Arrays.asList(split);
LambdaQueryWrapper<OcpTenantExtent> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OcpTenantExtent> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(OcpTenantExtent::getTenantCode, list); lambdaQueryWrapper.in(OcpTenantExtent::getTenantCode, list);
List<OcpTenantExtent> ocpTenantExtents = ocpTenantExtentMapper.selectList(lambdaQueryWrapper); List<OcpTenantExtent> ocpTenantExtents = ocpTenantExtentMapper.selectList(lambdaQueryWrapper);
for (OcpTenantExtent ocpTenantExtent : ocpTenantExtents) { for (OcpTenantExtent ocpTenantExtent : ocpTenantExtents) {
// if (ocpTenantExtent == null) {
// return ResponseVO.error("未知错误");
// }
if (ocpTenantExtent.getTenantState() == 2) { if (ocpTenantExtent.getTenantState() == 2) {
return ResponseVO.error("已下线"); return ResponseVO.error("已下线");
} else { } else {
ocpTenantExtent.setTenantState((short) 2); ocpTenantExtent.setTenantState((short) 2);
ocpTenantExtentMapper.updateById(ocpTenantExtent); ocpTenantExtentMapper.updateById(ocpTenantExtent);
} }
} }
return ResponseVO.ok(); return ResponseVO.ok("操作成功");
} }
/** /**
...@@ -184,8 +212,51 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan ...@@ -184,8 +212,51 @@ public class TenantBasicManagementServiceImpl extends ServiceImpl<TenantBasicMan
*/ */
@Override @Override
public List<OcpTenantGroup> tenantBaseTreeOther(String tenantGroupCode, String tenantGroupPcode) { public List<OcpTenantGroup> tenantBaseTreeOther(String tenantGroupCode, String tenantGroupPcode) {
List<OcpTenantGroup> ocpTenantGroups=ocpTenantGroupMapper.tenantBaseTreeOther(tenantGroupCode,tenantGroupPcode); List<OcpTenantGroup> ocpTenantGroups = ocpTenantGroupMapper.tenantBaseTreeOther(tenantGroupCode, tenantGroupPcode);
return ocpTenantGroups; return ocpTenantGroups;
} }
/**
* 应用列表
*
* @param tenantDto
* @return
*/
@Override
public ResponseVO<PageInfo<OcpTenantBaseDto>> getBaseByGroupCode(TenantDto tenantDto) {
if (tenantDto.getPageNum() == null || tenantDto.getPageSize() == null) {
ResponseVO.error("分页参数不能为空");
}
tenantGroupCode.add(tenantDto.getTenantCode());
setGroupIdValue(tenantDto.getTenantGroupCompanyCode(), tenantDto.getTenantCode());
PageHelper.startPage(tenantDto.getPageNum(), tenantDto.getPageSize());
List<OcpTenantBaseDto> ocpTenantBaseDto = ocpTenantGroupMapper.selectPageLists(tenantDto);
tenantGroupCode.clear();
PageInfo<OcpTenantBaseDto> pageInfo = new PageInfo<>(ocpTenantBaseDto);
return ResponseVO.ok(pageInfo);
// List<OcpApiBaseVo> ocpApiBaseVos = ocpApiGroupMapper.selectPageLists(apiBaseReq);
// tenantGroupCode.clear();
// PageInfo<OcpApiBaseVo> pageInfo = new PageInfo<>(ocpApiBaseVos);
// return ResponseVO.ok(pageInfo);
}
private void setGroupIdValue(String apiGroupCompanyCode, String code) {
List<String> codes = getIdsByPIdPub(apiGroupCompanyCode, code);
if (codes.size() > 0) {
for (String cod : codes) {
setGroupIdValue(apiGroupCompanyCode, cod);
tenantGroupCode.add(cod);
}
;
}
}
public List<String> getIdsByPIdPub(String apiGroupCompanyCode, String code) {
List<OcpTenantGroup> ocpTenantGroups = ocpTenantGroupMapper.tenantBaseTreeOther(apiGroupCompanyCode, code);
return ocpTenantGroups.stream().map(OcpTenantGroup::getTenantGroupCode).collect(Collectors.toList());
}
} }
...@@ -79,4 +79,9 @@ ...@@ -79,4 +79,9 @@
</if> </if>
</select> </select>
<!-- <select id="queryApiTreeData1" resultType="com.pms.ocp.model.vo.WholeLinkTreeVo">-->
<!-- select api_group_code ,api_group_name ,api_group_pcode ,api_group_promotion_type from operating_platform.ocp_api_group-->
<!-- </select>-->
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pms.ocp.mapper.OcpTenantGroupMapper"> <mapper namespace="com.pms.ocp.mapper.OcpTenantGroupMapper">
<resultMap id="ctbMap" type="com.pms.ocp.model.dto.OcpTenantBaseDto">
<result property="objId" column="obj_id"/>
<result property="tenantCode" column="api_code"/>
<result property="tenantName" column="api_name"/>
<result property="tenantGroupName" column="cluster_name"/>
<result property="tenantUrl" column="space_name"/>
<result property="clusterName" column="api_unit"/>
<result property="spaceName" column="api_ctime"/>
<result property="deploymentName" column="api_state"/>
<result property="tenantZone" column="api_url"/>
<result property="tenantCtime" column="api_code"/>
<result property="tenantUnit" column="api_code"/>
</resultMap>
<select id="tenantBaseTreeOther" resultType="com.pms.ocp.model.entity.OcpTenantGroup"> <select id="tenantBaseTreeOther" resultType="com.pms.ocp.model.entity.OcpTenantGroup">
select tenant_group_code,tenant_group_name,tenant_group_pcode,tenant_group_level from ocp_tenant_group where select tenant_group_code,tenant_group_name,tenant_group_pcode,tenant_group_level from ocp_tenant_group where
is_delete = 0 is_delete = 0
<if test="tenantGroupPcode ==null">
and tenant_group_pcode is null <if test="tenantGroupCode !=null and tenantGroupCode!=''">
and tenant_group_pcode=#{tenantGroupCode}
</if> </if>
<if test="tenantGroupPcode !=null and tenantGroupPcode !=''"> </select>
and tenant_group_pcode =#{tenantGroupPcode}
<select id="selectPageLists" resultMap="ctbMap">
select
otb.obj_id,otb.tenant_code,otb.tenant_name,otg.tenant_group_name,otb.tenant_url,ote.cluster_name,ote.space_name,
ote.deployment_name,otb.tenant_zone,otb.tenant_ctime,otb.tenant_unit
from ocp_tenant_base otb
join ocp_tenant_extent ote on otb.tenant_code=ote.tenant_code
join ocp_tenant_group otg on otb.tenant_group_code =otg.tenant_group_code
WHERE otg.is_delete=0
<if test="tenantCode !=null and tenantCode!=''">
and otb.tenant_code = #{tenantCode}
</if> </if>
<if test="tenantGroupCode !=null and tenantGroupCode!=''"> <if test="tenantGroupCode !=null and tenantGroupCode!=''">
and tenant_group_code=#{tenantGroupCode} and otb.tenant_group_code = #{tenantGroupCode}
</if> </if>
</select>
<if test="startTime !=null ">
<![CDATA[
and otb.tenant_ctime >= #{startCTime}
]]>
</if>
<if test="endTime !=null ">
<![CDATA[
and otb.tenant_ctime <= #{endCTime}
]]>
</if>
<if test="keyword !=null and keyword != '' ">
and otb.tenant_name like CONCAT('%', #{keyword}::text,'%')
</if>
<if test="keyword !=null and keyword != '' ">
and otb.tenant_code like CONCAT('%', #{keyword}::text,'%')
</if>
</select>
</mapper> </mapper>
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