Compare commits
No commits in common. "master" and "LCQ" have entirely different histories.
@ -18,28 +18,6 @@ export interface BrokerageWithdrawVO {
|
||||
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) => {
|
||||
return await request.get({ url: `/trade/brokerage-withdraw/page`, params })
|
||||
@ -59,13 +37,3 @@ export const approveBrokerageWithdraw = async (id: number) => {
|
||||
export const rejectBrokerageWithdraw = async (data: BrokerageWithdrawVO) => {
|
||||
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,26 +9,6 @@
|
||||
>
|
||||
<el-form-item label="客服名称" prop="name">
|
||||
<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 label="客服头像" prop="pic">
|
||||
<UploadImg v-model="formData.pic" />
|
||||
@ -85,7 +65,6 @@
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { SupportStaffApi, SupportStaffVO } from '@/api/mall/promotion/supportstaff'
|
||||
import {getUserListForAgent} from "@/api/member/user";
|
||||
|
||||
/** 客服人员 表单 */
|
||||
defineOptions({ name: 'SupportStaffForm' })
|
||||
@ -99,7 +78,6 @@ const formLoading = ref(false) // 表单的加载中:1)修改时的数据加
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
userId: undefined,
|
||||
name: undefined,
|
||||
pic: undefined,
|
||||
phone: undefined,
|
||||
@ -123,7 +101,6 @@ const open = async (type: string, id?: number) => {
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
getUserList()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
@ -136,14 +113,6 @@ const open = async (type: string, id?: number) => {
|
||||
}
|
||||
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 submitForm = async () => {
|
||||
@ -173,7 +142,6 @@ const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
userId: undefined,
|
||||
pic: undefined,
|
||||
phone: undefined,
|
||||
account: undefined,
|
||||
@ -188,24 +156,4 @@ const resetForm = () => {
|
||||
|
||||
|
||||
|
||||
</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>
|
||||
</script>
|
@ -1,232 +0,0 @@
|
||||
<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,12 +82,6 @@
|
||||
<el-form-item>
|
||||
<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="openClosingForm('create')"
|
||||
v-hasPermi="['trade:brokerage-withdraw:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 申请结算
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
@ -190,7 +184,6 @@
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<BrokerageWithdrawRejectForm ref="formRef" @success="getList" />
|
||||
<ClosingRecordForm ref="closingFormRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@ -198,7 +191,6 @@ import { DICT_TYPE, getDictLabel, getIntDictOptions, getStrDictOptions } from '@
|
||||
import { dateFormatter, formatDate } from '@/utils/formatTime'
|
||||
import * as BrokerageWithdrawApi from '@/api/mall/trade/brokerage/withdraw'
|
||||
import BrokerageWithdrawRejectForm from './BrokerageWithdrawRejectForm.vue'
|
||||
import ClosingRecordForm from "@/views/mall/trade/brokerage/withdraw/ClosingRecordForm.vue";
|
||||
import { BrokerageWithdrawStatusEnum, BrokerageWithdrawTypeEnum } from '@/utils/constants'
|
||||
import { fenToYuanFormat } from '@/utils/formatter'
|
||||
import { fenToYuan } from '@/utils'
|
||||
@ -256,12 +248,6 @@ const openForm = (id: number) => {
|
||||
formRef.value.open(id)
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const closingFormRef = ref()
|
||||
const openClosingForm = (type: string,id?: number) => {
|
||||
closingFormRef.value.open(type,id)
|
||||
}
|
||||
|
||||
/** 审核通过 */
|
||||
const handleApprove = async (id: number) => {
|
||||
try {
|
||||
|
@ -47,24 +47,6 @@
|
||||
下单支付金额按比例赠送积分(实际支付 1 元赠送多少积分)
|
||||
</el-text>
|
||||
</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="积分协议">
|
||||
<Editor v-model="formData.content" />
|
||||
</el-form-item>
|
||||
@ -93,10 +75,7 @@ const formData = ref({
|
||||
pointTradeDeductUnitPrice: 0,
|
||||
pointTradeDeductMaxPrice: 0,
|
||||
pointTradeGivePoint: 0,
|
||||
content: '',
|
||||
pointTradeSharePoint: 0,
|
||||
pointTradeGoodcommentPoint: 0,
|
||||
pointTradePromotionPoint: 0
|
||||
content: ''
|
||||
})
|
||||
|
||||
// 创建一个计算属性,用于将 pointTradeDeductUnitPrice 显示为带两位小数的形式
|
||||
|
@ -1,13 +0,0 @@
|
||||
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();
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
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,6 +173,4 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode REGISTRATION_NOT_EXISTS = new ErrorCode(1_024_000_000, "活动报名不存在");
|
||||
|
||||
ErrorCode ACTIVITY_INFO_NOT_EXISTS = new ErrorCode(1_025_000_000, "活动信息不存在");
|
||||
|
||||
ErrorCode SUPPORT_STAFF_USER_EXISTS = new ErrorCode(1_026_000_000, "客服人员绑定的用户已存在");
|
||||
}
|
||||
|
@ -1,38 +0,0 @@
|
||||
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,9 +18,6 @@ public class CirclePageReqVO extends PageParam {
|
||||
@Schema(description = "用户编号", example = "20140")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户昵称", example = "用户000")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "发表内容")
|
||||
private String content;
|
||||
|
||||
@ -43,4 +40,4 @@ public class CirclePageReqVO extends PageParam {
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
}
|
@ -22,9 +22,6 @@ public class CircleRespVO {
|
||||
@ExcelProperty("用户编号")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户昵称", example = "用户000")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "发表内容")
|
||||
@ExcelProperty("发表内容")
|
||||
private String content;
|
||||
@ -56,4 +53,4 @@ public class CircleRespVO {
|
||||
@Schema(description = "评论信息")
|
||||
private List<CircleReviewDO> circleList;
|
||||
|
||||
}
|
||||
}
|
@ -15,9 +15,6 @@ public class CircleSaveReqVO {
|
||||
@Schema(description = "用户编号", example = "20140")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户昵称", example = "用户000")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "发表内容")
|
||||
private String content;
|
||||
|
||||
@ -36,4 +33,4 @@ public class CircleSaveReqVO {
|
||||
@Schema(description = "更新版本号")
|
||||
private Integer version;
|
||||
|
||||
}
|
||||
}
|
@ -37,25 +37,6 @@ public class KeFuConversationController {
|
||||
@Resource
|
||||
private MemberUserApi memberUserApi;
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得客服会话")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('promotion:kefu-conversation:query')")
|
||||
public CommonResult<KeFuConversationRespVO> getConversation(@RequestParam("id") Long id) {
|
||||
KeFuConversationDO conversation = conversationService.getConversation(id);
|
||||
if (conversation == null) {
|
||||
return success(null);
|
||||
}
|
||||
|
||||
// 拼接数据
|
||||
KeFuConversationRespVO result = BeanUtils.toBean(conversation, KeFuConversationRespVO.class);
|
||||
MemberUserRespDTO memberUser = memberUserApi.getUser(conversation.getUserId());
|
||||
if (memberUser != null) {
|
||||
result.setUserAvatar(memberUser.getAvatar()).setUserNickname(memberUser.getNickname());
|
||||
}
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@PutMapping("/update-conversation-pinned")
|
||||
@Operation(summary = "置顶/取消置顶客服会话")
|
||||
@PreAuthorize("@ss.hasPermission('promotion:kefu-conversation:update')")
|
||||
|
@ -1,34 +0,0 @@
|
||||
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,7 +56,5 @@ public class SupportStaffRespVO {
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private Integer lineStatus;
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
}
|
@ -41,7 +41,4 @@ public class SupportStaffSaveReqVO {
|
||||
|
||||
private Integer lineStatus;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
}
|
@ -7,13 +7,10 @@ import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||
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.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.dal.dataobject.circle.CircleDO;
|
||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.circlelike.CircleLikeDO;
|
||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.circlereview.CircleReviewDO;
|
||||
import cn.iocoder.yudao.module.promotion.service.circle.CircleService;
|
||||
import cn.iocoder.yudao.module.promotion.service.circlelike.CircleLikeService;
|
||||
import cn.iocoder.yudao.module.promotion.service.circlereview.CircleReviewService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -39,8 +36,6 @@ public class AppCircleController {
|
||||
private CircleReviewService circleReviewService;
|
||||
@Resource
|
||||
private MemberUserApi memberUserApi;
|
||||
@Resource
|
||||
private CircleLikeService circleLikeService;
|
||||
|
||||
public String utilMethod(Long userId,Long reviewId){
|
||||
String nickname = memberUserApi.getUser(userId).getNickname();
|
||||
@ -67,44 +62,7 @@ public class AppCircleController {
|
||||
return success(result);
|
||||
}
|
||||
|
||||
@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")
|
||||
@GetMapping("/doBrowse")
|
||||
@Operation(summary = "浏览量叠加")
|
||||
@PreAuthenticated
|
||||
public CommonResult<Boolean> doBrowse(@RequestParam("id") Long lookId){
|
||||
@ -112,23 +70,11 @@ public class AppCircleController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/getLike")
|
||||
@Operation(summary = "查询是否点赞")
|
||||
@PreAuthenticated
|
||||
public CommonResult<Boolean> getLike(@RequestParam("id") Long lookId){
|
||||
CircleLikeDO circleLikeDO = circleLikeService.getCircleLike(lookId,getLoginUserId());
|
||||
Boolean isLike = false;
|
||||
if (circleLikeDO != null){
|
||||
isLike = true;
|
||||
}
|
||||
return success(isLike);
|
||||
}
|
||||
|
||||
@PutMapping("/doLike")
|
||||
@GetMapping("/doLike")
|
||||
@Operation(summary = "点赞/取消点赞")
|
||||
@PreAuthenticated
|
||||
public CommonResult<Boolean> doLike(@RequestParam("id") Long lookId){
|
||||
circleService.updateLikeCount(lookId,getLoginUserId());
|
||||
circleService.updateLikeCount(lookId);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@ -141,7 +87,7 @@ public class AppCircleController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/doReviewDelete")
|
||||
@GetMapping("/doReviewDelete")
|
||||
@Operation(summary = "删除评论")
|
||||
@PreAuthenticated
|
||||
public CommonResult<Boolean> doReviewDelete(@RequestParam("id") Long lookId){
|
||||
@ -149,7 +95,7 @@ public class AppCircleController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/doCircleDelete")
|
||||
@GetMapping("/doCircleDelete")
|
||||
@Operation(summary = "删除动态")
|
||||
@PreAuthenticated
|
||||
public CommonResult<Boolean> doCircleDelete(@RequestParam("id") Long lookId){
|
||||
|
@ -7,8 +7,6 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
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.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.app.kefu.vo.message.AppKeFuMessagePageReqVO;
|
||||
import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessageSendReqVO;
|
||||
@ -17,30 +15,17 @@ 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.mysql.kefu.KeFuConversationMapper;
|
||||
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.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.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
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.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;
|
||||
|
||||
@Tag(name = "用户 APP - 客服消息")
|
||||
@ -61,25 +46,12 @@ public class AppKeFuMessageController {
|
||||
@Resource
|
||||
private SupportStaffMapper supportStaffMapper;
|
||||
|
||||
@Resource
|
||||
private KeFuConversationService conversationService;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
|
||||
@PostMapping("/send")
|
||||
@Operation(summary = "发送客服消息")
|
||||
@PreAuthenticated
|
||||
public CommonResult<Long> sendKefuMessage(@Valid @RequestBody AppKeFuMessageSendReqVO sendReqVO) {
|
||||
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()); // 设置用户编号和类型
|
||||
}
|
||||
sendReqVO.setSenderId(getLoginUserId()).setSenderType(UserTypeEnum.MEMBER.getValue()); // 设置用户编号和类型
|
||||
return success(kefuMessageService.sendKefuMessage(sendReqVO));
|
||||
}
|
||||
|
||||
@ -126,34 +98,4 @@ public class AppKeFuMessageController {
|
||||
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,6 +1,5 @@
|
||||
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 lombok.Data;
|
||||
|
||||
@ -25,11 +24,4 @@ public class AppKeFuMessageSendReqVO {
|
||||
@Schema(description = "发送人类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1", hidden = true)
|
||||
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,7 +22,6 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
@AllArgsConstructor
|
||||
public class CircleDO extends BaseDO {
|
||||
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@ -32,10 +31,6 @@ public class CircleDO extends BaseDO {
|
||||
* 用户编号
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private String nickname;
|
||||
/**
|
||||
* 发表内容
|
||||
*/
|
||||
@ -61,4 +56,4 @@ public class CircleDO extends BaseDO {
|
||||
*/
|
||||
private Integer version;
|
||||
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
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,9 +68,4 @@ public class SupportStaffDO extends BaseDO {
|
||||
*/
|
||||
private Integer lineStatus;
|
||||
|
||||
/*
|
||||
* 用户id
|
||||
* */
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
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 updateLikeCount(Long circleId,Long userId);
|
||||
void updateLikeCount(Long circleId);
|
||||
|
||||
/**
|
||||
* 删除商城动态
|
||||
@ -58,4 +58,4 @@ public interface CircleService {
|
||||
*/
|
||||
PageResult<CircleDO> getCirclePage(CirclePageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
}
|
@ -1,7 +1,5 @@
|
||||
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 javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -31,9 +29,6 @@ public class CircleServiceImpl implements CircleService {
|
||||
@Resource
|
||||
private CircleMapper circleMapper;
|
||||
|
||||
@Resource
|
||||
private CircleLikeService circleLikeService;
|
||||
|
||||
@Override
|
||||
public Long createCircle(CircleSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
@ -60,20 +55,9 @@ public class CircleServiceImpl implements CircleService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLikeCount(Long circleId,Long userId) {
|
||||
public void updateLikeCount(Long circleId) {
|
||||
CircleDO circleDO = circleMapper.selectOne("id", circleId);
|
||||
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);
|
||||
}
|
||||
circleDO.setLookCount(circleDO.getLikeCount() + 1);
|
||||
circleMapper.updateById(circleDO);
|
||||
}
|
||||
|
||||
@ -101,4 +85,4 @@ public class CircleServiceImpl implements CircleService {
|
||||
return circleMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
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);
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
@ -13,14 +13,6 @@ import java.util.List;
|
||||
*/
|
||||
public interface KeFuConversationService {
|
||||
|
||||
/**
|
||||
* 获得客服会话
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 客服会话
|
||||
*/
|
||||
KeFuConversationDO getConversation(Long id);
|
||||
|
||||
/**
|
||||
* 【管理员】删除客服会话
|
||||
*
|
||||
|
@ -2,9 +2,7 @@ package cn.iocoder.yudao.module.promotion.service.kefu;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.supportstaff.vo.SupportStaffPageReqVO;
|
||||
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.supportstaff.SupportStaffDO;
|
||||
@ -37,11 +35,6 @@ public class KeFuConversationServiceImpl implements KeFuConversationService {
|
||||
@Resource
|
||||
private SupportStaffMapper supportStaffMapper;
|
||||
|
||||
@Override
|
||||
public KeFuConversationDO getConversation(Long id) {
|
||||
return conversationMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteKefuConversation(Long id) {
|
||||
// 校验存在
|
||||
@ -107,24 +100,13 @@ public class KeFuConversationServiceImpl implements KeFuConversationService {
|
||||
@Override
|
||||
public KeFuConversationDO getOrCreateConversation(Long 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) {
|
||||
conversation = new KeFuConversationDO().setUserId(userId).setLastMessageTime(LocalDateTime.now())
|
||||
.setLastMessageContent(StrUtil.EMPTY).setLastMessageContentType(KeFuMessageContentTypeEnum.TEXT.getType())
|
||||
.setAdminPinned(Boolean.FALSE).setUserDeleted(Boolean.FALSE).setAdminDeleted(Boolean.FALSE)
|
||||
.setAdminUnreadMessageCount(0).setKefuId(kefuId);
|
||||
if (userId == null) {
|
||||
conversation = null;
|
||||
}else {
|
||||
conversationMapper.insert(conversation);
|
||||
}
|
||||
.setAdminUnreadMessageCount(0);
|
||||
conversationMapper.insert(conversation);
|
||||
}
|
||||
return conversation;
|
||||
}
|
||||
@ -150,21 +132,12 @@ public class KeFuConversationServiceImpl implements KeFuConversationService {
|
||||
|
||||
@Override
|
||||
public String transferConversation(Long id, Long kefuId) {
|
||||
//先下线
|
||||
KeFuConversationDO currDo = conversationMapper.selectById(id);
|
||||
SupportStaffDO currSs = supportStaffMapper.selectById(currDo.getKefuId());
|
||||
currSs.setStatus(0);
|
||||
supportStaffMapper.updateById(currSs);
|
||||
//会话转接
|
||||
KeFuConversationDO keFuConversationDO = new KeFuConversationDO();
|
||||
keFuConversationDO.setId(id);
|
||||
keFuConversationDO.setKefuId(kefuId);
|
||||
conversationMapper.updateById(keFuConversationDO);
|
||||
//再上线新客服
|
||||
SupportStaffDO supportStaffDO = supportStaffMapper.selectById(kefuId);
|
||||
supportStaffDO.setStatus(1);
|
||||
supportStaffMapper.updateById(supportStaffDO);
|
||||
return supportStaffDO.getName();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package cn.iocoder.yudao.module.promotion.service.kefu;
|
||||
|
||||
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.KeFuMessageSendReqVO;
|
||||
import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessagePageReqVO;
|
||||
@ -9,7 +8,6 @@ import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuM
|
||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
@ -75,5 +73,4 @@ public interface KeFuMessageService {
|
||||
*/
|
||||
Boolean getLatestMessageBySenderId(Integer senderId);
|
||||
|
||||
List<KeFuMessageDO> getKeFuMessageList(KeFuMessageListReqVO pageReqVO);
|
||||
}
|
||||
}
|
@ -8,12 +8,9 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
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.member.api.user.MemberUserApi;
|
||||
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.KeFuMessageSendReqVO;
|
||||
import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessagePageReqVO;
|
||||
@ -32,7 +29,6 @@ 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.mysql.notify.NotifyMessageMapper;
|
||||
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.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -46,7 +42,6 @@ import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
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.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.WebSocketMessageTypeConstants.KEFU_MESSAGE_ADMIN_READ;
|
||||
import static cn.iocoder.yudao.module.promotion.enums.WebSocketMessageTypeConstants.KEFU_MESSAGE_TYPE;
|
||||
@ -112,27 +107,10 @@ public class KeFuMessageServiceImpl implements KeFuMessageService {
|
||||
public Long sendKefuMessage(AppKeFuMessageSendReqVO sendReqVO) { //用户发消息
|
||||
// 1.1 设置会话编号
|
||||
KeFuMessageDO kefuMessage = BeanUtils.toBean(sendReqVO, KeFuMessageDO.class);
|
||||
//判断是否是客服
|
||||
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());
|
||||
KeFuConversationDO conversation = conversationService.getOrCreateConversation(sendReqVO.getSenderId());
|
||||
kefuMessage.setConversationId(conversation.getId());
|
||||
// 1.2 保存消息
|
||||
// kefuMessage.setReceiverId(conversation.getKefuId()).setReceiverType(UserTypeEnum.ADMIN.getValue()); // 设置接收人
|
||||
kefuMessage.setReceiverId(conversation.getKefuId()).setReceiverType(UserTypeEnum.ADMIN.getValue()); // 设置接收人
|
||||
keFuMessageMapper.insert(kefuMessage);
|
||||
|
||||
// 2. 更新会话消息冗余
|
||||
@ -143,7 +121,7 @@ public class KeFuMessageServiceImpl implements KeFuMessageService {
|
||||
|
||||
//判断客服是否在线,自动回复
|
||||
SupportStaffDO supportStaffDO = supportStaffMapper.selectOne("id", conversation.getKefuId());
|
||||
if (supportStaffDO.getLineStatus() == 2 && a == 0){ //离线
|
||||
if (supportStaffDO.getLineStatus() == 2){ //离线
|
||||
KeFuConfigurationDO type = keFuConfigurationMapper.selectOne("type", 1);
|
||||
if (type != null){ //是否配置了客服不在线回复
|
||||
if (type.getFeedback() != null){
|
||||
@ -162,10 +140,7 @@ public class KeFuMessageServiceImpl implements KeFuMessageService {
|
||||
}
|
||||
}
|
||||
}
|
||||
//判断是否是客服
|
||||
if (null!=staff&&staff.getStatus()==1) {
|
||||
getSelf().sendAsyncMessageToMember(sendReqVO.getReceiverId(), KEFU_MESSAGE_TYPE, kefuMessage);
|
||||
}
|
||||
|
||||
// 3. 通知所有管理员更新对话
|
||||
getSelf().sendAsyncMessageToAdmin(KEFU_MESSAGE_TYPE, kefuMessage);
|
||||
return kefuMessage.getId();
|
||||
@ -194,13 +169,6 @@ public class KeFuMessageServiceImpl implements KeFuMessageService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateKeFuMessageReadStatus(Long conversationId, Long userId, Integer userType) {
|
||||
//判断是否是客服
|
||||
SupportStaffDO staff = supportStaffMapper.selectOne(new LambdaUpdateWrapper<SupportStaffDO>()
|
||||
.eq(SupportStaffDO::getUserId,getLoginUserId()));
|
||||
if (staff != null && staff.getStatus() == 1){
|
||||
conversationService.updateAdminUnreadMessageCountToZero(conversationId);
|
||||
return;
|
||||
}
|
||||
// 1.1 校验会话是否存在
|
||||
KeFuConversationDO conversation = conversationService.validateKefuConversationExists(conversationId);
|
||||
// 1.2 如果是会员端处理已读,需要传递 userId;万一用户模拟一个 conversationId
|
||||
@ -259,11 +227,6 @@ public class KeFuMessageServiceImpl implements KeFuMessageService {
|
||||
|
||||
@Override
|
||||
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. 获得客服会话
|
||||
KeFuConversationDO conversation = conversationService.getConversationByUserId(userId);
|
||||
if (conversation == null) {
|
||||
@ -271,7 +234,6 @@ public class KeFuMessageServiceImpl implements KeFuMessageService {
|
||||
}
|
||||
// 2. 设置会话编号
|
||||
pageReqVO.setConversationId(conversation.getId());
|
||||
}
|
||||
return keFuMessageMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@ -293,13 +255,4 @@ public class KeFuMessageServiceImpl implements KeFuMessageService {
|
||||
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,5 +55,4 @@ public interface SupportStaffService {
|
||||
*/
|
||||
void updateLineStatus(String id , Integer lineStatus );
|
||||
|
||||
SupportStaffDO getSupportStaffByUserId(Long userId);
|
||||
}
|
||||
}
|
@ -1,7 +1,5 @@
|
||||
package cn.iocoder.yudao.module.promotion.service.supportstaff;
|
||||
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -10,12 +8,8 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.supportstaff.SupportStaf
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
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.module.promotion.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_USERNAME_EXISTS;
|
||||
|
||||
/**
|
||||
* 客服人员 Service 实现类
|
||||
@ -29,36 +23,12 @@ public class SupportStaffServiceImpl implements SupportStaffService {
|
||||
@Resource
|
||||
private SupportStaffMapper supportStaffMapper;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Override
|
||||
public Integer createSupportStaff(SupportStaffSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
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);
|
||||
}
|
||||
}
|
||||
List<AdminUserRespDTO> users = adminUserApi.getListNoArgs();
|
||||
if(!users.isEmpty()){
|
||||
users.forEach(user -> {
|
||||
if(user.getUsername().equals(createReqVO.getAccount())){
|
||||
throw exception(USER_USERNAME_EXISTS);
|
||||
}
|
||||
});
|
||||
}
|
||||
supportStaff.setLineStatus(2);
|
||||
supportStaffMapper.insert(supportStaff);
|
||||
AdminUserRespDTO adminUserRespDTO = new AdminUserRespDTO();
|
||||
adminUserRespDTO.setUsername(createReqVO.getAccount());
|
||||
adminUserRespDTO.setMobile(supportStaff.getPhone());
|
||||
adminUserRespDTO.setPassword(createReqVO.getPassword());
|
||||
adminUserRespDTO.setNickname(supportStaff.getName());
|
||||
|
||||
adminUserApi.createUserBySupportStaff(adminUserRespDTO);
|
||||
// 返回
|
||||
return supportStaff.getId();
|
||||
}
|
||||
@ -69,34 +39,6 @@ public class SupportStaffServiceImpl implements SupportStaffService {
|
||||
validateSupportStaffExists(updateReqVO.getId());
|
||||
// 更新
|
||||
SupportStaffDO updateObj = BeanUtils.toBean(updateReqVO, SupportStaffDO.class);
|
||||
|
||||
SupportStaffDO supportStaffDO = supportStaffMapper.selectOne("id", updateReqVO.getId());
|
||||
AdminUserRespDTO adminUser = new AdminUserRespDTO();
|
||||
adminUser.setUsername(updateReqVO.getAccount());
|
||||
adminUser.setMobile(updateReqVO.getPhone());
|
||||
adminUser.setPassword(updateReqVO.getPassword());
|
||||
adminUser.setNickname(updateReqVO.getName());
|
||||
|
||||
AdminUserRespDTO adminUserRespDTO = adminUserApi.getUserByUserName(supportStaffDO.getAccount());
|
||||
if(adminUserRespDTO == null){
|
||||
// 新建一个后台账户
|
||||
adminUserApi.createUserBySupportStaff(adminUser);
|
||||
}
|
||||
else {
|
||||
adminUserRespDTO.setUsername(adminUser.getUsername());
|
||||
adminUserRespDTO.setPassword(adminUser.getPassword());
|
||||
adminUserApi.updateUserBySupportStaff(adminUserRespDTO);
|
||||
}
|
||||
|
||||
//判断用户是否被绑定
|
||||
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);
|
||||
}
|
||||
|
||||
@ -131,9 +73,4 @@ public class SupportStaffServiceImpl implements SupportStaffService {
|
||||
supportStaffMapper.updateById(supportStaffDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SupportStaffDO getSupportStaffByUserId(Long userId) {
|
||||
return supportStaffMapper.selectOne("user_id", userId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,25 +1,16 @@
|
||||
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.PageParam;
|
||||
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.dto.MemberUserRespDTO;
|
||||
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.BrokerageWithdrawPageReqVO;
|
||||
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.dal.dataobject.brokerage.BrokerageUserDO;
|
||||
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.service.brokerage.BrokerageUserService;
|
||||
import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageWithdrawService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -31,18 +22,11 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
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.util.collection.CollectionUtils.convertSet;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Tag(name = "管理后台 - 佣金提现")
|
||||
@RestController
|
||||
@ -57,12 +41,6 @@ public class BrokerageWithdrawController {
|
||||
@Resource
|
||||
private MemberUserApi memberUserApi;
|
||||
|
||||
@Resource
|
||||
private AgentInfoApi agentInfoApi;
|
||||
|
||||
@Resource
|
||||
private BrokerageUserService brokerageUserService;
|
||||
|
||||
@PutMapping("/approve")
|
||||
@Operation(summary = "通过申请")
|
||||
@PreAuthorize("@ss.hasPermission('trade:brokerage-withdraw:audit')")
|
||||
@ -95,12 +73,10 @@ public class BrokerageWithdrawController {
|
||||
// 分页查询
|
||||
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);
|
||||
return success(BrokerageWithdrawConvert.INSTANCE.convertPage(pageResult, userMap,brokerageWithdrawMap));
|
||||
return success(BrokerageWithdrawConvert.INSTANCE.convertPage(pageResult, userMap));
|
||||
}
|
||||
|
||||
// TODO @luchi:update-transferred,url 改成这个。和 update-paid 、update-refunded 保持一致
|
||||
@ -115,123 +91,4 @@ 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());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,61 +0,0 @@
|
||||
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 = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "代理商id", example = "1")
|
||||
/* @Schema(description = "代理商id", example = "1")
|
||||
private Long agentId;
|
||||
|
||||
@Schema(description = "代理商名称", example = "谁便")
|
||||
@ExcelProperty("代理商名称")
|
||||
private String agentName;
|
||||
|
||||
/* @Schema(description = "凭证", example = "谁便")
|
||||
@Schema(description = "凭证", example = "谁便")
|
||||
@ExcelProperty("凭证")
|
||||
private String voucher;*/
|
||||
|
||||
|
@ -55,10 +55,4 @@ public class AppTradeOrderPageItemRespVO {
|
||||
@Schema(description = "拼团记录编号", example = "100")
|
||||
private Long combinationRecordId;
|
||||
|
||||
@Schema(description = "代理商id", example = "25514")
|
||||
private Long agentId;
|
||||
|
||||
@Schema(description = "发票状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer invoiceStatus;
|
||||
|
||||
}
|
||||
|
@ -58,8 +58,4 @@ public class AppTradeOrderItemRespVO {
|
||||
@Schema(description = "售后状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer afterSaleStatus;
|
||||
|
||||
@Schema(description = "代理商id", example = "25514")
|
||||
private Long agentId;
|
||||
|
||||
|
||||
}
|
||||
|
@ -35,16 +35,10 @@ public interface BrokerageWithdrawConvert {
|
||||
|
||||
PageResult<BrokerageWithdrawRespVO> convertPage(PageResult<BrokerageWithdrawDO> page);
|
||||
|
||||
default PageResult<BrokerageWithdrawRespVO> convertPage(PageResult<BrokerageWithdrawDO> pageResult,
|
||||
Map<Long, MemberUserRespDTO> userMap,
|
||||
Map<Long,BrokerageWithdrawRespVO> broMap) {
|
||||
default PageResult<BrokerageWithdrawRespVO> convertPage(PageResult<BrokerageWithdrawDO> pageResult, Map<Long, MemberUserRespDTO> userMap) {
|
||||
PageResult<BrokerageWithdrawRespVO> result = convertPage(pageResult);
|
||||
for (BrokerageWithdrawRespVO vo : result.getList()) {
|
||||
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;
|
||||
}
|
||||
|
@ -123,14 +123,4 @@ public class BrokerageWithdrawDO extends BaseDO {
|
||||
*/
|
||||
private String transferStatus;
|
||||
|
||||
|
||||
/*
|
||||
* 代理商id
|
||||
* */
|
||||
private Long agentId;
|
||||
|
||||
/*
|
||||
* 代理商名称
|
||||
* */
|
||||
private String agentName;
|
||||
}
|
||||
|
@ -177,11 +177,6 @@ public class TradeOrderItemDO extends BaseDO {
|
||||
*/
|
||||
private Integer afterSaleStatus;
|
||||
|
||||
/*
|
||||
* 代理商户id
|
||||
* */
|
||||
private Long agentId;
|
||||
|
||||
/**
|
||||
* 商品属性
|
||||
*/
|
||||
|
@ -9,7 +9,6 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
|
||||
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.module.member.api.user.MemberUserApi;
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||
@ -28,7 +27,6 @@ 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.BrokerageRecordStatusEnum;
|
||||
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.metadata.IPage;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -414,8 +412,7 @@ public class BrokerageUserServiceImpl implements BrokerageUserService {
|
||||
|
||||
@Override
|
||||
public List<Long> getBrokerageUserIds() {
|
||||
List<Long> list = brokerageUserMapper.selectList(
|
||||
new LambdaQueryWrapper<BrokerageUserDO>().eq(BaseDO::getDeleted,false)).stream().map(BrokerageUserDO::getId).collect(Collectors.toList());
|
||||
List<Long> list = brokerageUserMapper.selectList().stream().map(BrokerageUserDO::getId).collect(Collectors.toList());
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.trade.service.brokerage;
|
||||
|
||||
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.BrokerageWithdrawRespVO;
|
||||
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.enums.brokerage.BrokerageWithdrawStatusEnum;
|
||||
@ -79,8 +78,4 @@ public interface BrokerageWithdrawService {
|
||||
}
|
||||
|
||||
void updateBrokerageWithdrawTransferred(Long id, Long payTransferId);
|
||||
|
||||
Map<Long, BrokerageWithdrawRespVO> getBrokerageWithdrawMap(Set<Long> userIds);
|
||||
|
||||
Long createSupply(BrokerageWithdrawDO brokerageWithdrawDO);
|
||||
}
|
||||
|
@ -7,8 +7,6 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
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.dto.PayTransferCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferRespDTO;
|
||||
@ -23,7 +21,6 @@ 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.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.BrokerageWithdrawRespVO;
|
||||
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.dal.dataobject.brokerage.BrokerageWithdrawDO;
|
||||
@ -44,7 +41,10 @@ import org.springframework.validation.annotation.Validated;
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Validator;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
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.util.servlet.ServletUtils.getClientIP;
|
||||
@ -86,9 +86,6 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService {
|
||||
@Resource
|
||||
private PayTransferApi payTransferApi;
|
||||
|
||||
@Resource
|
||||
private AgentInfoApi agentInfoApi;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void auditBrokerageWithdraw(Integer id, BrokerageWithdrawStatusEnum status, String auditReason) {
|
||||
@ -273,32 +270,5 @@ public class BrokerageWithdrawServiceImpl implements BrokerageWithdrawService {
|
||||
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,16 +31,4 @@ public class MemberConfigBaseVO {
|
||||
@Schema(description = "积分协议内容", example = "100")
|
||||
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;
|
||||
|
||||
}
|
||||
|
@ -123,10 +123,4 @@ public class AppAuthController {
|
||||
return success(AuthConvert.INSTANCE.convert(signature));
|
||||
}
|
||||
|
||||
@PostMapping("/checkLogin")
|
||||
@PermitAll
|
||||
public CommonResult<Integer> checkLogin(@RequestBody @Valid AppAuthSocialLoginReqVO reqVO) {
|
||||
return success(authService.checkLogin(reqVO));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,8 +34,6 @@ 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.user.MemberUserService;
|
||||
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.service.brokerage.BrokerageUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -84,9 +82,6 @@ public class AppMemberUserController {
|
||||
private MemberCodeMapper memberCodeMapper;
|
||||
@Resource
|
||||
private PaidMemberUserService paidMemberUserService;
|
||||
@Resource
|
||||
private SupportStaffApi supportStaffApi;
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得基本信息")
|
||||
@PreAuthenticated
|
||||
@ -94,27 +89,10 @@ public class AppMemberUserController {
|
||||
MemberUserDO user = userService.getUser(getLoginUserId());
|
||||
MemberLevelDO level = levelService.getLevel(user.getLevelId());
|
||||
PaidMemberUserDO paidMemberUserDO = paidMemberUserService.getPaidMemberUserByUid(getLoginUserId());
|
||||
AppMemberUserInfoRespVO appMemberUserInfoRespVO = new AppMemberUserInfoRespVO();
|
||||
//判断是否是客服
|
||||
SupportStaffDTO supportStaffDTO = supportStaffApi.getUserIsSupportStaff(getLoginUserId());
|
||||
if (paidMemberUserDO == 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,null,null));
|
||||
}
|
||||
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()));
|
||||
return success(MemberUserConvert.INSTANCE.convert(user, level,paidMemberUserDO.getPayMemberType(),paidMemberUserDO.getCardExpirationTime()));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
|
@ -53,15 +53,6 @@ public class AppMemberUserInfoRespVO {
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDateTime cardExpirationTime;
|
||||
|
||||
@Schema(description = "是否是客服")
|
||||
private boolean idKefu=false;
|
||||
|
||||
@Schema(description = "客服图片")
|
||||
private String kefuPic;
|
||||
|
||||
@Schema(description = "未读消息数量")
|
||||
private Integer unreadCount=0;
|
||||
|
||||
@Schema(description = "用户 App - 会员等级")
|
||||
@Data
|
||||
public static class Level {
|
||||
|
@ -50,19 +50,6 @@ public class MemberConfigDO extends BaseDO {
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/*
|
||||
* 分享得积分
|
||||
* */
|
||||
private Integer pointTradeSharePoint;
|
||||
|
||||
/*
|
||||
* 好评得积分
|
||||
* */
|
||||
private Integer pointTradeGoodcommentPoint;
|
||||
|
||||
/*
|
||||
* 推广得积分
|
||||
* */
|
||||
private Integer pointTradePromotionPoint;
|
||||
|
||||
}
|
||||
|
@ -85,6 +85,4 @@ public interface MemberAuthService {
|
||||
*/
|
||||
AppAuthLoginRespVO refreshToken(String refreshToken);
|
||||
|
||||
Integer checkLogin(AppAuthSocialLoginReqVO reqVO);
|
||||
|
||||
}
|
||||
|
@ -258,25 +258,6 @@ public class MemberAuthServiceImpl implements MemberAuthService {
|
||||
return AuthConvert.INSTANCE.convert(accessTokenDO, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer checkLogin(AppAuthSocialLoginReqVO reqVO) {
|
||||
// 使用 code 授权码,进行登录。然后,获得到绑定的用户编号
|
||||
SocialUserRespDTO socialUser = socialUserApi.getSocialUserByCode(UserTypeEnum.MEMBER.getValue(), reqVO.getType(),
|
||||
reqVO.getCode(), reqVO.getState());
|
||||
System.out.println(socialUser);
|
||||
if (socialUser == null) {
|
||||
System.out.println("111");
|
||||
throw exception(AUTH_SOCIAL_USER_NOT_FOUND);
|
||||
}
|
||||
|
||||
//判断openid是否存在
|
||||
// SocialUserRespDTO respDTO = socialUserApi.getSocialUserByOpenId(socialUser.getOpenid());
|
||||
if (socialUser.getUserId() == null) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
private void createLogoutLog(Long userId) {
|
||||
LoginLogCreateReqDTO reqDTO = new LoginLogCreateReqDTO();
|
||||
reqDTO.setLogType(LoginLogTypeEnum.LOGOUT_SELF.getType());
|
||||
|
@ -589,7 +589,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
userPostMapper.insertBatch(convertList(user.getPostIds(),
|
||||
postId -> new UserPostDO().setUserId(user.getId()).setPostId(postId)));
|
||||
}
|
||||
RoleDO role = roleService.getRoleByCode("chat");
|
||||
RoleDO role = roleService.getRoleByCode("support_staff");
|
||||
if (role != null){
|
||||
//给后台用户关联客服角色
|
||||
permissionService.assignUserRole(user.getId(), Collections.singleton(role.getId()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user