| | |
| | | package com.yeshi.fanli.dto.msg;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | /**
|
| | | * 其他消息里面的券相关的内容
|
| | | *
|
| | |
| | | public class MsgOtherCouponContentDTO {
|
| | | private String state;
|
| | | private String source;// 来源
|
| | | private String orderId;// 订单号
|
| | | private String desc;// 说明
|
| | | private BigDecimal fanLiMoney;
|
| | |
|
| | | |
| | |
|
| | | private String startTime;
|
| | | private String endTime;
|
| | | private Integer leftDay;
|
| | |
| | | this.leftDay = leftDay;
|
| | | }
|
| | |
|
| | | public String getOrderId() {
|
| | | return orderId;
|
| | | }
|
| | |
|
| | | public void setOrderId(String orderId) {
|
| | | this.orderId = orderId;
|
| | | }
|
| | |
|
| | | public String getDesc() {
|
| | | return desc;
|
| | | }
|
| | |
|
| | | public void setDesc(String desc) {
|
| | | this.desc = desc;
|
| | | }
|
| | | |
| | | public BigDecimal getFanLiMoney() {
|
| | | return fanLiMoney;
|
| | | }
|
| | |
|
| | | public void setFanLiMoney(BigDecimal fanLiMoney) {
|
| | | this.fanLiMoney = fanLiMoney;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.msg;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | |
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.exception.msg.MsgOtherDetailException;
|
| | | import com.yeshi.fanli.service.inter.msg.MsgOtherDetailService;
|
| | |
| | | coupon.getSource(), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, null));
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, "至少成功邀请1个队员后可激活"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void welfareCouponActive(UserSystemCoupon coupon) {
|
| | | public void welfareCouponActive(UserSystemCoupon coupon, UserInfo worker) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createWelfareCouponActive(getLeftDay(coupon),
|
| | | coupon.getStartTime(), coupon.getEndTime());
|
| | | "成功邀请队员:" + worker.getNickName(), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, null));
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, "可在首页-免单商品-选择商品-使用"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void welfareCouponUsing(UserSystemCoupon coupon) {
|
| | | public void welfareCouponUsing(UserSystemCoupon coupon,String orderId,BigDecimal money) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createWelfareCouponUsing(coupon.getStartTime(),
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createWelfareCouponUsing(orderId,money,coupon.getStartTime(),
|
| | | coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, null));
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, "实付款-返利=0元购(免单)"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void welfareCouponUsed(UserSystemCoupon coupon) {
|
| | | public void welfareCouponUsed(UserSystemCoupon coupon,String orderId) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createWelfareCouponUsed(getLeftDay(coupon),
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createWelfareCouponUsed(getLeftDay(coupon),"实付款-返利=0元购(免单)",
|
| | | coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, null));
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, "参与其他活动可获得更多免单券"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | .createWelfareCouponWillOutOfDate(getLeftDay(coupon), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, null));
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, "至少成功邀请1个队员后可激活"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | .createWelfareCouponAlreadyOutOfDate(coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, null));
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, "参与其他活动可获得更多免单券"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void welfareCouponDrawBack(UserSystemCoupon coupon,String orderId) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory
|
| | | .createWelfareCouponAlreadyOutOfDate(coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, "退回后依然可在有效期内使用"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createCouponGet(getLeftDay(coupon),
|
| | | coupon.getSource(), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponMianDan, null));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void freeSheetCouponActive(UserSystemCoupon coupon) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createCouponActive(getLeftDay(coupon),
|
| | | coupon.getSource(), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void rewardCouponActive(UserSystemCoupon coupon) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createRewardCouponActive(getLeftDay(coupon),
|
| | | coupon.getSource(), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponReward, null));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void rewardCouponUsed(UserSystemCoupon coupon) {
|
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void freeSheetCouponDrawBack(UserSystemCoupon coupon) {
|
| | | // TODO Auto-generated method stub
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | // 消息推送
|
| | | try {
|
| | | if (baseCoupon.getType() != CouponTypeEnum.welfareFreeCoupon) {
|
| | | userOtherMsgNotificationService.welfareCouponUsing(userSystemCoupon);
|
| | | // userOtherMsgNotificationService.welfareCouponUsing(userSystemCoupon,order);
|
| | | } else if (baseCoupon.getType() != CouponTypeEnum.freeCoupon) {
|
| | | userOtherMsgNotificationService.freeSheetCouponUsing(userSystemCoupon);
|
| | | }
|
| | |
| | | // 券已使用
|
| | | userOtherMsgNotificationService.freeSheetCouponUsed(userSystemCoupon);
|
| | | } else if (baseCoupon.getType() != CouponTypeEnum.welfareFreeCoupon) {
|
| | | userOtherMsgNotificationService.welfareCouponUsed(userSystemCoupon);
|
| | | userOtherMsgNotificationService.welfareCouponUsing(userSystemCoupon,orderNo,payment);
|
| | | } else if (baseCoupon.getType() != CouponTypeEnum.freeCoupon) {
|
| | | userOtherMsgNotificationService.freeSheetCouponUsed(userSystemCoupon);
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.msg;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | |
|
| | | /**
|
| | |
| | | * @param startTime
|
| | | * @param endTime
|
| | | */
|
| | | public void welfareCouponActive(UserSystemCoupon coupon);
|
| | | public void welfareCouponActive(UserSystemCoupon coupon,UserInfo worker);
|
| | |
|
| | | /**
|
| | | * 福利免单券使用中
|
| | |
| | | * @param startTime
|
| | | * @param endTime
|
| | | */
|
| | | public void welfareCouponUsing(UserSystemCoupon coupon);
|
| | | public void welfareCouponUsing(UserSystemCoupon coupon,String orderId,BigDecimal money);
|
| | |
|
| | | /**
|
| | | * 福利免单券已被使用
|
| | |
| | | * @param startTime
|
| | | * @param endTime
|
| | | */
|
| | | public void welfareCouponUsed(UserSystemCoupon coupon);
|
| | | public void welfareCouponUsed(UserSystemCoupon coupon,String orderId);
|
| | |
|
| | | /**
|
| | | * 福利免单券即将过期
|
| | |
| | | /**
|
| | | * 福利免单券已经过期
|
| | | *
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param coupon
|
| | | */
|
| | | public void welfareCouponAlreadyOutOfDate(UserSystemCoupon coupon);
|
| | | |
| | | |
| | | /**
|
| | | * 福利免单券已经退回
|
| | | * @param coupon
|
| | | */
|
| | | public void welfareCouponDrawBack(UserSystemCoupon coupon,String orderId);
|
| | |
|
| | | // 免单券
|
| | |
|
| | |
| | | * @param endTime
|
| | | */
|
| | | public void freeSheetCouponGet(UserSystemCoupon coupon);
|
| | |
|
| | | /**
|
| | | * 免单券激活
|
| | | * |
| | | * @param leftDay
|
| | | * @param source
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | */
|
| | | public void freeSheetCouponActive(UserSystemCoupon coupon);
|
| | |
|
| | | /**
|
| | | * 免单券正在使用
|
| | |
| | | * @param endTime
|
| | | */
|
| | | public void freeSheetCouponAlreadyOutOfDate(UserSystemCoupon coupon);
|
| | | |
| | | /**
|
| | | * 已退回
|
| | | * @param coupon
|
| | | */
|
| | | public void freeSheetCouponDrawBack(UserSystemCoupon coupon);
|
| | |
|
| | | // 奖励券
|
| | |
|
| | |
| | | * @param endTime
|
| | | */
|
| | | public void rewardCouponGet(UserSystemCoupon coupon);
|
| | |
|
| | | /**
|
| | | * 奖励券激活
|
| | | * |
| | | * @param leftDay
|
| | | * @param source
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | */
|
| | | public void rewardCouponActive(UserSystemCoupon coupon);
|
| | |
|
| | | /**
|
| | | * 奖励券已经使用
|
| | |
| | | package com.yeshi.fanli.util.factory.msg;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponContentDTO;
|
| | |
| | | private static MsgOtherCouponContentDTO getGeneral(Integer leftDay, String source, Date startTime, Date endTime) {
|
| | | MsgOtherCouponContentDTO dto = new MsgOtherCouponContentDTO();
|
| | | if (endTime != null)
|
| | | dto.setEndTime(TimeUtil.getGernalTime(endTime.getTime(), "yyyy.MM.dd HH:mm"));
|
| | | dto.setEndTime(TimeUtil.getGernalTime(endTime.getTime(), "yyyy.MM.dd"));
|
| | | if (startTime != null)
|
| | | dto.setStartTime(TimeUtil.getGernalTime(startTime.getTime(), "yyyy.MM.dd HH:mm"));
|
| | | dto.setStartTime(TimeUtil.getGernalTime(startTime.getTime(), "yyyy.MM.dd"));
|
| | | dto.setLeftDay(leftDay);
|
| | | dto.setSource(source);
|
| | | return dto;
|
| | |
| | | return dto;
|
| | | }
|
| | |
|
| | | public static MsgOtherCouponContentDTO createWelfareCouponActive(Integer leftDay, Date startTime, Date endTime) {
|
| | | MsgOtherCouponContentDTO dto = getGeneral(leftDay, "成功邀请1个队员", startTime, endTime);
|
| | | public static MsgOtherCouponContentDTO createWelfareCouponActive(Integer leftDay, String source, Date startTime, Date endTime) {
|
| | | MsgOtherCouponContentDTO dto = getGeneral(leftDay, source, startTime, endTime);
|
| | | dto.setState("已被激活");
|
| | | return dto;
|
| | | }
|
| | |
|
| | | public static MsgOtherCouponContentDTO createWelfareCouponUsing(Date startTime, Date endTime) {
|
| | | MsgOtherCouponContentDTO dto = getGeneral(null, "成功邀请1个队员", startTime, endTime);
|
| | | dto.setState("使用中,等待系统同步订单");
|
| | | public static MsgOtherCouponContentDTO createWelfareCouponUsing(String orderId,BigDecimal money, Date startTime, Date endTime) {
|
| | | MsgOtherCouponContentDTO dto = getGeneral(null, null, startTime, endTime);
|
| | | dto.setOrderId(orderId);
|
| | | dto.setState("已经使用");
|
| | | dto.setFanLiMoney(money);
|
| | | return dto;
|
| | | }
|
| | |
|
| | | public static MsgOtherCouponContentDTO createWelfareCouponUsed(Integer leftDay, Date startTime, Date endTime) {
|
| | | MsgOtherCouponContentDTO dto = getGeneral(null, "成功邀请1个队员", startTime, endTime);
|
| | | dto.setState("已被使用");
|
| | | public static MsgOtherCouponContentDTO createWelfareCouponUsed(Integer leftDay,String desc, Date startTime, Date endTime) {
|
| | | MsgOtherCouponContentDTO dto = getGeneral(null, null, startTime, endTime);
|
| | | dto.setState("完成免单");
|
| | | dto.setDesc(desc);
|
| | | return dto;
|
| | | }
|
| | |
|
| | |
| | | contentList.add(new ClientTextStyleVO(dto.getState(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态", COLOR_TITLE), contentList));
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dto.getOrderId())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getOrderId() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单号", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | if (dto.getFanLiMoney() != null) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(MoneyBigDecimalUtil.getWithNoZera(dto.getFanLiMoney()) + "",
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("预估返利", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dto.getSource())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getSource() + "", COLOR_CONTENT));
|
| | |
| | | contentList.add(new ClientTextStyleVO("天", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("剩余天数", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dto.getDesc())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getDesc(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("说明", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | | COLOR_CONTENT));
|