- 后端:临时解决 Dubbo 内嵌在 Spring Boot 时,对本地的 Dubbo Service 引用报错的问题。
- 前端:完善商品推荐 - 前端:完善优惠劵
This commit is contained in:
parent
ab5d051f75
commit
d39a416080
@ -6,6 +6,7 @@ import {
|
|||||||
getCouponCardTemplatePage,
|
getCouponCardTemplatePage,
|
||||||
} from '../../services/promotion';
|
} from '../../services/promotion';
|
||||||
import PaginationHelper from '../../../helpers/PaginationHelper';
|
import PaginationHelper from '../../../helpers/PaginationHelper';
|
||||||
|
import {productSpuList, productSpuSearchList} from "../../services/product";
|
||||||
|
|
||||||
const SEARCH_PARAMS_DEFAULT = {
|
const SEARCH_PARAMS_DEFAULT = {
|
||||||
title: '',
|
title: '',
|
||||||
@ -26,6 +27,7 @@ export default {
|
|||||||
modalType: undefined, // 'add' or 'update' 表单
|
modalType: undefined, // 'add' or 'update' 表单
|
||||||
formVals: {}, // 当前表单值
|
formVals: {}, // 当前表单值
|
||||||
modalLoading: false,
|
modalLoading: false,
|
||||||
|
searchProductSpuList: [],
|
||||||
},
|
},
|
||||||
|
|
||||||
effects: {
|
effects: {
|
||||||
@ -153,6 +155,33 @@ export default {
|
|||||||
// }
|
// }
|
||||||
// },
|
// },
|
||||||
|
|
||||||
|
* searchProductSpu({ payload }, { call, put }) {
|
||||||
|
// 请求
|
||||||
|
const response = yield call(productSpuSearchList, payload);
|
||||||
|
// 响应
|
||||||
|
if (response.code === 0) {
|
||||||
|
yield put({
|
||||||
|
type: 'setAll',
|
||||||
|
payload: {
|
||||||
|
searchProductSpuList: response.data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
* getProductSpuList({ payload }, { call, put }) {
|
||||||
|
// 请求
|
||||||
|
const response = yield call(productSpuList, payload);
|
||||||
|
// 响应
|
||||||
|
if (response.code === 0) {
|
||||||
|
yield put({
|
||||||
|
type: 'setAll',
|
||||||
|
payload: {
|
||||||
|
formSpuValues: response.data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
reducers: {
|
reducers: {
|
||||||
|
@ -7,6 +7,7 @@ import {
|
|||||||
updateProductRecommendStatus,
|
updateProductRecommendStatus,
|
||||||
} from '../../services/promotion';
|
} from '../../services/promotion';
|
||||||
import PaginationHelper from '../../../helpers/PaginationHelper';
|
import PaginationHelper from '../../../helpers/PaginationHelper';
|
||||||
|
import {productSpuList, productSpuSearchList} from "../../services/product";
|
||||||
|
|
||||||
const SEARCH_PARAMS_DEFAULT = {
|
const SEARCH_PARAMS_DEFAULT = {
|
||||||
type: undefined,
|
type: undefined,
|
||||||
@ -27,6 +28,8 @@ export default {
|
|||||||
modalType: undefined, // 'add' or 'update' 表单
|
modalType: undefined, // 'add' or 'update' 表单
|
||||||
formVals: {}, // 当前表单值
|
formVals: {}, // 当前表单值
|
||||||
modalLoading: false,
|
modalLoading: false,
|
||||||
|
searchProductSpuList: [], // 搜索商品
|
||||||
|
formSpuValues: [], // 编辑时,如果优惠劵选择的是商品,则需要获取该值。
|
||||||
},
|
},
|
||||||
|
|
||||||
effects: {
|
effects: {
|
||||||
@ -151,6 +154,19 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
* searchProductSpu({ payload }, { call, put }) {
|
||||||
|
// 请求
|
||||||
|
const response = yield call(productSpuSearchList, payload);
|
||||||
|
// 响应
|
||||||
|
if (response.code === 0) {
|
||||||
|
yield put({
|
||||||
|
type: 'setAll',
|
||||||
|
payload: {
|
||||||
|
searchProductSpuList: response.data,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
reducers: {
|
reducers: {
|
||||||
|
@ -217,7 +217,7 @@ const SearchForm = Form.create()(props => {
|
|||||||
</FormItem>
|
</FormItem>
|
||||||
</Col>
|
</Col>
|
||||||
<Col md={8} sm={24}>
|
<Col md={8} sm={24}>
|
||||||
<FormItem label="商品名称">
|
<FormItem label="商品分类">
|
||||||
{getFieldDecorator('cid')(
|
{getFieldDecorator('cid')(
|
||||||
<TreeSelect
|
<TreeSelect
|
||||||
showSearch
|
showSearch
|
||||||
|
@ -18,7 +18,7 @@ import {
|
|||||||
Select,
|
Select,
|
||||||
Icon,
|
Icon,
|
||||||
InputNumber,
|
InputNumber,
|
||||||
DatePicker
|
DatePicker, TreeSelect
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import { checkTypeWithEnglishAndNumbers } from '../../../helpers/validator'
|
import { checkTypeWithEnglishAndNumbers } from '../../../helpers/validator'
|
||||||
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
|
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
|
||||||
@ -145,10 +145,10 @@ function List ({ dataSource, loading, pagination, searchParams, dispatch,
|
|||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
render: val => <span>{status[val]}</span>,
|
render: val => <span>{status[val]}</span>,
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
title: '使用说明',
|
// title: '使用说明',
|
||||||
dataIndex: 'description',
|
// dataIndex: 'description',
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
dataIndex: 'createTime',
|
dataIndex: 'createTime',
|
||||||
@ -264,18 +264,20 @@ const SearchForm = Form.create()(props => {
|
|||||||
|
|
||||||
// 添加 or 修改 Form 表单
|
// 添加 or 修改 Form 表单
|
||||||
const AddOrUpdateForm = Form.create()(props => {
|
const AddOrUpdateForm = Form.create()(props => {
|
||||||
const { dispatch, modalVisible, form, handleModalVisible, modalType, formVals } = props;
|
const { dispatch, modalVisible, form, handleModalVisible, modalType, formVals,
|
||||||
|
searchProductSpuList, formSpuValues, categoryTree} = props;
|
||||||
|
|
||||||
const okHandle = () => {
|
const okHandle = () => {
|
||||||
form.validateFields((err, fields) => {
|
form.validateFields((err, fields) => {
|
||||||
if (err) return;
|
if (err) return;
|
||||||
let newFileds = {
|
let newFields = {
|
||||||
...fields,
|
...fields,
|
||||||
priceAvailable: fields.priceAvailable ? parseInt(fields.priceAvailable * 100) : undefined,
|
priceAvailable: fields.priceAvailable ? parseInt(fields.priceAvailable * 100) : undefined,
|
||||||
priceOff: fields.priceOff ? parseInt(fields.priceOff * 100) : undefined,
|
priceOff: fields.priceOff ? parseInt(fields.priceOff * 100) : undefined,
|
||||||
discountPriceLimit: fields.discountPriceLimit ? parseInt(fields.discountPriceLimit * 100) : undefined,
|
discountPriceLimit: fields.discountPriceLimit ? parseInt(fields.discountPriceLimit * 100) : undefined,
|
||||||
validStartTime: fields.validStartTime ? fields.validStartTime.format('YYYY-MM-DD') : undefined,
|
validStartTime: fields.validStartTime ? fields.validStartTime.format('YYYY-MM-DD') : undefined,
|
||||||
validEndTime: fields.validEndTime ? fields.validEndTime.format('YYYY-MM-DD') : undefined
|
validEndTime: fields.validEndTime ? fields.validEndTime.format('YYYY-MM-DD') : undefined,
|
||||||
|
rangeValues: fields.rangeValues && fields.rangeValues.length > 0 ? fields.rangeValues.join(',') : undefined,
|
||||||
};
|
};
|
||||||
// 添加表单
|
// 添加表单
|
||||||
if (modalType === 'add') {
|
if (modalType === 'add') {
|
||||||
@ -283,7 +285,7 @@ const AddOrUpdateForm = Form.create()(props => {
|
|||||||
type: 'couponCardTemplateList/add',
|
type: 'couponCardTemplateList/add',
|
||||||
payload: {
|
payload: {
|
||||||
body: {
|
body: {
|
||||||
...newFileds,
|
...newFields,
|
||||||
},
|
},
|
||||||
callback: () => {
|
callback: () => {
|
||||||
// 清空表单
|
// 清空表单
|
||||||
@ -302,7 +304,7 @@ const AddOrUpdateForm = Form.create()(props => {
|
|||||||
payload: {
|
payload: {
|
||||||
body: {
|
body: {
|
||||||
id: formVals.id,
|
id: formVals.id,
|
||||||
...newFileds,
|
...newFields,
|
||||||
priceAvailable: undefined,
|
priceAvailable: undefined,
|
||||||
dateType: undefined,
|
dateType: undefined,
|
||||||
validStartTime: undefined,
|
validStartTime: undefined,
|
||||||
@ -340,6 +342,42 @@ const AddOrUpdateForm = Form.create()(props => {
|
|||||||
formVals.preferentialType = parseInt(value);
|
formVals.preferentialType = parseInt(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const searchProductSpu = (value) => {
|
||||||
|
if (!value) {
|
||||||
|
dispatch({
|
||||||
|
type: 'couponCardTemplateList/setAll',
|
||||||
|
payload: {
|
||||||
|
searchProductSpuList: [],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dispatch({
|
||||||
|
type: 'couponCardTemplateList/searchProductSpu',
|
||||||
|
payload: {
|
||||||
|
name: value,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 处理分类筛选
|
||||||
|
const buildSelectTree = (list) => {
|
||||||
|
return list.map(item => {
|
||||||
|
let children = [];
|
||||||
|
if (item.children) {
|
||||||
|
children = buildSelectTree(item.children);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
title: item.name,
|
||||||
|
value: item.id,
|
||||||
|
key: item.id,
|
||||||
|
children,
|
||||||
|
selectable: item.pid > 0
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
let categoryTreeSelect = buildSelectTree(categoryTree);
|
||||||
|
|
||||||
const title = modalType === 'add' ? '新建优惠劵' : '更新优惠劵';
|
const title = modalType === 'add' ? '新建优惠劵' : '更新优惠劵';
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
@ -392,14 +430,14 @@ const AddOrUpdateForm = Form.create()(props => {
|
|||||||
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="使用金额门槛">
|
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="使用金额门槛">
|
||||||
{form.getFieldDecorator('priceAvailable', {
|
{form.getFieldDecorator('priceAvailable', {
|
||||||
rules: [{ required: true, message: '请输入使用金额门槛!' },],
|
rules: [{ required: true, message: '请输入使用金额门槛!' },],
|
||||||
initialValue: formVals.priceAvailable / 100.0,
|
initialValue: formVals.priceAvailable ? formVals.priceAvailable / 100.0 : undefined,
|
||||||
})(<InputNumber disabled={modalType != 'add'} placeholder="请输入" />)} 元
|
})(<InputNumber disabled={modalType != 'add'} placeholder="请输入" />)} 元
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="可用范围">
|
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="可用范围">
|
||||||
{form.getFieldDecorator('rangeType', {
|
{form.getFieldDecorator('rangeType', {
|
||||||
rules: [{ required: true, message: '请选择可用范围!'}, // TODO 芋艿,需要修改
|
rules: [{ required: true, message: '请选择可用范围!'}, // TODO 芋艿,需要修改
|
||||||
],
|
],
|
||||||
initialValue: formVals.rangeType + '',
|
initialValue: formVals.rangeType ? formVals.rangeType + '' : undefined,
|
||||||
})(
|
})(
|
||||||
<Select placeholder="请选择" style={{ maxWidth: 200, width: '100%' }} onChange={onRangeTypeChange} >
|
<Select placeholder="请选择" style={{ maxWidth: 200, width: '100%' }} onChange={onRangeTypeChange} >
|
||||||
<SelectOption value="10">所有可用</SelectOption>
|
<SelectOption value="10">所有可用</SelectOption>
|
||||||
@ -410,16 +448,62 @@ const AddOrUpdateForm = Form.create()(props => {
|
|||||||
</Select>
|
</Select>
|
||||||
)}
|
)}
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
{/*{*/}
|
||||||
|
{/* formVals.rangeType == 20 || formVals.rangeType == 21*/}
|
||||||
|
{/* || formVals.rangeType == 30 || formVals.rangeType == 31 ?*/}
|
||||||
|
{/* <FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="具体范围">*/}
|
||||||
|
{/* {form.getFieldDecorator('rangeValues', {*/}
|
||||||
|
{/* rules: [{ required: true, message: '请输入具体范围!' }, // TODO 芋艿,做成搜索*/}
|
||||||
|
{/* {maxlength: 255, message: '最大长度为 255 位'},*/}
|
||||||
|
{/* ],*/}
|
||||||
|
{/* initialValue: formVals.rangeValues,*/}
|
||||||
|
{/* })(<Input.TextArea placeholder="请输入" />)}*/}
|
||||||
|
{/* </FormItem>*/}
|
||||||
|
{/* : ''*/}
|
||||||
|
{/*}*/}
|
||||||
{
|
{
|
||||||
formVals.rangeType == 20 || formVals.rangeType == 21
|
formVals.rangeType == 20 || formVals.rangeType == 21?
|
||||||
|| formVals.rangeType == 30 || formVals.rangeType == 31 ?
|
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="选择商品">
|
||||||
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="具体范围">
|
|
||||||
{form.getFieldDecorator('rangeValues', {
|
{form.getFieldDecorator('rangeValues', {
|
||||||
rules: [{ required: true, message: '请输入具体范围!' }, // TODO 芋艿,做成搜索
|
rules: [{ required: true, message: '请选择商品!' },
|
||||||
{maxlength: 255, message: '最大长度为 255 位'},
|
|
||||||
],
|
],
|
||||||
initialValue: formVals.rangeValues,
|
initialValue: formVals.rangeValues ? formVals.rangeValues.split(',') : undefined,
|
||||||
})(<Input.TextArea placeholder="请输入" />)}
|
})(
|
||||||
|
<Select
|
||||||
|
// labelInValue
|
||||||
|
// value={formVals.productSpuId}
|
||||||
|
mode={"multiple"}
|
||||||
|
placeholder="请搜索商品"
|
||||||
|
onSearch={searchProductSpu}
|
||||||
|
showSearch={true}
|
||||||
|
filterOption={false}
|
||||||
|
style={{ width: '100%' }}
|
||||||
|
>
|
||||||
|
{searchProductSpuList.map(d => <Option key={d.id} value={d.id + ''}>{d.name}</Option>)}
|
||||||
|
{searchProductSpuList.length === 0 && formSpuValues.length > 0 ?
|
||||||
|
formSpuValues.map(d => <Option key={d.id} value={d.id + ''}>{d.name}</Option>) : ''}
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
|
</FormItem>
|
||||||
|
: ''
|
||||||
|
}
|
||||||
|
{
|
||||||
|
formVals.rangeType == 30 || formVals.rangeType == 31 ?
|
||||||
|
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="选择分类">
|
||||||
|
{form.getFieldDecorator('rangeValues', {
|
||||||
|
rules: [{ required: true, message: '请选择分类!' },
|
||||||
|
],
|
||||||
|
initialValue: formVals.rangeValues ? formVals.rangeValues.split(',') : undefined,
|
||||||
|
})(
|
||||||
|
<TreeSelect
|
||||||
|
showSearch
|
||||||
|
multiple
|
||||||
|
style={{ width: 200 }}
|
||||||
|
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
||||||
|
treeData={categoryTreeSelect}
|
||||||
|
placeholder="请选择分类"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</FormItem>
|
</FormItem>
|
||||||
: ''
|
: ''
|
||||||
}
|
}
|
||||||
@ -427,7 +511,7 @@ const AddOrUpdateForm = Form.create()(props => {
|
|||||||
{form.getFieldDecorator('dateType', {
|
{form.getFieldDecorator('dateType', {
|
||||||
rules: [{ required: true, message: '请选择可用范围!'}, // TODO 芋艿,需要修改
|
rules: [{ required: true, message: '请选择可用范围!'}, // TODO 芋艿,需要修改
|
||||||
],
|
],
|
||||||
initialValue: formVals.dateType + '',
|
initialValue: formVals.dateType ? formVals.dateType + '' : undefined,
|
||||||
})(
|
})(
|
||||||
<Select disabled={modalType != 'add'} 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="1">固定日期</SelectOption>
|
||||||
@ -470,7 +554,7 @@ const AddOrUpdateForm = Form.create()(props => {
|
|||||||
{form.getFieldDecorator('preferentialType', {
|
{form.getFieldDecorator('preferentialType', {
|
||||||
rules: [{ required: true, message: '请选择优惠类型!'}, // TODO 芋艿,需要修改
|
rules: [{ required: true, message: '请选择优惠类型!'}, // TODO 芋艿,需要修改
|
||||||
],
|
],
|
||||||
initialValue: formVals.preferentialType + '',
|
initialValue: formVals.preferentialType ? formVals.preferentialType + '' : undefined,
|
||||||
})(
|
})(
|
||||||
<Select disabled={modalType != 'add'} 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="1">代金卷</SelectOption>
|
||||||
@ -513,10 +597,11 @@ const AddOrUpdateForm = Form.create()(props => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@connect(({ couponCardTemplateList }) => ({
|
@connect(({ couponCardTemplateList, productCategoryList }) => ({
|
||||||
// list: productRecommend.list,
|
// list: productRecommend.list,
|
||||||
// pagination: productRecommend.pagination,
|
// pagination: productRecommend.pagination,
|
||||||
...couponCardTemplateList,
|
...couponCardTemplateList,
|
||||||
|
categoryTree: productCategoryList.list,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// 主界面
|
// 主界面
|
||||||
@ -525,6 +610,7 @@ class CouponCardTemplateLists extends PureComponent {
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { dispatch } = this.props;
|
const { dispatch } = this.props;
|
||||||
|
// 获得优惠劵列表
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'couponCardTemplateList/query',
|
type: 'couponCardTemplateList/query',
|
||||||
payload: {
|
payload: {
|
||||||
@ -535,21 +621,40 @@ class CouponCardTemplateLists extends PureComponent {
|
|||||||
|
|
||||||
handleModalVisible = (modalVisible, modalType, record) => {
|
handleModalVisible = (modalVisible, modalType, record) => {
|
||||||
const { dispatch } = this.props;
|
const { dispatch } = this.props;
|
||||||
|
// 弹窗,并清空一些缓存
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'couponCardTemplateList/setAll',
|
type: 'couponCardTemplateList/setAll',
|
||||||
payload: {
|
payload: {
|
||||||
modalVisible,
|
modalVisible,
|
||||||
modalType,
|
modalType,
|
||||||
formVals: record || {}
|
formVals: record || {},
|
||||||
|
searchProductSpuList: [],
|
||||||
|
formSpuValues: [],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
// 如果是指定商品,则获得商品列表
|
||||||
|
if (record && record.rangeType &&
|
||||||
|
(record.rangeType === 20 || record.rangeType === 21)) {
|
||||||
|
dispatch({
|
||||||
|
type: 'couponCardTemplateList/getProductSpuList',
|
||||||
|
payload: {
|
||||||
|
ids: record.rangeValues,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 获得商品分类,因为后续可能使用到
|
||||||
|
// 获得商品分类
|
||||||
|
dispatch({
|
||||||
|
type: 'productCategoryList/tree',
|
||||||
|
payload: {},
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
// let that = this;
|
// let that = this;
|
||||||
const { dispatch,
|
const { dispatch,
|
||||||
list, listLoading, searchParams, pagination,
|
list, listLoading, searchParams, pagination,
|
||||||
modalVisible, modalType, formVals,
|
modalVisible, modalType, formVals, searchProductSpuList, formSpuValues, categoryTree,
|
||||||
confirmLoading, } = this.props;
|
confirmLoading, } = this.props;
|
||||||
|
|
||||||
// 列表属性
|
// 列表属性
|
||||||
@ -574,6 +679,9 @@ class CouponCardTemplateLists extends PureComponent {
|
|||||||
modalType,
|
modalType,
|
||||||
formVals,
|
formVals,
|
||||||
dispatch,
|
dispatch,
|
||||||
|
searchProductSpuList,
|
||||||
|
formSpuValues,
|
||||||
|
categoryTree,
|
||||||
handleModalVisible: this.handleModalVisible, // Function
|
handleModalVisible: this.handleModalVisible, // Function
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -211,7 +211,12 @@ const SearchForm = Form.create()(props => {
|
|||||||
|
|
||||||
// 添加 or 修改 Form 表单
|
// 添加 or 修改 Form 表单
|
||||||
const AddOrUpdateForm = Form.create()(props => {
|
const AddOrUpdateForm = Form.create()(props => {
|
||||||
const { dispatch, modalVisible, form, handleModalVisible, modalType, formVals } = props;
|
const { dispatch, modalVisible, form, handleModalVisible, modalType, formVals,
|
||||||
|
searchProductSpuList} = props;
|
||||||
|
// let selectedSearchProductSpu = formVals.productSpuId ? {
|
||||||
|
// key: formVals.productSpuId,
|
||||||
|
// label: formVals.productSpuName,
|
||||||
|
// } : {};
|
||||||
|
|
||||||
const okHandle = () => {
|
const okHandle = () => {
|
||||||
form.validateFields((err, fields) => {
|
form.validateFields((err, fields) => {
|
||||||
@ -257,6 +262,24 @@ const AddOrUpdateForm = Form.create()(props => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const searchProductSpu = (value) => {
|
||||||
|
if (!value) {
|
||||||
|
dispatch({
|
||||||
|
type: 'productRecommendList/setAll',
|
||||||
|
payload: {
|
||||||
|
searchProductSpuList: [],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dispatch({
|
||||||
|
type: 'productRecommendList/searchProductSpu',
|
||||||
|
payload: {
|
||||||
|
name: value,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const title = modalType === 'add' ? '新建商品推荐' : '更新商品推荐';
|
const title = modalType === 'add' ? '新建商品推荐' : '更新商品推荐';
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
@ -284,7 +307,20 @@ const AddOrUpdateForm = Form.create()(props => {
|
|||||||
rules: [{ required: true, message: '请输入商品!'}, // TODO 芋艿,临时先输入商品编号,后面做成搜索。
|
rules: [{ required: true, message: '请输入商品!'}, // TODO 芋艿,临时先输入商品编号,后面做成搜索。
|
||||||
],
|
],
|
||||||
initialValue: formVals.productSpuId,
|
initialValue: formVals.productSpuId,
|
||||||
})(<Input placeholder="请输入" />)}
|
})(
|
||||||
|
<Select
|
||||||
|
// labelInValue
|
||||||
|
// value={formVals.productSpuId}
|
||||||
|
placeholder="请搜索商品"
|
||||||
|
onSearch={searchProductSpu}
|
||||||
|
showSearch={true}
|
||||||
|
filterOption={false}
|
||||||
|
style={{ width: '100%' }}
|
||||||
|
>
|
||||||
|
{searchProductSpuList.map(d => <Option key={d.id} value={d.id}>{d.name}</Option>)}
|
||||||
|
{searchProductSpuList.length === 0 && formVals.productSpuId ? <Option key={formVals.productSpuId} value={formVals.productSpuId}>{formVals.productSpuName}</Option> : ''}
|
||||||
|
</Select>
|
||||||
|
)}
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="排序值">
|
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="排序值">
|
||||||
{form.getFieldDecorator('sort', {
|
{form.getFieldDecorator('sort', {
|
||||||
@ -331,7 +367,8 @@ class BannerList extends PureComponent {
|
|||||||
payload: {
|
payload: {
|
||||||
modalVisible,
|
modalVisible,
|
||||||
modalType,
|
modalType,
|
||||||
formVals: record || {}
|
formVals: record || {},
|
||||||
|
searchProductSpuList: [],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -340,7 +377,7 @@ class BannerList extends PureComponent {
|
|||||||
// let that = this;
|
// let that = this;
|
||||||
const { dispatch,
|
const { dispatch,
|
||||||
list, listLoading, searchParams, pagination,
|
list, listLoading, searchParams, pagination,
|
||||||
modalVisible, modalType, formVals,
|
modalVisible, modalType, formVals, searchProductSpuList,
|
||||||
confirmLoading, } = this.props;
|
confirmLoading, } = this.props;
|
||||||
|
|
||||||
// 列表属性
|
// 列表属性
|
||||||
@ -365,6 +402,7 @@ class BannerList extends PureComponent {
|
|||||||
modalType,
|
modalType,
|
||||||
formVals,
|
formVals,
|
||||||
dispatch,
|
dispatch,
|
||||||
|
searchProductSpuList,
|
||||||
handleModalVisible: this.handleModalVisible, // Function
|
handleModalVisible: this.handleModalVisible, // Function
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,6 +44,18 @@ export async function productSpuPage(params) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function productSpuSearchList(params) {
|
||||||
|
return request(`/product-api/admins/spu/search_list?${stringify(params)}`, {
|
||||||
|
method: 'GET',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function productSpuList(params) {
|
||||||
|
return request(`/product-api/admins/spu/list?${stringify(params)}`, {
|
||||||
|
method: 'GET',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export async function productSpuAdd(params) {
|
export async function productSpuAdd(params) {
|
||||||
return request(`/product-api/admins/spu/add?${stringify(params)}`, {
|
return request(`/product-api/admins/spu/add?${stringify(params)}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -84,6 +84,12 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.dubbo</groupId>
|
||||||
|
<artifactId>dubbo</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -0,0 +1,268 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.dubbo.config.spring.beans.factory.annotation;
|
||||||
|
|
||||||
|
import org.apache.dubbo.config.annotation.Reference;
|
||||||
|
import org.apache.dubbo.config.spring.ReferenceBean;
|
||||||
|
import org.apache.dubbo.config.spring.ServiceBean;
|
||||||
|
import org.apache.dubbo.config.spring.context.event.ServiceBeanExportedEvent;
|
||||||
|
import org.apache.dubbo.config.spring.util.AnnotationUtils;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.beans.factory.annotation.InjectionMetadata;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationContextAware;
|
||||||
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
import org.springframework.context.ApplicationListener;
|
||||||
|
import org.springframework.context.event.ContextRefreshedEvent;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.InvocationHandler;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.Proxy;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link org.springframework.beans.factory.config.BeanPostProcessor} implementation
|
||||||
|
* that Consumer service {@link Reference} annotated fields
|
||||||
|
*
|
||||||
|
* @since 2.5.7
|
||||||
|
*/
|
||||||
|
public class ReferenceAnnotationBeanPostProcessor extends AnnotationInjectedBeanPostProcessor<Reference>
|
||||||
|
implements ApplicationContextAware, ApplicationListener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The bean name of {@link ReferenceAnnotationBeanPostProcessor}
|
||||||
|
*/
|
||||||
|
public static final String BEAN_NAME = "referenceAnnotationBeanPostProcessor";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache size
|
||||||
|
*/
|
||||||
|
private static final int CACHE_SIZE = Integer.getInteger(BEAN_NAME + ".cache.size", 32);
|
||||||
|
|
||||||
|
private final ConcurrentMap<String, ReferenceBean<?>> referenceBeanCache =
|
||||||
|
new ConcurrentHashMap<String, ReferenceBean<?>>(CACHE_SIZE);
|
||||||
|
|
||||||
|
private final ConcurrentHashMap<String, ReferenceBeanInvocationHandler> localReferenceBeanInvocationHandlerCache =
|
||||||
|
new ConcurrentHashMap<String, ReferenceBeanInvocationHandler>(CACHE_SIZE);
|
||||||
|
|
||||||
|
private final ConcurrentMap<InjectionMetadata.InjectedElement, ReferenceBean<?>> injectedFieldReferenceBeanCache =
|
||||||
|
new ConcurrentHashMap<InjectionMetadata.InjectedElement, ReferenceBean<?>>(CACHE_SIZE);
|
||||||
|
|
||||||
|
private final ConcurrentMap<InjectionMetadata.InjectedElement, ReferenceBean<?>> injectedMethodReferenceBeanCache =
|
||||||
|
new ConcurrentHashMap<InjectionMetadata.InjectedElement, ReferenceBean<?>>(CACHE_SIZE);
|
||||||
|
|
||||||
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all beans of {@link ReferenceBean}
|
||||||
|
*
|
||||||
|
* @return non-null read-only {@link Collection}
|
||||||
|
* @since 2.5.9
|
||||||
|
*/
|
||||||
|
public Collection<ReferenceBean<?>> getReferenceBeans() {
|
||||||
|
return referenceBeanCache.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get {@link ReferenceBean} {@link Map} in injected field.
|
||||||
|
*
|
||||||
|
* @return non-null {@link Map}
|
||||||
|
* @since 2.5.11
|
||||||
|
*/
|
||||||
|
public Map<InjectionMetadata.InjectedElement, ReferenceBean<?>> getInjectedFieldReferenceBeanMap() {
|
||||||
|
return Collections.unmodifiableMap(injectedFieldReferenceBeanCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get {@link ReferenceBean} {@link Map} in injected method.
|
||||||
|
*
|
||||||
|
* @return non-null {@link Map}
|
||||||
|
* @since 2.5.11
|
||||||
|
*/
|
||||||
|
public Map<InjectionMetadata.InjectedElement, ReferenceBean<?>> getInjectedMethodReferenceBeanMap() {
|
||||||
|
return Collections.unmodifiableMap(injectedMethodReferenceBeanCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object doGetInjectedBean(Reference reference, Object bean, String beanName, Class<?> injectedType,
|
||||||
|
InjectionMetadata.InjectedElement injectedElement) throws Exception {
|
||||||
|
|
||||||
|
String referencedBeanName = buildReferencedBeanName(reference, injectedType);
|
||||||
|
|
||||||
|
ReferenceBean referenceBean = buildReferenceBeanIfAbsent(referencedBeanName, reference, injectedType, getClassLoader());
|
||||||
|
|
||||||
|
cacheInjectedReferenceBean(referenceBean, injectedElement);
|
||||||
|
|
||||||
|
Object proxy = buildProxy(referencedBeanName, referenceBean, injectedType);
|
||||||
|
|
||||||
|
return proxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object buildProxy(String referencedBeanName, ReferenceBean referenceBean, Class<?> injectedType) {
|
||||||
|
InvocationHandler handler = buildInvocationHandler(referencedBeanName, referenceBean);
|
||||||
|
Object proxy = Proxy.newProxyInstance(getClassLoader(), new Class[]{injectedType}, handler);
|
||||||
|
return proxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
private InvocationHandler buildInvocationHandler(String referencedBeanName, ReferenceBean referenceBean) {
|
||||||
|
|
||||||
|
ReferenceBeanInvocationHandler handler = localReferenceBeanInvocationHandlerCache.get(referencedBeanName);
|
||||||
|
|
||||||
|
if (handler == null) {
|
||||||
|
handler = new ReferenceBeanInvocationHandler(referenceBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (applicationContext.containsBean(referencedBeanName)) { // Is local @Service Bean or not ?
|
||||||
|
// ReferenceBeanInvocationHandler's initialization has to wait for current local @Service Bean has been exported.
|
||||||
|
localReferenceBeanInvocationHandlerCache.put(referencedBeanName, handler);
|
||||||
|
} else if (!applicationContext.getBeansOfType(referenceBean.getInterfaceClass()).isEmpty()) { // TODO 芋艿,临时添加,等待官方修复方案
|
||||||
|
localReferenceBeanInvocationHandlerCache.put(referencedBeanName, handler);
|
||||||
|
} else {
|
||||||
|
// Remote Reference Bean should initialize immediately
|
||||||
|
handler.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
return handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ReferenceBeanInvocationHandler implements InvocationHandler {
|
||||||
|
|
||||||
|
private final ReferenceBean referenceBean;
|
||||||
|
|
||||||
|
private Object bean;
|
||||||
|
|
||||||
|
private ReferenceBeanInvocationHandler(ReferenceBean referenceBean) {
|
||||||
|
this.referenceBean = referenceBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||||
|
Object result = null;
|
||||||
|
try {
|
||||||
|
if (bean == null) { // If the bean is not initialized, invoke init()
|
||||||
|
// issue: https://github.com/apache/incubator-dubbo/issues/3429
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
result = method.invoke(bean, args);
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
// re-throws the actual Exception.
|
||||||
|
throw e.getTargetException();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
this.bean = referenceBean.get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String buildInjectedObjectCacheKey(Reference reference, Object bean, String beanName,
|
||||||
|
Class<?> injectedType, InjectionMetadata.InjectedElement injectedElement) {
|
||||||
|
|
||||||
|
String key = buildReferencedBeanName(reference, injectedType) +
|
||||||
|
"#source=" + (injectedElement.getMember()) +
|
||||||
|
"#attributes=" + AnnotationUtils.getAttributes(reference,getEnvironment(),true);
|
||||||
|
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String buildReferencedBeanName(Reference reference, Class<?> injectedType) {
|
||||||
|
|
||||||
|
AnnotationBeanNameBuilder builder = AnnotationBeanNameBuilder.create(reference, injectedType);
|
||||||
|
|
||||||
|
builder.environment(getEnvironment());
|
||||||
|
|
||||||
|
return getEnvironment().resolvePlaceholders(builder.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
private ReferenceBean buildReferenceBeanIfAbsent(String referencedBeanName, Reference reference,
|
||||||
|
Class<?> referencedType, ClassLoader classLoader)
|
||||||
|
throws Exception {
|
||||||
|
|
||||||
|
ReferenceBean<?> referenceBean = referenceBeanCache.get(referencedBeanName);
|
||||||
|
|
||||||
|
if (referenceBean == null) {
|
||||||
|
ReferenceBeanBuilder beanBuilder = ReferenceBeanBuilder
|
||||||
|
.create(reference, classLoader, applicationContext)
|
||||||
|
.interfaceClass(referencedType);
|
||||||
|
referenceBean = beanBuilder.build();
|
||||||
|
referenceBeanCache.put(referencedBeanName, referenceBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
return referenceBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cacheInjectedReferenceBean(ReferenceBean referenceBean,
|
||||||
|
InjectionMetadata.InjectedElement injectedElement) {
|
||||||
|
if (injectedElement.getMember() instanceof Field) {
|
||||||
|
injectedFieldReferenceBeanCache.put(injectedElement, referenceBean);
|
||||||
|
} else if (injectedElement.getMember() instanceof Method) {
|
||||||
|
injectedMethodReferenceBeanCache.put(injectedElement, referenceBean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||||
|
this.applicationContext = applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onApplicationEvent(ApplicationEvent event) {
|
||||||
|
if (event instanceof ServiceBeanExportedEvent) {
|
||||||
|
onServiceBeanExportEvent((ServiceBeanExportedEvent) event);
|
||||||
|
} else if (event instanceof ContextRefreshedEvent) {
|
||||||
|
onContextRefreshedEvent((ContextRefreshedEvent) event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onServiceBeanExportEvent(ServiceBeanExportedEvent event) {
|
||||||
|
ServiceBean serviceBean = event.getServiceBean();
|
||||||
|
initReferenceBeanInvocationHandler(serviceBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initReferenceBeanInvocationHandler(ServiceBean serviceBean) {
|
||||||
|
String serviceBeanName = serviceBean.getBeanName();
|
||||||
|
// Remove ServiceBean when it's exported
|
||||||
|
ReferenceBeanInvocationHandler handler = localReferenceBeanInvocationHandlerCache.remove(serviceBeanName);
|
||||||
|
// Initialize
|
||||||
|
if (handler != null) {
|
||||||
|
handler.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onContextRefreshedEvent(ContextRefreshedEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() throws Exception {
|
||||||
|
super.destroy();
|
||||||
|
this.referenceBeanCache.clear();
|
||||||
|
this.localReferenceBeanInvocationHandlerCache.clear();
|
||||||
|
this.injectedFieldReferenceBeanCache.clear();
|
||||||
|
this.injectedMethodReferenceBeanCache.clear();
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,8 @@
|
|||||||
* 未完成的功能,欢迎一起来开发,特别是【待认领】的任务。
|
* 未完成的功能,欢迎一起来开发,特别是【待认领】的任务。
|
||||||
|
|
||||||
- [x] 首页
|
- [x] 首页
|
||||||
|
- [x] 首页广告
|
||||||
|
- [x] 商品推荐(手动)
|
||||||
- 商品相关
|
- 商品相关
|
||||||
- [x] 分类列表
|
- [x] 分类列表
|
||||||
- [x] 商品搜索
|
- [x] 商品搜索
|
||||||
|
@ -22,12 +22,12 @@
|
|||||||
- TODO 需要补充
|
- TODO 需要补充
|
||||||
- [ ] 营销管理
|
- [ ] 营销管理
|
||||||
- [x] 首页广告
|
- [x] 首页广告
|
||||||
- [ ] 优惠劵
|
- [x] 商品推荐
|
||||||
|
- [x] 优惠劵
|
||||||
- [ ] 优惠码【待认领】
|
- [ ] 优惠码【待认领】
|
||||||
- [ ] 商品推荐
|
- [ ] 满减送
|
||||||
- [ ] 满减送活动
|
- [ ] 限制折扣
|
||||||
- [ ] 限制折扣活动
|
- [ ] 多人拼团【待认领】
|
||||||
- [ ] 团购活动【待认领】
|
|
||||||
- [ ] 系统管理
|
- [ ] 系统管理
|
||||||
- [ ] 员工管理
|
- [ ] 员工管理
|
||||||
- [ ] 角色管理
|
- [ ] 角色管理
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
package cn.iocoder.mall.pay.biz;
|
||||||
|
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication(scanBasePackages = {"cn.iocoder.mall.pay"})
|
||||||
|
public class Application {
|
||||||
|
}
|
@ -20,12 +20,6 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|||||||
AdminSecurityInterceptor.class, AdminAccessLogInterceptor.class})
|
AdminSecurityInterceptor.class, AdminAccessLogInterceptor.class})
|
||||||
public class MVCConfiguration implements WebMvcConfigurer {
|
public class MVCConfiguration implements WebMvcConfigurer {
|
||||||
|
|
||||||
// @Autowired
|
|
||||||
// private SecurityInterceptor securityInterceptor;
|
|
||||||
|
|
||||||
// @Reference
|
|
||||||
// private OAuth2Service oauth2Service;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AdminSecurityInterceptor adminSecurityInterceptor;
|
private AdminSecurityInterceptor adminSecurityInterceptor;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -13,30 +13,29 @@ import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrPageVO;
|
|||||||
import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrSimpleVO;
|
import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrSimpleVO;
|
||||||
import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrVO;
|
import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrVO;
|
||||||
import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrValueVO;
|
import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrValueVO;
|
||||||
import org.apache.dubbo.config.annotation.Reference;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.apache.dubbo.config.annotation.Reference;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import static cn.iocoder.common.framework.vo.CommonResult.*;
|
|
||||||
|
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("admins")
|
@RequestMapping("admins")
|
||||||
@Api("商品规格")
|
@Api("商品规格")
|
||||||
public class AdminsProductAttrController {
|
public class AdminsProductAttrController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.ProductAttrService.version}")
|
||||||
@Autowired
|
|
||||||
private ProductAttrService productAttrService;
|
private ProductAttrService productAttrService;
|
||||||
|
|
||||||
@GetMapping("/attr/page")
|
@GetMapping("/attr/page")
|
||||||
@ApiOperation("获得规格分页")
|
@ApiOperation("获得规格分页")
|
||||||
public CommonResult<AdminsProductAttrPageVO> attrPage(@RequestParam(value = "name", required = false) String name,
|
public CommonResult<AdminsProductAttrPageVO> attrPage(@RequestParam(value = "name", required = false) String name,
|
||||||
@RequestParam(value = "pageNo", defaultValue = "0") Integer pageNo,
|
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||||
// 创建 ProductAttrPageDTO 对象
|
// 创建 ProductAttrPageDTO 对象
|
||||||
ProductAttrPageDTO productAttrPageDTO = new ProductAttrPageDTO().setName(name).setPageNo(pageNo).setPageSize(pageSize);
|
ProductAttrPageDTO productAttrPageDTO = new ProductAttrPageDTO().setName(name).setPageNo(pageNo).setPageSize(pageSize);
|
||||||
|
@ -15,7 +15,6 @@ import io.swagger.annotations.ApiImplicitParam;
|
|||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.dubbo.config.annotation.Reference;
|
import org.apache.dubbo.config.annotation.Reference;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -31,8 +30,7 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
|
|||||||
@Api("商品分类")
|
@Api("商品分类")
|
||||||
public class AdminsProductCategoryController {
|
public class AdminsProductCategoryController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.ProductCategoryService.version}")
|
||||||
@Autowired
|
|
||||||
private ProductCategoryService productCategoryService;
|
private ProductCategoryService productCategoryService;
|
||||||
|
|
||||||
@GetMapping("/tree")
|
@GetMapping("/tree")
|
||||||
|
@ -3,26 +3,23 @@ package cn.iocoder.mall.product.application.controller.admins;
|
|||||||
import cn.iocoder.common.framework.vo.CommonResult;
|
import cn.iocoder.common.framework.vo.CommonResult;
|
||||||
import cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder;
|
import cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder;
|
||||||
import cn.iocoder.mall.product.api.ProductSpuService;
|
import cn.iocoder.mall.product.api.ProductSpuService;
|
||||||
|
import cn.iocoder.mall.product.api.bo.ProductSpuBO;
|
||||||
import cn.iocoder.mall.product.api.bo.ProductSpuDetailBO;
|
import cn.iocoder.mall.product.api.bo.ProductSpuDetailBO;
|
||||||
import cn.iocoder.mall.product.api.bo.ProductSpuPageBO;
|
import cn.iocoder.mall.product.api.bo.ProductSpuPageBO;
|
||||||
import cn.iocoder.mall.product.api.dto.ProductSkuAddOrUpdateDTO;
|
import cn.iocoder.mall.product.api.dto.*;
|
||||||
import cn.iocoder.mall.product.api.dto.ProductSpuAddDTO;
|
|
||||||
import cn.iocoder.mall.product.api.dto.ProductSpuPageDTO;
|
|
||||||
import cn.iocoder.mall.product.api.dto.ProductSpuUpdateDTO;
|
|
||||||
import cn.iocoder.mall.product.application.convert.ProductSpuConvert;
|
import cn.iocoder.mall.product.application.convert.ProductSpuConvert;
|
||||||
import cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuDetailVO;
|
import cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuDetailVO;
|
||||||
import cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuPageVO;
|
import cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuPageVO;
|
||||||
import com.fasterxml.jackson.databind.JavaType;
|
import cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuVO;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.alibaba.fastjson.JSON;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.dubbo.config.annotation.Reference;
|
import org.apache.dubbo.config.annotation.Reference;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||||
@ -32,13 +29,9 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
|
|||||||
@Api("商品 SPU + SKU")
|
@Api("商品 SPU + SKU")
|
||||||
public class AdminsProductSpuController {
|
public class AdminsProductSpuController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.ProductSpuService.version}")
|
||||||
@Autowired
|
|
||||||
private ProductSpuService productSpuService;
|
private ProductSpuService productSpuService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ObjectMapper objectMapper; // jackson 解析
|
|
||||||
|
|
||||||
@PostMapping("/spu/add")
|
@PostMapping("/spu/add")
|
||||||
@ApiOperation("创建商品")
|
@ApiOperation("创建商品")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ -109,15 +102,15 @@ public class AdminsProductSpuController {
|
|||||||
@ApiOperation("商品 SPU 分页列表")
|
@ApiOperation("商品 SPU 分页列表")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "name", value = "商品名称,模糊匹配", example = "小王"),
|
@ApiImplicitParam(name = "name", value = "商品名称,模糊匹配", example = "小王"),
|
||||||
@ApiImplicitParam(name = "pageNo", value = "页码,从 1 开始", example = "1"),
|
|
||||||
@ApiImplicitParam(name = "status", value = "状态", example = "可选值:1-在售中;2-已售罄;3-仓库中;"),
|
@ApiImplicitParam(name = "status", value = "状态", example = "可选值:1-在售中;2-已售罄;3-仓库中;"),
|
||||||
@ApiImplicitParam(name = "cid", value = "商品分类编号", example = "10"),
|
@ApiImplicitParam(name = "cid", value = "商品分类编号", example = "10"),
|
||||||
|
@ApiImplicitParam(name = "pageNo", value = "页码,从 1 开始", example = "1"),
|
||||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, example = "10"),
|
@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, example = "10"),
|
||||||
})
|
})
|
||||||
public CommonResult<AdminsProductSpuPageVO> spuPage(@RequestParam(value = "name", required = false) String name,
|
public CommonResult<AdminsProductSpuPageVO> spuPage(@RequestParam(value = "name", required = false) String name,
|
||||||
@RequestParam(value = "status") Integer status,
|
@RequestParam(value = "status") Integer status,
|
||||||
@RequestParam(value = "cid", required = false) Integer cid,
|
@RequestParam(value = "cid", required = false) Integer cid,
|
||||||
@RequestParam(value = "pageNo", defaultValue = "0") Integer pageNo,
|
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||||
// 创建 ProductSpuPageDTO 对象
|
// 创建 ProductSpuPageDTO 对象
|
||||||
ProductSpuPageDTO productSpuPageDTO = new ProductSpuPageDTO().setName(name).setCid(cid).setPageNo(pageNo).setPageSize(pageSize);
|
ProductSpuPageDTO productSpuPageDTO = new ProductSpuPageDTO().setName(name).setCid(cid).setPageNo(pageNo).setPageSize(pageSize);
|
||||||
@ -136,20 +129,40 @@ public class AdminsProductSpuController {
|
|||||||
return success(ProductSpuConvert.INSTANCE.convert2(result));
|
return success(ProductSpuConvert.INSTANCE.convert2(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/spu/search_list")
|
||||||
|
@ApiOperation("商品 SPU 搜索列表")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "name", value = "商品名称,模糊匹配", example = "小王"),
|
||||||
|
})
|
||||||
|
public CommonResult<List<AdminsProductSpuVO>> spuSearchList(@RequestParam(value = "name", required = false) String name) {
|
||||||
|
// 创建 ProductSpuSearchListDTO 对象
|
||||||
|
ProductSpuSearchListDTO productSpuSearchListDTO = new ProductSpuSearchListDTO().setName(name);
|
||||||
|
// 执行搜索
|
||||||
|
List<ProductSpuBO> list = productSpuService.getProductSpuSearchList(productSpuSearchListDTO);
|
||||||
|
// 转换返回
|
||||||
|
return success(ProductSpuConvert.INSTANCE.convert3(list));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/spu/info")
|
@GetMapping("/spu/info")
|
||||||
@ApiOperation("商品 SPU 明细")
|
@ApiOperation("商品 SPU 明细")
|
||||||
@ApiImplicitParam(name = "id", value = "SPU 编号", required = true, example = "100")
|
@ApiImplicitParam(name = "id", value = "SPU 编号", required = true, example = "100")
|
||||||
public CommonResult<AdminsProductSpuDetailVO> info(@RequestParam("id") Integer id) {
|
public CommonResult<AdminsProductSpuDetailVO> spuInfo(@RequestParam("id") Integer id) {
|
||||||
return success(ProductSpuConvert.INSTANCE.convert(productSpuService.getProductSpuDetail(id)));
|
return success(ProductSpuConvert.INSTANCE.convert(productSpuService.getProductSpuDetail(id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> List<T> parseSkus(String skuStr, Class<T> clazz) {
|
@GetMapping("/spu/list")
|
||||||
JavaType type = objectMapper.getTypeFactory().constructParametricType(List.class, clazz);
|
@ApiOperation("商品 SPU 列表")
|
||||||
try {
|
@ApiImplicitParams({
|
||||||
return objectMapper.readValue(skuStr, type);
|
@ApiImplicitParam(name = "ids", value = "商品 SPU 编号数组", example = "1,2,3"),
|
||||||
} catch (IOException e) {
|
})
|
||||||
throw new RuntimeException(e);
|
public CommonResult<List<AdminsProductSpuVO>> spuList(@RequestParam("ids") Collection<Integer> ids) {
|
||||||
|
List<ProductSpuBO> list = productSpuService.getProductSpuList(ids);
|
||||||
|
// 转换返回
|
||||||
|
return success(ProductSpuConvert.INSTANCE.convert3(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private <T> List<T> parseSkus(String skuStr, Class<T> clazz) {
|
||||||
|
return JSON.parseArray(skuStr, clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ import java.util.List;
|
|||||||
@Api("商品分类")
|
@Api("商品分类")
|
||||||
public class UsersProductCategoryController {
|
public class UsersProductCategoryController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.ProductCategoryService.version}")
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProductCategoryService productCategoryService;
|
private ProductCategoryService productCategoryService;
|
||||||
|
|
||||||
|
@ -8,12 +8,11 @@ import cn.iocoder.mall.product.application.convert.ProductSpuConvert;
|
|||||||
import cn.iocoder.mall.product.application.vo.users.UsersProductSpuDetailVO;
|
import cn.iocoder.mall.product.application.vo.users.UsersProductSpuDetailVO;
|
||||||
import cn.iocoder.mall.product.application.vo.users.UsersProductSpuPageVO;
|
import cn.iocoder.mall.product.application.vo.users.UsersProductSpuPageVO;
|
||||||
import cn.iocoder.mall.user.sdk.annotation.PermitAll;
|
import cn.iocoder.mall.user.sdk.annotation.PermitAll;
|
||||||
import org.apache.dubbo.config.annotation.Reference;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.apache.dubbo.config.annotation.Reference;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@ -26,8 +25,7 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
|
|||||||
@Api("商品 SPU + SKU")
|
@Api("商品 SPU + SKU")
|
||||||
public class UsersProductSpuController {
|
public class UsersProductSpuController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.ProductSpuService.version}")
|
||||||
@Autowired
|
|
||||||
private ProductSpuService productSpuService;
|
private ProductSpuService productSpuService;
|
||||||
|
|
||||||
@GetMapping("/info")
|
@GetMapping("/info")
|
||||||
|
@ -1,15 +1,19 @@
|
|||||||
package cn.iocoder.mall.product.application.convert;
|
package cn.iocoder.mall.product.application.convert;
|
||||||
|
|
||||||
|
import cn.iocoder.mall.product.api.bo.ProductSpuBO;
|
||||||
import cn.iocoder.mall.product.api.bo.ProductSpuDetailBO;
|
import cn.iocoder.mall.product.api.bo.ProductSpuDetailBO;
|
||||||
import cn.iocoder.mall.product.api.bo.ProductSpuPageBO;
|
import cn.iocoder.mall.product.api.bo.ProductSpuPageBO;
|
||||||
import cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuDetailVO;
|
import cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuDetailVO;
|
||||||
import cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuPageVO;
|
import cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuPageVO;
|
||||||
|
import cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuVO;
|
||||||
import cn.iocoder.mall.product.application.vo.users.UsersProductSpuDetailVO;
|
import cn.iocoder.mall.product.application.vo.users.UsersProductSpuDetailVO;
|
||||||
import cn.iocoder.mall.product.application.vo.users.UsersProductSpuPageVO;
|
import cn.iocoder.mall.product.application.vo.users.UsersProductSpuPageVO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mappings;
|
import org.mapstruct.Mappings;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ProductSpuConvert {
|
public interface ProductSpuConvert {
|
||||||
|
|
||||||
@ -24,6 +28,9 @@ public interface ProductSpuConvert {
|
|||||||
@Mappings({})
|
@Mappings({})
|
||||||
AdminsProductSpuPageVO convert2(ProductSpuPageBO result);
|
AdminsProductSpuPageVO convert2(ProductSpuPageBO result);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
List<AdminsProductSpuVO> convert3(List<ProductSpuBO> result);
|
||||||
|
|
||||||
@Mappings({})
|
@Mappings({})
|
||||||
UsersProductSpuPageVO convert3(ProductSpuPageBO result);
|
UsersProductSpuPageVO convert3(ProductSpuPageBO result);
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package cn.iocoder.mall.product.api;
|
|||||||
import cn.iocoder.mall.product.api.bo.*;
|
import cn.iocoder.mall.product.api.bo.*;
|
||||||
import cn.iocoder.mall.product.api.dto.ProductSpuAddDTO;
|
import cn.iocoder.mall.product.api.dto.ProductSpuAddDTO;
|
||||||
import cn.iocoder.mall.product.api.dto.ProductSpuPageDTO;
|
import cn.iocoder.mall.product.api.dto.ProductSpuPageDTO;
|
||||||
|
import cn.iocoder.mall.product.api.dto.ProductSpuSearchListDTO;
|
||||||
import cn.iocoder.mall.product.api.dto.ProductSpuUpdateDTO;
|
import cn.iocoder.mall.product.api.dto.ProductSpuUpdateDTO;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -23,6 +24,8 @@ public interface ProductSpuService {
|
|||||||
|
|
||||||
ProductSpuPageBO getProductSpuPage(ProductSpuPageDTO productSpuPageDTO);
|
ProductSpuPageBO getProductSpuPage(ProductSpuPageDTO productSpuPageDTO);
|
||||||
|
|
||||||
|
List<ProductSpuBO> getProductSpuSearchList(ProductSpuSearchListDTO productSpuSearchListDTO);
|
||||||
|
|
||||||
List<ProductSpuBO> getProductSpuList(Collection<Integer> ids);
|
List<ProductSpuBO> getProductSpuList(Collection<Integer> ids);
|
||||||
|
|
||||||
ProductSkuBO getProductSku(Integer id);
|
ProductSkuBO getProductSku(Integer id);
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package cn.iocoder.mall.product.api.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品 Spu 搜索列表 DTO
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class ProductSpuSearchListDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品名
|
||||||
|
*
|
||||||
|
* 模糊匹配
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
}
|
@ -27,7 +27,7 @@ import java.util.stream.Collectors;
|
|||||||
* @see cn.iocoder.mall.product.dataobject.ProductAttrValueDO
|
* @see cn.iocoder.mall.product.dataobject.ProductAttrValueDO
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.ProductAttrService.version}")
|
||||||
public class ProductAttrServiceImpl implements ProductAttrService {
|
public class ProductAttrServiceImpl implements ProductAttrService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -19,7 +19,7 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
|
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
|
||||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.ProductCategoryService.version}")
|
||||||
public class ProductCategoryServiceImpl implements ProductCategoryService {
|
public class ProductCategoryServiceImpl implements ProductCategoryService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -9,10 +9,7 @@ import cn.iocoder.mall.product.api.bo.*;
|
|||||||
import cn.iocoder.mall.product.api.constant.ProductCategoryConstants;
|
import cn.iocoder.mall.product.api.constant.ProductCategoryConstants;
|
||||||
import cn.iocoder.mall.product.api.constant.ProductErrorCodeEnum;
|
import cn.iocoder.mall.product.api.constant.ProductErrorCodeEnum;
|
||||||
import cn.iocoder.mall.product.api.constant.ProductSpuConstants;
|
import cn.iocoder.mall.product.api.constant.ProductSpuConstants;
|
||||||
import cn.iocoder.mall.product.api.dto.ProductSkuAddOrUpdateDTO;
|
import cn.iocoder.mall.product.api.dto.*;
|
||||||
import cn.iocoder.mall.product.api.dto.ProductSpuAddDTO;
|
|
||||||
import cn.iocoder.mall.product.api.dto.ProductSpuPageDTO;
|
|
||||||
import cn.iocoder.mall.product.api.dto.ProductSpuUpdateDTO;
|
|
||||||
import cn.iocoder.mall.product.api.message.ProductUpdateMessage;
|
import cn.iocoder.mall.product.api.message.ProductUpdateMessage;
|
||||||
import cn.iocoder.mall.product.convert.ProductSpuConvert;
|
import cn.iocoder.mall.product.convert.ProductSpuConvert;
|
||||||
import cn.iocoder.mall.product.dao.ProductSkuMapper;
|
import cn.iocoder.mall.product.dao.ProductSkuMapper;
|
||||||
@ -31,7 +28,7 @@ import java.util.*;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
|
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
|
||||||
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "1.0.0")
|
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.ProductSpuService.version}")
|
||||||
public class ProductSpuServiceImpl implements ProductSpuService {
|
public class ProductSpuServiceImpl implements ProductSpuService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -237,6 +234,14 @@ public class ProductSpuServiceImpl implements ProductSpuService {
|
|||||||
return productSpuPage;
|
return productSpuPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ProductSpuBO> getProductSpuSearchList(ProductSpuSearchListDTO productSpuSearchListDTO) {
|
||||||
|
return ProductSpuConvert.INSTANCE.convert(
|
||||||
|
productSpuMapper.selectListByNameLikeOrderBySortAsc(productSpuSearchListDTO.getName(), null, null,
|
||||||
|
null, null, null)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ProductSpuBO> getProductSpuList(Collection<Integer> ids) {
|
public List<ProductSpuBO> getProductSpuList(Collection<Integer> ids) {
|
||||||
List<ProductSpuDO> spus = productSpuMapper.selectByIds(ids);
|
List<ProductSpuDO> spus = productSpuMapper.selectByIds(ids);
|
||||||
|
@ -23,7 +23,13 @@ dubbo:
|
|||||||
name: dubbo
|
name: dubbo
|
||||||
scan:
|
scan:
|
||||||
base-packages: cn.iocoder.mall.product.service
|
base-packages: cn.iocoder.mall.product.service
|
||||||
|
provider:
|
||||||
|
ProductAttrService:
|
||||||
|
version: 1.0.0
|
||||||
|
ProductCategoryService:
|
||||||
|
version: 1.0.0
|
||||||
|
ProductSpuService:
|
||||||
|
version: 1.0.0
|
||||||
|
|
||||||
# rocketmq
|
# rocketmq
|
||||||
rocketmq:
|
rocketmq:
|
||||||
|
@ -113,7 +113,9 @@
|
|||||||
AND deleted = 0
|
AND deleted = 0
|
||||||
</where>
|
</where>
|
||||||
ORDER BY sort ASC
|
ORDER BY sort ASC
|
||||||
|
<if test="offset != null and limit != null">
|
||||||
LIMIT #{offset}, #{limit}
|
LIMIT #{offset}, #{limit}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectCountByNameLike" resultType="Integer">
|
<select id="selectCountByNameLike" resultType="Integer">
|
||||||
|
@ -12,6 +12,12 @@
|
|||||||
<artifactId>promotion-application</artifactId>
|
<artifactId>promotion-application</artifactId>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.mall</groupId>
|
||||||
|
<artifactId>common-framework</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.iocoder.mall</groupId>
|
<groupId>cn.iocoder.mall</groupId>
|
||||||
<artifactId>promotion-service-api</artifactId>
|
<artifactId>promotion-service-api</artifactId>
|
||||||
@ -22,13 +28,6 @@
|
|||||||
<artifactId>promotion-service-impl</artifactId>
|
<artifactId>promotion-service-impl</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.mall</groupId>
|
|
||||||
<artifactId>common-framework</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.iocoder.mall</groupId>
|
<groupId>cn.iocoder.mall</groupId>
|
||||||
<artifactId>user-service-api</artifactId>
|
<artifactId>user-service-api</artifactId>
|
||||||
|
@ -39,11 +39,11 @@ public class MVCConfiguration implements WebMvcConfigurer {
|
|||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
// 用户
|
// 用户
|
||||||
// registry.addInterceptor(userAccessLogInterceptor).addPathPatterns("/users/**");
|
registry.addInterceptor(userAccessLogInterceptor).addPathPatterns("/users/**");
|
||||||
// registry.addInterceptor(userSecurityInterceptor).addPathPatterns("/users/**"); // 只拦截我们定义的接口
|
registry.addInterceptor(userSecurityInterceptor).addPathPatterns("/users/**"); // 只拦截我们定义的接口
|
||||||
// 管理员
|
// 管理员
|
||||||
// registry.addInterceptor(adminAccessLogInterceptor).addPathPatterns("/admins/**");
|
// registry.addInterceptor(adminAccessLogInterceptor).addPathPatterns("/admins/**");
|
||||||
// registry.addInterceptor(adminSecurityInterceptor).addPathPatterns("/admins/**");
|
registry.addInterceptor(adminSecurityInterceptor).addPathPatterns("/admins/**");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -10,12 +10,11 @@ import cn.iocoder.mall.promotion.api.dto.BannerUpdateDTO;
|
|||||||
import cn.iocoder.mall.promotion.application.convert.BannerConvert;
|
import cn.iocoder.mall.promotion.application.convert.BannerConvert;
|
||||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsBannerPageVO;
|
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.admins.AdminsBannerVO;
|
||||||
import org.apache.dubbo.config.annotation.Reference;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.apache.dubbo.config.annotation.Reference;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||||
@ -25,8 +24,7 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
|
|||||||
@Api("Banner 模块")
|
@Api("Banner 模块")
|
||||||
public class AdminsBannerController {
|
public class AdminsBannerController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.BannerService.version}")
|
||||||
@Autowired
|
|
||||||
private BannerService bannerService;
|
private BannerService bannerService;
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
|
@ -12,12 +12,11 @@ import cn.iocoder.mall.promotion.api.dto.CouponTemplatePageDTO;
|
|||||||
import cn.iocoder.mall.promotion.application.convert.CouponTemplateConvert;
|
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.AdminsCouponTemplatePageVO;
|
||||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplateVO;
|
import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplateVO;
|
||||||
import org.apache.dubbo.config.annotation.Reference;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.apache.dubbo.config.annotation.Reference;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -28,8 +27,7 @@ import java.util.Date;
|
|||||||
@Api("优惠劵(码)模块")
|
@Api("优惠劵(码)模块")
|
||||||
public class AdminsCouponController {
|
public class AdminsCouponController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.CouponService.version}")
|
||||||
@Autowired
|
|
||||||
private CouponService couponService;
|
private CouponService couponService;
|
||||||
|
|
||||||
// ========== 优惠劵(码)模板 ==========
|
// ========== 优惠劵(码)模板 ==========
|
||||||
|
@ -18,7 +18,6 @@ import io.swagger.annotations.ApiImplicitParam;
|
|||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.dubbo.config.annotation.Reference;
|
import org.apache.dubbo.config.annotation.Reference;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -32,10 +31,9 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
|
|||||||
@Api("商品推荐模块")
|
@Api("商品推荐模块")
|
||||||
public class AdminsProductRecommendController {
|
public class AdminsProductRecommendController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.ProductRecommendService.version}")
|
||||||
@Autowired
|
|
||||||
private ProductRecommendService productRecommendService;
|
private ProductRecommendService productRecommendService;
|
||||||
@Reference(validation = "true", version = "*", lazy = true)
|
@Reference(validation = "true", version = "${dubbo.consumer.ProductSpuService.version}")
|
||||||
private ProductSpuService productSpuService;
|
private ProductSpuService productSpuService;
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
|
@ -7,10 +7,9 @@ import cn.iocoder.mall.promotion.api.bo.BannerBO;
|
|||||||
import cn.iocoder.mall.promotion.application.convert.BannerConvert;
|
import cn.iocoder.mall.promotion.application.convert.BannerConvert;
|
||||||
import cn.iocoder.mall.promotion.application.vo.users.UsersBannerVO;
|
import cn.iocoder.mall.promotion.application.vo.users.UsersBannerVO;
|
||||||
import cn.iocoder.mall.user.sdk.annotation.PermitAll;
|
import cn.iocoder.mall.user.sdk.annotation.PermitAll;
|
||||||
import org.apache.dubbo.config.annotation.Reference;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.apache.dubbo.config.annotation.Reference;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@ -23,8 +22,7 @@ import java.util.List;
|
|||||||
@Api("Banner 模块")
|
@Api("Banner 模块")
|
||||||
public class UsersBannerController {
|
public class UsersBannerController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.BannerService.version}")
|
||||||
@Autowired
|
|
||||||
private BannerService bannerService;
|
private BannerService bannerService;
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
|
@ -13,12 +13,11 @@ import cn.iocoder.mall.promotion.application.vo.users.UsersCouponCardVO;
|
|||||||
import cn.iocoder.mall.promotion.application.vo.users.UsersCouponTemplateVO;
|
import cn.iocoder.mall.promotion.application.vo.users.UsersCouponTemplateVO;
|
||||||
import cn.iocoder.mall.user.sdk.annotation.PermitAll;
|
import cn.iocoder.mall.user.sdk.annotation.PermitAll;
|
||||||
import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder;
|
import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder;
|
||||||
import org.apache.dubbo.config.annotation.Reference;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.apache.dubbo.config.annotation.Reference;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@ -26,8 +25,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
@Api("优惠劵(码)模块")
|
@Api("优惠劵(码)模块")
|
||||||
public class UsersCouponController {
|
public class UsersCouponController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.CouponService.version}")
|
||||||
@Autowired
|
|
||||||
private CouponService couponService;
|
private CouponService couponService;
|
||||||
|
|
||||||
// ========== 优惠劵(码)模板 ==========
|
// ========== 优惠劵(码)模板 ==========
|
||||||
|
@ -9,12 +9,11 @@ import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO;
|
|||||||
import cn.iocoder.mall.promotion.application.convert.ProductRecommendConvert;
|
import cn.iocoder.mall.promotion.application.convert.ProductRecommendConvert;
|
||||||
import cn.iocoder.mall.promotion.application.vo.users.UsersProductRecommendVO;
|
import cn.iocoder.mall.promotion.application.vo.users.UsersProductRecommendVO;
|
||||||
import cn.iocoder.mall.user.sdk.annotation.PermitAll;
|
import cn.iocoder.mall.user.sdk.annotation.PermitAll;
|
||||||
import org.apache.dubbo.config.annotation.Reference;
|
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.apache.dubbo.config.annotation.Reference;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@ -30,11 +29,9 @@ import java.util.stream.Collectors;
|
|||||||
@Api("商品推荐模块")
|
@Api("商品推荐模块")
|
||||||
public class UsersProductRecommendController {
|
public class UsersProductRecommendController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.ProductRecommendService.version}")
|
||||||
@Autowired
|
|
||||||
private ProductRecommendService productRecommendService;
|
private ProductRecommendService productRecommendService;
|
||||||
|
@Reference(validation = "true", version = "${dubbo.consumer.ProductSpuService.version}")
|
||||||
@Reference(validation = "true", version = "1.0.0")
|
|
||||||
private ProductSpuService productSpuService;
|
private ProductSpuService productSpuService;
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.mall.promotion.api;
|
package cn.iocoder.mall.promotion.api;
|
||||||
|
|
||||||
import cn.iocoder.common.framework.constant.CommonStatusEnum;
|
import cn.iocoder.common.framework.constant.CommonStatusEnum;
|
||||||
|
import cn.iocoder.common.framework.exception.ServiceException;
|
||||||
import cn.iocoder.common.framework.validator.InEnum;
|
import cn.iocoder.common.framework.validator.InEnum;
|
||||||
import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO;
|
import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO;
|
||||||
import cn.iocoder.mall.promotion.api.bo.ProductRecommendPageBO;
|
import cn.iocoder.mall.promotion.api.bo.ProductRecommendPageBO;
|
||||||
@ -16,12 +17,12 @@ public interface ProductRecommendService {
|
|||||||
|
|
||||||
ProductRecommendPageBO getProductRecommendPage(ProductRecommendPageDTO productRecommendPageDTO);
|
ProductRecommendPageBO getProductRecommendPage(ProductRecommendPageDTO productRecommendPageDTO);
|
||||||
|
|
||||||
ProductRecommendBO addProductRecommend(Integer adminId, ProductRecommendAddDTO productRecommendAddDTO);
|
ProductRecommendBO addProductRecommend(Integer adminId, ProductRecommendAddDTO productRecommendAddDTO) throws ServiceException;
|
||||||
|
|
||||||
Boolean updateProductRecommend(Integer adminId, ProductRecommendUpdateDTO productRecommendUpdateDTO);
|
Boolean updateProductRecommend(Integer adminId, ProductRecommendUpdateDTO productRecommendUpdateDTO) throws ServiceException;
|
||||||
|
|
||||||
Boolean updateProductRecommendStatus(Integer adminId, Integer productRecommendId,
|
Boolean updateProductRecommendStatus(Integer adminId, Integer productRecommendId,
|
||||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") Integer status);
|
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") Integer status) throws ServiceException;
|
||||||
|
|
||||||
Boolean deleteProductRecommend(Integer adminId, Integer productRecommendId);
|
Boolean deleteProductRecommend(Integer adminId, Integer productRecommendId);
|
||||||
|
|
||||||
|
@ -7,13 +7,14 @@ import org.hibernate.validator.constraints.URL;
|
|||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Banner 添加 DTO
|
* Banner 添加 DTO
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class BannerAddDTO {
|
public class BannerAddDTO implements Serializable {
|
||||||
|
|
||||||
@NotEmpty(message = "标题不能为空")
|
@NotEmpty(message = "标题不能为空")
|
||||||
@Length(min = 2, max = 32, message = "标题长度为 2-32 位")
|
@Length(min = 2, max = 32, message = "标题长度为 2-32 位")
|
||||||
|
@ -4,13 +4,14 @@ import lombok.Data;
|
|||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Banner 分页 DTO
|
* Banner 分页 DTO
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class BannerPageDTO {
|
public class BannerPageDTO implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标题,模糊匹配
|
* 标题,模糊匹配
|
||||||
|
@ -7,13 +7,14 @@ import org.hibernate.validator.constraints.URL;
|
|||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Banner 更新 DTO
|
* Banner 更新 DTO
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class BannerUpdateDTO {
|
public class BannerUpdateDTO implements Serializable {
|
||||||
|
|
||||||
@NotNull(message = "编号不能为空")
|
@NotNull(message = "编号不能为空")
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
@ -4,13 +4,14 @@ import lombok.Data;
|
|||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 优惠劵分页 DTO
|
* 优惠劵分页 DTO
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class CouponCardPageDTO {
|
public class CouponCardPageDTO implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户编号
|
* 用户编号
|
||||||
|
@ -12,6 +12,7 @@ import javax.validation.constraints.Max;
|
|||||||
import javax.validation.constraints.Min;
|
import javax.validation.constraints.Min;
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,7 +20,7 @@ import java.util.Date;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class CouponCardTemplateAddDTO {
|
public class CouponCardTemplateAddDTO implements Serializable {
|
||||||
|
|
||||||
// ========== 基本信息 BEGIN ==========
|
// ========== 基本信息 BEGIN ==========
|
||||||
/**
|
/**
|
||||||
|
@ -9,13 +9,14 @@ import org.hibernate.validator.constraints.Length;
|
|||||||
import javax.validation.constraints.Min;
|
import javax.validation.constraints.Min;
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 优惠劵模板更新 DTO
|
* 优惠劵模板更新 DTO
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class CouponCardTemplateUpdateDTO {
|
public class CouponCardTemplateUpdateDTO implements Serializable {
|
||||||
|
|
||||||
@NotNull(message = "编号不能为空")
|
@NotNull(message = "编号不能为空")
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
@ -3,10 +3,12 @@ package cn.iocoder.mall.promotion.api.dto;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 优惠码模板添加 DTO
|
* 优惠码模板添加 DTO
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class CouponCodeTemplateAddDTO {
|
public class CouponCodeTemplateAddDTO implements Serializable {
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,12 @@ package cn.iocoder.mall.promotion.api.dto;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 优惠码模板更新 DTO
|
* 优惠码模板更新 DTO
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class CouponCodeTemplateUpdateDTO {
|
public class CouponCodeTemplateUpdateDTO implements Serializable {
|
||||||
}
|
}
|
||||||
|
@ -4,13 +4,14 @@ import lombok.Data;
|
|||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 优惠劵模板分页 DTO
|
* 优惠劵模板分页 DTO
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class CouponTemplatePageDTO {
|
public class CouponTemplatePageDTO implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类型
|
* 类型
|
||||||
|
@ -7,13 +7,14 @@ import lombok.experimental.Accessors;
|
|||||||
import org.hibernate.validator.constraints.Length;
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品推荐添加 DTO
|
* 商品推荐添加 DTO
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class ProductRecommendAddDTO {
|
public class ProductRecommendAddDTO implements Serializable {
|
||||||
|
|
||||||
@InEnum(value = ProductRecommendTypeEnum.class, message = "修改推荐类型必须是 {value}")
|
@InEnum(value = ProductRecommendTypeEnum.class, message = "修改推荐类型必须是 {value}")
|
||||||
@NotNull(message = "推荐类型不能为空")
|
@NotNull(message = "推荐类型不能为空")
|
||||||
|
@ -4,13 +4,14 @@ import lombok.Data;
|
|||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品推荐分页 DTO
|
* 商品推荐分页 DTO
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class ProductRecommendPageDTO {
|
public class ProductRecommendPageDTO implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推荐类型
|
* 推荐类型
|
||||||
|
@ -7,13 +7,14 @@ import lombok.experimental.Accessors;
|
|||||||
import org.hibernate.validator.constraints.Length;
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品推荐更新 DTO
|
* 商品推荐更新 DTO
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class ProductRecommendUpdateDTO {
|
public class ProductRecommendUpdateDTO implements Serializable {
|
||||||
|
|
||||||
@NotNull(message = "编号不能为空")
|
@NotNull(message = "编号不能为空")
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
@ -38,9 +38,7 @@ public class CouponTemplateDO extends BaseDO {
|
|||||||
/**
|
/**
|
||||||
* 优惠码状态
|
* 优惠码状态
|
||||||
*
|
*
|
||||||
* 1-开启中
|
* {@link cn.iocoder.mall.promotion.api.constant.CouponTemplateStatusEnum}
|
||||||
* 2-禁用中
|
|
||||||
* 3-已过期
|
|
||||||
*
|
*
|
||||||
* 当优惠劵(码)开启中,可以手动操作,设置禁用中。
|
* 当优惠劵(码)开启中,可以手动操作,设置禁用中。
|
||||||
*/
|
*/
|
||||||
|
@ -20,7 +20,7 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
|
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
|
||||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.BannerService.version}")
|
||||||
public class BannerServiceImpl implements BannerService {
|
public class BannerServiceImpl implements BannerService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -24,7 +24,7 @@ import java.util.*;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
|
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
|
||||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.CouponService.version}")
|
||||||
public class CouponServiceImpl implements CouponService {
|
public class CouponServiceImpl implements CouponService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -22,10 +22,10 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
|
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
|
||||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.ProductRecommendService.version}")
|
||||||
public class ProductRecommendServiceImpl implements ProductRecommendService {
|
public class ProductRecommendServiceImpl implements ProductRecommendService {
|
||||||
|
|
||||||
@Reference(validation = "true", version = "1.0.0")
|
@Reference(validation = "true", version = "${dubbo.consumer.ProductSpuService.version}")
|
||||||
private ProductSpuService productSpuService;
|
private ProductSpuService productSpuService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -18,7 +18,7 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
|
@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示
|
||||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.PromotionActivityService.version}")
|
||||||
public class PromotionActivityServiceImpl implements PromotionActivityService {
|
public class PromotionActivityServiceImpl implements PromotionActivityService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -23,6 +23,19 @@ dubbo:
|
|||||||
name: dubbo
|
name: dubbo
|
||||||
scan:
|
scan:
|
||||||
base-packages: cn.iocoder.mall.promotion.biz.service
|
base-packages: cn.iocoder.mall.promotion.biz.service
|
||||||
|
consumer:
|
||||||
|
ProductSpuService:
|
||||||
|
version: 1.0.0
|
||||||
|
provider:
|
||||||
|
BannerService:
|
||||||
|
version: 1.0.0
|
||||||
|
CouponService:
|
||||||
|
version: 1.0.0
|
||||||
|
ProductRecommendService:
|
||||||
|
version: 1.0.0
|
||||||
|
PromotionActivityService:
|
||||||
|
version: 1.0.0
|
||||||
|
|
||||||
|
|
||||||
# logging
|
# logging
|
||||||
logging:
|
logging:
|
||||||
|
@ -12,6 +12,12 @@
|
|||||||
<artifactId>system-application</artifactId>
|
<artifactId>system-application</artifactId>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.mall</groupId>
|
||||||
|
<artifactId>common-framework</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.iocoder.mall</groupId>
|
<groupId>cn.iocoder.mall</groupId>
|
||||||
<artifactId>system-service-impl</artifactId>
|
<artifactId>system-service-impl</artifactId>
|
||||||
@ -22,11 +28,6 @@
|
|||||||
<artifactId>system-sdk</artifactId>
|
<artifactId>system-sdk</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.mall</groupId>
|
|
||||||
<artifactId>common-framework</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
@ -48,11 +49,11 @@
|
|||||||
<artifactId>springfox-swagger-ui</artifactId>
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>org.springframework.boot</groupId>
|
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||||
<artifactId>spring-boot-devtools</artifactId>
|
<!-- <artifactId>spring-boot-devtools</artifactId>-->
|
||||||
<optional>true</optional>
|
<!-- <optional>true</optional>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!--<dependency>-->
|
<!--<dependency>-->
|
||||||
<!--<groupId>de.codecentric</groupId>-->
|
<!--<groupId>de.codecentric</groupId>-->
|
||||||
|
@ -20,7 +20,9 @@ import java.util.Set;
|
|||||||
@EnableWebMvc
|
@EnableWebMvc
|
||||||
@Configuration
|
@Configuration
|
||||||
@Import(value = {GlobalExceptionHandler.class, // 统一全局返回
|
@Import(value = {GlobalExceptionHandler.class, // 统一全局返回
|
||||||
AdminSecurityInterceptor.class})
|
AdminAccessLogInterceptor.class,
|
||||||
|
AdminSecurityInterceptor.class
|
||||||
|
})
|
||||||
public class MVCConfiguration implements WebMvcConfigurer {
|
public class MVCConfiguration implements WebMvcConfigurer {
|
||||||
|
|
||||||
// @Autowired
|
// @Autowired
|
||||||
@ -36,7 +38,6 @@ public class MVCConfiguration implements WebMvcConfigurer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
// registry.addInterceptor(securityInterceptor).addPathPatterns("/user/**", "/admin/**"); // 只拦截我们定义的接口
|
|
||||||
registry.addInterceptor(adminAccessLogInterceptor).addPathPatterns("/admins/**");
|
registry.addInterceptor(adminAccessLogInterceptor).addPathPatterns("/admins/**");
|
||||||
registry.addInterceptor(adminSecurityInterceptor.setIgnoreUrls(ignoreUrls)).addPathPatterns("/admins/**")
|
registry.addInterceptor(adminSecurityInterceptor.setIgnoreUrls(ignoreUrls)).addPathPatterns("/admins/**")
|
||||||
.excludePathPatterns("/admins/passport/login"); // 排除登陆接口
|
.excludePathPatterns("/admins/passport/login"); // 排除登陆接口
|
||||||
|
@ -23,7 +23,6 @@ import io.swagger.annotations.ApiImplicitParam;
|
|||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.dubbo.config.annotation.Reference;
|
import org.apache.dubbo.config.annotation.Reference;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -34,14 +33,11 @@ import java.util.stream.Collectors;
|
|||||||
@Api("管理员模块")
|
@Api("管理员模块")
|
||||||
public class AdminController {
|
public class AdminController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.ResourceService.version}")
|
||||||
@Autowired // TODO Dubbo 2.7.2 移除 bug
|
|
||||||
private ResourceService resourceService;
|
private ResourceService resourceService;
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.AdminService.version}")
|
||||||
@Autowired // TODO Dubbo 2.7.2 移除 bug
|
|
||||||
private AdminService adminService;
|
private AdminService adminService;
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.RoleService.version}")
|
||||||
@Autowired // TODO Dubbo 2.7.2 移除 bug
|
|
||||||
private RoleService roleService;
|
private RoleService roleService;
|
||||||
|
|
||||||
// =========== 当前管理员相关的资源 API ===========
|
// =========== 当前管理员相关的资源 API ===========
|
||||||
|
@ -9,14 +9,13 @@ import cn.iocoder.mall.admin.application.convert.DataDictConvert;
|
|||||||
import cn.iocoder.mall.admin.application.vo.DataDictEnumVO;
|
import cn.iocoder.mall.admin.application.vo.DataDictEnumVO;
|
||||||
import cn.iocoder.mall.admin.application.vo.DataDictVO;
|
import cn.iocoder.mall.admin.application.vo.DataDictVO;
|
||||||
import cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder;
|
import cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder;
|
||||||
import org.apache.dubbo.config.annotation.Reference;
|
|
||||||
import com.google.common.collect.ImmutableListMultimap;
|
import com.google.common.collect.ImmutableListMultimap;
|
||||||
import com.google.common.collect.Multimaps;
|
import com.google.common.collect.Multimaps;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.apache.dubbo.config.annotation.Reference;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -27,8 +26,7 @@ import java.util.List;
|
|||||||
@Api("数据字典模块")
|
@Api("数据字典模块")
|
||||||
public class DataDictController {
|
public class DataDictController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.DataDictService.version}")
|
||||||
@Autowired // TODO Dubbo 2.7.2 移除 bug
|
|
||||||
private DataDictService dataDictService;
|
private DataDictService dataDictService;
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
|
@ -10,7 +10,6 @@ import io.swagger.annotations.ApiImplicitParam;
|
|||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.dubbo.config.annotation.Reference;
|
import org.apache.dubbo.config.annotation.Reference;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@ -21,8 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@Api("Admin Passport 模块")
|
@Api("Admin Passport 模块")
|
||||||
public class PassportController {
|
public class PassportController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.OAuth2Service.version}")
|
||||||
@Autowired // TODO Dubbo 2.7.2 移除 bug
|
|
||||||
private OAuth2Service oauth2Service;
|
private OAuth2Service oauth2Service;
|
||||||
|
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
|
@ -10,12 +10,11 @@ import cn.iocoder.mall.admin.application.convert.ResourceConvert;
|
|||||||
import cn.iocoder.mall.admin.application.vo.ResourceTreeNodeVO;
|
import cn.iocoder.mall.admin.application.vo.ResourceTreeNodeVO;
|
||||||
import cn.iocoder.mall.admin.application.vo.ResourceVO;
|
import cn.iocoder.mall.admin.application.vo.ResourceVO;
|
||||||
import cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder;
|
import cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder;
|
||||||
import org.apache.dubbo.config.annotation.Reference;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.apache.dubbo.config.annotation.Reference;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -29,8 +28,7 @@ import java.util.stream.Collectors;
|
|||||||
@Api("资源模块")
|
@Api("资源模块")
|
||||||
public class ResourceController {
|
public class ResourceController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.ResourceService.version}")
|
||||||
@Autowired // TODO Dubbo 2.7.2 移除 bug
|
|
||||||
private ResourceService resourceService;
|
private ResourceService resourceService;
|
||||||
|
|
||||||
@SuppressWarnings("Duplicates")
|
@SuppressWarnings("Duplicates")
|
||||||
|
@ -16,11 +16,10 @@ import cn.iocoder.mall.admin.application.vo.RolePageVO;
|
|||||||
import cn.iocoder.mall.admin.application.vo.RoleResourceTreeNodeVO;
|
import cn.iocoder.mall.admin.application.vo.RoleResourceTreeNodeVO;
|
||||||
import cn.iocoder.mall.admin.application.vo.RoleVO;
|
import cn.iocoder.mall.admin.application.vo.RoleVO;
|
||||||
import cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder;
|
import cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder;
|
||||||
import org.apache.dubbo.config.annotation.Reference;
|
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.apache.dubbo.config.annotation.Reference;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -30,11 +29,9 @@ import java.util.stream.Collectors;
|
|||||||
@RequestMapping("admins/role")
|
@RequestMapping("admins/role")
|
||||||
public class RoleController {
|
public class RoleController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.RoleService.version}")
|
||||||
@Autowired // TODO Dubbo 2.7.2 移除 bug
|
|
||||||
private RoleService roleService;
|
private RoleService roleService;
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.ResourceService.version}")
|
||||||
@Autowired // TODO Dubbo 2.7.2 移除 bug
|
|
||||||
private ResourceService resourceService;
|
private ResourceService resourceService;
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
|
@ -42,6 +42,10 @@
|
|||||||
<groupId>org.apache.dubbo</groupId>
|
<groupId>org.apache.dubbo</groupId>
|
||||||
<artifactId>dubbo</artifactId>
|
<artifactId>dubbo</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.dubbo</groupId>
|
||||||
|
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-context</artifactId>
|
<artifactId>spring-context</artifactId>
|
||||||
|
@ -8,7 +8,6 @@ import org.apache.commons.lang3.exception.ExceptionUtils;
|
|||||||
import org.apache.dubbo.config.annotation.Reference;
|
import org.apache.dubbo.config.annotation.Reference;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||||
|
|
||||||
@ -33,8 +32,7 @@ public class AdminAccessLogInterceptor extends HandlerInterceptorAdapter {
|
|||||||
*/
|
*/
|
||||||
private static final ThreadLocal<Integer> ADMIN_ID = new ThreadLocal<>();
|
private static final ThreadLocal<Integer> ADMIN_ID = new ThreadLocal<>();
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.consumer.AdminAccessLogService.version:1.0.0}")
|
||||||
@Autowired(required = false) // TODO 芋艿,初始化时,会存在 spring boot 启动时,服务无法引用的情况,先暂时这么解决。
|
|
||||||
private AdminAccessLogService adminAccessLogService;
|
private AdminAccessLogService adminAccessLogService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -8,15 +8,12 @@ import cn.iocoder.mall.admin.api.bo.OAuth2AuthenticationBO;
|
|||||||
import cn.iocoder.mall.admin.api.constant.AdminErrorCodeEnum;
|
import cn.iocoder.mall.admin.api.constant.AdminErrorCodeEnum;
|
||||||
import cn.iocoder.mall.admin.sdk.context.AdminSecurityContext;
|
import cn.iocoder.mall.admin.sdk.context.AdminSecurityContext;
|
||||||
import cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder;
|
import cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder;
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import org.apache.dubbo.config.annotation.Reference;
|
import org.apache.dubbo.config.annotation.Reference;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,8 +22,7 @@ import java.util.Set;
|
|||||||
@Component
|
@Component
|
||||||
public class AdminSecurityInterceptor extends HandlerInterceptorAdapter {
|
public class AdminSecurityInterceptor extends HandlerInterceptorAdapter {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.consumer.OAuth2Service.version:1.0.0}")
|
||||||
@Autowired(required = false) // TODO 芋艿,初始化时,会存在 spring boot 启动时,服务无法引用的情况,先暂时这么解决。
|
|
||||||
private OAuth2Service oauth2Service;
|
private OAuth2Service oauth2Service;
|
||||||
/**
|
/**
|
||||||
* 忽略的 URL 集合,即无需经过认证
|
* 忽略的 URL 集合,即无需经过认证
|
||||||
@ -44,13 +40,11 @@ public class AdminSecurityInterceptor extends HandlerInterceptorAdapter {
|
|||||||
String accessToken = HttpUtil.obtainAccess(request);
|
String accessToken = HttpUtil.obtainAccess(request);
|
||||||
OAuth2AuthenticationBO authentication = null;
|
OAuth2AuthenticationBO authentication = null;
|
||||||
if (accessToken != null) {
|
if (accessToken != null) {
|
||||||
// CommonResult<OAuth2AuthenticationBO> result = oauth2Service.checkToken(accessToken);
|
CommonResult<OAuth2AuthenticationBO> result = oauth2Service.checkToken(accessToken);
|
||||||
|
|
||||||
// TODO sin 先临时跳过 认证
|
// TODO sin 先临时跳过 认证
|
||||||
CommonResult<OAuth2AuthenticationBO> result = CommonResult.success(new OAuth2AuthenticationBO()
|
// CommonResult<OAuth2AuthenticationBO> result = CommonResult.success(new OAuth2AuthenticationBO()
|
||||||
.setAdminId(1)
|
// .setAdminId(1)
|
||||||
.setRoleIds(Sets.newHashSet(1, 2, 3, 4)));
|
// .setRoleIds(Sets.newHashSet(1, 2, 3, 4)));
|
||||||
|
|
||||||
if (result.isError()) { // TODO 芋艿,如果访问的地址无需登录,这里也不用抛异常
|
if (result.isError()) { // TODO 芋艿,如果访问的地址无需登录,这里也不用抛异常
|
||||||
throw new ServiceException(result.getCode(), result.getMessage());
|
throw new ServiceException(result.getCode(), result.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.AdminAccessLogService.version}")
|
||||||
public class AdminAccessLogServiceImpl implements AdminAccessLogService {
|
public class AdminAccessLogServiceImpl implements AdminAccessLogService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +29,7 @@ import java.util.Set;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.AdminService.version}")
|
||||||
public class AdminServiceImpl implements AdminService {
|
public class AdminServiceImpl implements AdminService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -24,7 +24,7 @@ import java.util.stream.Collectors;
|
|||||||
* 数据字典 Service
|
* 数据字典 Service
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.DataDictService.version}")
|
||||||
public class DataDictServiceImpl implements DataDictService {
|
public class DataDictServiceImpl implements DataDictService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -21,7 +21,7 @@ import java.util.Set;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.OAuth2Service.version:1.0.0}")
|
||||||
public class OAuth2ServiceImpl implements OAuth2Service {
|
public class OAuth2ServiceImpl implements OAuth2Service {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +24,7 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.ResourceService.version}")
|
||||||
public class ResourceServiceImpl implements ResourceService {
|
public class ResourceServiceImpl implements ResourceService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -30,7 +30,7 @@ import java.util.Set;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.RoleService.version}")
|
||||||
public class RoleServiceImpl implements RoleService {
|
public class RoleServiceImpl implements RoleService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -23,3 +23,16 @@ dubbo:
|
|||||||
name: dubbo
|
name: dubbo
|
||||||
scan:
|
scan:
|
||||||
base-packages: cn.iocoder.mall.admin.service
|
base-packages: cn.iocoder.mall.admin.service
|
||||||
|
provider:
|
||||||
|
AdminAccessLogService:
|
||||||
|
version: 1.0.0
|
||||||
|
AdminService:
|
||||||
|
version: 1.0.0
|
||||||
|
DataDictService:
|
||||||
|
version: 1.0.0
|
||||||
|
OAuth2Service:
|
||||||
|
version: 1.0.0
|
||||||
|
ResourceService:
|
||||||
|
version: 1.0.0
|
||||||
|
RoleService:
|
||||||
|
version: 1.0.0
|
||||||
|
Loading…
Reference in New Issue
Block a user