Compare commits

..

4 Commits

28 changed files with 1961 additions and 4 deletions

View File

@ -14,7 +14,7 @@ VITE_APP_TENANT_ENABLE=true
VITE_APP_CAPTCHA_ENABLE=true VITE_APP_CAPTCHA_ENABLE=true
# 文档地址的开关 # 文档地址的开关
VITE_APP_DOCALERT_ENABLE=true VITE_APP_DOCALERT_ENABLE=false
# 百度统计 # 百度统计
VITE_APP_BAIDU_CODE = a1ff8825baa73c3a78eb96aa40325abc VITE_APP_BAIDU_CODE = a1ff8825baa73c3a78eb96aa40325abc

View File

@ -0,0 +1,46 @@
import request from '@/config/axios'
// 商城动态 VO
export interface CircleVO {
id: number // 编号
userId: number // 用户编号
content: string // 发表内容
picUrl: string // 图片地址
likeCount: number // 点赞量
lookCount: number // 访问量
commentCount: number // 评论数量
version: number // 更新版本号
}
// 商城动态 API
export const CircleApi = {
// 查询商城动态分页
getCirclePage: async (params: any) => {
return await request.get({ url: `/promotion/circle/page`, params })
},
// 查询商城动态详情
getCircle: async (id: number) => {
return await request.get({ url: `/promotion/circle/get?id=` + id })
},
// 新增商城动态
createCircle: async (data: CircleVO) => {
return await request.post({ url: `/promotion/circle/create`, data })
},
// 修改商城动态
updateCircle: async (data: CircleVO) => {
return await request.put({ url: `/promotion/circle/update`, data })
},
// 删除商城动态
deleteCircle: async (id: number) => {
return await request.delete({ url: `/promotion/circle/delete?id=` + id })
},
// 导出商城动态 Excel
exportCircle: async (params) => {
return await request.download({ url: `/promotion/circle/export-excel`, params })
}
}

View File

@ -0,0 +1,48 @@
import request from '@/config/axios'
// 动态的评论 VO
export interface CircleReviewVO {
id: number // 编号
userId: number // 用户id
circleId: number // 动态id
type: number // 评论类型
content: string // 评论内容
picUrl: string // 图片地址
likeCount: number // 点赞量
replyId: number // 被回复的评论ID
replyUserId: number // 被回复的用户ID
version: number // 版本号
}
// 动态的评论 API
export const CircleReviewApi = {
// 查询动态的评论分页
getCircleReviewPage: async (params: any) => {
return await request.get({ url: `/promotion/circle-review/page`, params })
},
// 查询动态的评论详情
getCircleReview: async (id: number) => {
return await request.get({ url: `/promotion/circle-review/get?id=` + id })
},
// 新增动态的评论
createCircleReview: async (data: CircleReviewVO) => {
return await request.post({ url: `/promotion/circle-review/create`, data })
},
// 修改动态的评论
updateCircleReview: async (data: CircleReviewVO) => {
return await request.put({ url: `/promotion/circle-review/update`, data })
},
// 删除动态的评论
deleteCircleReview: async (id: number) => {
return await request.delete({ url: `/promotion/circle-review/delete?id=` + id })
},
// 导出动态的评论 Excel
exportCircleReview: async (params) => {
return await request.download({ url: `/promotion/circle-review/export-excel`, params })
}
}

View File

