服务审核

This commit is contained in:
Wenchao Gong 2021-09-10 11:35:16 +08:00
parent e04a4526ce
commit 0d66a9caf9
7 changed files with 279 additions and 69 deletions

View File

@ -1,30 +1,31 @@
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.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.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.isc.domain.vo.IscServiceVo;
import com.ruoyi.isc.domain.bo.IscAuditBo;
import com.ruoyi.isc.domain.bo.IscServiceBo;
import com.ruoyi.isc.domain.vo.IscServiceVo;
import com.ruoyi.isc.service.IIscServiceService;
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
@ -109,4 +110,16 @@ public class IscServiceController extends BaseController {
@PathVariable Long[] serviceIds) {
return toAjax(iIscServiceService.deleteWithValidByIds(Arrays.asList(serviceIds), true) ? 1 : 0);
}
/**
* 服务信息审核
*/
@ApiOperation("服务信息审核")
@PreAuthorize("@ss.hasPermi('isc:service:audit')")
@Log(title = "服务信息审核", businessType = BusinessType.AUDIT)
@RepeatSubmit()
@PutMapping("/audit")
public AjaxResult<Void> audit(@Validated @RequestBody IscAuditBo bo) {
return toAjax(iIscServiceService.audit(bo) ? 1 : 0);
}
}

View File

@ -1,10 +1,10 @@
package com.ruoyi.isc.service;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNode;
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.isc.domain.IscService;
import com.ruoyi.isc.domain.bo.IscAuditBo;
import com.ruoyi.isc.domain.bo.IscServiceBo;
import com.ruoyi.isc.domain.vo.IscServiceVo;
@ -77,4 +77,17 @@ public interface IIscServiceService extends IServicePlus<IscService, IscServiceV
* @return 服务树结构
*/
List<Tree<Long>> genServiceTree(Set<Long> exitsIds);
/**
* 服务信息审核
* @param bo 审核信息
* @return 操作结果
*/
Boolean audit(IscAuditBo bo);
/**
* 校验 审核参数
* @param bo 审核业务对象
*/
void checkAuditBO(IscAuditBo bo);
}

View File

@ -2,14 +2,12 @@ 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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
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.StringUtils;
import com.ruoyi.isc.domain.IscAppService;
@ -138,15 +136,7 @@ public class IscAppServiceApplyServiceImpl extends ServicePlusImpl<IscAppService
@Override
public Boolean audit(IscAuditBo bo)
{
switch (bo.getStatus()) {
case IscConstants.AUDIT_PASS:
break;
case IscConstants.AUDIT_REJECT:
Assert.notBlank(bo.getRemark(), () -> new ServiceException("审核意见不能为空"));
break;
default:
throw new ServiceException("审核状态异常");
}
serviceService.checkAuditBO(bo);
boolean result = true;
for (Long id : bo.getIds())
{

View File

@ -2,6 +2,7 @@ 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 cn.hutool.core.map.MapUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -12,11 +13,13 @@ import com.ruoyi.common.constant.UserConstants;
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.FullPathUtils;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.isc.domain.IscService;
import com.ruoyi.isc.domain.bo.IscAuditBo;
import com.ruoyi.isc.domain.bo.IscServiceBo;
import com.ruoyi.isc.domain.vo.IscServiceVo;
import com.ruoyi.isc.mapper.IscServiceMapper;
@ -159,4 +162,37 @@ public class IscServiceServiceImpl extends ServicePlusImpl<IscServiceMapper, Isc
.orderByDesc(IscService::getUpdateTime));
return cateService.genCateTree(cateService.selectCateList(), serviceList, exitsIds);
}
@Override
public Boolean audit(IscAuditBo bo)
{
checkAuditBO(bo);
boolean result = true;
for (Long id : bo.getIds())
{
IscService service = getOne(Wrappers.<IscService>lambdaQuery()
.eq(IscService::getServiceId, id)
.eq(IscService::getStatus, IscConstants.AUDIT_WAIT), false);
if(Objects.isNull(service)) {
continue;
}
result = updateById(new IscService().setServiceId(id).setStatus(bo.getStatus())
.setAuditMind(bo.getRemark()));
}
return result;
}
@Override
public void checkAuditBO(IscAuditBo bo)
{
switch (bo.getStatus()) {
case IscConstants.AUDIT_PASS:
break;
case IscConstants.AUDIT_REJECT:
Assert.notBlank(bo.getRemark(), () -> new ServiceException("审核意见不能为空"));
break;
default:
throw new ServiceException("审核状态异常");
}
}
}

