服务申请记录

This commit is contained in:
Wenchao Gong 2021-09-09 18:00:31 +08:00
parent cdffaecbe8
commit 3ca291d665
27 changed files with 1391 additions and 133 deletions

View File

@ -11,4 +11,14 @@ public class IscConstants {
/** 待审核 */
public static final String ONLINE_STATUS_ON = "1";
/** 申请类型 申请服务 */
public static final String APPLY_TYPE_APPLY = "0";
/** 申请类型 服务续期 */
public static final String APPLY_TYPE_RENEWAL = "1";
/** 申请类型 申请修改 */
public static final String APPLY_TYPE_MODIFY = "2";
}

View File

@ -2,7 +2,7 @@ package com.ruoyi.common.enums;
/**
* 业务操作类型
*
*
* @author ruoyi
*/
public enum BusinessType
@ -51,9 +51,14 @@ public enum BusinessType
* 生成代码
*/
GENCODE,
/**
* 清空数据
*/
CLEAN,
/**
* 审核
*/
AUDIT
}

View File

@ -0,0 +1,86 @@
package com.ruoyi.isc.controller;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
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.bo.IscAppServiceApplyBo;
import com.ruoyi.isc.domain.vo.IscAppServiceApplyVo;
import com.ruoyi.isc.service.IIscAppServiceApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* 应用服务申请信息Controller
*
* @author Wenchao Gong
* @date 2021-09-09
*/
@Validated
@Api(value = "应用服务申请信息控制器", tags = {"应用服务申请信息管理"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/isc/serviceapply")
public class IscAppServiceApplyController extends BaseController {
private final IIscAppServiceApplyService iIscAppServiceApplyService;
/**
* 查询应用服务申请信息列表
*/
@ApiOperation("查询应用服务申请信息列表")
@PreAuthorize("@ss.hasPermi('isc:serviceapply:list')")
@GetMapping("/list")
public TableDataInfo<IscAppServiceApplyVo> list(@Validated(QueryGroup.class) IscAppServiceApplyBo bo) {
return iIscAppServiceApplyService.queryPageList(bo);
}
/**
* 导出应用服务申请信息列表
*/
@ApiOperation("导出应用服务申请信息列表")
@PreAuthorize("@ss.hasPermi('isc:serviceapply:export')")
@Log(title = "应用服务申请信息", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public void export(@Validated IscAppServiceApplyBo bo, HttpServletResponse response) {
List<IscAppServiceApplyVo> list = iIscAppServiceApplyService.queryList(bo);
ExcelUtil.exportExcel(list, "应用服务申请信息", IscAppServiceApplyVo.class, response);
}
/**
* 获取应用服务申请信息详细信息
*/
@ApiOperation("获取应用服务申请信息详细信息")
@PreAuthorize("@ss.hasPermi('isc:serviceapply:query')")
@GetMapping("/{applyId}")
public AjaxResult<IscAppServiceApplyVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable("applyId") Long applyId) {
return AjaxResult.success(iIscAppServiceApplyService.queryById(applyId));
}
/**
* 应用服务申请信息审核
*/
@ApiOperation("应用服务申请信息审核")
@PreAuthorize("@ss.hasPermi('isc:serviceapply:audit')")
@Log(title = "应用服务申请信息审核", businessType = BusinessType.AUDIT)
@RepeatSubmit()
@PutMapping()
public AjaxResult<Void> audit(@Validated(EditGroup.class) @RequestBody IscAppServiceApplyBo bo) {
return toAjax(iIscAppServiceApplyService.updateByBo(bo) ? 1 : 0);
}
}

View File

@ -1,33 +1,32 @@
package com.ruoyi.isc.controller;
import java.util.List;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import cn.hutool.core.lang.tree.Tree;
import com.ruoyi.isc.domain.IscServiceCate;
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.annotation.RepeatSubmit;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
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.domain.vo.IscAppServiceVo;
import com.ruoyi.isc.service.IIscAppServiceService;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.List;
/**
* 应用服务Controller
@ -71,10 +70,10 @@ public class IscAppServiceController extends BaseController {
*/
@ApiOperation("获取应用服务详细信息")
@PreAuthorize("@ss.hasPermi('isc:appservice:query')")
@GetMapping("/{serviceAppId}")
@GetMapping("/{appServiceId}")
public AjaxResult<IscAppServiceVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable("serviceAppId") Long serviceAppId) {
return AjaxResult.success(appServiceService.queryById(serviceAppId));
@PathVariable("appServiceId") Long appServiceId) {
return AjaxResult.success(appServiceService.queryById(appServiceId));
}
/**
@ -107,10 +106,10 @@ public class IscAppServiceController extends BaseController {
@ApiOperation("删除应用服务")
@PreAuthorize("@ss.hasPermi('isc:appservice:remove')")
@Log(title = "应用服务" , businessType = BusinessType.DELETE)
@DeleteMapping("/{serviceAppIds}")
@DeleteMapping("/{appServiceIds}")
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] serviceAppIds) {
return toAjax(appServiceService.deleteWithValidByIds(Arrays.asList(serviceAppIds), true) ? 1 : 0);
@PathVariable Long[] appServiceIds) {
return toAjax(appServiceService.deleteWithValidByIds(Arrays.asList(appServiceIds), true) ? 1 : 0);
}
/**

View File

@ -4,9 +4,9 @@ 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
@ -26,8 +26,8 @@ public class IscAppService implements Serializable {
/**
* 应用服务ID
*/
@TableId(value = "service_app_id")
private Long serviceAppId;
@TableId(value = "app_service_id")
private Long appServiceId;
/**
* 服务ID
@ -119,4 +119,9 @@ public class IscAppService implements Serializable {
@TableLogic
private String delFlag;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,112 @@
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_apply
*
* @author Wenchao Gong
* @date 2021-09-09
*/
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("isc_app_service_apply")
public class IscAppServiceApply implements Serializable {
private static final long serialVersionUID=1L;
/**
* 申请ID
*/
@TableId(value = "apply_id")
private Long applyId;
/**
* 应用服务ID
*/
private Long appServiceId;
/**
* 申请类型(0申请 1续期)
*/
private String applyType;
/**
* 审核状态0待审核 1审核通过 2驳回
*/
private String status;
/**
* 审核意见
*/
private String auditMind;
/**
* 续期时长单位月
*/
private Long renewalDuration;
/**
* 天配额
*/
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;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,113 @@
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 com.ruoyi.common.core.domain.BaseEntity;
/**
* 应用服务申请信息业务对象 isc_app_service_apply
*
* @author Wenchao Gong
* @date 2021-09-09
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel("应用服务申请信息业务对象")
public class IscAppServiceApplyBo extends BaseEntity {
/**
* 申请ID
*/
@ApiModelProperty(value = "申请ID")
private Long applyId;
/**
* 应用服务ID
*/
@ApiModelProperty(value = "应用服务ID", required = true)
@NotNull(message = "应用服务ID不能为空", groups = { AddGroup.class, EditGroup.class })
private Long appServiceId;
/**
* 申请类型(0申请 1续期)
*/
@ApiModelProperty(value = "申请类型(0申请 1续期)")
private String applyType;
/**
* 审核状态0待审核 1审核通过 2驳回
*/
@ApiModelProperty(value = "审核状态0待审核 1审核通过 2驳回")
private String status;
/**
* 续期时长单位月
*/
@ApiModelProperty(value = "续期时长(单位月)")
private Long renewalDuration;
/**
* 天配额
*/
@ApiModelProperty(value = "天配额")
private Long quotaDays;
/**
* 小时配额
*/
@ApiModelProperty(value = "小时配额")
private Long quotaHours;
/**
* 分钟配额
*/
@ApiModelProperty(value = "分钟配额")
private Long quotaMinutes;
/**
* 秒配额
*/
@ApiModelProperty(value = "秒配额")
private Long quotaSeconds;
/**
* 删除标志0代表存在 2代表删除
*/
@ApiModelProperty(value = "删除标志0代表存在 2代表删除")
private String delFlag;
/**
* 分页大小
*/
@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,19 +1,17 @@
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.EditGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 应用服务业务对象 isc_app_service
*
@ -30,7 +28,7 @@ public class IscAppServiceBo extends BaseEntity {
* 应用服务ID
*/
@ApiModelProperty(value = "应用服务ID")
private Long serviceAppId;
private Long appServiceId;
/**
* 服务ID
@ -53,12 +51,6 @@ public class IscAppServiceBo extends BaseEntity {
@NotBlank(message = "启用状态0启用 1停用不能为空", groups = { AddGroup.class, EditGroup.class })
private String enabled;
/**
* 申请类型(0申请 1续期)
*/
@ApiModelProperty(value = "申请类型(0申请 1续期)")
private String applyType;
/**
* 审核状态0待审核 1审核通过 2驳回
*/
@ -95,6 +87,12 @@ public class IscAppServiceBo extends BaseEntity {
@ApiModelProperty(value = "秒配额")
private Long quotaSeconds;
/**
* 续期时长单位月
*/
@NotNull(message = "续期时长不能为空", groups = { AddGroup.class })
private Long renewalDuration;
/**
* 分页大小

View File

@ -0,0 +1,127 @@
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_apply
*
* @author Wenchao Gong
* @date 2021-09-09
*/
@Data
@ApiModel("应用服务申请信息视图对象")
@ExcelIgnoreUnannotated
public class IscAppServiceApplyVo {
private static final long serialVersionUID = 1L;
/**
* 申请ID
*/
@ApiModelProperty("申请ID")
private Long applyId;
/**
* 应用服务ID
*/
@ApiModelProperty("应用服务ID")
private Long appServiceId;
/**
* 应用名称
*/
@ExcelProperty(value = "应用名称")
@ApiModelProperty("应用名称")
private String applicationName;
/**
* 服务名称
*/
@ExcelProperty(value = "服务名称")
@ApiModelProperty("服务名称")
private String serviceName;
/**
* 申请类型(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 = "续期时长", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "单=位月")
@ApiModelProperty("续期时长(单位月)")
private Long renewalDuration;
/**
* 天配额
*/
@ExcelProperty(value = "天配额")
@ApiModelProperty("天配额")
private Long quotaDays;
/**
* 小时配额
*/
@ExcelProperty(value = "小时配额")
@ApiModelProperty("小时配额")
private Long quotaHours;
/**
* 分钟配额
*/
@ExcelProperty(value = "分钟配额")
@ApiModelProperty("分钟配额")
private Long quotaMinutes;
/**
* 秒配额
*/
@ExcelProperty(value = "秒配额")
@ApiModelProperty("秒配额")
private Long quotaSeconds;
/**
* 更新者
*/
@ExcelProperty(value = "更新者")
@ApiModelProperty("更新者")
private String updateBy;
/**
* 更新时间
*/
@ExcelProperty(value = "更新时间")
@ApiModelProperty("更新时间")
private Date updateTime;
/**
* 备注
*/
@ExcelProperty(value = "备注")
@ApiModelProperty("备注")
private String remark;
}

View File

@ -29,7 +29,7 @@ public class IscAppServiceVo {
* 应用服务ID
*/
@ApiModelProperty("应用服务ID")
private Long serviceAppId;
private Long appServiceId;
/**
* 服务ID
@ -96,6 +96,30 @@ public class IscAppServiceVo {
@ApiModelProperty("到期时间")
private Date endTime;
/**
* 天配额
*/
@ApiModelProperty(value = "天配额")
private Long quotaDays;
/**
* 小时配额
*/
@ApiModelProperty(value = "小时配额")
private Long quotaHours;
/**
* 分钟配额
*/
@ApiModelProperty(value = "分钟配额")
private Long quotaMinutes;
/**
* 秒配额
*/
@ApiModelProperty(value = "秒配额")
private Long quotaSeconds;
/**
* 更新者
*/

View File

@ -0,0 +1,16 @@
package com.ruoyi.isc.mapper;
import com.ruoyi.isc.domain.IscAppServiceApply;
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-09
*/
public interface IscAppServiceApplyMapper extends BaseMapperPlus<IscAppServiceApply> {
}

View File

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

View File

@ -1,11 +1,11 @@
package com.ruoyi.isc.service;
import cn.hutool.core.lang.tree.Tree;
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 com.ruoyi.isc.domain.IscAppService;
import com.ruoyi.isc.domain.bo.IscAppServiceBo;
import com.ruoyi.isc.domain.vo.IscAppServiceVo;
import java.util.Collection;
import java.util.List;
@ -21,7 +21,7 @@ public interface IIscAppServiceService extends IServicePlus<IscAppService, IscAp
* 查询单个
* @return
*/
IscAppServiceVo queryById(Long serviceAppId);
IscAppServiceVo queryById(Long appServiceId);
/**
* 查询列表
@ -61,4 +61,11 @@ public interface IIscAppServiceService extends IServicePlus<IscAppService, IscAp
* @return 应用服务树结构 标识服务是否存在
*/
List<Tree<Long>> genAppServiceTree(Long applicationId);
/**
* 通过 Id集合 返回列表
* @param ids 应用服务ID
* @return 应用服务列表
*/
List<IscAppService> getAppServiceListByIds(Collection<Long> ids);
}

View File

@ -1,13 +1,14 @@
package com.ruoyi.isc.service;
import com.ruoyi.isc.domain.IscApplication;
import com.ruoyi.isc.domain.vo.IscApplicationVo;
import com.ruoyi.isc.domain.bo.IscApplicationBo;
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.isc.domain.IscApplication;
import com.ruoyi.isc.domain.bo.IscApplicationBo;
import com.ruoyi.isc.domain.vo.IscApplicationVo;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 应用信息Service接口
@ -53,4 +54,11 @@ public interface IIscApplicationService extends IServicePlus<IscApplication, Isc
* @return
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* 通过应用ID集合批量查询 应用名称
* @param applicationIds 应用ID集合
* @return 应用名称Map
*/
Map<Long, String> getNameMap(Collection<Long> applicationIds);
}

View File

@ -0,0 +1,131 @@
package com.ruoyi.isc.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
import com.ruoyi.common.core.page.PagePlus;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.isc.domain.IscAppService;
import com.ruoyi.isc.domain.IscAppServiceApply;
import com.ruoyi.isc.domain.bo.IscAppServiceApplyBo;
import com.ruoyi.isc.domain.vo.IscAppServiceApplyVo;
import com.ruoyi.isc.mapper.IscAppServiceApplyMapper;
import com.ruoyi.isc.service.IIscAppServiceApplyService;
import com.ruoyi.isc.service.IIscAppServiceService;
import com.ruoyi.isc.service.IIscApplicationService;
import com.ruoyi.isc.service.IIscServiceService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 应用服务申请信息Service业务层处理
*
* @author Wenchao Gong
* @date 2021-09-09
*/
@Service
public class IscAppServiceApplyServiceImpl extends ServicePlusImpl<IscAppServiceApplyMapper, IscAppServiceApply, IscAppServiceApplyVo> implements IIscAppServiceApplyService {
@Resource
private IIscAppServiceService appServiceService;
@Resource
private IIscApplicationService applicationService;
@Resource
private IIscServiceService serviceService;
@Override
public IscAppServiceApplyVo queryById(Long applyId){
return getVoById(applyId);
}
@Override
public TableDataInfo<IscAppServiceApplyVo> queryPageList(IscAppServiceApplyBo bo) {
PagePlus<IscAppServiceApply, IscAppServiceApplyVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo));
genServiceNameAndApplicationName(result.getRecordsVo());
return PageUtils.buildDataInfo(result);
}
@Override
public List<IscAppServiceApplyVo> queryList(IscAppServiceApplyBo bo) {
List<IscAppServiceApplyVo> results = listVo(buildQueryWrapper(bo));
genServiceNameAndApplicationName(results);
return results;
}
/**
* 组装服务应用名称
* @param list 申请记录
*/
private void genServiceNameAndApplicationName(List<IscAppServiceApplyVo> list)
{
if(CollectionUtil.isEmpty(list)) {
return;
}
Set<Long> appServiceIds = list.stream().map(IscAppServiceApplyVo::getAppServiceId).collect(Collectors.toSet());
List<IscAppService> appServiceList = appServiceService.getAppServiceListByIds(appServiceIds);
if(CollectionUtil.isEmpty(appServiceList)) {
return;
}
Map<Long, IscAppService> appServiceMap = appServiceList.stream()
.collect(Collectors.toMap(IscAppService::getAppServiceId, Function.identity()));
Map<Long, String> serviceNameMap = serviceService.getNameMap(appServiceList.stream()
.map(IscAppService::getServiceId).collect(Collectors.toSet()));
Map<Long, String> applicationNameMap = applicationService.getNameMap(appServiceList.stream()
.map(IscAppService::getApplicationId).collect(Collectors.toSet()));
for (IscAppServiceApplyVo vo : list) {
IscAppService appService = appServiceMap.get(vo.getAppServiceId());
if(Objects.isNull(appService)) {
continue;
}
vo.setServiceName(serviceNameMap.get(appService.getServiceId()));
vo.setApplicationName(applicationNameMap.get(appService.getApplicationId()));
}
}
private LambdaQueryWrapper<IscAppServiceApply> buildQueryWrapper(IscAppServiceApplyBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<IscAppServiceApply> lqw = Wrappers.lambdaQuery();
lqw.eq(StringUtils.isNotBlank(bo.getApplyType()), IscAppServiceApply::getApplyType, bo.getApplyType());
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), IscAppServiceApply::getStatus, bo.getStatus());
return lqw;
}
@Override
public Boolean insertByBo(IscAppServiceApplyBo bo) {
IscAppServiceApply add = BeanUtil.toBean(bo, IscAppServiceApply.class);
validEntityBeforeSave(add);
return save(add);
}
@Override
public Boolean updateByBo(IscAppServiceApplyBo bo) {
IscAppServiceApply update = BeanUtil.toBean(bo, IscAppServiceApply.class);
validEntityBeforeSave(update);
return updateById(update);
}
/**
* 保存前的数据校验
*
* @param entity 实体类数据
*/
private void validEntityBeforeSave(IscAppServiceApply entity){
//TODO 做一些数据校验,如唯一约束
}
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return removeByIds(ids);
}
}

View File

@ -2,29 +2,33 @@ package com.ruoyi.isc.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.lang.tree.Tree;
import com.ruoyi.common.utils.SecurityUtils;
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 com.ruoyi.isc.domain.IscService;
import com.ruoyi.isc.service.IIscServiceService;
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.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.ruoyi.common.constant.IscConstants;
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
import com.ruoyi.common.core.page.PagePlus;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.isc.domain.IscAppService;
import com.ruoyi.isc.domain.IscAppServiceApply;
import com.ruoyi.isc.domain.bo.IscAppServiceApplyBo;
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.IIscAppServiceApplyService;
import com.ruoyi.isc.service.IIscAppServiceService;
import com.ruoyi.isc.service.IIscServiceService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.Set;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@ -38,9 +42,12 @@ public class IscAppServiceServiceImpl extends ServicePlusImpl<IscAppServiceMappe
@Resource
private IIscServiceService serviceService;
@Resource
private IIscAppServiceApplyService applyService;
@Override
public IscAppServiceVo queryById(Long serviceAppId){
return getVoById(serviceAppId);
public IscAppServiceVo queryById(Long appServiceId){
return getVoById(appServiceId);
}
@Override
@ -90,13 +97,20 @@ public class IscAppServiceServiceImpl extends ServicePlusImpl<IscAppServiceMappe
public Boolean insertByBo(IscAppServiceBo bo) {
IscAppService add = BeanUtil.toBean(bo, IscAppService.class);
validEntityBeforeSave(add);
return save(add);
add.setStatus(IscConstants.AUDIT_WAIT);
add.setApplyType(IscConstants.APPLY_TYPE_APPLY);
add.setUserId(SecurityUtils.getUserId());
boolean result = save(add);
addApplyRecord(bo, IscConstants.APPLY_TYPE_APPLY, add.getAppServiceId());
return result;
}
@Override
public Boolean updateByBo(IscAppServiceBo bo) {
IscAppService update = BeanUtil.toBean(bo, IscAppService.class);
validEntityBeforeSave(update);
update.setStatus(IscConstants.AUDIT_WAIT);
addApplyRecord(bo, IscConstants.APPLY_TYPE_RENEWAL, bo.getAppServiceId());
return updateById(update);
}
@ -106,7 +120,13 @@ public class IscAppServiceServiceImpl extends ServicePlusImpl<IscAppServiceMappe
* @param entity 实体类数据
*/
private void validEntityBeforeSave(IscAppService entity){
//TODO 做一些数据校验,如唯一约束
//判断是否有申请未审核
if(Objects.nonNull(entity.getAppServiceId())){
long count = applyService.count(Wrappers.<IscAppServiceApply>lambdaQuery()
.eq(IscAppServiceApply::getAppServiceId, entity.getAppServiceId())
.eq(IscAppServiceApply::getStatus, IscConstants.AUDIT_WAIT));
Assert.isFalse(SqlHelper.retBool(count), () -> new ServiceException("有申请未审核, 不能再申请"));
}
}
@Override
@ -125,4 +145,42 @@ public class IscAppServiceServiceImpl extends ServicePlusImpl<IscAppServiceMappe
.eq(IscAppService::getApplicationId, applicationId), o -> (Long) o);
return serviceService.genServiceTree(CollectionUtil.newHashSet(serviceIds));
}
@Override
public List<IscAppService> getAppServiceListByIds(Collection<Long> ids)
{
return list(Wrappers.<IscAppService>lambdaQuery()
.select(IscAppService::getAppServiceId, IscAppService::getApplicationId, IscAppService::getServiceId)
.in(IscAppService::getAppServiceId, ids));
}
/**
* 添加 服务申请记录
* @param appService 应用服务信息
* @param applyType 申请类型
* @param appServiceId 应用服务ID
* @return 是否添加成功
*/
private Boolean addApplyRecord(IscAppServiceBo appService, String applyType, Long appServiceId) {
IscAppServiceApplyBo entity = new IscAppServiceApplyBo();
entity.setAppServiceId(appServiceId);
entity.setApplyType(applyType);
entity.setStatus(IscConstants.AUDIT_WAIT);
entity.setRemark(appService.getRemark());
switch (applyType) {
case IscConstants.APPLY_TYPE_APPLY:
entity.setRenewalDuration(appService.getRenewalDuration());
case IscConstants.APPLY_TYPE_MODIFY:
entity.setQuotaDays(appService.getQuotaDays());
entity.setQuotaHours(appService.getQuotaHours());
entity.setQuotaMinutes(appService.getQuotaMinutes());
entity.setQuotaSeconds(appService.getQuotaSeconds());
break;
case IscConstants.APPLY_TYPE_RENEWAL:
entity.setRenewalDuration(appService.getRenewalDuration());
break;
default:
}
return applyService.insertByBo(entity);
}
}

