Compare commits
19 Commits
074278c9bd
...
bd834f366d
Author | SHA1 | Date | |
---|---|---|---|
bd834f366d | |||
e9c46ea4e1 | |||
bca9290872 | |||
7ad4e0ed52 | |||
c373bcb8e0 | |||
fb40e7fb15 | |||
9fd3f4b7e2 | |||
4fc63dc326 | |||
19c6fec3dc | |||
fb3bdc1558 | |||
be9593e214 | |||
eead90abb2 | |||
527e0210de | |||
7dcb1ef9a9 | |||
566cf302c4 | |||
232976d532 | |||
f2297720fc | |||
e406f885d9 | |||
f7f702673b |
66
.drone-all.yml
Normal file
66
.drone-all.yml
Normal file
@ -0,0 +1,66 @@
|
||||
kind: pipeline # 定义对象类型,还有secret和signature两种类型
|
||||
|
||||
type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
|
||||
|
||||
name: filesystem-drone # 定义流水线名称
|
||||
|
||||
clone:
|
||||
disable: true
|
||||
steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
||||
|
||||
- name: build-copy-vue
|
||||
|
||||
image: appleboy/drone-ssh # SSH工具镜像
|
||||
|
||||
settings:
|
||||
|
||||
host: 101.43.112.107 # 远程连接地址
|
||||
|
||||
username: root # 远程连接账号
|
||||
|
||||
password:
|
||||
|
||||
from_secret: ssh_password
|
||||
|
||||
port: 22 # 远程连接端口
|
||||
command_timeout: 20m # 远程执行命令超时时间
|
||||
|
||||
script:
|
||||
- ssh root@47.118.40.3 "sh -c 'cd /build_project/allLikeMall/yudao-admin-vue3 && git pull origin master && /usr/bin/pnpm install && /usr/bin/pnpm run build:prod && zip -r dist-prod.zip dist-prod'"
|
||||
- scp root@47.118.40.3:/build_project/allLikeMall/yudao-admin-vue3/dist-prod.zip /build_package/
|
||||
- scp /build_package/dist-prod.zip root@1.14.205.126:/build_package/
|
||||
- name: build-java-and-vue
|
||||
|
||||
image: appleboy/drone-ssh # SSH工具镜像
|
||||
|
||||
settings:
|
||||
|
||||
host: 1.14.205.126 # 远程连接地址
|
||||
|
||||
username: root # 远程连接账号
|
||||
|
||||
password:
|
||||
|
||||
from_secret: ssh_password # 从Secret中读取SSH密码
|
||||
|
||||
port: 22 # 远程连接端口
|
||||
|
||||
command_timeout: 30m # 远程执行命令超时时间
|
||||
|
||||
script:
|
||||
- echo "build-java......"
|
||||
- cd /root/allLikeMall
|
||||
- git fetch origin
|
||||
- git reset --hard origin/master
|
||||
- git clean -fd
|
||||
- /root/apache-maven-3.9.4/bin/mvn package -Dmaven.test.skip=true
|
||||
- cd yudao-server
|
||||
- chmod +x all.sh
|
||||
- ./all.sh
|
||||
- echo "build-vue......"
|
||||
- cd /build_package
|
||||
- rm -rf dist-prod
|
||||
- unzip dist-prod.zip
|
||||
- rm -rf /root/nginx/html/mall
|
||||
- mv dist-prod /root/nginx/html/mall
|
||||
|
@ -7,8 +7,6 @@ name: filesystem-drone # 定义流水线名称
|
||||
clone:
|
||||
disable: true
|
||||
steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
||||
|
||||
- name: build-start
|
||||
|
||||
image: appleboy/drone-ssh # SSH工具镜像
|
||||
|
||||
@ -27,6 +25,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
||||
command_timeout: 30m # 远程执行命令超时时间
|
||||
|
||||
script:
|
||||
- echo "build-java......"
|
||||
- cd /root/allLikeMall
|
||||
- git fetch origin
|
||||
- git reset --hard origin/master
|
57
.drone-vue.yml
Normal file
57
.drone-vue.yml
Normal file
@ -0,0 +1,57 @@
|
||||
kind: pipeline # 定义对象类型,还有secret和signature两种类型
|
||||
|
||||
type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
|
||||
|
||||
name: filesystem-drone # 定义流水线名称
|
||||
|
||||
clone:
|
||||
disable: true
|
||||
steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
||||
|
||||
- name: build-copy-vue
|
||||
|
||||
image: appleboy/drone-ssh # SSH工具镜像
|
||||
|
||||
settings:
|
||||
|
||||
host: 101.43.112.107 # 远程连接地址
|
||||
|
||||
username: root # 远程连接账号
|
||||
|
||||
password:
|
||||
|
||||
from_secret: ssh_password
|
||||
|
||||
port: 22 # 远程连接端口
|
||||
command_timeout: 20m # 远程执行命令超时时间
|
||||
|
||||
script:
|
||||
- ssh root@47.118.40.3 "sh -c 'cd /build_project/allLikeMall/yudao-admin-vue3 && git pull origin master && /usr/bin/pnpm install && /usr/bin/pnpm run build:prod && zip -r dist-prod.zip dist-prod'"
|
||||
- scp root@47.118.40.3:/build_project/allLikeMall/yudao-admin-vue3/dist-prod.zip /build_package/
|
||||
- scp /build_package/dist-prod.zip root@1.14.205.126:/build_package/
|
||||
- name: build-vue
|
||||
|
||||
image: appleboy/drone-ssh # SSH工具镜像
|
||||
|
||||
settings:
|
||||
|
||||
host: 1.14.205.126 # 远程连接地址
|
||||
|
||||
username: root # 远程连接账号
|
||||
|
||||
password:
|
||||
|
||||
from_secret: ssh_password # 从Secret中读取SSH密码
|
||||
|
||||
port: 22 # 远程连接端口
|
||||
|
||||
command_timeout: 30m # 远程执行命令超时时间
|
||||
|
||||
script:
|
||||
- echo "build-vue......"
|
||||
- cd /build_package
|
||||
- rm -rf dist-prod
|
||||
- unzip dist-prod.zip
|
||||
- rm -rf /root/nginx/html/mall
|
||||
- mv dist-prod /root/nginx/html/mall
|
||||
|
@ -1,195 +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="mobile">
|
||||
<el-input v-model="formData.mobile" placeholder="请输入手机号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input v-model="formData.password" placeholder="请输入密码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="formData.status">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="注册 IP" prop="registerIp">
|
||||
<el-input v-model="formData.registerIp" placeholder="请输入注册 IP" />
|
||||
</el-form-item>
|
||||
<el-form-item label="注册终端" prop="registerTerminal">
|
||||
<el-input v-model="formData.registerTerminal" placeholder="请输入注册终端" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最后登录IP" prop="loginIp">
|
||||
<el-input v-model="formData.loginIp" placeholder="请输入最后登录IP" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最后登录时间" prop="loginDate">
|
||||
<el-date-picker
|
||||
v-model="formData.loginDate"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="选择最后登录时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户昵称" prop="nickname">
|
||||
<el-input v-model="formData.nickname" placeholder="请输入用户昵称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="头像" prop="avatar">
|
||||
<el-input v-model="formData.avatar" placeholder="请输入头像" />
|
||||
</el-form-item>
|
||||
<el-form-item label="真实名字" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入真实名字" />
|
||||
</el-form-item>
|
||||
<el-form-item label="性别" prop="sex">
|
||||
<el-radio-group v-model="formData.sex">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="出生日期" prop="birthday">
|
||||
<el-date-picker
|
||||
v-model="formData.birthday"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="选择出生日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所在地" prop="areaId">
|
||||
<el-input v-model="formData.areaId" placeholder="请输入所在地" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户备注" prop="mark">
|
||||
<el-input v-model="formData.mark" placeholder="请输入用户备注" />
|
||||
</el-form-item>
|
||||
<el-form-item label="积分" prop="point">
|
||||
<el-input v-model="formData.point" placeholder="请输入积分" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户标签编号列表,以逗号分隔" prop="tagIds">
|
||||
<el-input v-model="formData.tagIds" placeholder="请输入用户标签编号列表,以逗号分隔" />
|
||||
</el-form-item>
|
||||
<el-form-item label="等级编号" prop="levelId">
|
||||
<el-input v-model="formData.levelId" placeholder="请输入等级编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="经验" prop="experience">
|
||||
<el-input v-model="formData.experience" placeholder="请输入经验" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户分组编号" prop="groupId">
|
||||
<el-input v-model="formData.groupId" 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 { PaidMemberUserApi, PaidMemberUserVO } from '@/api/member/memberuser'
|
||||
|
||||
/** 付费会员 表单 */
|
||||
defineOptions({ name: 'PaidMemberUserForm' })
|
||||
|
||||
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,
|
||||
mobile: undefined,
|
||||
password: undefined,
|
||||
status: undefined,
|
||||
registerIp: undefined,
|
||||
registerTerminal: undefined,
|
||||
loginIp: undefined,
|
||||
loginDate: undefined,
|
||||
nickname: undefined,
|
||||
avatar: undefined,
|
||||
name: undefined,
|
||||
sex: undefined,
|
||||
birthday: undefined,
|
||||
areaId: undefined,
|
||||
mark: undefined,
|
||||
point: undefined,
|
||||
tagIds: undefined,
|
||||
levelId: undefined,
|
||||
experience: undefined,
|
||||
groupId: 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 PaidMemberUserApi.getPaidMemberUser(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 PaidMemberUserVO
|
||||
if (formType.value === 'create') {
|
||||
await PaidMemberUserApi.createPaidMemberUser(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await PaidMemberUserApi.updatePaidMemberUser(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
mobile: undefined,
|
||||
password: undefined,
|
||||
status: undefined,
|
||||
registerIp: undefined,
|
||||
registerTerminal: undefined,
|
||||
loginIp: undefined,
|
||||
loginDate: undefined,
|
||||
nickname: undefined,
|
||||
avatar: undefined,
|
||||
name: undefined,
|
||||
sex: undefined,
|
||||
birthday: undefined,
|
||||
areaId: undefined,
|
||||
mark: undefined,
|
||||
point: undefined,
|
||||
tagIds: undefined,
|
||||
levelId: undefined,
|
||||
experience: undefined,
|
||||
groupId: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
@ -76,13 +76,13 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="有效期限(天)" align="center" prop="deadlineDay" />
|
||||
<el-table-column label="支付金额(分)" align="center" prop="price" />
|
||||
<el-table-column label="支付金额(元)" align="center" prop="price" :formatter="formPriceInYuan"/>
|
||||
<el-table-column label="支付方式" align="center" prop="payType" />
|
||||
<el-table-column
|
||||
label="购买时间"
|
||||
align="center"
|
||||
prop="payTime"
|
||||
:formatter="dateFormatter"
|
||||
:formatter="dateFormatter2"
|
||||
width="180px"
|
||||
/>
|
||||
</el-table>
|
||||
@ -95,17 +95,15 @@
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<PaidMemberUserForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import { dateFormatter2 } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { PaidMemberUserApi, PaidMemberUserVO } from '@/api/member/memberuser'
|
||||
import * as CardVoApid from '@/api/member/type'
|
||||
import PaidMemberUserForm from './PaidMemberUserForm.vue'
|
||||
import { column } from 'element-plus/es/components/table-v2/src/common'
|
||||
|
||||
/** 付费会员 列表 */
|
||||
defineOptions({ name: 'PaidMemberUser' })
|
||||
@ -167,6 +165,10 @@ const getList = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
/** 将金额单位分转为元 */
|
||||
const formPriceInYuan = (row,column,cellValue) =>{
|
||||
return (cellValue / 100).toFixed(2)
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
|
@ -117,13 +117,14 @@ const submitForm = async () => {
|
||||
if (formType.value === 'create') {
|
||||
await LitemallBrandApi.createLitemallBrand(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
|
||||
} else {
|
||||
await LitemallBrandApi.updateLitemallBrand(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
|
@ -56,7 +56,7 @@
|
||||
<!-- <el-table-column label="门店管理员" align="center" prop="userId" />-->
|
||||
<el-table-column label="门店图片" align="center" prop="picUrl">
|
||||
<template #default="{ row }">
|
||||
<div class="flex">
|
||||
<div class="flex justify-center items-center">
|
||||
<el-image fit="cover" :src="row.picUrl" class="flex-none w-50px h-50px"
|
||||
@click="imagePreview(row.picUrl)" />
|
||||
</div>
|
||||
@ -79,7 +79,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="权重" align="center" prop="weight" />-->
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<!-- <el-table-column label="备注" align="center" prop="remark" /> -->
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" width="180px" />
|
||||
<el-table-column label="操作" align="center" fixed="right" width="110">
|
||||
<template #default="scope">
|
||||
|
@ -8,10 +8,14 @@
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="门店" prop="brandId">
|
||||
<!-- <el-input v-model="formData.brandId" placeholder="请输入门店id" />-->
|
||||
<el-select v-model="formData.brandId" placeholder="请选择门店" clearable class="!w-240px">
|
||||
<el-option v-for="organizationNameOptions in option" :key="organizationNameOptions.id"
|
||||
:label="organizationNameOptions.name" :value="organizationNameOptions.id" />
|
||||
<el-option
|
||||
v-for="organizationNameOptions in option"
|
||||
:key="organizationNameOptions.id"
|
||||
:label="organizationNameOptions.name"
|
||||
:value="organizationNameOptions.id"
|
||||
:disabled="organizationNameOptions.disabled"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目名称" prop="name">
|
||||
|
@ -54,7 +54,7 @@
|
||||
<!-- <el-table-column label="项目图片" align="center" prop="pictrue" /> -->
|
||||
<el-table-column label="项目图片" align="center" prop="pictrue">
|
||||
<template #default="{ row }">
|
||||
<div class="flex" style="display: flex; align-items: center;">
|
||||
<div class="flex justify-center items-center" style="display: flex; align-items: center;">
|
||||
<el-image fit="cover" :src="row.pictrue" class="flex-none w-50px h-50px"
|
||||
@click="imagePreview(row.pictrue)" />
|
||||
</div>
|
||||
|
@ -2,8 +2,8 @@
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
|
||||
<el-form-item label="所属门店" prop="brandId">
|
||||
<el-select v-model="queryParams.brandId" placeholder="请选择门店" clearable class="!w-240px">
|
||||
<el-form-item label="所属项目" prop="brandId">
|
||||
<el-select v-model="queryParams.brandId" placeholder="请选择项目" clearable class="!w-240px">
|
||||
<el-option v-for="organizationNameOptions in option" :key="organizationNameOptions.id"
|
||||
:label="organizationNameOptions.name" :value="organizationNameOptions.id" />
|
||||
</el-select>
|
||||
@ -47,7 +47,7 @@
|
||||
<el-table-column label="名称" align="center" prop="name" />
|
||||
<el-table-column label="图片" align="center" prop="photo">
|
||||
<template #default="{ row }">
|
||||
<div class="flex">
|
||||
<div class="flex justify-center items-center">
|
||||
<el-image fit="cover" :src="row.photo" class="flex-none w-50px h-50px"
|
||||
@click="imagePreview(row.photo)" />
|
||||
</div>
|
||||
|
@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.annotation.security.PermitAll;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -100,6 +101,7 @@ public class AppPointActivityController {
|
||||
return success(result);
|
||||
}
|
||||
|
||||
|
||||
private List<AppPointActivityRespVO> buildAppPointActivityRespVOList(List<PointActivityDO> activityList) {
|
||||
List<PointProductDO> products = pointActivityService.getPointProductListByActivityIds(
|
||||
convertSet(activityList, PointActivityDO::getId));
|
||||
@ -118,4 +120,29 @@ public class AppPointActivityController {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//获取更多积分商品
|
||||
@GetMapping("/pointActivityList")
|
||||
public CommonResult<List<AppPointActivityRespVO>> pointActivityList() {
|
||||
|
||||
|
||||
List<Long> ids = new ArrayList<>();
|
||||
List<PointActivityDO> pointActivityDOS = pointActivityService.pointActivityList();
|
||||
for (int i = 0; i < pointActivityDOS.size(); i++) {
|
||||
PointActivityDO pointActivityDO = pointActivityDOS.get(i);
|
||||
ids.add(pointActivityDO.getId());
|
||||
}
|
||||
|
||||
// 1. 获得开启的活动列表
|
||||
List<PointActivityDO> activityList = pointActivityService.getPointActivityListByIds(ids);
|
||||
activityList.removeIf(activity -> CommonStatusEnum.isDisable(activity.getStatus()));
|
||||
if (CollUtil.isEmpty(activityList)) {
|
||||
return success(Collections.emptyList());
|
||||
}
|
||||
// 2. 拼接返回
|
||||
List<AppPointActivityRespVO> result = buildAppPointActivityRespVOList(activityList);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,9 @@ import cn.iocoder.yudao.module.promotion.controller.admin.point.vo.activity.Poin
|
||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.point.PointActivityDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 积分商城活动 Mapper
|
||||
@ -56,4 +59,10 @@ public interface PointActivityMapper extends BaseMapperX<PointActivityDO> {
|
||||
.setSql("stock = stock + " + count));
|
||||
}
|
||||
|
||||
|
||||
@Select(" select a.* from promotion_point_activity a " +
|
||||
" left join product_spu b on a.spu_id = b.id " +
|
||||
" where b.status = 1 and b.deleted = 0 ")
|
||||
List<PointActivityDO> pointActivityList();
|
||||
|
||||
}
|
@ -109,4 +109,6 @@ public interface PointActivityService {
|
||||
*/
|
||||
PointValidateJoinRespDTO validateJoinPointActivity(Long activityId, Long skuId, Integer count);
|
||||
|
||||
List<PointActivityDO> pointActivityList();
|
||||
|
||||
}
|
@ -306,4 +306,9 @@ public class PointActivityServiceImpl implements PointActivityService {
|
||||
return BeanUtils.toBean(product, PointValidateJoinRespDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PointActivityDO> pointActivityList() {
|
||||
return pointActivityMapper.pointActivityList();
|
||||
}
|
||||
|
||||
}
|
@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.trade.controller.app.delivery.vo.pickup;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalTime;
|
||||
|
||||
@Schema(description = "用户 App - 自提门店 Response VO")
|
||||
@Data
|
||||
public class AppDeliveryPickUpStoreRespVO {
|
||||
@ -37,4 +39,17 @@ public class AppDeliveryPickUpStoreRespVO {
|
||||
@Schema(description = "距离,单位:千米", example = "100") // 只有在用户传递了经纬度时,才进行计算
|
||||
private Double distance;
|
||||
|
||||
/**
|
||||
* 营业开始时间
|
||||
*/
|
||||
private LocalTime openingTime;
|
||||
|
||||
/**
|
||||
* 营业结束时间
|
||||
*/
|
||||
private LocalTime closingTime;
|
||||
|
||||
//门店状态:营业中,休息中
|
||||
private int stat;
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.trade.dal.dataobject.delivery;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
@ -81,4 +82,8 @@ public class DeliveryPickUpStoreDO extends BaseDO {
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
@TableField(exist = false)
|
||||
private int stat;
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.trade.dal.dataobject.type;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 会员卡类型 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("paid_member_card_type")
|
||||
@KeySequence("paid_member_card_type_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TradePaidMemberCardTypeDO extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 会员名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 有效期
|
||||
*/
|
||||
private String vid;
|
||||
/**
|
||||
* 原价
|
||||
*/
|
||||
private BigDecimal originalPrice;
|
||||
/**
|
||||
* 优惠价
|
||||
*/
|
||||
private BigDecimal specialPrice;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private String sort;
|
||||
/**
|
||||
* 是否禁用
|
||||
*/
|
||||
private Boolean status;
|
||||
}
|
@ -72,6 +72,7 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
|
||||
.eq(TradeOrderDO::getUserId, userId)
|
||||
.eqIfPresent(TradeOrderDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(TradeOrderDO::getCommentStatus, reqVO.getCommentStatus())
|
||||
.notLike(TradeOrderDO::getNo,"M")
|
||||
.orderByDesc(TradeOrderDO::getId)); // TODO 芋艿:未来不同的 status,不同的排序
|
||||
}
|
||||
|
||||
@ -79,7 +80,8 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
|
||||
return selectCount(new LambdaQueryWrapperX<TradeOrderDO>()
|
||||
.eq(TradeOrderDO::getUserId, userId)
|
||||
.eqIfPresent(TradeOrderDO::getStatus, status)
|
||||
.eqIfPresent(TradeOrderDO::getCommentStatus, commentStatus));
|
||||
.eqIfPresent(TradeOrderDO::getCommentStatus, commentStatus)
|
||||
.notLike(TradeOrderDO::getNo,"M"));
|
||||
}
|
||||
|
||||
default TradeOrderDO selectOrderByIdAndUserId(Long orderId, Long loginUserId) {
|
||||
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.trade.dal.mysql.type;
|
||||
|
||||
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.trade.dal.dataobject.type.TradePaidMemberCardTypeDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员卡类型 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface TradePaidMemberCardTypeMapper extends BaseMapperX<TradePaidMemberCardTypeDO> {
|
||||
|
||||
default List<TradePaidMemberCardTypeDO> selectListByStatus(Integer status){
|
||||
return selectList(TradePaidMemberCardTypeDO::getStatus, status);
|
||||
}
|
||||
|
||||
default List<TradePaidMemberCardTypeDO> selectListByIsActivate(Integer status){
|
||||
return selectList(new LambdaQueryWrapperX<TradePaidMemberCardTypeDO>()
|
||||
.eqIfPresent(TradePaidMemberCardTypeDO::getStatus,status)
|
||||
.neIfPresent(TradePaidMemberCardTypeDO::getName,"试用")
|
||||
.orderByAsc(TradePaidMemberCardTypeDO::getId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@ -78,7 +79,29 @@ public class DeliveryPickUpStoreServiceImpl implements DeliveryPickUpStoreServic
|
||||
|
||||
@Override
|
||||
public List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreListByStatus(Integer status) {
|
||||
return deliveryPickUpStoreMapper.selectListByStatus(status);
|
||||
List<DeliveryPickUpStoreDO> deliveryPickUpStoreDOS = deliveryPickUpStoreMapper.selectListByStatus(status);
|
||||
for (int i = 0; i < deliveryPickUpStoreDOS.size(); i++) {
|
||||
DeliveryPickUpStoreDO deliveryPickUpStoreDO = deliveryPickUpStoreDOS.get(i);
|
||||
LocalTime openingTime = deliveryPickUpStoreDO.getOpeningTime();
|
||||
LocalTime closingTime = deliveryPickUpStoreDO.getClosingTime();
|
||||
LocalTime currentTime = LocalTime.now(); // 获取当前时间
|
||||
|
||||
boolean isOpen = isStoreOpen(openingTime, closingTime, currentTime);
|
||||
|
||||
if (isOpen) {
|
||||
System.out.println("商店现在是开着的。");
|
||||
deliveryPickUpStoreDO.setStat(1);
|
||||
} else {
|
||||
System.out.println("商店现在是关着的。");
|
||||
deliveryPickUpStoreDO.setStat(0);
|
||||
}
|
||||
}
|
||||
return deliveryPickUpStoreDOS;
|
||||
}
|
||||
|
||||
public static boolean isStoreOpen(LocalTime openingTime, LocalTime closingTime, LocalTime currentTime) {
|
||||
// 检查当前时间是否在开店时间和关店时间之间
|
||||
return !currentTime.isBefore(openingTime) && !currentTime.isAfter(closingTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public interface TradePaidMemberUserService {
|
||||
|
||||
|
||||
|
||||
LocalDateTime getDeadLineDay(String cardName);
|
||||
LocalDateTime getDeadLineDay(String cardName,Long userId);
|
||||
|
||||
TradePaidMemberUserDO getPaidMemberUserByOrderNo(String orderNO);
|
||||
|
||||
@ -34,4 +34,8 @@ public interface TradePaidMemberUserService {
|
||||
|
||||
TradePaidMemberUserDO getByPayOrderId(Long payOrderId);
|
||||
|
||||
/*
|
||||
* 现金支付后更新会员记录状态
|
||||
* */
|
||||
void updateStatus(TradePaidMemberUserDO tradePaidMemberUserDO,String channelCode);
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
package cn.iocoder.yudao.module.trade.service.member;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.member.TradeMemberUserDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.member.TradePaidMemberUserDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.type.TradePaidMemberCardTypeDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.mysql.member.TradePaidMemberUserMapper;
|
||||
import cn.iocoder.yudao.module.trade.service.type.TradePaidMemberCardTypeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.PAID_MEMBER_ORDER_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 会员 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class TradePaidMemberUserServiceImpl implements TradePaidMemberUserService {
|
||||
|
||||
@Resource
|
||||
private TradePaidMemberUserMapper tradePaidMemberUserMapper;
|
||||
|
||||
@Resource
|
||||
private TradeMemberUserService tradeMemberUserService;
|
||||
|
||||
@Resource
|
||||
private TradePaidMemberCardTypeService tradePaidMemberCardTypeService;
|
||||
|
||||
private void validateMemberUserExists(Long id) {
|
||||
if (tradePaidMemberUserMapper.selectById(id) == null) {
|
||||
throw exception(PAID_MEMBER_ORDER_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//获取会员类型对应的过期时间
|
||||
@Override
|
||||
public LocalDateTime getDeadLineDay(String cardName,Long userId) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime deadlineDay;
|
||||
TradeMemberUserDO tradeMemberUserDO = tradeMemberUserService.getUser(userId);
|
||||
//判断是否为会员,是否需要续期
|
||||
if(tradeMemberUserDO.getActivate() !=1
|
||||
&& tradeMemberUserDO.getActivate() != 2
|
||||
&& tradeMemberUserDO.getActivate() != 3){
|
||||
deadlineDay = getDay(cardName,now);
|
||||
}
|
||||
else {
|
||||
List<TradePaidMemberUserDO> list = tradePaidMemberUserMapper.selectList(new LambdaQueryWrapperX<TradePaidMemberUserDO>()
|
||||
.eqIfPresent(TradePaidMemberUserDO::getUid, userId)
|
||||
.isNotNull(TradePaidMemberUserDO::getCardExpirationTime)
|
||||
.orderByDesc(TradePaidMemberUserDO::getId));
|
||||
now = CollUtil.getFirst(list).getCardExpirationTime();
|
||||
deadlineDay = getDay(cardName,now);
|
||||
}
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(FORMAT_YEAR_MONTH_DAY);
|
||||
String dayStr = deadlineDay.format(formatter);
|
||||
LocalDate expireDate = LocalDate.parse(dayStr,formatter);
|
||||
deadlineDay = expireDate.atStartOfDay();
|
||||
return deadlineDay;
|
||||
}
|
||||
|
||||
public LocalDateTime getDay(String cardName,LocalDateTime dateTime) {
|
||||
LocalDateTime deadlineDay;
|
||||
TradePaidMemberCardTypeDO paidMemberCardTypeDO = tradePaidMemberCardTypeService.selectByName(cardName);
|
||||
if (cardName.equals("试用")){
|
||||
deadlineDay = dateTime.plus(Long.parseLong(paidMemberCardTypeDO.getVid()), ChronoUnit.DAYS);
|
||||
} else if (cardName.equals("月卡")) {
|
||||
deadlineDay = dateTime.plus(1,ChronoUnit.MONTHS);
|
||||
} else if (cardName.equals("季卡")) {
|
||||
deadlineDay = dateTime.plus(3,ChronoUnit.MONTHS);
|
||||
} else if (cardName.equals("年卡")) {
|
||||
deadlineDay = dateTime.plus(1,ChronoUnit.YEARS);
|
||||
} else {
|
||||
//永久设置为一个非常远的的日期
|
||||
deadlineDay = LocalDateTime.of(9999,12,31,23,59,59);
|
||||
}
|
||||
return deadlineDay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TradePaidMemberUserDO getPaidMemberUserByOrderNo(String orderNO) {
|
||||
TradePaidMemberUserDO tradePaidMemberUserDO = tradePaidMemberUserMapper.selectOne(TradePaidMemberUserDO::getOrderNo,orderNO);
|
||||
return tradePaidMemberUserDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String currentPayType(String payChannel) {
|
||||
String payType = null;
|
||||
if (payChannel.equals("wallet")){
|
||||
payType = "余额";
|
||||
} else if(payChannel.startsWith("wx")){
|
||||
payType = "微信";
|
||||
} else if (payChannel.startsWith("alipay")) {
|
||||
payType = "支付宝";
|
||||
} else {
|
||||
payType = "模拟支付";
|
||||
}
|
||||
return payType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(TradePaidMemberUserDO updateReqVO) {
|
||||
// 校验存在
|
||||
validateMemberUserExists(updateReqVO.getId());
|
||||
tradePaidMemberUserMapper.updateById(updateReqVO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public TradePaidMemberUserDO getByPayOrderId(Long payOrderId) {
|
||||
TradePaidMemberUserDO tradePaidMemberUserDO = tradePaidMemberUserMapper.selectOne(
|
||||
new LambdaQueryWrapperX<TradePaidMemberUserDO>().eqIfPresent(TradePaidMemberUserDO::getPayOrderId,payOrderId));
|
||||
return tradePaidMemberUserDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(TradePaidMemberUserDO tradePaidMemberUserDO,String channelCode) {
|
||||
tradePaidMemberUserDO.setPayTime(LocalDateTime.now());
|
||||
tradePaidMemberUserDO.setPaid(true);
|
||||
//过期时间
|
||||
LocalDateTime cardExpirationTime = getDeadLineDay(tradePaidMemberUserDO.getPayMemberType(),tradePaidMemberUserDO.getUid());
|
||||
tradePaidMemberUserDO.setCardExpirationTime(cardExpirationTime);
|
||||
tradePaidMemberUserDO.setPayChannel(channelCode);
|
||||
//支付方式
|
||||
String payType = currentPayType(channelCode);
|
||||
tradePaidMemberUserDO.setPayType(payType);
|
||||
//更新会员订单
|
||||
update(tradePaidMemberUserDO);
|
||||
System.out.println("成功更新会员订单paid:"+tradePaidMemberUserDO);
|
||||
//更新用户会员状态
|
||||
tradeMemberUserService.updateActivate(tradePaidMemberUserDO.getPayMemberType(),tradePaidMemberUserDO.getUid());
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
package cn.iocoder.yudao.module.trade.service.member;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.member.TradePaidMemberUserDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.mysql.member.TradePaidMemberUserMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.PAID_MEMBER_ORDER_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 会员 Service 实现类
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class TradeTradePaidMemberUserServiceImpl implements TradePaidMemberUserService {
|
||||
|
||||
@Resource
|
||||
private TradePaidMemberUserMapper tradePaidMemberUserMapper;
|
||||
|
||||
private void validateMemberUserExists(Long id) {
|
||||
if (tradePaidMemberUserMapper.selectById(id) == null) {
|
||||
throw exception(PAID_MEMBER_ORDER_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//获取会员类型对应的过期时间
|
||||
@Override
|
||||
public LocalDateTime getDeadLineDay(String cardName) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime deadlineDay;
|
||||
//判断是否具有过期时间,该操作为续费
|
||||
if (cardName.equals("试用")){
|
||||
deadlineDay = now.plus(1, ChronoUnit.DAYS);
|
||||
} else if (cardName.equals("月卡")) {
|
||||
deadlineDay = now.plus(1,ChronoUnit.MONTHS);
|
||||
} else if (cardName.equals("季卡")) {
|
||||
deadlineDay = now.plus(3,ChronoUnit.MONTHS);
|
||||
} else if (cardName.equals("年卡")) {
|
||||
deadlineDay = now.plus(1,ChronoUnit.YEARS);
|
||||
} else {
|
||||
//永久设置为一个非常远的的日期
|
||||
deadlineDay = LocalDateTime.of(9999,12,31,23,59,59);
|
||||
}
|
||||
return deadlineDay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TradePaidMemberUserDO getPaidMemberUserByOrderNo(String orderNO) {
|
||||
TradePaidMemberUserDO tradePaidMemberUserDO = tradePaidMemberUserMapper.selectOne(TradePaidMemberUserDO::getOrderNo,orderNO);
|
||||
return tradePaidMemberUserDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String currentPayType(String payChannel) {
|
||||
String payType = null;
|
||||
if (payChannel.equals("wallet")){
|
||||
payType = "余额";
|
||||
} else if(payChannel.startsWith("wx")){
|
||||
payType = "微信";
|
||||
} else if (payChannel.startsWith("alipay")) {
|
||||
payType = "支付宝";
|
||||
} else {
|
||||
payType = "模拟支付";
|
||||
}
|
||||
return payType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(TradePaidMemberUserDO updateReqVO) {
|
||||
// 校验存在
|
||||
validateMemberUserExists(updateReqVO.getId());
|
||||
tradePaidMemberUserMapper.updateById(updateReqVO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public TradePaidMemberUserDO getByPayOrderId(Long payOrderId) {
|
||||
TradePaidMemberUserDO tradePaidMemberUserDO = tradePaidMemberUserMapper.selectOne(
|
||||
new LambdaQueryWrapperX<TradePaidMemberUserDO>().eqIfPresent(TradePaidMemberUserDO::getPayOrderId,payOrderId));
|
||||
return tradePaidMemberUserDO;
|
||||
}
|
||||
|
||||
}
|
@ -337,25 +337,14 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||
PayOrderRespDTO payOrder = orderResult.getValue();
|
||||
System.out.println("交易订单成功id:"+id+"和payOrderId:"+payOrderId);
|
||||
//会员用户信息,支付状态修改
|
||||
TradeMemberUserDO tradeMemberUserDO = tradeMemberUserService.getUser(order.getUserId());
|
||||
TradePaidMemberUserDO tradePaidMemberUserDO = tradePaidMemberUserService.getByPayOrderId(payOrderId);
|
||||
if(tradePaidMemberUserDO != null ){
|
||||
System.out.println("进入会员支付修改操作paid:"+tradePaidMemberUserDO+"和member:"+tradeMemberUserDO);
|
||||
tradePaidMemberUserDO.setPayTime(LocalDateTime.now());
|
||||
tradePaidMemberUserDO.setPaid(true);
|
||||
//过期时间
|
||||
LocalDateTime cardExpirationTime = tradePaidMemberUserService.getDeadLineDay(tradePaidMemberUserDO.getPayMemberType());
|
||||
tradePaidMemberUserDO.setCardExpirationTime(cardExpirationTime);
|
||||
tradePaidMemberUserDO.setPayChannel(payOrder.getChannelCode());
|
||||
//支付方式
|
||||
String payType = tradePaidMemberUserService.currentPayType(payOrder.getChannelCode());
|
||||
tradePaidMemberUserDO.setPayType(payType);
|
||||
//更新会员订单
|
||||
tradePaidMemberUserService.update(tradePaidMemberUserDO);
|
||||
System.out.println("成功更新会员订单paid:"+tradePaidMemberUserDO);
|
||||
//更新用户会员状态
|
||||
tradeMemberUserService.updateActivate(tradePaidMemberUserDO.getPayMemberType(),order.getUserId());
|
||||
System.out.println("成功更新用户的会员状态member:"+tradeMemberUserDO);
|
||||
System.out.println("进入会员支付修改操作paid:"+tradePaidMemberUserDO);
|
||||
//更新会员状态
|
||||
tradePaidMemberUserService.updateStatus(tradePaidMemberUserDO,order.getPayChannelCode());
|
||||
//查询最新的用户信息
|
||||
TradeMemberUserDO tradeMemberUserDO = tradeMemberUserService.getUser(order.getUserId());
|
||||
System.out.println("成功更新用户的会员状态member:"+ tradeMemberUserDO);
|
||||
}
|
||||
System.out.println("会员修改操作结束!!!");
|
||||
// 2. 更新 TradeOrderDO 状态为已支付,等待发货
|
||||
|
@ -0,0 +1,52 @@
|
||||
package cn.iocoder.yudao.module.trade.service.type;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.type.TradePaidMemberCardTypeDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员卡类型 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface TradePaidMemberCardTypeService {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除会员卡类型
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deletecard(Long id);
|
||||
|
||||
/**
|
||||
* 获得会员卡类型
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 会员卡类型
|
||||
*/
|
||||
TradePaidMemberCardTypeDO getcard(Long id);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户是否使用试用会员
|
||||
* 查询会员类型列表
|
||||
* @param activate
|
||||
* @return
|
||||
*/
|
||||
List<TradePaidMemberCardTypeDO> getCardTypeList (Integer activate);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据会员卡名查询
|
||||
*/
|
||||
TradePaidMemberCardTypeDO selectByName(String cardName);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package cn.iocoder.yudao.module.trade.service.type;
|
||||
|
||||
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.module.trade.dal.dataobject.type.TradePaidMemberCardTypeDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.mysql.type.TradePaidMemberCardTypeMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.CARD_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 会员卡类型 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class TradePaidMemberCardTypeServiceImpl implements TradePaidMemberCardTypeService {
|
||||
|
||||
@Resource
|
||||
private TradePaidMemberCardTypeMapper cardMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void deletecard(Long id) {
|
||||
// 校验存在
|
||||
validatecardExists(id);
|
||||
// 删除
|
||||
cardMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validatecardExists(Long id) {
|
||||
if (cardMapper.selectById(id) == null) {
|
||||
throw exception(CARD_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TradePaidMemberCardTypeDO getcard(Long id) {
|
||||
return cardMapper.selectById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<TradePaidMemberCardTypeDO> getCardTypeList(Integer activate) {
|
||||
List<TradePaidMemberCardTypeDO> list = new ArrayList<>();
|
||||
Integer status = 1;
|
||||
if(activate == 0){
|
||||
list = cardMapper.selectListByStatus(status);
|
||||
}
|
||||
else {
|
||||
list = cardMapper.selectListByIsActivate(status);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public TradePaidMemberCardTypeDO selectByName(String cardName) {
|
||||
TradePaidMemberCardTypeDO paidMemberCardTypeDO = cardMapper.selectOne(new LambdaQueryWrapperX<TradePaidMemberCardTypeDO>()
|
||||
.eqIfPresent(TradePaidMemberCardTypeDO::getName,cardName));
|
||||
validatecardExists(paidMemberCardTypeDO.getId());
|
||||
return paidMemberCardTypeDO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -7,6 +7,7 @@ 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;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 付费会员分页 Request VO")
|
||||
@ -85,6 +86,7 @@ public class PaidMemberUserPageReqVO extends PageParam {
|
||||
private LocalDateTime[] payTime;
|
||||
|
||||
@Schema(description = "到期时间", example = "2024-11-22 09:30:05")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDateTime cardExpirationTime;
|
||||
|
||||
|
||||
|
@ -102,7 +102,7 @@ public class PaidMemberUserRespVO {
|
||||
@Schema(description = "支付时间", example = "2024-11-22 09:30:05")
|
||||
private LocalDateTime payTime;
|
||||
|
||||
@Schema(description = "到期时间", example = "2024-11-22 09:30:05")
|
||||
@Schema(description = "到期时间", example = "2024-11-22")
|
||||
private LocalDateTime cardExpirationTime;
|
||||
|
||||
|
||||
|
@ -7,6 +7,7 @@ import javax.validation.constraints.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 会员新增/修改 Request VO")
|
||||
@ -82,7 +83,8 @@ public class PaidMemberUserSaveReqVO {
|
||||
@Schema(description = "支付时间", example = "2024-11-22 09:30:05")
|
||||
private LocalDateTime payTime;
|
||||
|
||||
@Schema(description = "到期时间", example = "2024-11-22 09:30:05")
|
||||
@Schema(description = "到期时间", example = "2024-11-22")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDateTime cardExpirationTime;
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@ 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;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
|
||||
@Schema(description = "用户 APP - 用户个人信息 Response VO")
|
||||
@Data
|
||||
@ -50,7 +50,7 @@ public class AppMemberUserInfoRespVO {
|
||||
private String cardName;
|
||||
|
||||
@Schema(description = "过期时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDateTime cardExpirationTime;
|
||||
|
||||
@Schema(description = "用户 App - 会员等级")
|
||||
|
@ -143,7 +143,7 @@ public class MemberUserDO extends TenantBaseDO {
|
||||
private Long groupId;
|
||||
|
||||
/**
|
||||
* 是否绑过卡,是否开通过会员(0:未开通,1:试用,2:有效期,3:永久)
|
||||
* 是否绑过卡,是否开通过会员(0:未开通,1:试用,2:有效期,3:永久,4:过期)
|
||||
*/
|
||||
private Integer activate;
|
||||
|
||||
|
@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.PaidMemberUserDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.user.vo.*;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* 会员 Mapper
|
||||
@ -25,4 +26,15 @@ public interface PaidMemberUserMapper extends BaseMapperX<PaidMemberUserDO> {
|
||||
.likeIfPresent(PaidMemberUserDO::getNickname,reqVO.getNickname())
|
||||
.orderByDesc(PaidMemberUserDO::getId));
|
||||
}
|
||||
|
||||
@Select("SELECT * FROM paid_member_user pmu " +
|
||||
"INNER JOIN (" +
|
||||
" SELECT uid, MAX(card_expiration_time) AS max_card_expiration_time " +
|
||||
" FROM paid_member_user " +
|
||||
" WHERE paid = TRUE " +
|
||||
" GROUP BY uid" +
|
||||
") latest " +
|
||||
"ON pmu.uid = latest.uid AND pmu.card_expiration_time = latest.max_card_expiration_time " +
|
||||
"WHERE pmu.paid = TRUE")
|
||||
List<PaidMemberUserDO> selectLatestPaidMemberUsers();
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.member.job.user;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
||||
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
||||
import cn.iocoder.yudao.module.member.service.user.PaidMemberUserService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component
|
||||
public class PaidMemberUserExpireJob implements JobHandler {
|
||||
|
||||
@Resource
|
||||
private PaidMemberUserService paidMemberUserService;
|
||||
|
||||
|
||||
@Override
|
||||
@TenantJob
|
||||
public String execute(String param) throws Exception {
|
||||
|
||||
int count = paidMemberUserService.expireMemberUser();
|
||||
|
||||
return StrUtil.format("会员过期{}个",count);
|
||||
}
|
||||
}
|
@ -331,7 +331,7 @@ public class MemberUserServiceImpl implements MemberUserService {
|
||||
@Override
|
||||
public void updateActivate(String cardName,Long userId) {
|
||||
MemberUserDO memberUserDO = getUser(userId);
|
||||
//设置个人信息的会员状态,0:未开通,1试用,2有效期,3永久
|
||||
//设置个人信息的会员状态,0:未开通,1试用,2有效期,3永久,4过期
|
||||
if(cardName.equals("永久")){
|
||||
memberUserDO.setActivate(3);
|
||||
}else {
|
||||
|
@ -58,7 +58,12 @@ public interface PaidMemberUserService {
|
||||
|
||||
int getPriceByTtype(Integer activate, String cardName);
|
||||
|
||||
LocalDateTime getDeadLineDay(String cardName);
|
||||
/*
|
||||
* 判断当前是否会员
|
||||
* 为会员则过期时间需要续时长
|
||||
* 不为会员则直接加入过期时间
|
||||
* */
|
||||
LocalDateTime getDeadLineDay(String cardName,Long userId);
|
||||
|
||||
PaidMemberUserDO getPaidMemberUserByOrderNo(String orderNO);
|
||||
|
||||
@ -93,4 +98,8 @@ public interface PaidMemberUserService {
|
||||
public Long buildTradeOrder(PaidMemberUserDO updateReqVO);
|
||||
|
||||
void updateTradeOrderId(Long merchantOrderId, Long payOrderId);
|
||||
|
||||
PaidMemberUserSaveReqVO createPaidMemberUserSaveReqVO(MemberUserDO memberUserDO, String cardName);
|
||||
|
||||
int expireMemberUser();
|
||||
}
|
@ -1,12 +1,8 @@
|
||||
package cn.iocoder.yudao.module.member.service.user;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.member.api.address.MemberAddressApi;
|
||||
import cn.iocoder.yudao.module.member.api.address.dto.MemberAddressRespDTO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.membercardtype.PaidMemberCardTypeDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||
import cn.iocoder.yudao.module.member.service.membercardtype.PaidMemberCardTypeService;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||
@ -23,7 +19,10 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.user.vo.*;
|
||||
@ -35,7 +34,10 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.user.PaidMemberUserMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.addTime;
|
||||
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getTerminal;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
|
||||
|
||||
@ -61,7 +63,7 @@ public class PaidMemberUserServiceImpl implements PaidMemberUserService {
|
||||
private TradeOrderMapper tradeOrderMapper;
|
||||
|
||||
@Resource
|
||||
private MemberAddressApi addressApi;
|
||||
private MemberUserService memberUserService;
|
||||
|
||||
|
||||
@Override
|
||||
@ -110,24 +112,10 @@ public class PaidMemberUserServiceImpl implements PaidMemberUserService {
|
||||
return paidMemberUserMapper.selectById(id);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public PaidMemberUserDO isValidPaidMember(Integer activate, LocalDateTime cardExpirationTime) {
|
||||
// if (activate == 0){
|
||||
// throw exception(PAID_MEMBER_USER_NOT_OPEN);
|
||||
// } else if (activate != 0 && cardExpirationTime.isBefore(LocalDateTime.now())) {
|
||||
// throw exception(PAID_MEMBER_USER_PASSED);
|
||||
// }else {
|
||||
// //当前用户为会员
|
||||
// List<PaidMemberUserDO> list = paidMemberUserMapper.selectList(PaidMemberUserDO::getUid,getLoginUserId(),
|
||||
// )
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public int getPriceByTtype(Integer activate, String cardName) {
|
||||
int price = 0;
|
||||
if(activate == 0){
|
||||
if(activate == 0 || activate == 4){
|
||||
BigDecimal payprice = memberCardTypeService.selectByName(cardName).getOriginalPrice();
|
||||
price = payprice.multiply(new BigDecimal("100")).intValue();
|
||||
}
|
||||
@ -140,22 +128,46 @@ public class PaidMemberUserServiceImpl implements PaidMemberUserService {
|
||||
|
||||
//获取会员类型对应的过期时间
|
||||
@Override
|
||||
public LocalDateTime getDeadLineDay(String cardName) {
|
||||
public LocalDateTime getDeadLineDay(String cardName,Long userId) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime deadlineDay;
|
||||
//判断是否具有过期时间,该操作为续费
|
||||
if (cardName.equals("试用")){
|
||||
deadlineDay = now.plus(1, ChronoUnit.DAYS);
|
||||
} else if (cardName.equals("月卡")) {
|
||||
deadlineDay = now.plus(1,ChronoUnit.MONTHS);
|
||||
} else if (cardName.equals("季卡")) {
|
||||
deadlineDay = now.plus(3,ChronoUnit.MONTHS);
|
||||
} else if (cardName.equals("年卡")) {
|
||||
deadlineDay = now.plus(1,ChronoUnit.YEARS);
|
||||
} else {
|
||||
//永久设置为一个非常远的的日期
|
||||
deadlineDay = LocalDateTime.of(9999,12,31,23,59,59);
|
||||
}
|
||||
MemberUserDO memberUserDO = memberUserService.getUser(userId);
|
||||
//判断是否为会员,是否需要续期
|
||||
if(memberUserDO.getActivate() !=1
|
||||
&& memberUserDO.getActivate() != 2
|
||||
&& memberUserDO.getActivate() != 3){
|
||||
deadlineDay = getDay(cardName,now);
|
||||
}
|
||||
else {
|
||||
List<PaidMemberUserDO> list = paidMemberUserMapper.selectList(new LambdaQueryWrapperX<PaidMemberUserDO>()
|
||||
.eqIfPresent(PaidMemberUserDO::getUid, userId)
|
||||
.isNotNull(PaidMemberUserDO::getCardExpirationTime)
|
||||
.orderByDesc(PaidMemberUserDO::getId));
|
||||
now = CollUtil.getFirst(list).getCardExpirationTime();
|
||||
deadlineDay = getDay(cardName,now);
|
||||
}
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(FORMAT_YEAR_MONTH_DAY);
|
||||
String dayStr = deadlineDay.format(formatter);
|
||||
LocalDate expireDate = LocalDate.parse(dayStr,formatter);
|
||||
deadlineDay = expireDate.atStartOfDay();
|
||||
return deadlineDay;
|
||||
}
|
||||
|
||||
public LocalDateTime getDay(String cardName,LocalDateTime dateTime) {
|
||||
LocalDateTime deadlineDay;
|
||||
PaidMemberCardTypeDO paidMemberCardTypeDO = memberCardTypeService.selectByName(cardName);
|
||||
if (cardName.equals("试用")){
|
||||
deadlineDay = dateTime.plus(Long.parseLong(paidMemberCardTypeDO.getVid()), ChronoUnit.DAYS);
|
||||
} else if (cardName.equals("月卡")) {
|
||||
deadlineDay = dateTime.plus(1,ChronoUnit.MONTHS);
|
||||
} else if (cardName.equals("季卡")) {
|
||||
deadlineDay = dateTime.plus(3,ChronoUnit.MONTHS);
|
||||
} else if (cardName.equals("年卡")) {
|
||||
deadlineDay = dateTime.plus(1,ChronoUnit.YEARS);
|
||||
} else {
|
||||
//永久设置为一个非常远的的日期
|
||||
deadlineDay = LocalDateTime.of(9999,12,31,23,59,59);
|
||||
}
|
||||
return deadlineDay;
|
||||
}
|
||||
|
||||
@ -227,10 +239,6 @@ public class PaidMemberUserServiceImpl implements PaidMemberUserService {
|
||||
orderDO.setUserIp(getClientIP()).setTerminal(getTerminal());
|
||||
orderDO.setDeliveryType(DeliveryTypeEnum.EXPRESS.getType());
|
||||
orderDO.setPayPrice(updateReqVO.getPrice());
|
||||
//获取用户地址
|
||||
// MemberAddressRespDTO address = addressApi.getDefaultAddress(updateReqVO.getUid());
|
||||
// orderDO.setReceiverName(address.getName()).setReceiverMobile(address.getMobile())
|
||||
// .setReceiverAreaId(address.getAreaId()).setReceiverDetailAddress(address.getDetailAddress());
|
||||
//插入新增交易订单
|
||||
tradeOrderMapper.insert(orderDO);
|
||||
//查询最新的交易订单数据
|
||||
@ -252,5 +260,39 @@ public class PaidMemberUserServiceImpl implements PaidMemberUserService {
|
||||
tradeOrderMapper.updateById(orderDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaidMemberUserSaveReqVO createPaidMemberUserSaveReqVO(MemberUserDO memberUserDO, String cardName) {
|
||||
PaidMemberUserSaveReqVO paidMemberUserSaveReqVO = new PaidMemberUserSaveReqVO();
|
||||
//将用户信息复制到会员记录里
|
||||
org.springframework.beans.BeanUtils.copyProperties(memberUserDO,paidMemberUserSaveReqVO);
|
||||
paidMemberUserSaveReqVO.setPayMemberType(cardName);
|
||||
paidMemberUserSaveReqVO.setId(null);
|
||||
paidMemberUserSaveReqVO.setUid(memberUserDO.getId());
|
||||
//获取期限天数
|
||||
String deadlineDay = memberCardTypeService.selectByName(cardName).getVid();
|
||||
paidMemberUserSaveReqVO.setDeadlineDay(deadlineDay);
|
||||
return paidMemberUserSaveReqVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int expireMemberUser() {
|
||||
//1.查询当前会员记录里最新的会员记录
|
||||
List<PaidMemberUserDO> list = paidMemberUserMapper.selectLatestPaidMemberUsers();
|
||||
if(CollUtil.isEmpty(list)){
|
||||
return 0;
|
||||
}
|
||||
//2.遍历执行
|
||||
int count = 0;
|
||||
for (PaidMemberUserDO paidMemberUserDO : list){
|
||||
MemberUserDO memberUserDO = memberUserService.getUser(paidMemberUserDO.getUid());
|
||||
if(paidMemberUserDO.getCardExpirationTime().isBefore(LocalDateTime.now())
|
||||
&& memberUserDO.getActivate() != 4){
|
||||
memberUserDO.setActivate(4);
|
||||
memberUserService.updateUserDo(memberUserDO);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
@ -91,27 +91,21 @@ public class AppPaidMembeController {
|
||||
throw exception(MEMBER_USER_NOT_EXISTS);
|
||||
}
|
||||
PaidMemberUserDO paidMemberUserDO = new PaidMemberUserDO();
|
||||
PaidMemberUserSaveReqVO paidMemberUserSaveReqVO = new PaidMemberUserSaveReqVO();
|
||||
//初始化支付金额,单位为分
|
||||
int price = 0;
|
||||
Long payOrderId = null;
|
||||
Long merchantOrderId = null;
|
||||
//初始化付费会员记录
|
||||
PaidMemberUserSaveReqVO paidMemberUserSaveReqVO = paidMemberUserService.
|
||||
createPaidMemberUserSaveReqVO(memberUserDO,reqVO.getCardName());
|
||||
if(reqVO.getCardName().equals("试用")){
|
||||
BeanUtils.copyProperties(memberUserDO,paidMemberUserSaveReqVO);
|
||||
paidMemberUserSaveReqVO.setPayMemberType(reqVO.getCardName());
|
||||
paidMemberUserSaveReqVO.setId(null);
|
||||
paidMemberUserSaveReqVO.setUid(memberUserDO.getId());
|
||||
paidMemberUserSaveReqVO.setPrice(price);
|
||||
paidMemberUserSaveReqVO.setPaid(true);
|
||||
//获取期限天数
|
||||
String deadlineDay = memberCardService.selectByName(reqVO.getCardName()).getVid();
|
||||
paidMemberUserSaveReqVO.setDeadlineDay(deadlineDay);
|
||||
paidMemberUserSaveReqVO.setPayType("免费领取");
|
||||
//获取支付时间
|
||||
LocalDateTime payTime = LocalDateTime.now();
|
||||
paidMemberUserSaveReqVO.setPayTime(payTime);
|
||||
//获取试用类型的过期时间
|
||||
LocalDateTime cardExpirationTime = paidMemberUserService.getDeadLineDay(reqVO.getCardName());
|
||||
LocalDateTime cardExpirationTime = paidMemberUserService.getDeadLineDay(reqVO.getCardName(),getLoginUserId());
|
||||
paidMemberUserSaveReqVO.setCardExpirationTime(cardExpirationTime);
|
||||
//设置会员订单号
|
||||
paidMemberUserSaveReqVO.setOrderNo(noRedisDAO.generate(PAID_MEMBER_NO_PREFIX));
|
||||
@ -124,15 +118,8 @@ public class AppPaidMembeController {
|
||||
memberUserService.updateUserDo(memberUserDO);
|
||||
}
|
||||
else {
|
||||
BeanUtils.copyProperties(memberUserDO,paidMemberUserSaveReqVO);
|
||||
paidMemberUserSaveReqVO.setId(null);
|
||||
paidMemberUserSaveReqVO.setPayMemberType(reqVO.getCardName());
|
||||
paidMemberUserSaveReqVO.setUid(memberUserDO.getId());
|
||||
//获取实际支付金额(判断是否为会员有无优惠价)
|
||||
price = paidMemberUserService.getPriceByTtype(memberUserDO.getActivate(),reqVO.getCardName());
|
||||
//获取期限天数
|
||||
String deadlineDay = memberCardService.selectByName(reqVO.getCardName()).getVid();
|
||||
paidMemberUserSaveReqVO.setDeadlineDay(deadlineDay);
|
||||
paidMemberUserSaveReqVO.setPrice(price);
|
||||
//设置会员订单号
|
||||
paidMemberUserSaveReqVO.setOrderNo(noRedisDAO.generate(PAID_MEMBER_NO_PREFIX));
|
||||
@ -141,7 +128,7 @@ public class AppPaidMembeController {
|
||||
//查询新增的会员订单记录
|
||||
paidMemberUserDO = paidMemberUserService.getMemberUser(id);
|
||||
//创建交易订单号
|
||||
merchantOrderId = paidMemberUserService.buildTradeOrder(paidMemberUserDO);
|
||||
Long merchantOrderId = paidMemberUserService.buildTradeOrder(paidMemberUserDO);
|
||||
paidMemberUserDO.setMerchantOrderId(String.valueOf(merchantOrderId));
|
||||
//创建支付订单号
|
||||
payOrderId = payOrderService.createOrder(new PayOrderCreateReqDTO()
|
||||
@ -163,22 +150,21 @@ public class AppPaidMembeController {
|
||||
@PostMapping("/update")
|
||||
@Operation(summary = "余额支付")
|
||||
public CommonResult<Boolean> updatePaidMemberUser(@Valid @RequestBody AppPaidMemeberOrderReqDto notifyReqDTO){
|
||||
//获取当前登录用户信息,并判断用户是否为会员
|
||||
MemberUserDO memberUserDO = memberUserService.getUser(getLoginUserId());
|
||||
//获取订单记录
|
||||
PaidMemberUserDO paidMemberUserDO = paidMemberUserService.getMemberUser(notifyReqDTO.getId());
|
||||
// 获取当前用户钱包信息
|
||||
PayWalletDO walletDO = payWalletService.getOrCreateWallet(WebFrameworkUtils.getLoginUserId(),getLoginUserType());
|
||||
// 扣减钱包余额
|
||||
payWalletService.reduceWalletBalance
|
||||
(walletDO.getId(),notifyReqDTO.getId(),PAYMENT,paidMemberUserDO.getPrice());
|
||||
payWalletService.reduceWalletBalanceByCardType
|
||||
(walletDO.getId(),notifyReqDTO.getId(),PAYMENT,paidMemberUserDO.getPrice(),
|
||||
paidMemberUserDO.getPayMemberType());
|
||||
//获取支付时间
|
||||
LocalDateTime payTime = LocalDateTime.now();
|
||||
paidMemberUserDO.setPayTime(payTime);
|
||||
//更新会员订单支付状态为已支付
|
||||
paidMemberUserDO.setPaid(true);
|
||||
//获取试用类型的过期时间
|
||||
LocalDateTime cardExpirationTime = paidMemberUserService.getDeadLineDay(notifyReqDTO.getCardName());
|
||||
LocalDateTime cardExpirationTime = paidMemberUserService.getDeadLineDay(notifyReqDTO.getCardName(),getLoginUserId());
|
||||
paidMemberUserDO.setCardExpirationTime(cardExpirationTime);
|
||||
paidMemberUserDO.setPayChannel(notifyReqDTO.getPayChannel());
|
||||
String payType = paidMemberUserService.currentPayType(notifyReqDTO.getPayChannel());
|
||||
@ -187,8 +173,6 @@ public class AppPaidMembeController {
|
||||
paidMemberUserService.update(paidMemberUserDO);
|
||||
//更新用户会员状态
|
||||
memberUserService.updateActivate(paidMemberUserDO.getPayMemberType(),getLoginUserId());
|
||||
// return success(PayMemberOrderConvert.INSTANCE.convert(paidMemberUserDO.getId(),payOrderId
|
||||
// ,paidMemberUserDO.getCardExpirationTime(),memberUserDO.getActivate()));
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,20 @@ public interface PayWalletService {
|
||||
PayWalletTransactionDO reduceWalletBalance(Long walletId, Long bizId,
|
||||
PayWalletBizTypeEnum bizType, Integer price);
|
||||
|
||||
/**
|
||||
* 根据会员购卡类型
|
||||
* 扣减钱包余额
|
||||
*
|
||||
* @param walletId 钱包 id
|
||||
* @param bizId 业务关联 id
|
||||
* @param bizType 业务关联分类
|
||||
* @param price 扣减金额
|
||||
* @param payMemberType 会员类型
|
||||
* @return 钱包流水
|
||||
*/
|
||||
PayWalletTransactionDO reduceWalletBalanceByCardType(Long walletId, Long bizId,
|
||||
PayWalletBizTypeEnum bizType, Integer price,String payMemberType);
|
||||
|
||||
/**
|
||||
* 增加钱包余额
|
||||
*
|
||||
|
@ -169,6 +169,41 @@ public class PayWalletServiceImpl implements PayWalletService {
|
||||
return walletTransactionService.createWalletTransaction(bo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayWalletTransactionDO reduceWalletBalanceByCardType(Long walletId, Long bizId, PayWalletBizTypeEnum bizType, Integer price, String payMemberType) {
|
||||
// 1. 获取钱包
|
||||
PayWalletDO payWallet = getWallet(walletId);
|
||||
if (payWallet == null) {
|
||||
log.error("[reduceWalletBalance],用户钱包({})不存在.", walletId);
|
||||
throw exception(WALLET_NOT_FOUND);
|
||||
}
|
||||
// 2.1 扣除余额
|
||||
int updateCounts;
|
||||
switch (bizType) {
|
||||
case PAYMENT: {
|
||||
updateCounts = walletMapper.updateWhenConsumption(payWallet.getId(), price);
|
||||
break;
|
||||
}
|
||||
case RECHARGE_REFUND: {
|
||||
updateCounts = walletMapper.updateWhenRechargeRefund(payWallet.getId(), price);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
// TODO 其它类型待实现
|
||||
throw new UnsupportedOperationException("待实现");
|
||||
}
|
||||
}
|
||||
if (updateCounts == 0) {
|
||||
throw exception(WALLET_BALANCE_NOT_ENOUGH);
|
||||
}
|
||||
// 2.2 生成钱包流水
|
||||
Integer afterBalance = payWallet.getBalance() - price;
|
||||
WalletTransactionCreateReqBO bo = new WalletTransactionCreateReqBO().setWalletId(payWallet.getId())
|
||||
.setPrice(-price).setBalance(afterBalance).setBizId(String.valueOf(bizId))
|
||||
.setBizType(bizType.getType()).setTitle(bizType.getDescription()+payMemberType+"类型会员");
|
||||
return walletTransactionService.createWalletTransaction(bo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@SneakyThrows
|
||||
|
@ -70,4 +70,8 @@ public class LitemallBrandDO extends BaseDO {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
//状态:显示下拉框数据显示或隐藏
|
||||
@TableField(exist = false)
|
||||
private boolean disabled;
|
||||
|
||||
}
|
@ -42,6 +42,12 @@ public class LitemallBrandServiceImpl implements LitemallBrandService {
|
||||
public void updateLitemallBrand(LitemallBrandSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateLitemallBrandExists(updateReqVO.getId());
|
||||
|
||||
// //停用门店
|
||||
// if (updateReqVO.getStatus() == 1){
|
||||
//
|
||||
// }
|
||||
|
||||
// 更新
|
||||
LitemallBrandDO updateObj = BeanUtils.toBean(updateReqVO, LitemallBrandDO.class);
|
||||
litemallBrandMapper.updateById(updateObj);
|
||||
@ -73,7 +79,15 @@ public class LitemallBrandServiceImpl implements LitemallBrandService {
|
||||
|
||||
@Override
|
||||
public List<LitemallBrandDO> getOrganization() {
|
||||
return litemallBrandMapper.selectList();
|
||||
List<LitemallBrandDO> litemallBrandDOS = litemallBrandMapper.selectList();
|
||||
for (int i = 0; i < litemallBrandDOS.size(); i++) {
|
||||
LitemallBrandDO litemallBrandDO = litemallBrandDOS.get(i);
|
||||
if (litemallBrandDO.getStatus() == 1){ //关闭
|
||||
litemallBrandDO.setDisabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
return litemallBrandDOS;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user