Merge pull request 'khy-three' (#130) from khy-three into master
Reviewed-on: #130
This commit is contained in:
commit
38da289685
@ -18,6 +18,28 @@ export interface BrokerageWithdrawVO {
|
|||||||
remark: string
|
remark: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface withDrawSupplyVO {
|
||||||
|
id: number,
|
||||||
|
userId: number,
|
||||||
|
agentPrice: number,
|
||||||
|
brokeragePrice: number,
|
||||||
|
frozenPrice: number,
|
||||||
|
closingType: number,
|
||||||
|
wechatAccountQrCodeUrl: string,
|
||||||
|
aliyAccountQrCodeUrl: string,
|
||||||
|
realName: string,
|
||||||
|
accountNo: string,
|
||||||
|
bankName: string,
|
||||||
|
bankCardNo: string,
|
||||||
|
supplyPrice: number,
|
||||||
|
remark: string,
|
||||||
|
wechatAccount: string,
|
||||||
|
aliyAccount: string,
|
||||||
|
agentId: number,
|
||||||
|
agentName: string,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 查询佣金提现列表
|
// 查询佣金提现列表
|
||||||
export const getBrokerageWithdrawPage = async (params: any) => {
|
export const getBrokerageWithdrawPage = async (params: any) => {
|
||||||
return await request.get({ url: `/trade/brokerage-withdraw/page`, params })
|
return await request.get({ url: `/trade/brokerage-withdraw/page`, params })
|
||||||
@ -37,3 +59,13 @@ export const approveBrokerageWithdraw = async (id: number) => {
|
|||||||
export const rejectBrokerageWithdraw = async (data: BrokerageWithdrawVO) => {
|
export const rejectBrokerageWithdraw = async (data: BrokerageWithdrawVO) => {
|
||||||
return await request.put({ url: `/trade/brokerage-withdraw/reject`, data })
|
return await request.put({ url: `/trade/brokerage-withdraw/reject`, data })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 结算申请
|
||||||
|
export const createWithDraw = async (data: withDrawSupplyVO) => {
|
||||||
|
return await request.post({ url: `/trade/brokerage-withdraw/create-supply`,data })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出佣金提现 Excel
|
||||||
|
export const exportBrokerageWithDraw = async (params) => {
|
||||||
|
return await request.download({ url: `/trade/brokerage-withdraw/export-excel`, params })
|
||||||
|
}
|
||||||
|
@ -9,6 +9,26 @@
|
|||||||
>
|
>
|
||||||
<el-form-item label="客服名称" prop="name">
|
<el-form-item label="客服名称" prop="name">
|
||||||
<el-input v-model="formData.name" placeholder="请输入客服名称" />
|
<el-input v-model="formData.name" placeholder="请输入客服名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="绑定账号" prop="userId">
|
||||||
|
<el-select v-model="formData.userId" placeholder="请选择用户名">
|
||||||
|
<el-option
|
||||||
|
v-for="item in userList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
>
|
||||||
|
<template #default>
|
||||||
|
<div class="user-option">
|
||||||
|
<img
|
||||||
|
:src="item.avatar"
|
||||||
|
class="user-avatar"
|
||||||
|
/>
|
||||||
|
<span class="user-name">{{ item.name }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="客服头像" prop="pic">
|
<el-form-item label="客服头像" prop="pic">
|
||||||
<UploadImg v-model="formData.pic" />
|
<UploadImg v-model="formData.pic" />
|
||||||
@ -65,6 +85,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
import { SupportStaffApi, SupportStaffVO } from '@/api/mall/promotion/supportstaff'
|
import { SupportStaffApi, SupportStaffVO } from '@/api/mall/promotion/supportstaff'
|
||||||
|
import {getUserListForAgent} from "@/api/member/user";
|
||||||
|
|
||||||
/** 客服人员 表单 */
|
/** 客服人员 表单 */
|
||||||
defineOptions({ name: 'SupportStaffForm' })
|
defineOptions({ name: 'SupportStaffForm' })
|
||||||
@ -78,6 +99,7 @@ const formLoading = ref(false) // 表单的加载中:1)修改时的数据加
|
|||||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
id: undefined,
|
id: undefined,
|
||||||
|
userId: undefined,
|
||||||
name: undefined,
|
name: undefined,
|
||||||
pic: undefined,
|
pic: undefined,
|
||||||
phone: undefined,
|
phone: undefined,
|
||||||
@ -101,6 +123,7 @@ const open = async (type: string, id?: number) => {
|
|||||||
dialogTitle.value = t('action.' + type)
|
dialogTitle.value = t('action.' + type)
|
||||||
formType.value = type
|
formType.value = type
|
||||||
resetForm()
|
resetForm()
|
||||||
|
getUserList()
|
||||||
// 修改时,设置数据
|
// 修改时,设置数据
|
||||||
if (id) {
|
if (id) {
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
@ -113,6 +136,14 @@ const open = async (type: string, id?: number) => {
|
|||||||
}
|
}
|
||||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||||
|
|
||||||
|
const userList = ref([]);
|
||||||
|
/** 初始化用户列表*/
|
||||||
|
const getUserList = async () => {
|
||||||
|
const res = await getUserListForAgent();
|
||||||
|
userList.value = res
|
||||||
|
console.log('getUserList', res)
|
||||||
|
}
|
||||||
|
|
||||||
/** 提交表单 */
|
/** 提交表单 */
|
||||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
@ -142,6 +173,7 @@ const resetForm = () => {
|
|||||||
formData.value = {
|
formData.value = {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
name: undefined,
|
name: undefined,
|
||||||
|
userId: undefined,
|
||||||
pic: undefined,
|
pic: undefined,
|
||||||
phone: undefined,
|
phone: undefined,
|
||||||
account: undefined,
|
account: undefined,
|
||||||
@ -157,3 +189,23 @@ const resetForm = () => {
|
|||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.user-option {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-avatar {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 10px;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-name {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #606266;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@ -0,0 +1,232 @@
|
|||||||
|
<template>
|
||||||
|
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="100px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<!-- <el-form-item label="提现用户:" prop="userId">-->
|
||||||
|
<!-- <el-select v-model="formData.userId" placeholder="请选择提现用户" @change="handleUserSelect(formData.userId)">-->
|
||||||
|
<!-- <el-option v-for="item in supplyUserList"-->
|
||||||
|
<!-- :key="item.id"-->
|
||||||
|
<!-- :label="item.name"-->
|
||||||
|
<!-- :value="item.id" >-->
|
||||||
|
<!-- <template #default>-->
|
||||||
|
<!-- <div class="user-option">-->
|
||||||
|
<!-- <img-->
|
||||||
|
<!-- :src="item.avatar"-->
|
||||||
|
<!-- class="user-avatar"-->
|
||||||
|
<!-- />-->
|
||||||
|
<!-- <span class="user-name">{{ item.name }}</span>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </template>-->
|
||||||
|
<!-- </el-option>-->
|
||||||
|
<!-- </el-select>-->
|
||||||
|
<!-- </el-form-item>-->
|
||||||
|
<el-form-item label="代理商余额:" prop="agentPrice">
|
||||||
|
<span>¥ {{fenToYuan(formData.agentPrice) || '-'}} </span>
|
||||||
|
<!-- <el-input v-model="formData.agentPrice" placeholder="请输入代理商id" :disabled="true"/>-->
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="可提现金额:" prop="brokeragePrice">
|
||||||
|
<span>¥ {{fenToYuan(formData.brokeragePrice) || '-'}} </span>
|
||||||
|
<!-- <el-input v-model="formData.brokeragePrice" placeholder="请输入可提现金额" :disabled= "true"/>-->
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="冻结金额:" prop="frozenPrice">
|
||||||
|
<span>¥ {{fenToYuan(formData.frozenPrice) || '-'}} </span>
|
||||||
|
<!-- <el-input v-model="formData.frozenPrice" placeholder="请输入冻结金额" :disabled= "true"/>-->
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="结算类型:" prop="closingType">
|
||||||
|
<el-radio-group v-model="formData.closingType">
|
||||||
|
<el-radio :value="1">钱包</el-radio>
|
||||||
|
<el-radio :value="2">银行</el-radio>
|
||||||
|
<el-radio :value="3">微信</el-radio>
|
||||||
|
<el-radio :value="4">支付宝</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="真实姓名:" prop="realName">
|
||||||
|
<span>{{(formData.realName) || '-'}} </span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="formData.closingType === 3" label="微信账号:" prop="wechatAccount">
|
||||||
|
<span>{{(formData.wechatAccount) || '-'}} </span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="formData.closingType === 3" label="微信收款码:" prop="wechatAccountQrCodeUrl">
|
||||||
|
<UploadImg v-model="formData.wechatAccountQrCodeUrl" :disabled="true"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="formData.closingType === 4" label="支付宝账号:" prop="alipayAccount">
|
||||||
|
<span>{{(formData.alipayAccount || '-')}} </span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="formData.closingType === 4" label="支付宝收款码:" prop="alipayAccountQrCodeUrl">
|
||||||
|
<UploadImg v-model="formData.alipayAccountQrCodeUrl" :disabled="true"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="formData.closingType === 2" label="开户银行:" prop="bankName">
|
||||||
|
<span>{{(formData.bankName) || '-'}} </span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="formData.closingType === 2" label="银行账号:" prop="bankCardNo">
|
||||||
|
<span>{{(formData.bankCardNo) || '-'}} </span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="申请金额:" prop="supplyPrice">
|
||||||
|
<el-input-number v-model="formData.supplyPrice" :min="1" :precision="2" :step="0.01"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注:" prop="remark">
|
||||||
|
<el-input type="textarea" v-model="formData.remark" placeholder="请输入平台备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import * as BrokerageWithdrawApi from '@/api/mall/trade/brokerage/withdraw'
|
||||||
|
import { fenToYuan, jsonParse } from '@/utils'
|
||||||
|
import {getBrokerageUser} from '@/api/mall/trade/brokerage/user'
|
||||||
|
|
||||||
|
/** 结算记录 表单 */
|
||||||
|
defineOptions({ name: 'ClosingRecordForm' })
|
||||||
|
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined,
|
||||||
|
userId: undefined,
|
||||||
|
agentPrice: undefined,
|
||||||
|
brokeragePrice: undefined,
|
||||||
|
frozenPrice: undefined,
|
||||||
|
closingType: undefined,
|
||||||
|
wechatAccountQrCodeUrl: undefined,
|
||||||
|
aliyAccountQrCodeUrl: undefined,
|
||||||
|
realName: undefined,
|
||||||
|
accountNo: undefined,
|
||||||
|
bankName: undefined,
|
||||||
|
bankCardNo: undefined,
|
||||||
|
supplyPrice: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
wechatAccount: undefined,
|
||||||
|
aliyAccount: undefined,
|
||||||
|
agentId: undefined,
|
||||||
|
agentName: undefined,
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
closingType: [{ required: true, message: '结算类型不能为空', trigger: 'change' }],
|
||||||
|
supplyPrice: [{ required: true, message: '申请金额不能为空', trigger: 'change' }],
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const open = async (type: string, id?: number) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
dialogTitle.value = t('action.' + type)
|
||||||
|
formType.value = type
|
||||||
|
resetForm()
|
||||||
|
// formData.value = await BrokerageWithdrawApi.getBrokerageSupplyInfo()
|
||||||
|
formData.value.closingType = 1
|
||||||
|
formData.value.supplyPrice = 1
|
||||||
|
console.log("form:",formData.value)
|
||||||
|
/*// 修改时,设置数据
|
||||||
|
if (id) {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||||
|
|
||||||
|
const supplyUserList = ref([]);
|
||||||
|
|
||||||
|
const handleUserSelect = async (userId) => {
|
||||||
|
const res = await getBrokerageUser(userId)
|
||||||
|
console.log('res11:', res)
|
||||||
|
// formData.value.
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||||
|
const submitForm = async () => {
|
||||||
|
// 校验表单
|
||||||
|
await formRef.value.validate()
|
||||||
|
// 提交请求
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = formData.value as unknown as BrokerageWithdrawApi.withDrawSupplyVO
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
const submitData = JSON.parse(JSON.stringify(data))
|
||||||
|
submitData.supplyPrice = submitData.supplyPrice * 100
|
||||||
|
console.log("formData:",data)
|
||||||
|
|
||||||
|
await BrokerageWithdrawApi.createWithDraw(submitData)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
}
|
||||||
|
/* else {
|
||||||
|
await ClosingRecordApi.updateClosingRecord(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}*/
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 发送操作成功的事件
|
||||||
|
emit('success')
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
userId: undefined,
|
||||||
|
agentPrice: undefined,
|
||||||
|
brokeragePrice: undefined,
|
||||||
|
frozenPrice: undefined,
|
||||||
|
closingType: undefined,
|
||||||
|
wechatAccountQrCodeUrl: undefined,
|
||||||
|
aliyAccountQrCodeUrl: undefined,
|
||||||
|
realName: undefined,
|
||||||
|
accountNo: undefined,
|
||||||
|
bankName: undefined,
|
||||||
|
bankCardNo: undefined,
|
||||||
|
supplyPrice: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
wechatAccount: undefined,
|
||||||
|
aliyAccount: undefined,
|
||||||
|
agentId: undefined,
|
||||||
|
agentName: undefined,
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
::v-deep .el-select-dropdown__item {
|
||||||
|
height: auto !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-option {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-avatar {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 10px;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-name {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #606266;
|
||||||
|
}
|
||||||
|
</style>
|
@ -82,6 +82,12 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||||
|
<el-button
|
||||||
|
@click="openClosingForm('create')"
|
||||||
|
v-hasPermi="['trade:brokerage-withdraw:create']"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:plus" class="mr-5px" /> 申请结算
|
||||||
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
@ -184,6 +190,7 @@
|
|||||||
|
|
||||||
<!-- 表单弹窗:添加/修改 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
<BrokerageWithdrawRejectForm ref="formRef" @success="getList" />
|
<BrokerageWithdrawRejectForm ref="formRef" @success="getList" />
|
||||||
|
<ClosingRecordForm ref="closingFormRef" @success="getList" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@ -191,6 +198,7 @@ import { DICT_TYPE, getDictLabel, getIntDictOptions, getStrDictOptions } from '@
|
|||||||
import { dateFormatter, formatDate } from '@/utils/formatTime'
|
import { dateFormatter, formatDate } from '@/utils/formatTime'
|
||||||
import * as BrokerageWithdrawApi from '@/api/mall/trade/brokerage/withdraw'
|
import * as BrokerageWithdrawApi from '@/api/mall/trade/brokerage/withdraw'
|
||||||
import BrokerageWithdrawRejectForm from './BrokerageWithdrawRejectForm.vue'
|
import BrokerageWithdrawRejectForm from './BrokerageWithdrawRejectForm.vue'
|
||||||
|
import ClosingRecordForm from "@/views/mall/trade/brokerage/withdraw/ClosingRecordForm.vue";
|
||||||
import { BrokerageWithdrawStatusEnum, BrokerageWithdrawTypeEnum } from '@/utils/constants'
|
import { BrokerageWithdrawStatusEnum, BrokerageWithdrawTypeEnum } from '@/utils/constants'
|
||||||
import { fenToYuanFormat } from '@/utils/formatter'
|
import { fenToYuanFormat } from '@/utils/formatter'
|
||||||
import { fenToYuan } from '@/utils'
|
import { fenToYuan } from '@/utils'
|
||||||
@ -248,6 +256,12 @@ const openForm = (id: number) => {
|
|||||||
formRef.value.open(id)
|
formRef.value.open(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 添加/修改操作 */
|
||||||
|
const closingFormRef = ref()
|
||||||
|
const openClosingForm = (type: string,id?: number) => {
|
||||||
|
closingFormRef.value.open(type,id)
|
||||||
|
}
|
||||||
|
|
||||||
/** 审核通过 */
|
/** 审核通过 */
|
||||||
const handleApprove = async (id: number) => {
|
const handleApprove = async (id: number) => {
|
||||||
try {
|
try {
|
||||||
|
@ -47,6 +47,24 @@
|
|||||||
下单支付金额按比例赠送积分(实际支付 1 元赠送多少积分)
|
下单支付金额按比例赠送积分(实际支付 1 元赠送多少积分)
|
||||||
</el-text>
|
</el-text>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="分享赠送多少分" prop="pointTradeSharePoint">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.pointTradeSharePoint"
|
||||||
|
placeholder="请输入 分享赠送多少积分"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="好评赠送多少分" prop="pointTradeGoodcommentPoint">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.pointTradeGoodcommentPoint"
|
||||||
|
placeholder="请输入 好评赠送多少积分"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="推广赠送多少分" prop="pointTradePromotionPoint">
|
||||||
|
<el-input-number
|
||||||
|
v-model="formData.pointTradePromotionPoint"
|
||||||
|
placeholder="请输入 推广商品可赠送多少积分"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="积分协议">
|
<el-form-item label="积分协议">
|
||||||
<Editor v-model="formData.content" />
|
<Editor v-model="formData.content" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -75,7 +93,10 @@ const formData = ref({
|
|||||||
pointTradeDeductUnitPrice: 0,
|
pointTradeDeductUnitPrice: 0,
|
||||||
pointTradeDeductMaxPrice: 0,
|
pointTradeDeductMaxPrice: 0,
|
||||||
pointTradeGivePoint: 0,
|
pointTradeGivePoint: 0,
|
||||||
content: ''
|
content: '',
|
||||||
|
pointTradeSharePoint: 0,
|
||||||
|
pointTradeGoodcommentPoint: 0,
|
||||||
|
pointTradePromotionPoint: 0
|
||||||
})
|
})
|
||||||
|
|
||||||
// 创建一个计算属性,用于将 pointTradeDeductUnitPrice 显示为带两位小数的形式
|
// 创建一个计算属性,用于将 pointTradeDeductUnitPrice 显示为带两位小数的形式
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package cn.iocoder.yudao.module.promotion.api.kefu;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.promotion.api.kefu.dto.SupportStaffDTO;
|
||||||
|
|
||||||
|
public interface SupportStaffApi {
|
||||||
|
/**
|
||||||
|
* 获得 skuId 商品匹配的的限时折扣信息
|
||||||
|
* @return 限时折扣信息
|
||||||
|
*/
|
||||||
|
SupportStaffDTO getUserIsSupportStaff(Long userId);
|
||||||
|
|
||||||
|
Integer getUnredCount();
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
package cn.iocoder.yudao.module.promotion.api.kefu.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客服人员 DO
|
||||||
|
*
|
||||||
|
* @author 管理员
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SupportStaffDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 客服名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 客服头像
|
||||||
|
*/
|
||||||
|
private String pic;
|
||||||
|
/**
|
||||||
|
* 手机号码
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
/**
|
||||||
|
* 登录账号
|
||||||
|
*/
|
||||||
|
private String account;
|
||||||
|
/**
|
||||||
|
* 登录密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
/**
|
||||||
|
* 客服状态
|
||||||
|
*
|
||||||
|
* 枚举 {@link TODO kefu_support_staff_status 对应的类}
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 手机订单管理
|
||||||
|
*
|
||||||
|
* 枚举 {@link TODO kefu_support_staff_order_manage 对应的类}
|
||||||
|
*/
|
||||||
|
private Integer orderManage;
|
||||||
|
/**
|
||||||
|
* 订单通知
|
||||||
|
*
|
||||||
|
* 枚举 {@link TODO kefu_support_staff_order_inform 对应的类}
|
||||||
|
*/
|
||||||
|
private Integer orderInform;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 线上状态
|
||||||
|
* */
|
||||||
|
private Integer lineStatus;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 用户id
|
||||||
|
* */
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
}
|
@ -173,4 +173,6 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode REGISTRATION_NOT_EXISTS = new ErrorCode(1_024_000_000, "活动报名不存在");
|
ErrorCode REGISTRATION_NOT_EXISTS = new ErrorCode(1_024_000_000, "活动报名不存在");
|
||||||
|
|
||||||
ErrorCode ACTIVITY_INFO_NOT_EXISTS = new ErrorCode(1_025_000_000, "活动信息不存在");
|
ErrorCode ACTIVITY_INFO_NOT_EXISTS = new ErrorCode(1_025_000_000, "活动信息不存在");
|
||||||
|
|
||||||
|
ErrorCode SUPPORT_STAFF_USER_EXISTS = new ErrorCode(1_026_000_000, "客服人员绑定的用户已存在");
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
package cn.iocoder.yudao.module.promotion.api.kefu;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.module.promotion.api.kefu.dto.SupportStaffDTO;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuConversationDO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.supportstaff.SupportStaffDO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.service.kefu.KeFuConversationService;
|
||||||
|
import cn.iocoder.yudao.module.promotion.service.supportstaff.SupportStaffService;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class SupportStaffApiImpl implements SupportStaffApi{
|
||||||
|
@Resource
|
||||||
|
private SupportStaffService staffService;
|
||||||
|
@Resource
|
||||||
|
private KeFuConversationService conversationService;
|
||||||
|
@Override
|
||||||
|
public SupportStaffDTO getUserIsSupportStaff(Long userId) {
|
||||||
|
SupportStaffDO staffDO = staffService.getSupportStaffByUserId(userId);
|
||||||
|
return BeanUtils.toBean(staffDO, SupportStaffDTO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getUnredCount() {
|
||||||
|
List<KeFuConversationDO> conversationDOS = conversationService.getKefuConversationList(null);
|
||||||
|
int totalAge = conversationDOS.stream()
|
||||||
|
.mapToInt(KeFuConversationDO::getAdminUnreadMessageCount) // 将Person对象转换为int(即age值)的Stream
|
||||||
|
.sum(); // 对所有age值进行累加
|
||||||
|
return totalAge;
|
||||||
|
}
|
||||||
|
}
|
@ -18,6 +18,9 @@ public class CirclePageReqVO extends PageParam {
|
|||||||
@Schema(description = "用户编号", example = "20140")
|
@Schema(description = "用户编号", example = "20140")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "用户昵称", example = "用户000")
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
@Schema(description = "发表内容")
|
@Schema(description = "发表内容")
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
|
@ -22,6 +22,9 @@ public class CircleRespVO {
|
|||||||
@ExcelProperty("用户编号")
|
@ExcelProperty("用户编号")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "用户昵称", example = "用户000")
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
@Schema(description = "发表内容")
|
@Schema(description = "发表内容")
|
||||||
@ExcelProperty("发表内容")
|
@ExcelProperty("发表内容")
|
||||||
private String content;
|
private String content;
|
||||||
|
@ -15,6 +15,9 @@ public class CircleSaveReqVO {
|
|||||||
@Schema(description = "用户编号", example = "20140")
|
@Schema(description = "用户编号", example = "20140")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "用户昵称", example = "用户000")
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
@Schema(description = "发表内容")
|
@Schema(description = "发表内容")
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
package cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Max;
|
||||||
|
import javax.validation.constraints.Min;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 客服消息列表 Request VO")
|
||||||
|
@Data
|
||||||
|
public class KeFuMessageListReqVO {
|
||||||
|
|
||||||
|
private static final Integer LIMIT = 10;
|
||||||
|
|
||||||
|
@Schema(description = "会话编号", example = "12580")
|
||||||
|
@NotNull(message = "会话编号不能为空")
|
||||||
|
private Long conversationId;
|
||||||
|
|
||||||
|
@Schema(description = "发送时间", example = "2024-03-27 12:00:00")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "每次查询条数,最大值为 100", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
||||||
|
@NotNull(message = "每次查询条数不能为空")
|
||||||
|
@Min(value = 1, message = "每次查询条数最小值为 1")
|
||||||
|
@Max(value = 100, message = "每次查询最大值为 100")
|
||||||
|
private Integer limit = LIMIT;
|
||||||
|
|
||||||
|
}
|
@ -56,5 +56,7 @@ public class SupportStaffRespVO {
|
|||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
private Integer lineStatus;
|
private Integer lineStatus;
|
||||||
|
@Schema(description = "用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
}
|
}
|
@ -41,4 +41,7 @@ public class SupportStaffSaveReqVO {
|
|||||||
|
|
||||||
private Integer lineStatus;
|
private Integer lineStatus;
|
||||||
|
|
||||||
|
@Schema(description = "用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
}
|
}
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
|||||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.circle.vo.CirclePageReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.circle.vo.CirclePageReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.circle.vo.CircleRespVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.circle.vo.CircleRespVO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.circle.vo.CircleSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.circlereview.vo.CircleReviewSaveReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.circlereview.vo.CircleReviewSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.circle.CircleDO;
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.circle.CircleDO;
|
||||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.circlereview.CircleReviewDO;
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.circlereview.CircleReviewDO;
|
||||||
@ -62,7 +63,44 @@ public class AppCircleController {
|
|||||||
return success(result);
|
return success(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/doBrowse")
|
@GetMapping("/getById")
|
||||||
|
@Operation(summary = "获得动态对象")
|
||||||
|
@PreAuthenticated
|
||||||
|
public CommonResult<CircleRespVO> getCircleById(@RequestParam("id") Long id) {
|
||||||
|
CircleDO circleDO = circleService.getCircle(id);
|
||||||
|
|
||||||
|
CircleRespVO circleRespVO = BeanUtils.toBean(circleDO, CircleRespVO.class);
|
||||||
|
List<CircleReviewDO> listCircleReviewByCircleId = circleReviewService.getListCircleReviewByCircleId(circleRespVO.getId());
|
||||||
|
for (CircleReviewDO reviewDO : listCircleReviewByCircleId) {
|
||||||
|
reviewDO.setRemark(utilMethod(reviewDO.getUserId(),reviewDO.getReplyUserId()));
|
||||||
|
}
|
||||||
|
circleRespVO.setCircleList(listCircleReviewByCircleId);
|
||||||
|
return success(circleRespVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "发表社区动态")
|
||||||
|
@PreAuthenticated
|
||||||
|
public CommonResult<Boolean> createCircle(@RequestBody CircleSaveReqVO createReqVO){
|
||||||
|
String nickname = memberUserApi.getUser(getLoginUserId()).getNickname();
|
||||||
|
createReqVO.setUserId(getLoginUserId());
|
||||||
|
createReqVO.setNickname(nickname);
|
||||||
|
circleService.createCircle(createReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/doCircleUpdate")
|
||||||
|
@Operation(summary = "编辑社区动态")
|
||||||
|
@PreAuthenticated
|
||||||
|
public CommonResult<Boolean> updateCircle(@RequestBody CircleSaveReqVO updateReqVO){
|
||||||
|
String nickname = memberUserApi.getUser(getLoginUserId()).getNickname();
|
||||||
|
updateReqVO.setUserId(getLoginUserId());
|
||||||
|
updateReqVO.setNickname(nickname);
|
||||||
|
circleService.updateCircle(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/doBrowse")
|
||||||
@Operation(summary = "浏览量叠加")
|
@Operation(summary = "浏览量叠加")
|
||||||
@PreAuthenticated
|
@PreAuthenticated
|
||||||
public CommonResult<Boolean> doBrowse(@RequestParam("id") Long lookId){
|
public CommonResult<Boolean> doBrowse(@RequestParam("id") Long lookId){
|
||||||
@ -70,11 +108,11 @@ public class AppCircleController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/doLike")
|
@PutMapping("/doLike")
|
||||||
@Operation(summary = "点赞/取消点赞")
|
@Operation(summary = "点赞/取消点赞")
|
||||||
@PreAuthenticated
|
@PreAuthenticated
|
||||||
public CommonResult<Boolean> doLike(@RequestParam("id") Long lookId){
|
public CommonResult<Boolean> doLike(@RequestParam("id") Long lookId){
|
||||||
circleService.updateLikeCount(lookId);
|
circleService.updateLikeCount(lookId,getLoginUserId());
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +125,7 @@ public class AppCircleController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/doReviewDelete")
|
@DeleteMapping("/doReviewDelete")
|
||||||
@Operation(summary = "删除评论")
|
@Operation(summary = "删除评论")
|
||||||
@PreAuthenticated
|
@PreAuthenticated
|
||||||
public CommonResult<Boolean> doReviewDelete(@RequestParam("id") Long lookId){
|
public CommonResult<Boolean> doReviewDelete(@RequestParam("id") Long lookId){
|
||||||
@ -95,7 +133,7 @@ public class AppCircleController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/doCircleDelete")
|
@DeleteMapping("/doCircleDelete")
|
||||||
@Operation(summary = "删除动态")
|
@Operation(summary = "删除动态")
|
||||||
@PreAuthenticated
|
@PreAuthenticated
|
||||||
public CommonResult<Boolean> doCircleDelete(@RequestParam("id") Long lookId){
|
public CommonResult<Boolean> doCircleDelete(@RequestParam("id") Long lookId){
|
||||||
|
@ -7,6 +7,8 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|||||||
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.conversation.KeFuConversationRespVO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageListReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageRespVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageRespVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessagePageReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessagePageReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessageSendReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessageSendReqVO;
|
||||||
@ -15,17 +17,30 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO;
|
|||||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.supportstaff.SupportStaffDO;
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.supportstaff.SupportStaffDO;
|
||||||
import cn.iocoder.yudao.module.promotion.dal.mysql.kefu.KeFuConversationMapper;
|
import cn.iocoder.yudao.module.promotion.dal.mysql.kefu.KeFuConversationMapper;
|
||||||
import cn.iocoder.yudao.module.promotion.dal.mysql.supportstaff.SupportStaffMapper;
|
import cn.iocoder.yudao.module.promotion.dal.mysql.supportstaff.SupportStaffMapper;
|
||||||
|
import cn.iocoder.yudao.module.promotion.service.kefu.KeFuConversationService;
|
||||||
import cn.iocoder.yudao.module.promotion.service.kefu.KeFuMessageService;
|
import cn.iocoder.yudao.module.promotion.service.kefu.KeFuMessageService;
|
||||||
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.filterList;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen;
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
|
|
||||||
@Tag(name = "用户 APP - 客服消息")
|
@Tag(name = "用户 APP - 客服消息")
|
||||||
@ -46,12 +61,25 @@ public class AppKeFuMessageController {
|
|||||||
@Resource
|
@Resource
|
||||||
private SupportStaffMapper supportStaffMapper;
|
private SupportStaffMapper supportStaffMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeFuConversationService conversationService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AdminUserApi adminUserApi;
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/send")
|
@PostMapping("/send")
|
||||||
@Operation(summary = "发送客服消息")
|
@Operation(summary = "发送客服消息")
|
||||||
@PreAuthenticated
|
@PreAuthenticated
|
||||||
public CommonResult<Long> sendKefuMessage(@Valid @RequestBody AppKeFuMessageSendReqVO sendReqVO) {
|
public CommonResult<Long> sendKefuMessage(@Valid @RequestBody AppKeFuMessageSendReqVO sendReqVO) {
|
||||||
sendReqVO.setSenderId(getLoginUserId()).setSenderType(UserTypeEnum.MEMBER.getValue()); // 设置用户编号和类型
|
SupportStaffDO supportStaffDO = supportStaffMapper.selectOne(new LambdaQueryWrapper<SupportStaffDO>()
|
||||||
|
.eq(SupportStaffDO::getUserId, getLoginUserId()));
|
||||||
|
if (supportStaffDO != null && supportStaffDO.getStatus() == 1){
|
||||||
|
sendReqVO.setSenderId(Long.valueOf(supportStaffDO.getId())).setSenderType(UserTypeEnum.ADMIN.getValue()); // 设置用户编号和类型
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sendReqVO.setSenderId(getLoginUserId()).setSenderType(UserTypeEnum.MEMBER.getValue()); // 设置用户编号和类型
|
||||||
|
}
|
||||||
return success(kefuMessageService.sendKefuMessage(sendReqVO));
|
return success(kefuMessageService.sendKefuMessage(sendReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,4 +126,34 @@ public class AppKeFuMessageController {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/listCoversation")
|
||||||
|
@Operation(summary = "获得客服会话列表")
|
||||||
|
@PreAuthenticated
|
||||||
|
public CommonResult<List<KeFuConversationRespVO>> getConversationList() {
|
||||||
|
// 查询会话列表
|
||||||
|
List<KeFuConversationRespVO> respList = BeanUtils.toBean(conversationService.getKefuConversationList(null),
|
||||||
|
KeFuConversationRespVO.class);
|
||||||
|
|
||||||
|
// 拼接数据
|
||||||
|
Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(convertSet(respList, KeFuConversationRespVO::getUserId));
|
||||||
|
respList.forEach(item -> findAndThen(userMap, item.getUserId(),
|
||||||
|
memberUser -> item.setUserAvatar(memberUser.getAvatar()).setUserNickname(memberUser.getNickname())));
|
||||||
|
return success(respList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/listMessgaebyCoversation")
|
||||||
|
@Operation(summary = "获取聊天列表")
|
||||||
|
@PreAuthenticated
|
||||||
|
public CommonResult<List<KeFuMessageRespVO>> getKeFuMessageList(@Valid KeFuMessageListReqVO pageReqVO) {
|
||||||
|
// 获得数据
|
||||||
|
List<KeFuMessageDO> list = kefuMessageService.getKeFuMessageList(pageReqVO);
|
||||||
|
|
||||||
|
// 拼接数据
|
||||||
|
List<KeFuMessageRespVO> result = BeanUtils.toBean(list, KeFuMessageRespVO.class);
|
||||||
|
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertSet(filterList(result,
|
||||||
|
item -> UserTypeEnum.ADMIN.getValue().equals(item.getSenderType())), KeFuMessageRespVO::getSenderId));
|
||||||
|
result.forEach(item -> findAndThen(userMap, item.getSenderId(), user -> item.setSenderAvatar(user.getAvatar())));
|
||||||
|
return success(result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message;
|
package cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ -24,4 +25,11 @@ public class AppKeFuMessageSendReqVO {
|
|||||||
@Schema(description = "发送人类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1", hidden = true)
|
@Schema(description = "发送人类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1", hidden = true)
|
||||||
private Integer senderType;
|
private Integer senderType;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "接收人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "24571", hidden = true)
|
||||||
|
private Long receiverId;
|
||||||
|
|
||||||
|
@Schema(description = "接收人类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "24571", hidden = true)
|
||||||
|
private Integer receiverType;
|
||||||
|
|
||||||
}
|
}
|
@ -22,6 +22,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class CircleDO extends BaseDO {
|
public class CircleDO extends BaseDO {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编号
|
* 编号
|
||||||
*/
|
*/
|
||||||
@ -31,6 +32,10 @@ public class CircleDO extends BaseDO {
|
|||||||
* 用户编号
|
* 用户编号
|
||||||
*/
|
*/
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 用户编号
|
||||||
|
*/
|
||||||
|
private String nickname;
|
||||||
/**
|
/**
|
||||||
* 发表内容
|
* 发表内容
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
package cn.iocoder.yudao.module.promotion.dal.dataobject.circlelike;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城动态 DO
|
||||||
|
*
|
||||||
|
* @author 管理员
|
||||||
|
*/
|
||||||
|
@TableName("promotion_circle_like")
|
||||||
|
@KeySequence("promotion_circle_like_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CircleLikeDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编号
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户编号
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 种草id
|
||||||
|
*/
|
||||||
|
private Long circleId;
|
||||||
|
}
|
@ -68,4 +68,9 @@ public class SupportStaffDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private Integer lineStatus;
|
private Integer lineStatus;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 用户id
|
||||||
|
* */
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package cn.iocoder.yudao.module.promotion.dal.mysql.circlelike;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.circle.vo.CirclePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.circle.CircleDO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.circlelike.CircleLikeDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城动态 Mapper
|
||||||
|
*
|
||||||
|
* @author 管理员
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface CircleLikeMapper extends BaseMapperX<CircleLikeDO> {
|
||||||
|
|
||||||
|
}
|
@ -33,7 +33,7 @@ public interface CircleService {
|
|||||||
void addLookCount(Long circleId);
|
void addLookCount(Long circleId);
|
||||||
|
|
||||||
//点赞/取消点赞
|
//点赞/取消点赞
|
||||||
void updateLikeCount(Long circleId);
|
void updateLikeCount(Long circleId,Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除商城动态
|
* 删除商城动态
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.promotion.service.circle;
|
package cn.iocoder.yudao.module.promotion.service.circle;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.circlelike.CircleLikeDO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.service.circlelike.CircleLikeService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -29,6 +31,9 @@ public class CircleServiceImpl implements CircleService {
|
|||||||
@Resource
|
@Resource
|
||||||
private CircleMapper circleMapper;
|
private CircleMapper circleMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CircleLikeService circleLikeService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createCircle(CircleSaveReqVO createReqVO) {
|
public Long createCircle(CircleSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
@ -55,9 +60,20 @@ public class CircleServiceImpl implements CircleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateLikeCount(Long circleId) {
|
public void updateLikeCount(Long circleId,Long userId) {
|
||||||
CircleDO circleDO = circleMapper.selectOne("id", circleId);
|
CircleDO circleDO = circleMapper.selectOne("id", circleId);
|
||||||
circleDO.setLookCount(circleDO.getLikeCount() + 1);
|
CircleLikeDO circleLikeDO = circleLikeService.getCircleLike(circleId,userId);
|
||||||
|
if (circleLikeDO != null){
|
||||||
|
circleLikeService.deleteCircleLike(circleLikeDO.getId());
|
||||||
|
circleDO.setLikeCount(circleDO.getLikeCount() - 1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
circleDO.setLikeCount(circleDO.getLikeCount() + 1);
|
||||||
|
circleLikeDO = new CircleLikeDO();
|
||||||
|
circleLikeDO.setCircleId(circleId);
|
||||||
|
circleLikeDO.setUserId(userId);
|
||||||
|
circleLikeService.createCircleLike(circleLikeDO);
|
||||||
|
}
|
||||||
circleMapper.updateById(circleDO);
|
circleMapper.updateById(circleDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package cn.iocoder.yudao.module.promotion.service.circlelike;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.circle.vo.CirclePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.circle.vo.CircleSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.circle.CircleDO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.circlelike.CircleLikeDO;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城动态 Service 接口
|
||||||
|
*
|
||||||
|
* @author 管理员
|
||||||
|
*/
|
||||||
|
public interface CircleLikeService {
|
||||||
|
|
||||||
|
|
||||||
|
CircleLikeDO getCircleLike(Long circleId, Long userId);
|
||||||
|
|
||||||
|
void deleteCircleLike(Long id);
|
||||||
|
|
||||||
|
void createCircleLike(CircleLikeDO circleLikeDO);
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
package cn.iocoder.yudao.module.promotion.service.circlelike;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.circle.vo.CirclePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.circle.vo.CircleSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.circle.CircleDO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.circlelike.CircleLikeDO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.dal.mysql.circle.CircleMapper;
|
||||||
|
import cn.iocoder.yudao.module.promotion.dal.mysql.circlelike.CircleLikeMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.CIRCLE_NOT_EXISTS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商城动态 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 管理员
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class CircleLikeServiceImpl implements CircleLikeService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CircleLikeMapper circleLikeMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CircleLikeDO getCircleLike(Long circleId, Long userId) {
|
||||||
|
CircleLikeDO circleLikeDO = circleLikeMapper.selectOne(new LambdaQueryWrapper<CircleLikeDO>()
|
||||||
|
.eq(CircleLikeDO::getCircleId,circleId)
|
||||||
|
.eq(CircleLikeDO::getUserId,userId)
|
||||||
|
.eq(BaseDO::getDeleted,false));
|
||||||
|
return circleLikeDO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteCircleLike(Long id) {
|
||||||
|
circleLikeMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createCircleLike(CircleLikeDO circleLikeDO) {
|
||||||
|
circleLikeMapper.insert(circleLikeDO);
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,9 @@ package cn.iocoder.yudao.module.promotion.service.kefu;
|
|||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.conversation.KeFuConversationUpdatePinnedReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.conversation.KeFuConversationUpdatePinnedReqVO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.supportstaff.vo.SupportStaffPageReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuConversationDO;
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuConversationDO;
|
||||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO;
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO;
|
||||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.supportstaff.SupportStaffDO;
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.supportstaff.SupportStaffDO;
|
||||||
@ -100,13 +102,24 @@ public class KeFuConversationServiceImpl implements KeFuConversationService {
|
|||||||
@Override
|
@Override
|
||||||
public KeFuConversationDO getOrCreateConversation(Long userId) {
|
public KeFuConversationDO getOrCreateConversation(Long userId) {
|
||||||
KeFuConversationDO conversation = conversationMapper.selectOne(KeFuConversationDO::getUserId, userId);
|
KeFuConversationDO conversation = conversationMapper.selectOne(KeFuConversationDO::getUserId, userId);
|
||||||
|
//查询当前后台默认客服
|
||||||
|
Long kefuId = null;
|
||||||
|
SupportStaffPageReqVO vo = new SupportStaffPageReqVO();
|
||||||
|
vo.setStatus(1);
|
||||||
|
PageResult<SupportStaffDO> pageResult = supportStaffMapper.selectPage(vo);
|
||||||
|
if (null!=pageResult&&pageResult.getTotal()>=1)
|
||||||
|
kefuId=Long.valueOf(pageResult.getList().get(0).getId());
|
||||||
// 没有历史会话,则初始化一个新会话
|
// 没有历史会话,则初始化一个新会话
|
||||||
if (conversation == null) {
|
if (conversation == null) {
|
||||||
conversation = new KeFuConversationDO().setUserId(userId).setLastMessageTime(LocalDateTime.now())
|
conversation = new KeFuConversationDO().setUserId(userId).setLastMessageTime(LocalDateTime.now())
|
||||||
.setLastMessageContent(StrUtil.EMPTY).setLastMessageContentType(KeFuMessageContentTypeEnum.TEXT.getType())
|
.setLastMessageContent(StrUtil.EMPTY).setLastMessageContentType(KeFuMessageContentTypeEnum.TEXT.getType())
|
||||||
.setAdminPinned(Boolean.FALSE).setUserDeleted(Boolean.FALSE).setAdminDeleted(Boolean.FALSE)
|
.setAdminPinned(Boolean.FALSE).setUserDeleted(Boolean.FALSE).setAdminDeleted(Boolean.FALSE)
|
||||||
.setAdminUnreadMessageCount(0);
|
.setAdminUnreadMessageCount(0).setKefuId(kefuId);
|
||||||
conversationMapper.insert(conversation);
|
if (userId == null) {
|
||||||
|
conversation = null;
|
||||||
|
}else {
|
||||||
|
conversationMapper.insert(conversation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return conversation;
|
return conversation;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.promotion.service.kefu;
|
package cn.iocoder.yudao.module.promotion.service.kefu;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageListReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessagePageReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessagePageReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageSendReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageSendReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessagePageReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessagePageReqVO;
|
||||||
@ -8,6 +9,7 @@ import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuM
|
|||||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO;
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,4 +75,5 @@ public interface KeFuMessageService {
|
|||||||
*/
|
*/
|
||||||
Boolean getLatestMessageBySenderId(Integer senderId);
|
Boolean getLatestMessageBySenderId(Integer senderId);
|
||||||
|
|
||||||
|
List<KeFuMessageDO> getKeFuMessageList(KeFuMessageListReqVO pageReqVO);
|
||||||
}
|
}
|
@ -8,9 +8,12 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
||||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageListReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessagePageReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessagePageReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageSendReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageSendReqVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessagePageReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessagePageReqVO;
|
||||||
@ -29,6 +32,7 @@ import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|||||||
import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.notify.NotifyMessageMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.notify.NotifyMessageMapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -42,6 +46,7 @@ import java.util.concurrent.ConcurrentMap;
|
|||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
|
||||||
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.KEFU_CONVERSATION_NOT_EXISTS;
|
import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.KEFU_CONVERSATION_NOT_EXISTS;
|
||||||
import static cn.iocoder.yudao.module.promotion.enums.WebSocketMessageTypeConstants.KEFU_MESSAGE_ADMIN_READ;
|
import static cn.iocoder.yudao.module.promotion.enums.WebSocketMessageTypeConstants.KEFU_MESSAGE_ADMIN_READ;
|
||||||
import static cn.iocoder.yudao.module.promotion.enums.WebSocketMessageTypeConstants.KEFU_MESSAGE_TYPE;
|
import static cn.iocoder.yudao.module.promotion.enums.WebSocketMessageTypeConstants.KEFU_MESSAGE_TYPE;
|
||||||
@ -107,10 +112,27 @@ public class KeFuMessageServiceImpl implements KeFuMessageService {
|
|||||||
public Long sendKefuMessage(AppKeFuMessageSendReqVO sendReqVO) { //用户发消息
|
public Long sendKefuMessage(AppKeFuMessageSendReqVO sendReqVO) { //用户发消息
|
||||||
// 1.1 设置会话编号
|
// 1.1 设置会话编号
|
||||||
KeFuMessageDO kefuMessage = BeanUtils.toBean(sendReqVO, KeFuMessageDO.class);
|
KeFuMessageDO kefuMessage = BeanUtils.toBean(sendReqVO, KeFuMessageDO.class);
|
||||||
KeFuConversationDO conversation = conversationService.getOrCreateConversation(sendReqVO.getSenderId());
|
//判断是否是客服
|
||||||
|
SupportStaffDO staff = supportStaffMapper.selectOne(new LambdaUpdateWrapper<SupportStaffDO>()
|
||||||
|
.eq(SupportStaffDO::getUserId,getLoginUserId()));
|
||||||
|
//判断客服标志
|
||||||
|
int a = 0;
|
||||||
|
KeFuConversationDO conversation = new KeFuConversationDO();
|
||||||
|
if (staff != null && staff.getStatus() == 1){
|
||||||
|
conversation = conversationService.getOrCreateConversation(sendReqVO.getReceiverId());
|
||||||
|
if (conversation == null){
|
||||||
|
return 5L;
|
||||||
|
}
|
||||||
|
a = 1;
|
||||||
|
}else {
|
||||||
|
conversation = conversationService.getOrCreateConversation(sendReqVO.getSenderId());
|
||||||
|
kefuMessage.setReceiverId(conversation.getUserId()).setReceiverType(UserTypeEnum.MEMBER.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
// KeFuConversationDO conversation = conversationService.getOrCreateConversation(sendReqVO.getSenderId());
|
||||||
kefuMessage.setConversationId(conversation.getId());
|
kefuMessage.setConversationId(conversation.getId());
|
||||||
// 1.2 保存消息
|
// 1.2 保存消息
|
||||||
kefuMessage.setReceiverId(conversation.getKefuId()).setReceiverType(UserTypeEnum.ADMIN.getValue()); // 设置接收人
|
// kefuMessage.setReceiverId(conversation.getKefuId()).setReceiverType(UserTypeEnum.ADMIN.getValue()); // 设置接收人
|
||||||
keFuMessageMapper.insert(kefuMessage);
|
keFuMessageMapper.insert(kefuMessage);
|
||||||
|
|
||||||
// 2. 更新会话消息冗余
|
// 2. 更新会话消息冗余
|
||||||
@ -121,7 +143,7 @@ public class KeFuMessageServiceImpl implements KeFuMessageService {
|
|||||||
|
|
||||||
//判断客服是否在线,自动回复
|
//判断客服是否在线,自动回复
|
||||||
SupportStaffDO supportStaffDO = supportStaffMapper.selectOne("id", conversation.getKefuId());
|
SupportStaffDO supportStaffDO = supportStaffMapper.selectOne("id", conversation.getKefuId());
|
||||||
if (supportStaffDO.getLineStatus() == 2){ //离线
|
if (supportStaffDO.getLineStatus() == 2 && a == 0){ //离线
|
||||||
KeFuConfigurationDO type = keFuConfigurationMapper.selectOne("type", 1);
|
KeFuConfigurationDO type = keFuConfigurationMapper.selectOne("type", 1);
|
||||||
if (type != null){ //是否配置了客服不在线回复
|
if (type != null){ //是否配置了客服不在线回复
|
||||||
if (type.getFeedback() != null){
|
if (type.getFeedback() != null){
|
||||||
@ -140,7 +162,10 @@ public class KeFuMessageServiceImpl implements KeFuMessageService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//判断是否是客服
|
||||||
|
if (null!=staff&&staff.getStatus()==1) {
|
||||||
|
getSelf().sendAsyncMessageToMember(sendReqVO.getReceiverId(), KEFU_MESSAGE_TYPE, kefuMessage);
|
||||||
|
}
|
||||||
// 3. 通知所有管理员更新对话
|
// 3. 通知所有管理员更新对话
|
||||||
getSelf().sendAsyncMessageToAdmin(KEFU_MESSAGE_TYPE, kefuMessage);
|
getSelf().sendAsyncMessageToAdmin(KEFU_MESSAGE_TYPE, kefuMessage);
|
||||||
return kefuMessage.getId();
|
return kefuMessage.getId();
|
||||||
@ -227,6 +252,11 @@ public class KeFuMessageServiceImpl implements KeFuMessageService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<KeFuMessageDO> getKeFuMessagePage(AppKeFuMessagePageReqVO pageReqVO, Long userId) {
|
public PageResult<KeFuMessageDO> getKeFuMessagePage(AppKeFuMessagePageReqVO pageReqVO, Long userId) {
|
||||||
|
//判断是否是客服
|
||||||
|
SupportStaffDO staff = supportStaffMapper.selectOne((new LambdaQueryWrapperX<SupportStaffDO>()
|
||||||
|
.eq(SupportStaffDO::getUserId, userId)));
|
||||||
|
if (null==staff) {
|
||||||
|
// conversationService.getConversation(pageReqVO.getConversationId());
|
||||||
// 1. 获得客服会话
|
// 1. 获得客服会话
|
||||||
KeFuConversationDO conversation = conversationService.getConversationByUserId(userId);
|
KeFuConversationDO conversation = conversationService.getConversationByUserId(userId);
|
||||||
if (conversation == null) {
|
if (conversation == null) {
|
||||||
@ -234,6 +264,7 @@ public class KeFuMessageServiceImpl implements KeFuMessageService {
|
|||||||
}
|
}
|
||||||
// 2. 设置会话编号
|
// 2. 设置会话编号
|
||||||
pageReqVO.setConversationId(conversation.getId());
|
pageReqVO.setConversationId(conversation.getId());
|
||||||
|
}
|
||||||
return keFuMessageMapper.selectPage(pageReqVO);
|
return keFuMessageMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,4 +286,13 @@ public class KeFuMessageServiceImpl implements KeFuMessageService {
|
|||||||
return SpringUtil.getBean(getClass());
|
return SpringUtil.getBean(getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<KeFuMessageDO> getKeFuMessageList(KeFuMessageListReqVO pageReqVO) {
|
||||||
|
return keFuMessageMapper.selectList(new QueryWrapperX<KeFuMessageDO>()
|
||||||
|
.eqIfPresent("conversation_id",pageReqVO.getConversationId())
|
||||||
|
.ltIfPresent("create_time",pageReqVO.getCreateTime())
|
||||||
|
.orderByDesc("create_time")
|
||||||
|
.limitN(pageReqVO.getLimit()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -55,4 +55,5 @@ public interface SupportStaffService {
|
|||||||
*/
|
*/
|
||||||
void updateLineStatus(String id , Integer lineStatus );
|
void updateLineStatus(String id , Integer lineStatus );
|
||||||
|
|
||||||
|
SupportStaffDO getSupportStaffByUserId(Long userId);
|
||||||
}
|
}
|
@ -8,6 +8,9 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.supportstaff.SupportStaf
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.module.promotion.dal.mysql.supportstaff.SupportStaffMapper;
|
import cn.iocoder.yudao.module.promotion.dal.mysql.supportstaff.SupportStaffMapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.*;
|
import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
@ -27,6 +30,12 @@ public class SupportStaffServiceImpl implements SupportStaffService {
|
|||||||
public Integer createSupportStaff(SupportStaffSaveReqVO createReqVO) {
|
public Integer createSupportStaff(SupportStaffSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
SupportStaffDO supportStaff = BeanUtils.toBean(createReqVO, SupportStaffDO.class);
|
SupportStaffDO supportStaff = BeanUtils.toBean(createReqVO, SupportStaffDO.class);
|
||||||
|
if(supportStaff.getUserId() != null){
|
||||||
|
SupportStaffDO staffDO = supportStaffMapper.selectOne("user_id", supportStaff.getUserId());
|
||||||
|
if(staffDO != null){
|
||||||
|
throw exception(SUPPORT_STAFF_USER_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
supportStaff.setLineStatus(2);
|
supportStaff.setLineStatus(2);
|
||||||
supportStaffMapper.insert(supportStaff);
|
supportStaffMapper.insert(supportStaff);
|
||||||
// 返回
|
// 返回
|
||||||
@ -39,6 +48,17 @@ public class SupportStaffServiceImpl implements SupportStaffService {
|
|||||||
validateSupportStaffExists(updateReqVO.getId());
|
validateSupportStaffExists(updateReqVO.getId());
|
||||||
// 更新
|
// 更新
|
||||||
SupportStaffDO updateObj = BeanUtils.toBean(updateReqVO, SupportStaffDO.class);
|
SupportStaffDO updateObj = BeanUtils.toBean(updateReqVO, SupportStaffDO.class);
|
||||||
|
|
||||||
|
SupportStaffDO supportStaffDO = supportStaffMapper.selectOne("id", updateReqVO.getId());
|
||||||
|
//判断用户是否被绑定
|
||||||
|
if (updateObj.getUserId() != null){
|
||||||
|
if (supportStaffDO.getUserId() == null || !supportStaffDO.getUserId().equals(updateObj.getUserId())){
|
||||||
|
SupportStaffDO staffDO = supportStaffMapper.selectOne("user_id", updateObj.getUserId());
|
||||||
|
if(staffDO != null){
|
||||||
|
throw exception(SUPPORT_STAFF_USER_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
supportStaffMapper.updateById(updateObj);
|
supportStaffMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,4 +93,9 @@ public class SupportStaffServiceImpl implements SupportStaffService {
|
|||||||
supportStaffMapper.updateById(supportStaffDO);
|
supportStaffMapper.updateById(supportStaffDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SupportStaffDO getSupportStaffByUserId(Long userId) {
|
||||||
|
return supportStaffMapper.selectOne("user_id", userId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,16 +1,25 @@
|
|||||||
package cn.iocoder.yudao.module.trade.controller.admin.brokerage;
|
package cn.iocoder.yudao.module.trade.controller.admin.brokerage;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.yudao.module.agent.enums.api.agentinfo.AgentInfoApi;
|
||||||
|
import cn.iocoder.yudao.module.agent.enums.api.agentinfo.dto.AgentInfoRespDTO;
|
||||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
import cn.iocoder.yudao.module.pay.api.notify.dto.PayTransferNotifyReqDTO;
|
import cn.iocoder.yudao.module.pay.api.notify.dto.PayTransferNotifyReqDTO;
|
||||||
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageSupplyInfoRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawRejectReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawRejectReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawPageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawRespVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.convert.brokerage.BrokerageWithdrawConvert;
|
import cn.iocoder.yudao.module.trade.convert.brokerage.BrokerageWithdrawConvert;
|
||||||
|
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageWithdrawDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageWithdrawDO;
|
||||||
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum;
|
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum;
|
||||||
|
import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageUserService;
|
||||||
import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageWithdrawService;
|
import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageWithdrawService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
@ -22,11 +31,18 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.annotation.security.PermitAll;
|
import javax.annotation.security.PermitAll;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 佣金提现")
|
@Tag(name = "管理后台 - 佣金提现")
|
||||||
@RestController
|
@RestController
|
||||||
@ -41,6 +57,12 @@ public class BrokerageWithdrawController {
|
|||||||
@Resource
|
@Resource
|
||||||
private MemberUserApi memberUserApi;
|
private MemberUserApi memberUserApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AgentInfoApi agentInfoApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BrokerageUserService brokerageUserService;
|
||||||
|
|
||||||
@PutMapping("/approve")
|
@PutMapping("/approve")
|
||||||
@Operation(summary = "通过申请")
|
@Operation(summary = "通过申请")
|
||||||
@PreAuthorize("@ss.hasPermission('trade:brokerage-withdraw:audit')")
|
@PreAuthorize("@ss.hasPermission('trade:brokerage-withdraw:audit')")
|
||||||
@ -73,10 +95,12 @@ public class BrokerageWithdrawController {
|
|||||||
// 分页查询
|
// 分页查询
|
||||||
PageResult<BrokerageWithdrawDO> pageResult = brokerageWithdrawService.getBrokerageWithdrawPage(pageVO);
|
PageResult<BrokerageWithdrawDO> pageResult = brokerageWithdrawService.getBrokerageWithdrawPage(pageVO);
|
||||||
|
|
||||||
|
Set<Long> userIds = convertSet(pageResult.getList(), BrokerageWithdrawDO::getUserId);
|
||||||
// 拼接信息
|
// 拼接信息
|
||||||
Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(
|
Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(
|
||||||
convertSet(pageResult.getList(), BrokerageWithdrawDO::getUserId));
|
convertSet(pageResult.getList(), BrokerageWithdrawDO::getUserId));
|
||||||
return success(BrokerageWithdrawConvert.INSTANCE.convertPage(pageResult, userMap));
|
Map<Long, BrokerageWithdrawRespVO> brokerageWithdrawMap = brokerageWithdrawService.getBrokerageWithdrawMap(userIds);
|
||||||
|
return success(BrokerageWithdrawConvert.INSTANCE.convertPage(pageResult, userMap,brokerageWithdrawMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @luchi:update-transferred,url 改成这个。和 update-paid 、update-refunded 保持一致
|
// TODO @luchi:update-transferred,url 改成这个。和 update-paid 、update-refunded 保持一致
|
||||||
@ -91,4 +115,123 @@ public class BrokerageWithdrawController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/get-supply-info")
|
||||||
|
@Operation(summary = "获得申请结算信息")
|
||||||
|
@PreAuthorize("@ss.hasPermission('trade:brokerage-withdraw:query')")
|
||||||
|
public CommonResult<BrokerageSupplyInfoRespVO> getBrokerageSupplyInfo() {
|
||||||
|
Long sysUserId = getLoginUserId();
|
||||||
|
AgentInfoRespDTO agentInfoRespDTO = agentInfoApi.getInfoBySysUserId(sysUserId);
|
||||||
|
BrokerageSupplyInfoRespVO brokerageSupplyInfoRespVO = new BrokerageSupplyInfoRespVO();
|
||||||
|
if(agentInfoRespDTO != null && agentInfoRespDTO.getUserId() != null){
|
||||||
|
MemberUserRespDTO memberUserRespDTO = memberUserApi.getUser(agentInfoRespDTO.getUserId());
|
||||||
|
BrokerageUserDO brokerageUserDO = brokerageUserService.getBrokerageUser(agentInfoRespDTO.getUserId());
|
||||||
|
if(memberUserRespDTO != null && brokerageUserDO != null){
|
||||||
|
//设置代理商信息
|
||||||
|
brokerageSupplyInfoRespVO.setUserId(agentInfoRespDTO.getUserId());
|
||||||
|
brokerageSupplyInfoRespVO.setAgentId(agentInfoRespDTO.getId());
|
||||||
|
brokerageSupplyInfoRespVO.setAgentName(agentInfoRespDTO.getAgentName());
|
||||||
|
brokerageSupplyInfoRespVO.setBankName(agentInfoRespDTO.getBankName());
|
||||||
|
brokerageSupplyInfoRespVO.setBankCardNo(agentInfoRespDTO.getBankCardNo());
|
||||||
|
brokerageSupplyInfoRespVO.setWechatAccountQrCodeUrl(agentInfoRespDTO.getWechatAccountQrCodeUrl());
|
||||||
|
brokerageSupplyInfoRespVO.setWechatAccount(agentInfoRespDTO.getWechatAccount());
|
||||||
|
brokerageSupplyInfoRespVO.setAlipayAccountQrCodeUrl(agentInfoRespDTO.getAlipayAccountQrCodeUrl());
|
||||||
|
brokerageSupplyInfoRespVO.setAlipayAccount(agentInfoRespDTO.getAlipayAccount());
|
||||||
|
|
||||||
|
//设置用户信息
|
||||||
|
brokerageSupplyInfoRespVO.setRealName(memberUserRespDTO.getName());
|
||||||
|
|
||||||
|
//设置分销用户信息
|
||||||
|
brokerageSupplyInfoRespVO.setBrokeragePrice(brokerageUserDO.getBrokeragePrice());
|
||||||
|
brokerageSupplyInfoRespVO.setFrozenPrice(brokerageUserDO.getFrozenPrice());
|
||||||
|
Integer agentPrice = brokerageUserDO.getBrokeragePrice() + brokerageUserDO.getFrozenPrice();
|
||||||
|
brokerageSupplyInfoRespVO.setAgentPrice(agentPrice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return success(brokerageSupplyInfoRespVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/create-supply")
|
||||||
|
@Operation(summary = "结算申请")
|
||||||
|
@PreAuthorize("@ss.hasPermission('trade:brokerage-withdraw:create')")
|
||||||
|
public CommonResult<Long> createBrokerageWithdraw(@Valid @RequestBody BrokerageSupplyInfoRespVO reqVO) {
|
||||||
|
if (reqVO.getUserId() == null){
|
||||||
|
return error(400, "当前用户未绑定代理商");
|
||||||
|
}
|
||||||
|
if(reqVO.getAgentPrice() != null && reqVO.getAgentPrice() <= 0){
|
||||||
|
return error(400, "代理商佣金不足");
|
||||||
|
}
|
||||||
|
if(reqVO.getBrokeragePrice() != null && reqVO.getSupplyPrice() > reqVO.getBrokeragePrice()){
|
||||||
|
return error(400, "提现金额不能大于可用佣金");
|
||||||
|
}
|
||||||
|
BrokerageWithdrawDO brokerageWithdrawDO = new BrokerageWithdrawDO();
|
||||||
|
brokerageWithdrawDO.setUserId(reqVO.getUserId());
|
||||||
|
|
||||||
|
brokerageWithdrawDO.setPrice(reqVO.getSupplyPrice());
|
||||||
|
brokerageWithdrawDO.setTotalPrice(reqVO.getAgentPrice());
|
||||||
|
brokerageWithdrawDO.setType(reqVO.getClosingType());
|
||||||
|
//代理商信息
|
||||||
|
brokerageWithdrawDO.setAgentId(reqVO.getAgentId());
|
||||||
|
brokerageWithdrawDO.setAgentName(reqVO.getAgentName());
|
||||||
|
brokerageWithdrawDO.setName(reqVO.getRealName() != null ? reqVO.getRealName() : "");
|
||||||
|
brokerageWithdrawDO.setBankName(reqVO.getBankName() != null ? reqVO.getBankName() : "");
|
||||||
|
|
||||||
|
//银行
|
||||||
|
if(reqVO.getClosingType() == 2){
|
||||||
|
brokerageWithdrawDO.setAccountNo(reqVO.getBankCardNo());
|
||||||
|
}
|
||||||
|
//微信
|
||||||
|
else if(reqVO.getClosingType() == 3){
|
||||||
|
brokerageWithdrawDO.setAccountNo(reqVO.getWechatAccount());
|
||||||
|
brokerageWithdrawDO.setAccountQrCodeUrl(reqVO.getWechatAccountQrCodeUrl());
|
||||||
|
}
|
||||||
|
//支付宝
|
||||||
|
else if(reqVO.getClosingType() == 4){
|
||||||
|
brokerageWithdrawDO.setAccountNo(reqVO.getAlipayAccount());
|
||||||
|
brokerageWithdrawDO.setAccountQrCodeUrl(reqVO.getAlipayAccountQrCodeUrl());
|
||||||
|
}
|
||||||
|
brokerageWithdrawDO.setStatus(0);
|
||||||
|
brokerageWithdrawDO.setRemark(reqVO.getRemark() != null ? reqVO.getRemark() : "");
|
||||||
|
|
||||||
|
Long id = brokerageWithdrawService.createSupply(brokerageWithdrawDO);
|
||||||
|
return success(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 导出佣金提现
|
||||||
|
* */
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出结算管理 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('trade:brokerage-withdraw:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportBrokerageWithdrawExcel(@Valid BrokerageWithdrawPageReqVO pageVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
/* List<AdminUserRespDTO> list = adminUserApi.getAdminUserByCode("super_admin");
|
||||||
|
List<AdminUserRespDTO> users = adminUserApi.getAdminUserByCode("dfhg");
|
||||||
|
Long userId = getLoginUserId();
|
||||||
|
AgentInfoRespDTO agentInfoRespDTO = new AgentInfoRespDTO();
|
||||||
|
if(!list.get(0).getId().equals(userId) && !users.get(0).getId().equals(userId)){
|
||||||
|
agentInfoRespDTO = agentInfoApi.getInfoBySysUserId(userId);
|
||||||
|
if(agentInfoRespDTO != null && agentInfoRespDTO.getUserId() != null){
|
||||||
|
pageVO.setUserId(agentInfoRespDTO.getUserId());
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
// 分页查询
|
||||||
|
PageResult<BrokerageWithdrawDO> pageResult = brokerageWithdrawService.getBrokerageWithdrawPage(pageVO);
|
||||||
|
|
||||||
|
Set<Long> userIds = convertSet(pageResult.getList(), BrokerageWithdrawDO::getUserId);
|
||||||
|
// 拼接信息
|
||||||
|
Map<Long, MemberUserRespDTO> userMap = memberUserApi.getUserMap(
|
||||||
|
convertSet(pageResult.getList(), BrokerageWithdrawDO::getUserId));
|
||||||
|
Map<Long, BrokerageWithdrawRespVO> brokerageWithdrawMap = brokerageWithdrawService.getBrokerageWithdrawMap(userIds);
|
||||||
|
PageResult<BrokerageWithdrawRespVO> page = BrokerageWithdrawConvert.INSTANCE.convertPage(pageResult, userMap,brokerageWithdrawMap);
|
||||||
|
/*if(agentInfoRespDTO == null && !list.get(0).getId().equals(userId) && !users.get(0).getId().equals(userId)){
|
||||||
|
page = new PageResult<>();
|
||||||
|
}*/
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "提现审核.xls", "数据", BrokerageWithdrawRespVO.class,
|
||||||
|
page.getList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,61 @@
|
|||||||
|
package cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BrokerageSupplyInfoRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "用户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "代理商余额", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161")
|
||||||
|
private Integer agentPrice;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "可用佣金", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161")
|
||||||
|
private Integer brokeragePrice;
|
||||||
|
/**
|
||||||
|
* 冻结佣金
|
||||||
|
*/
|
||||||
|
@Schema(description = "冻结佣金", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161")
|
||||||
|
private Integer frozenPrice;
|
||||||
|
|
||||||
|
@Schema(description = "代理商id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161")
|
||||||
|
private Long agentId;
|
||||||
|
|
||||||
|
@Schema(description = "代理商名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161")
|
||||||
|
private String agentName;
|
||||||
|
|
||||||
|
@Schema(description = "结算类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161")
|
||||||
|
private Integer closingType;
|
||||||
|
|
||||||
|
@Schema(description = "微信收款二维码", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161")
|
||||||
|
private String wechatAccountQrCodeUrl;
|
||||||
|
|
||||||
|
@Schema(description = "支付宝收款二维码", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161")
|
||||||
|
private String alipayAccountQrCodeUrl;
|
||||||
|
|
||||||
|
@Schema(description = "微信账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161")
|
||||||
|
private String wechatAccount;
|
||||||
|
|
||||||
|
@Schema(description = "支付宝账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161")
|
||||||
|
private String alipayAccount;
|
||||||
|
|
||||||
|
@Schema(description = "开户行", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161")
|
||||||
|
private String bankName;
|
||||||
|
|
||||||
|
@Schema(description = "银行卡号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161")
|
||||||
|
private String bankCardNo;
|
||||||
|
|
||||||
|
@Schema(description = "真实姓名", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161")
|
||||||
|
private String realName;
|
||||||
|
|
||||||
|
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "提现金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "7161")
|
||||||
|
private Integer supplyPrice;
|
||||||
|
|
||||||
|
}
|
@ -66,14 +66,14 @@ public class BrokerageWithdrawBaseVO {
|
|||||||
@Schema(description = "备注", example = "随便")
|
@Schema(description = "备注", example = "随便")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
/* @Schema(description = "代理商id", example = "1")
|
@Schema(description = "代理商id", example = "1")
|
||||||
private Long agentId;
|
private Long agentId;
|
||||||
|
|
||||||
@Schema(description = "代理商名称", example = "谁便")
|
@Schema(description = "代理商名称", example = "谁便")
|
||||||
@ExcelProperty("代理商名称")
|
@ExcelProperty("代理商名称")
|
||||||
private String agentName;
|
private String agentName;
|
||||||
|
|
||||||
@Schema(description = "凭证", example = "谁便")
|
/* @Schema(description = "凭证", example = "谁便")
|
||||||
@ExcelProperty("凭证")
|
@ExcelProperty("凭证")
|
||||||
private String voucher;*/
|
private String voucher;*/
|
||||||
|
|
||||||
|
@ -55,4 +55,10 @@ public class AppTradeOrderPageItemRespVO {
|
|||||||
@Schema(description = "拼团记录编号", example = "100")
|
@Schema(description = "拼团记录编号", example = "100")
|
||||||
private Long combinationRecordId;
|
private Long combinationRecordId;
|
||||||
|
|
||||||
|
@Schema(description = "代理商id", example = "25514")
|
||||||
|
private Long agentId;
|
||||||
|
|
||||||
|
@Schema(description = "发票状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Integer invoiceStatus;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -58,4 +58,8 @@ public class AppTradeOrderItemRespVO {
|
|||||||
@Schema(description = "售后状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "售后状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
private Integer afterSaleStatus;
|
private Integer afterSaleStatus;
|
||||||
|
|
||||||
|
@Schema(description = "代理商id", example = "25514")
|
||||||
|
private Long agentId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,16 @@ public interface BrokerageWithdrawConvert {
|
|||||||
|
|
||||||
PageResult<BrokerageWithdrawRespVO> convertPage(PageResult<BrokerageWithdrawDO> page);
|
PageResult<BrokerageWithdrawRespVO> convertPage(PageResult<BrokerageWithdrawDO> page);
|
||||||
|
|
||||||
default PageResult<BrokerageWithdrawRespVO> convertPage(PageResult<BrokerageWithdrawDO> pageResult, Map<Long, MemberUserRespDTO> userMap) {
|
default PageResult<BrokerageWithdrawRespVO> convertPage(PageResult<BrokerageWithdrawDO> pageResult,
|
||||||
|
Map<Long, MemberUserRespDTO> userMap,
|
||||||
|
Map<Long,BrokerageWithdrawRespVO> broMap) {
|
||||||
PageResult<BrokerageWithdrawRespVO> result = convertPage(pageResult);
|
PageResult<BrokerageWithdrawRespVO> result = convertPage(pageResult);
|
||||||
for (BrokerageWithdrawRespVO vo : result.getList()) {
|
for (BrokerageWithdrawRespVO vo : result.getList()) {
|
||||||
vo.setUserNickname(Optional.ofNullable(userMap.get(vo.getUserId())).map(MemberUserRespDTO::getNickname).orElse(null));
|
vo.setUserNickname(Optional.ofNullable(userMap.get(vo.getUserId())).map(MemberUserRespDTO::getNickname).orElse(null));
|
||||||
|
Optional.ofNullable(broMap.get(vo.getUserId())).ifPresent(brokerageWithdrawRespVO -> {
|
||||||
|
vo.setAgentId(brokerageWithdrawRespVO.getAgentId());
|
||||||
|
vo.setAgentName(brokerageWithdrawRespVO.getAgentName());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -123,4 +123,14 @@ public class BrokerageWithdrawDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private String transferStatus;
|
private String transferStatus;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 代理商id
|
||||||
|
* */
|
||||||
|
private Long agentId;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 代理商名称
|
||||||
|
* */
|
||||||
|
private String agentName;
|
||||||
}
|
}
|
||||||
|
@ -177,6 +177,11 @@ public class TradeOrderItemDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private Integer afterSaleStatus;
|
private Integer afterSaleStatus;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 代理商户id
|
||||||
|
* */
|
||||||
|
private Long agentId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品属性
|
* 商品属性
|
||||||
*/
|
*/
|
||||||
|
@ -9,6 +9,7 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
|
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
@ -27,6 +28,7 @@ import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageEnabledConditionEn
|
|||||||
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum;
|
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum;
|
||||||
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordStatusEnum;
|
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordStatusEnum;
|
||||||
import cn.iocoder.yudao.module.trade.service.config.TradeConfigService;
|
import cn.iocoder.yudao.module.trade.service.config.TradeConfigService;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -412,7 +414,8 @@ public class BrokerageUserServiceImpl implements BrokerageUserService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Long> getBrokerageUserIds() {
|
public List<Long> getBrokerageUserIds() {
|
||||||
List<Long> list = brokerageUserMapper.selectList().stream().map(BrokerageUserDO::getId).collect(Collectors.toList());
|
List<Long> list = brokerageUserMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<BrokerageUserDO>().eq(BaseDO::getDeleted,false)).stream().map(BrokerageUserDO::getId).collect(Collectors.toList());
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.trade.service.brokerage;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.withdraw.AppBrokerageWithdrawCreateReqVO;
|
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.withdraw.AppBrokerageWithdrawCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageWithdrawDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageWithdrawDO;
|
||||||
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum;
|
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageWithdrawStatusEnum;
|
||||||
@ -78,4 +79,8 @@ public interface BrokerageWithdrawService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void updateBrokerageWithdrawTransferred(Long id, Long payTransferId);
|
void updateBrokerageWithdrawTransferred(Long id, Long payTransferId);
|
||||||
|
|
||||||
|
Map<Long, BrokerageWithdrawRespVO> getBrokerageWithdrawMap(Set<Long> userIds);
|
||||||
|
|
||||||
|
Long createSupply(BrokerageWithdrawDO brokerageWithdrawDO);
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
|
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
|
||||||
|
import cn.iocoder.yudao.module.agent.enums.api.agentinfo.AgentInfoApi;
|
||||||
|
import cn.iocoder.yudao.module.agent.enums.api.agentinfo.dto.AgentInfoRespDTO;
|
||||||
import cn.iocoder.yudao.module.pay.api.transfer.PayTransferApi;
|
import cn.iocoder.yudao.module.pay.api.transfer.PayTransferApi;
|
||||||
import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferCreateReqDTO;
|
import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferRespDTO;
|
import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferRespDTO;
|
||||||
@ -21,6 +23,7 @@ import cn.iocoder.yudao.module.system.api.social.SocialUserApi;
|
|||||||
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO;
|
import cn.iocoder.yudao.module.system.api.social.dto.SocialUserRespDTO;
|
||||||
import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
|
import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.withdraw.BrokerageWithdrawRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.withdraw.AppBrokerageWithdrawCreateReqVO;
|
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.withdraw.AppBrokerageWithdrawCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.convert.brokerage.BrokerageWithdrawConvert;
|
import cn.iocoder.yudao.module.trade.convert.brokerage.BrokerageWithdrawConvert;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageWithdrawDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageWithdrawDO;
|
||||||
@ -41,10 +44,7 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Validator;
|
import javax.validation.Validator;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
|
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||||
@ -86,6 +86,9 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService {
|
|||||||
@Resource
|
@Resource
|
||||||
private PayTransferApi payTransferApi;
|
private PayTransferApi payTransferApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AgentInfoApi agentInfoApi;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void auditBrokerageWithdraw(Integer id, BrokerageWithdrawStatusEnum status, String auditReason) {
|
public void auditBrokerageWithdraw(Integer id, BrokerageWithdrawStatusEnum status, String auditReason) {
|
||||||
@ -270,5 +273,32 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService {
|
|||||||
return tradeConfig;
|
return tradeConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, BrokerageWithdrawRespVO> getBrokerageWithdrawMap(Set<Long> userIds) {
|
||||||
|
if (CollUtil.isEmpty(userIds)){
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
|
Map<Long, BrokerageWithdrawRespVO> brokerageWithdrawMap = new HashMap<>();
|
||||||
|
for (Long userId : userIds){
|
||||||
|
AgentInfoRespDTO agentInfoRespDTO = agentInfoApi.getAgentByUserId(userId);
|
||||||
|
BrokerageWithdrawRespVO brokerageWithdrawRespVO = new BrokerageWithdrawRespVO();
|
||||||
|
brokerageWithdrawRespVO.setUserId(userId);
|
||||||
|
if(agentInfoRespDTO != null){
|
||||||
|
brokerageWithdrawRespVO.setAgentId(agentInfoRespDTO.getId());
|
||||||
|
brokerageWithdrawRespVO. setAgentName(agentInfoRespDTO.getAgentName());
|
||||||
|
}
|
||||||
|
brokerageWithdrawMap.put(userId,brokerageWithdrawRespVO);
|
||||||
|
}
|
||||||
|
return brokerageWithdrawMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createSupply(BrokerageWithdrawDO brokerageWithdrawDO) {
|
||||||
|
if (brokerageWithdrawDO != null){
|
||||||
|
brokerageWithdrawMapper.insert(brokerageWithdrawDO);
|
||||||
|
}
|
||||||
|
return brokerageWithdrawDO.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,4 +31,16 @@ public class MemberConfigBaseVO {
|
|||||||
@Schema(description = "积分协议内容", example = "100")
|
@Schema(description = "积分协议内容", example = "100")
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
|
@Schema(description = "分享得积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||||
|
@NotNull(message = "分享得积分")
|
||||||
|
private Integer pointTradeSharePoint;
|
||||||
|
|
||||||
|
@Schema(description = "好评得积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||||
|
@NotNull(message = "好评得积分")
|
||||||
|
private Integer pointTradeGoodcommentPoint;
|
||||||
|
|
||||||
|
@Schema(description = "推广得积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
|
||||||
|
@NotNull(message = "推广得积分")
|
||||||
|
private Integer pointTradePromotionPoint;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,8 @@ import cn.iocoder.yudao.module.member.service.transfer.TransferService;
|
|||||||
import cn.iocoder.yudao.module.member.service.transferlog.TransferLogService;
|
import cn.iocoder.yudao.module.member.service.transferlog.TransferLogService;
|
||||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||||
import cn.iocoder.yudao.module.member.service.user.PaidMemberUserService;
|
import cn.iocoder.yudao.module.member.service.user.PaidMemberUserService;
|
||||||
|
import cn.iocoder.yudao.module.promotion.api.kefu.SupportStaffApi;
|
||||||
|
import cn.iocoder.yudao.module.promotion.api.kefu.dto.SupportStaffDTO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO;
|
||||||
import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageUserService;
|
import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageUserService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@ -82,6 +84,9 @@ public class AppMemberUserController {
|
|||||||
private MemberCodeMapper memberCodeMapper;
|
private MemberCodeMapper memberCodeMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private PaidMemberUserService paidMemberUserService;
|
private PaidMemberUserService paidMemberUserService;
|
||||||
|
@Resource
|
||||||
|
private SupportStaffApi supportStaffApi;
|
||||||
|
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "获得基本信息")
|
@Operation(summary = "获得基本信息")
|
||||||
@PreAuthenticated
|
@PreAuthenticated
|
||||||
@ -89,10 +94,27 @@ public class AppMemberUserController {
|
|||||||
MemberUserDO user = userService.getUser(getLoginUserId());
|
MemberUserDO user = userService.getUser(getLoginUserId());
|
||||||
MemberLevelDO level = levelService.getLevel(user.getLevelId());
|
MemberLevelDO level = levelService.getLevel(user.getLevelId());
|
||||||
PaidMemberUserDO paidMemberUserDO = paidMemberUserService.getPaidMemberUserByUid(getLoginUserId());
|
PaidMemberUserDO paidMemberUserDO = paidMemberUserService.getPaidMemberUserByUid(getLoginUserId());
|
||||||
|
AppMemberUserInfoRespVO appMemberUserInfoRespVO = new AppMemberUserInfoRespVO();
|
||||||
|
//判断是否是客服
|
||||||
|
SupportStaffDTO supportStaffDTO = supportStaffApi.getUserIsSupportStaff(getLoginUserId());
|
||||||
if (paidMemberUserDO == null) {
|
if (paidMemberUserDO == null) {
|
||||||
return success(MemberUserConvert.INSTANCE.convert(user, level,null,null));
|
appMemberUserInfoRespVO = MemberUserConvert.INSTANCE.convert(user, level,null,null);
|
||||||
|
if (null!=supportStaffDTO&&supportStaffDTO.getStatus()==1) {
|
||||||
|
appMemberUserInfoRespVO.setIdKefu(true);
|
||||||
|
appMemberUserInfoRespVO.setKefuPic(supportStaffDTO.getPic());
|
||||||
|
appMemberUserInfoRespVO.setUnreadCount(supportStaffApi.getUnredCount());
|
||||||
|
}
|
||||||
|
return success(appMemberUserInfoRespVO);
|
||||||
|
// return success(MemberUserConvert.INSTANCE.convert(user, level,null,null));
|
||||||
}
|
}
|
||||||
return success(MemberUserConvert.INSTANCE.convert(user, level,paidMemberUserDO.getPayMemberType(),paidMemberUserDO.getCardExpirationTime()));
|
appMemberUserInfoRespVO = MemberUserConvert.INSTANCE.convert(user, level,paidMemberUserDO.getPayMemberType(),paidMemberUserDO.getCardExpirationTime());
|
||||||
|
if (null!=supportStaffDTO&&supportStaffDTO.getStatus()==1) {
|
||||||
|
appMemberUserInfoRespVO.setIdKefu(true);
|
||||||
|
appMemberUserInfoRespVO.setKefuPic(supportStaffDTO.getPic());
|
||||||
|
appMemberUserInfoRespVO.setUnreadCount(supportStaffApi.getUnredCount());
|
||||||
|
}
|
||||||
|
return success(appMemberUserInfoRespVO);
|
||||||
|
// return success(MemberUserConvert.INSTANCE.convert(user, level,paidMemberUserDO.getPayMemberType(),paidMemberUserDO.getCardExpirationTime()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
|
@ -53,6 +53,15 @@ public class AppMemberUserInfoRespVO {
|
|||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||||
private LocalDateTime cardExpirationTime;
|
private LocalDateTime cardExpirationTime;
|
||||||
|
|
||||||
|
@Schema(description = "是否是客服")
|
||||||
|
private boolean idKefu=false;
|
||||||
|
|
||||||
|
@Schema(description = "客服图片")
|
||||||
|
private String kefuPic;
|
||||||
|
|
||||||
|
@Schema(description = "未读消息数量")
|
||||||
|
private Integer unreadCount=0;
|
||||||
|
|
||||||
@Schema(description = "用户 App - 会员等级")
|
@Schema(description = "用户 App - 会员等级")
|
||||||
@Data
|
@Data
|
||||||
public static class Level {
|
public static class Level {
|
||||||
|
@ -50,6 +50,19 @@ public class MemberConfigDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 分享得积分
|
||||||
|
* */
|
||||||
|
private Integer pointTradeSharePoint;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 好评得积分
|
||||||
|
* */
|
||||||
|
private Integer pointTradeGoodcommentPoint;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 推广得积分
|
||||||
|
* */
|
||||||
|
private Integer pointTradePromotionPoint;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user