| | |
| | | |
| | | 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; |
| | | |
| | | /** |
| | | * 用户优惠券关联表 |
| | |
| | | @ApiModelProperty(value = "满额(元)", example = "1") |
| | | private BigDecimal limitPrice; |
| | | |
| | | @ApiModelProperty(value = "优惠金额(元)", example = "1") |
| | | @ExcelColumn(name="优惠金额(元)",width = 10,index = 7) |
| | | @ApiModelProperty(value = "优惠金额(元、折)", example = "1") |
| | | private BigDecimal price; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | |
| | | @ExcelColumn(name="结束时间",width = 10 ,index = 6,dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private Date endDate; |
| | | |
| | | @ApiModelProperty(value = "领取方式 0领取 1兑换", example = "1") |
| | | @ApiModelProperty(value = "领取方式 0=首次注册;1=邀请好友;2=定向发放;", example = "1") |
| | | @ExcelColumn(name="领取方式",width = 10,index = 4,valueMapping = "0=首次注册;1=邀请好友;2=定向发放;") |
| | | private Integer getMethod; |
| | | |
| | |
| | | @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; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |