应用服务管理

This commit is contained in:
Wenchao Gong 2021-09-08 17:44:34 +08:00
parent a59f2c2e4b
commit ea42d0b6aa
18 changed files with 1492 additions and 17 deletions

View File

@ -0,0 +1,113 @@
package com.ruoyi.isc.controller;
import java.util.List;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import lombok.RequiredArgsConstructor;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.*;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.common.core.validate.QueryGroup;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.isc.domain.vo.IscAppServiceVo;
import com.ruoyi.isc.domain.bo.IscAppServiceBo;
import com.ruoyi.isc.service.IIscAppServiceService;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 应用服务Controller
*
* @author Wenchao Gong
* @date 2021-09-08
*/
@Validated
@Api(value = "应用服务控制器", tags = {"应用服务管理"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/isc/appservice")
public class IscAppServiceController extends BaseController {
private final IIscAppServiceService iIscAppServiceService;
/**
* 查询应用服务列表
*/
@ApiOperation("查询应用服务列表")
@PreAuthorize("@ss.hasPermi('isc:appservice:list')")
@GetMapping("/list")
public TableDataInfo<IscAppServiceVo> list(@Validated(QueryGroup.class) IscAppServiceBo bo) {
return iIscAppServiceService.queryPageList(bo);
}
/**
* 导出应用服务列表
*/
@ApiOperation("导出应用服务列表")
@PreAuthorize("@ss.hasPermi('isc:appservice:export')")
@Log(title = "应用服务", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public void export(@Validated IscAppServiceBo bo, HttpServletResponse response) {
List<IscAppServiceVo> list = iIscAppServiceService.queryList(bo);
ExcelUtil.exportExcel(list, "应用服务", IscAppServiceVo.class, response);
}
/**
* 获取应用服务详细信息
*/
@ApiOperation("获取应用服务详细信息")
@PreAuthorize("@ss.hasPermi('isc:appservice:query')")
@GetMapping("/{serviceAppId}")
public AjaxResult<IscAppServiceVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable("serviceAppId") Long serviceAppId) {
return AjaxResult.success(iIscAppServiceService.queryById(serviceAppId));
}
/**
* 新增应用服务
*/
@ApiOperation("新增应用服务")
@PreAuthorize("@ss.hasPermi('isc:appservice:add')")
@Log(title = "应用服务", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody IscAppServiceBo bo) {
return toAjax(iIscAppServiceService.insertByBo(bo) ? 1 : 0);
}
/**
* 修改应用服务
*/
@ApiOperation("修改应用服务")
@PreAuthorize("@ss.hasPermi('isc:appservice:edit')")
@Log(title = "应用服务", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody IscAppServiceBo bo) {
return toAjax(iIscAppServiceService.updateByBo(bo) ? 1 : 0);
}
/**
* 删除应用服务
*/
@ApiOperation("删除应用服务")
@PreAuthorize("@ss.hasPermi('isc:appservice:remove')")
@Log(title = "应用服务" , businessType = BusinessType.DELETE)
@DeleteMapping("/{serviceAppIds}")
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] serviceAppIds) {
return toAjax(iIscAppServiceService.deleteWithValidByIds(Arrays.asList(serviceAppIds), true) ? 1 : 0);
}
}

View File

@ -0,0 +1,122 @@
package com.ruoyi.isc.domain;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
/**
* 应用服务对象 isc_app_service
*
* @author Wenchao Gong
* @date 2021-09-08
*/
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("isc_app_service")
public class IscAppService implements Serializable {
private static final long serialVersionUID=1L;
/**
* 应用服务ID
*/
@TableId(value = "service_app_id")
private Long serviceAppId;
/**
* 服务ID
*/
private Long serviceId;
/**
* 应用ID
*/
private Long applicationId;
/**
* 用户ID
*/
private Long userId;
/**
* 启用状态0启用 1停用
*/
private String enabled;
/**
* 申请类型(0申请 1续期)
*/
private String applyType;
/**
* 审核状态0待审核 1审核通过 2驳回
*/
private String status;
/**
* 虚拟地址
*/
private String virtualAddr;
/**
* 到期时间
*/
private Date endTime;
/**
* 天配额
*/
private Long quotaDays;
/**
* 小时配额
*/
private Long quotaHours;
/**
* 分钟配额
*/
private Long quotaMinutes;
/**
* 秒配额
*/
private Long quotaSeconds;
/**
* 创建者
*/
@TableField(fill = FieldFill.INSERT)
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private Date createTime;
/**
* 更新者
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
/**
* 删除标志0代表存在 2代表删除
*/
@TableLogic
private String delFlag;
}

View File

@ -0,0 +1,129 @@
package com.ruoyi.isc.domain.bo;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.*;
import java.util.Date;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 应用服务业务对象 isc_app_service
*
* @author Wenchao Gong
* @date 2021-09-08
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel("应用服务业务对象")
public class IscAppServiceBo extends BaseEntity {
/**
* 应用服务ID
*/
@ApiModelProperty(value = "应用服务ID")
private Long serviceAppId;
/**
* 服务ID
*/
@ApiModelProperty(value = "服务ID", required = true)
@NotNull(message = "服务ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long serviceId;
/**
* 应用ID
*/
@ApiModelProperty(value = "应用ID", required = true)
@NotNull(message = "应用ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long applicationId;
/**
* 用户ID
*/
@ApiModelProperty(value = "用户ID")
private Long userId;
/**
* 启用状态0启用 1停用
*/
@ApiModelProperty(value = "启用状态0启用 1停用", required = true)
@NotBlank(message = "启用状态0启用 1停用不能为空", groups = { AddGroup.class, EditGroup.class })
private String enabled;
/**
* 申请类型(0申请 1续期)
*/
@ApiModelProperty(value = "申请类型(0申请 1续期)")
private String applyType;
/**
* 审核状态0待审核 1审核通过 2驳回
*/
@ApiModelProperty(value = "审核状态0待审核 1审核通过 2驳回")
private String status;
/**
* 到期时间
*/
@ApiModelProperty(value = "到期时间")
private Date endTime;
/**
* 天配额
*/
@ApiModelProperty(value = "天配额")
private Long quotaDays;
/**
* 小时配额
*/
@ApiModelProperty(value = "小时配额")
private Long quotaHours;
/**
* 分钟配额
*/
@ApiModelProperty(value = "分钟配额")
private Long quotaMinutes;
/**
* 秒配额
*/
@ApiModelProperty(value = "秒配额")
private Long quotaSeconds;
/**
* 分页大小
*/
@ApiModelProperty("分页大小")
private Integer pageSize;
/**
* 当前页数
*/
@ApiModelProperty("当前页数")
private Integer pageNum;
/**
* 排序列
*/
@ApiModelProperty("排序列")
private String orderByColumn;
/**
* 排序的方向desc或者asc
*/
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
private String isAsc;
}

View File

@ -1,16 +1,15 @@
package com.ruoyi.isc.domain.bo; package com.ruoyi.isc.domain.bo;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.validate.AddGroup; import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup; import com.ruoyi.common.core.validate.EditGroup;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import javax.validation.constraints.*;
import java.util.Date; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import com.ruoyi.common.core.domain.BaseEntity;
/** /**
* 服务信息业务对象 isc_service * 服务信息业务对象 isc_service
@ -105,13 +104,6 @@ public class IscServiceBo extends BaseEntity {
@NotNull(message = "服务分类不能为空", groups = { AddGroup.class, EditGroup.class }) @NotNull(message = "服务分类不能为空", groups = { AddGroup.class, EditGroup.class })
private String cateFullPath; private String cateFullPath;
/**
* 用户ID
*/
@ApiModelProperty(value = "用户ID", required = true)
private Long userId;
/** /**
* 分页大小 * 分页大小
*/ */

View File

@ -0,0 +1,108 @@
package com.ruoyi.isc.domain.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.ruoyi.common.annotation.ExcelDictFormat;
import com.ruoyi.common.convert.ExcelDictConvert;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* 应用服务视图对象 isc_app_service
*
* @author Wenchao Gong
* @date 2021-09-08
*/
@Data
@ApiModel("应用服务视图对象")
@ExcelIgnoreUnannotated
public class IscAppServiceVo {
private static final long serialVersionUID = 1L;
/**
* 应用服务ID
*/
@ApiModelProperty("应用服务ID")
private Long serviceAppId;
/**
* 服务ID
*/
@ExcelProperty(value = "服务ID")
@ApiModelProperty("服务ID")
private Long serviceId;
/**
* 应用ID
*/
@ExcelProperty(value = "应用ID")
@ApiModelProperty("应用ID")
private Long applicationId;
/**
* 用户ID
*/
@ExcelProperty(value = "用户ID")
@ApiModelProperty("用户ID")
private Long userId;
/**
* 启用状态0启用 1停用
*/
@ExcelProperty(value = "启用状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_normal_disable")
@ApiModelProperty("启用状态0启用 1停用")
private String enabled;
/**
* 申请类型(0申请 1续期)
*/
@ExcelProperty(value = "申请类型(0申请 1续期)", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "isc_apply_type")
@ApiModelProperty("申请类型(0申请 1续期)")
private String applyType;
/**
* 审核状态0待审核 1审核通过 2驳回
*/
@ExcelProperty(value = "审核状态", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_audit_status")
@ApiModelProperty("审核状态0待审核 1审核通过 2驳回")
private String status;
/**
* 虚拟地址
*/
@ExcelProperty(value = "虚拟地址")
@ApiModelProperty("虚拟地址")
private String virtualAddr;
/**
* 到期时间
*/
@ExcelProperty(value = "到期时间")
@ApiModelProperty("到期时间")
private Date endTime;
/**
* 更新者
*/
@ExcelProperty(value = "更新者")
@ApiModelProperty("更新者")
private String updateBy;
/**
* 更新时间
*/
@ExcelProperty(value = "更新时间")
@ApiModelProperty("更新时间")
private Date updateTime;
}

View File

@ -0,0 +1,16 @@
package com.ruoyi.isc.mapper;
import com.ruoyi.isc.domain.IscAppService;
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
import org.apache.ibatis.annotations.CacheNamespace;
/**
* 应用服务Mapper接口
*
* @author Wenchao Gong
* @date 2021-09-08
*/
public interface IscAppServiceMapper extends BaseMapperPlus<IscAppService> {
}

View File

@ -0,0 +1,56 @@
package com.ruoyi.isc.service;
import com.ruoyi.isc.domain.IscAppService;
import com.ruoyi.isc.domain.vo.IscAppServiceVo;
import com.ruoyi.isc.domain.bo.IscAppServiceBo;
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
import com.ruoyi.common.core.page.TableDataInfo;
import java.util.Collection;
import java.util.List;
/**
* 应用服务Service接口
*
* @author Wenchao Gong
* @date 2021-09-08
*/
public interface IIscAppServiceService extends IServicePlus<IscAppService, IscAppServiceVo> {
/**
* 查询单个
* @return
*/
IscAppServiceVo queryById(Long serviceAppId);
/**
* 查询列表
*/
TableDataInfo<IscAppServiceVo> queryPageList(IscAppServiceBo bo);
/**
* 查询列表
*/
List<IscAppServiceVo> queryList(IscAppServiceBo bo);
/**
* 根据新增业务对象插入应用服务
* @param bo 应用服务新增业务对象
* @return
*/
Boolean insertByBo(IscAppServiceBo bo);
/**
* 根据编辑业务对象修改应用服务
* @param bo 应用服务编辑业务对象
* @return
*/
Boolean updateByBo(IscAppServiceBo bo);
/**
* 校验并删除数据
* @param ids 主键集合
* @param isValid 是否校验,true-删除前校验,false-不校验
* @return
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

View File

@ -0,0 +1,88 @@
package com.ruoyi.isc.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.core.page.PagePlus;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.isc.domain.bo.IscAppServiceBo;
import com.ruoyi.isc.domain.vo.IscAppServiceVo;
import com.ruoyi.isc.domain.IscAppService;
import com.ruoyi.isc.mapper.IscAppServiceMapper;
import com.ruoyi.isc.service.IIscAppServiceService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 应用服务Service业务层处理
*
* @author Wenchao Gong
* @date 2021-09-08
*/
@Service
public class IscAppServiceServiceImpl extends ServicePlusImpl<IscAppServiceMapper, IscAppService, IscAppServiceVo> implements IIscAppServiceService {
@Override
public IscAppServiceVo queryById(Long serviceAppId){
return getVoById(serviceAppId);
}
@Override
public TableDataInfo<IscAppServiceVo> queryPageList(IscAppServiceBo bo) {
PagePlus<IscAppService, IscAppServiceVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo));
return PageUtils.buildDataInfo(result);
}
@Override
public List<IscAppServiceVo> queryList(IscAppServiceBo bo) {
return listVo(buildQueryWrapper(bo));
}
private LambdaQueryWrapper<IscAppService> buildQueryWrapper(IscAppServiceBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<IscAppService> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getServiceId() != null, IscAppService::getServiceId, bo.getServiceId());
lqw.eq(bo.getApplicationId() != null, IscAppService::getApplicationId, bo.getApplicationId());
lqw.eq(bo.getUserId() != null, IscAppService::getUserId, bo.getUserId());
lqw.eq(StringUtils.isNotBlank(bo.getEnabled()), IscAppService::getEnabled, bo.getEnabled());
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), IscAppService::getStatus, bo.getStatus());
return lqw;
}
@Override
public Boolean insertByBo(IscAppServiceBo bo) {
IscAppService add = BeanUtil.toBean(bo, IscAppService.class);
validEntityBeforeSave(add);
return save(add);
}
@Override
public Boolean updateByBo(IscAppServiceBo bo) {
IscAppService update = BeanUtil.toBean(bo, IscAppService.class);
validEntityBeforeSave(update);
return updateById(update);
}
/**
* 保存前的数据校验
*
* @param entity 实体类数据
*/
private void validEntityBeforeSave(IscAppService entity){
//TODO 做一些数据校验,如唯一约束
}
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return removeByIds(ids);
}
}

