admin
2019-08-22 c044b6dd024b6884a4f39bc56e4873c95b13fe02
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/ThreeSaleSerivceImpl.java
@@ -18,10 +18,10 @@
import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo;
import com.yeshi.fanli.entity.bus.user.UserActiveLog;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.exception.ThreeSaleException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
import com.yeshi.fanli.service.inter.hongbao.ThreeSaleExtraInfoSerivce;
import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.msg.MsgInviteDetailService;
import com.yeshi.fanli.service.inter.msg.UserInviteMsgNotificationService;
@@ -66,6 +66,10 @@
   
   @Resource
   private UserInfoExtraService userInfoExtraService;
   @Resource
   private ThreeSaleExtraInfoSerivce threeSaleExtraInfoSerivce;
   
   @Resource(name = "taskExecutor")
   private TaskExecutor executor;
@@ -345,7 +349,7 @@
   public List<ThreeSale> listbyIdAndBossId(Long id, Long uid, Integer expire) {
      return threeSaleMapper.listbyIdAndBossId(id, uid, expire);
   }
   @Override
   public JSONObject getMyFirstTeam(long start, int count, Long uid, Integer state) {
@@ -356,7 +360,7 @@
      long countTotal = threeSaleMapper.countFirstTeam(uid, state);
      return organizeTeam(countTotal, list, uid);
      return organizeTeam(countTotal, list);
   }
   @Override
@@ -368,10 +372,10 @@
      long countTotal = threeSaleMapper.countSecondTeam(uid, state);
      return organizeTeam(countTotal, list, uid);
      return organizeTeam(countTotal, list);
   }
   public JSONObject organizeTeam(long count, List<ThreeSale> list, Long uid) {
   public JSONObject organizeTeam(long count, List<ThreeSale> list) {
      JSONObject result = new JSONObject();
@@ -402,18 +406,15 @@
         object.put("memoName", memoName);
         String nickName = "";
         Long  workerId= null;
         String portrait = "";
         Long lastLoginTime = null;
         UserInfo worker = threeSale.getWorker();
         if (worker != null) {
            workerId = worker.getId();
            portrait = worker.getPortrait();
            lastLoginTime = worker.getLastLoginTime();
            nickName = worker.getNickName();
         }
         object.put("workerId", workerId);
         object.put("nickName", nickName);
         object.put("portrait", portrait);
@@ -438,15 +439,8 @@
               // 往年
               contentJson.put("content", "最近登录 " + format.format(lastLoginTime));
            }
            array.add(contentJson);
            if (workerId != null) {
               UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(workerId);
               if (userInfoExtra != null)
                  object.put("weiXin", userInfoExtra.getWeiXin());
            }
         } else if (threeSale.getExpire() != null
               && (threeSale.getExpire() == 1 || threeSale.getExpire().equals(1))) {
@@ -490,18 +484,13 @@
         resultArray.add(object);
      }
      boolean bdWeiXin = false;
      UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
      if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin()))
         bdWeiXin = true;
      result.put("bdWeiXin", bdWeiXin);
      result.put("count", count);
      result.put("result_list", resultArray);
      return result;
   }
   @Override
   public List<ThreeSale> listByWorkerId(Long workerId) {
      return threeSaleMapper.listByWorkerId(workerId);
@@ -514,7 +503,7 @@
   @Override
   @Transactional
   public void bindRelationshipByInviteCode(UserInfo invitee, UserInfo inviter, String platform, String version) throws ThreeSaleException {
   public void bindRelationshipByInviteCode(UserInfo invitee, UserInfo inviter) throws ThreeSaleException {
      if (invitee == null || inviter == null) 
         throw new ThreeSaleException(1, "用户信息为空");
@@ -524,6 +513,8 @@
      if (threeSale != null) {
         // 有效关系--生效
         threeSale.setBoss(inviter);
         threeSale.setWorker(invitee);
         threeSale.setState(true);
         threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
         threeSale.setSucceedTime(java.lang.System.currentTimeMillis());
@@ -599,7 +590,7 @@
   @Override
   @Transactional
   public void bindRelationshipByWX(UserInfo invitee, Long inviterId, ThreeSale threeSaleOld, String platform, String version) throws ThreeSaleException {
   public void bindRelationshipByWX(UserInfo invitee, Long inviterId, ThreeSale threeSaleOld) throws ThreeSaleException {
      if (invitee == null || (inviterId == null && threeSaleOld == null))
         throw new ThreeSaleException(1, "用户信息为空");
@@ -642,6 +633,7 @@
      
      UserInfo boss = userInfoService.selectByPKey(threeSale.getBoss().getId());
      threeSale.setBoss(boss);
      threeSale.setWorker(invitee);
      
      // 添加到队列
      ThreeSaleCMQManager.getInstance().addThreeSaleMsg(threeSale);
@@ -714,5 +706,16 @@
   public List<ThreeSale> getSuccessByDate(Long bossId, Long minTime, Long maxTime){
      return threeSaleMapper.getSuccessByDate(bossId, minTime, maxTime);
   }
   @Override
   public List<ThreeSale> listFirstTeam(long start, int count, Long uid, Integer state) {
      return threeSaleMapper.listFirstTeam(start, count, uid, state);
   }
   @Override
   public List<ThreeSale> listSecondTeam(long start, int count, Long uid, Integer state) {
      return threeSaleMapper.listSecondTeam(start, count, uid, state);
   }
}