admin
2019-09-06 2012b3b5db3c6b06535a68f775bcc81b16151b90
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserMoneyMsgNotificationServiceImpl.java
@@ -1,17 +1,23 @@
package com.yeshi.fanli.service.impl.msg;
import java.math.BigDecimal;
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dto.push.PushContentDTO;
import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail;
import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
import com.yeshi.fanli.entity.bus.user.Extract;
import com.yeshi.fanli.entity.config.push.PushMsgFactory;
import com.yeshi.fanli.exception.msg.MsgMoneyDetailException;
import com.yeshi.fanli.exception.push.PushException;
import com.yeshi.fanli.service.inter.msg.MsgMoneyDetailService;
import com.yeshi.fanli.service.inter.msg.UserMoneyMsgNotificationService;
import com.yeshi.fanli.service.inter.push.PushService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.factory.msg.MsgMoneyDetailFactory;
@Service
@@ -19,6 +25,8 @@
   @Resource
   private MsgMoneyDetailService msgMoneyDetailService;
   @Resource
   private PushService pushService;
   @Override
   public void extractApplay(Extract extract) {
@@ -41,6 +49,15 @@
         e.printStackTrace();
      }
      PushContentDTO dto = PushMsgFactory.createmoneyExtractFail(new Date(extract.getExtractTime()),
            extract.getMoney(), extract.getAccount());
      try {
         pushService.pushZNX(extract.getUserInfo().getId(), dto.getTitle(), dto.getContent(), null, null);
      } catch (NumberFormatException e) {
         e.printStackTrace();
      } catch (PushException e) {
         e.printStackTrace();
      }
   }
   @Override
@@ -52,16 +69,33 @@
      } catch (MsgMoneyDetailException e) {
         e.printStackTrace();
      }
      PushContentDTO dto = PushMsgFactory.createMoneyExtractSuccess(new Date(extract.getExtractTime()),
            extract.getMoney(), extract.getAccount());
      try {
         pushService.pushZNX(extract.getUserInfo().getId(), dto.getTitle(), dto.getContent(), null, null);
      } catch (NumberFormatException e) {
         e.printStackTrace();
      } catch (PushException e) {
         e.printStackTrace();
      }
   }
   @Override
   public void alipayAccountValid(AlipayAccountValidNormalHistory history) {
      MsgMoneyDetail detail = MsgMoneyDetailFactory.createAlipayAccountValidMsg(history, history.getUid(),
            "重庆小影记科技有限公司", new BigDecimal("0.1"), null);
            Constant.systemCommonConfig.getProjectChineseName(), new BigDecimal("0.1"), null);
      try {
         msgMoneyDetailService.addMsgMoneyDetail(detail);
      } catch (MsgMoneyDetailException e) {
         e.printStackTrace();
      }
      PushContentDTO dto = PushMsgFactory.createAlipayAccountValid(history.getAccount(), new BigDecimal("0.1"));
      try {
         pushService.pushZNX(history.getUid(), dto.getTitle(), dto.getContent(), null, null);
      } catch (NumberFormatException e) {
         e.printStackTrace();
      } catch (PushException e) {
         e.printStackTrace();
      }
   }
@@ -77,6 +111,14 @@
         e.printStackTrace();
      }
      PushContentDTO dto = PushMsgFactory.createMoneyFanliRecieved(orderType, orderId, money);
      try {
         pushService.pushZNX(uid, dto.getTitle(), dto.getContent(), null, null);
      } catch (NumberFormatException e) {
         e.printStackTrace();
      } catch (PushException e) {
         e.printStackTrace();
      }
   }
   @Override
@@ -86,6 +128,16 @@
      try {
         msgMoneyDetailService.addMsgMoneyDetail(detail);
      } catch (MsgMoneyDetailException e) {
         e.printStackTrace();
      }
      // TODO 需要传入是否部分维权
      PushContentDTO dto = PushMsgFactory.createMoneyOrderFanLiWeiquan(orderType, orderId, false, money);
      try {
         pushService.pushZNX(uid, dto.getTitle(), dto.getContent(), null, null);
      } catch (NumberFormatException e) {
         e.printStackTrace();
      } catch (PushException e) {
         e.printStackTrace();
      }
   }
@@ -100,6 +152,14 @@
      } catch (MsgMoneyDetailException e) {
         e.printStackTrace();
      }
      PushContentDTO dto = PushMsgFactory.createMoneyShareRecieved(orderType, money);
      try {
         pushService.pushZNX(uid, dto.getTitle(), dto.getContent(), null, null);
      } catch (NumberFormatException e) {
         e.printStackTrace();
      } catch (PushException e) {
         e.printStackTrace();
      }
   }
   @Override
@@ -109,6 +169,15 @@
      try {
         msgMoneyDetailService.addMsgMoneyDetail(detail);
      } catch (MsgMoneyDetailException e) {
         e.printStackTrace();
      }
      PushContentDTO dto = PushMsgFactory.createMoneyOrderShareOrInviteWeiquan(orderType, orderId, false, money);
      try {
         pushService.pushZNX(uid, dto.getTitle(), dto.getContent(), null, null);
      } catch (NumberFormatException e) {
         e.printStackTrace();
      } catch (PushException e) {
         e.printStackTrace();
      }
@@ -125,6 +194,14 @@
         e.printStackTrace();
      }
      PushContentDTO dto = PushMsgFactory.createMoneyInviteRecieved(orderType, money);
      try {
         pushService.pushZNX(uid, dto.getTitle(), dto.getContent(), null, null);
      } catch (NumberFormatException e) {
         e.printStackTrace();
      } catch (PushException e) {
         e.printStackTrace();
      }
   }
   @Override
@@ -136,7 +213,14 @@
      } catch (MsgMoneyDetailException e) {
         e.printStackTrace();
      }
      PushContentDTO dto = PushMsgFactory.createMoneyOrderShareOrInviteWeiquan(orderType, orderId, false, money);
      try {
         pushService.pushZNX(uid, dto.getTitle(), dto.getContent(), null, null);
      } catch (NumberFormatException e) {
         e.printStackTrace();
      } catch (PushException e) {
         e.printStackTrace();
      }
   }
   @Override
@@ -148,6 +232,15 @@
      } catch (MsgMoneyDetailException e) {
         e.printStackTrace();
      }
      PushContentDTO dto = PushMsgFactory.createMoneySystemReward("使用返利奖励券", money);
      try {
         pushService.pushZNX(uid, dto.getTitle(), dto.getContent(), null, null);
      } catch (NumberFormatException e) {
         e.printStackTrace();
      } catch (PushException e) {
         e.printStackTrace();
      }
   }
   @Override
@@ -158,6 +251,15 @@
      } catch (MsgMoneyDetailException e) {
         e.printStackTrace();
      }
      PushContentDTO dto = PushMsgFactory.createMoneySystemCompensate(reason, money);
      try {
         pushService.pushZNX(uid, dto.getTitle(), dto.getContent(), null, null);
      } catch (NumberFormatException e) {
         e.printStackTrace();
      } catch (PushException e) {
         e.printStackTrace();
      }
   }
}