Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
39a596e6ad
@ -20,7 +20,8 @@ export default {
|
||||
pathRewrite: {},
|
||||
},
|
||||
'/promotion-api/': {
|
||||
target: 'http://180.167.213.26:18085/',
|
||||
// target: 'http://180.167.213.26:18085/',
|
||||
target: 'http://127.0.0.1:18085/',
|
||||
changeOrigin: true,
|
||||
pathRewrite: {},
|
||||
},
|
||||
|
@ -1,16 +1,14 @@
|
||||
import {message} from 'antd';
|
||||
import {
|
||||
addProductRecommend,
|
||||
deleteProductRecommend,
|
||||
queryProductRecommend,
|
||||
updateProductRecommend,
|
||||
updateProductRecommendStatus,
|
||||
addCouponCardTemplate,
|
||||
updateCouponCardTemplate,
|
||||
updateCouponCardTemplateStatus,
|
||||
getCouponCardTemplatePage,
|
||||
} from '../../services/promotion';
|
||||
import PaginationHelper from '../../../helpers/PaginationHelper';
|
||||
|
||||
const SEARCH_PARAMS_DEFAULT = {
|
||||
type: 1,
|
||||
title: '',
|
||||
};
|
||||
|
||||
export default {
|
||||
@ -40,7 +38,10 @@ export default {
|
||||
});
|
||||
|
||||
// 请求
|
||||
const response = yield call(queryProductRecommend, payload);
|
||||
const response = yield call(getCouponCardTemplatePage, {
|
||||
...payload,
|
||||
type: 1
|
||||
});
|
||||
// 响应
|
||||
yield put({
|
||||
type: 'setAll',
|
||||
@ -48,7 +49,7 @@ export default {
|
||||
list: response.data.list,
|
||||
pagination: PaginationHelper.formatPagination(response.data, payload),
|
||||
searchParams: {
|
||||
type: payload.type
|
||||
title: payload.title
|
||||
}
|
||||
},
|
||||
});
|
||||
@ -98,7 +99,7 @@ export default {
|
||||
});
|
||||
|
||||
// 请求
|
||||
const response = yield call(updateProductRecommend, body);
|
||||
const response = yield call(updateCouponCardTemplate, body);
|
||||
// 响应
|
||||
if (response.code === 0) {
|
||||
if (callback) {
|
||||
@ -122,7 +123,7 @@ export default {
|
||||
|
||||
* updateStatus({ payload }, { call, put }) {
|
||||
// 请求
|
||||
const response = yield call(updateProductRecommendStatus, payload);
|
||||
const response = yield call(updateCouponCardTemplateStatus, payload);
|
||||
// 响应
|
||||
if (response.code === 0) {
|
||||
message.info('更新状态成功!');
|
||||
@ -136,21 +137,21 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
* delete({ payload }, { call, put }) {
|
||||
// 请求
|
||||
const response = yield call(deleteProductRecommend, payload);
|
||||
// 响应
|
||||
if (response.code === 0) {
|
||||
message.info('删除成功!');
|
||||
// 刷新列表
|
||||
yield put({
|
||||
type: 'query',
|
||||
payload: {
|
||||
...PaginationHelper.defaultPayload
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
// * delete({ payload }, { call, put }) {
|
||||
// // 请求
|
||||
// const response = yield call(deleteProductRecommend, payload);
|
||||
// // 响应
|
||||
// if (response.code === 0) {
|
||||
// message.info('删除成功!');
|
||||
// // 刷新列表
|
||||
// yield put({
|
||||
// type: 'query',
|
||||
// payload: {
|
||||
// ...PaginationHelper.defaultPayload
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
|
||||
},
|
||||
|
||||
|
@ -32,7 +32,14 @@ const SelectOption = Select.Option;
|
||||
const { TreeNode } = Tree;
|
||||
const RangePicker = DatePicker.RangePicker;
|
||||
const status = ['未知', '正常', '禁用'];
|
||||
const types = ['未知', '新品推荐', '热卖推荐'];
|
||||
const rangeType = {
|
||||
10: '所有可用',
|
||||
20: '部分商品可用',
|
||||
21: '部分商品不可用',
|
||||
30: '部分分类可用',
|
||||
31: '部分分类不可用'};
|
||||
const preferentialType = ['未知', '代金卷', '折扣卷'];
|
||||
const dateType = ['未知', '固定日期', '领取日期'];
|
||||
|
||||
// 列表
|
||||
function List ({ dataSource, loading, pagination, searchParams, dispatch,
|
||||
@ -41,10 +48,10 @@ function List ({ dataSource, loading, pagination, searchParams, dispatch,
|
||||
function handleStatus(record) {
|
||||
Modal.confirm({
|
||||
title: record.status === 1 ? '确认禁用' : '取消禁用',
|
||||
content: `${record.productSpuId}`,
|
||||
content: `${record.title}`,
|
||||
onOk() {
|
||||
dispatch({
|
||||
type: 'productRecommendList/updateStatus',
|
||||
type: 'couponCardTemplateList/updateStatus',
|
||||
payload: {
|
||||
id: record.id,
|
||||
status: record.status === 1 ? 2 : 1,
|
||||
@ -55,48 +62,92 @@ function List ({ dataSource, loading, pagination, searchParams, dispatch,
|
||||
});
|
||||
}
|
||||
|
||||
function handleDelete(record) {
|
||||
Modal.confirm({
|
||||
title: `确认删除?`,
|
||||
content: `${record.productSpuId}`,
|
||||
onOk() {
|
||||
dispatch({
|
||||
type: 'productRecommendList/delete',
|
||||
payload: {
|
||||
id: record.id,
|
||||
},
|
||||
});
|
||||
},
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
// function handleDelete(record) {
|
||||
// Modal.confirm({
|
||||
// title: `确认删除?`,
|
||||
// content: `${record.productSpuId}`,
|
||||
// onOk() {
|
||||
// dispatch({
|
||||
// type: 'couponCardTemplateList/delete',
|
||||
// payload: {
|
||||
// id: record.id,
|
||||
// },
|
||||
// });
|
||||
// },
|
||||
// onCancel() {},
|
||||
// });
|
||||
// }
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '推荐类型',
|
||||
dataIndex: 'type',
|
||||
title: '名称',
|
||||
dataIndex: 'title',
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
dataIndex: 'preferentialType',
|
||||
render(val) {
|
||||
return <span>{types[val]}</span>; // TODO 芋艿,此处要改
|
||||
return <span>{preferentialType[val]}</span>;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '商品',
|
||||
dataIndex: 'productSpuId',
|
||||
title: '优惠内容',
|
||||
render(val, record) {
|
||||
let content;
|
||||
// priceAvailable;
|
||||
if (record.priceAvailable === 0) {
|
||||
content = '无门槛,';
|
||||
} else {
|
||||
content = '满 ' + record.priceAvailable / 100 + ' 元,';
|
||||
}
|
||||
if (record.preferentialType === 1) {
|
||||
content += '减 ' + record.priceOff / 100 + ' 元';
|
||||
} else {
|
||||
content += '打' + record.percentOff / 100.0 + '折';
|
||||
if (record.discountPriceLimit) {
|
||||
content += ', 最多减 ' + record.discountPriceLimit / 100 + ' 元';
|
||||
}
|
||||
}
|
||||
return content;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '排序值',
|
||||
dataIndex: 'sort',
|
||||
title: '可使用商品',
|
||||
dataIndex: 'rangeType',
|
||||
render: val => <span>{rangeType[val]}</span>,
|
||||
},
|
||||
{
|
||||
title: '有效期',
|
||||
render(val, record) {
|
||||
let content = dateType[record.dateType] + ' ';
|
||||
// priceAvailable;
|
||||
if (record.dateType === 1) {
|
||||
content += moment(new Date(record.validStartTime)).format('YYYY-MM-DD')
|
||||
+ '~' + moment(new Date(record.validEndTime)).format('YYYY-MM-DD');
|
||||
} else if (record.dateType === 2) {
|
||||
content += record.fixedStartTerm + '-' + record.fixedEndTerm + ' 天';
|
||||
}
|
||||
return content;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '已领取/剩余',
|
||||
// 已使用 TODO 芋艿
|
||||
// 支付金额(元) TODO 芋艿
|
||||
// 客单价(元) TODO 芋艿
|
||||
render(val, record) {
|
||||
// debugger;
|
||||
return `${record.statFetchNum} / ` + (record.total - record.statFetchNum);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
render(val) {
|
||||
return <span>{status[val]}</span>; // TODO 芋艿,此处要改
|
||||
},
|
||||
render: val => <span>{status[val]}</span>,
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'memo',
|
||||
title: '使用说明',
|
||||
dataIndex: 'description',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
@ -105,7 +156,7 @@ function List ({ dataSource, loading, pagination, searchParams, dispatch,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 360,
|
||||
width: 120,
|
||||
render: (text, record) => {
|
||||
const statusText = record.status === 1 ? '禁用' : '开启'; // TODO 芋艿,此处要改
|
||||
return (
|
||||
@ -115,15 +166,15 @@ function List ({ dataSource, loading, pagination, searchParams, dispatch,
|
||||
<a className={styles.tableDelete} onClick={() => handleStatus(record)}>
|
||||
{statusText}
|
||||
</a>
|
||||
{
|
||||
record.status === 2 ?
|
||||
<span>
|
||||
<Divider type="vertical" />
|
||||
<a className={styles.tableDelete} onClick={() => handleDelete(record)}>
|
||||
删除
|
||||
</a>
|
||||
</span> : null
|
||||
}
|
||||
{/*{*/}
|
||||
{/* record.status === 2 ?*/}
|
||||
{/* <span>*/}
|
||||
{/* <Divider type="vertical" />*/}
|
||||
{/* <a className={styles.tableDelete} onClick={() => handleDelete(record)}>*/}
|
||||
{/* 删除*/}
|
||||
{/* </a>*/}
|
||||
{/* </span> : null*/}
|
||||
{/*}*/}
|
||||
</Fragment>
|
||||
);
|
||||
},
|
||||
@ -132,7 +183,7 @@ function List ({ dataSource, loading, pagination, searchParams, dispatch,
|
||||
|
||||
function onPageChange(page) { // 翻页
|
||||
dispatch({
|
||||
type: 'productRecommendList/query',
|
||||
type: 'couponCardTemplateList/query',
|
||||
payload: {
|
||||
pageNo: page.current,
|
||||
pageSize: page.pageSize,
|
||||
@ -164,7 +215,7 @@ const SearchForm = Form.create()(props => {
|
||||
|
||||
function search() {
|
||||
dispatch({
|
||||
type: 'productRecommendList/query',
|
||||
type: 'couponCardTemplateList/query',
|
||||
payload: {
|
||||
...PaginationHelper.defaultPayload,
|
||||
...form.getFieldsValue()
|
||||
@ -252,6 +303,16 @@ const AddOrUpdateForm = Form.create()(props => {
|
||||
body: {
|
||||
id: formVals.id,
|
||||
...newFileds,
|
||||
priceAvailable: undefined,
|
||||
dateType: undefined,
|
||||
validStartTime: undefined,
|
||||
validEndTime: undefined,
|
||||
fixedStartTerm: undefined,
|
||||
fixedEndTerm: undefined,
|
||||
preferentialType: undefined,
|
||||
priceOff: undefined,
|
||||
percentOff: undefined,
|
||||
discountPriceLimit: undefined,
|
||||
},
|
||||
callback: () => {
|
||||
// 清空表单
|
||||
@ -331,14 +392,14 @@ const AddOrUpdateForm = Form.create()(props => {
|
||||
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="使用金额门槛">
|
||||
{form.getFieldDecorator('priceAvailable', {
|
||||
rules: [{ required: true, message: '请输入使用金额门槛!' },],
|
||||
initialValue: formVals.priceAvailable,
|
||||
})(<InputNumber placeholder="请输入" />)} 元
|
||||
initialValue: formVals.priceAvailable / 100.0,
|
||||
})(<InputNumber disabled={modalType != 'add'} placeholder="请输入" />)} 元
|
||||
</FormItem>
|
||||
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="可用范围">
|
||||
{form.getFieldDecorator('rangeType', {
|
||||
rules: [{ required: true, message: '请选择可用范围!'}, // TODO 芋艿,需要修改
|
||||
],
|
||||
initialValue: formVals.rangeType,
|
||||
initialValue: formVals.rangeType + '',
|
||||
})(
|
||||
<Select placeholder="请选择" style={{ maxWidth: 200, width: '100%' }} onChange={onRangeTypeChange} >
|
||||
<SelectOption value="10">所有可用</SelectOption>
|
||||
@ -366,9 +427,9 @@ const AddOrUpdateForm = Form.create()(props => {
|
||||
{form.getFieldDecorator('dateType', {
|
||||
rules: [{ required: true, message: '请选择可用范围!'}, // TODO 芋艿,需要修改
|
||||
],
|
||||
initialValue: formVals.dateType,
|
||||
initialValue: formVals.dateType + '',
|
||||
})(
|
||||
<Select placeholder="请选择" style={{ maxWidth: 200, width: '100%' }} onChange={onDateTypeChange}>
|
||||
<Select disabled={modalType != 'add'} placeholder="请选择" style={{ maxWidth: 200, width: '100%' }} onChange={onDateTypeChange}>
|
||||
<SelectOption value="1">固定日期</SelectOption>
|
||||
<SelectOption value="2">领取日期</SelectOption>
|
||||
</Select>
|
||||
@ -379,29 +440,29 @@ const AddOrUpdateForm = Form.create()(props => {
|
||||
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="固定日期">
|
||||
{form.getFieldDecorator('validStartTime', {
|
||||
rules: [{ required: true, message: '请输入固定日期!' },],
|
||||
initialValue: formVals.validStartTime,
|
||||
})(<DatePicker format="YYYY-MM-DD" />)}
|
||||
initialValue: formVals.validStartTime ? moment(formVals.validStartTime) : undefined,
|
||||
})(<DatePicker disabled={modalType != 'add'} format="YYYY-MM-DD" />)}
|
||||
-
|
||||
{form.getFieldDecorator('validEndTime', {
|
||||
rules: [{ required: true, message: '请输入固定日期!' },],
|
||||
initialValue: formVals.validEndTime,
|
||||
})(<DatePicker format="YYYY-MM-DD" />)}
|
||||
initialValue: formVals.validEndTime ? moment(formVals.validEndTime) : undefined,
|
||||
})(<DatePicker disabled={modalType != 'add'} format="YYYY-MM-DD" />)}
|
||||
</FormItem> : ''
|
||||
}
|
||||
{
|
||||
formVals.dateType == 2 ?
|
||||
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="领取日期">
|
||||
{form.getFieldDecorator('fixedBeginTerm', {
|
||||
{form.getFieldDecorator('fixedStartTerm', {
|
||||
rules: [{ required: true, message: '请输入固定日期!' },
|
||||
{min: 1, type: 'number', message: '最小值为 1'}],
|
||||
initialValue: formVals.fixedBeginTerm,
|
||||
})(<InputNumber placeholder="请输入" />)}
|
||||
initialValue: formVals.fixedStartTerm,
|
||||
})(<InputNumber disabled={modalType != 'add'} placeholder="请输入" />)}
|
||||
-
|
||||
{form.getFieldDecorator('fixedEndTerm', {
|
||||
rules: [{ required: true, message: '请输入固定日期!' },
|
||||
{min: 1, type: 'number', message: '最小值为 1'}],
|
||||
initialValue: formVals.fixedEndTerm,
|
||||
})(<InputNumber placeholder="请输入" />)} 天
|
||||
})(<InputNumber disabled={modalType != 'add'} placeholder="请输入" />)} 天
|
||||
</FormItem> : ''
|
||||
}
|
||||
|
||||
@ -409,9 +470,9 @@ const AddOrUpdateForm = Form.create()(props => {
|
||||
{form.getFieldDecorator('preferentialType', {
|
||||
rules: [{ required: true, message: '请选择优惠类型!'}, // TODO 芋艿,需要修改
|
||||
],
|
||||
initialValue: formVals.preferentialType,
|
||||
initialValue: formVals.preferentialType + '',
|
||||
})(
|
||||
<Select placeholder="请选择" style={{ maxWidth: 200, width: '100%' }} onChange={onPreferentialTypeChange}>
|
||||
<Select disabled={modalType != 'add'} placeholder="请选择" style={{ maxWidth: 200, width: '100%' }} onChange={onPreferentialTypeChange}>
|
||||
<SelectOption value="1">代金卷</SelectOption>
|
||||
<SelectOption value="2">折扣卷</SelectOption>
|
||||
</Select>
|
||||
@ -423,8 +484,8 @@ const AddOrUpdateForm = Form.create()(props => {
|
||||
{form.getFieldDecorator('priceOff', {
|
||||
rules: [{ required: true, message: '请输入优惠金额!' },
|
||||
{min: 0.01, type: 'number', message: '最小值为 0.01'}],
|
||||
initialValue: formVals.priceOff,
|
||||
})(<InputNumber placeholder="请输入" />)}
|
||||
initialValue: formVals.priceOff ? formVals.priceOff / 100.0 : undefined,
|
||||
})(<InputNumber disabled={modalType != 'add'} placeholder="请输入" />)}
|
||||
</FormItem> : ''
|
||||
}
|
||||
{
|
||||
@ -436,15 +497,15 @@ const AddOrUpdateForm = Form.create()(props => {
|
||||
{min: 1, max: 99, type: 'number', message: '范围为 [1, 99]'},
|
||||
],
|
||||
initialValue: formVals.percentOff,
|
||||
})(<InputNumber placeholder="请输入" />)}%
|
||||
})(<InputNumber disabled={modalType != 'add'} placeholder="请输入" />)}%
|
||||
</FormItem>
|
||||
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="最多优惠">
|
||||
{form.getFieldDecorator('discountPriceLimit', {
|
||||
rules: [{ required: false, message: '请输入最多优惠!' },
|
||||
{min: 0.01, type: 'number', message: '最小值为 0.01'},
|
||||
],
|
||||
initialValue: formVals.discountPriceLimit,
|
||||
})(<InputNumber placeholder="请输入" />)}元
|
||||
initialValue: formVals.discountPriceLimit ? formVals.discountPriceLimit / 100.0 : undefineds,
|
||||
})(<InputNumber disabled={modalType != 'add'} placeholder="请输入" />)}元
|
||||
</FormItem>
|
||||
</span> : ''
|
||||
}
|
||||
@ -452,10 +513,10 @@ const AddOrUpdateForm = Form.create()(props => {
|
||||
);
|
||||
});
|
||||
|
||||
@connect(({ productRecommendList }) => ({
|
||||
@connect(({ couponCardTemplateList }) => ({
|
||||
// list: productRecommend.list,
|
||||
// pagination: productRecommend.pagination,
|
||||
...productRecommendList,
|
||||
...couponCardTemplateList,
|
||||
}))
|
||||
|
||||
// 主界面
|
||||
@ -465,7 +526,7 @@ class CouponCardTemplateLists extends PureComponent {
|
||||
componentDidMount() {
|
||||
const { dispatch } = this.props;
|
||||
dispatch({
|
||||
type: 'productRecommendList/query',
|
||||
type: 'couponCardTemplateList/query',
|
||||
payload: {
|
||||
...PaginationHelper.defaultPayload
|
||||
},
|
||||
@ -475,7 +536,7 @@ class CouponCardTemplateLists extends PureComponent {
|
||||
handleModalVisible = (modalVisible, modalType, record) => {
|
||||
const { dispatch } = this.props;
|
||||
dispatch({
|
||||
type: 'productRecommendList/setAll',
|
||||
type: 'couponCardTemplateList/setAll',
|
||||
payload: {
|
||||
modalVisible,
|
||||
modalType,
|
||||
|
@ -67,8 +67,26 @@ export async function deleteProductRecommend(params) {
|
||||
|
||||
// coupon
|
||||
|
||||
export async function getCouponCardTemplatePage(params) {
|
||||
return request(`/promotion-api/admins/coupon/template/page?${stringify(params)}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
|
||||
export async function addCouponCardTemplate(params) {
|
||||
return request(`/promotion-api/admins/coupon/template/add_card?${stringify(params)}`, {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateCouponCardTemplate(params) {
|
||||
return request(`/promotion-api/admins/coupon/template/update_card?${stringify(params)}`, {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateCouponCardTemplateStatus(params) {
|
||||
return request(`/promotion-api/admins/coupon/template/update_status?${stringify(params)}`, {
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.mall.order.biz.dao.OrderRecipientMapper">
|
||||
|
||||
<sql id="FIELDS">
|
||||
id, order_id, `area_no`, `name`, mobile, address,
|
||||
create_time, update_time
|
||||
</sql>
|
||||
|
||||
<!--
|
||||
插入数据
|
||||
-->
|
||||
<insert id="insert" parameterType="OrderRecipientDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
INSERT INTO `order_recipient` (
|
||||
order_id, `area_no`, `name`, mobile, address,
|
||||
create_time, update_time
|
||||
) VALUES (
|
||||
#{orderId}, #{areaNo}, #{name}, #{mobile}, #{address},
|
||||
#{createTime}, #{updateTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!--
|
||||
查询 - 根据 orderIds
|
||||
-->
|
||||
<select id="selectByOrderIds" resultType="cn.iocoder.mall.order.biz.dataobject.OrderRecipientDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM `order_recipient`
|
||||
WHERE order_id IN
|
||||
<foreach collection="orderIds" item="orderId" separator="," open="(" close=")">
|
||||
#{orderId}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,65 @@
|
||||
package cn.iocoder.mall.order.biz.convert;
|
||||
|
||||
import cn.iocoder.mall.order.api.bo.OrderRecipientBO;
|
||||
import cn.iocoder.mall.order.api.dto.OrderCreateDTO;
|
||||
import cn.iocoder.mall.order.biz.dataobject.OrderRecipientDO;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2019-04-05T22:26:02+0800",
|
||||
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)"
|
||||
)
|
||||
public class OrderRecipientConvertImpl implements OrderRecipientConvert {
|
||||
|
||||
@Override
|
||||
public OrderRecipientDO convert(OrderCreateDTO orderCreateDTO) {
|
||||
if ( orderCreateDTO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
OrderRecipientDO orderRecipientDO = new OrderRecipientDO();
|
||||
|
||||
orderRecipientDO.setAreaNo( orderCreateDTO.getAreaNo() );
|
||||
orderRecipientDO.setName( orderCreateDTO.getName() );
|
||||
orderRecipientDO.setMobile( orderCreateDTO.getMobile() );
|
||||
orderRecipientDO.setAddress( orderCreateDTO.getAddress() );
|
||||
|
||||
return orderRecipientDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderRecipientBO> convert(List<OrderRecipientDO> orderRecipientDOList) {
|
||||
if ( orderRecipientDOList == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<OrderRecipientBO> list = new ArrayList<OrderRecipientBO>( orderRecipientDOList.size() );
|
||||
for ( OrderRecipientDO orderRecipientDO : orderRecipientDOList ) {
|
||||
list.add( orderRecipientDOToOrderRecipientBO( orderRecipientDO ) );
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
protected OrderRecipientBO orderRecipientDOToOrderRecipientBO(OrderRecipientDO orderRecipientDO) {
|
||||
if ( orderRecipientDO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
OrderRecipientBO orderRecipientBO = new OrderRecipientBO();
|
||||
|
||||
orderRecipientBO.setCreateTime( orderRecipientDO.getCreateTime() );
|
||||
orderRecipientBO.setUpdateTime( orderRecipientDO.getUpdateTime() );
|
||||
orderRecipientBO.setId( orderRecipientDO.getId() );
|
||||
orderRecipientBO.setOrderId( orderRecipientDO.getOrderId() );
|
||||
orderRecipientBO.setAreaNo( orderRecipientDO.getAreaNo() );
|
||||
orderRecipientBO.setName( orderRecipientDO.getName() );
|
||||
orderRecipientBO.setMobile( orderRecipientDO.getMobile() );
|
||||
orderRecipientBO.setAddress( orderRecipientDO.getAddress() );
|
||||
|
||||
return orderRecipientBO;
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@
|
||||
|
||||
<properties>
|
||||
<org.mapstruct.version>1.3.0.Final</org.mapstruct.version>
|
||||
<org.projectlombok.version>1.16.14</org.projectlombok.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -103,6 +104,17 @@
|
||||
<artifactId>mapstruct</artifactId> <!-- use mapstruct-jdk8 for Java 8 or higher -->
|
||||
<version>${org.mapstruct.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-jdk8</artifactId>
|
||||
<version>${org.mapstruct.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${org.projectlombok.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@ -112,7 +124,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source> <!-- or higher, depending on your project -->
|
||||
<target>1.8</target> <!-- or higher, depending on your project -->
|
||||
@ -122,6 +134,11 @@
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
<version>${org.mapstruct.version}</version>
|
||||
</path>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${org.projectlombok.version}</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
@ -2,10 +2,15 @@ package cn.iocoder.mall.promotion.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.util.DateUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder;
|
||||
import cn.iocoder.mall.promotion.api.CouponService;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateAddDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateUpdateDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponTemplatePageDTO;
|
||||
import cn.iocoder.mall.promotion.application.convert.CouponTemplateConvert;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplatePageVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplateVO;
|
||||
import com.alibaba.dubbo.config.annotation.Reference;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -13,10 +18,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ -30,6 +32,25 @@ public class AdminsCouponTemplateController {
|
||||
|
||||
// ========== 优惠劵(码)模板 ==========
|
||||
|
||||
@GetMapping("/template/page")
|
||||
@ApiOperation(value = "优惠劵(码)模板分页")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "title", value = "标题,模糊匹配", example = "活动 A"),
|
||||
@ApiImplicitParam(name = "pageNo", value = "页码,从 1 开始", example = "1"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, example = "10"),
|
||||
})
|
||||
public CommonResult<AdminsCouponTemplatePageVO> page(@RequestParam(value = "type", required = false) Integer type,
|
||||
@RequestParam(value = "title", required = false) String title,
|
||||
@RequestParam(value = "status", required = false) Integer status,
|
||||
@RequestParam(value = "preferentialType", required = false) Integer preferentialType,
|
||||
@RequestParam(value = "pageNo", defaultValue = "0") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
CommonResult<CouponTemplatePageBO> result = couponService.getCouponTemplatePage(new CouponTemplatePageDTO()
|
||||
.setType(type).setTitle(title).setStatus(status).setPreferentialType(preferentialType)
|
||||
.setPageNo(pageNo).setPageSize(pageSize));
|
||||
return CouponTemplateConvert.INSTANCE.convert(result);
|
||||
}
|
||||
|
||||
@PostMapping("/template/add_card")
|
||||
@ApiOperation(value = "创建优惠劵模板")
|
||||
@ApiImplicitParams({
|
||||
@ -56,7 +77,7 @@ public class AdminsCouponTemplateController {
|
||||
@RequestParam(value = "total", required = false) Integer total,
|
||||
@RequestParam(value = "priceAvailable") Integer priceAvailable,
|
||||
@RequestParam(value = "rangeType") Integer rangeType,
|
||||
@RequestParam(value = "rangeType", required = false) String rangeValues,
|
||||
@RequestParam(value = "rangeValues", required = false) String rangeValues,
|
||||
@RequestParam(value = "dateType") Integer dateType,
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@RequestParam(value = "validStartTime", required = false) Date validStartTime,
|
||||
@ -84,6 +105,44 @@ public class AdminsCouponTemplateController {
|
||||
return CouponTemplateConvert.INSTANCE.convert2(result);
|
||||
}
|
||||
|
||||
@PostMapping("/template/update_card")
|
||||
@ApiOperation(value = "更新优惠劵模板")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "title", value = "标题", required = true, example = "优惠劵牛逼"),
|
||||
@ApiImplicitParam(name = "description", value = "使用说明", example = "我只是描述"),
|
||||
@ApiImplicitParam(name = "quota", value = "每人限领个数", required = true),
|
||||
@ApiImplicitParam(name = "total", value = "发行总量"),
|
||||
@ApiImplicitParam(name = "rangeType", value = "可用范围的类型", required = true, example = "参见 CouponTemplateRangeTypeEnum 枚举"),
|
||||
@ApiImplicitParam(name = "rangeValues", value = "指定商品 / 分类列表,使用逗号分隔商品编号"),
|
||||
})
|
||||
public CommonResult<Boolean> update(@RequestParam(value = "id") Integer id,
|
||||
@RequestParam(value = "title") String title,
|
||||
@RequestParam(value = "description", required = false) String description,
|
||||
@RequestParam(value = "quota") Integer quota,
|
||||
@RequestParam(value = "total", required = false) Integer total,
|
||||
@RequestParam(value = "rangeType") Integer rangeType,
|
||||
@RequestParam(value = "rangeValues", required = false) String rangeValues) {
|
||||
// 创建 CouponCardTemplateAddDTO 对象
|
||||
CouponCardTemplateUpdateDTO couponCardTemplateUpdateDTO = new CouponCardTemplateUpdateDTO()
|
||||
.setId(id)
|
||||
.setTitle(title).setDescription(description)
|
||||
.setQuota(quota).setTotal(total)
|
||||
.setRangeType(rangeType).setRangeValues(rangeValues);
|
||||
return couponService.updateCouponCardTemplate(couponCardTemplateUpdateDTO);
|
||||
}
|
||||
|
||||
@PostMapping("/template/update_status")
|
||||
@ApiOperation(value = "更新优惠劵(码)模板状态")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "Banner 编号", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "status", value = "状态。1 - 开启;2 - 禁用", required = true, example = "1"),
|
||||
})
|
||||
public CommonResult<Boolean> updateStatus(@RequestParam("id") Integer id,
|
||||
@RequestParam("status") Integer status) {
|
||||
return couponService.updateCouponTemplateStatus(AdminSecurityContextHolder.getContext().getAdminId(), id, status);
|
||||
}
|
||||
|
||||
// ========== 优惠劵 ==========
|
||||
|
||||
// ========== 优惠码 ==========
|
||||
|
@ -2,26 +2,34 @@ package cn.iocoder.mall.promotion.application.convert;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplatePageVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplateVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CouponTemplateConvert {
|
||||
|
||||
CouponTemplateConvert INSTANCE = Mappers.getMapper(CouponTemplateConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
AdminsCouponTemplateVO convert(CouponTemplateBO bannerBO);
|
||||
AdminsCouponTemplateVO convert(CouponTemplateBO template);
|
||||
|
||||
@Mappings({})
|
||||
CommonResult<AdminsCouponTemplateVO> convert2(CommonResult<CouponTemplateBO> result);
|
||||
|
||||
// @Mappings({})
|
||||
// CommonResult<AdminsCouponTemplatePageVO> convert(CommonResult<CouponTemplatePageBO> result);
|
||||
@Mappings({})
|
||||
CommonResult<AdminsCouponTemplatePageVO> convert(CommonResult<CouponTemplatePageBO> result);
|
||||
|
||||
@Mappings({})
|
||||
List<AdminsCouponTemplateVO> convertList(List<CouponTemplateBO> templates);
|
||||
|
||||
//
|
||||
// @Mappings({})
|
||||
// List<UsersCouponTemplateVO> convertList(List<CouponTemplateBO> banners);
|
||||
// List<UsersCouponTemplateVO> convertList2(List<CouponTemplateBO> banners);
|
||||
|
||||
}
|
||||
|
@ -2,10 +2,14 @@ package cn.iocoder.mall.promotion.application.vo.admins;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("Banner VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminsBannerVO {
|
||||
|
||||
@ApiModelProperty(value = "Banner 编号", required = true, example = "1")
|
||||
@ -25,75 +29,4 @@ public class AdminsBannerVO {
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
|
||||
private Date createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public AdminsBannerVO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public AdminsBannerVO setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public AdminsBannerVO setUrl(String url) {
|
||||
this.url = url;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public AdminsBannerVO setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public AdminsBannerVO setStatus(Integer status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMemo() {
|
||||
return memo;
|
||||
}
|
||||
|
||||
public AdminsBannerVO setMemo(String memo) {
|
||||
this.memo = memo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public AdminsBannerVO setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPicUrl() {
|
||||
return picUrl;
|
||||
}
|
||||
|
||||
public AdminsBannerVO setPicUrl(String picUrl) {
|
||||
this.picUrl = picUrl;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.mall.promotion.application.vo.admins;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("优惠劵(码)分页 VO")
|
||||
public class AdminsCouponTemplatePageVO {
|
||||
|
||||
@ApiModelProperty(value = "优惠劵(码)数组")
|
||||
private List<AdminsCouponTemplateVO> list;
|
||||
@ApiModelProperty(value = "优惠劵(码)总数")
|
||||
private Integer total;
|
||||
|
||||
public List<AdminsCouponTemplateVO> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public AdminsCouponTemplatePageVO setList(List<AdminsCouponTemplateVO> list) {
|
||||
this.list = list;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public AdminsCouponTemplatePageVO setTotal(Integer total) {
|
||||
this.total = total;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
@ -49,7 +49,7 @@ public class AdminsCouponTemplateVO {
|
||||
@ApiModelProperty(value = "固定日期-生效结束时间")
|
||||
private Date validEndTime;
|
||||
@ApiModelProperty(value = "领取日期-开始天数", example = "例如,0-当天;1-次天")
|
||||
private Integer fixedBeginTerm;
|
||||
private Integer fixedStartTerm;
|
||||
@ApiModelProperty(value = "领取日期-结束天数")
|
||||
private Integer fixedEndTerm;
|
||||
// ========== 使用规则 END ==========
|
||||
@ -190,12 +190,12 @@ public class AdminsCouponTemplateVO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getFixedBeginTerm() {
|
||||
return fixedBeginTerm;
|
||||
public Integer getFixedStartTerm() {
|
||||
return fixedStartTerm;
|
||||
}
|
||||
|
||||
public AdminsCouponTemplateVO setFixedBeginTerm(Integer fixedBeginTerm) {
|
||||
this.fixedBeginTerm = fixedBeginTerm;
|
||||
public AdminsCouponTemplateVO setFixedStartTerm(Integer fixedStartTerm) {
|
||||
this.fixedStartTerm = fixedStartTerm;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -261,4 +261,13 @@ public class AdminsCouponTemplateVO {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public AdminsCouponTemplateVO setTotal(Integer total) {
|
||||
this.total = total;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,12 @@ package cn.iocoder.mall.promotion.application.vo.users;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@ApiModel("Banner VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UsersBannerVO {
|
||||
|
||||
@ApiModelProperty(value = "跳转链接", required = true, example = "http://www.baidu.com")
|
||||
@ -11,22 +15,4 @@ public class UsersBannerVO {
|
||||
@ApiModelProperty(value = "图片链接", required = true, example = "http://www.iocoder.cn/01.jpg")
|
||||
private String picUrl;
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public UsersBannerVO setUrl(String url) {
|
||||
this.url = url;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPicUrl() {
|
||||
return picUrl;
|
||||
}
|
||||
|
||||
public UsersBannerVO setPicUrl(String picUrl) {
|
||||
this.picUrl = picUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
package cn.iocoder.mall.promotion.application.convert;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.promotion.api.bo.BannerBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.BannerPageBO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsBannerPageVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsBannerVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.users.UsersBannerVO;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2019-04-06T01:40:13+0800",
|
||||
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
|
||||
)
|
||||
public class BannerConvertImpl implements BannerConvert {
|
||||
|
||||
@Override
|
||||
public AdminsBannerVO convert(BannerBO bannerBO) {
|
||||
if ( bannerBO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AdminsBannerVO adminsBannerVO = new AdminsBannerVO();
|
||||
|
||||
adminsBannerVO.setId( bannerBO.getId() );
|
||||
adminsBannerVO.setTitle( bannerBO.getTitle() );
|
||||
adminsBannerVO.setUrl( bannerBO.getUrl() );
|
||||
adminsBannerVO.setPicUrl( bannerBO.getPicUrl() );
|
||||
adminsBannerVO.setSort( bannerBO.getSort() );
|
||||
adminsBannerVO.setStatus( bannerBO.getStatus() );
|
||||
adminsBannerVO.setMemo( bannerBO.getMemo() );
|
||||
adminsBannerVO.setCreateTime( bannerBO.getCreateTime() );
|
||||
|
||||
return adminsBannerVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<AdminsBannerVO> convert2(CommonResult<BannerBO> result) {
|
||||
if ( result == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CommonResult<AdminsBannerVO> commonResult = new CommonResult<AdminsBannerVO>();
|
||||
|
||||
commonResult.setCode( result.getCode() );
|
||||
commonResult.setMessage( result.getMessage() );
|
||||
commonResult.setData( convert( result.getData() ) );
|
||||
|
||||
return commonResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<AdminsBannerPageVO> convert(CommonResult<BannerPageBO> result) {
|
||||
if ( result == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CommonResult<AdminsBannerPageVO> commonResult = new CommonResult<AdminsBannerPageVO>();
|
||||
|
||||
commonResult.setCode( result.getCode() );
|
||||
commonResult.setMessage( result.getMessage() );
|
||||
commonResult.setData( bannerPageBOToAdminsBannerPageVO( result.getData() ) );
|
||||
|
||||
return commonResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UsersBannerVO> convertList(List<BannerBO> banners) {
|
||||
if ( banners == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<UsersBannerVO> list = new ArrayList<UsersBannerVO>( banners.size() );
|
||||
for ( BannerBO bannerBO : banners ) {
|
||||
list.add( bannerBOToUsersBannerVO( bannerBO ) );
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
protected List<AdminsBannerVO> bannerBOListToAdminsBannerVOList(List<BannerBO> list) {
|
||||
if ( list == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<AdminsBannerVO> list1 = new ArrayList<AdminsBannerVO>( list.size() );
|
||||
for ( BannerBO bannerBO : list ) {
|
||||
list1.add( convert( bannerBO ) );
|
||||
}
|
||||
|
||||
return list1;
|
||||
}
|
||||
|
||||
protected AdminsBannerPageVO bannerPageBOToAdminsBannerPageVO(BannerPageBO bannerPageBO) {
|
||||
if ( bannerPageBO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AdminsBannerPageVO adminsBannerPageVO = new AdminsBannerPageVO();
|
||||
|
||||
adminsBannerPageVO.setList( bannerBOListToAdminsBannerVOList( bannerPageBO.getList() ) );
|
||||
adminsBannerPageVO.setTotal( bannerPageBO.getTotal() );
|
||||
|
||||
return adminsBannerPageVO;
|
||||
}
|
||||
|
||||
protected UsersBannerVO bannerBOToUsersBannerVO(BannerBO bannerBO) {
|
||||
if ( bannerBO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
UsersBannerVO usersBannerVO = new UsersBannerVO();
|
||||
|
||||
usersBannerVO.setUrl( bannerBO.getUrl() );
|
||||
usersBannerVO.setPicUrl( bannerBO.getPicUrl() );
|
||||
|
||||
return usersBannerVO;
|
||||
}
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
package cn.iocoder.mall.promotion.application.convert;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplatePageVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplateVO;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2019-04-06T01:40:13+0800",
|
||||
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
|
||||
)
|
||||
public class CouponTemplateConvertImpl implements CouponTemplateConvert {
|
||||
|
||||
@Override
|
||||
public AdminsCouponTemplateVO convert(CouponTemplateBO template) {
|
||||
if ( template == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AdminsCouponTemplateVO adminsCouponTemplateVO = new AdminsCouponTemplateVO();
|
||||
|
||||
adminsCouponTemplateVO.setId( template.getId() );
|
||||
adminsCouponTemplateVO.setTitle( template.getTitle() );
|
||||
adminsCouponTemplateVO.setDescription( template.getDescription() );
|
||||
adminsCouponTemplateVO.setType( template.getType() );
|
||||
adminsCouponTemplateVO.setCodeType( template.getCodeType() );
|
||||
adminsCouponTemplateVO.setStatus( template.getStatus() );
|
||||
adminsCouponTemplateVO.setQuota( template.getQuota() );
|
||||
adminsCouponTemplateVO.setPriceAvailable( template.getPriceAvailable() );
|
||||
adminsCouponTemplateVO.setRangeType( template.getRangeType() );
|
||||
adminsCouponTemplateVO.setRangeValues( template.getRangeValues() );
|
||||
adminsCouponTemplateVO.setDateType( template.getDateType() );
|
||||
adminsCouponTemplateVO.setValidStartTime( template.getValidStartTime() );
|
||||
adminsCouponTemplateVO.setValidEndTime( template.getValidEndTime() );
|
||||
adminsCouponTemplateVO.setFixedStartTerm( template.getFixedStartTerm() );
|
||||
adminsCouponTemplateVO.setFixedEndTerm( template.getFixedEndTerm() );
|
||||
adminsCouponTemplateVO.setPreferentialType( template.getPreferentialType() );
|
||||
adminsCouponTemplateVO.setPercentOff( template.getPercentOff() );
|
||||
adminsCouponTemplateVO.setPriceOff( template.getPriceOff() );
|
||||
adminsCouponTemplateVO.setDiscountPriceLimit( template.getDiscountPriceLimit() );
|
||||
adminsCouponTemplateVO.setStatFetchNum( template.getStatFetchNum() );
|
||||
adminsCouponTemplateVO.setCreateTime( template.getCreateTime() );
|
||||
adminsCouponTemplateVO.setTotal( template.getTotal() );
|
||||
|
||||
return adminsCouponTemplateVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<AdminsCouponTemplateVO> convert2(CommonResult<CouponTemplateBO> result) {
|
||||
if ( result == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CommonResult<AdminsCouponTemplateVO> commonResult = new CommonResult<AdminsCouponTemplateVO>();
|
||||
|
||||
commonResult.setCode( result.getCode() );
|
||||
commonResult.setMessage( result.getMessage() );
|
||||
commonResult.setData( convert( result.getData() ) );
|
||||
|
||||
return commonResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<AdminsCouponTemplatePageVO> convert(CommonResult<CouponTemplatePageBO> result) {
|
||||
if ( result == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CommonResult<AdminsCouponTemplatePageVO> commonResult = new CommonResult<AdminsCouponTemplatePageVO>();
|
||||
|
||||
commonResult.setCode( result.getCode() );
|
||||
commonResult.setMessage( result.getMessage() );
|
||||
commonResult.setData( couponTemplatePageBOToAdminsCouponTemplatePageVO( result.getData() ) );
|
||||
|
||||
return commonResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdminsCouponTemplateVO> convertList(List<CouponTemplateBO> templates) {
|
||||
if ( templates == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<AdminsCouponTemplateVO> list = new ArrayList<AdminsCouponTemplateVO>( templates.size() );
|
||||
for ( CouponTemplateBO couponTemplateBO : templates ) {
|
||||
list.add( convert( couponTemplateBO ) );
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
protected AdminsCouponTemplatePageVO couponTemplatePageBOToAdminsCouponTemplatePageVO(CouponTemplatePageBO couponTemplatePageBO) {
|
||||
if ( couponTemplatePageBO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AdminsCouponTemplatePageVO adminsCouponTemplatePageVO = new AdminsCouponTemplatePageVO();
|
||||
|
||||
adminsCouponTemplatePageVO.setList( convertList( couponTemplatePageBO.getList() ) );
|
||||
adminsCouponTemplatePageVO.setTotal( couponTemplatePageBO.getTotal() );
|
||||
|
||||
return adminsCouponTemplatePageVO;
|
||||
}
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
package cn.iocoder.mall.promotion.application.convert;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.product.api.bo.ProductSpuBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.ProductRecommendPageBO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsProductRecommendPageVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsProductRecommendVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.users.UsersProductRecommendVO;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2019-04-06T01:40:13+0800",
|
||||
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
|
||||
)
|
||||
public class ProductRecommendConvertImpl implements ProductRecommendConvert {
|
||||
|
||||
@Override
|
||||
public AdminsProductRecommendVO convert(ProductRecommendBO bannerBO) {
|
||||
if ( bannerBO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AdminsProductRecommendVO adminsProductRecommendVO = new AdminsProductRecommendVO();
|
||||
|
||||
adminsProductRecommendVO.setId( bannerBO.getId() );
|
||||
adminsProductRecommendVO.setType( bannerBO.getType() );
|
||||
adminsProductRecommendVO.setProductSpuId( bannerBO.getProductSpuId() );
|
||||
adminsProductRecommendVO.setSort( bannerBO.getSort() );
|
||||
adminsProductRecommendVO.setStatus( bannerBO.getStatus() );
|
||||
adminsProductRecommendVO.setMemo( bannerBO.getMemo() );
|
||||
adminsProductRecommendVO.setCreateTime( bannerBO.getCreateTime() );
|
||||
|
||||
return adminsProductRecommendVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<AdminsProductRecommendVO> convert2(CommonResult<ProductRecommendBO> result) {
|
||||
if ( result == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CommonResult<AdminsProductRecommendVO> commonResult = new CommonResult<AdminsProductRecommendVO>();
|
||||
|
||||
commonResult.setCode( result.getCode() );
|
||||
commonResult.setMessage( result.getMessage() );
|
||||
commonResult.setData( convert( result.getData() ) );
|
||||
|
||||
return commonResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<AdminsProductRecommendPageVO> convert(CommonResult<ProductRecommendPageBO> result) {
|
||||
if ( result == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CommonResult<AdminsProductRecommendPageVO> commonResult = new CommonResult<AdminsProductRecommendPageVO>();
|
||||
|
||||
commonResult.setCode( result.getCode() );
|
||||
commonResult.setMessage( result.getMessage() );
|
||||
commonResult.setData( productRecommendPageBOToAdminsProductRecommendPageVO( result.getData() ) );
|
||||
|
||||
return commonResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UsersProductRecommendVO convert(ProductSpuBO productSpu) {
|
||||
if ( productSpu == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
UsersProductRecommendVO usersProductRecommendVO = new UsersProductRecommendVO();
|
||||
|
||||
usersProductRecommendVO.setId( productSpu.getId() );
|
||||
usersProductRecommendVO.setName( productSpu.getName() );
|
||||
usersProductRecommendVO.setSellPoint( productSpu.getSellPoint() );
|
||||
List<String> list = productSpu.getPicUrls();
|
||||
if ( list != null ) {
|
||||
usersProductRecommendVO.setPicUrls( new ArrayList<String>( list ) );
|
||||
}
|
||||
usersProductRecommendVO.setPrice( productSpu.getPrice() );
|
||||
|
||||
return usersProductRecommendVO;
|
||||
}
|
||||
|
||||
protected List<AdminsProductRecommendVO> productRecommendBOListToAdminsProductRecommendVOList(List<ProductRecommendBO> list) {
|
||||
if ( list == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<AdminsProductRecommendVO> list1 = new ArrayList<AdminsProductRecommendVO>( list.size() );
|
||||
for ( ProductRecommendBO productRecommendBO : list ) {
|
||||
list1.add( convert( productRecommendBO ) );
|
||||
}
|
||||
|
||||
return list1;
|
||||
}
|
||||
|
||||
protected AdminsProductRecommendPageVO productRecommendPageBOToAdminsProductRecommendPageVO(ProductRecommendPageBO productRecommendPageBO) {
|
||||
if ( productRecommendPageBO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AdminsProductRecommendPageVO adminsProductRecommendPageVO = new AdminsProductRecommendPageVO();
|
||||
|
||||
adminsProductRecommendPageVO.setList( productRecommendBOListToAdminsProductRecommendVOList( productRecommendPageBO.getList() ) );
|
||||
adminsProductRecommendPageVO.setTotal( productRecommendPageBO.getTotal() );
|
||||
|
||||
return adminsProductRecommendPageVO;
|
||||
}
|
||||
}
|
@ -11,6 +11,11 @@
|
||||
|
||||
<artifactId>promotion-service-api</artifactId>
|
||||
|
||||
<properties>
|
||||
<org.mapstruct.version>1.3.0.Final</org.mapstruct.version>
|
||||
<org.projectlombok.version>1.16.14</org.projectlombok.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
@ -22,6 +27,51 @@
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId> <!-- use mapstruct-jdk8 for Java 8 or higher -->
|
||||
<version>${org.mapstruct.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-jdk8</artifactId>
|
||||
<version>${org.mapstruct.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${org.projectlombok.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- 提供给 mapstruct 使用 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source> <!-- or higher, depending on your project -->
|
||||
<target>1.8</target> <!-- or higher, depending on your project -->
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
<version>${org.mapstruct.version}</version>
|
||||
</path>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${org.projectlombok.version}</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
@ -1,9 +1,11 @@
|
||||
package cn.iocoder.mall.promotion.api;
|
||||
|
||||
import cn.iocoder.common.framework.validator.InEnum;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponCardBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO;
|
||||
import cn.iocoder.mall.promotion.api.constant.CouponTemplateStatusEnum;
|
||||
import cn.iocoder.mall.promotion.api.dto.*;
|
||||
|
||||
public interface CouponService {
|
||||
@ -52,7 +54,8 @@ public interface CouponService {
|
||||
* @param status 状态
|
||||
* @return 是否成功
|
||||
*/
|
||||
CommonResult<Boolean> updateCouponTemplateStatus(Integer adminId, Integer couponTemplateId, Integer status);
|
||||
CommonResult<Boolean> updateCouponTemplateStatus(Integer adminId, Integer couponTemplateId,
|
||||
@InEnum(value = CouponTemplateStatusEnum.class, message = "修改状态必须是 {value}") Integer status);
|
||||
|
||||
// ========== 优惠劵 ==========
|
||||
|
||||
|
@ -1,10 +1,15 @@
|
||||
package cn.iocoder.mall.promotion.api.bo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Banner BO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class BannerBO {
|
||||
|
||||
/**
|
||||
@ -40,75 +45,4 @@ public class BannerBO {
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public BannerBO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public BannerBO setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public BannerBO setUrl(String url) {
|
||||
this.url = url;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public BannerBO setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public BannerBO setStatus(Integer status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMemo() {
|
||||
return memo;
|
||||
}
|
||||
|
||||
public BannerBO setMemo(String memo) {
|
||||
this.memo = memo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public BannerBO setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPicUrl() {
|
||||
return picUrl;
|
||||
}
|
||||
|
||||
public BannerBO setPicUrl(String picUrl) {
|
||||
this.picUrl = picUrl;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -81,7 +81,7 @@ public class CouponTemplateBO {
|
||||
* 生效日期类型
|
||||
*
|
||||
* 1-固定日期
|
||||
* 2-领取日期:领到券 {@link #fixedBeginTerm} 日开始 N 天内有效
|
||||
* 2-领取日期:领到券 {@link #fixedStartTerm} 日开始 N 天内有效
|
||||
*/
|
||||
private Integer dateType;
|
||||
/**
|
||||
@ -97,7 +97,7 @@ public class CouponTemplateBO {
|
||||
*
|
||||
* 例如,0-当天;1-次天
|
||||
*/
|
||||
private Integer fixedBeginTerm;
|
||||
private Integer fixedStartTerm;
|
||||
/**
|
||||
* 领取日期-结束天数
|
||||
*/
|
||||
@ -323,12 +323,12 @@ public class CouponTemplateBO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getFixedBeginTerm() {
|
||||
return fixedBeginTerm;
|
||||
public Integer getFixedStartTerm() {
|
||||
return fixedStartTerm;
|
||||
}
|
||||
|
||||
public CouponTemplateBO setFixedBeginTerm(Integer fixedBeginTerm) {
|
||||
this.fixedBeginTerm = fixedBeginTerm;
|
||||
public CouponTemplateBO setFixedStartTerm(Integer fixedStartTerm) {
|
||||
this.fixedStartTerm = fixedStartTerm;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,33 @@
|
||||
package cn.iocoder.mall.promotion.api.bo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CouponTemplatePageBO {
|
||||
|
||||
/**
|
||||
* 优惠劵(码)数组
|
||||
*/
|
||||
private List<CouponTemplateBO> list;
|
||||
/**
|
||||
* 总量
|
||||
*/
|
||||
private Integer total;
|
||||
|
||||
public CouponTemplatePageBO setList(List<CouponTemplateBO> list) {
|
||||
this.list = list;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CouponTemplatePageBO setTotal(Integer total) {
|
||||
this.total = total;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<CouponTemplateBO> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,14 @@
|
||||
package cn.iocoder.mall.promotion.api.constant;
|
||||
|
||||
import cn.iocoder.common.framework.core.IntArrayValuable;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public enum CouponTemplateStatusEnum {
|
||||
public enum CouponTemplateStatusEnum implements IntArrayValuable {
|
||||
|
||||
ENABLE(1, "开启中"),
|
||||
DISABLE(2, "禁用中"),
|
||||
EXPIRE(3, "已过期"),
|
||||
// EXPIRE(3, "已过期"), TODO 芋艿,暂时不考虑过期的
|
||||
;
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CouponTemplateStatusEnum::getValue).toArray();
|
||||
@ -33,4 +35,8 @@ public enum CouponTemplateStatusEnum {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,14 @@ public enum PromotionErrorCodeEnum {
|
||||
PRODUCT_RECOMMEND_PRODUCT_NOT_EXISTS(1006001001, "商品不存在"),
|
||||
PRODUCT_RECOMMEND_EXISTS(1006001002, "该商品推荐已经存在"),
|
||||
|
||||
;
|
||||
|
||||
// ========== COUPON TEMPLATE 模块 ==========
|
||||
PRODUCT_TEMPLATE_NOT_EXISTS(1006002000, "优惠劵模板(码)不存在"),
|
||||
PRODUCT_TEMPLATE_NOT_CARD(1006002001, "不是优惠劵模板"),
|
||||
PRODUCT_TEMPLATE_NOT_CODE(1006002002, "不是优惠码模板"),
|
||||
PRODUCT_TEMPLATE_TOTAL_CAN_NOT_REDUCE(1006002003, "优惠劵(码)模板的发放数量不能减小"),
|
||||
|
||||
;
|
||||
|
||||
private final int code;
|
||||
private final String message;
|
||||
|
@ -277,5 +277,4 @@ public class CouponCardTemplateAddDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,196 @@
|
||||
package cn.iocoder.mall.promotion.api.dto;
|
||||
|
||||
import cn.iocoder.common.framework.validator.InEnum;
|
||||
import cn.iocoder.mall.promotion.api.constant.CouponTemplateRangeTypeEnum;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
public class CouponCardTemplateUpdateDTO {
|
||||
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Integer id;
|
||||
|
||||
// ========== 基本信息 BEGIN ==========
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@NotEmpty(message = "标题不能为空")
|
||||
@Length(min = 2, max = 16, message = "标题长度为 {min}-{max} 位")
|
||||
private String title;
|
||||
/**
|
||||
* 使用说明
|
||||
*/
|
||||
@Length(max = 255, message = "使用说明最大长度为 {max} 位")
|
||||
private String description;
|
||||
// ========== 基本信息 END ==========
|
||||
|
||||
// ========== 领取规则 BEGIN ==========
|
||||
/**
|
||||
* 每人限领个数
|
||||
*/
|
||||
@NotNull(message = "每人限领个数不能为空")
|
||||
@Min(value = 1, message = "每人限领个数最小为 {value}")
|
||||
private Integer quota;
|
||||
/**
|
||||
* 发放总量
|
||||
*/
|
||||
@NotNull(message = "发放总量不能为空")
|
||||
@Min(value = 1, message = "每人限领个数最小为 {value}")
|
||||
private Integer total;
|
||||
// ========== 领取规则 END ==========
|
||||
|
||||
// ========== 使用规则 BEGIN ==========
|
||||
// /**
|
||||
// * 是否设置满多少金额可用,单位:分
|
||||
// *
|
||||
// * 0-不限制
|
||||
// * 大于0-多少金额可用
|
||||
// */
|
||||
// @NotNull(message = "使用金额门槛不能为空")
|
||||
// @Min(value = 0L, message = "使用金额门槛最低为 {value}")
|
||||
// private Integer priceAvailable;
|
||||
/**
|
||||
* 可用范围的类型
|
||||
*
|
||||
* 10-全部(ALL):所有可用
|
||||
* 20-部分(PART):部分商品可用,或指定商品可用
|
||||
* 21-部分(PART):部分商品不可用,或指定商品可用
|
||||
* 30-部分(PART):部分分类可用,或指定分类可用
|
||||
* 31-部分(PART):部分分类不可用,或指定分类可用
|
||||
*/
|
||||
@NotNull(message = "可用范围的类型不能为空")
|
||||
@InEnum(value = CouponTemplateRangeTypeEnum.class, message = "可用范围的类型必须在 {value}")
|
||||
private Integer rangeType;
|
||||
/**
|
||||
* 指定商品 / 分类列表,使用逗号分隔商品编号
|
||||
*/
|
||||
private String rangeValues;
|
||||
// /**
|
||||
// * 生效日期类型
|
||||
// *
|
||||
// * 1-固定日期
|
||||
// * 2-领取日期:领到券 {@link #fixedEndTerm} 日开始 N 天内有效
|
||||
// */
|
||||
// @NotNull(message = "生效日期类型不能为空")
|
||||
// @InEnum(value = CouponTemplateDateTypeEnum.class, message = "生效日期类型必须在 {value}")
|
||||
// private Integer dateType;
|
||||
// /**
|
||||
// * 固定日期-生效开始时间
|
||||
// */
|
||||
// private Date validStartTime;
|
||||
// /**
|
||||
// * 固定日期-生效结束时间
|
||||
// */
|
||||
// private Date validEndTime;
|
||||
// /**
|
||||
// * 领取日期-开始天数
|
||||
// *
|
||||
// * 例如,0-当天;1-次天
|
||||
// */
|
||||
// @Min(value = 0L, message = "领取日期开始时间最小为 {value}")
|
||||
// private Integer fixedBeginTerm;
|
||||
// /**
|
||||
// * 领取日期-结束天数
|
||||
// */
|
||||
// @Min(value = 1L, message = "领取日期结束时间最小为 {value}")
|
||||
// private Integer fixedEndTerm;
|
||||
// ========== 使用规则 END ==========
|
||||
|
||||
// ========== 使用效果 BEGIN ==========
|
||||
// /**
|
||||
// * 优惠类型
|
||||
// *
|
||||
// * 1-代金卷
|
||||
// * 2-折扣卷
|
||||
// */
|
||||
// @NotNull(message = "优惠类型不能为空")
|
||||
// @InEnum(value = CouponTemplatePreferentialTypeEnum.class, message = "优惠类型必须在 {value}")
|
||||
// private Integer preferentialType;
|
||||
// /**
|
||||
// * 优惠金额,单位:分
|
||||
// */
|
||||
// @Min(value = 1, message = "优惠金额最小值为 {value}")
|
||||
// private Integer priceOff;
|
||||
// /**
|
||||
// * 折扣百分比。
|
||||
// *
|
||||
// * 例如,80% 为 80。
|
||||
// * 当 100% 为 100 ,则代表免费。
|
||||
// */
|
||||
// @Max(value = 100, message = "折扣比最大值为 {value}")
|
||||
// private Integer percentOff;
|
||||
// /**
|
||||
// * 折扣上限,仅在 {@link #preferentialType} 等于 2 时生效。
|
||||
// *
|
||||
// * 例如,折扣上限为 20 元,当使用 8 折优惠券,订单金额为 1000 元时,最高只可折扣 20 元,而非 80 元。
|
||||
// */
|
||||
// @Min(value = 1, message = "折扣上限最小值为 {value}")
|
||||
// private Integer discountPriceLimit;
|
||||
// ========== 使用效果 END ==========
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateDTO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateDTO setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateDTO setDescription(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getQuota() {
|
||||
return quota;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateDTO setQuota(Integer quota) {
|
||||
this.quota = quota;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateDTO setTotal(Integer total) {
|
||||
this.total = total;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getRangeType() {
|
||||
return rangeType;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateDTO setRangeType(Integer rangeType) {
|
||||
this.rangeType = rangeType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRangeValues() {
|
||||
return rangeValues;
|
||||
}
|
||||
|
||||
public CouponCardTemplateUpdateDTO setRangeValues(String rangeValues) {
|
||||
this.rangeValues = rangeValues;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,16 @@
|
||||
package cn.iocoder.mall.promotion.api.dto;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 优惠劵模板分页 DTO
|
||||
*/
|
||||
public class CouponTemplatePageDTO {
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@ -18,4 +24,62 @@ public class CouponTemplatePageDTO {
|
||||
*/
|
||||
private Integer preferentialType;
|
||||
|
||||
@NotNull(message = "页码不能为空")
|
||||
private Integer pageNo;
|
||||
@NotNull(message = "每页条数不能为空")
|
||||
private Integer pageSize;
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public CouponTemplatePageDTO setType(Integer type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public CouponTemplatePageDTO setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public CouponTemplatePageDTO setStatus(Integer status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPreferentialType() {
|
||||
return preferentialType;
|
||||
}
|
||||
|
||||
public CouponTemplatePageDTO setPreferentialType(Integer preferentialType) {
|
||||
this.preferentialType = preferentialType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPageNo() {
|
||||
return pageNo;
|
||||
}
|
||||
|
||||
public CouponTemplatePageDTO setPageNo(Integer pageNo) {
|
||||
this.pageNo = pageNo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public CouponTemplatePageDTO setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
<properties>
|
||||
<org.mapstruct.version>1.3.0.Final</org.mapstruct.version>
|
||||
<org.projectlombok.version>1.16.14</org.projectlombok.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -53,11 +54,23 @@
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
<artifactId>mapstruct</artifactId> <!-- use mapstruct-jdk8 for Java 8 or higher -->
|
||||
<version>${org.mapstruct.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-jdk8</artifactId>
|
||||
<version>${org.mapstruct.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${org.projectlombok.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
@ -103,7 +116,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source> <!-- or higher, depending on your project -->
|
||||
<target>1.8</target> <!-- or higher, depending on your project -->
|
||||
@ -113,6 +126,11 @@
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
<version>${org.mapstruct.version}</version>
|
||||
</path>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${org.projectlombok.version}</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
@ -2,12 +2,16 @@ package cn.iocoder.mall.promotion.biz.convert;
|
||||
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateAddDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateUpdateDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCodeTemplateAddDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCodeTemplateUpdateDTO;
|
||||
import cn.iocoder.mall.promotion.biz.dataobject.CouponTemplateDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CouponTemplateConvert {
|
||||
|
||||
@ -16,15 +20,21 @@ public interface CouponTemplateConvert {
|
||||
// @Mappings({})
|
||||
// CouponTemplateBO convertToBO(CouponTemplateDO banner);
|
||||
//
|
||||
// @Mappings({})
|
||||
// List<CouponTemplateBO> convertToBO(List<CouponTemplateDO> bannerList);
|
||||
@Mappings({})
|
||||
List<CouponTemplateBO> convertToBO(List<CouponTemplateDO> templateList);
|
||||
|
||||
@Mappings({})
|
||||
CouponTemplateDO convert(CouponCodeTemplateAddDTO template);
|
||||
CouponTemplateDO convert(CouponCodeTemplateUpdateDTO template);
|
||||
|
||||
@Mappings({})
|
||||
CouponTemplateDO convert(CouponCardTemplateAddDTO template);
|
||||
|
||||
@Mappings({})
|
||||
CouponTemplateDO convert(CouponCardTemplateUpdateDTO template);
|
||||
|
||||
@Mappings({})
|
||||
CouponTemplateDO convert(CouponCodeTemplateAddDTO template);
|
||||
|
||||
@Mappings({})
|
||||
CouponTemplateBO convert(CouponTemplateDO template);
|
||||
|
||||
|
@ -11,13 +11,15 @@ public interface CouponTemplateMapper {
|
||||
|
||||
CouponTemplateDO selectById(@Param("id") Integer id);
|
||||
|
||||
List<CouponTemplateDO> selectListByPage(@Param("title") String title,
|
||||
List<CouponTemplateDO> selectListByPage(@Param("type") Integer type,
|
||||
@Param("title") String title,
|
||||
@Param("status") Integer status,
|
||||
@Param("preferentialType") Integer preferentialType,
|
||||
@Param("offset") Integer offset,
|
||||
@Param("limit") Integer limit);
|
||||
|
||||
Integer selectCountByPage(@Param("title") String title,
|
||||
Integer selectCountByPage(@Param("type") Integer type,
|
||||
@Param("title") String title,
|
||||
@Param("status") Integer status,
|
||||
@Param("preferentialType") Integer preferentialType);
|
||||
|
||||
|
@ -1,10 +1,14 @@
|
||||
package cn.iocoder.mall.promotion.biz.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* Banner 广告页
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class BannerDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
@ -40,67 +44,4 @@ public class BannerDO extends DeletableDO {
|
||||
|
||||
// TODO 芋艿 点击次数。&& 其他数据相关
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public BannerDO setId(Integer id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public BannerDO setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public BannerDO setUrl(String url) {
|
||||
this.url = url;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public BannerDO setStatus(Integer status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMemo() {
|
||||
return memo;
|
||||
}
|
||||
|
||||
public BannerDO setMemo(String memo) {
|
||||
this.memo = memo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public BannerDO setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPicUrl() {
|
||||
return picUrl;
|
||||
}
|
||||
|
||||
public BannerDO setPicUrl(String picUrl) {
|
||||
this.picUrl = picUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
@ -120,7 +120,7 @@ public class CouponTemplateDO extends BaseDO {
|
||||
* 生效日期类型
|
||||
*
|
||||
* 1-固定日期
|
||||
* 2-领取日期:领到券 {@link #fixedTerm} 日开始 N 天内有效
|
||||
* 2-领取日期:领到券 {@link #fixedStartTerm} 日开始 N 天内有效
|
||||
*/
|
||||
private Integer dateType;
|
||||
/**
|
||||
@ -131,16 +131,16 @@ public class CouponTemplateDO extends BaseDO {
|
||||
* 固定日期-生效结束时间
|
||||
*/
|
||||
private Date validEndTime;
|
||||
// /**
|
||||
// * 领取日期-开始天数
|
||||
// *
|
||||
// * 例如,0-当天;1-次天
|
||||
// */
|
||||
// private Integer fixedBeginTerm;
|
||||
/**
|
||||
* 领取日期-开始天数
|
||||
*
|
||||
* 例如,0-当天;1-次天
|
||||
*/
|
||||
private Integer fixedStartTerm;
|
||||
/**
|
||||
* 领取日期-结束天数
|
||||
*/
|
||||
private Integer fixedTerm;
|
||||
private Integer fixedEndTerm;
|
||||
// /**
|
||||
// * 是否到期前4天发送提醒
|
||||
// *
|
||||
@ -335,12 +335,21 @@ public class CouponTemplateDO extends BaseDO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getFixedTerm() {
|
||||
return fixedTerm;
|
||||
public Integer getFixedStartTerm() {
|
||||
return fixedStartTerm;
|
||||
}
|
||||
|
||||
public CouponTemplateDO setFixedTerm(Integer fixedTerm) {
|
||||
this.fixedTerm = fixedTerm;
|
||||
public CouponTemplateDO setFixedStartTerm(Integer fixedStartTerm) {
|
||||
this.fixedStartTerm = fixedStartTerm;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getFixedEndTerm() {
|
||||
return fixedEndTerm;
|
||||
}
|
||||
|
||||
public CouponTemplateDO setFixedEndTerm(Integer fixedEndTerm) {
|
||||
this.fixedEndTerm = fixedEndTerm;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,13 @@
|
||||
package cn.iocoder.mall.promotion.biz.service;
|
||||
|
||||
import cn.iocoder.common.framework.constant.SysErrorCodeEnum;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.promotion.api.CouponService;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponCardBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO;
|
||||
import cn.iocoder.mall.promotion.api.constant.CouponTemplateDateTypeEnum;
|
||||
import cn.iocoder.mall.promotion.api.constant.CouponTemplatePreferentialTypeEnum;
|
||||
import cn.iocoder.mall.promotion.api.constant.CouponTemplateStatusEnum;
|
||||
import cn.iocoder.mall.promotion.api.constant.CouponTemplateTypeEnum;
|
||||
import cn.iocoder.mall.promotion.api.constant.*;
|
||||
import cn.iocoder.mall.promotion.api.dto.*;
|
||||
import cn.iocoder.mall.promotion.biz.convert.CouponTemplateConvert;
|
||||
import cn.iocoder.mall.promotion.biz.dao.CouponTemplateMapper;
|
||||
@ -26,9 +24,22 @@ public class CouponServiceImpl implements CouponService {
|
||||
@Autowired
|
||||
private CouponTemplateMapper couponTemplateMapper;
|
||||
|
||||
// ========== 优惠劵(码)模板 ==========
|
||||
|
||||
@Override
|
||||
public CommonResult<CouponTemplatePageBO> getCouponTemplatePage(CouponTemplatePageDTO couponTemplatePageDTO) {
|
||||
return null;
|
||||
CouponTemplatePageBO couponTemplatePageBO = new CouponTemplatePageBO();
|
||||
// 查询分页数据
|
||||
int offset = (couponTemplatePageDTO.getPageNo() - 1) * couponTemplatePageDTO.getPageSize();
|
||||
couponTemplatePageBO.setList(CouponTemplateConvert.INSTANCE.convertToBO(couponTemplateMapper.selectListByPage(
|
||||
couponTemplatePageDTO.getType(), couponTemplatePageDTO.getTitle(),
|
||||
couponTemplatePageDTO.getStatus(), couponTemplatePageDTO.getPreferentialType(),
|
||||
offset, couponTemplatePageDTO.getPageSize())));
|
||||
// 查询分页总数
|
||||
couponTemplatePageBO.setTotal(couponTemplateMapper.selectCountByPage(
|
||||
couponTemplatePageDTO.getType(), couponTemplatePageDTO.getTitle(),
|
||||
couponTemplatePageDTO.getStatus(), couponTemplatePageDTO.getPreferentialType()));
|
||||
return CommonResult.success(couponTemplatePageBO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -71,32 +82,38 @@ public class CouponServiceImpl implements CouponService {
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> updateCouponCardTemplate(CouponCardTemplateUpdateDTO couponCardTemplateUpdateDTO) {
|
||||
return null;
|
||||
// 校验 CouponCardTemplate 存在
|
||||
CouponTemplateDO template = couponTemplateMapper.selectById(couponCardTemplateUpdateDTO.getId());
|
||||
if (template == null) {
|
||||
return ServiceExceptionUtil.error(PromotionErrorCodeEnum.PRODUCT_TEMPLATE_NOT_EXISTS.getCode());
|
||||
}
|
||||
// 校验 CouponCardTemplate 是 CARD
|
||||
if (!CouponTemplateTypeEnum.CARD.getValue().equals(template.getType())) {
|
||||
return ServiceExceptionUtil.error(PromotionErrorCodeEnum.PRODUCT_TEMPLATE_NOT_CARD.getCode());
|
||||
}
|
||||
// 校验发放数量不能减少
|
||||
if (couponCardTemplateUpdateDTO.getTotal() < template.getTotal()) {
|
||||
return ServiceExceptionUtil.error(PromotionErrorCodeEnum.PRODUCT_TEMPLATE_TOTAL_CAN_NOT_REDUCE.getCode());
|
||||
}
|
||||
// 更新优惠劵模板到数据库
|
||||
CouponTemplateDO updateTemplateDO = CouponTemplateConvert.INSTANCE.convert(couponCardTemplateUpdateDTO);
|
||||
couponTemplateMapper.update(updateTemplateDO);
|
||||
// 返回成功
|
||||
return CommonResult.success(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> updateCouponTemplateStatus(Integer adminId, Integer couponTemplateId, Integer status) {
|
||||
return null;
|
||||
// 校验 CouponCardTemplate 存在
|
||||
CouponTemplateDO template = couponTemplateMapper.selectById(couponTemplateId);
|
||||
if (template == null) {
|
||||
return ServiceExceptionUtil.error(PromotionErrorCodeEnum.PRODUCT_TEMPLATE_NOT_EXISTS.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<CouponCardBO> addCouponCard(Integer userId, Integer couponTemplateId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> useCouponCard(Integer userId, Integer couponCardId, Integer usedOrderId, Integer usedPrice) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> cancelUseCouponCard(Integer userId, Integer couponCardId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<CouponCardBO> useCouponCode(Integer userId, String code) {
|
||||
return null;
|
||||
// 更新到数据库
|
||||
CouponTemplateDO updateTemplateDO = new CouponTemplateDO().setId(couponTemplateId).setStatus(status);
|
||||
couponTemplateMapper.update(updateTemplateDO);
|
||||
// 返回成功
|
||||
return CommonResult.success(true);
|
||||
}
|
||||
|
||||
private CommonResult<Boolean> checkCouponTemplateDateType(Integer dateType, Date validStartTime, Date validEndTime, Integer fixedBeginTerm, Integer fixedEndTerm) {
|
||||
@ -142,4 +159,28 @@ public class CouponServiceImpl implements CouponService {
|
||||
return CommonResult.success(true);
|
||||
}
|
||||
|
||||
// ========== 优惠劵 ==========
|
||||
|
||||
@Override
|
||||
public CommonResult<CouponCardBO> addCouponCard(Integer userId, Integer couponTemplateId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> useCouponCard(Integer userId, Integer couponCardId, Integer usedOrderId, Integer usedPrice) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<Boolean> cancelUseCouponCard(Integer userId, Integer couponCardId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ========== 优惠码 ==========
|
||||
|
||||
@Override
|
||||
public CommonResult<CouponCardBO> useCouponCode(Integer userId, String code) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
<sql id="FIELDS">
|
||||
id, title, description, type, code_type,
|
||||
status, quota, total, price_available, range_type,
|
||||
range_values, date_type, valid_start_time, valid_end_time, fixed_term,
|
||||
range_values, date_type, valid_start_time, valid_end_time, fixed_start_term, fixed_end_term,
|
||||
preferential_type, percent_off, price_off, discount_price_limit, stat_fetch_num,
|
||||
create_time
|
||||
</sql>
|
||||
@ -39,8 +39,11 @@
|
||||
<include refid="FIELDS" />
|
||||
FROM coupon_template
|
||||
<where>
|
||||
<if test="type != null">
|
||||
AND type = #{type}
|
||||
</if>
|
||||
<if test="title != null">
|
||||
title LIKE "%"#{title}"%"
|
||||
AND title LIKE "%"#{title}"%"
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
@ -57,8 +60,11 @@
|
||||
COUNT(1)
|
||||
FROM coupon_template
|
||||
<where>
|
||||
<if test="type != null">
|
||||
AND type = #{type}
|
||||
</if>
|
||||
<if test="title != null">
|
||||
title LIKE "%"#{title}"%"
|
||||
AND title LIKE "%"#{title}"%"
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
@ -73,13 +79,13 @@
|
||||
INSERT INTO coupon_template (
|
||||
title, description, type, code_type,
|
||||
status, quota, total, price_available, range_type,
|
||||
range_values, date_type, valid_start_time, valid_end_time, fixed_term,
|
||||
range_values, date_type, valid_start_time, valid_end_time, fixed_start_term, fixed_end_term,
|
||||
preferential_type, percent_off, price_off, discount_price_limit, stat_fetch_num,
|
||||
create_time
|
||||
) VALUES (
|
||||
#{title}, #{description}, #{type}, #{codeType},
|
||||
#{status}, #{quota}, #{total}, #{priceAvailable}, #{rangeType},
|
||||
#{rangeValues}, #{dateType}, #{validStartTime}, #{validEndTime}, #{fixedTerm},
|
||||
#{rangeValues}, #{dateType}, #{validStartTime}, #{validEndTime}, #{fixedStartTerm}, #{fixedEndTerm}
|
||||
#{preferentialType}, #{percentOff}, #{priceOff}, #{discountPriceLimit}, #{statFetchNum},
|
||||
#{createTime}
|
||||
)
|
||||
@ -121,8 +127,11 @@
|
||||
<if test="validEndTime != null">
|
||||
valid_end_time = #{validEndTime},
|
||||
</if>
|
||||
<if test="fixedTerm != null">
|
||||
fixed_term = #{fixedTerm},
|
||||
<if test="fixedStartTerm != null">
|
||||
fixed_start_term = #{fixedStartTerm},
|
||||
</if>
|
||||
<if test="fixedEndTerm != null">
|
||||
fixed_end_term = #{fixedEndTerm},
|
||||
</if>
|
||||
<if test="preferentialType != null">
|
||||
preferential_type = #{preferentialType},
|
||||
|
@ -0,0 +1,152 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.iocoder.mall.promotion.biz.dao.CouponTemplateMapper">
|
||||
|
||||
<sql id="FIELDS">
|
||||
id, title, description, type, code_type,
|
||||
status, quota, total, price_available, range_type,
|
||||
range_values, date_type, valid_start_time, valid_end_time, fixed_start_term, fixed_end_term,
|
||||
preferential_type, percent_off, price_off, discount_price_limit, stat_fetch_num,
|
||||
create_time
|
||||
</sql>
|
||||
|
||||
<!-- <select id="selectListByPidAndStatusOrderBySort" resultType="CouponTemplateDO">-->
|
||||
<!-- SELECT-->
|
||||
<!-- <include refid="FIELDS" />-->
|
||||
<!-- FROM coupon_template-->
|
||||
<!-- WHERE pid = #{pid}-->
|
||||
<!-- AND status = #{status}-->
|
||||
<!-- AND deleted = 0-->
|
||||
<!-- ORDER BY sort ASC-->
|
||||
<!-- </select>-->
|
||||
|
||||
<!-- <select id="selectList" resultType="CouponTemplateDO">-->
|
||||
<!-- SELECT-->
|
||||
<!-- <include refid="FIELDS" />-->
|
||||
<!-- FROM coupon_template-->
|
||||
<!-- WHERE deleted = 0-->
|
||||
<!-- </select>-->
|
||||
|
||||
<select id="selectById" parameterType="Integer" resultType="CouponTemplateDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM coupon_template
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectListByPage" resultType="CouponTemplateDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM coupon_template
|
||||
<where>
|
||||
<if test="type != null">
|
||||
AND type = #{type}
|
||||
</if>
|
||||
<if test="title != null">
|
||||
AND title LIKE "%"#{title}"%"
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="preferentialType != null">
|
||||
AND preferential_type = #{preferentialType}
|
||||
</if>
|
||||
</where>
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
|
||||
<select id="selectCountByPage" resultType="Integer">
|
||||
SELECT
|
||||
COUNT(1)
|
||||
FROM coupon_template
|
||||
<where>
|
||||
<if test="type != null">
|
||||
AND type = #{type}
|
||||
</if>
|
||||
<if test="title != null">
|
||||
AND title LIKE "%"#{title}"%"
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="preferentialType != null">
|
||||
AND preferential_type = #{preferentialType}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="CouponTemplateDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
INSERT INTO coupon_template (
|
||||
title, description, type, code_type,
|
||||
status, quota, total, price_available, range_type,
|
||||
range_values, date_type, valid_start_time, valid_end_time, fixed_start_term, fixed_end_term,
|
||||
preferential_type, percent_off, price_off, discount_price_limit, stat_fetch_num,
|
||||
create_time
|
||||
) VALUES (
|
||||
#{title}, #{description}, #{type}, #{codeType},
|
||||
#{status}, #{quota}, #{total}, #{priceAvailable}, #{rangeType},
|
||||
#{rangeValues}, #{dateType}, #{validStartTime}, #{validEndTime}, #{fixedStartTerm}, #{fixedEndTerm}
|
||||
#{preferentialType}, #{percentOff}, #{priceOff}, #{discountPriceLimit}, #{statFetchNum},
|
||||
#{createTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="CouponTemplateDO">
|
||||
UPDATE coupon_template
|
||||
<set>
|
||||
<if test="title != null">
|
||||
title = #{title},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="quota != null">
|
||||
quota = #{quota},
|
||||
</if>
|
||||
<if test="total != null">
|
||||
total = #{total},
|
||||
</if>
|
||||
<if test="priceAvailable != null">
|
||||
price_available = #{priceAvailable},
|
||||
</if>
|
||||
<if test="rangeType != null">
|
||||
range_type = #{rangeType},
|
||||
</if>
|
||||
<if test="rangeValues != null">
|
||||
range_values = #{rangeValues},
|
||||
</if>
|
||||
<if test="dateType != null">
|
||||
date_type = #{dateType},
|
||||
</if>
|
||||
<if test="validStartTime != null">
|
||||
valid_start_time = #{validStartTime},
|
||||
</if>
|
||||
<if test="validEndTime != null">
|
||||
valid_end_time = #{validEndTime},
|
||||
</if>
|
||||
<if test="fixedStartTerm != null">
|
||||
fixed_start_term = #{fixedStartTerm},
|
||||
</if>
|
||||
<if test="fixedEndTerm != null">
|
||||
fixed_end_term = #{fixedEndTerm},
|
||||
</if>
|
||||
<if test="preferentialType != null">
|
||||
preferential_type = #{preferentialType},
|
||||
</if>
|
||||
<if test="percentOff != null">
|
||||
percent_off = #{percentOff},
|
||||
</if>
|
||||
<if test="priceOff != null">
|
||||
price_off = #{priceOff},
|
||||
</if>
|
||||
<if test="discountPriceLimit != null">
|
||||
discount_price_limit = #{discountPriceLimit},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.iocoder.mall.promotion.biz.dao.ProductRecommendMapper">
|
||||
|
||||
<sql id="FIELDS">
|
||||
id, type, product_spu_id, sort,
|
||||
status, memo, create_time
|
||||
</sql>
|
||||
|
||||
<!-- <select id="selectListByPidAndStatusOrderBySort" resultType="ProductRecommendDO">-->
|
||||
<!-- SELECT-->
|
||||
<!-- <include refid="FIELDS" />-->
|
||||
<!-- FROM product_recommend-->
|
||||
<!-- WHERE pid = #{pid}-->
|
||||
<!-- AND status = #{status}-->
|
||||
<!-- AND deleted = 0-->
|
||||
<!-- ORDER BY sort ASC-->
|
||||
<!-- </select>-->
|
||||
|
||||
<!-- <select id="selectList" resultType="ProductRecommendDO">-->
|
||||
<!-- SELECT-->
|
||||
<!-- <include refid="FIELDS" />-->
|
||||
<!-- FROM product_recommend-->
|
||||
<!-- WHERE deleted = 0-->
|
||||
<!-- </select>-->
|
||||
|
||||
<select id="selectById" parameterType="Integer" resultType="ProductRecommendDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM product_recommend
|
||||
WHERE id = #{id}
|
||||
AND deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="selectByProductSpuIdAndType" resultType="ProductRecommendDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM product_recommend
|
||||
<where>
|
||||
<if test="productSpuId != null">
|
||||
product_spu_id = #{productSpuId}
|
||||
</if>
|
||||
<if test="type != null">
|
||||
AND type = #{type}
|
||||
</if>
|
||||
AND deleted = 0
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectListByTypeAndStatus" parameterType="Integer" resultType="ProductRecommendDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM product_recommend
|
||||
<where>
|
||||
<if test="type != null">
|
||||
type = #{type}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
AND deleted = 0
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPageByType" resultType="ProductRecommendDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM product_recommend
|
||||
<where>
|
||||
<if test="type != null">
|
||||
type = #{type}
|
||||
</if>
|
||||
AND deleted = 0
|
||||
</where>
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
|
||||
<select id="selectCountByType" resultType="Integer">
|
||||
SELECT
|
||||
COUNT(1)
|
||||
FROM product_recommend
|
||||
<where>
|
||||
<if test="type != null">
|
||||
type = #{type}
|
||||
</if>
|
||||
AND deleted = 0
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="ProductRecommendDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
INSERT INTO product_recommend (
|
||||
type, product_spu_id, sort, status, memo,
|
||||
create_time, deleted
|
||||
) VALUES (
|
||||
#{type}, #{productSpuId}, #{sort}, #{status}, #{memo},
|
||||
#{createTime}, #{deleted}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="ProductRecommendDO">
|
||||
UPDATE product_recommend
|
||||
<set>
|
||||
<if test="type != null">
|
||||
type = #{type},
|
||||
</if>
|
||||
<if test="productSpuId != null">
|
||||
product_spu_id = #{productSpuId},
|
||||
</if>
|
||||
<if test="sort != null">
|
||||
sort = #{sort},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="memo != null">
|
||||
memo = #{memo},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted}
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,135 @@
|
||||
package cn.iocoder.mall.promotion.biz.convert;
|
||||
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateAddDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateUpdateDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCodeTemplateAddDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCodeTemplateUpdateDTO;
|
||||
import cn.iocoder.mall.promotion.biz.dataobject.CouponTemplateDO;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2019-04-06T01:40:11+0800",
|
||||
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
|
||||
)
|
||||
public class CouponTemplateConvertImpl implements CouponTemplateConvert {
|
||||
|
||||
@Override
|
||||
public List<CouponTemplateBO> convertToBO(List<CouponTemplateDO> templateList) {
|
||||
if ( templateList == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<CouponTemplateBO> list = new ArrayList<CouponTemplateBO>( templateList.size() );
|
||||
for ( CouponTemplateDO couponTemplateDO : templateList ) {
|
||||
list.add( convert( couponTemplateDO ) );
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CouponTemplateDO convert(CouponCodeTemplateUpdateDTO template) {
|
||||
if ( template == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CouponTemplateDO couponTemplateDO = new CouponTemplateDO();
|
||||
|
||||
return couponTemplateDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CouponTemplateDO convert(CouponCardTemplateAddDTO template) {
|
||||
if ( template == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CouponTemplateDO couponTemplateDO = new CouponTemplateDO();
|
||||
|
||||
couponTemplateDO.setTitle( template.getTitle() );
|
||||
couponTemplateDO.setDescription( template.getDescription() );
|
||||
couponTemplateDO.setQuota( template.getQuota() );
|
||||
couponTemplateDO.setTotal( template.getTotal() );
|
||||
couponTemplateDO.setPriceAvailable( template.getPriceAvailable() );
|
||||
couponTemplateDO.setRangeType( template.getRangeType() );
|
||||
couponTemplateDO.setRangeValues( template.getRangeValues() );
|
||||
couponTemplateDO.setDateType( template.getDateType() );
|
||||
couponTemplateDO.setValidStartTime( template.getValidStartTime() );
|
||||
couponTemplateDO.setValidEndTime( template.getValidEndTime() );
|
||||
couponTemplateDO.setFixedEndTerm( template.getFixedEndTerm() );
|
||||
couponTemplateDO.setPreferentialType( template.getPreferentialType() );
|
||||
couponTemplateDO.setPercentOff( template.getPercentOff() );
|
||||
couponTemplateDO.setPriceOff( template.getPriceOff() );
|
||||
couponTemplateDO.setDiscountPriceLimit( template.getDiscountPriceLimit() );
|
||||
|
||||
return couponTemplateDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CouponTemplateDO convert(CouponCardTemplateUpdateDTO template) {
|
||||
if ( template == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CouponTemplateDO couponTemplateDO = new CouponTemplateDO();
|
||||
|
||||
couponTemplateDO.setId( template.getId() );
|
||||
couponTemplateDO.setTitle( template.getTitle() );
|
||||
couponTemplateDO.setDescription( template.getDescription() );
|
||||
couponTemplateDO.setQuota( template.getQuota() );
|
||||
couponTemplateDO.setTotal( template.getTotal() );
|
||||
couponTemplateDO.setRangeType( template.getRangeType() );
|
||||
couponTemplateDO.setRangeValues( template.getRangeValues() );
|
||||
|
||||
return couponTemplateDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CouponTemplateDO convert(CouponCodeTemplateAddDTO template) {
|
||||
if ( template == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CouponTemplateDO couponTemplateDO = new CouponTemplateDO();
|
||||
|
||||
return couponTemplateDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CouponTemplateBO convert(CouponTemplateDO template) {
|
||||
if ( template == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CouponTemplateBO couponTemplateBO = new CouponTemplateBO();
|
||||
|
||||
couponTemplateBO.setId( template.getId() );
|
||||
couponTemplateBO.setTitle( template.getTitle() );
|
||||
couponTemplateBO.setDescription( template.getDescription() );
|
||||
couponTemplateBO.setType( template.getType() );
|
||||
couponTemplateBO.setCodeType( template.getCodeType() );
|
||||
couponTemplateBO.setStatus( template.getStatus() );
|
||||
couponTemplateBO.setQuota( template.getQuota() );
|
||||
couponTemplateBO.setTotal( template.getTotal() );
|
||||
couponTemplateBO.setPriceAvailable( template.getPriceAvailable() );
|
||||
couponTemplateBO.setRangeType( template.getRangeType() );
|
||||
couponTemplateBO.setRangeValues( template.getRangeValues() );
|
||||
couponTemplateBO.setDateType( template.getDateType() );
|
||||
couponTemplateBO.setValidStartTime( template.getValidStartTime() );
|
||||
couponTemplateBO.setValidEndTime( template.getValidEndTime() );
|
||||
couponTemplateBO.setPreferentialType( template.getPreferentialType() );
|
||||
couponTemplateBO.setPercentOff( template.getPercentOff() );
|
||||
couponTemplateBO.setPriceOff( template.getPriceOff() );
|
||||
couponTemplateBO.setDiscountPriceLimit( template.getDiscountPriceLimit() );
|
||||
couponTemplateBO.setStatFetchNum( template.getStatFetchNum() );
|
||||
couponTemplateBO.setCreateTime( template.getCreateTime() );
|
||||
couponTemplateBO.setFixedStartTerm( template.getFixedStartTerm() );
|
||||
couponTemplateBO.setFixedEndTerm( template.getFixedEndTerm() );
|
||||
|
||||
return couponTemplateBO;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
package cn.iocoder.mall.promotion.biz.convert;
|
||||
|
||||
import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO;
|
||||
import cn.iocoder.mall.promotion.api.dto.ProductRecommendAddDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.ProductRecommendUpdateDTO;
|
||||
import cn.iocoder.mall.promotion.biz.dataobject.ProductRecommendDO;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2019-04-06T01:40:11+0800",
|
||||
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
|
||||
)
|
||||
public class ProductRecommendConvertImpl implements ProductRecommendConvert {
|
||||
|
||||
@Override
|
||||
public ProductRecommendBO convertToBO(ProductRecommendDO banner) {
|
||||
if ( banner == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ProductRecommendBO productRecommendBO = new ProductRecommendBO();
|
||||
|
||||
productRecommendBO.setId( banner.getId() );
|
||||
productRecommendBO.setType( banner.getType() );
|
||||
productRecommendBO.setProductSpuId( banner.getProductSpuId() );
|
||||
productRecommendBO.setSort( banner.getSort() );
|
||||
productRecommendBO.setStatus( banner.getStatus() );
|
||||
productRecommendBO.setMemo( banner.getMemo() );
|
||||
productRecommendBO.setCreateTime( banner.getCreateTime() );
|
||||
|
||||
return productRecommendBO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProductRecommendBO> convertToBO(List<ProductRecommendDO> bannerList) {
|
||||
if ( bannerList == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<ProductRecommendBO> list = new ArrayList<ProductRecommendBO>( bannerList.size() );
|
||||
for ( ProductRecommendDO productRecommendDO : bannerList ) {
|
||||
list.add( convertToBO( productRecommendDO ) );
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductRecommendDO convert(ProductRecommendAddDTO bannerAddDTO) {
|
||||
if ( bannerAddDTO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ProductRecommendDO productRecommendDO = new ProductRecommendDO();
|
||||
|
||||
productRecommendDO.setType( bannerAddDTO.getType() );
|
||||
productRecommendDO.setProductSpuId( bannerAddDTO.getProductSpuId() );
|
||||
productRecommendDO.setSort( bannerAddDTO.getSort() );
|
||||
productRecommendDO.setMemo( bannerAddDTO.getMemo() );
|
||||
|
||||
return productRecommendDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductRecommendDO convert(ProductRecommendUpdateDTO bannerUpdateDTO) {
|
||||
if ( bannerUpdateDTO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ProductRecommendDO productRecommendDO = new ProductRecommendDO();
|
||||
|
||||
productRecommendDO.setId( bannerUpdateDTO.getId() );
|
||||
productRecommendDO.setType( bannerUpdateDTO.getType() );
|
||||
productRecommendDO.setProductSpuId( bannerUpdateDTO.getProductSpuId() );
|
||||
productRecommendDO.setSort( bannerUpdateDTO.getSort() );
|
||||
productRecommendDO.setMemo( bannerUpdateDTO.getMemo() );
|
||||
|
||||
return productRecommendDO;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user