| | |
| | | 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;
|
| | | import com.yeshi.fanli.service.inter.order.OrderProcessService;
|
| | | import com.yeshi.fanli.service.inter.push.IOSPushService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.ExtractService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | |
| | |
|
| | | @Resource
|
| | | private QualityFactoryService qualityFactoryService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserSystemCouponService userSystemCouponService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoOrderService taoBaoOrderService;
|
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | |
|
| | | private static boolean isInited = false;
|
| | |
|
| | |
| | | doOrderTiChengFanLi();// 处理订单提成返利
|
| | | doWeiQuanOrder();// 处理维权订单
|
| | | doPushIOS();// 处理发送IOS消息
|
| | | doThreeSaleUserCouponJob();// 处理邀请队列
|
| | | doUpdateGoodsJob();
|
| | | } else if (!Constant.IS_TEST) {
|
| | | initScheduler();// 启动定时任务
|
| | | // doUpdateGoodsJob();
|
| | | //
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | */
|
| | | public void doTaoBaoOrders() {
|
| | | // 同时开启3个线程处理
|
| | | for (int i = 0; i < 3; i++) {
|
| | | for (int i = 0; i < 1; i++) {
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | |
| | | // 取16个订单
|
| | | Map<String, List<TaoBaoOrder>> map = CMQManager.getInstance().consumeTaoBaoOrderMsg(16);
|
| | | if (map != null) {
|
| | | // 从库里面查询
|
| | | Iterator<String> its = map.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | String orderId = its.next();
|
| | | List<TaoBaoOrder> orderList = taoBaoOrderService.getTaoBaoOrderByOrderId(orderId);
|
| | | map.put(orderId, orderList);
|
| | | }
|
| | | orderProcessService.processOrder(map);
|
| | | }
|
| | | } catch (Exception e) {
|
| | |
| | | while (its.hasNext()) {
|
| | | String handler = its.next();
|
| | | try {
|
| | | orderProcessService.fanli(map.get(handler));
|
| | | HongBaoV2 hongbao = map.get(handler);
|
| | | if (hongbao != null) {
|
| | | String key = "hongbao-fanli-" + hongbao.getId();
|
| | | if (StringUtil.isNullOrEmpty(redisManager.getCommonString(key))) {
|
| | | // 处理之后要隔2小时再次进行处理
|
| | | redisManager.cacheCommonString(key, "1", 60 * 60 * 2);
|
| | | orderProcessService.fanli(map.get(handler));
|
| | | }
|
| | | }
|
| | | CMQManager.getInstance().deleteFanLiMsgNew(handler);
|
| | | } catch (TaoBaoWeiQuanException e) {
|
| | | try {
|
| | |
| | | }
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | LogHelper.errorDetailInfo(e, "HongBaoV2-ID:" + map.get(handler).getId(), "");
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | |
| | | }
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | LogHelper.errorDetailInfo(e, map.get(handler).toString(), "");
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | |
| | |
|
| | | while (true) {
|
| | | try {
|
| | |
|
| | | Map<String, ThreeSale> map = ThreeSaleCMQManager.getInstance()
|
| | | .consumeQueueMsg(ThreeSaleCMQManager.QUEUE_USER_COUPON, 16);
|
| | |
|
| | | if (map != null) {
|
| | |
|
| | | Iterator<String> its = map.keySet().iterator();
|
| | |
| | | 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());
|
| | |
|
| | | Long bossId = threeSale.getBoss().getId();
|
| | | userSystemCouponService.activatedWelfareFreeCoupon(bossId);
|
| | | // 下级昵称
|
| | |
|
| | | String workerNickName = userInfoService
|
| | | .selectByPKey(threeSale.getWorker().getId()).getNickName();
|
| | |
|
| | | userSystemCouponService.activatedWelfareFreeCoupon(bossId,
|
| | | workerNickName);
|
| | | }
|
| | | }
|
| | | ThreeSaleCMQManager.getInstance()
|