parent
2789140740
commit
c0cce9fb0b
|
|
@ -1,454 +1,454 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
|
||||||
<el-form-item label="菜单名称" prop="menuName">
|
<el-form-item label="菜单名称" prop="menuName">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.menuName"
|
v-model="queryParams.menuName"
|
||||||
placeholder="请输入菜单名称"
|
placeholder="请输入菜单名称"
|
||||||
clearable
|
clearable
|
||||||
size="small"
|
size="small"
|
||||||
@keyup.enter.native="handleQuery"
|
@keyup.enter.native="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-select v-model="queryParams.status" placeholder="菜单状态" clearable size="small">
|
<el-select v-model="queryParams.status" placeholder="菜单状态" clearable size="small">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in dict.type.sys_normal_disable"
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
:label="dict.label"
|
:label="dict.label"
|
||||||
:value="dict.value"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<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-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
plain
|
plain
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['system:menu:add']"
|
v-hasPermi="['system:menu:add']"
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="info"
|
type="info"
|
||||||
plain
|
plain
|
||||||
icon="el-icon-sort"
|
icon="el-icon-sort"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="toggleExpandAll"
|
@click="toggleExpandAll"
|
||||||
>展开/折叠</el-button>
|
>展开/折叠</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
v-if="refreshTable"
|
v-if="refreshTable"
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:data="menuList"
|
:data="menuList"
|
||||||
row-key="menuId"
|
row-key="menuId"
|
||||||
:default-expand-all="isExpandAll"
|
:default-expand-all="isExpandAll"
|
||||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||||
>
|
>
|
||||||
<el-table-column prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="160"></el-table-column>
|
<el-table-column prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="200"></el-table-column>
|
||||||
<el-table-column prop="icon" label="图标" align="center" width="100">
|
<el-table-column prop="icon" label="图标" align="center" width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<svg-icon :icon-class="scope.row.icon" />
|
<svg-icon :icon-class="scope.row.icon" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="orderNum" label="排序" width="60"></el-table-column>
|
<el-table-column prop="orderNum" label="排序" width="60"></el-table-column>
|
||||||
<el-table-column prop="perms" label="权限标识" :show-overflow-tooltip="true"></el-table-column>
|
<el-table-column prop="perms" label="权限标识" :show-overflow-tooltip="true"></el-table-column>
|
||||||
<el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column>
|
<el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column>
|
||||||
<el-table-column prop="status" label="状态" width="80">
|
<el-table-column prop="status" label="状态" width="80">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime">
|
<el-table-column label="创建时间" align="center" prop="createTime">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200px">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['system:menu:edit']"
|
v-hasPermi="['system:menu:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
@click="handleAdd(scope.row)"
|
@click="handleAdd(scope.row)"
|
||||||
v-hasPermi="['system:menu:add']"
|
v-hasPermi="['system:menu:add']"
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['system:menu:remove']"
|
v-hasPermi="['system:menu:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<!-- 添加或修改菜单对话框 -->
|
<!-- 添加或修改菜单对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="680px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="680px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="上级菜单">
|
<el-form-item label="上级菜单">
|
||||||
<treeselect
|
<treeselect
|
||||||
v-model="form.parentId"
|
v-model="form.parentId"
|
||||||
:options="menuOptions"
|
:options="menuOptions"
|
||||||
:normalizer="normalizer"
|
:normalizer="normalizer"
|
||||||
:show-count="true"
|
:show-count="true"
|
||||||
placeholder="选择上级菜单"
|
placeholder="选择上级菜单"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="菜单类型" prop="menuType">
|
<el-form-item label="菜单类型" prop="menuType">
|
||||||
<el-radio-group v-model="form.menuType">
|
<el-radio-group v-model="form.menuType">
|
||||||
<el-radio label="M">目录</el-radio>
|
<el-radio label="M">目录</el-radio>
|
||||||
<el-radio label="C">菜单</el-radio>
|
<el-radio label="C">菜单</el-radio>
|
||||||
<el-radio label="F">按钮</el-radio>
|
<el-radio label="F">按钮</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24" v-if="form.menuType != 'F'">
|
<el-col :span="24" v-if="form.menuType != 'F'">
|
||||||
<el-form-item label="菜单图标" prop="icon">
|
<el-form-item label="菜单图标" prop="icon">
|
||||||
<el-popover
|
<el-popover
|
||||||
placement="bottom-start"
|
placement="bottom-start"
|
||||||
width="460"
|
width="460"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
@show="$refs['iconSelect'].reset()"
|
@show="$refs['iconSelect'].reset()"
|
||||||
>
|
>
|
||||||
<IconSelect ref="iconSelect" @selected="selected" />
|
<IconSelect ref="iconSelect" @selected="selected" />
|
||||||
<el-input slot="reference" v-model="form.icon" placeholder="点击选择图标" readonly>
|
<el-input slot="reference" v-model="form.icon" placeholder="点击选择图标" readonly>
|
||||||
<svg-icon
|
<svg-icon
|
||||||
v-if="form.icon"
|
v-if="form.icon"
|
||||||
slot="prefix"
|
slot="prefix"
|
||||||
:icon-class="form.icon"
|
:icon-class="form.icon"
|
||||||
class="el-input__icon"
|
class="el-input__icon"
|
||||||
style="height: 32px;width: 16px;"
|
style="height: 32px;width: 16px;"
|
||||||
/>
|
/>
|
||||||
<i v-else slot="prefix" class="el-icon-search el-input__icon" />
|
<i v-else slot="prefix" class="el-icon-search el-input__icon" />
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="菜单名称" prop="menuName">
|
<el-form-item label="菜单名称" prop="menuName">
|
||||||
<el-input v-model="form.menuName" placeholder="请输入菜单名称" />
|
<el-input v-model="form.menuName" placeholder="请输入菜单名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="显示排序" prop="orderNum">
|
<el-form-item label="显示排序" prop="orderNum">
|
||||||
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
|
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if="form.menuType != 'F'">
|
<el-col :span="12" v-if="form.menuType != 'F'">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-tooltip content="选择是外链则路由地址需要以`http(s)://`开头" placement="top">
|
<el-tooltip content="选择是外链则路由地址需要以`http(s)://`开头" placement="top">
|
||||||
<i class="el-icon-question"></i>
|
<i class="el-icon-question"></i>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
是否外链
|
是否外链
|
||||||
</span>
|
</span>
|
||||||
<el-radio-group v-model="form.isFrame">
|
<el-radio-group v-model="form.isFrame">
|
||||||
<el-radio label="0">是</el-radio>
|
<el-radio label="0">是</el-radio>
|
||||||
<el-radio label="1">否</el-radio>
|
<el-radio label="1">否</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if="form.menuType != 'F'">
|
<el-col :span="12" v-if="form.menuType != 'F'">
|
||||||
<el-form-item prop="path">
|
<el-form-item prop="path">
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-tooltip content="访问的路由地址,如:`user`,如外网地址需内链访问则以`http(s)://`开头" placement="top">
|
<el-tooltip content="访问的路由地址,如:`user`,如外网地址需内链访问则以`http(s)://`开头" placement="top">
|
||||||
<i class="el-icon-question"></i>
|
<i class="el-icon-question"></i>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
路由地址
|
路由地址
|
||||||
</span>
|
</span>
|
||||||
<el-input v-model="form.path" placeholder="请输入路由地址" />
|
<el-input v-model="form.path" placeholder="请输入路由地址" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if="form.menuType == 'C'">
|
<el-col :span="12" v-if="form.menuType == 'C'">
|
||||||
<el-form-item prop="component">
|
<el-form-item prop="component">
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-tooltip content="访问的组件路径,如:`system/user/index`,默认在`views`目录下" placement="top">
|
<el-tooltip content="访问的组件路径,如:`system/user/index`,默认在`views`目录下" placement="top">
|
||||||
<i class="el-icon-question"></i>
|
<i class="el-icon-question"></i>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
组件路径
|
组件路径
|
||||||
</span>
|
</span>
|
||||||
<el-input v-model="form.component" placeholder="请输入组件路径" />
|
<el-input v-model="form.component" placeholder="请输入组件路径" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if="form.menuType != 'M'">
|
<el-col :span="12" v-if="form.menuType != 'M'">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-input v-model="form.perms" placeholder="请输入权限标识" maxlength="100" />
|
<el-input v-model="form.perms" placeholder="请输入权限标识" maxlength="100" />
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-tooltip content="控制器中定义的权限字符,如:@PreAuthorize(`@ss.hasPermi('system:user:list')`)" placement="top">
|
<el-tooltip content="控制器中定义的权限字符,如:@PreAuthorize(`@ss.hasPermi('system:user:list')`)" placement="top">
|
||||||
<i class="el-icon-question"></i>
|
<i class="el-icon-question"></i>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
权限字符
|
权限字符
|
||||||
</span>
|
</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if="form.menuType == 'C'">
|
<el-col :span="12" v-if="form.menuType == 'C'">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-input v-model="form.query" placeholder="请输入路由参数" maxlength="255" />
|
<el-input v-model="form.query" placeholder="请输入路由参数" maxlength="255" />
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-tooltip content='访问路由的默认传递参数,如:`{"id": 1, "name": "ry"}`' placement="top">
|
<el-tooltip content='访问路由的默认传递参数,如:`{"id": 1, "name": "ry"}`' placement="top">
|
||||||
<i class="el-icon-question"></i>
|
<i class="el-icon-question"></i>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
路由参数
|
路由参数
|
||||||
</span>
|
</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if="form.menuType == 'C'">
|
<el-col :span="12" v-if="form.menuType == 'C'">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-tooltip content="选择是则会被`keep-alive`缓存,需要匹配组件的`name`和地址保持一致" placement="top">
|
<el-tooltip content="选择是则会被`keep-alive`缓存,需要匹配组件的`name`和地址保持一致" placement="top">
|
||||||
<i class="el-icon-question"></i>
|
<i class="el-icon-question"></i>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
是否缓存
|
是否缓存
|
||||||
</span>
|
</span>
|
||||||
<el-radio-group v-model="form.isCache">
|
<el-radio-group v-model="form.isCache">
|
||||||
<el-radio label="0">缓存</el-radio>
|
<el-radio label="0">缓存</el-radio>
|
||||||
<el-radio label="1">不缓存</el-radio>
|
<el-radio label="1">不缓存</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if="form.menuType != 'F'">
|
<el-col :span="12" v-if="form.menuType != 'F'">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-tooltip content="选择隐藏则路由将不会出现在侧边栏,但仍然可以访问" placement="top">
|
<el-tooltip content="选择隐藏则路由将不会出现在侧边栏,但仍然可以访问" placement="top">
|
||||||
<i class="el-icon-question"></i>
|
<i class="el-icon-question"></i>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
显示状态
|
显示状态
|
||||||
</span>
|
</span>
|
||||||
<el-radio-group v-model="form.visible">
|
<el-radio-group v-model="form.visible">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in dict.type.sys_show_hide"
|
v-for="dict in dict.type.sys_show_hide"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
:label="dict.value"
|
:label="dict.value"
|
||||||
>{{dict.label}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if="form.menuType != 'F'">
|
<el-col :span="12" v-if="form.menuType != 'F'">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-tooltip content="选择停用则路由将不会出现在侧边栏,也不能被访问" placement="top">
|
<el-tooltip content="选择停用则路由将不会出现在侧边栏,也不能被访问" placement="top">
|
||||||
<i class="el-icon-question"></i>
|
<i class="el-icon-question"></i>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
菜单状态
|
菜单状态
|
||||||
</span>
|
</span>
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.status">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in dict.type.sys_normal_disable"
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
:label="dict.value"
|
:label="dict.value"
|
||||||
>{{dict.label}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listMenu, getMenu, delMenu, addMenu, updateMenu } from "@/api/system/menu";
|
import { listMenu, getMenu, delMenu, addMenu, updateMenu } from "@/api/system/menu";
|
||||||
import Treeselect from "@riophae/vue-treeselect";
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
import IconSelect from "@/components/IconSelect";
|
import IconSelect from "@/components/IconSelect";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Menu",
|
name: "Menu",
|
||||||
dicts: ['sys_show_hide', 'sys_normal_disable'],
|
dicts: ['sys_show_hide', 'sys_normal_disable'],
|
||||||
components: { Treeselect, IconSelect },
|
components: { Treeselect, IconSelect },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
// 显示搜索条件
|
// 显示搜索条件
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
// 菜单表格树数据
|
// 菜单表格树数据
|
||||||
menuList: [],
|
menuList: [],
|
||||||
// 菜单树选项
|
// 菜单树选项
|
||||||
menuOptions: [],
|
menuOptions: [],
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
// 是否展开,默认全部折叠
|
// 是否展开,默认全部折叠
|
||||||
isExpandAll: false,
|
isExpandAll: false,
|
||||||
// 重新渲染表格状态
|
// 重新渲染表格状态
|
||||||
refreshTable: true,
|
refreshTable: true,
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
menuName: undefined,
|
menuName: undefined,
|
||||||
visible: undefined
|
visible: undefined
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
menuName: [
|
menuName: [
|
||||||
{ required: true, message: "菜单名称不能为空", trigger: "blur" }
|
{ required: true, message: "菜单名称不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
orderNum: [
|
orderNum: [
|
||||||
{ required: true, message: "菜单顺序不能为空", trigger: "blur" }
|
{ required: true, message: "菜单顺序不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
path: [
|
path: [
|
||||||
{ required: true, message: "路由地址不能为空", trigger: "blur" }
|
{ required: true, message: "路由地址不能为空", trigger: "blur" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 选择图标
|
// 选择图标
|
||||||
selected(name) {
|
selected(name) {
|
||||||
this.form.icon = name;
|
this.form.icon = name;
|
||||||
},
|
},
|
||||||
/** 查询菜单列表 */
|
/** 查询菜单列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listMenu(this.queryParams).then(response => {
|
listMenu(this.queryParams).then(response => {
|
||||||
this.menuList = this.handleTree(response.data, "menuId");
|
this.menuList = this.handleTree(response.data, "menuId");
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 转换菜单数据结构 */
|
/** 转换菜单数据结构 */
|
||||||
normalizer(node) {
|
normalizer(node) {
|
||||||
if (node.children && !node.children.length) {
|
if (node.children && !node.children.length) {
|
||||||
delete node.children;
|
delete node.children;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
id: node.menuId,
|
id: node.menuId,
|
||||||
label: node.menuName,
|
label: node.menuName,
|
||||||
children: node.children
|
children: node.children
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
/** 查询菜单下拉树结构 */
|
/** 查询菜单下拉树结构 */
|
||||||
getTreeselect() {
|
getTreeselect() {
|
||||||
listMenu().then(response => {
|
listMenu().then(response => {
|
||||||
this.menuOptions = [];
|
this.menuOptions = [];
|
||||||
const menu = { menuId: 0, menuName: '主类目', children: [] };
|
const menu = { menuId: 0, menuName: '主类目', children: [] };
|
||||||
menu.children = this.handleTree(response.data, "menuId");
|
menu.children = this.handleTree(response.data, "menuId");
|
||||||
this.menuOptions.push(menu);
|
this.menuOptions.push(menu);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.reset();
|
this.reset();
|
||||||
},
|
},
|
||||||
// 表单重置
|
// 表单重置
|
||||||
reset() {
|
reset() {
|
||||||
this.form = {
|
this.form = {
|
||||||
menuId: undefined,
|
menuId: undefined,
|
||||||
parentId: 0,
|
parentId: 0,
|
||||||
menuName: undefined,
|
menuName: undefined,
|
||||||
icon: undefined,
|
icon: undefined,
|
||||||
menuType: "M",
|
menuType: "M",
|
||||||
orderNum: undefined,
|
orderNum: undefined,
|
||||||
isFrame: "1",
|
isFrame: "1",
|
||||||
isCache: "0",
|
isCache: "0",
|
||||||
visible: "0",
|
visible: "0",
|
||||||
status: "0"
|
status: "0"
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.resetForm("queryForm");
|
this.resetForm("queryForm");
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd(row) {
|
handleAdd(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.getTreeselect();
|
this.getTreeselect();
|
||||||
if (row != null && row.menuId) {
|
if (row != null && row.menuId) {
|
||||||
this.form.parentId = row.menuId;
|
this.form.parentId = row.menuId;
|
||||||
} else {
|
} else {
|
||||||
this.form.parentId = 0;
|
this.form.parentId = 0;
|
||||||
}
|
}
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "添加菜单";
|
this.title = "添加菜单";
|
||||||
},
|
},
|
||||||
/** 展开/折叠操作 */
|
/** 展开/折叠操作 */
|
||||||
toggleExpandAll() {
|
toggleExpandAll() {
|
||||||
this.refreshTable = false;
|
this.refreshTable = false;
|
||||||
this.isExpandAll = !this.isExpandAll;
|
this.isExpandAll = !this.isExpandAll;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.refreshTable = true;
|
this.refreshTable = true;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.getTreeselect();
|
this.getTreeselect();
|
||||||
getMenu(row.menuId).then(response => {
|
getMenu(row.menuId).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改菜单";
|
this.title = "修改菜单";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function() {
|
submitForm: function() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.menuId != undefined) {
|
if (this.form.menuId != undefined) {
|
||||||
updateMenu(this.form).then(response => {
|
updateMenu(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addMenu(this.form).then(response => {
|
addMenu(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
this.$modal.confirm('是否确认删除名称为"' + row.menuName + '"的数据项?').then(function() {
|
this.$modal.confirm('是否确认删除名称为"' + row.menuName + '"的数据项?').then(function() {
|
||||||
return delMenu(row.menuId);
|
return delMenu(row.menuId);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess("删除成功");
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,24 @@
|
||||||
package com.xjs.apitools.controller;
|
package com.xjs.apitools.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.log.annotation.Log;
|
||||||
|
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.xjs.apitools.domain.ApiHoliday;
|
||||||
|
import com.xjs.apitools.service.ApiToolsService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* api小工具控制器
|
* api小工具控制器
|
||||||
|
*
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @since 2022-01-17
|
* @since 2022-01-17
|
||||||
*/
|
*/
|
||||||
|
|
@ -15,4 +27,20 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
@Api(tags = "业务模块-API小工具")
|
@Api(tags = "业务模块-API小工具")
|
||||||
@Log4j2
|
@Log4j2
|
||||||
public class ApiToolsController {
|
public class ApiToolsController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApiToolsService apiToolsService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@ApiOperation("获取节假日信息")
|
||||||
|
@Log(title = "获取节假日")
|
||||||
|
@RequiresPermissions("open:apitools:holiday")
|
||||||
|
public R<List<ApiHoliday>> getHolidayApiData() {
|
||||||
|
List<ApiHoliday> apiHolidayList = apiToolsService.getApiHolidayList();
|
||||||
|
return CollUtil.isNotEmpty(apiHolidayList) ? R.ok(apiHolidayList) : R.fail();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.xjs.apitools.factory;
|
package com.xjs.apitools.factory;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* api工具工厂接口
|
* api工具工厂接口
|
||||||
*
|
*
|
||||||
|
|
@ -15,7 +17,15 @@ public interface ApiToolsFactory<T, R> {
|
||||||
*
|
*
|
||||||
* @return T
|
* @return T
|
||||||
*/
|
*/
|
||||||
default T ApiData() {
|
default T apiData() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取api数据工厂方法 (无参)
|
||||||
|
* @return List<T>
|
||||||
|
*/
|
||||||
|
default List<T> apiDataList() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -25,9 +35,20 @@ public interface ApiToolsFactory<T, R> {
|
||||||
* @param req 请求参数
|
* @param req 请求参数
|
||||||
* @return T
|
* @return T
|
||||||
*/
|
*/
|
||||||
default T ApiData(R req) {
|
default T apiData(R req) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取api数据工厂方法 (有参)
|
||||||
|
*
|
||||||
|
* @param req 请求参数
|
||||||
|
* @return List<T>
|
||||||
|
*/
|
||||||
|
default List<T> apiDataList(R req) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,51 @@
|
||||||
package com.xjs.apitools.factory.impl;
|
package com.xjs.apitools.factory.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.xjs.apitools.domain.ApiHoliday;
|
import com.xjs.apitools.domain.ApiHoliday;
|
||||||
import com.xjs.apitools.factory.ApiToolsFactory;
|
import com.xjs.apitools.factory.ApiToolsFactory;
|
||||||
|
import com.xjs.common.client.api.roll.RollHolidayFeignClient;
|
||||||
import com.xjs.config.RollProperties;
|
import com.xjs.config.RollProperties;
|
||||||
|
import com.xjs.copywriting.domain.RequestBody;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
|
||||||
|
import static com.xjs.consts.ApiConst.ROLL_CODE_SUCCESS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* roll平台获取节假日api工厂实现
|
* roll平台获取节假日api工厂实现
|
||||||
|
*
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @since 2022-01-17
|
* @since 2022-01-17
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@Log4j2
|
@Log4j2
|
||||||
public class RollHolidayFactory implements ApiToolsFactory<ApiHoliday,Object> {
|
public class RollHolidayFactory implements ApiToolsFactory<ApiHoliday, Object> {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RollProperties rollProperties;
|
private RollProperties rollProperties;
|
||||||
|
@Autowired
|
||||||
|
private RollHolidayFeignClient rollHolidayFeignClient;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiHoliday ApiData() {
|
public List<ApiHoliday> apiDataList() {
|
||||||
|
RequestBody requestBody = new RequestBody();
|
||||||
|
requestBody.setApp_id(rollProperties.getApp_id());
|
||||||
|
requestBody.setApp_secret(rollProperties.getApp_secret());
|
||||||
|
JSONObject jsonObject = rollHolidayFeignClient.holidayApi(requestBody);
|
||||||
|
if (!jsonObject.containsKey(DEMOTE_ERROR) && jsonObject.getInteger("code") == ROLL_CODE_SUCCESS.intValue()) {
|
||||||
|
JSONArray jsonArrayData = jsonObject.getJSONArray("data");
|
||||||
|
return jsonArrayData.stream().map(data -> {
|
||||||
|
JSONObject jsonData = (JSONObject) data;
|
||||||
|
return jsonData.toJavaObject(ApiHoliday.class);
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.xjs.apitools.service;
|
||||||
|
|
||||||
|
import com.xjs.apitools.domain.ApiHoliday;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* api工具服务接口
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-01-18
|
||||||
|
*/
|
||||||
|
public interface ApiToolsService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取节假日信息(获取未来节假日,已过的节假日排除)
|
||||||
|
* @return List<ApiHoliday>
|
||||||
|
*/
|
||||||
|
List<ApiHoliday> getApiHolidayList();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.xjs.apitools.service.impl;
|
||||||
|
|
||||||
|
import com.xjs.apitools.domain.ApiHoliday;
|
||||||
|
import com.xjs.apitools.factory.ApiToolsFactory;
|
||||||
|
import com.xjs.apitools.factory.impl.RollHolidayFactory;
|
||||||
|
import com.xjs.apitools.service.ApiToolsService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* api工具服务实现
|
||||||
|
*
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-01-18
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ApiToolsServiceImpl implements ApiToolsService {
|
||||||
|
|
||||||
|
private ApiToolsFactory<ApiHoliday, Object> holidayFactory;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public void setHolidayFactory(RollHolidayFactory rollHolidayFactory) {
|
||||||
|
this.holidayFactory = rollHolidayFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ApiHoliday> getApiHolidayList() {
|
||||||
|
List<ApiHoliday> apiHolidayList = holidayFactory.apiDataList();
|
||||||
|
List<ApiHoliday> collect = apiHolidayList.stream().map(holidayFactory -> {
|
||||||
|
if (holidayFactory.getResidueDays() >= 0) {
|
||||||
|
return holidayFactory;
|
||||||
|
}else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
collect.removeIf(Objects::isNull);
|
||||||
|
return collect;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.xjs.common.client.api.roll;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.xjs.annotation.ApiLog;
|
||||||
|
import com.xjs.common.client.factory.RollHolidayFeignFactory;
|
||||||
|
import com.xjs.copywriting.domain.RequestBody;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.cloud.openfeign.SpringQueryMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
import static com.xjs.consts.ApiConst.ROLL_HOLIDAYS;
|
||||||
|
import static com.xjs.consts.ApiConst.ROLL_HOLIDAYS_URL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* roll节假日api接口feign远程调用
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-01-18
|
||||||
|
*/
|
||||||
|
@FeignClient(name = "rollHoliday", url = ROLL_HOLIDAYS_URL, fallbackFactory = RollHolidayFeignFactory.class)
|
||||||
|
public interface RollHolidayFeignClient {
|
||||||
|
|
||||||
|
@GetMapping()
|
||||||
|
@ApiLog(name = ROLL_HOLIDAYS,
|
||||||
|
url = ROLL_HOLIDAYS_URL,
|
||||||
|
method = "Get")
|
||||||
|
JSONObject holidayApi(@SpringQueryMap RequestBody requestBody);
|
||||||
|
}
|
||||||
|
|
@ -24,6 +24,6 @@ public interface RollIPFeignClient {
|
||||||
@ApiLog(name = ROLL_IP,
|
@ApiLog(name = ROLL_IP,
|
||||||
url = ROLL_IP_URL,
|
url = ROLL_IP_URL,
|
||||||
method = "Get")
|
method = "Get")
|
||||||
JSONObject IpApi(@SpringQueryMap RequestBody requestBody);
|
JSONObject ipApi(@SpringQueryMap RequestBody requestBody);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@ import org.springframework.stereotype.Component;
|
||||||
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
|
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 百度翻译平台服务降级处理类
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @desc 百度翻译平台服务降级处理类
|
* @since 2021-12-28
|
||||||
* @create 2021-12-28
|
|
||||||
*/
|
*/
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@Component
|
@Component
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.xjs.common.client.factory;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.xjs.common.client.api.roll.RollHolidayFeignClient;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* roll节假日api feign 降级
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-01-18
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Log4j2
|
||||||
|
public class RollHolidayFeignFactory implements FallbackFactory<RollHolidayFeignClient> {
|
||||||
|
@Override
|
||||||
|
public RollHolidayFeignClient create(Throwable cause) {
|
||||||
|
log.error("api模块roll 节假日服务调用失败:{},执行降级处理", cause.getMessage());
|
||||||
|
return requestBody -> {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put(DEMOTE_ERROR, R.FAIL);
|
||||||
|
return jsonObject;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -7,8 +7,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @desc 删除重复文案数据
|
* @desc 删除重复文案数据
|
||||||
|
|
@ -37,7 +35,7 @@ public class DeleteRepeatTask {
|
||||||
* 2022-01-07 09:00:00
|
* 2022-01-07 09:00:00
|
||||||
* 2022-01-07 10:00:00
|
* 2022-01-07 10:00:00
|
||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0 7-23 * * ? ")
|
@Scheduled(cron = "0 0 10,14,20 * * ? ")
|
||||||
public void execute() {
|
public void execute() {
|
||||||
int copyWritingCount = copyWritingService.deleteRepeatData();
|
int copyWritingCount = copyWritingService.deleteRepeatData();
|
||||||
log.info("thread id:{},定时清除文案重复数据,重复数:{}", Thread.currentThread().getId(),copyWritingCount);
|
log.info("thread id:{},定时清除文案重复数据,重复数:{}", Thread.currentThread().getId(),copyWritingCount);
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ public class RollIPFactory implements IPFactory<IPInfoVo> {
|
||||||
requestBody.setIp(ip);
|
requestBody.setIp(ip);
|
||||||
requestBody.setApp_id(rollProperties.getApp_id());
|
requestBody.setApp_id(rollProperties.getApp_id());
|
||||||
requestBody.setApp_secret(rollProperties.getApp_secret());
|
requestBody.setApp_secret(rollProperties.getApp_secret());
|
||||||
JSONObject jsonObject = rollIPFeignClient.IpApi(requestBody);
|
JSONObject jsonObject = rollIPFeignClient.ipApi(requestBody);
|
||||||
if (!jsonObject.containsKey(DEMOTE_ERROR) && jsonObject.getInteger("code") == ROLL_CODE_SUCCESS.intValue()) {
|
if (!jsonObject.containsKey(DEMOTE_ERROR) && jsonObject.getInteger("code") == ROLL_CODE_SUCCESS.intValue()) {
|
||||||
JSONObject data = jsonObject.getJSONObject("data");
|
JSONObject data = jsonObject.getJSONObject("data");
|
||||||
return data.toJavaObject(IPInfoVo.class);
|
return data.toJavaObject(IPInfoVo.class);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue