|
|
|
@ -33,55 +33,55 @@ public class MerStoreAccountChgHandler { |
|
|
|
|
|
|
|
|
|
@PostConstruct |
|
|
|
|
public void init() { |
|
|
|
|
// new Thread(() -> {
|
|
|
|
|
// {
|
|
|
|
|
// //消息处理
|
|
|
|
|
// while (true){
|
|
|
|
|
// try {
|
|
|
|
|
// //构建的队列为左进右出
|
|
|
|
|
// Object o = redisTemplate.opsForList().rightPop(MsgTopic.MerStoreAccount.getName());
|
|
|
|
|
// if (o != null) {
|
|
|
|
|
// //处理消息
|
|
|
|
|
// logger.info("消息通道:"+o);
|
|
|
|
|
//
|
|
|
|
|
// Map<String, Object> param = (Map<String, Object>) o;
|
|
|
|
|
//
|
|
|
|
|
// if (MapUtils.getInteger(param, "businessType").equals(MerStoreAmountTypeEnum.type1.getType())) {
|
|
|
|
|
// Map<String, Object> otherParam = new HashMap<>();
|
|
|
|
|
// otherParam.put("sourceType", MapUtils.getString(param, "sourceType"));
|
|
|
|
|
// otherParam.put("sourceId", MapUtils.getString(param, "sourceId"));
|
|
|
|
|
// otherParam.put("sourceContent", MapUtils.getString(param, "sourceContent"));
|
|
|
|
|
// otherParam.put("opUserId", MapUtils.getLong(param, "opUserId"));
|
|
|
|
|
// otherParam.put("opUserName", MapUtils.getString(param, "opUserName"));
|
|
|
|
|
//
|
|
|
|
|
// merchantStoreAccountService.recharge(
|
|
|
|
|
// MapUtils.getLong(param, "storeId"),
|
|
|
|
|
// new BigDecimal(MapUtils.getString(param, "price")),
|
|
|
|
|
// otherParam);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (MapUtils.getInteger(param, "businessType").equals(MerStoreAmountTypeEnum.type2.getType())) {
|
|
|
|
|
// Map<String, Object> otherParam = new HashMap<>();
|
|
|
|
|
// otherParam.put("sourceType", MapUtils.getString(param, "sourceType"));
|
|
|
|
|
// otherParam.put("sourceId", MapUtils.getString(param, "sourceId"));
|
|
|
|
|
// otherParam.put("sourceContent", MapUtils.getString(param, "sourceContent"));
|
|
|
|
|
// otherParam.put("opUserId", MapUtils.getLong(param, "opUserId"));
|
|
|
|
|
// otherParam.put("opUserName", MapUtils.getString(param, "opUserName"));
|
|
|
|
|
//
|
|
|
|
|
// merchantStoreAccountService.consume(
|
|
|
|
|
// MapUtils.getLong(param, "storeId"),
|
|
|
|
|
// new BigDecimal(MapUtils.getString(param, "price")),
|
|
|
|
|
// otherParam);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// } else {
|
|
|
|
|
// Thread.sleep(1000);
|
|
|
|
|
// }
|
|
|
|
|
// }catch (Exception e){
|
|
|
|
|
// logger.error("监听订单状态变更错误",e);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }).start();
|
|
|
|
|
new Thread(() -> { |
|
|
|
|
{ |
|
|
|
|
//消息处理
|
|
|
|
|
while (true){ |
|
|
|
|
try { |
|
|
|
|
//构建的队列为左进右出
|
|
|
|
|
Object o = redisTemplate.opsForList().rightPop(MsgTopic.MerStoreAccount.getName()); |
|
|
|
|
if (o != null) { |
|
|
|
|
//处理消息
|
|
|
|
|
logger.info("消息通道:"+o); |
|
|
|
|
|
|
|
|
|
Map<String, Object> param = (Map<String, Object>) o; |
|
|
|
|
|
|
|
|
|
if (MapUtils.getInteger(param, "businessType").equals(MerStoreAmountTypeEnum.type1.getType())) { |
|
|
|
|
Map<String, Object> otherParam = new HashMap<>(); |
|
|
|
|
otherParam.put("sourceType", MapUtils.getString(param, "sourceType")); |
|
|
|
|
otherParam.put("sourceId", MapUtils.getString(param, "sourceId")); |
|
|
|
|
otherParam.put("sourceContent", MapUtils.getString(param, "sourceContent")); |
|
|
|
|
otherParam.put("opUserId", MapUtils.getLong(param, "opUserId")); |
|
|
|
|
otherParam.put("opUserName", MapUtils.getString(param, "opUserName")); |
|
|
|
|
|
|
|
|
|
merchantStoreAccountService.recharge( |
|
|
|
|
MapUtils.getLong(param, "storeId"), |
|
|
|
|
new BigDecimal(MapUtils.getString(param, "price")), |
|
|
|
|
otherParam); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (MapUtils.getInteger(param, "businessType").equals(MerStoreAmountTypeEnum.type2.getType())) { |
|
|
|
|
Map<String, Object> otherParam = new HashMap<>(); |
|
|
|
|
otherParam.put("sourceType", MapUtils.getString(param, "sourceType")); |
|
|
|
|
otherParam.put("sourceId", MapUtils.getString(param, "sourceId")); |
|
|
|
|
otherParam.put("sourceContent", MapUtils.getString(param, "sourceContent")); |
|
|
|
|
otherParam.put("opUserId", MapUtils.getLong(param, "opUserId")); |
|
|
|
|
otherParam.put("opUserName", MapUtils.getString(param, "opUserName")); |
|
|
|
|
|
|
|
|
|
merchantStoreAccountService.consume( |
|
|
|
|
MapUtils.getLong(param, "storeId"), |
|
|
|
|
new BigDecimal(MapUtils.getString(param, "price")), |
|
|
|
|
otherParam); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
Thread.sleep(1000); |
|
|
|
|
} |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
logger.error("监听订单状态变更错误",e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}).start(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|