| | |
| | | */ |
| | | BigDecimal getMoneyByOrderNo(@Param("orderNo")String orderNo); |
| | | |
| | | |
| | | /** |
| | | * 统计已到账返利订单 |
| | | * @param uid |
| | | * @param dateTime |
| | | * @return |
| | | */ |
| | | long countValidOrderByDate(@Param("uid")Long uid, @Param("dateTime")String dateTime); |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | List<UserSystemCouponGiveRecord> overdueList(@Param("count") int count); |
| | | |
| | | |
| | | /** |
| | | * 赠送超时未领取的 |
| | | * @param count |
| | | * @return |
| | | */ |
| | | List<UserSystemCouponGiveRecord> overdueListByUser(@Param("uid") Long uid); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 领取的id |
| | | * @param count |
| | | * @return |
| | | */ |
| | | UserSystemCouponGiveRecord getByReceiveId(@Param("receiveId") Long receiveId); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dto.msg;
|
| | |
|
| | | /**
|
| | | * 其他消息里面的券激活
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class MsgOtherCouponActivateDTO {
|
| | |
|
| | | private String title; // 标题
|
| | | private String type; // 类别
|
| | | private String explain; // 说明
|
| | | private String giveUser; // 赠送时间
|
| | | private String receiveTime;// 领取时间
|
| | | private String validityTime;// 有效期
|
| | |
|
| | | public String getTitle() {
|
| | | return title;
|
| | | }
|
| | |
|
| | | public void setTitle(String title) {
|
| | | this.title = title;
|
| | | }
|
| | |
|
| | | public String getType() {
|
| | | return type;
|
| | | }
|
| | |
|
| | | public void setType(String type) {
|
| | | this.type = type;
|
| | | }
|
| | |
|
| | | public String getExplain() {
|
| | | return explain;
|
| | | }
|
| | |
|
| | | public void setExplain(String explain) {
|
| | | this.explain = explain;
|
| | | }
|
| | |
|
| | | public String getGiveUser() {
|
| | | return giveUser;
|
| | | }
|
| | |
|
| | | public void setGiveUser(String giveUser) {
|
| | | this.giveUser = giveUser;
|
| | | }
|
| | |
|
| | | public String getReceiveTime() {
|
| | | return receiveTime;
|
| | | }
|
| | |
|
| | | public void setReceiveTime(String receiveTime) {
|
| | | this.receiveTime = receiveTime;
|
| | | }
|
| | |
|
| | | public String getValidityTime() {
|
| | | return validityTime;
|
| | | }
|
| | |
|
| | | public void setValidityTime(String validityTime) {
|
| | | this.validityTime = validityTime;
|
| | | }
|
| | | }
|
| | |
| | | public class MsgOtherDetail {
|
| | | public enum MsgTypeOtherTypeEnum {
|
| | | couponMianDan("免单券"), couponWelfareMianDan("福利免单券"), freeCouponBuy("自购免单券"),
|
| | | freeCouponGive("赠送免单券"), couponReward("奖励券"), taoLiJin("推广红包"), give("赠送"), exchange("金币兑换");
|
| | | freeCouponGive("赠送免单券"), couponReward("奖励券"), taoLiJin("推广红包"), give("赠送"), exchange("金币兑换")
|
| | | , couponActivate("免单券激活");
|
| | |
|
| | | private final String desc;
|
| | |
|
| | |
| | | // 领取uid
|
| | | @Column(name = "cgr_receive_uid")
|
| | | private Long receiveUid;
|
| | | // 领取成功的券id
|
| | | @Column(name = "cgr_receive_id")
|
| | | private Long receiveId;
|
| | | // 领取时间
|
| | | @Column(name = "cgr_receive_time")
|
| | | private Date receiveTime;
|
| | |
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | public Long getReceiveId() {
|
| | | return receiveId;
|
| | | }
|
| | |
|
| | | public void setReceiveId(Long receiveId) {
|
| | | this.receiveId = receiveId;
|
| | | }
|
| | | }
|
| | |
| | | WHERE co.`co_order_no` = #{orderNo} |
| | | </select> |
| | | |
| | | <select id="countValidOrderByDate" resultType="Long"> |
| | | SELECT IFNULL(COUNT(co.`co_id`),0) FROM yeshi_ec_common_order co |
| | | LEFT JOIN yeshi_ec_hongbao_order ho ON co.`co_id`=ho.`ho_order_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 v2 ON v2.hb_id=ho.`ho_hongbao_id` |
| | | WHERE co.`co_uid` = #{uid} AND v2.`hb_type` = 1 AND v2.`hb_state` = 3 |
| | | AND co.`co_third_create_time` > #{dateTime} |
| | | </select> |
| | | </mapper> |
| | |
| | | <result column="cgr_give_time" property="giveTime" jdbcType="TIMESTAMP"/> |
| | | <result column="cgr_end_time" property="endTime" jdbcType="TIMESTAMP"/> |
| | | <result column="cgr_receive_uid" property="receiveUid" jdbcType="BIGINT"/> |
| | | <result column="cgr_receive_id" property="receiveId" jdbcType="BIGINT"/> |
| | | <result column="cgr_receive_time" property="receiveTime" jdbcType="TIMESTAMP"/> |
| | | <result column="cgr_state" property="state" jdbcType="INTEGER"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">cgr_id,cgr_coupon_id,cgr_give_uid,cgr_give_time,cgr_end_time,cgr_receive_uid,cgr_receive_time,cgr_state</sql> |
| | | <sql id="Base_Column_List">cgr_id,cgr_coupon_id,cgr_give_uid,cgr_give_time,cgr_end_time,cgr_receive_uid,cgr_receive_id,cgr_receive_time,cgr_state</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_user_system_coupon_give_record where cgr_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_system_coupon_give_record where cgr_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_system_coupon_give_record (cgr_id,cgr_coupon_id,cgr_give_uid,cgr_give_time,cgr_end_time,cgr_receive_uid,cgr_receive_time,cgr_state) values (#{id,jdbcType=BIGINT},#{couponId,jdbcType=BIGINT},#{giveUid,jdbcType=BIGINT},#{giveTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{receiveUid,jdbcType=BIGINT},#{receiveTime,jdbcType=TIMESTAMP},#{state,jdbcType=INTEGER})</insert> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_system_coupon_give_record (cgr_id,cgr_coupon_id,cgr_give_uid,cgr_give_time,cgr_end_time,cgr_receive_uid,cgr_receive_id,cgr_receive_time,cgr_state) values (#{id,jdbcType=BIGINT},#{couponId,jdbcType=BIGINT},#{giveUid,jdbcType=BIGINT},#{giveTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{receiveUid,jdbcType=BIGINT},#{receiveId,jdbcType=BIGINT},#{receiveTime,jdbcType=TIMESTAMP},#{state,jdbcType=INTEGER})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_system_coupon_give_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">cgr_id,</if> |
| | |
| | | <if test="giveTime != null">cgr_give_time,</if> |
| | | <if test="endTime != null">cgr_end_time,</if> |
| | | <if test="receiveUid != null">cgr_receive_uid,</if> |
| | | <if test="receiveId != null">cgr_receive_id,</if> |
| | | <if test="receiveTime != null">cgr_receive_time,</if> |
| | | <if test="state != null">cgr_state,</if> |
| | | </trim>values |
| | |
| | | <if test="giveTime != null">#{giveTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="receiveUid != null">#{receiveUid,jdbcType=BIGINT},</if> |
| | | <if test="receiveId != null">#{receiveId,jdbcType=BIGINT},</if> |
| | | <if test="receiveTime != null">#{receiveTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord">update yeshi_ec_user_system_coupon_give_record set cgr_coupon_id = #{couponId,jdbcType=BIGINT},cgr_give_uid = #{giveUid,jdbcType=BIGINT},cgr_give_time = #{giveTime,jdbcType=TIMESTAMP},cgr_end_time = #{endTime,jdbcType=TIMESTAMP},cgr_receive_uid = #{receiveUid,jdbcType=BIGINT},cgr_receive_time = #{receiveTime,jdbcType=TIMESTAMP},cgr_state = #{state,jdbcType=INTEGER} where cgr_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord">update yeshi_ec_user_system_coupon_give_record set cgr_coupon_id = #{couponId,jdbcType=BIGINT},cgr_give_uid = #{giveUid,jdbcType=BIGINT},cgr_give_time = #{giveTime,jdbcType=TIMESTAMP},cgr_end_time = #{endTime,jdbcType=TIMESTAMP},cgr_receive_uid = #{receiveUid,jdbcType=BIGINT},cgr_receive_id = #{receiveId,jdbcType=BIGINT},cgr_receive_time = #{receiveTime,jdbcType=TIMESTAMP},cgr_state = #{state,jdbcType=INTEGER} where cgr_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord">update yeshi_ec_user_system_coupon_give_record |
| | | <set> |
| | | <if test="couponId != null">cgr_coupon_id=#{couponId,jdbcType=BIGINT},</if> |
| | |
| | | <if test="giveTime != null">cgr_give_time=#{giveTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="endTime != null">cgr_end_time=#{endTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="receiveUid != null">cgr_receive_uid=#{receiveUid,jdbcType=BIGINT},</if> |
| | | <if test="receiveId != null">cgr_receive_id=#{receiveId,jdbcType=BIGINT},</if> |
| | | <if test="receiveTime != null">cgr_receive_time=#{receiveTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="state != null">cgr_state=#{state,jdbcType=INTEGER},</if> |
| | | </set> where cgr_id = #{id,jdbcType=BIGINT} |
| | |
| | | WHERE d.`cgr_state` = 0 AND d.`cgr_end_time` IS NOT NULL AND d.`cgr_end_time` <![CDATA[<]]> CURDATE() |
| | | LIMIT #{count} |
| | | </select> |
| | | |
| | | <select id="overdueListByUser" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_user_system_coupon_give_record d |
| | | WHERE d.cgr_give_uid = #{uid} AND d.`cgr_state` = 0 AND d.`cgr_end_time` IS NOT NULL |
| | | AND d.`cgr_end_time` <![CDATA[<]]> CURDATE() |
| | | </select> |
| | | |
| | | <select id="getByReceiveId" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_user_system_coupon_give_record d |
| | | WHERE d.cgr_receive_id = #{receiveId} |
| | | LIMIT 1 |
| | | </select> |
| | | </mapper> |
| | |
| | | return commonOrderCountMapper.getMoneyByOrderNo(orderNo);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countValidOrderByDate(Long uid, String dateTime) {
|
| | | return commonOrderCountMapper.countValidOrderByDate(uid, dateTime);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | userSystemCouponService.exchangeCoupon(uid, type.name(), UserSystemCoupon.SOURCE_EXCHANGE, null);
|
| | | couponNews = 1;
|
| | | } else if (ExchangeTypeEnum.rebatePercentCoupon == type) {
|
| | | thing = "奖励免单券";
|
| | | thing = "返利奖励券";
|
| | | thingNum = "3天";
|
| | | String percent = configService.get("exchange_rebate_percent");
|
| | | userSystemCouponService.exchangeCoupon(uid, type.name(), UserSystemCoupon.SOURCE_EXCHANGE, new BigDecimal(percent));
|
| | |
| | | } else if (detail.getType() == MsgTypeOtherTypeEnum.exchange) {
|
| | | msgOtherDetailMapper.insertSelective(detail);
|
| | | userMsgReadStateService.addOtherMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | } else if (detail.getType() == MsgTypeOtherTypeEnum.couponActivate) {
|
| | | msgOtherDetailMapper.insertSelective(detail);
|
| | | userMsgReadStateService.addOtherMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponActivateDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherExchangeContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void giveCouponActivateMsg(Long uid, String beiZhu, MsgOtherCouponActivateDTO content) {
|
| | | try {
|
| | | MsgOtherDetail detail = new MsgOtherDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setContent(new Gson().toJson(content));
|
| | | detail.setType(MsgTypeOtherTypeEnum.couponActivate);
|
| | | msgOtherDetailService.addMsgOtherDetail(detail);
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void taoLiJinMsg(Long uid, String beiZhu, MsgOtherTaoLiJinContentDTO content) {
|
| | | try {
|
| | |
| | | }
|
| | |
|
| | |
|
| | | |
| | | @Override
|
| | | public void exchangeMsg(Long uid, String beiZhu, MsgOtherExchangeContentDTO content) {
|
| | | try {
|
| | |
| | | || userCoupon.getState() != UserSystemCoupon.STATE_IN_USE)
|
| | | throw new TokenRecordException(1, "该券不存在或非赠送");
|
| | |
|
| | | |
| | | |
| | | UserSystemCoupon userSystemCoupon= null;
|
| | | try {
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.freeCoupon.name(),
|
| | | userSystemCoupon = userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.freeCoupon.name(),
|
| | | UserSystemCoupon.SOURCE_GIVE, null);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | |
|
| | | // 更新赠送记录
|
| | | UserSystemCouponGiveRecord updateGiveRecord = new UserSystemCouponGiveRecord();
|
| | | updateGiveRecord.setId(giveRecord.getId());
|
| | | updateGiveRecord.setReceiveUid(uid);
|
| | | updateGiveRecord.setReceiveTime(new Date());
|
| | | updateGiveRecord.setState(UserSystemCouponGiveRecord.STATE_RECEIVE);
|
| | | if (userSystemCoupon != null) {
|
| | | updateGiveRecord.setReceiveId(userSystemCoupon.getId());
|
| | | }
|
| | | userSystemCouponGiveRecordService.updateByPrimaryKeySelective(updateGiveRecord);
|
| | |
|
| | | integralGetService.addGiveFreeCoupon(giveUid);
|
| | |
| | | if (systemCoupon == null)
|
| | | throw new TokenRecordException(1, "该券不存在");
|
| | |
|
| | | UserSystemCoupon userSystemCoupon= null;
|
| | | try {
|
| | | userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(),
|
| | | userSystemCoupon = userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(),
|
| | | UserSystemCoupon.SOURCE_GIVE, systemCoupon.getPercent());
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | |
|
| | | // 更新赠送记录
|
| | | UserSystemCouponGiveRecord updateGiveRecord = new UserSystemCouponGiveRecord();
|
| | | updateGiveRecord.setId(giveRecord.getId());
|
| | | updateGiveRecord.setReceiveUid(uid);
|
| | | updateGiveRecord.setReceiveTime(new Date());
|
| | | updateGiveRecord.setState(UserSystemCouponGiveRecord.STATE_RECEIVE);
|
| | | if (userSystemCoupon != null) {
|
| | | updateGiveRecord.setReceiveId(userSystemCoupon.getId());
|
| | | }
|
| | | userSystemCouponGiveRecordService.updateByPrimaryKeySelective(updateGiveRecord);
|
| | |
|
| | | integralGetService.addGiveRebateCoupon(giveUid);
|
| | |
| | | public List<UserSystemCouponGiveRecord> overdueList(int count) {
|
| | | return userSystemCouponGiveRecordMapper.overdueList(count);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<UserSystemCouponGiveRecord> overdueListByUser(Long uid) {
|
| | | return userSystemCouponGiveRecordMapper.overdueListByUser(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserSystemCouponGiveRecord getByReceiveId(Long receiveId) {
|
| | | return userSystemCouponGiveRecordMapper.getByReceiveId(receiveId);
|
| | | }
|
| | | }
|
| | |
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponMapper;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponActivateDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.DeviceLotteryRecord;
|
| | |
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void insertUserCoupon(Long uid, String couponType, String source, BigDecimal percent)
|
| | | public UserSystemCoupon insertUserCoupon(Long uid, String couponType, String source, BigDecimal percent)
|
| | | throws UserSystemCouponException, Exception {
|
| | |
|
| | | if (couponType == null || uid == null) {
|
| | |
| | | // 随机奖励券
|
| | | if (percent == null || percent.compareTo(new BigDecimal(0)) < 1) {
|
| | | randomRewardCoupon(1, uid, source);
|
| | | return;
|
| | | return null;
|
| | | } else {
|
| | | coupon = systemCouponService.getCouponByTypeAndPercent(couponType, percent);
|
| | | }
|
| | |
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | return userCoupon;
|
| | | }
|
| | |
|
| | | @Transactional
|
| | |
| | | // 退回券
|
| | | sendBackTimeOutCoupon(uid);
|
| | |
|
| | | // 赠送的退回
|
| | | sendBackGiveUser(uid);
|
| | | |
| | |
|
| | | List<UserSystemCouponVO> listVO = userSystemCouponMapper.getUserCouponVOList(start, count, uid);
|
| | | if (listVO == null || listVO.size() == 0) {
|
| | |
| | | listTip.add("满足条件后,系统将自动激活,并在消息-其它消息中提醒。");
|
| | | userCouponVO.setTips(listTip);
|
| | | userCouponVO.setPopup(true);
|
| | | |
| | | // 验证是否已累计3单
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | freeCouponActivate(userCouponVO.getId(), uid, userCouponVO.getCreateTime());
|
| | | }
|
| | | });
|
| | | |
| | | } else if (CouponTypeEnum.welfareFreeCoupon == type) {
|
| | | jumpBtn = new HashMap<String, Object>();
|
| | | if (inviteCode != null && inviteCode.trim().length() > 0) {
|
| | |
| | |
|
| | | if (UserSystemCoupon.STATE_IN_USE == state && (CouponTypeEnum.freeCouponBuy == type
|
| | | || CouponTypeEnum.freeCoupon == type || CouponTypeEnum.welfareFreeCoupon == type)) {
|
| | | userCouponVO.setInUseExplain(configService.get("free_coupon_using-help"));
|
| | | List<String> listTip = new ArrayList<String>();
|
| | | listTip.add("系统正在判断是否符合免单需求;");
|
| | | listTip.add("系统正在同步淘宝订单;");
|
| | | listTip.add("未使用成功的免单券会原路退回。");
|
| | | userCouponVO.setTipsUsing(listTip);
|
| | | }
|
| | |
|
| | | // 是否已赠送
|
| | |
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 免单券激活
|
| | | * @param uid
|
| | | */
|
| | | public void freeCouponActivate(Long id,Long uid, Date date) {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | | long count = commonOrderCountService.countValidOrderByDate(uid, sdf.format(date));
|
| | | |
| | | String activateNum = configService.get("free_coupon_activate_num");
|
| | | int num = Integer.parseInt(activateNum);
|
| | | |
| | | if (count >= num) {
|
| | | UserSystemCoupon coupon = userSystemCouponMapper.selectByPrimaryKey(id);
|
| | | if (coupon == null || coupon.getState() != UserSystemCoupon.STATE_CAN_USE
|
| | | || coupon.getStateActivated() != 0)
|
| | | return;
|
| | | |
| | | Date nowDate = new Date();
|
| | | Date endTime2 = coupon.getEndTime();
|
| | | if (endTime2 != null && endTime2.getTime() <= nowDate.getTime())
|
| | | return;
|
| | | |
| | | |
| | | SystemCoupon systemCoupon = coupon.getSystemCoupon();
|
| | | if (systemCoupon == null)
|
| | | return;
|
| | | |
| | | systemCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
|
| | | if (systemCoupon == null || systemCoupon.getType() != CouponTypeEnum.freeCoupon)
|
| | | return;
|
| | | |
| | |
|
| | | try {
|
| | | Integer expiryDay = systemCoupon.getExpiryDay();
|
| | | String endDay = DateUtil.plusDay(expiryDay - 1, nowDate);
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
| | | Date endTime = format.parse(endDay);
|
| | | |
| | | UserSystemCoupon userCoupon = new UserSystemCoupon();
|
| | | userCoupon.setId(coupon.getId());
|
| | | userCoupon.setStateActivated(1);
|
| | | userCoupon.setEndTime(endTime);
|
| | | userCoupon.setStartTime(nowDate);
|
| | | userCoupon.setUpdateTime(new Date());
|
| | | userSystemCouponMapper.updateByPrimaryKeySelective(userCoupon);
|
| | | |
| | | // 赠送记录
|
| | | UserSystemCouponGiveRecord giveRecord = userSystemCouponGiveRecordService.getByReceiveId(id);
|
| | | if (giveRecord == null) |
| | | return;
|
| | | |
| | | Long giveUid = giveRecord.getGiveUid();
|
| | | UserInfo userInfo = userInfoService.selectByPKey(giveUid);
|
| | | if (userInfo == null) |
| | | return;
|
| | | |
| | | String beiZhu = "请到我的-福利中心中查看";
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | MsgOtherCouponActivateDTO msgOther = new MsgOtherCouponActivateDTO();
|
| | | msgOther.setTitle("免单券激活");
|
| | | msgOther.setType("免单券系统已自动激活");
|
| | | msgOther.setExplain("满足"+ systemCoupon.getActivateDay() +"天内产生"+ num +"笔已到账返利订单");
|
| | | msgOther.setGiveUser("昵称:"+ userInfo.getNickName() +" ID:" + giveUid);
|
| | | msgOther.setReceiveTime(sd.format(giveRecord.getReceiveTime()));
|
| | | msgOther.setValidityTime(expiryDay + "天");
|
| | | userOtherMsgNotificationService.giveCouponActivateMsg(uid, beiZhu, msgOther);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Transactional
|
| | | @Override
|
| | | public void updateInvalidSate(Long uid) {
|
| | |
| | | }
|
| | |
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void sendBackGiveUser(Long uid) {
|
| | | List<UserSystemCouponGiveRecord> list =userSystemCouponGiveRecordService.overdueListByUser(uid);
|
| | | if (list == null || list.size() == 0) {
|
| | | return;
|
| | | }
|
| | | sendBackGiveCoupon(list);
|
| | | }
|
| | | |
| | | @Override
|
| | | public void sendBackGiveCoupon(List<UserSystemCouponGiveRecord> overdueList) {
|
| | | for (UserSystemCouponGiveRecord record: overdueList) {
|
| | |
| | |
|
| | | // 退回消息
|
| | | String couponName = systemCoupon.getName();
|
| | | if (CouponTypeEnum.freeCouponGive == systemCoupon.getType())
|
| | | if (CouponTypeEnum.freeCouponGive == systemCoupon.getType()) {
|
| | | couponName = "免单券";
|
| | | } else if (CouponTypeEnum.rebatePercentCoupon == systemCoupon.getType()) {
|
| | | couponName = "奖励券";
|
| | | }
|
| | |
|
| | | String beiZhu = "请到我的-福利中心查看";
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | MsgOtherGiveContentDTO msgOther = new MsgOtherGiveContentDTO();
|
| | | msgOther.setType(MsgOtherGiveContentDTO.TYEP_COUPON);
|
| | | msgOther.setTitle("赠送" + couponName + "退回");
|
| | | msgOther.setTitle(couponName + "退回");
|
| | | msgOther.setGiveType("你赠送的"+ couponName + "未被成功领取");
|
| | | msgOther.setGiveTime(sd.format(record.getGiveTime()));
|
| | | msgOther.setReturnTime(sd.format(new Date()));
|
| | |
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponActivateDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherExchangeContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
|
| | |
| | |
|
| | | public void couponUsedFreeSheet(UserSystemCoupon coupon, String orderId, MsgTypeOtherTypeEnum type);
|
| | |
|
| | | |
| | | /**
|
| | | * 赠送的免单券激活
|
| | | * @param uid
|
| | | * @param beiZhu
|
| | | * @param content
|
| | | */
|
| | | public void giveCouponActivateMsg(Long uid, String beiZhu, MsgOtherCouponActivateDTO content);
|
| | |
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | BigDecimal getMoneyByOrderNo(String orderNo);
|
| | | |
| | | |
| | | /**
|
| | | * 统计已到账返利订单
|
| | | * @param uid
|
| | | * @param dateTime
|
| | | * @return
|
| | | */
|
| | | public long countValidOrderByDate(Long uid, String dateTime);
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public UserSystemCouponGiveRecord selectByPrimaryKey(Long id);
|
| | |
|
| | | /**
|
| | | * 赠送需退回
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public List<UserSystemCouponGiveRecord> overdueListByUser(Long uid);
|
| | | |
| | | |
| | | /**
|
| | | * 领取的id
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | UserSystemCouponGiveRecord getByReceiveId(Long receiveId);
|
| | |
|
| | | }
|
| | |
| | | * @throws UserSystemCouponException
|
| | | * @throws Exception
|
| | | */
|
| | | public void insertUserCoupon(Long uid, String couponType, String source, BigDecimal percent) throws UserSystemCouponException, Exception;
|
| | | public UserSystemCoupon insertUserCoupon(Long uid, String couponType, String source, BigDecimal percent) throws UserSystemCouponException, Exception;
|
| | |
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | public void updateInvalidSate(Long uid);
|
| | |
|
| | | /*
|
| | | * 赠送券
|
| | | */
|
| | | public void sendBackGiveUser(Long uid);
|
| | |
|
| | | }
|
| | |
| | | import java.util.List;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponActivateDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherExchangeContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
|
| | |
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
|
| | | } else if (msg.getType() == MsgTypeOtherTypeEnum.couponActivate) {
|
| | | if (StringUtil.isNullOrEmpty(msg.getContent()))
|
| | | return null;
|
| | |
|
| | | MsgOtherCouponActivateDTO dto = new Gson().fromJson(msg.getContent(), MsgOtherCouponActivateDTO.class);
|
| | | if (dto == null)
|
| | | return null;
|
| | |
|
| | | icon = "http://img.flqapp.com/resource/msg/icon_msg_other_coupon.png";
|
| | | |
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getType(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("类别", COLOR_TITLE), contentList));
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dto.getExplain())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getExplain() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("说明", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dto.getGiveUser())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getGiveUser() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("赠送人", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dto.getReceiveTime())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getReceiveTime() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("获赠时间", COLOR_TITLE), contentList));
|
| | | }
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(dto.getValidityTime())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getValidityTime() + "", 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));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
|
| | | |
| | | UserMsgVO userMsgVO = new UserMsgVO();
|
| | | userMsgVO.setIcon(icon);
|
| | | userMsgVO.setTitle(dto.getTitle());
|
| | | userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
|
| | | userMsgVO.setContentItems(items);
|
| | | return userMsgVO;
|
| | | }
|
| | |
|
| | | return new UserMsgVO(icon, msg.getType().getDesc(),
|
| | |
| | | @Expose
|
| | | private List<String> tips;
|
| | |
|
| | | // 使用中说明1.6.5
|
| | | @Expose
|
| | | private List<String> tipsUsing;
|
| | | |
| | | // 赠送中-分享口令
|
| | | @Expose
|
| | | private String giveTips;
|
| | |
| | | public void setGiveTips(String giveTips) {
|
| | | this.giveTips = giveTips;
|
| | | }
|
| | |
|
| | | public List<String> getTipsUsing() {
|
| | | return tipsUsing;
|
| | | }
|
| | |
|
| | | public void setTipsUsing(List<String> tipsUsing) {
|
| | | this.tipsUsing = tipsUsing;
|
| | | }
|
| | | }
|