yujian
2019-03-07 e6cb7c27384f22b39ccee584028e23b56c30e9ee
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
@@ -23,6 +23,7 @@
import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
import com.yeshi.fanli.exception.TaoBaoWeiQuanException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.lable.BoutiqueAutoRuleService;
import com.yeshi.fanli.service.inter.lable.LabelService;
import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
@@ -30,6 +31,7 @@
import com.yeshi.fanli.service.inter.push.IOSPushService;
import com.yeshi.fanli.service.inter.user.ExtractService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
/**
 * 系统初始化
@@ -64,6 +66,12 @@
   @Resource
   private QualityFactoryService qualityFactoryService;
   @Resource
   private UserSystemCouponService userSystemCouponService;
   @Resource
   private ThreeSaleSerivce threeSaleSerivce;
   private static boolean isInited = false;
   public void onApplicationEvent(ContextRefreshedEvent arg0) {
@@ -90,6 +98,7 @@
         doOrderTiChengFanLi();// 处理订单提成返利
         doWeiQuanOrder();// 处理维权订单
         doPushIOS();// 处理发送IOS消息
         doThreeSaleUserCouponJob();// 处理邀请队列
      } else if (!Constant.IS_TEST) {
         initScheduler();// 启动定时任务
         // doUpdateGoodsJob();
@@ -204,7 +213,7 @@
                           }
                        } catch (Exception e) {
                           try {
                              LogHelper.errorDetailInfo(e);
                              LogHelper.errorDetailInfo(e, "HongBaoV2-ID:" + map.get(handler).getId(), "");
                           } catch (Exception e1) {
                              e1.printStackTrace();
                           }
@@ -402,10 +411,8 @@
               while (true) {
                  try {
                     Map<String, ThreeSale> map = ThreeSaleCMQManager.getInstance()
                           .consumeQueueMsg(ThreeSaleCMQManager.QUEUE_USER_COUPON, 16);
                     if (map != null) {
                        Iterator<String> its = map.keySet().iterator();
@@ -413,13 +420,21 @@
                           String key = its.next();
                           try {
                              ThreeSale threeSale = map.get(key);
                              if (threeSale != null)
                                 threeSale = threeSaleSerivce.selectByPrimaryKey(threeSale.getId());
                              if (threeSale != null) {
                                 if (threeSale.getState() != null && threeSale.getState() == true) {
                                    // 邀请成功
                                    // 邀请成功 - 券激活生效
                                    LogHelper.test("doThreeSaleUserCouponJob-" + threeSale.getId());
                                    // TODO 券激活生效
                                    // threeSale.getBoss().getId();
                                    Long bossId = threeSale.getBoss().getId();
                                    // 下级昵称
                                    String workerNickName = userInfoService
                                          .selectByPKey(threeSale.getWorker().getId()).getNickName();
                                    userSystemCouponService.activatedWelfareFreeCoupon(bossId,
                                          workerNickName);
                                 }
                              }
                              ThreeSaleCMQManager.getInstance()