admin
2019-01-05 86e46bc28e78b3a883132816e23dbcca37f9ca3a
fanli/src/main/java/com/yeshi/fanli/util/CMQManager.java
@@ -6,7 +6,7 @@
import java.util.List;
import java.util.Map;
import net.sf.json.JSONObject;
import org.yeshi.utils.CMQUtil;
import com.alipay.api.response.AlipayFundTransToaccountTransferResponse;
import com.google.gson.Gson;
@@ -16,11 +16,13 @@
import com.yeshi.fanli.entity.bus.user.AlipayTransferResultInfo;
import com.yeshi.fanli.entity.bus.user.Extract;
import com.yeshi.fanli.entity.bus.user.HongBao;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.common.AdminUser;
import com.yeshi.fanli.entity.push.PushQueueRecord;
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
import org.yeshi.utils.CMQUtil;
import net.sf.json.JSONObject;
public class CMQManager {
   private static String secretId = "AKIDTlpgJhLjOozvd6QI2XnpfGbgV4NQJk25";
@@ -36,6 +38,10 @@
   // TODO 返利队列
   public static String FANLI_ORDER = "fanli-order";
   // TODO 返利队列
   public static String FANLI_ORDER_NEW = "fanli-order-new";
   // TODO 提成订单
   public static String FANLI_TICHENG_ORDER = "fanli-ticheng-order";
   // TODO 维权订单
@@ -48,6 +54,7 @@
      EXTRACT_RESULT += "-" + Constant.systemCommonConfig.getProjectName();
      PUSH_IOS += "-" + Constant.systemCommonConfig.getProjectName();
      FANLI_ORDER += "-" + Constant.systemCommonConfig.getProjectName();
      FANLI_ORDER_NEW += "-" + Constant.systemCommonConfig.getProjectName();
      FANLI_TICHENG_ORDER += "-" + Constant.systemCommonConfig.getProjectName();
      ORDER_WEIQUAN += "-" + Constant.systemCommonConfig.getProjectName();
@@ -57,6 +64,7 @@
      cmqUtil.createQueue(EXTRACT_RESULT);
      cmqUtil.createQueue(PUSH_IOS);
      cmqUtil.createQueue(FANLI_ORDER);
      cmqUtil.createQueue(FANLI_ORDER_NEW);
      cmqUtil.createQueue(FANLI_TICHENG_ORDER);
      cmqUtil.createQueue(ORDER_WEIQUAN);
      cmqUtil.createQueue(GOODS_UPDATE);
@@ -167,6 +175,12 @@
      cmqUtil.sendMsg(FANLI_ORDER, content);
   }
   // 新版订单返利
   public void addFanLiMsgNew(HongBaoV2 hongBao) {
      String content = new Gson().toJson(hongBao);
      cmqUtil.sendMsg(FANLI_ORDER_NEW, content);
   }
   public Map<String, HongBao> consumeFanLiMsg(int count) {
      List<Message> list = cmqUtil.recieveMsg(count, FANLI_ORDER);
      Map<String, HongBao> map = new HashMap<>();
@@ -181,10 +195,30 @@
      return map;
   }
   public Map<String, HongBaoV2> consumeFanLiMsgNew(int count) {
      List<Message> list = cmqUtil.recieveMsg(count, FANLI_ORDER_NEW);
      Map<String, HongBaoV2> map = new HashMap<>();
      if (list != null)
         for (Message msg : list) {
            String result = msg.msgBody;
            if (!StringUtil.isNullOrEmpty(result)) {
               HongBaoV2 hongBao = new Gson().fromJson(result, HongBaoV2.class);
               map.put(msg.receiptHandle, hongBao);
            }
         }
      return map;
   }
   public void deleteFanLiMsg(String receiptHandle) {
      cmqUtil.deleteMsg(FANLI_ORDER, receiptHandle);
   }
   public void deleteFanLiMsgNew(String receiptHandle) {
      cmqUtil.deleteMsg(FANLI_ORDER_NEW, receiptHandle);
   }
   // 提成返利
   public void addFanLiTiChengMsg(Long uid) {
      cmqUtil.sendMsg(FANLI_TICHENG_ORDER, uid + "");