Merge remote-tracking branch 'origin/seedance_balance' into seedance_balance
# Conflicts: # admin-ui/src/views/ai/record/index.vue
This commit is contained in:
commit
bbcc14a395
|
|
@ -9,36 +9,10 @@ export function listOrder(query) {
|
|||
})
|
||||
}
|
||||
|
||||
// 查询团队(部门)充值退款订单详细
|
||||
// 查询团队(部门)充值退款订单详细(只读)
|
||||
export function getOrder(id) {
|
||||
return request({
|
||||
url: '/ai/order/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增团队(部门)充值退款订单
|
||||
export function addOrder(data) {
|
||||
return request({
|
||||
url: '/ai/order',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改团队(部门)充值退款订单
|
||||
export function updateOrder(data) {
|
||||
return request({
|
||||
url: '/ai/order',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除团队(部门)充值退款订单
|
||||
export function delOrder(id) {
|
||||
return request({
|
||||
url: '/ai/order/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,36 +9,10 @@ export function listRecord(query) {
|
|||
})
|
||||
}
|
||||
|
||||
// 查询团队(部门)余额变动详细
|
||||
// 查询团队(部门)余额变动详细(只读)
|
||||
export function getRecord(id) {
|
||||
return request({
|
||||
url: '/ai/record/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增团队(部门)余额变动
|
||||
export function addRecord(data) {
|
||||
return request({
|
||||
url: '/ai/record',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改团队(部门)余额变动
|
||||
export function updateRecord(data) {
|
||||
return request({
|
||||
url: '/ai/record',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除团队(部门)余额变动
|
||||
export function delRecord(id) {
|
||||
return request({
|
||||
url: '/ai/record/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@
|
|||
</el-row>
|
||||
<el-row v-if="isSecondLevelCompanyForm">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="Byte API Key">
|
||||
<el-form-item label="ApiKey">
|
||||
<el-input
|
||||
v-model="form.byteApiKey"
|
||||
type="password"
|
||||
|
|
|
|||
|
|
@ -21,38 +21,6 @@
|
|||
</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="['ai:order: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="['ai:order: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="['ai:order:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
|
|
@ -66,8 +34,7 @@
|
|||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="orderList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table v-loading="loading" :data="orderList">
|
||||
<el-table-column label="ID" align="center" prop="id" width="72" />
|
||||
<el-table-column label="团队名称" align="center" prop="deptName" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column label="类型" align="center" width="100">
|
||||
|
|
@ -83,24 +50,6 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['ai:order:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['ai:order:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
|
|
@ -110,94 +59,33 @@
|
|||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<el-dialog :title="title" :visible.sync="open" width="560px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="团队" prop="deptId">
|
||||
<treeselect
|
||||
v-model="form.deptId"
|
||||
:options="deptOptions"
|
||||
:normalizer="normalizer"
|
||||
:show-count="true"
|
||||
placeholder="请选择团队(二级部门)"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="orderType">
|
||||
<el-select v-model="form.orderType" placeholder="请选择" style="width: 100%">
|
||||
<el-option v-for="item in orderTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="金额(元)" prop="money">
|
||||
<el-input v-model="form.money" placeholder="可选,对账用金额" />
|
||||
</el-form-item>
|
||||
<el-form-item label="积分" prop="amount">
|
||||
<el-input v-model="form.amount" placeholder="充值/退款填正数;手动修改可填负数表示扣减" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="form.status" placeholder="请选择" style="width: 100%">
|
||||
<el-option label="进行中" :value="0" />
|
||||
<el-option label="已完成" :value="1" />
|
||||
<el-option label="失败" :value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单编号" prop="orderNum" v-if="form.id != null">
|
||||
<el-input v-model="form.orderNum" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" :rows="3" placeholder="对账说明、打款信息等" maxlength="500" show-word-limit />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listOrder, getOrder, delOrder, addOrder, updateOrder } from "@/api/ai/order"
|
||||
import { deptTreeSelect } from "@/api/system/user"
|
||||
import Treeselect from "@riophae/vue-treeselect"
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css"
|
||||
import { listOrder } from "@/api/ai/order"
|
||||
|
||||
export default {
|
||||
name: "TeamChargeOrder",
|
||||
components: { Treeselect },
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
ids: [],
|
||||
single: true,
|
||||
multiple: true,
|
||||
showSearch: true,
|
||||
total: 0,
|
||||
orderList: [],
|
||||
title: "",
|
||||
open: false,
|
||||
deptOptions: [],
|
||||
orderTypeOptions: [
|
||||
{ label: "充值", value: 0 },
|
||||
{ label: "退款", value: 1 },
|
||||
{ label: "手动修改", value: 2 }
|
||||
{ label: "退款", value: 1 }
|
||||
],
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
deptName: null,
|
||||
orderType: null
|
||||
},
|
||||
form: {},
|
||||
rules: {
|
||||
deptId: [{ required: true, message: "请选择团队", trigger: "change" }],
|
||||
orderType: [{ required: true, message: "请选择类型", trigger: "change" }],
|
||||
amount: [{ required: true, message: "请填写积分", trigger: "blur" }],
|
||||
status: [{ required: true, message: "请选择状态", trigger: "change" }]
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getDeptTree()
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -206,21 +94,6 @@ export default {
|
|||
const hit = this.orderTypeOptions.find(o => o.value === n)
|
||||
return hit ? hit.label : "—"
|
||||
},
|
||||
getDeptTree() {
|
||||
deptTreeSelect().then(response => {
|
||||
this.deptOptions = response.data || []
|
||||
})
|
||||
},
|
||||
normalizer(node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children
|
||||
}
|
||||
return {
|
||||
id: node.id,
|
||||
label: node.label,
|
||||
children: node.children
|
||||
}
|
||||
},
|
||||
getList() {
|
||||
this.loading = true
|
||||
listOrder(this.queryParams).then(response => {
|
||||
|
|
@ -229,23 +102,6 @@ export default {
|
|||
this.loading = false
|
||||
})
|
||||
},
|
||||
cancel() {
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
deptId: undefined,
|
||||
orderType: 0,
|
||||
money: undefined,
|
||||
amount: undefined,
|
||||
remark: undefined,
|
||||
status: 1,
|
||||
orderNum: undefined
|
||||
}
|
||||
this.resetForm("form")
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
|
|
@ -254,53 +110,6 @@ export default {
|
|||
this.resetForm("queryForm")
|
||||
this.handleQuery()
|
||||
},
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
handleAdd() {
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = "新增团队订单"
|
||||
},
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
const id = row.id || this.ids[0]
|
||||
getOrder(id).then(response => {
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.title = "修改团队订单"
|
||||
})
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
const payload = { ...this.form }
|
||||
if (payload.id == null) {
|
||||
addOrder(payload).then(() => {
|
||||
this.$modal.msgSuccess("新增成功")
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
updateOrder(payload).then(() => {
|
||||
this.$modal.msgSuccess("修改成功")
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids
|
||||
this.$modal.confirm("是否确认删除所选团队订单?").then(() => delOrder(ids)).then(() => {
|
||||
this.getList()
|
||||
this.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
},
|
||||
handleExport() {
|
||||
this.download("ai/order/export", { ...this.queryParams }, `team_orders_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,37 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="88px">
|
||||
<el-form-item label="团队名称" prop="deptName">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="订单号" prop="relationOrderNo">
|
||||
<el-input
|
||||
v-model="queryParams.deptName"
|
||||
placeholder="支持模糊搜索"
|
||||
v-model="queryParams.relationOrderNo"
|
||||
placeholder="请输入关联(充值/退款)订单号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="orderType">
|
||||
<el-select v-model="queryParams.orderType" placeholder="全部" clearable style="width: 140px">
|
||||
<el-option v-for="item in orderTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
<el-form-item label="部门ID" prop="deptId">
|
||||
<el-input
|
||||
v-model="queryParams.deptId"
|
||||
placeholder="请输入部门ID"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="变更金额" prop="changeAmount">
|
||||
<el-input
|
||||
v-model="queryParams.changeAmount"
|
||||
placeholder="请输入变更金额"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="变更后金额" prop="resultAmount">
|
||||
<el-input
|
||||
v-model="queryParams.resultAmount"
|
||||
placeholder="请输入变更后金额"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
|
|
@ -21,7 +40,6 @@
|
|||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
|
|
@ -29,29 +47,25 @@
|
|||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['ai:order:export']"
|
||||
v-hasPermi="['ai:record:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" />
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="ID" align="center" prop="id" width="72" />
|
||||
<el-table-column label="团队名称" align="center" prop="deptName" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column label="类型" align="center" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ orderTypeLabel(scope.row.orderType) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="金额(元)" align="center" prop="money" width="100" />
|
||||
<el-table-column label="积分" align="center" prop="amount" width="100" />
|
||||
<el-table-column label="时间" align="center" prop="createTime" width="160">
|
||||
<el-table v-loading="loading" :data="recordList">
|
||||
<el-table-column label="ID" align="center" prop="id" />
|
||||
<el-table-column label="订单号" align="center" prop="relationOrderNo" />
|
||||
<el-table-column label="部门ID" align="center" prop="deptId" />
|
||||
<el-table-column label="操作类型" align="center" prop="type" />
|
||||
<el-table-column label="变更金额" align="center" prop="changeAmount" />
|
||||
<el-table-column label="变更后金额" align="center" prop="resultAmount" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" min-width="140" show-overflow-tooltip />
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
|
|
@ -61,199 +75,55 @@
|
|||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<el-dialog :title="title" :visible.sync="open" width="560px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="团队ID" prop="deptId">
|
||||
<el-input v-model="form.deptId" placeholder="请输入团队ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="orderType">
|
||||
<el-select v-model="form.orderType" placeholder="请选择" style="width: 100%">
|
||||
<el-option v-for="item in orderTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="金额(元)" prop="money">
|
||||
<el-input v-model="form.money" placeholder="可选,对账用金额" />
|
||||
</el-form-item>
|
||||
<el-form-item label="积分" prop="amount">
|
||||
<el-input v-model="form.amount" placeholder="充值/退款填正数;手动修改可填负数表示扣减" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="form.status" placeholder="请选择" style="width: 100%">
|
||||
<el-option label="进行中" :value="0" />
|
||||
<el-option label="已完成" :value="1" />
|
||||
<el-option label="失败" :value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单编号" prop="orderNum" v-if="form.id != null">
|
||||
<el-input v-model="form.orderNum" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" :rows="3" placeholder="对账说明、打款信息等" maxlength="500" show-word-limit />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listGroupChargeOrder, getGroupChargeOrder, delGroupChargeOrder, addGroupChargeOrder, updateGroupChargeOrder } from "@/api/ai/groupChargeOrder"
|
||||
import { listRecord } from "@/api/ai/record"
|
||||
|
||||
export default {
|
||||
name: "Record",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 团队订单表格数据
|
||||
recordList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
deptName: null,
|
||||
orderType: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
deptId: [{ required: true, message: "请输入团队ID", trigger: "blur" }],
|
||||
orderType: [{ required: true, message: "请选择类型", trigger: "change" }],
|
||||
amount: [{ required: true, message: "请填写积分", trigger: "blur" }],
|
||||
status: [{ required: true, message: "请选择状态", trigger: "change" }]
|
||||
},
|
||||
orderTypeOptions: [
|
||||
{ label: "充值", value: 0 },
|
||||
{ label: "退款", value: 1 },
|
||||
{ label: "手动修改", value: 2 }
|
||||
]
|
||||
relationOrderNo: null,
|
||||
deptId: null,
|
||||
type: null,
|
||||
changeAmount: null,
|
||||
resultAmount: null
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
orderTypeLabel(orderType) {
|
||||
const n = orderType !== undefined && orderType !== null ? Number(orderType) : null
|
||||
const hit = this.orderTypeOptions.find(o => o.value === n)
|
||||
return hit ? hit.label : "—"
|
||||
},
|
||||
/** 查询团队订单列表 */
|
||||
getList() {
|
||||
this.loading = true
|
||||
listGroupChargeOrder(this.queryParams).then(response => {
|
||||
listRecord(this.queryParams).then(response => {
|
||||
this.recordList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
deptId: undefined,
|
||||
orderType: 0,
|
||||
money: undefined,
|
||||
amount: undefined,
|
||||
remark: undefined,
|
||||
status: 1,
|
||||
orderNum: 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.id)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = "新增团队订单"
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
const id = row.id || this.ids[0]
|
||||
getGroupChargeOrder(id).then(response => {
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.title = "修改团队订单"
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
const payload = { ...this.form }
|
||||
if (payload.id == null) {
|
||||
addGroupChargeOrder(payload).then(() => {
|
||||
this.$modal.msgSuccess("新增成功")
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
updateGroupChargeOrder(payload).then(() => {
|
||||
this.$modal.msgSuccess("修改成功")
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids
|
||||
this.$modal.confirm("是否确认删除所选团队订单?").then(() => {
|
||||
return delGroupChargeOrder(ids)
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
this.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download("ai/group/chargeorder/export", {
|
||||
this.download('ai/record/export', {
|
||||
...this.queryParams
|
||||
}, `team_orders_${new Date().getTime()}.xlsx`)
|
||||
}, `record_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -239,8 +239,11 @@
|
|||
placeholder="请选择生日"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="余额" prop="balance">
|
||||
<el-input v-model="form.balance" placeholder="请输入余额" />
|
||||
<el-form-item v-if="form.id != null" label="余额" prop="balance">
|
||||
<el-input v-model="form.balance" disabled placeholder="-" />
|
||||
<div style="color: #909399; font-size: 12px; line-height: 1.5; margin-top: 4px">
|
||||
余额仅可通过「下放积分」「回收积分」调整
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
|
|
@ -689,7 +692,9 @@ export default {
|
|||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addUser(this.form).then(() => {
|
||||
const payload = { ...this.form };
|
||||
delete payload.balance;
|
||||
addUser(payload).then(() => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
|
|
|
|||
|
|
@ -53,6 +53,11 @@
|
|||
<span>{{ scope.row.maxUserCount != null && scope.row.maxUserCount > 0 ? scope.row.maxUserCount : '不限制' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="balance" label="剩余积分" width="120" align="right">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.balance != null ? scope.row.balance : '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" label="状态" width="100">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||
|
|
@ -63,7 +68,7 @@
|
|||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<el-table-column label="操作" align="center" width="480" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
v-if="isFirstLevelRow(scope.row) || isSecondLevelRow(scope.row)"
|
||||
|
|
@ -72,7 +77,23 @@
|
|||
icon="el-icon-setting"
|
||||
@click="handleArkConfig(scope.row)"
|
||||
v-hasPermi="['system:dept:query', 'system:dept:edit']"
|
||||
>火山配置</el-button>
|
||||
>火山引擎</el-button>
|
||||
<el-button
|
||||
v-if="isFirstLevelRow(scope.row) || isSecondLevelRow(scope.row)"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-wallet"
|
||||
@click="handleChargeRefund(scope.row)"
|
||||
v-hasPermi="['system:dept:chargeRefund']"
|
||||
>充值/退款</el-button>
|
||||
<el-button
|
||||
v-if="isFirstLevelRow(scope.row) || isSecondLevelRow(scope.row)"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-s-operation"
|
||||
@click="handleEditScore(scope.row)"
|
||||
v-hasPermi="['system:dept:chargeRefund']"
|
||||
>积分更正</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
|
|
@ -179,11 +200,11 @@
|
|||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="火山配置" :visible.sync="arkOpen" width="800px" append-to-body @close="resetArkForm">
|
||||
<el-dialog title="火山引擎" :visible.sync="arkOpen" width="800px" append-to-body @close="resetArkForm">
|
||||
<el-form ref="arkFormRef" :model="arkForm" label-width="120px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="Byte API Key">
|
||||
<el-form-item label="ApiKey">
|
||||
<el-input
|
||||
v-model="arkForm.byteApiKey"
|
||||
type="password"
|
||||
|
|
@ -196,7 +217,7 @@
|
|||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="火山配置项目">
|
||||
<el-form-item label="火山项目">
|
||||
<el-input
|
||||
v-model="arkForm.project"
|
||||
type="password"
|
||||
|
|
@ -248,6 +269,91 @@
|
|||
<el-button @click="arkOpen = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
:title="'充值/退款 — ' + (chargeRefundForm.deptName || '')"
|
||||
:visible.sync="chargeRefundOpen"
|
||||
width="520px"
|
||||
append-to-body
|
||||
@close="resetChargeRefund"
|
||||
>
|
||||
<el-form ref="chargeRefundFormRef" :model="chargeRefundForm" :rules="chargeRefundRules" label-width="88px">
|
||||
<el-form-item label="类型" prop="orderType">
|
||||
<el-radio-group v-model="chargeRefundForm.orderType">
|
||||
<el-radio :label="0">充值</el-radio>
|
||||
<el-radio :label="1">退款</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="金额" prop="money">
|
||||
<el-input
|
||||
:value="chargeRefundMoneyDisplay"
|
||||
placeholder="财务记录(元),如 9,999,999.00"
|
||||
clearable
|
||||
@input="onChargeRefundMoneyInput"
|
||||
@blur="onChargeRefundMoneyBlur"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="积分" prop="amount">
|
||||
<el-input
|
||||
:value="chargeRefundAmountDisplay"
|
||||
placeholder="变动积分,如 99,999,999"
|
||||
clearable
|
||||
@input="onChargeRefundAmountInput"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="chargeRefundForm.remark"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
placeholder="选填,最多50字"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitChargeRefund">确 定</el-button>
|
||||
<el-button @click="chargeRefundOpen = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog
|
||||
:title="'积分更正 — ' + (editScoreForm.deptName || '')"
|
||||
:visible.sync="editScoreOpen"
|
||||
width="520px"
|
||||
append-to-body
|
||||
@close="resetEditScore"
|
||||
>
|
||||
<el-form ref="editScoreFormRef" :model="editScoreForm" :rules="editScoreRules" label-width="88px">
|
||||
<el-form-item label="积分" prop="score">
|
||||
<el-input-number
|
||||
v-model="editScoreForm.score"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
:min="-100000000"
|
||||
:max="100000000"
|
||||
controls-position="right"
|
||||
class="edit-score-input-number"
|
||||
placeholder="正数增加,负数扣减,不能为0"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="editScoreForm.remark"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
placeholder="必填,最多50字"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitEditScore">确 定</el-button>
|
||||
<el-button @click="editScoreOpen = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -279,10 +385,23 @@
|
|||
color: #e6a23c;
|
||||
font-size: 12px;
|
||||
}
|
||||
.edit-score-input-number {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild, getDeptArk, updateDeptArk } from "@/api/system/dept"
|
||||
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild, getDeptArk, updateDeptArk, chargeRefundDept, editScore } from "@/api/system/dept"
|
||||
import {
|
||||
WESTERN_MONEY_MAX,
|
||||
sanitizeMoneyDigits,
|
||||
formatMoneyWesternDisplay,
|
||||
moneyStringToNumber,
|
||||
formatMoneyWesternFinal,
|
||||
sanitizeIntDigits,
|
||||
formatIntWesternDisplay,
|
||||
intStringToNumber
|
||||
} from "@/utils/westernNumberFormat"
|
||||
import Treeselect from "@riophae/vue-treeselect"
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css"
|
||||
|
||||
|
|
@ -312,6 +431,75 @@ export default {
|
|||
modelParm: undefined
|
||||
},
|
||||
arkModelParamRows: [{ label: '', value: '' }],
|
||||
chargeRefundOpen: false,
|
||||
chargeRefundMoneyDisplay: "",
|
||||
chargeRefundAmountDisplay: "",
|
||||
chargeRefundForm: {
|
||||
deptId: undefined,
|
||||
deptName: "",
|
||||
orderType: 0,
|
||||
money: undefined,
|
||||
amount: undefined,
|
||||
remark: ""
|
||||
},
|
||||
chargeRefundRules: {
|
||||
orderType: [
|
||||
{ required: true, message: "类型不能为空", trigger: "change" }
|
||||
],
|
||||
money: [
|
||||
{ required: true, message: "金额不能为空", trigger: "blur" },
|
||||
{ type: "number", min: 0, max: 10000000, message: "金额须在 0~10000000 之间", trigger: "blur" }
|
||||
],
|
||||
amount: [
|
||||
{ required: true, message: "积分不能为空", trigger: "blur" },
|
||||
{ type: "number", min: 1, max: 100000000, message: "积分须在 1~100000000 之间", trigger: "blur" }
|
||||
],
|
||||
remark: [
|
||||
{ max: 50, message: "备注不能超过50个字符", trigger: "blur" }
|
||||
]
|
||||
},
|
||||
editScoreOpen: false,
|
||||
editScoreForm: {
|
||||
deptId: undefined,
|
||||
deptName: "",
|
||||
score: undefined,
|
||||
remark: ""
|
||||
},
|
||||
editScoreRules: {
|
||||
score: [
|
||||
{ required: true, message: "积分不能为空", trigger: "blur" },
|
||||
{
|
||||
validator(rule, value, callback) {
|
||||
if (value === undefined || value === null || value === "") {
|
||||
callback(new Error("积分不能为空"))
|
||||
} else if (!Number.isInteger(Number(value))) {
|
||||
callback(new Error("积分须为整数"))
|
||||
} else if (Number(value) === 0) {
|
||||
callback(new Error("积分不能为0"))
|
||||
} else if (Number(value) < -100000000 || Number(value) > 100000000) {
|
||||
callback(new Error("积分须在 -100000000~100000000 之间(不含0)"))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
trigger: "blur"
|
||||
}
|
||||
],
|
||||
remark: [
|
||||
{ required: true, message: "备注不能为空", trigger: "blur" },
|
||||
{
|
||||
validator(rule, value, callback) {
|
||||
if (!value || String(value).trim() === "") {
|
||||
callback(new Error("备注不能为空"))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
trigger: "blur"
|
||||
},
|
||||
{ max: 50, message: "备注不能超过50个字符", trigger: "blur" }
|
||||
]
|
||||
},
|
||||
// 是否展开,默认全部展开
|
||||
isExpandAll: true,
|
||||
// 重新渲染表格状态
|
||||
|
|
@ -443,6 +631,138 @@ export default {
|
|||
this.arkOpen = true
|
||||
})
|
||||
},
|
||||
resetChargeRefund() {
|
||||
this.chargeRefundMoneyDisplay = ""
|
||||
this.chargeRefundAmountDisplay = ""
|
||||
this.chargeRefundForm = {
|
||||
deptId: undefined,
|
||||
deptName: "",
|
||||
orderType: 0,
|
||||
money: undefined,
|
||||
amount: undefined,
|
||||
remark: ""
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.chargeRefundFormRef) {
|
||||
this.$refs.chargeRefundFormRef.clearValidate()
|
||||
}
|
||||
})
|
||||
},
|
||||
handleChargeRefund(row) {
|
||||
if (!this.isFirstLevelRow(row) && !this.isSecondLevelRow(row)) {
|
||||
return
|
||||
}
|
||||
this.chargeRefundMoneyDisplay = ""
|
||||
this.chargeRefundAmountDisplay = ""
|
||||
this.chargeRefundForm = {
|
||||
deptId: row.deptId,
|
||||
deptName: row.deptName,
|
||||
orderType: 0,
|
||||
money: undefined,
|
||||
amount: undefined,
|
||||
remark: ""
|
||||
}
|
||||
this.chargeRefundOpen = true
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.chargeRefundFormRef) {
|
||||
this.$refs.chargeRefundFormRef.clearValidate()
|
||||
}
|
||||
})
|
||||
},
|
||||
onChargeRefundMoneyInput(val) {
|
||||
const sanitized = sanitizeMoneyDigits(val)
|
||||
if (!sanitized) {
|
||||
this.chargeRefundMoneyDisplay = ""
|
||||
this.chargeRefundForm.money = undefined
|
||||
return
|
||||
}
|
||||
const raw = parseFloat(sanitized)
|
||||
if (!isNaN(raw) && raw > WESTERN_MONEY_MAX) {
|
||||
this.chargeRefundForm.money = WESTERN_MONEY_MAX
|
||||
this.chargeRefundMoneyDisplay = formatMoneyWesternFinal(WESTERN_MONEY_MAX)
|
||||
return
|
||||
}
|
||||
this.chargeRefundMoneyDisplay = formatMoneyWesternDisplay(sanitized)
|
||||
this.chargeRefundForm.money = moneyStringToNumber(sanitized)
|
||||
},
|
||||
onChargeRefundMoneyBlur() {
|
||||
if (this.chargeRefundForm.money !== undefined && this.chargeRefundForm.money !== null) {
|
||||
this.chargeRefundMoneyDisplay = formatMoneyWesternFinal(this.chargeRefundForm.money)
|
||||
}
|
||||
},
|
||||
onChargeRefundAmountInput(val) {
|
||||
const digits = sanitizeIntDigits(val)
|
||||
this.chargeRefundAmountDisplay = digits === "" ? "" : formatIntWesternDisplay(digits)
|
||||
this.chargeRefundForm.amount = intStringToNumber(digits)
|
||||
},
|
||||
submitChargeRefund() {
|
||||
this.onChargeRefundMoneyBlur()
|
||||
this.$refs["chargeRefundFormRef"].validate(valid => {
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
const data = {
|
||||
deptId: this.chargeRefundForm.deptId,
|
||||
orderType: this.chargeRefundForm.orderType,
|
||||
money: this.chargeRefundForm.money,
|
||||
amount: this.chargeRefundForm.amount,
|
||||
remark: this.chargeRefundForm.remark ? this.chargeRefundForm.remark.trim() : undefined
|
||||
}
|
||||
chargeRefundDept(data).then(() => {
|
||||
this.$modal.msgSuccess("操作成功")
|
||||
this.chargeRefundOpen = false
|
||||
this.getList()
|
||||
})
|
||||
})
|
||||
},
|
||||
resetEditScore() {
|
||||
this.editScoreForm = {
|
||||
deptId: undefined,
|
||||
deptName: "",
|
||||
score: undefined,
|
||||
remark: ""
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.editScoreFormRef) {
|
||||
this.$refs.editScoreFormRef.clearValidate()
|
||||
}
|
||||
})
|
||||
},
|
||||
handleEditScore(row) {
|
||||
if (!this.isFirstLevelRow(row) && !this.isSecondLevelRow(row)) {
|
||||
return
|
||||
}
|
||||
this.editScoreForm = {
|
||||
deptId: row.deptId,
|
||||
deptName: row.deptName,
|
||||
score: undefined,
|
||||
remark: ""
|
||||
}
|
||||
this.editScoreOpen = true
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.editScoreFormRef) {
|
||||
this.$refs.editScoreFormRef.clearValidate()
|
||||
}
|
||||
})
|
||||
},
|
||||
submitEditScore() {
|
||||
this.$refs["editScoreFormRef"].validate(valid => {
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
const remark = (this.editScoreForm.remark || "").trim()
|
||||
const data = {
|
||||
deptId: this.editScoreForm.deptId,
|
||||
score: this.editScoreForm.score,
|
||||
remark: remark
|
||||
}
|
||||
editScore(data).then(() => {
|
||||
this.$modal.msgSuccess("操作成功")
|
||||
this.editScoreOpen = false
|
||||
this.getList()
|
||||
})
|
||||
})
|
||||
},
|
||||
submitArkForm() {
|
||||
this.buildArkModelParmPayload()
|
||||
const payload = {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
|
|
@ -68,37 +65,4 @@ public class AiChargeRefundOrderController extends BaseController
|
|||
{
|
||||
return success(aiChargeRefundOrderService.selectAiChargeRefundOrderById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增团队(部门)充值退款订单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ai:order:add')")
|
||||
@Log(title = "团队(部门)充值退款订单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AiChargeRefundOrder aiChargeRefundOrder)
|
||||
{
|
||||
return toAjax(aiChargeRefundOrderService.insertAiChargeRefundOrder(aiChargeRefundOrder));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改团队(部门)充值退款订单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ai:order:edit')")
|
||||
@Log(title = "团队(部门)充值退款订单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AiChargeRefundOrder aiChargeRefundOrder)
|
||||
{
|
||||
return toAjax(aiChargeRefundOrderService.updateAiChargeRefundOrder(aiChargeRefundOrder));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除团队(部门)充值退款订单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ai:order:remove')")
|
||||
@Log(title = "团队(部门)充值退款订单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(aiChargeRefundOrderService.deleteAiChargeRefundOrderByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,10 +6,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
|
|
@ -64,41 +61,8 @@ public class AiGroupBalanceChangeRecordController extends BaseController
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ai:record:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(aiGroupBalanceChangeRecordService.selectAiGroupBalanceChangeRecordById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增团队(部门)余额变动
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ai:record:add')")
|
||||
@Log(title = "团队(部门)余额变动", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AiGroupBalanceChangeRecord aiGroupBalanceChangeRecord)
|
||||
{
|
||||
return toAjax(aiGroupBalanceChangeRecordService.insertAiGroupBalanceChangeRecord(aiGroupBalanceChangeRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改团队(部门)余额变动
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ai:record:edit')")
|
||||
@Log(title = "团队(部门)余额变动", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AiGroupBalanceChangeRecord aiGroupBalanceChangeRecord)
|
||||
{
|
||||
return toAjax(aiGroupBalanceChangeRecordService.updateAiGroupBalanceChangeRecord(aiGroupBalanceChangeRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除团队(部门)余额变动
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ai:record:remove')")
|
||||
@Log(title = "团队(部门)余额变动", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
return toAjax(aiGroupBalanceChangeRecordService.deleteAiGroupBalanceChangeRecordByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class SubteamGroupBalanceController extends BaseController {
|
|||
|
||||
@PreAuthorize("@ss.hasPermi('subteam:groupBalance:query')")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult getInfo(@PathVariable String id) {
|
||||
public AjaxResult getInfo(@PathVariable Long id) {
|
||||
subteamScopeService.assertGroupBalanceRecordBelongsToTeam(id);
|
||||
return success(aiGroupBalanceChangeRecordService.selectAiGroupBalanceChangeRecordById(id));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,17 @@
|
|||
package com.ruoyi.ai.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.math.BigDecimal;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import lombok.Data;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 团队(部门)充值退款订单对象 ai_charge_refund_order
|
||||
|
|
@ -17,7 +21,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
|||
*/
|
||||
@Data
|
||||
@TableName("ai_charge_refund_order")
|
||||
public class AiChargeRefundOrder extends BaseEntity {
|
||||
public class AiChargeRefundOrder implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
|
@ -28,11 +32,22 @@ public class AiChargeRefundOrder extends BaseEntity {
|
|||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 创建者用户ID(sys_user.user_id) */
|
||||
private Long createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/** 订单编号 */
|
||||
@Excel(name = "订单编号")
|
||||
private String orderNum;
|
||||
|
||||
/** 第三方单号(预留) */
|
||||
/** 第三方单号(预留) */
|
||||
@Excel(name = "第三方单号(预留)")
|
||||
private String thirdPartyOrderNum;
|
||||
|
||||
|
|
@ -45,23 +60,25 @@ public class AiChargeRefundOrder extends BaseEntity {
|
|||
@Excel(name = "团队名称")
|
||||
private String deptName;
|
||||
|
||||
/** 订单类型(0-充值;1-退款;2-手动修改) */
|
||||
@Excel(name = "订单类型", readConverterExp = "0=充值,1=退款,2=手动修改")
|
||||
private Long orderType;
|
||||
/** 订单类型(0-充值;1-退款) */
|
||||
@Excel(name = "订单类型", readConverterExp = "0=充值,1=退款")
|
||||
private Integer orderType;
|
||||
|
||||
/** 金额(元) */
|
||||
@Excel(name = "金额(元)")
|
||||
/** 充值金额(元) */
|
||||
@Excel(name = "充值金额")
|
||||
private BigDecimal money;
|
||||
|
||||
/**
|
||||
* 积分变动:充值/退款为绝对值(退款在统计中按负数计入);
|
||||
* 手动修改可为正(增加)或负(扣减)。
|
||||
* 积分,均为正数,通过订单类型判断是加还是减
|
||||
*/
|
||||
@Excel(name = "积分")
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
/** 状态:0-进行中 1-已完成 2-失败 */
|
||||
@Excel(name = "状态", readConverterExp = "0=进行中,1=已完成,2=失败")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@ package com.ruoyi.ai.domain;
|
|||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 团队(部门)对应火山引擎配置对象 ai_dept_ark_config
|
||||
|
|
@ -17,28 +17,36 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
|||
*/
|
||||
@Data
|
||||
@TableName("ai_dept_ark_config")
|
||||
public class AiDeptArkConfig extends BaseEntity {
|
||||
public class AiDeptArkConfig implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 部门ID */
|
||||
@Excel(name = "部门ID")
|
||||
private Long deptId;
|
||||
|
||||
/** 视频模型列表JSON(label+value) */
|
||||
@Excel(name = "视频模型列表JSON(label+value)")
|
||||
private String modelParm;
|
||||
|
||||
/** Byte project,加密 */
|
||||
@Excel(name = "Byte project,加密")
|
||||
private String project;
|
||||
|
||||
/** Byte API Key,加密 */
|
||||
@Excel(name = "Byte API Key,加密")
|
||||
private String byteApiKey;
|
||||
|
||||
/** 创建者(与表 create_by BIGINT 一致) */
|
||||
private Long createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/** 更新者(与表 update_by BIGINT 一致) */
|
||||
private Long updateBy;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
package com.ruoyi.ai.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 团队(部门)余额变动对象 ai_group_balance_change_record
|
||||
|
|
@ -18,15 +19,15 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
|||
*/
|
||||
@Data
|
||||
@TableName("ai_group_balance_change_record")
|
||||
public class AiGroupBalanceChangeRecord extends BaseEntity {
|
||||
public class AiGroupBalanceChangeRecord implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
/** 主键ID */
|
||||
@TableId(type = IdType.AUTO)
|
||||
private String id;
|
||||
private Long id;
|
||||
|
||||
/** 关联(充值/退款)订单号 */
|
||||
/** 关联(充值/退款)订单号 */
|
||||
@Excel(name = "关联(充值/退款)订单号")
|
||||
private String relationOrderNo;
|
||||
|
||||
|
|
@ -34,9 +35,11 @@ public class AiGroupBalanceChangeRecord extends BaseEntity {
|
|||
@Excel(name = "部门ID")
|
||||
private Long deptId;
|
||||
|
||||
/** 操作类型(0-充值、1-退款、2-下发、3-回收、4-手动修改) */
|
||||
@Excel(name = "操作类型", readConverterExp = "0=-充值、1-退款、2-下发、3-回收、4-手动修改")
|
||||
private Long type;
|
||||
/**
|
||||
* 操作类型(0-充值,1-退款,2-下发,3-回收,4-手动修改,…)
|
||||
*/
|
||||
@Excel(name = "操作类型", readConverterExp = "0=充值,1=退款,2=下发,3=回收,4=手动修改")
|
||||
private Integer type;
|
||||
|
||||
/** 变更金额 */
|
||||
@Excel(name = "变更金额")
|
||||
|
|
@ -46,4 +49,15 @@ public class AiGroupBalanceChangeRecord extends BaseEntity {
|
|||
@Excel(name = "变更后金额")
|
||||
private BigDecimal resultAmount;
|
||||
|
||||
/** 备注(目前只作为手工修改时的备注) */
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,4 @@ public interface AiChargeRefundOrderMapper extends BaseMapper<AiChargeRefundOrde
|
|||
List<AiChargeRefundOrder> selectAiChargeRefundOrderList(AiChargeRefundOrder query);
|
||||
|
||||
AiChargeRefundOrder selectAiChargeRefundOrderById(Long id);
|
||||
|
||||
int deleteAiChargeRefundOrderByIds(Long[] ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,28 +44,4 @@ public interface IAiChargeRefundOrderService {
|
|||
* @return 结果
|
||||
*/
|
||||
int insertAiChargeRefundOrder(AiChargeRefundOrder aiChargeRefundOrder);
|
||||
|
||||
/**
|
||||
* 修改团队(部门)充值退款订单
|
||||
*
|
||||
* @param aiChargeRefundOrder 团队(部门)充值退款订单
|
||||
* @return 结果
|
||||
*/
|
||||
int updateAiChargeRefundOrder(AiChargeRefundOrder aiChargeRefundOrder);
|
||||
|
||||
/**
|
||||
* 批量删除团队(部门)充值退款订单
|
||||
*
|
||||
* @param ids 需要删除的团队(部门)充值退款订单主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteAiChargeRefundOrderByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除团队(部门)充值退款订单信息
|
||||
*
|
||||
* @param id 团队(部门)充值退款订单主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteAiChargeRefundOrderById(Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
package com.ruoyi.ai.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.ai.domain.AiGroupBalanceChangeRecord;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 团队(部门)余额变动Service接口
|
||||
|
|
@ -19,7 +18,7 @@ public interface IAiGroupBalanceChangeRecordService {
|
|||
* @param id 团队(部门)余额变动主键
|
||||
* @return 团队(部门)余额变动
|
||||
*/
|
||||
AiGroupBalanceChangeRecord selectAiGroupBalanceChangeRecordById(String id);
|
||||
AiGroupBalanceChangeRecord selectAiGroupBalanceChangeRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 查询团队(部门)余额变动列表
|
||||
|
|
@ -28,44 +27,4 @@ public interface IAiGroupBalanceChangeRecordService {
|
|||
* @return 团队(部门)余额变动集合
|
||||
*/
|
||||
List<AiGroupBalanceChangeRecord> selectAiGroupBalanceChangeRecordList(AiGroupBalanceChangeRecord aiGroupBalanceChangeRecord);
|
||||
|
||||
/**
|
||||
* 分页查询团队(部门)余额变动列表
|
||||
*
|
||||
* @param aiGroupBalanceChangeRecord 团队(部门)余额变动
|
||||
* @return 团队(部门)余额变动集合
|
||||
*/
|
||||
IPage<AiGroupBalanceChangeRecord> selectAiGroupBalanceChangeRecordPage(Page page, AiGroupBalanceChangeRecord aiGroupBalanceChangeRecord);
|
||||
|
||||
/**
|
||||
* 新增团队(部门)余额变动
|
||||
*
|
||||
* @param aiGroupBalanceChangeRecord 团队(部门)余额变动
|
||||
* @return 结果
|
||||
*/
|
||||
int insertAiGroupBalanceChangeRecord(AiGroupBalanceChangeRecord aiGroupBalanceChangeRecord);
|
||||
|
||||
/**
|
||||
* 修改团队(部门)余额变动
|
||||
*
|
||||
* @param aiGroupBalanceChangeRecord 团队(部门)余额变动
|
||||
* @return 结果
|
||||
*/
|
||||
int updateAiGroupBalanceChangeRecord(AiGroupBalanceChangeRecord aiGroupBalanceChangeRecord);
|
||||
|
||||
/**
|
||||
* 批量删除团队(部门)余额变动
|
||||
*
|
||||
* @param ids 需要删除的团队(部门)余额变动主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteAiGroupBalanceChangeRecordByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除团队(部门)余额变动信息
|
||||
*
|
||||
* @param id 团队(部门)余额变动主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteAiGroupBalanceChangeRecordById(String id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,55 +89,13 @@ public class AiChargeRefundOrderServiceImpl implements IAiChargeRefundOrderServi
|
|||
aiChargeRefundOrder.setStatus(ChargeRefundOrderStatusType.SUCCESS.getCode());
|
||||
}
|
||||
aiChargeRefundOrder.setDelFlag("0");
|
||||
aiChargeRefundOrder.setCreateBy(SecurityUtils.getUsername());
|
||||
aiChargeRefundOrder.setCreateBy(SecurityUtils.getUserId());
|
||||
aiChargeRefundOrder.setCreateTime(DateUtils.getNowDate());
|
||||
int rows = aiChargeRefundOrderMapper.insert(aiChargeRefundOrder);
|
||||
syncRechargeReportData(aiChargeRefundOrder);
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改团队(部门)充值退款订单
|
||||
*
|
||||
* @param aiChargeRefundOrder 团队(部门)充值退款订单
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAiChargeRefundOrder(AiChargeRefundOrder aiChargeRefundOrder) {
|
||||
validateChargeAmount(aiChargeRefundOrder);
|
||||
aiChargeRefundOrder.setUpdateTime(DateUtils.getNowDate());
|
||||
int rows = aiChargeRefundOrderMapper.updateById(aiChargeRefundOrder);
|
||||
if (rows > 0) {
|
||||
AiChargeRefundOrder fresh = aiChargeRefundOrderMapper.selectById(aiChargeRefundOrder.getId());
|
||||
syncRechargeReportData(fresh);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除团队(部门)充值退款订单
|
||||
*
|
||||
* @param ids 需要删除的团队(部门)充值退款订单主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAiChargeRefundOrderByIds(Long[] ids)
|
||||
{
|
||||
return aiChargeRefundOrderMapper.deleteAiChargeRefundOrderByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除团队(部门)充值退款订单信息
|
||||
*
|
||||
* @param id 团队(部门)充值退款订单主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAiChargeRefundOrderById(Long id)
|
||||
{
|
||||
return aiChargeRefundOrderMapper.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值/退款单完成后,按“订单创建时间”同步到团队统计来源表。
|
||||
*
|
||||
|
|
@ -164,7 +122,7 @@ public class AiChargeRefundOrderServiceImpl implements IAiChargeRefundOrderServi
|
|||
}
|
||||
|
||||
/**
|
||||
* 充值、退款积分须为非负数;手动修改允许正负。
|
||||
* 充值、退款积分须为非负数。
|
||||
*/
|
||||
private void validateChargeAmount(AiChargeRefundOrder o) {
|
||||
if (o.getOrderType() == null || o.getAmount() == null) {
|
||||
|
|
|
|||
|
|
@ -92,14 +92,14 @@ public class AiDeptArkConfigServiceImpl implements IAiDeptArkConfigService {
|
|||
row.setByteApiKey(encodeNullable(keyPlain));
|
||||
row.setProject(encodeNullable(projectPlain));
|
||||
row.setModelParm(modelPlain);
|
||||
row.setCreateBy(SecurityUtils.getUsername());
|
||||
row.setCreateBy(SecurityUtils.getUserId());
|
||||
row.setCreateTime(DateUtils.getNowDate());
|
||||
aiDeptArkConfigMapper.insert(row);
|
||||
} else {
|
||||
existing.setByteApiKey(encodeNullable(keyPlain));
|
||||
existing.setProject(encodeNullable(projectPlain));
|
||||
existing.setModelParm(modelPlain);
|
||||
existing.setUpdateBy(SecurityUtils.getUsername());
|
||||
existing.setUpdateBy(SecurityUtils.getUserId());
|
||||
existing.setUpdateTime(DateUtils.getNowDate());
|
||||
aiDeptArkConfigMapper.updateById(existing);
|
||||
}
|
||||
|
|
@ -181,7 +181,7 @@ public class AiDeptArkConfigServiceImpl implements IAiDeptArkConfigService {
|
|||
@Override
|
||||
public int insertAiDeptArkConfig(AiDeptArkConfig aiDeptArkConfig) {
|
||||
encryptSensitiveForStore(aiDeptArkConfig);
|
||||
aiDeptArkConfig.setCreateBy(SecurityUtils.getUsername());
|
||||
aiDeptArkConfig.setCreateBy(SecurityUtils.getUserId());
|
||||
aiDeptArkConfig.setCreateTime(DateUtils.getNowDate());
|
||||
int r = aiDeptArkConfigMapper.insert(aiDeptArkConfig);
|
||||
if (r > 0 && aiDeptArkConfig.getDeptId() != null) {
|
||||
|
|
@ -193,7 +193,7 @@ public class AiDeptArkConfigServiceImpl implements IAiDeptArkConfigService {
|
|||
@Override
|
||||
public int updateAiDeptArkConfig(AiDeptArkConfig aiDeptArkConfig) {
|
||||
encryptSensitiveForStore(aiDeptArkConfig);
|
||||
aiDeptArkConfig.setUpdateBy(SecurityUtils.getUsername());
|
||||
aiDeptArkConfig.setUpdateBy(SecurityUtils.getUserId());
|
||||
aiDeptArkConfig.setUpdateTime(DateUtils.getNowDate());
|
||||
int r = aiDeptArkConfigMapper.updateById(aiDeptArkConfig);
|
||||
if (r > 0 && aiDeptArkConfig.getDeptId() != null) {
|
||||
|
|
|
|||
|
|
@ -1,16 +1,14 @@
|
|||
package com.ruoyi.ai.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.ai.domain.AiGroupBalanceChangeRecord;
|
||||
import com.ruoyi.ai.mapper.AiGroupBalanceChangeRecordMapper;
|
||||
import com.ruoyi.ai.service.IAiGroupBalanceChangeRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.ai.mapper.AiGroupBalanceChangeRecordMapper;
|
||||
import com.ruoyi.ai.domain.AiGroupBalanceChangeRecord;
|
||||
import com.ruoyi.ai.service.IAiGroupBalanceChangeRecordService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 团队(部门)余额变动Service业务层处理
|
||||
|
|
@ -31,7 +29,7 @@ public class AiGroupBalanceChangeRecordServiceImpl implements IAiGroupBalanceCha
|
|||
* @return 团队(部门)余额变动
|
||||
*/
|
||||
@Override
|
||||
public AiGroupBalanceChangeRecord selectAiGroupBalanceChangeRecordById(String id) {
|
||||
public AiGroupBalanceChangeRecord selectAiGroupBalanceChangeRecordById(Long id) {
|
||||
return aiGroupBalanceChangeRecordMapper.selectById(id);
|
||||
}
|
||||
|
||||
|
|
@ -47,64 +45,4 @@ public class AiGroupBalanceChangeRecordServiceImpl implements IAiGroupBalanceCha
|
|||
query.orderByDesc(AiGroupBalanceChangeRecord::getId);
|
||||
return aiGroupBalanceChangeRecordMapper.selectList(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询团队(部门)余额变动列表
|
||||
*
|
||||
* @param aiGroupBalanceChangeRecord 团队(部门)余额变动
|
||||
* @return 团队(部门)余额变动
|
||||
*/
|
||||
@Override
|
||||
public IPage<AiGroupBalanceChangeRecord> selectAiGroupBalanceChangeRecordPage(Page page, AiGroupBalanceChangeRecord aiGroupBalanceChangeRecord) {
|
||||
LambdaQueryWrapper<AiGroupBalanceChangeRecord> query = Wrappers.lambdaQuery(aiGroupBalanceChangeRecord);
|
||||
return aiGroupBalanceChangeRecordMapper.selectPage(page, query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增团队(部门)余额变动
|
||||
*
|
||||
* @param aiGroupBalanceChangeRecord 团队(部门)余额变动
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAiGroupBalanceChangeRecord(AiGroupBalanceChangeRecord aiGroupBalanceChangeRecord) {
|
||||
aiGroupBalanceChangeRecord.setCreateTime(DateUtils.getNowDate());
|
||||
return aiGroupBalanceChangeRecordMapper.insert(aiGroupBalanceChangeRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改团队(部门)余额变动
|
||||
*
|
||||
* @param aiGroupBalanceChangeRecord 团队(部门)余额变动
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAiGroupBalanceChangeRecord(AiGroupBalanceChangeRecord aiGroupBalanceChangeRecord) {
|
||||
aiGroupBalanceChangeRecord.setUpdateTime(DateUtils.getNowDate());
|
||||
return aiGroupBalanceChangeRecordMapper.updateById(aiGroupBalanceChangeRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除团队(部门)余额变动
|
||||
*
|
||||
* @param ids 需要删除的团队(部门)余额变动主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAiGroupBalanceChangeRecordByIds(String[] ids)
|
||||
{
|
||||
return aiGroupBalanceChangeRecordMapper.deleteBatchIds(java.util.Arrays.asList(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除团队(部门)余额变动信息
|
||||
*
|
||||
* @param id 团队(部门)余额变动主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAiGroupBalanceChangeRecordById(String id)
|
||||
{
|
||||
return aiGroupBalanceChangeRecordMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ public class AiUserServiceImpl implements IAiUserService {
|
|||
aiUser.setDelFlag("0");
|
||||
aiUser.setCreateBy(SecurityUtils.getUsername());
|
||||
aiUser.setCreateTime(DateUtils.getNowDate());
|
||||
aiUser.setBalance(null);
|
||||
return aiUserMapper.insert(aiUser);
|
||||
}
|
||||
|
||||
|
|
@ -192,6 +193,7 @@ public class AiUserServiceImpl implements IAiUserService {
|
|||
} else {
|
||||
aiUser.setPassword(null);
|
||||
}
|
||||
aiUser.setBalance(old != null ? old.getBalance() : null);
|
||||
return aiUserMapper.updateById(aiUser);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.ruoyi.ai.mapper.AiGroupBalanceChangeRecordMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -13,7 +14,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import com.ruoyi.ai.domain.AiChargeRefundOrder;
|
||||
import com.ruoyi.ai.domain.AiGroupBalanceChangeRecord;
|
||||
import com.ruoyi.ai.service.IAiChargeRefundOrderService;
|
||||
import com.ruoyi.ai.service.IAiGroupBalanceChangeRecordService;
|
||||
import com.ruoyi.ai.service.IDeptChargeRefundService;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.core.request.system.DeptChargeRefundRequest;
|
||||
|
|
@ -41,7 +41,7 @@ public class DeptChargeRefundServiceImpl implements IDeptChargeRefundService {
|
|||
private IAiChargeRefundOrderService aiChargeRefundOrderService;
|
||||
|
||||
@Autowired
|
||||
private IAiGroupBalanceChangeRecordService aiGroupBalanceChangeRecordService;
|
||||
private AiGroupBalanceChangeRecordMapper aiGroupBalanceChangeRecordMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
|
@ -59,12 +59,12 @@ public class DeptChargeRefundServiceImpl implements IDeptChargeRefundService {
|
|||
// 1) 手工入账订单,状态直接为已完成
|
||||
AiChargeRefundOrder order = new AiChargeRefundOrder();
|
||||
order.setDelFlag("0");
|
||||
order.setCreateBy(SecurityUtils.getUsername());
|
||||
order.setCreateBy(SecurityUtils.getUserId());
|
||||
order.setCreateTime(now);
|
||||
order.setUpdateTime(now);
|
||||
order.setOrderNum(orderNum);
|
||||
order.setDeptId(request.getDeptId());
|
||||
order.setOrderType(Long.valueOf(request.getOrderType()));
|
||||
order.setOrderType(request.getOrderType());
|
||||
// 金额两位小数:向零截断(非四舍五入),避免入账金额被抬高
|
||||
order.setMoney(request.getMoney().setScale(2, RoundingMode.DOWN));
|
||||
order.setAmount(amountBd);
|
||||
|
|
@ -82,7 +82,7 @@ public class DeptChargeRefundServiceImpl implements IDeptChargeRefundService {
|
|||
}
|
||||
if (rows == 0) {
|
||||
if (orderType == ChargeRefundOrderType.REFUND) {
|
||||
throw new ServiceException("余额不足或部门不存在");
|
||||
throw new ServiceException("剩余积分不足");
|
||||
}
|
||||
throw new ServiceException("部门不存在或已删除");
|
||||
}
|
||||
|
|
@ -101,16 +101,15 @@ public class DeptChargeRefundServiceImpl implements IDeptChargeRefundService {
|
|||
record.setRelationOrderNo(orderNum);
|
||||
record.setDeptId(request.getDeptId());
|
||||
record.setType(orderType == ChargeRefundOrderType.CHARGE
|
||||
? Long.valueOf(GroupBalanceChangeType.RECHARGE.getCode())
|
||||
: Long.valueOf(GroupBalanceChangeType.REFUND.getCode()));
|
||||
? GroupBalanceChangeType.RECHARGE.getCode()
|
||||
: GroupBalanceChangeType.REFUND.getCode());
|
||||
record.setChangeAmount(signedChange);
|
||||
record.setResultAmount(dept.getBalance());
|
||||
record.setRemark(request.getRemark());
|
||||
record.setCreateBy(SecurityUtils.getUsername());
|
||||
record.setCreateTime(now);
|
||||
record.setUpdateTime(now);
|
||||
|
||||
aiGroupBalanceChangeRecordService.insertAiGroupBalanceChangeRecord(record);
|
||||
aiGroupBalanceChangeRecordMapper.insert(record);
|
||||
}
|
||||
|
||||
/** 业务单号前缀 + 日序 + 随机后缀,保证与流水 relation_order_no 一致。 */
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.ruoyi.ai.mapper.AiGroupBalanceChangeRecordMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.ruoyi.ai.domain.AiGroupBalanceChangeRecord;
|
||||
import com.ruoyi.ai.mapper.AiOrderMapper;
|
||||
import com.ruoyi.ai.service.IAiGroupBalanceChangeRecordService;
|
||||
import com.ruoyi.ai.service.IAiUserService;
|
||||
import com.ruoyi.common.constant.BalanceChangerConstants;
|
||||
import com.ruoyi.common.core.domain.entity.AiUser;
|
||||
|
|
@ -19,7 +19,6 @@ import com.ruoyi.common.core.domain.entity.SysDept;
|
|||
import com.ruoyi.common.core.request.ai.AiUserDeptScoreRequest;
|
||||
import com.ruoyi.common.enums.GroupBalanceChangeType;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
|
||||
|
|
@ -35,11 +34,10 @@ public class DeptUserScoreTransferTxService {
|
|||
@Autowired
|
||||
private IAiUserService aiUserService;
|
||||
|
||||
@Autowired
|
||||
private IAiGroupBalanceChangeRecordService aiGroupBalanceChangeRecordService;
|
||||
|
||||
@Autowired
|
||||
private AiOrderMapper aiOrderMapper;
|
||||
@Autowired
|
||||
private AiGroupBalanceChangeRecordMapper aiGroupBalanceChangeRecordMapper;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void transferIssue(AiUserDeptScoreRequest request) {
|
||||
|
|
@ -109,7 +107,7 @@ public class DeptUserScoreTransferTxService {
|
|||
if (amount == null || amount < 1) {
|
||||
throw new ServiceException("积分必须为正整数");
|
||||
}
|
||||
return BigDecimal.valueOf(amount.longValue());
|
||||
return BigDecimal.valueOf(amount);
|
||||
}
|
||||
|
||||
private String buildRemark(String input, String defaultPrefix) {
|
||||
|
|
@ -132,12 +130,11 @@ public class DeptUserScoreTransferTxService {
|
|||
AiGroupBalanceChangeRecord record = new AiGroupBalanceChangeRecord();
|
||||
record.setRelationOrderNo(orderNum);
|
||||
record.setDeptId(deptId);
|
||||
record.setType(Long.valueOf(type));
|
||||
record.setType(type);
|
||||
record.setChangeAmount(signedChange);
|
||||
record.setResultAmount(resultBalance);
|
||||
record.setRemark(remark);
|
||||
record.setCreateBy(SecurityUtils.getUsername());
|
||||
aiGroupBalanceChangeRecordService.insertAiGroupBalanceChangeRecord(record);
|
||||
aiGroupBalanceChangeRecordMapper.insert(record);
|
||||
}
|
||||
|
||||
private static String buildOrderNum() {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,8 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.ruoyi.ai.domain.AiGroupBalanceChangeRecord;
|
||||
import com.ruoyi.ai.mapper.AiGroupBalanceChangeRecordMapper;
|
||||
import com.ruoyi.ai.service.IAiDeptArkConfigService;
|
||||
import com.ruoyi.ai.service.IAiGroupBalanceChangeRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.ruoyi.common.annotation.DataScope;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.domain.TreeSelect;
|
||||
|
|
@ -24,7 +13,6 @@ import com.ruoyi.common.core.request.system.DeptPointsCorrectionRequest;
|
|||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.enums.GroupBalanceChangeType;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
|
|
@ -32,6 +20,16 @@ import com.ruoyi.system.mapper.SysDeptMapper;
|
|||
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.system.service.ISysDeptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 部门管理 服务实现
|
||||
|
|
@ -39,8 +37,7 @@ import com.ruoyi.system.service.ISysDeptService;
|
|||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class SysDeptServiceImpl implements ISysDeptService
|
||||
{
|
||||
public class SysDeptServiceImpl implements ISysDeptService {
|
||||
@Autowired
|
||||
private SysDeptMapper deptMapper;
|
||||
|
||||
|
|
@ -50,11 +47,10 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
@Autowired
|
||||
private SysUserMapper userMapper;
|
||||
|
||||
@Autowired
|
||||
private IAiGroupBalanceChangeRecordService aiGroupBalanceChangeRecordService;
|
||||
|
||||
@Autowired
|
||||
private IAiDeptArkConfigService aiDeptArkConfigService;
|
||||
@Autowired
|
||||
private AiGroupBalanceChangeRecordMapper aiGroupBalanceChangeRecordMapper;
|
||||
|
||||
/**
|
||||
* 查询部门管理数据
|
||||
|
|
@ -64,8 +60,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d")
|
||||
public List<SysDept> selectDeptList(SysDept dept)
|
||||
{
|
||||
public List<SysDept> selectDeptList(SysDept dept) {
|
||||
return deptMapper.selectDeptList(dept);
|
||||
}
|
||||
|
||||
|
|
@ -76,8 +71,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
* @return 部门树信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<TreeSelect> selectDeptTreeList(SysDept dept)
|
||||
{
|
||||
public List<TreeSelect> selectDeptTreeList(SysDept dept) {
|
||||
List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
|
||||
return buildDeptTreeSelect(depts);
|
||||
}
|
||||
|
|
@ -89,21 +83,17 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
* @return 树结构列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysDept> buildDeptTree(List<SysDept> depts)
|
||||
{
|
||||
public List<SysDept> buildDeptTree(List<SysDept> depts) {
|
||||
List<SysDept> returnList = new ArrayList<SysDept>();
|
||||
List<Long> tempList = depts.stream().map(SysDept::getDeptId).collect(Collectors.toList());
|
||||
for (SysDept dept : depts)
|
||||
{
|
||||
for (SysDept dept : depts) {
|
||||
// 如果是顶级节点, 遍历该父节点的所有子节点
|
||||
if (!tempList.contains(dept.getParentId()))
|
||||
{
|
||||
if (!tempList.contains(dept.getParentId())) {
|
||||
recursionFn(depts, dept);
|
||||
returnList.add(dept);
|
||||
}
|
||||
}
|
||||
if (returnList.isEmpty())
|
||||
{
|
||||
if (returnList.isEmpty()) {
|
||||
returnList = depts;
|
||||
}
|
||||
return returnList;
|
||||
|
|
@ -116,8 +106,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
* @return 下拉树结构列表
|
||||
*/
|
||||
@Override
|
||||
public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts)
|
||||
{
|
||||
public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts) {
|
||||
List<SysDept> deptTrees = buildDeptTree(depts);
|
||||
return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
|
@ -129,8 +118,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
* @return 选中部门列表
|
||||
*/
|
||||
@Override
|
||||
public List<Long> selectDeptListByRoleId(Long roleId)
|
||||
{
|
||||
public List<Long> selectDeptListByRoleId(Long roleId) {
|
||||
SysRole role = roleMapper.selectRoleById(roleId);
|
||||
return deptMapper.selectDeptListByRoleId(roleId, role.isDeptCheckStrictly());
|
||||
}
|
||||
|
|
@ -142,8 +130,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
* @return 部门信息
|
||||
*/
|
||||
@Override
|
||||
public SysDept selectDeptById(Long deptId)
|
||||
{
|
||||
public SysDept selectDeptById(Long deptId) {
|
||||
return deptMapper.selectDeptById(deptId);
|
||||
}
|
||||
|
||||
|
|
@ -154,8 +141,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
* @return 子部门数
|
||||
*/
|
||||
@Override
|
||||
public int selectNormalChildrenDeptById(Long deptId)
|
||||
{
|
||||
public int selectNormalChildrenDeptById(Long deptId) {
|
||||
return deptMapper.selectNormalChildrenDeptById(deptId);
|
||||
}
|
||||
|
||||
|
|
@ -166,8 +152,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean hasChildByDeptId(Long deptId)
|
||||
{
|
||||
public boolean hasChildByDeptId(Long deptId) {
|
||||
int result = deptMapper.hasChildByDeptId(deptId);
|
||||
return result > 0;
|
||||
}
|
||||
|
|
@ -179,8 +164,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
* @return 结果 true 存在 false 不存在
|
||||
*/
|
||||
@Override
|
||||
public boolean checkDeptExistUser(Long deptId)
|
||||
{
|
||||
public boolean checkDeptExistUser(Long deptId) {
|
||||
int result = deptMapper.checkDeptExistUser(deptId);
|
||||
return result > 0;
|
||||
}
|
||||
|
|
@ -192,12 +176,10 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean checkDeptNameUnique(SysDept dept)
|
||||
{
|
||||
public boolean checkDeptNameUnique(SysDept dept) {
|
||||
Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
|
||||
SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId());
|
||||
if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue())
|
||||
{
|
||||
if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue()) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
|
|
@ -209,15 +191,12 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
* @param deptId 部门id
|
||||
*/
|
||||
@Override
|
||||
public void checkDeptDataScope(Long deptId)
|
||||
{
|
||||
if (!SysUser.isAdmin(SecurityUtils.getUserId()) && StringUtils.isNotNull(deptId))
|
||||
{
|
||||
public void checkDeptDataScope(Long deptId) {
|
||||
if (!SysUser.isAdmin(SecurityUtils.getUserId()) && StringUtils.isNotNull(deptId)) {
|
||||
SysDept dept = new SysDept();
|
||||
dept.setDeptId(deptId);
|
||||
List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
|
||||
if (StringUtils.isEmpty(depts))
|
||||
{
|
||||
if (StringUtils.isEmpty(depts)) {
|
||||
throw new ServiceException("没有权限访问部门数据!");
|
||||
}
|
||||
}
|
||||
|
|
@ -230,16 +209,13 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDept(SysDept dept)
|
||||
{
|
||||
public int insertDept(SysDept dept) {
|
||||
SysDept info = deptMapper.selectDeptById(dept.getParentId());
|
||||
if (!isFirstLevelDept(info))
|
||||
{
|
||||
if (!isFirstLevelDept(info)) {
|
||||
throw new ServiceException("仅允许在一级部门下创建二级部门");
|
||||
}
|
||||
// 如果父节点不为正常状态,则不允许新增子节点
|
||||
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
|
||||
{
|
||||
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
|
||||
throw new ServiceException("部门停用,不允许新增");
|
||||
}
|
||||
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
||||
|
|
@ -253,18 +229,15 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDept(SysDept dept)
|
||||
{
|
||||
public int updateDept(SysDept dept) {
|
||||
SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId());
|
||||
SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId());
|
||||
if (StringUtils.isNull(oldDept))
|
||||
{
|
||||
if (StringUtils.isNull(oldDept)) {
|
||||
throw new ServiceException("部门不存在");
|
||||
}
|
||||
validateDeptUpdateConstraint(dept, oldDept, newParentDept);
|
||||
validateDeptMaxUserCountFloor(dept, oldDept);
|
||||
if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept))
|
||||
{
|
||||
if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) {
|
||||
String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId();
|
||||
String oldAncestors = oldDept.getAncestors();
|
||||
dept.setAncestors(newAncestors);
|
||||
|
|
@ -272,8 +245,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
}
|
||||
int result = deptMapper.updateDept(dept);
|
||||
if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors())
|
||||
&& !StringUtils.equals("0", dept.getAncestors()))
|
||||
{
|
||||
&& !StringUtils.equals("0", dept.getAncestors())) {
|
||||
// 如果该部门是启用状态,则启用该部门的所有上级部门
|
||||
updateParentDeptStatusNormal(dept);
|
||||
}
|
||||
|
|
@ -285,8 +257,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
*
|
||||
* @param dept 当前部门
|
||||
*/
|
||||
private void updateParentDeptStatusNormal(SysDept dept)
|
||||
{
|
||||
private void updateParentDeptStatusNormal(SysDept dept) {
|
||||
String ancestors = dept.getAncestors();
|
||||
Long[] deptIds = Convert.toLongArray(ancestors);
|
||||
deptMapper.updateDeptStatusNormal(deptIds);
|
||||
|
|
@ -295,16 +266,13 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
/**
|
||||
* 账号上限调低时:不能小于当前启用中用户数(max_user_count 为空或≤0 表示不限制)
|
||||
*/
|
||||
private void validateDeptMaxUserCountFloor(SysDept incoming, SysDept oldDept)
|
||||
{
|
||||
private void validateDeptMaxUserCountFloor(SysDept incoming, SysDept oldDept) {
|
||||
Integer newMax = incoming.getMaxUserCount() != null ? incoming.getMaxUserCount() : oldDept.getMaxUserCount();
|
||||
if (newMax == null || newMax <= 0)
|
||||
{
|
||||
if (newMax == null || newMax <= 0) {
|
||||
return;
|
||||
}
|
||||
int enabledCnt = userMapper.countNormalUsersByDeptId(incoming.getDeptId(), null);
|
||||
if (enabledCnt > newMax)
|
||||
{
|
||||
if (enabledCnt > newMax) {
|
||||
throw new ServiceException(String.format("该团队当前启用中账号共 %d 个,账号上限不能小于该数量", enabledCnt));
|
||||
}
|
||||
}
|
||||
|
|
@ -312,19 +280,16 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
/**
|
||||
* 修改子元素关系
|
||||
*
|
||||
* @param deptId 被修改的部门ID
|
||||
* @param deptId 被修改的部门ID
|
||||
* @param newAncestors 新的父ID集合
|
||||
* @param oldAncestors 旧的父ID集合
|
||||
*/
|
||||
public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors)
|
||||
{
|
||||
public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) {
|
||||
List<SysDept> children = deptMapper.selectChildrenDeptById(deptId);
|
||||
for (SysDept child : children)
|
||||
{
|
||||
for (SysDept child : children) {
|
||||
child.setAncestors(child.getAncestors().replaceFirst(oldAncestors, newAncestors));
|
||||
}
|
||||
if (children.size() > 0)
|
||||
{
|
||||
if (children.size() > 0) {
|
||||
deptMapper.updateDeptChildren(children);
|
||||
}
|
||||
}
|
||||
|
|
@ -337,26 +302,21 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteDeptById(Long deptId)
|
||||
{
|
||||
public int deleteDeptById(Long deptId) {
|
||||
int rows = deptMapper.deleteDeptById(deptId);
|
||||
if (rows > 0)
|
||||
{
|
||||
if (rows > 0) {
|
||||
aiDeptArkConfigService.deleteByDeptId(deptId);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isArkConfigurableDept(Long deptId)
|
||||
{
|
||||
if (deptId == null)
|
||||
{
|
||||
public boolean isArkConfigurableDept(Long deptId) {
|
||||
if (deptId == null) {
|
||||
return false;
|
||||
}
|
||||
SysDept d = deptMapper.selectDeptById(deptId);
|
||||
if (d == null)
|
||||
{
|
||||
if (d == null) {
|
||||
return false;
|
||||
}
|
||||
return isFirstLevelDept(d) || isSecondLevelDept(d);
|
||||
|
|
@ -368,52 +328,46 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
return maxOrder != null ? maxOrder : 1;
|
||||
}
|
||||
|
||||
/** 委托 Mapper 原子更新 {@code sys_dept.balance}(充值)。 */
|
||||
/**
|
||||
* 委托 Mapper 原子更新 {@code sys_dept.balance}(充值)。
|
||||
*/
|
||||
@Override
|
||||
public int addDeptBalance(Long deptId, BigDecimal amount)
|
||||
{
|
||||
public int addDeptBalance(Long deptId, BigDecimal amount) {
|
||||
return deptMapper.addDeptBalance(deptId, amount);
|
||||
}
|
||||
|
||||
/** 委托 Mapper 原子更新 {@code sys_dept.balance}(退款,防透支)。 */
|
||||
/**
|
||||
* 委托 Mapper 原子更新 {@code sys_dept.balance}(退款,防透支)。
|
||||
*/
|
||||
@Override
|
||||
public int subtractDeptBalance(Long deptId, BigDecimal amount)
|
||||
{
|
||||
public int subtractDeptBalance(Long deptId, BigDecimal amount) {
|
||||
return deptMapper.subtractDeptBalance(deptId, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void editScore(DeptPointsCorrectionRequest request)
|
||||
{
|
||||
public void editScore(DeptPointsCorrectionRequest request) {
|
||||
Long score = request.getScore();
|
||||
if (score == null || score == 0L)
|
||||
{
|
||||
if (score == null || score == 0L) {
|
||||
throw new ServiceException("积分不能为0");
|
||||
}
|
||||
|
||||
SysDept dept = selectDeptById(request.getDeptId());
|
||||
if (dept == null)
|
||||
{
|
||||
if (dept == null) {
|
||||
throw new ServiceException("部门不存在");
|
||||
}
|
||||
|
||||
BigDecimal delta = BigDecimal.valueOf(score);
|
||||
|
||||
int rows;
|
||||
if (delta.signum() > 0)
|
||||
{
|
||||
if (delta.signum() > 0) {
|
||||
rows = addDeptBalance(request.getDeptId(), delta);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
rows = subtractDeptBalance(request.getDeptId(), delta.abs());
|
||||
}
|
||||
if (rows == 0)
|
||||
{
|
||||
if (delta.signum() < 0)
|
||||
{
|
||||
throw new ServiceException("余额不足或部门不存在");
|
||||
if (rows == 0) {
|
||||
if (delta.signum() < 0) {
|
||||
throw new ServiceException("剩余积分不足");
|
||||
}
|
||||
throw new ServiceException("部门不存在或已删除");
|
||||
}
|
||||
|
|
@ -421,27 +375,22 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
AiGroupBalanceChangeRecord record = new AiGroupBalanceChangeRecord();
|
||||
record.setRelationOrderNo(null);
|
||||
record.setDeptId(request.getDeptId());
|
||||
record.setType(Long.valueOf(GroupBalanceChangeType.MANUAL_ADJUST.getCode()));
|
||||
record.setType(GroupBalanceChangeType.MANUAL_ADJUST.getCode());
|
||||
record.setChangeAmount(delta);
|
||||
record.setResultAmount(dept.getBalance());
|
||||
record.setRemark(request.getRemark());
|
||||
record.setCreateBy(SecurityUtils.getUsername());
|
||||
|
||||
aiGroupBalanceChangeRecordService.insertAiGroupBalanceChangeRecord(record);
|
||||
aiGroupBalanceChangeRecordMapper.insert(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归列表
|
||||
*/
|
||||
private void recursionFn(List<SysDept> list, SysDept t)
|
||||
{
|
||||
private void recursionFn(List<SysDept> list, SysDept t) {
|
||||
// 得到子节点列表
|
||||
List<SysDept> childList = getChildList(list, t);
|
||||
t.setChildren(childList);
|
||||
for (SysDept tChild : childList)
|
||||
{
|
||||
if (hasChild(list, tChild))
|
||||
{
|
||||
for (SysDept tChild : childList) {
|
||||
if (hasChild(list, tChild)) {
|
||||
recursionFn(list, tChild);
|
||||
}
|
||||
}
|
||||
|
|
@ -450,15 +399,12 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
/**
|
||||
* 得到子节点列表
|
||||
*/
|
||||
private List<SysDept> getChildList(List<SysDept> list, SysDept t)
|
||||
{
|
||||
private List<SysDept> getChildList(List<SysDept> list, SysDept t) {
|
||||
List<SysDept> tlist = new ArrayList<SysDept>();
|
||||
Iterator<SysDept> it = list.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
while (it.hasNext()) {
|
||||
SysDept n = (SysDept) it.next();
|
||||
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue())
|
||||
{
|
||||
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) {
|
||||
tlist.add(n);
|
||||
}
|
||||
}
|
||||
|
|
@ -468,29 +414,24 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
/**
|
||||
* 判断是否有子节点
|
||||
*/
|
||||
private boolean hasChild(List<SysDept> list, SysDept t)
|
||||
{
|
||||
private boolean hasChild(List<SysDept> list, SysDept t) {
|
||||
return getChildList(list, t).size() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 约束:仅允许创建/更新二级部门;一级部门仅允许修改名称。
|
||||
*
|
||||
* @param newDept 前端提交的新部门参数
|
||||
* @param oldDept 数据库中的原部门数据
|
||||
* @param newDept 前端提交的新部门参数
|
||||
* @param oldDept 数据库中的原部门数据
|
||||
* @param newParentDept 修改后的父部门
|
||||
*/
|
||||
private void validateDeptUpdateConstraint(SysDept newDept, SysDept oldDept, SysDept newParentDept)
|
||||
{
|
||||
if (isFirstLevelDept(oldDept))
|
||||
{
|
||||
private void validateDeptUpdateConstraint(SysDept newDept, SysDept oldDept, SysDept newParentDept) {
|
||||
if (isFirstLevelDept(oldDept)) {
|
||||
validateFirstLevelDeptOnlyRename(newDept, oldDept);
|
||||
return;
|
||||
}
|
||||
if (isSecondLevelDept(oldDept))
|
||||
{
|
||||
if (!isFirstLevelDept(newParentDept))
|
||||
{
|
||||
if (isSecondLevelDept(oldDept)) {
|
||||
if (!isFirstLevelDept(newParentDept)) {
|
||||
throw new ServiceException("仅允许更新二级部门,且其上级必须为一级部门");
|
||||
}
|
||||
return;
|
||||
|
|
@ -504,8 +445,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
* @param newDept 前端提交的新部门参数
|
||||
* @param oldDept 数据库中的原部门数据
|
||||
*/
|
||||
private void validateFirstLevelDeptOnlyRename(SysDept newDept, SysDept oldDept)
|
||||
{
|
||||
private void validateFirstLevelDeptOnlyRename(SysDept newDept, SysDept oldDept) {
|
||||
if (!Objects.equals(newDept.getParentId(), oldDept.getParentId())
|
||||
|| !Objects.equals(newDept.getOrderNum(), oldDept.getOrderNum())
|
||||
|| !Objects.equals(newDept.getLeader(), oldDept.getLeader())
|
||||
|
|
@ -513,8 +453,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
|| !Objects.equals(newDept.getEmail(), oldDept.getEmail())
|
||||
|| !Objects.equals(newDept.getStatus(), oldDept.getStatus())
|
||||
|| !Objects.equals(newDept.getMaxUserCount(), oldDept.getMaxUserCount())
|
||||
|| !Objects.equals(newDept.getBalance(), oldDept.getBalance()))
|
||||
{
|
||||
|| !Objects.equals(newDept.getBalance(), oldDept.getBalance())) {
|
||||
throw new ServiceException("一级部门仅允许修改名称");
|
||||
}
|
||||
newDept.setAncestors(oldDept.getAncestors());
|
||||
|
|
@ -526,8 +465,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
* @param dept 部门信息
|
||||
* @return true-一级部门,false-非一级部门
|
||||
*/
|
||||
private boolean isFirstLevelDept(SysDept dept)
|
||||
{
|
||||
private boolean isFirstLevelDept(SysDept dept) {
|
||||
return StringUtils.isNotNull(dept)
|
||||
&& Objects.equals(0L, dept.getParentId())
|
||||
&& "0".equals(dept.getAncestors());
|
||||
|
|
@ -539,10 +477,8 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
* @param dept 部门信息
|
||||
* @return true-二级部门,false-非二级部门
|
||||
*/
|
||||
private boolean isSecondLevelDept(SysDept dept)
|
||||
{
|
||||
if (StringUtils.isNull(dept) || StringUtils.isBlank(dept.getAncestors()) || StringUtils.isNull(dept.getParentId()))
|
||||
{
|
||||
private boolean isSecondLevelDept(SysDept dept) {
|
||||
if (StringUtils.isNull(dept) || StringUtils.isBlank(dept.getAncestors()) || StringUtils.isNull(dept.getParentId())) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(2, StringUtils.split(dept.getAncestors(), ",").length);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public interface ISubteamScopeService {
|
|||
|
||||
void assertChargeRefundBelongsToTeam(Long orderPkId);
|
||||
|
||||
void assertGroupBalanceRecordBelongsToTeam(String recordId);
|
||||
void assertGroupBalanceRecordBelongsToTeam(Long recordId);
|
||||
|
||||
void assertAiBalanceRecordVisible(Long recordId, Long teamDeptId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public class SubteamScopeServiceImpl implements ISubteamScopeService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void assertGroupBalanceRecordBelongsToTeam(String recordId) {
|
||||
public void assertGroupBalanceRecordBelongsToTeam(Long recordId) {
|
||||
Long teamDeptId = currentTeamDeptId();
|
||||
AiGroupBalanceChangeRecord r = aiGroupBalanceChangeRecordMapper.selectById(recordId);
|
||||
if (r == null || r.getDeptId() == null || !teamDeptId.equals(r.getDeptId())) {
|
||||
|
|
|
|||
|
|
@ -48,66 +48,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectAiChargeRefundOrderVo"/>
|
||||
where o.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertAiChargeRefundOrder" parameterType="AiChargeRefundOrder" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ai_charge_refund_order
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="orderNum != null and orderNum != ''">order_num,</if>
|
||||
<if test="thirdPartyOrderNum != null">third_party_order_num,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="orderType != null">order_type,</if>
|
||||
<if test="money != null">money,</if>
|
||||
<if test="amount != null">amount,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="status != null">status,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
|
||||
<if test="thirdPartyOrderNum != null">#{thirdPartyOrderNum},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="orderType != null">#{orderType},</if>
|
||||
<if test="money != null">#{money},</if>
|
||||
<if test="amount != null">#{amount},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateAiChargeRefundOrder" parameterType="AiChargeRefundOrder">
|
||||
update ai_charge_refund_order
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
|
||||
<if test="thirdPartyOrderNum != null">third_party_order_num = #{thirdPartyOrderNum},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="orderType != null">order_type = #{orderType},</if>
|
||||
<if test="money != null">money = #{money},</if>
|
||||
<if test="amount != null">amount = #{amount},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAiChargeRefundOrderById" parameterType="Long">
|
||||
delete from ai_charge_refund_order where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAiChargeRefundOrderByIds" parameterType="String">
|
||||
delete from ai_charge_refund_order where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
@ -31,58 +31,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAiGroupBalanceChangeRecordById" parameterType="String" resultMap="AiGroupBalanceChangeRecordResult">
|
||||
<select id="selectAiGroupBalanceChangeRecordById" parameterType="long" resultMap="AiGroupBalanceChangeRecordResult">
|
||||
<include refid="selectAiGroupBalanceChangeRecordVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertAiGroupBalanceChangeRecord" parameterType="AiGroupBalanceChangeRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ai_group_balance_change_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="relationOrderNo != null">relation_order_no,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="changeAmount != null">change_amount,</if>
|
||||
<if test="resultAmount != null">result_amount,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="relationOrderNo != null">#{relationOrderNo},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="changeAmount != null">#{changeAmount},</if>
|
||||
<if test="resultAmount != null">#{resultAmount},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateAiGroupBalanceChangeRecord" parameterType="AiGroupBalanceChangeRecord">
|
||||
update ai_group_balance_change_record
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="relationOrderNo != null">relation_order_no = #{relationOrderNo},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="changeAmount != null">change_amount = #{changeAmount},</if>
|
||||
<if test="resultAmount != null">result_amount = #{resultAmount},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAiGroupBalanceChangeRecordById" parameterType="String">
|
||||
delete from ai_group_balance_change_record where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAiGroupBalanceChangeRecordByIds" parameterType="String">
|
||||
delete from ai_group_balance_change_record where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue