| | |
| | | import org.springframework.context.event.ContextRefreshedEvent;
|
| | | import org.springframework.core.task.TaskExecutor;
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | | import org.yeshi.utils.tencentcloud.entity.COSInitParams;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayTransferResultInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.push.PushQueueRecord;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | |
| | | 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 org.yeshi.utils.tencentcloud.COSManager;
|
| | | import org.yeshi.utils.tencentcloud.entity.COSInitParams;
|
| | |
|
| | | /**
|
| | | * 系统初始化
|
| | |
| | | if (Constant.IS_TASK) {
|
| | | doExtractResult();// 处理提现结果
|
| | | doTaoBaoOrders();// 处理淘宝订单
|
| | | doOrderFanLi();// 处理订单返利
|
| | | doOrderFanLiNew();// 新版返利
|
| | | doOrderTiChengFanLi();// 处理订单提成返利
|
| | | doWeiQuanOrder();// 处理维权订单
|
| | | doPushIOS();// 处理发送IOS消息
|
| | | } else if (!Constant.IS_TEST) {
|
| | | initScheduler();// 启动定时任务
|
| | | doUpdateGoodsJob();
|
| | | // doUpdateGoodsJob();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | orderProcessService.processOrder(map);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 处理淘宝订单返利
|
| | | * 处理新版淘宝订单返利
|
| | | */
|
| | | public void doOrderFanLi() {
|
| | | public void doOrderFanLiNew() {
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | while (true) {
|
| | | try {
|
| | | Map<String, HongBao> map = CMQManager.getInstance().consumeFanLiMsg(16);
|
| | | Map<String, HongBaoV2> map = CMQManager.getInstance().consumeFanLiMsgNew(16);
|
| | | if (map != null) {
|
| | | Iterator<String> its = map.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | String handler = its.next();
|
| | | try {
|
| | | orderProcessService.fanli(map.get(handler));
|
| | | CMQManager.getInstance().deleteFanLiMsg(handler);
|
| | | CMQManager.getInstance().deleteFanLiMsgNew(handler);
|
| | | } catch (TaoBaoWeiQuanException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.error("更新商品出错:"+e.getMessage());
|
| | | LogHelper.error("更新商品出错:" + e.getMessage());
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | /**
|
| | | * 邀请关系变化后券的更新
|
| | | */
|
| | | public void doThreeSaleUserCouponJob() {
|
| | |
|
| | | // 采用2个线程做更新
|
| | | for (int i = 0; i < 2; i++)
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | |
|
| | | while (true) {
|
| | | try {
|
| | |
|
| | | Map<String, ThreeSale> map = ThreeSaleCMQManager.getInstance()
|
| | | .consumeQueueMsg(ThreeSaleCMQManager.QUEUE_USER_COUPON, 16);
|
| | |
|
| | | if (map != null) {
|
| | |
|
| | | Iterator<String> its = map.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | String key = its.next();
|
| | | try {
|
| | | ThreeSale threeSale = map.get(key);
|
| | | if (threeSale != null) {
|
| | | if (threeSale.getState() != null && threeSale.getState() == true) {
|
| | | // 邀请成功
|
| | |
|
| | | // TODO 券激活生效
|
| | | // threeSale.getBoss().getId();
|
| | |
|
| | | }
|
| | | }
|
| | | ThreeSaleCMQManager.getInstance()
|
| | | .deleteQueueMsg(ThreeSaleCMQManager.QUEUE_USER_COUPON, key);
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.error("更新商品出错:" + e.getMessage());
|
| | |
|
| | | }
|
| | | }
|