View File

@ -42,3 +42,12 @@ export function delService(serviceId) {
method: 'delete'
})
}
// 服务信息审核
export function auditService(data) {
return request({
url: '/isc/service/audit',
method: 'put',
data: data
})
}

View File

@ -78,7 +78,7 @@
icon="el-icon-view"
size="mini"
:disabled="multiple"
@click="handleUpdate"
@click="handleAudit"
v-hasPermi="['isc:service:audit']"
>批量审核</el-button>
</el-col>
@ -139,14 +139,14 @@
size="mini"
type="text"
icon="el-icon-info"
@click="handleUpdate(scope.row)"
@click="handleAuditSingle(scope.row)"
v-hasPermi="['isc:service:query']"
>查看</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleUpdate(scope.row)"
@click="handleAuditSingle(scope.row)"
v-hasPermi="['isc:service:audit']"
>审核</el-button>
<el-button
@ -223,11 +223,67 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 查看或审核服务信息对话框 -->
<el-dialog :title="title" :visible.sync="openView" width="500px" append-to-body>
<el-card shadow="never" v-if="this.show" style="margin-bottom: 20px">
<el-row :gutter="20">
<el-col :span="6" class="col-title">服务分类</el-col>
<el-col :span="18" class="col-content">{{this.form.cateName}}</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">服务名称</el-col>
<el-col :span="18" class="col-content">{{this.form.serviceName}}</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">服务地址</el-col>
<el-col :span="18" class="col-content">{{this.form.serviceAddr}}</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">探活地址</el-col>
<el-col :span="18" class="col-content">{{this.form.probeActiveAddr}}</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">请求方式</el-col>
<el-col :span="18" class="col-content">
<dict-tag :options="requestMethodOptions" :value="this.form.requestMethod"/>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">备注</el-col>
<el-col :span="18" class="col-content">{{this.form.remark}}</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">跨域标志</el-col>
<el-col :span="18" class="col-content">
<dict-tag :options="corsFlagOptions" :value="this.form.corsFlag"/>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">隐藏参数</el-col>
<el-col :span="18" class="col-content">{{this.form.hiddenParams}}</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">JSON文档</el-col>
<el-col :span="18" class="col-content">{{this.form.apiDoc}}</el-col>
</el-row>
</el-card>
<el-form ref="auditForm" :model="auditForm" :rules="rules" label-width="80px">
<el-form-item label="审核意见" prop="remark">
<el-input v-model="auditForm.remark" type="textarea" :disabled='this.view' placeholder="请输入审核意见"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="success" @click="submitAuditForm(1)" icon="el-icon-check" v-if="!this.view"> </el-button>
<el-button :loading="buttonLoading" type="warning" @click="submitAuditForm(2)" icon="el-icon-close" v-if="!this.view"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listService, getService, delService, addService, updateService } from "@/api/isc/service";
import { listService, getService, delService, addService, updateService, auditService } from "@/api/isc/service";
import { treeselect } from "@/api/isc/cate";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
@ -246,6 +302,10 @@ export default {
exportLoading: false,
//
ids: [],
//
view: false,
//
show: false,
//
single: true,
//
@ -260,6 +320,8 @@ export default {
title: "",
//
open: false,
//
openView: false,
//
corsFlagOptions: [],
// 线
@ -284,6 +346,8 @@ export default {
},
//
form: {},
//
auditForm: {},
//
rules: {
serviceName: [
@ -344,7 +408,7 @@ export default {
},
//
cancel() {
this.open = false;
this.open = this.openView = false;
this.reset();
},
//
@ -372,6 +436,15 @@ export default {
};
this.resetForm("form");
},
//
resetAudit() {
this.auditForm = {
ids: [],
status: "0",
remark: undefined
};
this.resetForm("auditForm");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
@ -388,6 +461,36 @@ export default {
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 审核按钮操作 */
handleAudit(row) {
if(this.single) {
this.openView = true;
this.show = false;
this.title = "服务审核";
this.resetAudit();
this.auditForm.ids = this.ids;
return;
}
this.handleAuditSingle(row, false);
},
handleAuditSingle(row, view) {
this.loading = true;
this.view = view;
this.show = true;
this.reset();
const serviceId = row.serviceId || this.ids
getService(serviceId).then(response => {
this.loading = false;
this.form = response.data;
this.openView = true;
if(view) {
this.title = "服务查看";
}else{
this.title = "服务审核";
}
this.auditForm.ids = [serviceId]
});
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
@ -445,6 +548,27 @@ export default {
}
});
},
/** 提交按钮 */
submitAuditForm(status) {
this.auditForm.status = status;
this.$refs["auditForm"].validate(valid => {
if (valid) {
this.buttonLoading = true;
if (this.auditForm.ids.length > 0) {
auditService(this.auditForm).then(response => {
this.msgSuccess("审核成功");
this.openView = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
} else {
this.msgError("请选择记录");
this.buttonLoading = false;
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const serviceIds = row.serviceId || this.ids;
@ -470,3 +594,15 @@ export default {
}
};
</script>
<style lang="scss" scoped>
.el-card .el-row {
font-size: 14px;
line-height: 36px;
vertical-align: middle;
}
.el-card .el-row .col-title {
text-align: right;
color: #606266;
font-weight: bold;
}
</style>

View File

@ -85,19 +85,18 @@
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleAuditSingle(scope.row)"
v-if="scope.row.status == 0"
v-hasPermi="['isc:serviceapply:audit']"
>审核</el-button>
icon="el-icon-info"
@click="handleAuditSingle(scope.row, true)"
v-hasPermi="['isc:serviceapply:query']"
>查看</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-info"
@click="handleAuditSingle(scope.row)"
v-if="scope.row.status > 0"
v-hasPermi="['isc:serviceapply:query']"
>查看</el-button>
icon="el-icon-view"
@click="handleAuditSingle(scope.row, false)"
v-if="scope.row.status == 0"
v-hasPermi="['isc:serviceapply:audit']"
>审核</el-button>
</template>
</el-table-column>
</el-table>
@ -110,70 +109,70 @@
@pagination="getList"
/>
<!-- 添加或修改应用服务申请信息对话框 -->
<!-- 查看或审核服务申请信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-card shadow="never" v-if="!single" style="margin-bottom: 20px">
<el-card shadow="never" v-if="this.show" style="margin-bottom: 20px">
<el-row :gutter="20">
<el-col :span="6" class="col-title">应用名称</el-col>
<el-col :span="18" class="col-content">{{this.form.applicationName}}</el-col>
<el-col :span="18" class="col-content">{{this.viewData.applicationName}}</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">服务名称</el-col>
<el-col :span="18" class="col-content">{{this.form.serviceName}}</el-col>
<el-col :span="18" class="col-content">{{this.viewData.serviceName}}</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">申请类型</el-col>
<el-col :span="18" class="col-content">
<dict-tag :options="applyTypeOptions" :value="this.form.applyType"/>
<dict-tag :options="applyTypeOptions" :value="this.viewData.applyType"/>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">审核状态</el-col>
<el-col :span="18" class="col-content">
<dict-tag :options="statusOptions" :value="this.form.status"/>
<dict-tag :options="statusOptions" :value="this.viewData.status"/>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">续期时长()</el-col>
<el-col :span="18" class="col-content">{{this.form.renewalDuration}}</el-col>
<el-col :span="18" class="col-content">{{this.viewData.renewalDuration}}</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">每日配额</el-col>
<el-col :span="18" class="col-content">{{this.form.quotaDays}}</el-col>
<el-col :span="18" class="col-content">{{this.viewData.quotaDays}}</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">小时配额</el-col>
<el-col :span="18" class="col-content">{{this.form.quotaHours}}</el-col>
<el-col :span="18" class="col-content">{{this.viewData.quotaHours}}</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">分钟配额</el-col>
<el-col :span="18" class="col-content">{{this.form.quotaMinutes}}</el-col>
<el-col :span="18" class="col-content">{{this.viewData.quotaMinutes}}</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">每秒配额</el-col>
<el-col :span="18" class="col-content">{{this.form.quotaSeconds}}</el-col>
<el-col :span="18" class="col-content">{{this.viewData.quotaSeconds}}</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">提交人</el-col>
<el-col :span="18" class="col-content">{{this.form.updateBy}}</el-col>
<el-col :span="18" class="col-content">{{this.viewData.updateBy}}</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">提交时间</el-col>
<el-col :span="18" class="col-content">{{this.form.updateTime}}</el-col>
<el-col :span="18" class="col-content">{{this.viewData.updateTime}}</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6" class="col-title">备注</el-col>
<el-col :span="18" class="col-content">{{this.form.remark}}</el-col>
<el-col :span="18" class="col-content">{{this.viewData.remark}}</el-col>
</el-row>
</el-card>
<el-form ref="auditForm" :model="auditForm" :rules="rules" label-width="80px">
<el-form-item label="审核意见" prop="remark">
<el-input v-model="auditForm.remark" type="textarea" :disabled='this.form.status > 0' placeholder="请输入审核意见"/>
<el-input v-model="auditForm.remark" type="textarea" :disabled='this.view' placeholder="请输入审核意见"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="success" @click="submitForm(1)" icon="el-icon-check" v-if="this.form.status == 0"> </el-button>
<el-button :loading="buttonLoading" type="warning" @click="submitForm(2)" icon="el-icon-close" v-if="this.form.status == 0"> </el-button>
<el-button :loading="buttonLoading" type="success" @click="submitForm(1)" icon="el-icon-check" v-if="!this.view"> </el-button>
<el-button :loading="buttonLoading" type="warning" @click="submitForm(2)" icon="el-icon-close" v-if="!this.view"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
@ -195,6 +194,10 @@ export default {
exportLoading: false,
//
ids: [],
//
view: false,
//
show: false,
//
single: true,
//
@ -221,7 +224,7 @@ export default {
status: undefined,
},
//
form: {},
viewData: {},
//
auditForm: {},
//
@ -255,18 +258,23 @@ export default {
cancel() {
this.open = false;
this.reset();
this.resetAudit();
},
selectable(row, index) {
return row.status == 0;
},
//
reset() {
this.form = {
applyId: undefined,
this.viewData = { };
},
//
resetAudit() {
this.auditForm = {
ids: [],
status: "0",
remark: undefined
};
this.resetForm("form");
this.resetForm("auditForm");
},
/** 搜索按钮操作 */
handleQuery() {
@ -289,22 +297,28 @@ export default {
if(this.single) {
this.open = true;
this.title = "服务申请审核";
this.resetAudit();
this.show = false;
this.auditForm.ids = this.ids;
return;
}
this.handleAuditSingle(row);
this.handleAuditSingle(row, false);
},
handleAuditSingle(row) {
this.single = false;
handleAuditSingle(row, view) {
this.loading = true;
this.view = view;
this.show = true;
this.reset();
const applyId = row.applyId || this.ids
console.log(applyId)
getServiceapply(applyId).then(response => {
this.loading = false;
this.form = response.data;
this.viewData = response.data;
this.open = true;
this.title = "服务申请审核";
if(view) {
this.title = "服务申请查看";
}else{
this.title = "服务申请审核";
}
this.auditForm.ids = [applyId]
});
},
@ -314,7 +328,6 @@ export default {
this.$refs["auditForm"].validate(valid => {
if (valid) {
this.buttonLoading = true;
console.log(this.auditForm)
if (this.auditForm.ids.length > 0) {
auditServiceapply(this.auditForm).then(response => {
this.msgSuccess("审核成功");