@ -0,0 +1,121 @@
<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-input v-model="formData.userId" placeholder="请输入用户编号" />
</el-form-item>
<el-form-item label="发表内容" prop="content">
<Editor v-model="formData.content" height="150px" />
</el-form-item>
<el-form-item label="图片地址" prop="picUrl">
<UploadImg v-model="formData.picUrl" />
</el-form-item>
<el-form-item label="点赞量" prop="likeCount">
<el-input v-model="formData.likeCount" placeholder="请输入点赞量" />
</el-form-item>
<el-form-item label="访问量" prop="lookCount">
<el-input v-model="formData.lookCount" placeholder="请输入访问量" />
</el-form-item>
<el-form-item label="评论数量" prop="commentCount">
<el-input v-model="formData.commentCount" placeholder="请输入评论数量" />
</el-form-item>
<!-- <el-form-item label="更新版本号" prop="version">
<el-input v-model="formData.version" 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 { CircleApi, CircleVO } from '@/api/mall/promotion/circle'
/** 商城动态 表单 */
defineOptions({ name: 'CircleForm' })
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
userId: undefined,
content: undefined,
picUrl: undefined,
likeCount: undefined,
lookCount: undefined,
commentCount: undefined,
version: undefined
})
const formRules = reactive({
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await CircleApi.getCircle(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
await formRef.value.validate()
//
formLoading.value = true
try {
const data = formData.value as unknown as CircleVO
if (formType.value === 'create') {
await CircleApi.createCircle(data)
message.success(t('common.createSuccess'))
} else {
await CircleApi.updateCircle(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
userId: undefined,
content: undefined,
picUrl: undefined,
likeCount: undefined,
lookCount: undefined,
commentCount: undefined,
version: undefined
}
formRef.value?.resetFields()
}
</script>

View File

@ -0,0 +1,235 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="用户编号" prop="userId">
<el-input
v-model="queryParams.userId"
placeholder="请输入用户编号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="点赞量" prop="likeCount">
<el-input
v-model="queryParams.likeCount"
placeholder="请输入点赞量"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="访问量" prop="lookCount">
<el-input
v-model="queryParams.lookCount"
placeholder="请输入访问量"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="评论数量" prop="commentCount">
<el-input
v-model="queryParams.commentCount"
placeholder="请输入评论数量"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<!-- <el-form-item label="更新版本号" prop="version">
<el-input
v-model="queryParams.version"
placeholder="请输入更新版本号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item> -->
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<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
type="primary"
plain
@click="openForm('create')"
v-hasPermi="['promotion:circle:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['promotion:circle:export']"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="用户编号" align="center" prop="userId" />
<el-table-column label="发表内容" align="center" prop="content" />
<el-table-column label="图片地址" align="center" prop="picUrl" />
<el-table-column label="点赞量" align="center" prop="likeCount" />
<el-table-column label="访问量" align="center" prop="lookCount" />
<el-table-column label="评论数量" align="center" prop="commentCount" />
<!-- <el-table-column label="更新版本号" align="center" prop="version" /> -->
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['promotion:circle:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['promotion:circle:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<CircleForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { CircleApi, CircleVO } from '@/api/mall/promotion/circle'
import CircleForm from './CircleForm.vue'
/** 商城动态 列表 */
defineOptions({ name: 'Circle' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref<CircleVO[]>([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
userId: undefined,
content: undefined,
picUrl: undefined,
likeCount: undefined,
lookCount: undefined,
commentCount: undefined,
version: undefined,
createTime: []
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await CircleApi.getCirclePage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await CircleApi.deleteCircle(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await CircleApi.exportCircle(queryParams)
download.excel(data, '商城动态.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>

View File

@ -0,0 +1,139 @@
<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="用户id" prop="userId">
<el-input v-model="formData.userId" placeholder="请输入用户id" />
</el-form-item>
<el-form-item label="动态id" prop="circleId">
<el-input v-model="formData.circleId" placeholder="请输入动态id" />
</el-form-item>
<el-form-item label="评论类型" prop="type">
<el-select v-model="formData.type" placeholder="请选择评论类型">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.CIRCLE_REVIEW_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="评论内容" prop="content">
<Editor v-model="formData.content" height="150px" />
</el-form-item>
<el-form-item label="图片地址" prop="picUrl">
<UploadImg v-model="formData.picUrl" />
</el-form-item>
<el-form-item label="点赞量" prop="likeCount">
<el-input v-model="formData.likeCount" placeholder="请输入点赞量" />
</el-form-item>
<el-form-item label="被回复的评论ID" prop="replyId">
<el-input v-model="formData.replyId" placeholder="请输入被回复的评论ID" />
</el-form-item>
<el-form-item label="被回复的用户ID" prop="replyUserId">
<el-input v-model="formData.replyUserId" placeholder="请输入被回复的用户ID" />
</el-form-item>
<el-form-item label="版本号" prop="version">
<el-input v-model="formData.version" 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 { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { CircleReviewApi, CircleReviewVO } from '@/api/mall/promotion/circlereview'
/** 动态的评论 表单 */
defineOptions({ name: 'CircleReviewForm' })
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
userId: undefined,
circleId: undefined,
type: undefined,
content: undefined,
picUrl: undefined,
likeCount: undefined,
replyId: undefined,
replyUserId: undefined,
version: undefined
})
const formRules = reactive({
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await CircleReviewApi.getCircleReview(id)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
await formRef.value.validate()
//
formLoading.value = true
try {
const data = formData.value as unknown as CircleReviewVO
if (formType.value === 'create') {
await CircleReviewApi.createCircleReview(data)
message.success(t('common.createSuccess'))
} else {
await CircleReviewApi.updateCircleReview(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
userId: undefined,
circleId: undefined,
type: undefined,
content: undefined,
picUrl: undefined,
likeCount: undefined,
replyId: undefined,
replyUserId: undefined,
version: undefined
}
formRef.value?.resetFields()
}
</script>

View File

@ -0,0 +1,268 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="用户id" prop="userId">
<el-input
v-model="queryParams.userId"
placeholder="请输入用户id"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="动态id" prop="circleId">
<el-input
v-model="queryParams.circleId"
placeholder="请输入动态id"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="评论类型" prop="type">
<el-select
v-model="queryParams.type"
placeholder="请选择评论类型"
clearable
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.CIRCLE_REVIEW_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="点赞量" prop="likeCount">
<el-input
v-model="queryParams.likeCount"
placeholder="请输入点赞量"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<!-- <el-form-item label="被回复的评论ID" prop="replyId">
<el-input
v-model="queryParams.replyId"
placeholder="请输入被回复的评论ID"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="被回复的用户ID" prop="replyUserId">
<el-input
v-model="queryParams.replyUserId"
placeholder="请输入被回复的用户ID"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item> -->
<!-- <el-form-item label="版本号" prop="version">
<el-input
v-model="queryParams.version"
placeholder="请输入版本号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item> -->
<el-form-item label="创建时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
value-format="YYYY-MM-DD HH:mm:ss"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class="!w-240px"
/>
</el-form-item>
<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
type="primary"
plain
@click="openForm('create')"
v-hasPermi="['promotion:circle-review:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['promotion:circle-review:export']"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="用户id" align="center" prop="userId" />
<el-table-column label="动态id" align="center" prop="circleId" />
<el-table-column label="评论类型" align="center" prop="type">
<template #default="scope">
<dict-tag :type="DICT_TYPE.CIRCLE_REVIEW_TYPE" :value="scope.row.type" />
</template>
</el-table-column>
<el-table-column label="评论内容" align="center" prop="content" />
<el-table-column label="图片地址" align="center" prop="picUrl" />
<el-table-column label="点赞量" align="center" prop="likeCount" />
<!-- <el-table-column label="被回复的评论ID" align="center" prop="replyId" /> -->
<!-- <el-table-column label="被回复的用户ID" align="center" prop="replyUserId" /> -->
<!-- <el-table-column label="版本号" align="center" prop="version" /> -->
<el-table-column
label="创建时间"
align="center"
prop="createTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
link
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['promotion:circle-review:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['promotion:circle-review:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<CircleReviewForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { CircleReviewApi, CircleReviewVO } from '@/api/mall/promotion/circlereview'
import CircleReviewForm from './CircleReviewForm.vue'
/** 动态的评论 列表 */
defineOptions({ name: 'CircleReview' })
const message = useMessage() //
const { t } = useI18n() //
const loading = ref(true) //
const list = ref<CircleReviewVO[]>([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
userId: undefined,
circleId: undefined,
type: undefined,
content: undefined,
picUrl: undefined,
likeCount: undefined,
replyId: undefined,
replyUserId: undefined,
version: undefined,
createTime: []
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await CircleReviewApi.getCircleReviewPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await CircleReviewApi.deleteCircleReview(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await CircleReviewApi.exportCircleReview(queryParams)
download.excel(data, '动态的评论.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
})
</script>

View File

@ -203,7 +203,7 @@
}, },
//广 //广
handelExtend(id) { handelExtend(id) {
this.extendLink = 'http://101.43.112.107/form/extendLink/form?id=' + id this.extendLink = 'http://zysc.fjptzykj.com/form/extendLink/form?id=' + id
this.extendOpen = true; this.extendOpen = true;
this.extendTitle = "推广链接"; this.extendTitle = "推广链接";
}, },
@ -278,4 +278,4 @@
border: none; border: none;
/* border-bottom:1px solid blue; */ /* border-bottom:1px solid blue; */
} }
</style> </style>

View File

@ -131,4 +131,8 @@ public interface ErrorCodeConstants {
// ========== 客服消息 1-013-020-000 ========== // ========== 客服消息 1-013-020-000 ==========
ErrorCode KEFU_MESSAGE_NOT_EXISTS = new ErrorCode(1_013_020_000, "客服消息不存在"); ErrorCode KEFU_MESSAGE_NOT_EXISTS = new ErrorCode(1_013_020_000, "客服消息不存在");
ErrorCode CIRCLE_NOT_EXISTS = new ErrorCode(1_013_021_000, "商城动态不存在");
ErrorCode CIRCLE_REVIEW_NOT_EXISTS = new ErrorCode(1_013_022_000, "动态的评论不存在");
} }

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.promotion.controller.admin.circle;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.promotion.controller.admin.circle.vo.*;
import cn.iocoder.yudao.module.promotion.dal.dataobject.circle.CircleDO;
import cn.iocoder.yudao.module.promotion.service.circle.CircleService;
@Tag(name = "管理后台 - 商城动态")
@RestController
@RequestMapping("/promotion/circle")
@Validated
public class CircleController {
@Resource
private CircleService circleService;
@PostMapping("/create")
@Operation(summary = "创建商城动态")
@PreAuthorize("@ss.hasPermission('promotion:circle:create')")
public CommonResult<Long> createCircle(@Valid @RequestBody CircleSaveReqVO createReqVO) {
return success(circleService.createCircle(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新商城动态")
@PreAuthorize("@ss.hasPermission('promotion:circle:update')")
public CommonResult<Boolean> updateCircle(@Valid @RequestBody CircleSaveReqVO updateReqVO) {
circleService.updateCircle(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除商城动态")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('promotion:circle:delete')")
public CommonResult<Boolean> deleteCircle(@RequestParam("id") Long id) {
circleService.deleteCircle(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得商城动态")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('promotion:circle:query')")
public CommonResult<CircleRespVO> getCircle(@RequestParam("id") Long id) {
CircleDO circle = circleService.getCircle(id);
return success(BeanUtils.toBean(circle, CircleRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得商城动态分页")
@PreAuthorize("@ss.hasPermission('promotion:circle:query')")
public CommonResult<PageResult<CircleRespVO>> getCirclePage(@Valid CirclePageReqVO pageReqVO) {
PageResult<CircleDO> pageResult = circleService.getCirclePage(pageReqVO);
return success(BeanUtils.toBean(pageResult, CircleRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出商城动态 Excel")
@PreAuthorize("@ss.hasPermission('promotion:circle:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportCircleExcel(@Valid CirclePageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<CircleDO> list = circleService.getCirclePage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "商城动态.xls", "数据", CircleRespVO.class,
BeanUtils.toBean(list, CircleRespVO.class));
}
}

View File

@ -0,0 +1,43 @@
package cn.iocoder.yudao.module.promotion.controller.admin.circle.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
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
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CirclePageReqVO extends PageParam {
@Schema(description = "用户编号", example = "20140")
private Long userId;
@Schema(description = "发表内容")
private String content;
@Schema(description = "图片地址", example = "https://www.iocoder.cn")
private String picUrl;
@Schema(description = "点赞量", example = "22573")
private Long likeCount;
@Schema(description = "访问量", example = "14008")
private Long lookCount;
@Schema(description = "评论数量", example = "8684")
private Long commentCount;
@Schema(description = "更新版本号")
private Integer version;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,56 @@
package cn.iocoder.yudao.module.promotion.controller.admin.circle.vo;
import cn.iocoder.yudao.module.promotion.dal.dataobject.circle.CircleDO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.circlereview.CircleReviewDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 商城动态 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CircleRespVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "5886")
@ExcelProperty("编号")
private Long id;
@Schema(description = "用户编号", example = "20140")
@ExcelProperty("用户编号")
private Long userId;
@Schema(description = "发表内容")
@ExcelProperty("发表内容")
private String content;
@Schema(description = "图片地址", example = "https://www.iocoder.cn")
@ExcelProperty("图片地址")
private String picUrl;
@Schema(description = "点赞量", example = "22573")
@ExcelProperty("点赞量")
private Long likeCount;
@Schema(description = "访问量", example = "14008")
@ExcelProperty("访问量")
private Long lookCount;
@Schema(description = "评论数量", example = "8684")
@ExcelProperty("评论数量")
private Long commentCount;
@Schema(description = "更新版本号")
@ExcelProperty("更新版本号")
private Integer version;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "评论信息")
private List<CircleReviewDO> circleList;
}

View File

@ -0,0 +1,36 @@
package cn.iocoder.yudao.module.promotion.controller.admin.circle.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 商城动态新增/修改 Request VO")
@Data
public class CircleSaveReqVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "5886")
private Long id;
@Schema(description = "用户编号", example = "20140")
private Long userId;
@Schema(description = "发表内容")
private String content;
@Schema(description = "图片地址", example = "https://www.iocoder.cn")
private String picUrl;
@Schema(description = "点赞量", example = "22573")
private Long likeCount;
@Schema(description = "访问量", example = "14008")
private Long lookCount;
@Schema(description = "评论数量", example = "8684")
private Long commentCount;
@Schema(description = "更新版本号")
private Integer version;
}

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.promotion.controller.admin.circlereview;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.promotion.controller.admin.circlereview.vo.*;
import cn.iocoder.yudao.module.promotion.dal.dataobject.circlereview.CircleReviewDO;
import cn.iocoder.yudao.module.promotion.service.circlereview.CircleReviewService;
@Tag(name = "管理后台 - 动态的评论")
@RestController
@RequestMapping("/promotion/circle-review")
@Validated
public class CircleReviewController {
@Resource
private CircleReviewService circleReviewService;
@PostMapping("/create")
@Operation(summary = "创建动态的评论")
@PreAuthorize("@ss.hasPermission('promotion:circle-review:create')")
public CommonResult<Long> createCircleReview(@Valid @RequestBody CircleReviewSaveReqVO createReqVO) {
return success(circleReviewService.createCircleReview(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新动态的评论")
@PreAuthorize("@ss.hasPermission('promotion:circle-review:update')")
public CommonResult<Boolean> updateCircleReview(@Valid @RequestBody CircleReviewSaveReqVO updateReqVO) {
circleReviewService.updateCircleReview(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除动态的评论")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('promotion:circle-review:delete')")
public CommonResult<Boolean> deleteCircleReview(@RequestParam("id") Long id) {
circleReviewService.deleteCircleReview(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得动态的评论")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('promotion:circle-review:query')")
public CommonResult<CircleReviewRespVO> getCircleReview(@RequestParam("id") Long id) {
CircleReviewDO circleReview = circleReviewService.getCircleReview(id);
return success(BeanUtils.toBean(circleReview, CircleReviewRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得动态的评论分页")
@PreAuthorize("@ss.hasPermission('promotion:circle-review:query')")
public CommonResult<PageResult<CircleReviewRespVO>> getCircleReviewPage(@Valid CircleReviewPageReqVO pageReqVO) {
PageResult<CircleReviewDO> pageResult = circleReviewService.getCircleReviewPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, CircleReviewRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出动态的评论 Excel")
@PreAuthorize("@ss.hasPermission('promotion:circle-review:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportCircleReviewExcel(@Valid CircleReviewPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<CircleReviewDO> list = circleReviewService.getCircleReviewPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "动态的评论.xls", "数据", CircleReviewRespVO.class,
BeanUtils.toBean(list, CircleReviewRespVO.class));
}
}

View File

@ -0,0 +1,52 @@
package cn.iocoder.yudao.module.promotion.controller.admin.circlereview.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
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
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CircleReviewPageReqVO extends PageParam {
@Schema(description = "用户id", example = "10725")
private Long userId;
@Schema(description = "动态id", example = "17391")
private Long circleId;
@Schema(description = "评论类型", example = "2")
private Integer type;
@Schema(description = "评论内容")
private String content;
@Schema(description = "图片地址", example = "https://www.iocoder.cn")
private String picUrl;
@Schema(description = "点赞量", example = "10166")
private Long likeCount;
@Schema(description = "被回复的评论ID", example = "8913")
private Long replyId;
@Schema(description = "被回复的用户ID", example = "32646")
private Long replyUserId;
@Schema(description = "版本号")
private Integer version;
@Schema(description = "备注")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,65 @@
package cn.iocoder.yudao.module.promotion.controller.admin.circlereview.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 动态的评论 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CircleReviewRespVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12446")
@ExcelProperty("编号")
private Long id;
@Schema(description = "用户id", example = "10725")
@ExcelProperty("用户id")
private Long userId;
@Schema(description = "动态id", example = "17391")
@ExcelProperty("动态id")
private Long circleId;
@Schema(description = "评论类型", example = "2")
@ExcelProperty(value = "评论类型", converter = DictConvert.class)
@DictFormat("circle_review_type") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer type;
@Schema(description = "评论内容")
@ExcelProperty("评论内容")
private String content;
@Schema(description = "图片地址", example = "https://www.iocoder.cn")
@ExcelProperty("图片地址")
private String picUrl;
@Schema(description = "点赞量", example = "10166")
@ExcelProperty("点赞量")
private Long likeCount;
@Schema(description = "被回复的评论ID", example = "8913")
@ExcelProperty("被回复的评论ID")
private Long replyId;
@Schema(description = "被回复的用户ID", example = "32646")
@ExcelProperty("被回复的用户ID")
private Long replyUserId;
@Schema(description = "版本号")
@ExcelProperty("版本号")
private Integer version;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "备注")
private String remark;
}

View File

@ -0,0 +1,45 @@
package cn.iocoder.yudao.module.promotion.controller.admin.circlereview.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 动态的评论新增/修改 Request VO")
@Data
public class CircleReviewSaveReqVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12446")
private Long id;
@Schema(description = "用户id", example = "10725")
private Long userId;
@Schema(description = "动态id", example = "17391")
private Long circleId;
@Schema(description = "评论类型", example = "2")
private Integer type;
@Schema(description = "评论内容")
private String content;
@Schema(description = "图片地址", example = "https://www.iocoder.cn")
private String picUrl;
@Schema(description = "点赞量", example = "10166")
private Long likeCount;
@Schema(description = "被回复的评论ID", example = "8913")
private Long replyId;
@Schema(description = "被回复的用户ID", example = "32646")
private Long replyUserId;
@Schema(description = "版本号")
private Integer version;
@Schema(description = "备注")
private String remark;
}

View File

@ -0,0 +1,106 @@
package cn.iocoder.yudao.module.promotion.controller.app.circle;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
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.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.circlereview.vo.CircleReviewSaveReqVO;
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.service.circle.CircleService;
import cn.iocoder.yudao.module.promotion.service.circlereview.CircleReviewService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId;
@Tag(name = "用户 APP - 商城动态") // 用于提供跨多个活动的 HTTP 接口
@RestController
@RequestMapping("/promotion/circle")
@Validated
public class AppCircleController {
@Resource
private CircleService circleService;
@Resource
private CircleReviewService circleReviewService;
@Resource
private MemberUserApi memberUserApi;
public String utilMethod(Long userId,Long reviewId){
String nickname = memberUserApi.getUser(userId).getNickname();
if (reviewId != null){
String reviewNickname = memberUserApi.getUser(reviewId).getNickname();
return nickname + "回复了" +reviewNickname;
}
return nickname;
}
@GetMapping("/page")
@Operation(summary = "获得商城动态列表")
@PreAuthenticated
public CommonResult<PageResult<CircleRespVO>> getCirclePage(@Valid CirclePageReqVO pageReqVO) {
PageResult<CircleDO> pageResult = circleService.getCirclePage(pageReqVO);
PageResult<CircleRespVO> result = BeanUtils.toBean(pageResult, CircleRespVO.class);
for (CircleRespVO circleRespVO : result.getList()) {
List<CircleReviewDO> listCircleReviewByCircleId = circleReviewService.getListCircleReviewByCircleId(circleRespVO.getId());
for (CircleReviewDO reviewDO : listCircleReviewByCircleId) {
reviewDO.setRemark(utilMethod(reviewDO.getUserId(),reviewDO.getReplyUserId()));
}
circleRespVO.setCircleList(listCircleReviewByCircleId);
}
return success(result);
}
@GetMapping("/doBrowse")
@Operation(summary = "浏览量叠加")
@PreAuthenticated
public CommonResult<Boolean> doBrowse(@RequestParam("id") Long lookId){
circleService.addLookCount(lookId);
return success(true);
}
@GetMapping("/doLike")
@Operation(summary = "点赞/取消点赞")
@PreAuthenticated
public CommonResult<Boolean> doLike(@RequestParam("id") Long lookId){
circleService.updateLikeCount(lookId);
return success(true);
}
@PostMapping("/doReview")
@Operation(summary = "评论/回复")
@PreAuthenticated
public CommonResult<Boolean> doReview(@RequestBody CircleReviewSaveReqVO createReqVO){
createReqVO.setUserId(getLoginUserId());
circleReviewService.createCircleReview(createReqVO);
return success(true);
}
@GetMapping("/doReviewDelete")
@Operation(summary = "删除评论")
@PreAuthenticated
public CommonResult<Boolean> doReviewDelete(@RequestParam("id") Long lookId){
circleReviewService.deleteCircleReview(lookId);
return success(true);
}
@GetMapping("/doCircleDelete")
@Operation(summary = "删除动态")
@PreAuthenticated
public CommonResult<Boolean> doCircleDelete(@RequestParam("id") Long lookId){
circleService.deleteCircle(lookId);
return success(true);
}
}

View File

@ -0,0 +1,59 @@
package cn.iocoder.yudao.module.promotion.dal.dataobject.circle;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 商城动态 DO
*
* @author 管理员
*/
@TableName("promotion_circle")
@KeySequence("promotion_circle_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CircleDO extends BaseDO {
/**
* 编号
*/
@TableId
private Long id;
/**
* 用户编号
*/
private Long userId;
/**
* 发表内容
*/
private String content;
/**
* 图片地址
*/
private String picUrl;
/**
* 点赞量
*/
private Long likeCount;
/**
* 访问量
*/
private Long lookCount;
/**
* 评论数量
*/
private Long commentCount;
/**
* 更新版本号
*/
private Integer version;
}

View File

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.promotion.dal.dataobject.circlereview;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 动态的评论 DO
*
* @author 管理员
*/
@TableName("promotion_circle_review")
@KeySequence("promotion_circle_review_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CircleReviewDO extends BaseDO {
/**
* 编号
*/
@TableId
private Long id;
/**
* 用户id
*/
private Long userId;
/**
* 动态id
*/
private Long circleId;
/**
* 评论类型
*
* 枚举 {@link TODO circle_review_type 对应的类}
*/
private Integer type;
/**
* 评论内容
*/
private String content;
/**
* 图片地址
*/
private String picUrl;
/**
* 点赞量
*/
private Long likeCount;
/**
* 被回复的评论ID
*/
private Long replyId;
/**
* 被回复的用户ID
*/
private Long replyUserId;
/**
* 版本号
*/
private Integer version;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,33 @@
package cn.iocoder.yudao.module.promotion.dal.mysql.circle;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.promotion.dal.dataobject.circle.CircleDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.promotion.controller.admin.circle.vo.*;
/**
* 商城动态 Mapper
*
* @author 管理员
*/
@Mapper
public interface CircleMapper extends BaseMapperX<CircleDO> {
default PageResult<CircleDO> selectPage(CirclePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<CircleDO>()
.eqIfPresent(CircleDO::getUserId, reqVO.getUserId())
.eqIfPresent(CircleDO::getContent, reqVO.getContent())
.eqIfPresent(CircleDO::getPicUrl, reqVO.getPicUrl())
.eqIfPresent(CircleDO::getLikeCount, reqVO.getLikeCount())
.eqIfPresent(CircleDO::getLookCount, reqVO.getLookCount())
.eqIfPresent(CircleDO::getCommentCount, reqVO.getCommentCount())
.eqIfPresent(CircleDO::getVersion, reqVO.getVersion())
.betweenIfPresent(CircleDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(CircleDO::getId));
}
}

View File

@ -0,0 +1,36 @@
package cn.iocoder.yudao.module.promotion.dal.mysql.circlereview;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.promotion.dal.dataobject.circlereview.CircleReviewDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.promotion.controller.admin.circlereview.vo.*;
/**
* 动态的评论 Mapper
*
* @author 管理员
*/
@Mapper
public interface CircleReviewMapper extends BaseMapperX<CircleReviewDO> {
default PageResult<CircleReviewDO> selectPage(CircleReviewPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<CircleReviewDO>()
.eqIfPresent(CircleReviewDO::getUserId, reqVO.getUserId())
.eqIfPresent(CircleReviewDO::getCircleId, reqVO.getCircleId())
.eqIfPresent(CircleReviewDO::getType, reqVO.getType())
.eqIfPresent(CircleReviewDO::getContent, reqVO.getContent())
.eqIfPresent(CircleReviewDO::getPicUrl, reqVO.getPicUrl())
.eqIfPresent(CircleReviewDO::getLikeCount, reqVO.getLikeCount())
.eqIfPresent(CircleReviewDO::getReplyId, reqVO.getReplyId())
.eqIfPresent(CircleReviewDO::getReplyUserId, reqVO.getReplyUserId())
.eqIfPresent(CircleReviewDO::getVersion, reqVO.getVersion())
.eqIfPresent(CircleReviewDO::getRemark, reqVO.getRemark())
.betweenIfPresent(CircleReviewDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(CircleReviewDO::getId));
}
}

View File

@ -0,0 +1,61 @@
package cn.iocoder.yudao.module.promotion.service.circle;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.promotion.controller.admin.circle.vo.*;
import cn.iocoder.yudao.module.promotion.dal.dataobject.circle.CircleDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 商城动态 Service 接口
*
* @author 管理员
*/
public interface CircleService {
/**
* 创建商城动态
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createCircle(@Valid CircleSaveReqVO createReqVO);
/**
* 更新商城动态
*
* @param updateReqVO 更新信息
*/
void updateCircle(@Valid CircleSaveReqVO updateReqVO);
//浏览量叠加
void addLookCount(Long circleId);
//点赞/取消点赞
void updateLikeCount(Long circleId);
/**
* 删除商城动态
*
* @param id 编号
*/
void deleteCircle(Long id);
/**
* 获得商城动态
*
* @param id 编号
* @return 商城动态
*/
CircleDO getCircle(Long id);
/**
* 获得商城动态分页
*
* @param pageReqVO 分页查询
* @return 商城动态分页
*/
PageResult<CircleDO> getCirclePage(CirclePageReqVO pageReqVO);
}

View File

@ -0,0 +1,88 @@
package cn.iocoder.yudao.module.promotion.service.circle;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.promotion.controller.admin.circle.vo.*;
import cn.iocoder.yudao.module.promotion.dal.dataobject.circle.CircleDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.promotion.dal.mysql.circle.CircleMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.*;
/**
* 商城动态 Service 实现类
*
* @author 管理员
*/
@Service
@Validated
public class CircleServiceImpl implements CircleService {
@Resource
private CircleMapper circleMapper;
@Override
public Long createCircle(CircleSaveReqVO createReqVO) {
// 插入
CircleDO circle = BeanUtils.toBean(createReqVO, CircleDO.class);
circleMapper.insert(circle);
// 返回
return circle.getId();
}
@Override
public void updateCircle(CircleSaveReqVO updateReqVO) {
// 校验存在
validateCircleExists(updateReqVO.getId());
// 更新
CircleDO updateObj = BeanUtils.toBean(updateReqVO, CircleDO.class);
circleMapper.updateById(updateObj);
}
@Override
public void addLookCount(Long circleId) {
CircleDO circleDO = circleMapper.selectOne("id", circleId);
circleDO.setLookCount(circleDO.getLookCount() + 1);
circleMapper.updateById(circleDO);
}
@Override
public void updateLikeCount(Long circleId) {
CircleDO circleDO = circleMapper.selectOne("id", circleId);
circleDO.setLookCount(circleDO.getLikeCount() + 1);
circleMapper.updateById(circleDO);
}
@Override
public void deleteCircle(Long id) {
// 校验存在
validateCircleExists(id);
// 删除
circleMapper.deleteById(id);
}
private void validateCircleExists(Long id) {
if (circleMapper.selectById(id) == null) {
throw exception(CIRCLE_NOT_EXISTS);
}
}
@Override
public CircleDO getCircle(Long id) {
return circleMapper.selectById(id);
}
@Override
public PageResult<CircleDO> getCirclePage(CirclePageReqVO pageReqVO) {
return circleMapper.selectPage(pageReqVO);
}
}

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.module.promotion.service.circlereview;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.promotion.controller.admin.circlereview.vo.*;
import cn.iocoder.yudao.module.promotion.dal.dataobject.circlereview.CircleReviewDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 动态的评论 Service 接口
*
* @author 管理员
*/
public interface CircleReviewService {
/**
* 创建动态的评论
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createCircleReview(@Valid CircleReviewSaveReqVO createReqVO);
/**
* 更新动态的评论
*
* @param updateReqVO 更新信息
*/
void updateCircleReview(@Valid CircleReviewSaveReqVO updateReqVO);
/**
* 删除动态的评论
*
* @param id 编号
*/
void deleteCircleReview(Long id);
/**
* 获得动态的评论
*
* @param id 编号
* @return 动态的评论
*/
CircleReviewDO getCircleReview(Long id);
List<CircleReviewDO> getListCircleReviewByCircleId(Long circleId);
/**
* 获得动态的评论分页
*
* @param pageReqVO 分页查询
* @return 动态的评论分页
*/
PageResult<CircleReviewDO> getCircleReviewPage(CircleReviewPageReqVO pageReqVO);
}

View File

@ -0,0 +1,79 @@
package cn.iocoder.yudao.module.promotion.service.circlereview;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.promotion.controller.admin.circlereview.vo.*;
import cn.iocoder.yudao.module.promotion.dal.dataobject.circlereview.CircleReviewDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.promotion.dal.mysql.circlereview.CircleReviewMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.*;
/**
* 动态的评论 Service 实现类
*
* @author 管理员
*/
@Service
@Validated
public class CircleReviewServiceImpl implements CircleReviewService {
@Resource
private CircleReviewMapper circleReviewMapper;
@Override
public Long createCircleReview(CircleReviewSaveReqVO createReqVO) {
// 插入
CircleReviewDO circleReview = BeanUtils.toBean(createReqVO, CircleReviewDO.class);
circleReviewMapper.insert(circleReview);
// 返回
return circleReview.getId();
}
@Override
public void updateCircleReview(CircleReviewSaveReqVO updateReqVO) {
// 校验存在
validateCircleReviewExists(updateReqVO.getId());
// 更新
CircleReviewDO updateObj = BeanUtils.toBean(updateReqVO, CircleReviewDO.class);
circleReviewMapper.updateById(updateObj);
}
@Override
public void deleteCircleReview(Long id) {
// 校验存在
validateCircleReviewExists(id);
// 删除
circleReviewMapper.deleteById(id);
}
private void validateCircleReviewExists(Long id) {
if (circleReviewMapper.selectById(id) == null) {
throw exception(CIRCLE_REVIEW_NOT_EXISTS);
}
}
@Override
public CircleReviewDO getCircleReview(Long id) {
return circleReviewMapper.selectById(id);
}
@Override
public List<CircleReviewDO> getListCircleReviewByCircleId(Long circleId) {
return circleReviewMapper.selectList("circle_id", circleId);
}
@Override
public PageResult<CircleReviewDO> getCircleReviewPage(CircleReviewPageReqVO pageReqVO) {
return circleReviewMapper.selectPage(pageReqVO);
}
}

View File

@ -44,7 +44,8 @@ public class RewardActivityServiceImpl implements RewardActivityService {
// 插入 // 插入
RewardActivityDO rewardActivity = RewardActivityConvert.INSTANCE.convert(createReqVO) RewardActivityDO rewardActivity = RewardActivityConvert.INSTANCE.convert(createReqVO)
.setStatus(PromotionUtils.calculateActivityStatus(createReqVO.getEndTime())); .setStatus(PromotionUtils.calculateRewardActivityStatus(createReqVO.getStartTime(),
createReqVO.getEndTime()));
rewardActivityMapper.insert(rewardActivity); rewardActivityMapper.insert(rewardActivity);
// 返回 // 返回
return rewardActivity.getId(); return rewardActivity.getId();

View File

@ -2,8 +2,10 @@ package cn.iocoder.yudao.module.promotion.util;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
import cn.iocoder.yudao.module.promotion.enums.common.PromotionActivityStatusEnum;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/** /**
* 活动工具类 * 活动工具类
@ -22,4 +24,17 @@ public class PromotionUtils {
return LocalDateTimeUtils.beforeNow(endTime) ? CommonStatusEnum.DISABLE.getStatus() : CommonStatusEnum.ENABLE.getStatus(); return LocalDateTimeUtils.beforeNow(endTime) ? CommonStatusEnum.DISABLE.getStatus() : CommonStatusEnum.ENABLE.getStatus();
} }
public static Integer calculateRewardActivityStatus(LocalDateTime starTime, LocalDateTime endTime) {
if (LocalDateTimeUtils.afterNow(starTime)){
return PromotionActivityStatusEnum.WAIT.getStatus();
}
if (LocalDateTimeUtils.beforeNow(starTime) && LocalDateTimeUtils.afterNow(endTime)){
return PromotionActivityStatusEnum.RUN.getStatus();
}
if (LocalDateTimeUtils.beforeNow(endTime)){
return PromotionActivityStatusEnum.END.getStatus();
}
return PromotionActivityStatusEnum.CLOSE.getStatus();
}
} }