View File

@ -51,6 +51,8 @@ public class IscApplicationServiceImpl extends ServicePlusImpl<IscApplicationMap
LambdaQueryWrapper<IscApplication> lqw = Wrappers.lambdaQuery(); LambdaQueryWrapper<IscApplication> lqw = Wrappers.lambdaQuery();
lqw.like(StringUtils.isNotBlank(bo.getApplicationName()), IscApplication::getApplicationName, bo.getApplicationName()); lqw.like(StringUtils.isNotBlank(bo.getApplicationName()), IscApplication::getApplicationName, bo.getApplicationName());
lqw.eq(StringUtils.isNotBlank(bo.getAccessKey()), IscApplication::getAccessKey, bo.getAccessKey()); lqw.eq(StringUtils.isNotBlank(bo.getAccessKey()), IscApplication::getAccessKey, bo.getAccessKey());
Long userId = SecurityUtils.getUserId();
lqw.eq(!SecurityUtils.isAdmin(userId), IscApplication::getUserId, userId);
return lqw; return lqw;
} }

View File

@ -83,7 +83,8 @@ public class IscServiceServiceImpl extends ServicePlusImpl<IscServiceMapper, Isc
lqw.eq(StringUtils.isNotBlank(bo.getEnabled()), IscService::getEnabled, bo.getEnabled()); lqw.eq(StringUtils.isNotBlank(bo.getEnabled()), IscService::getEnabled, bo.getEnabled());
lqw.ge(StringUtils.isNotBlank(bo.getCateFullPath()), IscService::getCateFullPath, bo.getCateFullPath()); lqw.ge(StringUtils.isNotBlank(bo.getCateFullPath()), IscService::getCateFullPath, bo.getCateFullPath());
lqw.le(StringUtils.isNotBlank(bo.getCateFullPath()), IscService::getCateFullPath, FullPathUtils.genMaxFullPath(bo.getCateFullPath())); lqw.le(StringUtils.isNotBlank(bo.getCateFullPath()), IscService::getCateFullPath, FullPathUtils.genMaxFullPath(bo.getCateFullPath()));
lqw.eq(bo.getUserId() != null, IscService::getUserId, bo.getUserId()); Long userId = SecurityUtils.getUserId();
lqw.eq(!SecurityUtils.isAdmin(userId), IscService::getUserId, userId);
return lqw; return lqw;
} }

View File

@ -0,0 +1,29 @@
<?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">
<mapper namespace="com.ruoyi.isc.mapper.IscAppServiceMapper">
<resultMap type="com.ruoyi.isc.domain.IscAppService" id="IscAppServiceResult">
<result property="serviceAppId" column="service_app_id"/>
<result property="serviceId" column="service_id"/>
<result property="applicationId" column="application_id"/>
<result property="userId" column="user_id"/>
<result property="enabled" column="enabled"/>
<result property="applyType" column="apply_type"/>
<result property="status" column="status"/>
<result property="virtualAddr" column="virtual_addr"/>
<result property="endTime" column="end_time"/>
<result property="quotaDays" column="quota_days"/>
<result property="quotaHours" column="quota_hours"/>
<result property="quotaMinutes" column="quota_minutes"/>
<result property="quotaSeconds" column="quota_seconds"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
</resultMap>
</mapper>

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询应用信息列表
export function listApplication(query) {
return request({
url: '/isc/application/list',
method: 'get',
params: query
})
}
// 查询应用信息详细
export function getApplication(applicationId) {
return request({
url: '/isc/application/' + applicationId,
method: 'get'
})
}
// 新增应用信息
export function addApplication(data) {
return request({
url: '/isc/application',
method: 'post',
data: data
})
}
// 修改应用信息
export function updateApplication(data) {
return request({
url: '/isc/application',
method: 'put',
data: data
})
}
// 删除应用信息
export function delApplication(applicationId) {
return request({
url: '/isc/application/' + applicationId,
method: 'delete'
})
}

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询应用服务列表
export function listAppservice(query) {
return request({
url: '/isc/appservice/list',
method: 'get',
params: query
})
}
// 查询应用服务详细
export function getAppservice(serviceAppId) {
return request({
url: '/isc/appservice/' + serviceAppId,
method: 'get'
})
}
// 新增应用服务
export function addAppservice(data) {
return request({
url: '/isc/appservice',
method: 'post',
data: data
})
}
// 修改应用服务
export function updateAppservice(data) {
return request({
url: '/isc/appservice',
method: 'put',
data: data
})
}
// 删除应用服务
export function delAppservice(serviceAppId) {
return request({
url: '/isc/appservice/' + serviceAppId,
method: 'delete'
})
}