View File

@ -1,6 +1,8 @@
package com.ruoyi.isc.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -20,6 +22,7 @@ import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 应用信息Service业务层处理
@ -88,4 +91,16 @@ public class IscApplicationServiceImpl extends ServicePlusImpl<IscApplicationMap
}
return removeByIds(ids);
}
@Override
public Map<Long, String> getNameMap(Collection<Long> applicationIds)
{
if(CollectionUtil.isEmpty(applicationIds)) {
return MapUtil.empty();
}
return list(Wrappers.<IscApplication>lambdaQuery()
.select(IscApplication::getApplicationId, IscApplication::getApplicationName)
.in(IscApplication::getApplicationId, applicationIds)).stream()
.collect(Collectors.toMap(IscApplication::getApplicationId, IscApplication::getApplicationName));
}
}

View File

@ -3,6 +3,7 @@ package com.ruoyi.isc.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.map.MapUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -134,6 +135,9 @@ public class IscServiceServiceImpl extends ServicePlusImpl<IscServiceMapper, Isc
@Override
public Map<Long, String> getNameMap(Collection<Long> serviceIds)
{
if(CollectionUtil.isEmpty(serviceIds)) {
return MapUtil.empty();
}
return list(Wrappers.<IscService>lambdaQuery()
.select(IscService::getServiceId, IscService::getServiceName)
.in(IscService::getServiceId, serviceIds)).stream()

View File

@ -0,0 +1,27 @@
<?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.IscAppServiceApplyMapper">
<resultMap type="com.ruoyi.isc.domain.IscAppServiceApply" id="IscAppServiceApplyResult">
<result property="applyId" column="apply_id"/>
<result property="appServiceId" column="app_service_id"/>
<result property="applyType" column="apply_type"/>
<result property="status" column="status"/>
<result property="auditMind" column="audit_mind"/>
<result property="renewalDuration" column="renewal_duration"/>
<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"/>
<result property="remark" column="remark"/>
</resultMap>
</mapper>

View File

@ -5,7 +5,7 @@
<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="appServiceId" column="app_service_id"/>
<result property="serviceId" column="service_id"/>
<result property="applicationId" column="application_id"/>
<result property="userId" column="user_id"/>

View File

@ -10,9 +10,9 @@ export function listAppservice(query) {
}
// 查询应用服务详细
export function getAppservice(serviceAppId) {
export function getAppservice(appServiceId) {
return request({
url: '/isc/appservice/' + serviceAppId,
url: '/isc/appservice/' + appServiceId,
method: 'get'
})
}
@ -36,9 +36,9 @@ export function updateAppservice(data) {
}
// 删除应用服务
export function delAppservice(serviceAppId) {
export function delAppservice(appServiceId) {
return request({
url: '/isc/appservice/' + serviceAppId,
url: '/isc/appservice/' + appServiceId,
method: 'delete'
})
}

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询应用服务申请信息列表
export function listServiceapply(query) {
return request({
url: '/isc/serviceapply/list',
method: 'get',
params: query
})
}
// 查询应用服务申请信息详细
export function getServiceapply(applyId) {
return request({
url: '/isc/serviceapply/' + applyId,
method: 'get'
})
}
// 新增应用服务申请信息
export function addServiceapply(data) {
return request({
url: '/isc/serviceapply',
method: 'post',
data: data
})
}
// 修改应用服务申请信息
export function updateServiceapply(data) {
return request({
url: '/isc/serviceapply',
method: 'put',
data: data
})
}
// 删除应用服务申请信息
export function delServiceapply(applyId) {
return request({
url: '/isc/serviceapply/' + applyId,
method: 'delete'
})
}

View File

@ -75,7 +75,7 @@
<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" width="80"/>
<el-table-column label="应用名称" align="center" prop="applicationName" >
<el-table-column label="应用名称" align="left" prop="applicationName" >
<template slot-scope="scope">
<router-link :to="'/isc/app-service/index/' + scope.row.applicationId" class="link-type">
<span>{{ scope.row.applicationName }}</span>
@ -86,7 +86,7 @@
<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>
<span>{{ parseTime(scope.row.updateTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">

View File

@ -46,7 +46,18 @@
size="mini"
@click="handleAdd"
v-hasPermi="['isc:appservice:add']"
>新增</el-button>
>申请</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-time"
size="mini"
:disabled="single"
@click="handleRenewal"
v-hasPermi="['isc:appservice:edit']"
>续期</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -58,7 +69,7 @@
@click="handleUpdate"
v-hasPermi="['isc:appservice:edit']"
>修改</el-button>
</el-col>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
@ -86,37 +97,39 @@
<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="服务名称" align="center" prop="serviceName" />
<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">
<el-table-column label="应用服务ID" align="center" prop="appServiceId" v-if="false"/>
<el-table-column label="服务名称" align="left" prop="serviceName" />
<el-table-column label="虚拟地址" align="left" prop="virtualAddr" />
<el-table-column label="审核状态" align="center" prop="status" width="100">
<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">
<el-table-column label="到期时间" align="center" prop="endTime" width="100">
<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="enabled" width="100">
<template slot-scope="scope">
<dict-tag :options="enabledOptions" :value="scope.row.enabled"/>
</template>
</el-table-column>
<el-table-column label="更新者" align="center" prop="updateBy" width="100"/>
<el-table-column label="更新时间" align="center" prop="updateTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.updateTime) }}</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-time"
@click="handleRenewal(scope.row)"
v-hasPermi="['isc:appservice:edit']"
>续期</el-button>
<el-button
size="mini"
type="text"
@ -148,10 +161,17 @@
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="服务名称" prop="serviceId">
<!-- :disable-branch-nodes="true" 只能选叶子节点 -->
<treeselect v-model="form.serviceId" :options="appServiceOptions" :show-count="true" :normalizer="normalizer"
:disable-branch-nodes="true" placeholder="请选择服务" style="width:215px"/>
<treeselect
v-model="form.serviceId"
:options="appServiceOptions"
:show-count="true"
:normalizer="normalizer"
:disable-branch-nodes="true"
:disabled="this.applyType !== 0"
placeholder="请选择服务"
style="width:215px"/>
</el-form-item>
<el-form-item label="启用状态">
<el-form-item label="启用状态" v-if="this.applyType === 0">
<el-radio-group v-model="form.enabled">
<el-radio
v-for="dict in enabledOptions"
@ -160,26 +180,31 @@
>{{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 label="申请时长" prop="renewalDuration" v-if="this.applyType === 0 || this.applyType === 1">
<el-select v-model="form.renewalDuration" placeholder="请选择申请时长" clearable size="small">
<el-option key="1" label="1(月)" value="1"/>
<el-option key="3" label="3(月)" value="3"/>
<el-option key="6" label="6(月)" value="6"/>
<el-option key="9" label="9(月)" value="9"/>
<el-option key="12" label="1(年)" value="12"/>
<el-option key="24" label="2(年)" value="24"/>
</el-select>
</el-form-item>
<el-form-item label="日配额" prop="quotaDays">
<el-input-number v-model="form.quotaDays" step="1000" placeholder="请输入日配额" />
<el-form-item label="日配额" prop="quotaDays" v-if="this.applyType === 0 || this.applyType === 2">
<el-input-number v-model="form.quotaDays" :step="1000" placeholder="请输入日配额" />
</el-form-item>
<el-form-item label="小时配额" prop="quotaHours">
<el-input-number v-model="form.quotaHours" step="100" placeholder="请输入小时配额" />
<el-form-item label="小时配额" prop="quotaHours" v-if="this.applyType === 0 || this.applyType === 2">
<el-input-number v-model="form.quotaHours" :step="100" placeholder="请输入小时配额" />
</el-form-item>
<el-form-item label="分钟配额" prop="quotaMinutes">
<el-input-number v-model="form.quotaMinutes" step="10" placeholder="请输入分钟配额" />
<el-form-item label="分钟配额" prop="quotaMinutes" v-if="this.applyType === 0 || this.applyType === 2">
<el-input-number v-model="form.quotaMinutes" :step="10" placeholder="请输入分钟配额" />
</el-form-item>
<el-form-item label="秒配额" prop="quotaSeconds">
<el-form-item label="秒配额" prop="quotaSeconds" v-if="this.applyType === 0 || this.applyType === 2">
<el-input-number v-model="form.quotaSeconds" 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>
@ -223,8 +248,6 @@ export default {
open: false,
//
enabledOptions: [],
//
applyTypeOptions: [],
//
statusOptions: [],
//
@ -239,6 +262,7 @@ export default {
},
applicationName: undefined,
applicationId: undefined,
applyType: undefined,
//
form: {},
//
@ -249,6 +273,9 @@ export default {
enabled: [
{ required: true, message: "启用状态不能为空", trigger: "blur" }
],
renewalDuration: [
{ required: true, message: "申请时长不能为空", trigger: "blur" }
],
}
};
},
@ -260,9 +287,6 @@ export default {
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;
});
@ -309,13 +333,12 @@ export default {
//
reset() {
this.form = {
serviceAppId: undefined,
appServiceId: undefined,
serviceId: undefined,
applicationId: this.applicationId,
enabled: "0",
applyType: undefined,
status: [],
endTime: undefined,
renewalDuration: undefined,
quotaDays: undefined,
quotaHours: undefined,
quotaMinutes: undefined,
@ -335,13 +358,15 @@ export default {
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.serviceAppId)
this.ids = selection.map(item => item.appServiceId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.applyType = 0;
this.getTreeselect(this.applicationId);
this.open = true;
this.title = "添加应用服务";
},
@ -349,8 +374,9 @@ export default {
handleUpdate(row) {
this.loading = true;
this.reset();
const serviceAppId = row.serviceAppId || this.ids
getAppservice(serviceAppId).then(response => {
this.applyType = 2;
const appServiceId = row.appServiceId || this.ids
getAppservice(appServiceId).then(response => {
this.loading = false;
this.form = response.data;
this.form.status = this.form.status.split(",");
@ -358,13 +384,27 @@ export default {
this.title = "修改应用服务";
});
},
/** 续期按钮操作 */
handleRenewal(row) {
this.loading = true;
this.reset();
this.applyType = 1;
const appServiceId = row.appServiceId || this.ids
getAppservice(appServiceId).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) {
if (this.form.appServiceId != null) {
updateAppservice(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
@ -386,14 +426,14 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
const serviceAppIds = row.serviceAppId || this.ids;
this.$confirm('是否确认删除应用服务编号为"' + serviceAppIds + '"的数据项?', "警告", {
const appServiceIds = row.appServiceId || this.ids;
this.$confirm('是否确认删除应用服务编号为"' + appServiceIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.loading = true;
return delAppservice(serviceAppIds);
return delAppservice(appServiceIds);
}).then(() => {
this.loading = false;
this.getList();

View File

@ -53,7 +53,7 @@
<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>
<span>{{ parseTime(scope.row.updateTime) }}</span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />

View File

@ -0,0 +1,368 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="申请类型" prop="applyType">
<el-select v-model="queryParams.applyType" placeholder="请选择申请类型" clearable size="small">
<el-option
v-for="dict in applyTypeOptions"
: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:serviceapply: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:serviceapply: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:serviceapply: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:serviceapply:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="serviceapplyList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="申请ID" align="center" prop="applyId" v-if="false"/>
<el-table-column label="应用名称" align="left" prop="applicationName" />
<el-table-column label="服务名称" align="left" prop="serviceName" />
<el-table-column label="申请类型" align="center" prop="applyType" width="80">
<template slot-scope="scope">
<dict-tag :options="applyTypeOptions" :value="scope.row.applyType"/>
</template>
</el-table-column>
<el-table-column label="审核状态" align="center" prop="status" width="80">
<template slot-scope="scope">
<dict-tag :options="statusOptions" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="续期时长(月)" align="center" prop="renewalDuration" width="100"/>
<el-table-column label="天配额" align="center" prop="quotaDays" width="80"/>
<el-table-column label="小时配额" align="center" prop="quotaHours" width="80"/>
<el-table-column label="分钟配额" align="center" prop="quotaMinutes" width="80"/>
<el-table-column label="秒配额" align="center" prop="quotaSeconds" width="70"/>
<el-table-column label="更新者" align="center" prop="updateBy" width="100"/>
<el-table-column label="更新时间" align="center" prop="updateTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime) }}</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:serviceapply:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['isc:serviceapply: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="appServiceId">
<el-input v-model="form.appServiceId" placeholder="请输入应用服务ID" />
</el-form-item>
<el-form-item label="续期时长" prop="renewalDuration">
<el-input v-model="form.renewalDuration" placeholder="请输入续期时长" />
</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-item label="创建者" prop="createBy">
<el-input v-model="form.createBy" placeholder="请输入创建者" />
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker clearable size="small"
v-model="form.createTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择创建时间">
</el-date-picker>
</el-form-item>
<el-form-item label="更新者" prop="updateBy">
<el-input v-model="form.updateBy" placeholder="请输入更新者" />
</el-form-item>
<el-form-item label="更新时间" prop="updateTime">
<el-date-picker clearable size="small"
v-model="form.updateTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择更新时间">
</el-date-picker>
</el-form-item>
<el-form-item label="删除标志" prop="delFlag">
<el-input v-model="form.delFlag" 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 { listServiceapply, getServiceapply, delServiceapply, addServiceapply, updateServiceapply } from "@/api/isc/serviceapply";
export default {
name: "Serviceapply",
data() {
return {
// loading
buttonLoading: false,
//
loading: true,
//
exportLoading: false,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
serviceapplyList: [],
//
title: "",
//
open: false,
// (0 1)
applyTypeOptions: [],
//
statusOptions: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
applyType: undefined,
status: undefined,
},
//
form: {},
//
rules: {
appServiceId: [
{ required: true, message: "应用服务ID不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
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;
listServiceapply(this.queryParams).then(response => {
this.serviceapplyList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
applyId: undefined,
appServiceId: undefined,
applyType: undefined,
status: "0",
auditMind: undefined,
renewalDuration: undefined,
quotaDays: undefined,
quotaHours: undefined,
quotaMinutes: undefined,
quotaSeconds: 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.applyId)
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 applyId = row.applyId || this.ids
getServiceapply(applyId).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.applyId != null) {
updateServiceapply(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
} else {
addServiceapply(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const applyIds = row.applyId || this.ids;
this.$confirm('是否确认删除应用服务申请信息编号为"' + applyIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.loading = true;
return delServiceapply(applyIds);
}).then(() => {
this.loading = false;
this.getList();
this.msgSuccess("删除成功");
}).finally(() => {
this.loading = false;
});
},
/** 导出按钮操作 */
handleExport() {
this.downLoadExcel('/isc/serviceapply/export', this.queryParams);
}
}
};
</script>

View File

@ -6,7 +6,7 @@ SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
DROP TABLE IF EXISTS `isc_app_service`;
CREATE TABLE `isc_app_service` (
`service_app_id` bigint NOT NULL AUTO_INCREMENT COMMENT '应用服务ID',
`app_service_id` bigint NOT NULL AUTO_INCREMENT COMMENT '应用服务ID',
`service_id` bigint NULL DEFAULT NULL COMMENT '服务ID',
`application_id` bigint NULL DEFAULT NULL COMMENT '应用ID',
`user_id` bigint NULL DEFAULT NULL COMMENT '用户ID',
@ -24,7 +24,7 @@ CREATE TABLE `isc_app_service` (
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
`del_flag` char(1) DEFAULT '0' COMMENT '删除标志0代表存在 2代表删除',
PRIMARY KEY (`service_app_id`) USING BTREE
PRIMARY KEY (`app_service_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT = '应用服务信息';
-- ----------------------------
@ -39,7 +39,7 @@ COMMIT;
DROP TABLE IF EXISTS `isc_app_service_apply`;
CREATE TABLE `isc_app_service_apply` (
`apply_id` bigint NOT NULL AUTO_INCREMENT COMMENT '申请ID',
`service_app_id` bigint NOT NULL COMMENT '应用服务ID',
`app_service_id` bigint NOT NULL COMMENT '应用服务ID',
`apply_type` char(1) DEFAULT NULL COMMENT '申请类型(0申请 1续期)',
`status` char(1) DEFAULT NULL COMMENT '审核状态0待审核 1审核通过 2驳回',
`audit_mind` varchar(255) DEFAULT NULL COMMENT '审核意见',
@ -243,10 +243,15 @@ INSERT INTO `sys_menu` VALUES (1634, '应用服务修改', 1631, 3, '#', '', 1,
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, '');
INSERT INTO VALUES (100, '审核状态', 'sys_audit_status', '0', 'admin', '2021-08-21 21:21:58', 'admin', '2021-08-21 21:21:58', '审核状态列表');
INSERT INTO VALUES (101, '在线状态', 'isc_online_status', '0', 'admin', '2021-08-21 21:24:28', 'admin', '2021-08-21 21:24:28', '在线状态列表');
INSERT INTO VALUES (102, '申请类型', 'isc_apply_type', '0', 'admin', '2021-08-21 21:25:26', 'admin', '2021-08-21 21:25:26', '申请类型列表');
INSERT INTO VALUES (103, '请求方法', 'isc_request_method', '0', 'admin', '2021-09-07 22:12:58', 'admin', '2021-09-07 22:12:58', 'GET/POST');
INSERT INTO `sys_menu` VALUES (1637, '服务申请', 1606, 1, 'serviceapply', 'isc/serviceapply/index', 1, 0, 'C', '0', '0', 'isc:serviceapply:list', '#', 'admin', '2021-09-09 14:45:09', '', NULL, '服务申请菜单');
INSERT INTO `sys_menu` VALUES (1638, '服务申请信息查询', 1637, 1, '#', '', 1, 0, 'F', '0', '0', 'isc:serviceapply:query', '#', 'admin', '2021-09-09 14:45:09', '', NULL, '');
INSERT INTO `sys_menu` VALUES (1639, '服务申请信息审核', 1637, 2, '#', '', 1, 0, 'F', '0', '0', 'isc:serviceapply:audit', '#', 'admin', '2021-09-09 14:45:09', '', NULL, '');
INSERT INTO `sys_menu` VALUES (1640, '服务申请信息导出', 1637, 5, '#', '', 1, 0, 'F', '0', '0', 'isc:serviceapply:export', '#', 'admin', '2021-09-09 14:45:09', '', NULL, '');
INSERT INTO `sys_dict_type` VALUES (100, '审核状态', 'sys_audit_status', '0', 'admin', '2021-08-21 21:21:58', 'admin', '2021-08-21 21:21:58', '审核状态列表');
INSERT INTO `sys_dict_type` VALUES (101, '在线状态', 'isc_online_status', '0', 'admin', '2021-08-21 21:24:28', 'admin', '2021-08-21 21:24:28', '在线状态列表');
INSERT INTO `sys_dict_type` VALUES (102, '申请类型', 'isc_apply_type', '0', 'admin', '2021-08-21 21:25:26', 'admin', '2021-08-21 21:25:26', '申请类型列表');
INSERT INTO `sys_dict_type` VALUES (103, '请求方法', 'isc_request_method', '0', 'admin', '2021-09-07 22:12:58', 'admin', '2021-09-07 22:12:58', 'GET/POST');
INSERT INTO `sys_dict_data` VALUES (100, 0, '待审核', '0', 'sys_audit_status', NULL, 'primary', 'N', '0', 'admin', '2021-08-21 21:26:36', 'admin', '2021-08-21 21:26:36', NULL);
INSERT INTO `sys_dict_data` VALUES (101, 1, '通过', '1', 'sys_audit_status', NULL, 'success', 'N', '0', 'admin', '2021-08-21 21:27:02', 'admin', '2021-08-21 21:27:02', NULL);
@ -255,9 +260,9 @@ INSERT INTO `sys_dict_data` VALUES (103, 0, '离线', '0', 'isc_online_status',
INSERT INTO `sys_dict_data` VALUES (104, 1, '在线', '1', 'isc_online_status', NULL, 'primary', 'N', '0', 'admin', '2021-08-21 21:29:15', 'admin', '2021-08-21 21:29:15', NULL);
INSERT INTO `sys_dict_data` VALUES (105, 0, '申请', '0', 'isc_apply_type', NULL, 'primary', 'N', '0', 'admin', '2021-08-21 21:30:26', 'admin', '2021-08-21 21:30:26', NULL);
INSERT INTO `sys_dict_data` VALUES (106, 1, '续期', '1', 'isc_apply_type', NULL, 'primary', 'N', '0', 'admin', '2021-08-21 21:30:42', 'admin', '2021-08-21 21:30:42', NULL);
INSERT INTO `sys_dict_data` VALUES (107, 1, 'GET', 'GET', 'isc_request_method', NULL, 'primary', 'N', '0', 'admin', '2021-09-07 22:13:22', 'admin', '2021-09-07 22:13:56', NULL);
INSERT INTO `sys_dict_data` VALUES (108, 2, 'POST', 'POST', 'isc_request_method', NULL, 'info', 'N', '0', 'admin', '2021-09-07 22:13:40', 'admin', '2021-09-07 22:13:40', NULL);
INSERT INTO `sys_dict_data` VALUES (107, 2, '修改', '2', 'isc_apply_type', NULL, 'primary', 'N', '0', 'admin', '2021-09-09 17:00:48', 'admin', '2021-09-09 17:00:48', NULL);
INSERT INTO `sys_dict_data` VALUES (108, 1, 'GET', 'GET', 'isc_request_method', NULL, 'primary', 'N', '0', 'admin', '2021-09-07 22:13:22', 'admin', '2021-09-07 22:13:56', NULL);
INSERT INTO `sys_dict_data` VALUES (109, 2, 'POST', 'POST', 'isc_request_method', NULL, 'info', 'N', '0', 'admin', '2021-09-07 22:13:40', 'admin', '2021-09-07 22:13:40', NULL);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;