yujian
2019-09-03 d1dccd08a249b830a95eeeb04af25f87d5c056be
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java
@@ -14,9 +14,11 @@
import org.yeshi.utils.DateUtil;
import com.yeshi.fanli.dao.mybatis.tlj.UserTaoLiJinOriginMapper;
import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
import com.yeshi.fanli.entity.bus.tlj.DeviceTaoLiJinRecord;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail.TaoLiJinDetailTypeEnum;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin.TaoLiJinOriginEnum;
@@ -399,8 +401,6 @@
      });
   }
   
   @Override
   public void overdueHongBao(Long uid) {
@@ -435,7 +435,7 @@
      BigDecimal total = new BigDecimal(0);
      for (UserTaoLiJinOrigin userTaoLiJinOrigin : list) {
         SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH.mm");
         SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
         String time = sd.format(userTaoLiJinOrigin.getCreateTime());
         BigDecimal moneySurplus = userTaoLiJinOrigin.getMoneySurplus();
@@ -612,4 +612,47 @@
      return origin;
   }
   
   @Override
   @Transactional
   public void  giveSendBack(Long uid, UserTaoLiJinGiveRecord record) throws UserTaoLiJinOriginException{
      if (uid == null || record == null) {
         throw new UserTaoLiJinOriginException(1, "参数不能为空");
      }
      BigDecimal money = record.getAmount();
      // 添加红包余额
      userMoneyExtraService.addTaoLiJin(uid, money, false);
      // 添加新增记录
      saveOrigin(uid, 1, money, TaoLiJinOriginEnum.giveSendBack);
      // 红包明细
      UserTaoLiJinDetail detail = new UserTaoLiJinDetail();
      detail.setUid(uid);
      detail.setMoney(money);
      detail.setType(TaoLiJinDetailTypeEnum.giveBack);
      detail.setTitle(TaoLiJinDetailTypeEnum.giveBack.getDesc());
      detail.setCreateTime(new Date());
      userTaoLiJinDetailService.insertSelective(detail);
      executor.execute(new Runnable() {
         @Override
         public void run() {
            // 退回消息
            String beiZhu = "请到我的-推广红包查看";
            SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
            MsgOtherGiveContentDTO msgOther = new MsgOtherGiveContentDTO();
            msgOther.setType(MsgOtherGiveContentDTO.TYEP_TLJ);
            msgOther.setTitle("推广红包退回");
            msgOther.setGiveType("你赠送的¥"+ money + "元推广红包未被领取");
            msgOther.setGiveTime(sd.format(record.getGiveTime()));
            msgOther.setReturnTime(sd.format(new Date()));
            userOtherMsgNotificationService.tokenGiveMsg(record.getGiveUid(), beiZhu, msgOther);
         }
      });
   }
}