View File

@ -162,6 +162,19 @@ export const constantRoutes = [
meta: { title: '修改生成配置', activeMenu: '/tool/gen'} meta: { title: '修改生成配置', activeMenu: '/tool/gen'}
} }
] ]
},
{
path: '/isc/app-service',
component: Layout,
hidden: true,
children: [
{
path: 'index/:applicationId(\\d+)',
component: (resolve) => require(['@/views/isc/appservice/index'], resolve),
name: 'Appservice',
meta: { title: '应用服务', activeMenu: '/isc/application'}
}
]
} }
] ]

View File

@ -0,0 +1,304 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="应用名称" prop="applicationName">
<el-input
v-model="queryParams.applicationName"
placeholder="请输入应用名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="应用密钥" prop="accessKey">
<el-input
v-model="queryParams.accessKey"
placeholder="请输入应用密钥"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['isc:application:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['isc:application:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['isc:application:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
@click="handleExport"
v-hasPermi="['isc:application:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="applicationList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="应用ID" align="center" prop="applicationId" v-if="true"/>
<el-table-column label="应用名称" align="center" prop="applicationName" >
<template slot-scope="scope">
<router-link :to="'/isc/app-service/index/' + scope.row.applicationId" class="link-type">
<span>{{ scope.row.applicationName }}</span>
</router-link>
</template>
</el-table-column>
<el-table-column label="应用密钥" align="center" prop="accessKey" />
<el-table-column label="更新者" align="center" prop="updateBy" />
<el-table-column label="更新时间" align="center" prop="updateTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['isc:application:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['isc:application:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改应用信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="应用名称" prop="applicationName">
<el-input v-model="form.applicationName" placeholder="请输入应用名称" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listApplication, getApplication, delApplication, addApplication, updateApplication } from "@/api/isc/application";
export default {
name: "Application",
data() {
return {
// loading
buttonLoading: false,
//
loading: true,
//
exportLoading: false,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
applicationList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
applicationName: undefined,
accessKey: undefined,
},
//
form: {},
//
rules: {
applicationName: [
{ required: true, message: "应用名称不能为空", trigger: "blur" }
],
accessKey: [
{ required: true, message: "应用密钥不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询应用信息列表 */
getList() {
this.loading = true;
listApplication(this.queryParams).then(response => {
this.applicationList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
applicationId: undefined,
applicationName: undefined,
accessKey: undefined,
userId: undefined,
createBy: undefined,
createTime: undefined,
updateBy: undefined,
updateTime: undefined,
delFlag: undefined,
remark: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.applicationId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加应用信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.loading = true;
this.reset();
const applicationId = row.applicationId || this.ids
getApplication(applicationId).then(response => {
this.loading = false;
this.form = response.data;
this.open = true;
this.title = "修改应用信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.buttonLoading = true;
if (this.form.applicationId != null) {
updateApplication(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
} else {
addApplication(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const applicationIds = row.applicationId || this.ids;
this.$confirm('是否确认删除应用信息编号为"' + applicationIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.loading = true;
return delApplication(applicationIds);
}).then(() => {
this.loading = false;
this.getList();
this.msgSuccess("删除成功");
}).finally(() => {
this.loading = false;
});
},
/** 导出按钮操作 */
handleExport() {
this.downLoadExcel('/isc/application/export', this.queryParams);
}
}
};
</script>

View File

@ -0,0 +1,411 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="服务ID" prop="serviceId">
<el-input
v-model="queryParams.serviceId"
placeholder="请输入服务ID"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="应用ID" prop="applicationId">
<el-input
v-model="queryParams.applicationId"
placeholder="请输入应用ID"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="用户ID" prop="userId">
<el-input
v-model="queryParams.userId"
placeholder="请输入用户ID"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="启用状态" prop="enabled">
<el-select v-model="queryParams.enabled" placeholder="请选择启用状态" clearable size="small">
<el-option
v-for="dict in enabledOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="审核状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择审核状态" clearable size="small">
<el-option
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['isc:appservice:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['isc:appservice:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['isc:appservice:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
@click="handleExport"
v-hasPermi="['isc:appservice:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="appserviceList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="应用服务ID" align="center" prop="serviceAppId" v-if="false"/>
<el-table-column label="服务ID" align="center" prop="serviceId" />
<el-table-column label="启用状态" align="center" prop="enabled">
<template slot-scope="scope">
<dict-tag :options="enabledOptions" :value="scope.row.enabled"/>
</template>
</el-table-column>
<el-table-column label="申请类型" align="center" prop="applyType">
<template slot-scope="scope">
<dict-tag :options="applyTypeOptions" :value="scope.row.applyType"/>
</template>
</el-table-column>
<el-table-column label="审核状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="statusOptions" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="虚拟地址" align="center" prop="virtualAddr" />
<el-table-column label="到期时间" align="center" prop="endTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="更新者" align="center" prop="updateBy" />
<el-table-column label="更新时间" align="center" prop="updateTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['isc:appservice:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['isc:appservice:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改应用服务对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="服务ID" prop="serviceId">
<el-input v-model="form.serviceId" placeholder="请输入服务ID" />
</el-form-item>
<el-form-item label="用户ID" prop="userId">
<el-input v-model="form.userId" placeholder="请输入用户ID" />
</el-form-item>
<el-form-item label="启用状态">
<el-radio-group v-model="form.enabled">
<el-radio
v-for="dict in enabledOptions"
:key="dict.dictValue"
:label="dict.dictValue"
>{{dict.dictLabel}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="到期时间" prop="endTime">
<el-date-picker clearable size="small"
v-model="form.endTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择到期时间">
</el-date-picker>
</el-form-item>
<el-form-item label="天配额" prop="quotaDays">
<el-input v-model="form.quotaDays" placeholder="请输入天配额" />
</el-form-item>
<el-form-item label="小时配额" prop="quotaHours">
<el-input v-model="form.quotaHours" placeholder="请输入小时配额" />
</el-form-item>
<el-form-item label="分钟配额" prop="quotaMinutes">
<el-input v-model="form.quotaMinutes" placeholder="请输入分钟配额" />
</el-form-item>
<el-form-item label="秒配额" prop="quotaSeconds">
<el-input v-model="form.quotaSeconds" placeholder="请输入秒配额" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listAppservice, getAppservice, delAppservice, addAppservice, updateAppservice } from "@/api/isc/appservice";
export default {
name: "Appservice",
data() {
return {
// loading
buttonLoading: false,
//
loading: true,
//
exportLoading: false,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
appserviceList: [],
//
title: "",
//
open: false,
//
enabledOptions: [],
//
applyTypeOptions: [],
//
statusOptions: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
serviceId: undefined,
applicationId: undefined,
userId: undefined,
enabled: undefined,
status: undefined,
},
applicationId: undefined,
//
form: {},
//
rules: {
serviceId: [
{ required: true, message: "服务ID不能为空", trigger: "blur" }
],
applicationId: [
{ required: true, message: "应用ID不能为空", trigger: "blur" }
],
enabled: [
{ required: true, message: "启用状态不能为空", trigger: "blur" }
],
}
};
},
created() {
const applicationId = this.$route.params && this.$route.params.applicationId;
this.form.applicationId = applicationId;
this.queryParams.applicationId = applicationId;
this.getList(applicationId);
this.getDicts("sys_normal_disable").then(response => {
this.enabledOptions = response.data;
});
this.getDicts("isc_apply_type").then(response => {
this.applyTypeOptions = response.data;
});
this.getDicts("sys_audit_status").then(response => {
this.statusOptions = response.data;
});
},
methods: {
/** 查询应用服务列表 */
getList() {
this.loading = true;
listAppservice(this.queryParams).then(response => {
this.appserviceList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
serviceAppId: undefined,
serviceId: undefined,
applicationId: this.applicationId,
userId: undefined,
enabled: "0",
applyType: undefined,
status: [],
virtualAddr: undefined,
endTime: undefined,
quotaDays: undefined,
quotaHours: undefined,
quotaMinutes: undefined,
quotaSeconds: undefined,
createBy: undefined,
createTime: undefined,
updateBy: undefined,
updateTime: undefined,
delFlag: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.serviceAppId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加应用服务";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.loading = true;
this.reset();
const serviceAppId = row.serviceAppId || this.ids
getAppservice(serviceAppId).then(response => {
this.loading = false;
this.form = response.data;
this.form.status = this.form.status.split(",");
this.open = true;
this.title = "修改应用服务";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.buttonLoading = true;
this.form.status = this.form.status.join(",");
if (this.form.serviceAppId != null) {
updateAppservice(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
} else {
addAppservice(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const serviceAppIds = row.serviceAppId || this.ids;
this.$confirm('是否确认删除应用服务编号为"' + serviceAppIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.loading = true;
return delAppservice(serviceAppIds);
}).then(() => {
this.loading = false;
this.getList();
this.msgSuccess("删除成功");
}).finally(() => {
this.loading = false;
});
},
/** 导出按钮操作 */
handleExport() {
this.downLoadExcel('/isc/appservice/export', this.queryParams);
}
}
};
</script>

View File

@ -272,10 +272,7 @@ export default {
], ],
cateFullPath: [ cateFullPath: [
{ required: true, message: "服务分类不能为空", trigger: "change" } { required: true, message: "服务分类不能为空", trigger: "change" }
], ]
userId: [
{ required: true, message: "用户ID不能为空", trigger: "blur" }
],
} }
}; };
}, },
@ -346,7 +343,6 @@ export default {
auditMind: undefined, auditMind: undefined,
enabled: "0", enabled: "0",
cateFullPath: undefined, cateFullPath: undefined,
userId: undefined,
createBy: undefined, createBy: undefined,
createTime: undefined, createTime: undefined,
updateBy: undefined, updateBy: undefined,

View File

@ -235,6 +235,13 @@ INSERT INTO `sys_menu` VALUES (1627, '应用信息新增', 1625, 2, '#', '', 1,
INSERT INTO `sys_menu` VALUES (1628, '应用信息修改', 1625, 3, '#', '', 1, 0, 'F', '0', '0', 'isc:application:edit', '#', 'admin', '2021-09-08 14:10:06', '', NULL, ''); INSERT INTO `sys_menu` VALUES (1628, '应用信息修改', 1625, 3, '#', '', 1, 0, 'F', '0', '0', 'isc:application:edit', '#', 'admin', '2021-09-08 14:10:06', '', NULL, '');
INSERT INTO `sys_menu` VALUES (1629, '应用信息删除', 1625, 4, '#', '', 1, 0, 'F', '0', '0', 'isc:application:remove', '#', 'admin', '2021-09-08 14:10:06', '', NULL, ''); INSERT INTO `sys_menu` VALUES (1629, '应用信息删除', 1625, 4, '#', '', 1, 0, 'F', '0', '0', 'isc:application:remove', '#', 'admin', '2021-09-08 14:10:06', '', NULL, '');
INSERT INTO `sys_menu` VALUES (1630, '应用信息导出', 1625, 5, '#', '', 1, 0, 'F', '0', '0', 'isc:application:export', '#', 'admin', '2021-09-08 14:10:06', '', NULL, ''); INSERT INTO `sys_menu` VALUES (1630, '应用信息导出', 1625, 5, '#', '', 1, 0, 'F', '0', '0', 'isc:application:export', '#', 'admin', '2021-09-08 14:10:06', '', NULL, '');
INSERT INTO `sys_menu` VALUES (1631, '应用服务', 1625, 1, 'appservice', 'isc/appservice/index', 1, 0, 'F', '0', '0', 'isc:appservice:list', '#', 'admin', '2021-09-08 16:11:57', 'admin', '2021-09-08 16:22:10', '应用服务菜单');
INSERT INTO `sys_menu` VALUES (1632, '应用服务查询', 1631, 1, '#', '', 1, 0, 'F', '0', '0', 'isc:appservice:query', '#', 'admin', '2021-09-08 16:11:57', '', NULL, '');
INSERT INTO `sys_menu` VALUES (1633, '应用服务新增', 1631, 2, '#', '', 1, 0, 'F', '0', '0', 'isc:appservice:add', '#', 'admin', '2021-09-08 16:11:57', '', NULL, '');
INSERT INTO `sys_menu` VALUES (1634, '应用服务修改', 1631, 3, '#', '', 1, 0, 'F', '0', '0', 'isc:appservice:edit', '#', 'admin', '2021-09-08 16:11:57', '', NULL, '');
INSERT INTO `sys_menu` VALUES (1635, '应用服务删除', 1631, 4, '#', '', 1, 0, 'F', '0', '0', 'isc:appservice:remove', '#', 'admin', '2021-09-08 16:11:57', '', NULL, '');
INSERT INTO `sys_menu` VALUES (1636, '应用服务导出', 1631, 5, '#', '', 1, 0, 'F', '0', '0', 'isc:appservice:export', '#', 'admin', '2021-09-08 16:11:57', '', NULL, '');
COMMIT; COMMIT;
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;