| | |
| | | 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;
|
| | |
| | | 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";
|
| | |
| | |
|
| | | // 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 维权订单
|
| | |
| | | public static String GOODS_UPDATE = "goods_update_queue";
|
| | |
|
| | | static {
|
| | |
|
| | | if (Constant.IS_TEST) {
|
| | | QUEUENAME_ORDER = "test-" + QUEUENAME_ORDER;
|
| | | EXTRACT_RESULT = "test-" + EXTRACT_RESULT;
|
| | | PUSH_IOS = "test-" + PUSH_IOS;
|
| | | FANLI_ORDER = "test-" + FANLI_ORDER;
|
| | | FANLI_ORDER_NEW = "test-" + FANLI_ORDER_NEW;
|
| | | FANLI_TICHENG_ORDER = "test-" + FANLI_TICHENG_ORDER;
|
| | | ORDER_WEIQUAN = "test-" + ORDER_WEIQUAN;
|
| | | }
|
| | |
|
| | | QUEUENAME_ORDER += "-" + Constant.systemCommonConfig.getProjectName();
|
| | | 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();
|
| | |
|
| | |
| | | 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);
|
| | |
| | | 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<>();
|
| | |
| | | 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 + "");
|