| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import java.util.Date; |
| | | import java.math.BigDecimal; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 用户优惠券关联表 |
| | |
| | | public class MemberCoupon { |
| | | |
| | | @ApiModelProperty(value = "主键", example = "1") |
| | | @ExcelColumn(name="主键") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "创建人编码", example = "1") |
| | | @ExcelColumn(name="创建人编码") |
| | | private Integer creator; |
| | | |
| | | @ApiModelProperty(value = "创建时间") |
| | | @ExcelColumn(name="创建时间") |
| | | |
| | | @ExcelColumn(name="发放时间" ,dateFormat = "yyyy-MM-dd HH:mm:ss",width = 10,index = 11) |
| | | private Date createDate; |
| | | |
| | | @ApiModelProperty(value = "更新人编码", example = "1") |
| | | @ExcelColumn(name="更新人编码") |
| | | private Integer editor; |
| | | |
| | | @ApiModelProperty(value = "更新时间") |
| | | @ExcelColumn(name="更新时间") |
| | | |
| | | private Date editDate; |
| | | |
| | | @ApiModelProperty(value = "是否删除0否 1是", example = "1") |
| | | @ExcelColumn(name="是否删除0否 1是") |
| | | private Integer isdeleted; |
| | | |
| | | @ApiModelProperty(value = "备注") |
| | | @ExcelColumn(name="备注") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "用户编码(关联member表)", example = "1") |
| | | @ExcelColumn(name="用户编码(关联member表)") |
| | | private Integer memberId; |
| | | |
| | | @ApiModelProperty(value = "商家编码(关联shop表)", example = "1") |
| | | @ExcelColumn(name="商家编码(关联shop表)") |
| | | private Integer shopId; |
| | | |
| | | @ApiModelProperty(value = "类型0商家优惠券 1平台优惠券 ", example = "1") |
| | | @ExcelColumn(name="类型0商家优惠券 1平台优惠券 ") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "满额(元)", example = "1") |
| | | @ExcelColumn(name="满额(元)") |
| | | private BigDecimal limitPrice; |
| | | |
| | | @ApiModelProperty(value = "优惠金额(元)", example = "1") |
| | | @ExcelColumn(name="优惠金额(元)") |
| | | @ApiModelProperty(value = "优惠金额(元、折)", example = "1") |
| | | private BigDecimal price; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | @ExcelColumn(name="开始时间") |
| | | |
| | | @ExcelColumn(name="开始时间",width = 10,index = 5,dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private Date startDate; |
| | | |
| | | @ApiModelProperty(value = "结束时间") |
| | | @ExcelColumn(name="结束时间") |
| | | |
| | | @ExcelColumn(name="结束时间",width = 10 ,index = 6,dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private Date endDate; |
| | | |
| | | @ApiModelProperty(value = "领取方式 0领取 1兑换", example = "1") |
| | | @ExcelColumn(name="领取方式 0领取 1兑换") |
| | | @ApiModelProperty(value = "领取方式 0=首次注册;1=邀请好友;2=定向发放;", example = "1") |
| | | @ExcelColumn(name="领取方式",width = 10,index = 4,valueMapping = "0=首次注册;1=邀请好友;2=定向发放;") |
| | | private Integer getMethod; |
| | | |
| | | @ApiModelProperty(value = "兑换所需咖豆金额", example = "1") |
| | | @ExcelColumn(name="兑换所需咖豆金额") |
| | | private BigDecimal integral; |
| | | |
| | | @ApiModelProperty(value = "状态 0未使用 1已使用", example = "1") |
| | | @ExcelColumn(name="状态 0未使用 1已使用") |
| | | @ExcelColumn(name="状态",width = 10,index = 8,valueMapping = "0=未使用;1=已使用;2=已过期;") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "说明") |
| | | @ExcelColumn(name="说明") |
| | | private String info; |
| | | |
| | | @ApiModelProperty(value = "使用时间") |
| | | @ExcelColumn(name="使用时间") |
| | | @ExcelColumn(name="使用时间",width = 10,index = 9,dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private Date useDate; |
| | | |
| | | @ApiModelProperty(value = "使用积分奖励数量", example = "1") |
| | | @ExcelColumn(name="使用积分奖励数量") |
| | | private BigDecimal backIntegral; |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | @ExcelColumn(name="优惠券名称") |
| | | @ExcelColumn(name="优惠券名称",width = 10,index = 2 ) |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "coupon表id") |
| | | @ExcelColumn(name="coupon表id") |
| | | private Integer couponId; |
| | | |
| | | @ApiModelProperty(value = "优惠券类型:0=满减券;1=折扣券;") |
| | | @ExcelColumn(name="优惠券类型",width = 10,index = 3,valueMapping = "0=满减券;1=折扣券;") |
| | | private Integer couponType; |
| | | |
| | | @ApiModelProperty(value = "适用类型:0=全场;1=品类;2=指定商品") |
| | |
| | | |
| | | @ApiModelProperty(value = "昵称") |
| | | @TableField(exist = false) |
| | | @ExcelColumn(name="用户",width = 10,index = 1) |
| | | private String nikeName; |
| | | @ApiModelProperty(value = "关联订单号号") |
| | | @ExcelColumn(name="关联订单号",width = 10,index = 10) |
| | | @TableField(exist = false) |
| | | private String orderCode; |
| | | @ApiModelProperty(value = "创建人") |
| | | @TableField(exist = false) |
| | | @ExcelColumn(name="操作人",index = 12,width = 10) |
| | | private String creatorName; |
| | | @ApiModelProperty(value = "关联订单号") |
| | | @ApiModelProperty(value = "关联订单") |
| | | private String orderId; |
| | | |
| | | @ApiModelProperty(value = "实际适用时金额") |
| | | @TableField(exist = false) |
| | | private BigDecimal validAmount; |
| | | @ApiModelProperty(value = "用户手机号") |
| | | @TableField(exist = false) |
| | | private String memberPhone; |
| | | |
| | | @ApiModelProperty(value = "优惠金额(元)", example = "1") |
| | | @ExcelColumn(name="优惠金额(元)",width = 10,index = 7) |
| | | @TableField(exist = false) |
| | | private BigDecimal couponPrice ; |
| | | |
| | | |
| | | public static MemberCoupon couponToBean(Coupon coupon, Member member , Date now, Integer getMethod, LoginUserInfo loginUserInfo){ |
| | | MemberCoupon insert = new MemberCoupon(); |
| | | insert.setCreateDate(now); |
| | | insert.setEditDate(now); |
| | | insert.setCreator(Objects.nonNull(loginUserInfo)?loginUserInfo.getId():null); |
| | | insert.setEditor(Objects.nonNull(loginUserInfo)?loginUserInfo.getId():null); |
| | | insert.setIsdeleted(Constants.ZERO); |
| | | insert.setRemark(Constants.equalsInteger(getMethod, Constants.ZERO)?"注册赠送":Constants.equalsInteger(getMethod, Constants.ONE)?"邀请好友":"定向发放"); |
| | | insert.setMemberId(member.getId()); |
| | | insert.setShopId(coupon.getShopId()); |
| | | insert.setType(coupon.getType()); |
| | | insert.setCouponType(coupon.getType()); |
| | | insert.setLimitPrice(coupon.getLimitPrice()); |
| | | insert.setPrice(coupon.getPrice()); |
| | | if(Constants.equalsObject(coupon.getUseType(),Constants.ZERO)){ |
| | | //如果是固定时段 |
| | | insert.setStartDate(coupon.getStartDate()); |
| | | insert.setEndDate(coupon.getEndDate()); |
| | | }else{ |
| | | //固定时长 //推迟天数 |
| | | insert.setEndDate(DateUtil.addDaysToDate(now,Constants.formatIntegerNum(coupon.getValidDays()))); |
| | | insert.setStartDate(now); |
| | | } |
| | | insert.setGetMethod(getMethod);//注册赠送 |
| | | insert.setIntegral(coupon.getIntegral()); |
| | | insert.setStatus(Constants.ZERO);//未使用 |
| | | insert.setInfo(coupon.getInfo()); |
| | | insert.setName(coupon.getName()); |
| | | insert.setApplyIds(coupon.getApplyIds()); |
| | | insert.setApplyType(coupon.getApplyType()); |
| | | insert.setCouponId(coupon.getId()); |
| | | return insert; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |