diff --git a/admin-web/config/proxy/proxy.dev.js b/admin-web/config/proxy/proxy.dev.js index bbe1d0624..9e6a576cf 100644 --- a/admin-web/config/proxy/proxy.dev.js +++ b/admin-web/config/proxy/proxy.dev.js @@ -20,7 +20,8 @@ export default { pathRewrite: {}, }, '/promotion-api/': { - target: 'http://180.167.213.26:18085/', + // target: 'http://180.167.213.26:18085/', + target: 'http://127.0.0.1:18085/', changeOrigin: true, pathRewrite: {}, }, diff --git a/admin-web/src/models/promotion/couponCardTemplateList.js b/admin-web/src/models/promotion/couponCardTemplateList.js index 3e8c00191..0add40a0a 100644 --- a/admin-web/src/models/promotion/couponCardTemplateList.js +++ b/admin-web/src/models/promotion/couponCardTemplateList.js @@ -1,15 +1,14 @@ import {message} from 'antd'; import { - deleteProductRecommend, - updateProductRecommend, updateProductRecommendStatus, addCouponCardTemplate, + updateCouponCardTemplate, getCouponCardTemplatePage, } from '../../services/promotion'; import PaginationHelper from '../../../helpers/PaginationHelper'; const SEARCH_PARAMS_DEFAULT = { - // type: 1, + title: '', }; export default { @@ -50,7 +49,7 @@ export default { list: response.data.list, pagination: PaginationHelper.formatPagination(response.data, payload), searchParams: { - // type: payload.type + title: payload.title } }, }); @@ -100,7 +99,7 @@ export default { }); // 请求 - const response = yield call(updateProductRecommend, body); + const response = yield call(updateCouponCardTemplate, body); // 响应 if (response.code === 0) { if (callback) { @@ -138,21 +137,21 @@ export default { } }, - * delete({ payload }, { call, put }) { - // 请求 - const response = yield call(deleteProductRecommend, payload); - // 响应 - if (response.code === 0) { - message.info('删除成功!'); - // 刷新列表 - yield put({ - type: 'query', - payload: { - ...PaginationHelper.defaultPayload - }, - }); - } - }, + // * delete({ payload }, { call, put }) { + // // 请求 + // const response = yield call(deleteProductRecommend, payload); + // // 响应 + // if (response.code === 0) { + // message.info('删除成功!'); + // // 刷新列表 + // yield put({ + // type: 'query', + // payload: { + // ...PaginationHelper.defaultPayload + // }, + // }); + // } + // }, }, diff --git a/admin-web/src/pages/Promotion/CouponCardTemplateList.js b/admin-web/src/pages/Promotion/CouponCardTemplateList.js index be873532e..4aa904fe4 100644 --- a/admin-web/src/pages/Promotion/CouponCardTemplateList.js +++ b/admin-web/src/pages/Promotion/CouponCardTemplateList.js @@ -136,6 +136,7 @@ function List ({ dataSource, loading, pagination, searchParams, dispatch, // 支付金额(元) TODO 芋艿 // 客单价(元) TODO 芋艿 render(val, record) { + // debugger; return `${record.statFetchNum} / ` + (record.total - record.statFetchNum); } }, @@ -302,6 +303,16 @@ const AddOrUpdateForm = Form.create()(props => { body: { id: formVals.id, ...newFileds, + priceAvailable: undefined, + dateType: undefined, + validStartTime: undefined, + validEndTime: undefined, + fixedStartTerm: undefined, + fixedEndTerm: undefined, + preferentialType: undefined, + priceOff: undefined, + percentOff: undefined, + discountPriceLimit: undefined, }, callback: () => { // 清空表单 @@ -381,14 +392,14 @@ const AddOrUpdateForm = Form.create()(props => { {form.getFieldDecorator('priceAvailable', { rules: [{ required: true, message: '请输入使用金额门槛!' },], - initialValue: formVals.priceAvailable, - })()} 元 + initialValue: formVals.priceAvailable / 100.0, + })()} 元 {form.getFieldDecorator('rangeType', { rules: [{ required: true, message: '请选择可用范围!'}, // TODO 芋艿,需要修改 ], - initialValue: formVals.rangeType, + initialValue: formVals.rangeType + '', })( - + )} @@ -429,29 +440,29 @@ const AddOrUpdateForm = Form.create()(props => { {form.getFieldDecorator('validStartTime', { rules: [{ required: true, message: '请输入固定日期!' },], - initialValue: formVals.validStartTime, - })()} + initialValue: formVals.validStartTime ? moment(formVals.validStartTime) : undefined, + })()}  -  {form.getFieldDecorator('validEndTime', { rules: [{ required: true, message: '请输入固定日期!' },], - initialValue: formVals.validEndTime, - })()} + initialValue: formVals.validEndTime ? moment(formVals.validEndTime) : undefined, + })()} : '' } { formVals.dateType == 2 ? - {form.getFieldDecorator('fixedBeginTerm', { + {form.getFieldDecorator('fixedStartTerm', { rules: [{ required: true, message: '请输入固定日期!' }, {min: 1, type: 'number', message: '最小值为 1'}], - initialValue: formVals.fixedBeginTerm, - })()} + initialValue: formVals.fixedStartTerm, + })()}  -  {form.getFieldDecorator('fixedEndTerm', { rules: [{ required: true, message: '请输入固定日期!' }, {min: 1, type: 'number', message: '最小值为 1'}], initialValue: formVals.fixedEndTerm, - })()} 天 + })()} 天 : '' } @@ -459,9 +470,9 @@ const AddOrUpdateForm = Form.create()(props => { {form.getFieldDecorator('preferentialType', { rules: [{ required: true, message: '请选择优惠类型!'}, // TODO 芋艿,需要修改 ], - initialValue: formVals.preferentialType, + initialValue: formVals.preferentialType + '', })( - 代金卷 折扣卷 @@ -473,8 +484,8 @@ const AddOrUpdateForm = Form.create()(props => { {form.getFieldDecorator('priceOff', { rules: [{ required: true, message: '请输入优惠金额!' }, {min: 0.01, type: 'number', message: '最小值为 0.01'}], - initialValue: formVals.priceOff, - })()} + initialValue: formVals.priceOff ? formVals.priceOff / 100.0 : undefined, + })()} : '' } { @@ -486,15 +497,15 @@ const AddOrUpdateForm = Form.create()(props => { {min: 1, max: 99, type: 'number', message: '范围为 [1, 99]'}, ], initialValue: formVals.percentOff, - })()}% + })()}% {form.getFieldDecorator('discountPriceLimit', { rules: [{ required: false, message: '请输入最多优惠!' }, {min: 0.01, type: 'number', message: '最小值为 0.01'}, ], - initialValue: formVals.discountPriceLimit, - })()}元 + initialValue: formVals.discountPriceLimit ? formVals.discountPriceLimit / 100.0 : undefineds, + })()}元 : '' } diff --git a/admin-web/src/services/promotion.js b/admin-web/src/services/promotion.js index ed5bc5e25..0abb67ce1 100644 --- a/admin-web/src/services/promotion.js +++ b/admin-web/src/services/promotion.js @@ -78,3 +78,9 @@ export async function addCouponCardTemplate(params) { method: 'POST', }); } + +export async function updateCouponCardTemplate(params) { + return request(`/promotion-api/admins/coupon/template/update_card?${stringify(params)}`, { + method: 'POST', + }); +} diff --git a/order/order-service-impl/target/classes/mapper/OrderRecipientMapper.xml b/order/order-service-impl/target/classes/mapper/OrderRecipientMapper.xml new file mode 100644 index 000000000..b2d9f675b --- /dev/null +++ b/order/order-service-impl/target/classes/mapper/OrderRecipientMapper.xml @@ -0,0 +1,35 @@ + + + + + + id, order_id, `area_no`, `name`, mobile, address, + create_time, update_time + + + + + INSERT INTO `order_recipient` ( + order_id, `area_no`, `name`, mobile, address, + create_time, update_time + ) VALUES ( + #{orderId}, #{areaNo}, #{name}, #{mobile}, #{address}, + #{createTime}, #{updateTime} + ) + + + + + diff --git a/order/order-service-impl/target/generated-sources/annotations/cn/iocoder/mall/order/biz/convert/OrderRecipientConvertImpl.java b/order/order-service-impl/target/generated-sources/annotations/cn/iocoder/mall/order/biz/convert/OrderRecipientConvertImpl.java new file mode 100644 index 000000000..f09bb1316 --- /dev/null +++ b/order/order-service-impl/target/generated-sources/annotations/cn/iocoder/mall/order/biz/convert/OrderRecipientConvertImpl.java @@ -0,0 +1,65 @@ +package cn.iocoder.mall.order.biz.convert; + +import cn.iocoder.mall.order.api.bo.OrderRecipientBO; +import cn.iocoder.mall.order.api.dto.OrderCreateDTO; +import cn.iocoder.mall.order.biz.dataobject.OrderRecipientDO; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.Generated; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2019-04-05T22:26:02+0800", + comments = "version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)" +) +public class OrderRecipientConvertImpl implements OrderRecipientConvert { + + @Override + public OrderRecipientDO convert(OrderCreateDTO orderCreateDTO) { + if ( orderCreateDTO == null ) { + return null; + } + + OrderRecipientDO orderRecipientDO = new OrderRecipientDO(); + + orderRecipientDO.setAreaNo( orderCreateDTO.getAreaNo() ); + orderRecipientDO.setName( orderCreateDTO.getName() ); + orderRecipientDO.setMobile( orderCreateDTO.getMobile() ); + orderRecipientDO.setAddress( orderCreateDTO.getAddress() ); + + return orderRecipientDO; + } + + @Override + public List convert(List orderRecipientDOList) { + if ( orderRecipientDOList == null ) { + return null; + } + + List list = new ArrayList( orderRecipientDOList.size() ); + for ( OrderRecipientDO orderRecipientDO : orderRecipientDOList ) { + list.add( orderRecipientDOToOrderRecipientBO( orderRecipientDO ) ); + } + + return list; + } + + protected OrderRecipientBO orderRecipientDOToOrderRecipientBO(OrderRecipientDO orderRecipientDO) { + if ( orderRecipientDO == null ) { + return null; + } + + OrderRecipientBO orderRecipientBO = new OrderRecipientBO(); + + orderRecipientBO.setCreateTime( orderRecipientDO.getCreateTime() ); + orderRecipientBO.setUpdateTime( orderRecipientDO.getUpdateTime() ); + orderRecipientBO.setId( orderRecipientDO.getId() ); + orderRecipientBO.setOrderId( orderRecipientDO.getOrderId() ); + orderRecipientBO.setAreaNo( orderRecipientDO.getAreaNo() ); + orderRecipientBO.setName( orderRecipientDO.getName() ); + orderRecipientBO.setMobile( orderRecipientDO.getMobile() ); + orderRecipientBO.setAddress( orderRecipientDO.getAddress() ); + + return orderRecipientBO; + } +} diff --git a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsCouponTemplateController.java b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsCouponTemplateController.java index 97bf9efa7..b4fed0e2c 100644 --- a/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsCouponTemplateController.java +++ b/promotion/promotion-application/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsCouponTemplateController.java @@ -6,6 +6,7 @@ import cn.iocoder.mall.promotion.api.CouponService; import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO; import cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO; import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateAddDTO; +import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateUpdateDTO; import cn.iocoder.mall.promotion.api.dto.CouponTemplatePageDTO; import cn.iocoder.mall.promotion.application.convert.CouponTemplateConvert; import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplatePageVO; @@ -31,7 +32,7 @@ public class AdminsCouponTemplateController { // ========== 优惠劵(码)模板 ========== @GetMapping("/template/page") - @ApiOperation(value = "Banner 分页") + @ApiOperation(value = "优惠劵(码)模板分页") @ApiImplicitParams({ @ApiImplicitParam(name = "title", value = "标题,模糊匹配", example = "活动 A"), @ApiImplicitParam(name = "pageNo", value = "页码,从 1 开始", example = "1"), @@ -75,7 +76,7 @@ public class AdminsCouponTemplateController { @RequestParam(value = "total", required = false) Integer total, @RequestParam(value = "priceAvailable") Integer priceAvailable, @RequestParam(value = "rangeType") Integer rangeType, - @RequestParam(value = "rangeType", required = false) String rangeValues, + @RequestParam(value = "rangeValues", required = false) String rangeValues, @RequestParam(value = "dateType") Integer dateType, @DateTimeFormat(pattern = "yyyy-MM-dd") @RequestParam(value = "validStartTime", required = false) Date validStartTime, @@ -103,6 +104,33 @@ public class AdminsCouponTemplateController { return CouponTemplateConvert.INSTANCE.convert2(result); } + @PostMapping("/template/update_card") + @ApiOperation(value = "更新优惠劵模板") + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1"), + @ApiImplicitParam(name = "title", value = "标题", required = true, example = "优惠劵牛逼"), + @ApiImplicitParam(name = "description", value = "使用说明", example = "我只是描述"), + @ApiImplicitParam(name = "quota", value = "每人限领个数", required = true), + @ApiImplicitParam(name = "total", value = "发行总量"), + @ApiImplicitParam(name = "rangeType", value = "可用范围的类型", required = true, example = "参见 CouponTemplateRangeTypeEnum 枚举"), + @ApiImplicitParam(name = "rangeValues", value = "指定商品 / 分类列表,使用逗号分隔商品编号"), + }) + public CommonResult update(@RequestParam(value = "id") Integer id, + @RequestParam(value = "title") String title, + @RequestParam(value = "description", required = false) String description, + @RequestParam(value = "quota") Integer quota, + @RequestParam(value = "total", required = false) Integer total, + @RequestParam(value = "rangeType") Integer rangeType, + @RequestParam(value = "rangeValues", required = false) String rangeValues) { + // 创建 CouponCardTemplateAddDTO 对象 + CouponCardTemplateUpdateDTO couponCardTemplateUpdateDTO = new CouponCardTemplateUpdateDTO() + .setId(id) + .setTitle(title).setDescription(description) + .setQuota(quota).setTotal(total) + .setRangeType(rangeType).setRangeValues(rangeValues); + return couponService.updateCouponCardTemplate(couponCardTemplateUpdateDTO); + } + // ========== 优惠劵 ========== // ========== 优惠码 ========== diff --git a/promotion/promotion-application/target/generated-sources/annotations/cn/iocoder/mall/promotion/application/convert/CouponTemplateConvertImpl.java b/promotion/promotion-application/target/generated-sources/annotations/cn/iocoder/mall/promotion/application/convert/CouponTemplateConvertImpl.java new file mode 100644 index 000000000..124f4094a --- /dev/null +++ b/promotion/promotion-application/target/generated-sources/annotations/cn/iocoder/mall/promotion/application/convert/CouponTemplateConvertImpl.java @@ -0,0 +1,109 @@ +package cn.iocoder.mall.promotion.application.convert; + +import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO; +import cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO; +import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplatePageVO; +import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplateVO; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.Generated; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2019-04-05T22:26:04+0800", + comments = "version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)" +) +public class CouponTemplateConvertImpl implements CouponTemplateConvert { + + @Override + public AdminsCouponTemplateVO convert(CouponTemplateBO template) { + if ( template == null ) { + return null; + } + + AdminsCouponTemplateVO adminsCouponTemplateVO = new AdminsCouponTemplateVO(); + + adminsCouponTemplateVO.setId( template.getId() ); + adminsCouponTemplateVO.setTitle( template.getTitle() ); + adminsCouponTemplateVO.setDescription( template.getDescription() ); + adminsCouponTemplateVO.setType( template.getType() ); + adminsCouponTemplateVO.setCodeType( template.getCodeType() ); + adminsCouponTemplateVO.setStatus( template.getStatus() ); + adminsCouponTemplateVO.setQuota( template.getQuota() ); + adminsCouponTemplateVO.setPriceAvailable( template.getPriceAvailable() ); + adminsCouponTemplateVO.setRangeType( template.getRangeType() ); + adminsCouponTemplateVO.setRangeValues( template.getRangeValues() ); + adminsCouponTemplateVO.setDateType( template.getDateType() ); + adminsCouponTemplateVO.setValidStartTime( template.getValidStartTime() ); + adminsCouponTemplateVO.setValidEndTime( template.getValidEndTime() ); + adminsCouponTemplateVO.setFixedStartTerm( template.getFixedStartTerm() ); + adminsCouponTemplateVO.setFixedEndTerm( template.getFixedEndTerm() ); + adminsCouponTemplateVO.setPreferentialType( template.getPreferentialType() ); + adminsCouponTemplateVO.setPercentOff( template.getPercentOff() ); + adminsCouponTemplateVO.setPriceOff( template.getPriceOff() ); + adminsCouponTemplateVO.setDiscountPriceLimit( template.getDiscountPriceLimit() ); + adminsCouponTemplateVO.setStatFetchNum( template.getStatFetchNum() ); + adminsCouponTemplateVO.setCreateTime( template.getCreateTime() ); + adminsCouponTemplateVO.setTotal( template.getTotal() ); + + return adminsCouponTemplateVO; + } + + @Override + public CommonResult convert2(CommonResult result) { + if ( result == null ) { + return null; + } + + CommonResult commonResult = new CommonResult(); + + commonResult.setCode( result.getCode() ); + commonResult.setMessage( result.getMessage() ); + commonResult.setData( convert( result.getData() ) ); + + return commonResult; + } + + @Override + public CommonResult convert(CommonResult result) { + if ( result == null ) { + return null; + } + + CommonResult commonResult = new CommonResult(); + + commonResult.setCode( result.getCode() ); + commonResult.setMessage( result.getMessage() ); + commonResult.setData( couponTemplatePageBOToAdminsCouponTemplatePageVO( result.getData() ) ); + + return commonResult; + } + + @Override + public List convertList(List templates) { + if ( templates == null ) { + return null; + } + + List list = new ArrayList( templates.size() ); + for ( CouponTemplateBO couponTemplateBO : templates ) { + list.add( convert( couponTemplateBO ) ); + } + + return list; + } + + protected AdminsCouponTemplatePageVO couponTemplatePageBOToAdminsCouponTemplatePageVO(CouponTemplatePageBO couponTemplatePageBO) { + if ( couponTemplatePageBO == null ) { + return null; + } + + AdminsCouponTemplatePageVO adminsCouponTemplatePageVO = new AdminsCouponTemplatePageVO(); + + adminsCouponTemplatePageVO.setList( convertList( couponTemplatePageBO.getList() ) ); + adminsCouponTemplatePageVO.setTotal( couponTemplatePageBO.getTotal() ); + + return adminsCouponTemplatePageVO; + } +} diff --git a/promotion/promotion-application/target/generated-sources/annotations/cn/iocoder/mall/promotion/application/convert/ProductRecommendConvertImpl.java b/promotion/promotion-application/target/generated-sources/annotations/cn/iocoder/mall/promotion/application/convert/ProductRecommendConvertImpl.java new file mode 100644 index 000000000..7a2c06886 --- /dev/null +++ b/promotion/promotion-application/target/generated-sources/annotations/cn/iocoder/mall/promotion/application/convert/ProductRecommendConvertImpl.java @@ -0,0 +1,115 @@ +package cn.iocoder.mall.promotion.application.convert; + +import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.mall.product.api.bo.ProductSpuBO; +import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO; +import cn.iocoder.mall.promotion.api.bo.ProductRecommendPageBO; +import cn.iocoder.mall.promotion.application.vo.admins.AdminsProductRecommendPageVO; +import cn.iocoder.mall.promotion.application.vo.admins.AdminsProductRecommendVO; +import cn.iocoder.mall.promotion.application.vo.users.UsersProductRecommendVO; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.Generated; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2019-04-05T22:26:04+0800", + comments = "version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)" +) +public class ProductRecommendConvertImpl implements ProductRecommendConvert { + + @Override + public AdminsProductRecommendVO convert(ProductRecommendBO bannerBO) { + if ( bannerBO == null ) { + return null; + } + + AdminsProductRecommendVO adminsProductRecommendVO = new AdminsProductRecommendVO(); + + adminsProductRecommendVO.setId( bannerBO.getId() ); + adminsProductRecommendVO.setType( bannerBO.getType() ); + adminsProductRecommendVO.setProductSpuId( bannerBO.getProductSpuId() ); + adminsProductRecommendVO.setSort( bannerBO.getSort() ); + adminsProductRecommendVO.setStatus( bannerBO.getStatus() ); + adminsProductRecommendVO.setMemo( bannerBO.getMemo() ); + adminsProductRecommendVO.setCreateTime( bannerBO.getCreateTime() ); + + return adminsProductRecommendVO; + } + + @Override + public CommonResult convert2(CommonResult result) { + if ( result == null ) { + return null; + } + + CommonResult commonResult = new CommonResult(); + + commonResult.setCode( result.getCode() ); + commonResult.setMessage( result.getMessage() ); + commonResult.setData( convert( result.getData() ) ); + + return commonResult; + } + + @Override + public CommonResult convert(CommonResult result) { + if ( result == null ) { + return null; + } + + CommonResult commonResult = new CommonResult(); + + commonResult.setCode( result.getCode() ); + commonResult.setMessage( result.getMessage() ); + commonResult.setData( productRecommendPageBOToAdminsProductRecommendPageVO( result.getData() ) ); + + return commonResult; + } + + @Override + public UsersProductRecommendVO convert(ProductSpuBO productSpu) { + if ( productSpu == null ) { + return null; + } + + UsersProductRecommendVO usersProductRecommendVO = new UsersProductRecommendVO(); + + usersProductRecommendVO.setId( productSpu.getId() ); + usersProductRecommendVO.setName( productSpu.getName() ); + usersProductRecommendVO.setSellPoint( productSpu.getSellPoint() ); + List list = productSpu.getPicUrls(); + if ( list != null ) { + usersProductRecommendVO.setPicUrls( new ArrayList( list ) ); + } + usersProductRecommendVO.setPrice( productSpu.getPrice() ); + + return usersProductRecommendVO; + } + + protected List productRecommendBOListToAdminsProductRecommendVOList(List list) { + if ( list == null ) { + return null; + } + + List list1 = new ArrayList( list.size() ); + for ( ProductRecommendBO productRecommendBO : list ) { + list1.add( convert( productRecommendBO ) ); + } + + return list1; + } + + protected AdminsProductRecommendPageVO productRecommendPageBOToAdminsProductRecommendPageVO(ProductRecommendPageBO productRecommendPageBO) { + if ( productRecommendPageBO == null ) { + return null; + } + + AdminsProductRecommendPageVO adminsProductRecommendPageVO = new AdminsProductRecommendPageVO(); + + adminsProductRecommendPageVO.setList( productRecommendBOListToAdminsProductRecommendVOList( productRecommendPageBO.getList() ) ); + adminsProductRecommendPageVO.setTotal( productRecommendPageBO.getTotal() ); + + return adminsProductRecommendPageVO; + } +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/PromotionErrorCodeEnum.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/PromotionErrorCodeEnum.java index 24d19f848..aa40e719e 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/PromotionErrorCodeEnum.java +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/constant/PromotionErrorCodeEnum.java @@ -15,8 +15,14 @@ public enum PromotionErrorCodeEnum { PRODUCT_RECOMMEND_PRODUCT_NOT_EXISTS(1006001001, "商品不存在"), PRODUCT_RECOMMEND_EXISTS(1006001002, "该商品推荐已经存在"), - ; + // ========== COUPON TEMPLATE 模块 ========== + PRODUCT_TEMPLATE_NOT_EXISTS(1006002000, "优惠劵模板(码)不存在"), + PRODUCT_TEMPLATE_NOT_CARD(1006002001, "不是优惠劵模板"), + PRODUCT_TEMPLATE_NOT_CODE(1006002002, "不是优惠码模板"), + PRODUCT_TEMPLATE_TOTAL_CAN_NOT_REDUCE(1006002003, "优惠劵(码)模板的发放数量不能减小"), + + ; private final int code; private final String message; @@ -34,4 +40,4 @@ public enum PromotionErrorCodeEnum { return message; } -} \ No newline at end of file +} diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java index 3c52e6faa..3414ab30b 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateAddDTO.java @@ -277,5 +277,4 @@ public class CouponCardTemplateAddDTO { return this; } - } diff --git a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateUpdateDTO.java b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateUpdateDTO.java index e64efa7a3..948ad671d 100644 --- a/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateUpdateDTO.java +++ b/promotion/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/dto/CouponCardTemplateUpdateDTO.java @@ -1,4 +1,196 @@ package cn.iocoder.mall.promotion.api.dto; +import cn.iocoder.common.framework.validator.InEnum; +import cn.iocoder.mall.promotion.api.constant.CouponTemplateRangeTypeEnum; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + public class CouponCardTemplateUpdateDTO { + + @NotNull(message = "编号不能为空") + private Integer id; + + // ========== 基本信息 BEGIN ========== + /** + * 标题 + */ + @NotEmpty(message = "标题不能为空") + @Length(min = 2, max = 16, message = "标题长度为 {min}-{max} 位") + private String title; + /** + * 使用说明 + */ + @Length(max = 255, message = "使用说明最大长度为 {max} 位") + private String description; + // ========== 基本信息 END ========== + + // ========== 领取规则 BEGIN ========== + /** + * 每人限领个数 + */ + @NotNull(message = "每人限领个数不能为空") + @Min(value = 1, message = "每人限领个数最小为 {value}") + private Integer quota; + /** + * 发放总量 + */ + @NotNull(message = "发放总量不能为空") + @Min(value = 1, message = "每人限领个数最小为 {value}") + private Integer total; + // ========== 领取规则 END ========== + + // ========== 使用规则 BEGIN ========== +// /** +// * 是否设置满多少金额可用,单位:分 +// * +// * 0-不限制 +// * 大于0-多少金额可用 +// */ +// @NotNull(message = "使用金额门槛不能为空") +// @Min(value = 0L, message = "使用金额门槛最低为 {value}") +// private Integer priceAvailable; + /** + * 可用范围的类型 + * + * 10-全部(ALL):所有可用 + * 20-部分(PART):部分商品可用,或指定商品可用 + * 21-部分(PART):部分商品不可用,或指定商品可用 + * 30-部分(PART):部分分类可用,或指定分类可用 + * 31-部分(PART):部分分类不可用,或指定分类可用 + */ + @NotNull(message = "可用范围的类型不能为空") + @InEnum(value = CouponTemplateRangeTypeEnum.class, message = "可用范围的类型必须在 {value}") + private Integer rangeType; + /** + * 指定商品 / 分类列表,使用逗号分隔商品编号 + */ + private String rangeValues; +// /** +// * 生效日期类型 +// * +// * 1-固定日期 +// * 2-领取日期:领到券 {@link #fixedEndTerm} 日开始 N 天内有效 +// */ +// @NotNull(message = "生效日期类型不能为空") +// @InEnum(value = CouponTemplateDateTypeEnum.class, message = "生效日期类型必须在 {value}") +// private Integer dateType; +// /** +// * 固定日期-生效开始时间 +// */ +// private Date validStartTime; +// /** +// * 固定日期-生效结束时间 +// */ +// private Date validEndTime; +// /** +// * 领取日期-开始天数 +// * +// * 例如,0-当天;1-次天 +// */ +// @Min(value = 0L, message = "领取日期开始时间最小为 {value}") +// private Integer fixedBeginTerm; +// /** +// * 领取日期-结束天数 +// */ +// @Min(value = 1L, message = "领取日期结束时间最小为 {value}") +// private Integer fixedEndTerm; + // ========== 使用规则 END ========== + + // ========== 使用效果 BEGIN ========== +// /** +// * 优惠类型 +// * +// * 1-代金卷 +// * 2-折扣卷 +// */ +// @NotNull(message = "优惠类型不能为空") +// @InEnum(value = CouponTemplatePreferentialTypeEnum.class, message = "优惠类型必须在 {value}") +// private Integer preferentialType; +// /** +// * 优惠金额,单位:分 +// */ +// @Min(value = 1, message = "优惠金额最小值为 {value}") +// private Integer priceOff; +// /** +// * 折扣百分比。 +// * +// * 例如,80% 为 80。 +// * 当 100% 为 100 ,则代表免费。 +// */ +// @Max(value = 100, message = "折扣比最大值为 {value}") +// private Integer percentOff; +// /** +// * 折扣上限,仅在 {@link #preferentialType} 等于 2 时生效。 +// * +// * 例如,折扣上限为 20 元,当使用 8 折优惠券,订单金额为 1000 元时,最高只可折扣 20 元,而非 80 元。 +// */ +// @Min(value = 1, message = "折扣上限最小值为 {value}") +// private Integer discountPriceLimit; + // ========== 使用效果 END ========== + + public Integer getId() { + return id; + } + + public CouponCardTemplateUpdateDTO setId(Integer id) { + this.id = id; + return this; + } + + public String getTitle() { + return title; + } + + public CouponCardTemplateUpdateDTO setTitle(String title) { + this.title = title; + return this; + } + + public String getDescription() { + return description; + } + + public CouponCardTemplateUpdateDTO setDescription(String description) { + this.description = description; + return this; + } + + public Integer getQuota() { + return quota; + } + + public CouponCardTemplateUpdateDTO setQuota(Integer quota) { + this.quota = quota; + return this; + } + + public Integer getTotal() { + return total; + } + + public CouponCardTemplateUpdateDTO setTotal(Integer total) { + this.total = total; + return this; + } + + public Integer getRangeType() { + return rangeType; + } + + public CouponCardTemplateUpdateDTO setRangeType(Integer rangeType) { + this.rangeType = rangeType; + return this; + } + + public String getRangeValues() { + return rangeValues; + } + + public CouponCardTemplateUpdateDTO setRangeValues(String rangeValues) { + this.rangeValues = rangeValues; + return this; + } } diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/convert/CouponTemplateConvert.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/convert/CouponTemplateConvert.java index 6fbfd095c..3c24e0112 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/convert/CouponTemplateConvert.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/convert/CouponTemplateConvert.java @@ -2,7 +2,9 @@ package cn.iocoder.mall.promotion.biz.convert; import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO; import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateAddDTO; +import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateUpdateDTO; import cn.iocoder.mall.promotion.api.dto.CouponCodeTemplateAddDTO; +import cn.iocoder.mall.promotion.api.dto.CouponCodeTemplateUpdateDTO; import cn.iocoder.mall.promotion.biz.dataobject.CouponTemplateDO; import org.mapstruct.Mapper; import org.mapstruct.Mappings; @@ -22,11 +24,17 @@ public interface CouponTemplateConvert { List convertToBO(List templateList); @Mappings({}) - CouponTemplateDO convert(CouponCodeTemplateAddDTO template); + CouponTemplateDO convert(CouponCodeTemplateUpdateDTO template); @Mappings({}) CouponTemplateDO convert(CouponCardTemplateAddDTO template); + @Mappings({}) + CouponTemplateDO convert(CouponCardTemplateUpdateDTO template); + + @Mappings({}) + CouponTemplateDO convert(CouponCodeTemplateAddDTO template); + @Mappings({}) CouponTemplateBO convert(CouponTemplateDO template); diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/CouponServiceImpl.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/CouponServiceImpl.java index 02a335229..69da446f0 100644 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/CouponServiceImpl.java +++ b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/CouponServiceImpl.java @@ -1,15 +1,13 @@ package cn.iocoder.mall.promotion.biz.service; import cn.iocoder.common.framework.constant.SysErrorCodeEnum; +import cn.iocoder.common.framework.util.ServiceExceptionUtil; import cn.iocoder.common.framework.vo.CommonResult; import cn.iocoder.mall.promotion.api.CouponService; import cn.iocoder.mall.promotion.api.bo.CouponCardBO; import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO; import cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO; -import cn.iocoder.mall.promotion.api.constant.CouponTemplateDateTypeEnum; -import cn.iocoder.mall.promotion.api.constant.CouponTemplatePreferentialTypeEnum; -import cn.iocoder.mall.promotion.api.constant.CouponTemplateStatusEnum; -import cn.iocoder.mall.promotion.api.constant.CouponTemplateTypeEnum; +import cn.iocoder.mall.promotion.api.constant.*; import cn.iocoder.mall.promotion.api.dto.*; import cn.iocoder.mall.promotion.biz.convert.CouponTemplateConvert; import cn.iocoder.mall.promotion.biz.dao.CouponTemplateMapper; @@ -82,7 +80,24 @@ public class CouponServiceImpl implements CouponService { @Override public CommonResult updateCouponCardTemplate(CouponCardTemplateUpdateDTO couponCardTemplateUpdateDTO) { - return null; + // 校验 CouponCardTemplate 存在 + CouponTemplateDO template = couponTemplateMapper.selectById(couponCardTemplateUpdateDTO.getId()); + if (template == null) { + return ServiceExceptionUtil.error(PromotionErrorCodeEnum.PRODUCT_TEMPLATE_NOT_EXISTS.getCode()); + } + // 校验 CouponCardTemplate 是 CARD + if (!CouponTemplateTypeEnum.CARD.getValue().equals(template.getType())) { + return ServiceExceptionUtil.error(PromotionErrorCodeEnum.PRODUCT_TEMPLATE_NOT_CARD.getCode()); + } + // 校验发放数量不能减少 + if (couponCardTemplateUpdateDTO.getTotal() < template.getTotal()) { + return ServiceExceptionUtil.error(PromotionErrorCodeEnum.PRODUCT_TEMPLATE_TOTAL_CAN_NOT_REDUCE.getCode()); + } + // 更新优惠劵模板到数据库 + CouponTemplateDO updateTemplateDO = CouponTemplateConvert.INSTANCE.convert(couponCardTemplateUpdateDTO); + couponTemplateMapper.update(updateTemplateDO); + // 返回成功 + return CommonResult.success(true); } @Override diff --git a/promotion/promotion-service-impl/target/classes/mapper/CouponTemplateMapper.xml b/promotion/promotion-service-impl/target/classes/mapper/CouponTemplateMapper.xml new file mode 100644 index 000000000..8a4938ded --- /dev/null +++ b/promotion/promotion-service-impl/target/classes/mapper/CouponTemplateMapper.xml @@ -0,0 +1,152 @@ + + + + + + id, title, description, type, code_type, + status, quota, total, price_available, range_type, + range_values, date_type, valid_start_time, valid_end_time, fixed_start_term, fixed_end_term, + preferential_type, percent_off, price_off, discount_price_limit, stat_fetch_num, + create_time + + + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO coupon_template ( + title, description, type, code_type, + status, quota, total, price_available, range_type, + range_values, date_type, valid_start_time, valid_end_time, fixed_start_term, fixed_end_term, + preferential_type, percent_off, price_off, discount_price_limit, stat_fetch_num, + create_time + ) VALUES ( + #{title}, #{description}, #{type}, #{codeType}, + #{status}, #{quota}, #{total}, #{priceAvailable}, #{rangeType}, + #{rangeValues}, #{dateType}, #{validStartTime}, #{validEndTime}, #{fixedStartTerm}, #{fixedEndTerm} + #{preferentialType}, #{percentOff}, #{priceOff}, #{discountPriceLimit}, #{statFetchNum}, + #{createTime} + ) + + + + UPDATE coupon_template + + + title = #{title}, + + + description = #{description}, + + + status = #{status}, + + + quota = #{quota}, + + + total = #{total}, + + + price_available = #{priceAvailable}, + + + range_type = #{rangeType}, + + + range_values = #{rangeValues}, + + + date_type = #{dateType}, + + + valid_start_time = #{validStartTime}, + + + valid_end_time = #{validEndTime}, + + + fixed_start_term = #{fixedStartTerm}, + + + fixed_end_term = #{fixedEndTerm}, + + + preferential_type = #{preferentialType}, + + + percent_off = #{percentOff}, + + + price_off = #{priceOff}, + + + discount_price_limit = #{discountPriceLimit}, + + + WHERE id = #{id} + + + diff --git a/promotion/promotion-service-impl/target/classes/mapper/ProductRecommendMapper.xml b/promotion/promotion-service-impl/target/classes/mapper/ProductRecommendMapper.xml new file mode 100644 index 000000000..7632b2579 --- /dev/null +++ b/promotion/promotion-service-impl/target/classes/mapper/ProductRecommendMapper.xml @@ -0,0 +1,125 @@ + + + + + + id, type, product_spu_id, sort, + status, memo, create_time + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO product_recommend ( + type, product_spu_id, sort, status, memo, + create_time, deleted + ) VALUES ( + #{type}, #{productSpuId}, #{sort}, #{status}, #{memo}, + #{createTime}, #{deleted} + ) + + + + UPDATE product_recommend + + + type = #{type}, + + + product_spu_id = #{productSpuId}, + + + sort = #{sort}, + + + status = #{status}, + + + memo = #{memo}, + + + deleted = #{deleted} + + + WHERE id = #{id} + + + \ No newline at end of file diff --git a/promotion/promotion-service-impl/target/generated-sources/annotations/cn/iocoder/mall/promotion/biz/convert/CouponTemplateConvertImpl.java b/promotion/promotion-service-impl/target/generated-sources/annotations/cn/iocoder/mall/promotion/biz/convert/CouponTemplateConvertImpl.java new file mode 100644 index 000000000..df59c1532 --- /dev/null +++ b/promotion/promotion-service-impl/target/generated-sources/annotations/cn/iocoder/mall/promotion/biz/convert/CouponTemplateConvertImpl.java @@ -0,0 +1,135 @@ +package cn.iocoder.mall.promotion.biz.convert; + +import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO; +import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateAddDTO; +import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateUpdateDTO; +import cn.iocoder.mall.promotion.api.dto.CouponCodeTemplateAddDTO; +import cn.iocoder.mall.promotion.api.dto.CouponCodeTemplateUpdateDTO; +import cn.iocoder.mall.promotion.biz.dataobject.CouponTemplateDO; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.Generated; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2019-04-06T00:20:10+0800", + comments = "version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)" +) +public class CouponTemplateConvertImpl implements CouponTemplateConvert { + + @Override + public List convertToBO(List templateList) { + if ( templateList == null ) { + return null; + } + + List list = new ArrayList( templateList.size() ); + for ( CouponTemplateDO couponTemplateDO : templateList ) { + list.add( convert( couponTemplateDO ) ); + } + + return list; + } + + @Override + public CouponTemplateDO convert(CouponCodeTemplateUpdateDTO template) { + if ( template == null ) { + return null; + } + + CouponTemplateDO couponTemplateDO = new CouponTemplateDO(); + + return couponTemplateDO; + } + + @Override + public CouponTemplateDO convert(CouponCardTemplateAddDTO template) { + if ( template == null ) { + return null; + } + + CouponTemplateDO couponTemplateDO = new CouponTemplateDO(); + + couponTemplateDO.setTitle( template.getTitle() ); + couponTemplateDO.setDescription( template.getDescription() ); + couponTemplateDO.setQuota( template.getQuota() ); + couponTemplateDO.setTotal( template.getTotal() ); + couponTemplateDO.setPriceAvailable( template.getPriceAvailable() ); + couponTemplateDO.setRangeType( template.getRangeType() ); + couponTemplateDO.setRangeValues( template.getRangeValues() ); + couponTemplateDO.setDateType( template.getDateType() ); + couponTemplateDO.setValidStartTime( template.getValidStartTime() ); + couponTemplateDO.setValidEndTime( template.getValidEndTime() ); + couponTemplateDO.setFixedEndTerm( template.getFixedEndTerm() ); + couponTemplateDO.setPreferentialType( template.getPreferentialType() ); + couponTemplateDO.setPercentOff( template.getPercentOff() ); + couponTemplateDO.setPriceOff( template.getPriceOff() ); + couponTemplateDO.setDiscountPriceLimit( template.getDiscountPriceLimit() ); + + return couponTemplateDO; + } + + @Override + public CouponTemplateDO convert(CouponCardTemplateUpdateDTO template) { + if ( template == null ) { + return null; + } + + CouponTemplateDO couponTemplateDO = new CouponTemplateDO(); + + couponTemplateDO.setId( template.getId() ); + couponTemplateDO.setTitle( template.getTitle() ); + couponTemplateDO.setDescription( template.getDescription() ); + couponTemplateDO.setQuota( template.getQuota() ); + couponTemplateDO.setTotal( template.getTotal() ); + couponTemplateDO.setRangeType( template.getRangeType() ); + couponTemplateDO.setRangeValues( template.getRangeValues() ); + + return couponTemplateDO; + } + + @Override + public CouponTemplateDO convert(CouponCodeTemplateAddDTO template) { + if ( template == null ) { + return null; + } + + CouponTemplateDO couponTemplateDO = new CouponTemplateDO(); + + return couponTemplateDO; + } + + @Override + public CouponTemplateBO convert(CouponTemplateDO template) { + if ( template == null ) { + return null; + } + + CouponTemplateBO couponTemplateBO = new CouponTemplateBO(); + + couponTemplateBO.setId( template.getId() ); + couponTemplateBO.setTitle( template.getTitle() ); + couponTemplateBO.setDescription( template.getDescription() ); + couponTemplateBO.setType( template.getType() ); + couponTemplateBO.setCodeType( template.getCodeType() ); + couponTemplateBO.setStatus( template.getStatus() ); + couponTemplateBO.setQuota( template.getQuota() ); + couponTemplateBO.setTotal( template.getTotal() ); + couponTemplateBO.setPriceAvailable( template.getPriceAvailable() ); + couponTemplateBO.setRangeType( template.getRangeType() ); + couponTemplateBO.setRangeValues( template.getRangeValues() ); + couponTemplateBO.setDateType( template.getDateType() ); + couponTemplateBO.setValidStartTime( template.getValidStartTime() ); + couponTemplateBO.setValidEndTime( template.getValidEndTime() ); + couponTemplateBO.setPreferentialType( template.getPreferentialType() ); + couponTemplateBO.setPercentOff( template.getPercentOff() ); + couponTemplateBO.setPriceOff( template.getPriceOff() ); + couponTemplateBO.setDiscountPriceLimit( template.getDiscountPriceLimit() ); + couponTemplateBO.setStatFetchNum( template.getStatFetchNum() ); + couponTemplateBO.setCreateTime( template.getCreateTime() ); + couponTemplateBO.setFixedStartTerm( template.getFixedStartTerm() ); + couponTemplateBO.setFixedEndTerm( template.getFixedEndTerm() ); + + return couponTemplateBO; + } +} diff --git a/promotion/promotion-service-impl/target/generated-sources/annotations/cn/iocoder/mall/promotion/biz/convert/ProductRecommendConvertImpl.java b/promotion/promotion-service-impl/target/generated-sources/annotations/cn/iocoder/mall/promotion/biz/convert/ProductRecommendConvertImpl.java new file mode 100644 index 000000000..3ad4be265 --- /dev/null +++ b/promotion/promotion-service-impl/target/generated-sources/annotations/cn/iocoder/mall/promotion/biz/convert/ProductRecommendConvertImpl.java @@ -0,0 +1,83 @@ +package cn.iocoder.mall.promotion.biz.convert; + +import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO; +import cn.iocoder.mall.promotion.api.dto.ProductRecommendAddDTO; +import cn.iocoder.mall.promotion.api.dto.ProductRecommendUpdateDTO; +import cn.iocoder.mall.promotion.biz.dataobject.ProductRecommendDO; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.Generated; + +@Generated( + value = "org.mapstruct.ap.MappingProcessor", + date = "2019-04-06T00:20:10+0800", + comments = "version: 1.3.0.Final, compiler: javac, environment: Java 11.0.1 (Oracle Corporation)" +) +public class ProductRecommendConvertImpl implements ProductRecommendConvert { + + @Override + public ProductRecommendBO convertToBO(ProductRecommendDO banner) { + if ( banner == null ) { + return null; + } + + ProductRecommendBO productRecommendBO = new ProductRecommendBO(); + + productRecommendBO.setId( banner.getId() ); + productRecommendBO.setType( banner.getType() ); + productRecommendBO.setProductSpuId( banner.getProductSpuId() ); + productRecommendBO.setSort( banner.getSort() ); + productRecommendBO.setStatus( banner.getStatus() ); + productRecommendBO.setMemo( banner.getMemo() ); + productRecommendBO.setCreateTime( banner.getCreateTime() ); + + return productRecommendBO; + } + + @Override + public List convertToBO(List bannerList) { + if ( bannerList == null ) { + return null; + } + + List list = new ArrayList( bannerList.size() ); + for ( ProductRecommendDO productRecommendDO : bannerList ) { + list.add( convertToBO( productRecommendDO ) ); + } + + return list; + } + + @Override + public ProductRecommendDO convert(ProductRecommendAddDTO bannerAddDTO) { + if ( bannerAddDTO == null ) { + return null; + } + + ProductRecommendDO productRecommendDO = new ProductRecommendDO(); + + productRecommendDO.setType( bannerAddDTO.getType() ); + productRecommendDO.setProductSpuId( bannerAddDTO.getProductSpuId() ); + productRecommendDO.setSort( bannerAddDTO.getSort() ); + productRecommendDO.setMemo( bannerAddDTO.getMemo() ); + + return productRecommendDO; + } + + @Override + public ProductRecommendDO convert(ProductRecommendUpdateDTO bannerUpdateDTO) { + if ( bannerUpdateDTO == null ) { + return null; + } + + ProductRecommendDO productRecommendDO = new ProductRecommendDO(); + + productRecommendDO.setId( bannerUpdateDTO.getId() ); + productRecommendDO.setType( bannerUpdateDTO.getType() ); + productRecommendDO.setProductSpuId( bannerUpdateDTO.getProductSpuId() ); + productRecommendDO.setSort( bannerUpdateDTO.getSort() ); + productRecommendDO.setMemo( bannerUpdateDTO.getMemo() ); + + return productRecommendDO; + } +}