记得上下班打卡 | git大法好,push需谨慎

Commit 5227b679 authored by 张国柄's avatar 张国柄

Merge remote-tracking branch 'origin/jxl_419_dotask' into pre

parents 4798897f 778ec962
package com.liquidnet.service.goblin.dto;
import com.liquidnet.commons.lang.util.JsonUtils;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 积分增减队列消息体
*
* @author jiangxiulong
*/
@Data
public class GoblinQueueBizIntegralDto implements Serializable, Cloneable {
private static final long serialVersionUID = 7538372638864080920L;
private String content;
private BigDecimal score;
private String uid;
private int type; // 1增 2减
private static final GoblinQueueBizIntegralDto obj = new GoblinQueueBizIntegralDto();
public static GoblinQueueBizIntegralDto getNew() {
try {
return (GoblinQueueBizIntegralDto) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinQueueBizIntegralDto();
}
}
public String toJson() {
return JsonUtils.toJson(this);
}
}
...@@ -104,8 +104,8 @@ public class HttpUtil { ...@@ -104,8 +104,8 @@ public class HttpUtil {
public static String postJson(String url, String jsonStr, MultiValueMap<String, String> headers) { public static String postJson(String url, String jsonStr, MultiValueMap<String, String> headers) {
MultiValueMap<String, String> commonHeader = CollectionUtil.linkedMultiValueMapStringString(); MultiValueMap<String, String> commonHeader = CollectionUtil.linkedMultiValueMapStringString();
headers.add("Content-Type", MediaType.APPLICATION_JSON_UTF8_VALUE); commonHeader.add("Content-Type", MediaType.APPLICATION_JSON_UTF8_VALUE);
headers.add("Accept", MediaType.APPLICATION_JSON_UTF8_VALUE); commonHeader.add("Accept", MediaType.APPLICATION_JSON_UTF8_VALUE);
if (url == null || url.trim().isEmpty()) { if (url == null || url.trim().isEmpty()) {
return null; return null;
...@@ -119,6 +119,7 @@ public class HttpUtil { ...@@ -119,6 +119,7 @@ public class HttpUtil {
if (headers != null) { if (headers != null) {
httpHeaders.addAll(headers); httpHeaders.addAll(headers);
} }
HttpEntity<Object> httpEntity = new HttpEntity(jsonStr, httpHeaders); HttpEntity<Object> httpEntity = new HttpEntity(jsonStr, httpHeaders);
// 提交方式:表单、json // 提交方式:表单、json
......
...@@ -41,7 +41,7 @@ public class RedisStreamConfig { ...@@ -41,7 +41,7 @@ public class RedisStreamConfig {
stringObjectObjectStreamOperations.delete(key, recordId.getValue()); stringObjectObjectStreamOperations.delete(key, recordId.getValue());
} }
} catch (Exception e) { } catch (Exception e) {
log.error("Ex:redis stream init [{},{}],ex:{}", key, group, e.getMessage()); log.warn("###Ex:redis stream init [{},{}],ex:{}", key, group, e.getMessage());
} }
} }
......
...@@ -268,7 +268,6 @@ public class MQConst { ...@@ -268,7 +268,6 @@ public class MQConst {
GOBLIN_STORE_MARKET("goblin:stream:store.market", "group.store.market", "店铺活动"), GOBLIN_STORE_MARKET("goblin:stream:store.market", "group.store.market", "店铺活动"),
GOBLIN_SELF_MARKET("goblin:stream:self.market", "group.self.market", "平台活动"), GOBLIN_SELF_MARKET("goblin:stream:self.market", "group.self.market", "平台活动"),
GOBLIN_ORDER_CREATE_PAY("goblin:stream:order:create_pay", "group.order:create_pay", "订单创建&支付"), GOBLIN_ORDER_CREATE_PAY("goblin:stream:order:create_pay", "group.order:create_pay", "订单创建&支付"),
GOBLIN_NFT_ORDER("goblin:stream:nftOrder:create", "group.nftOrder:create", "NFT订单处理"),
GOBLIN_SHOP_CART("goblin:stream:sql.shopcart","group.shop.shopcart","购物车"), GOBLIN_SHOP_CART("goblin:stream:sql.shopcart","group.shop.shopcart","购物车"),
GOBLIN_ORDER_AGAIN("goblin:stream:order:again", "group.order:again", "订单再次支付"), GOBLIN_ORDER_AGAIN("goblin:stream:order:again", "group.order:again", "订单再次支付"),
GOBLIN_ORDER_CLOSE("goblin:stream:order:close", "group.order:close", "订单关闭"), GOBLIN_ORDER_CLOSE("goblin:stream:order:close", "group.order:close", "订单关闭"),
...@@ -291,6 +290,10 @@ public class MQConst { ...@@ -291,6 +290,10 @@ public class MQConst {
BIZ_ARTWORK_CLQ("goblin:stream:biz_art:clq", "group.biz.artwork", "藏品声明查询"), BIZ_ARTWORK_CLQ("goblin:stream:biz_art:clq", "group.biz.artwork", "藏品声明查询"),
BIZ_ARTWORK_GEN("goblin:stream:biz_art:gen", "group.biz.artwork", "藏品生成"), BIZ_ARTWORK_GEN("goblin:stream:biz_art:gen", "group.biz.artwork", "藏品生成"),
SQL_ARTWORK_GEN("goblin:stream:sql_art:gen", "group.biz.artwork", "藏品生成"), SQL_ARTWORK_GEN("goblin:stream:sql_art:gen", "group.biz.artwork", "藏品生成"),
GOBLIN_NFT_ORDER("goblin:stream:nftOrder:create", "group.nftOrder:create", "NFT订单处理"),
BIZ_INTEGRAL("goblin:stream:biz_integral", "group.biz.integral", "增减积分操作"),
; ;
private final String key; private final String key;
......
...@@ -4,6 +4,7 @@ import com.liquidnet.common.cache.redis.config.RedisStreamConfig; ...@@ -4,6 +4,7 @@ import com.liquidnet.common.cache.redis.config.RedisStreamConfig;
import com.liquidnet.service.base.constant.MQConst; import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.kylin.receiver.ConsumerGoblinBizArtworkClqRdsReceiver; import com.liquidnet.service.consumer.kylin.receiver.ConsumerGoblinBizArtworkClqRdsReceiver;
import com.liquidnet.service.consumer.kylin.receiver.ConsumerGoblinBizArtworkUplRdsReceiver; import com.liquidnet.service.consumer.kylin.receiver.ConsumerGoblinBizArtworkUplRdsReceiver;
import com.liquidnet.service.consumer.kylin.receiver.ConsumerGoblinBizIntegralReceiver;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -29,6 +30,8 @@ public class ConsumerCommonBizRedisStreamConfig extends RedisStreamConfig { ...@@ -29,6 +30,8 @@ public class ConsumerCommonBizRedisStreamConfig extends RedisStreamConfig {
ConsumerGoblinBizArtworkClqRdsReceiver consumerGoblinBizArtworkClqRdsReceiver; ConsumerGoblinBizArtworkClqRdsReceiver consumerGoblinBizArtworkClqRdsReceiver;
// @Autowired // @Autowired
// ConsumerGoblinBizArtworkGenRdsReceiver consumerGoblinBizArtworkGenRdsReceiver; // ConsumerGoblinBizArtworkGenRdsReceiver consumerGoblinBizArtworkGenRdsReceiver;
@Autowired
ConsumerGoblinBizIntegralReceiver consumerGoblinBizIntegralReceiver;
@Bean// 藏品上传声明 @Bean// 藏品上传声明
public List<Subscription> subscriptionBizArtworkUpl(RedisConnectionFactory factory) { public List<Subscription> subscriptionBizArtworkUpl(RedisConnectionFactory factory) {
...@@ -77,4 +80,20 @@ public class ConsumerCommonBizRedisStreamConfig extends RedisStreamConfig { ...@@ -77,4 +80,20 @@ public class ConsumerCommonBizRedisStreamConfig extends RedisStreamConfig {
// } // }
// return subscriptionList; // return subscriptionList;
// } // }
@Bean// 增减积分
public List<Subscription> subscriptionBizIntegral(RedisConnectionFactory factory) {
List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.BIZ_INTEGRAL;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 10; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
StreamOffset.create(stream.getKey(), ReadOffset.lastConsumed()), consumerGoblinBizIntegralReceiver
));
listenerContainer.start();
}
return subscriptionList;
}
} }
...@@ -49,7 +49,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig { ...@@ -49,7 +49,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig {
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_0; MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_0;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup()); this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 20; i++) { for (int i = 0; i < 10; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory); StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck( subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)), Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
...@@ -65,7 +65,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig { ...@@ -65,7 +65,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig {
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_1; MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_1;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup()); this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 20; i++) { for (int i = 0; i < 10; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory); StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck( subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)), Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
...@@ -81,7 +81,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig { ...@@ -81,7 +81,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig {
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_2; MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_2;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup()); this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 20; i++) { for (int i = 0; i < 10; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory); StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck( subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)), Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
...@@ -97,7 +97,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig { ...@@ -97,7 +97,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig {
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_3; MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_3;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup()); this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 20; i++) { for (int i = 0; i < 10; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory); StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck( subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)), Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
...@@ -113,7 +113,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig { ...@@ -113,7 +113,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig {
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_4; MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_4;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup()); this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 20; i++) { for (int i = 0; i < 10; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory); StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck( subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)), Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
...@@ -129,7 +129,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig { ...@@ -129,7 +129,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig {
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_5; MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_5;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup()); this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 20; i++) { for (int i = 0; i < 10; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory); StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck( subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)), Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
...@@ -145,7 +145,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig { ...@@ -145,7 +145,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig {
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_6; MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_6;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup()); this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 20; i++) { for (int i = 0; i < 10; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory); StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck( subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)), Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
...@@ -161,7 +161,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig { ...@@ -161,7 +161,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig {
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_7; MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_7;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup()); this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 20; i++) { for (int i = 0; i < 10; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory); StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck( subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)), Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
...@@ -177,7 +177,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig { ...@@ -177,7 +177,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig {
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_8; MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_8;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup()); this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 20; i++) { for (int i = 0; i < 10; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory); StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck( subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)), Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
...@@ -193,7 +193,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig { ...@@ -193,7 +193,7 @@ public class ConsumerOrderCloseRedisStreamConfig extends RedisStreamConfig {
List<Subscription> subscriptionList = new ArrayList<>(); List<Subscription> subscriptionList = new ArrayList<>();
MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_9; MQConst.GoblinQueue stream = MQConst.GoblinQueue.GOBLIN_UN_PAY_9;
this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup()); this.initStream(stringRedisTemplate, stream.getKey(), stream.getGroup());
for (int i = 0; i < 20; i++) { for (int i = 0; i < 10; i++) {
StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory); StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer = this.buildStreamMessageListenerContainer(factory);
subscriptionList.add(listenerContainer.receiveAutoAck( subscriptionList.add(listenerContainer.receiveAutoAck(
Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)), Consumer.from(stream.getGroup(), getConsumerName(stream.name() + i)),
......
package com.liquidnet.service.consumer.kylin.receiver;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.HttpUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.goblin.dto.GoblinQueueBizIntegralDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.connection.stream.StreamRecords;
import org.springframework.stereotype.Component;
import org.springframework.util.MultiValueMap;
import java.util.HashMap;
@Slf4j
@Component
public class ConsumerGoblinBizIntegralReceiver extends AbstractBizRedisReceiver {
@Value("${liquidnet.service.stone.url}")
private String stoneUrl;
@Override
protected String getRedisStreamKey() {
return MQConst.GoblinQueue.BIZ_INTEGRAL.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.GoblinQueue.BIZ_INTEGRAL.getGroup();
}
@Override
protected boolean consumerMessageHandler(String msg) {
boolean aBoolean = false;
try {
GoblinQueueBizIntegralDto fromJsonObj = JsonUtils.fromJson(msg, GoblinQueueBizIntegralDto.class);
if (fromJsonObj == null) {
log.warn("CONSUMER MSG NULL_DTO ==> [{}]:{}", this.getRedisStreamKey(), msg);
aBoolean = true;
} else {
aBoolean = this.bizIntegralProcessing(fromJsonObj);
}
} catch (Exception e) {
log.error("CONSUMER MSG EX_HANDLE ==> [{}]:{}", this.getRedisStreamKey(), msg, e);
} finally {
if (!aBoolean) {
HashMap<String, String> map = CollectionUtil.mapStringString();
map.put(MQConst.QUEUE_MESSAGE_KEY, msg);
stringRedisTemplate.opsForStream().add(StreamRecords.mapBacked(map).withStreamKey(this.getRedisStreamKey()));
}
}
return aBoolean;
}
private boolean bizIntegralProcessing(GoblinQueueBizIntegralDto dto) {
try {
log.info("bizIntegralProcessing params:{}", dto);
String uid = dto.getUid(), content = dto.getContent();
int type = dto.getType();
MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString();
header.add("Accept", "application/json;charset=UTF-8");
MultiValueMap<String, String> params = CollectionUtil.linkedMultiValueMapStringString();
params.add("score", dto.getScore().intValue() + "");
params.add("content", content);
params.add("uid", uid);
String resultData = "";
long ss = System.currentTimeMillis();
log.info("HttpUtil s:{}", ss);
if (type == 1) {
resultData = HttpUtil.post(stoneUrl + "/user/logs/in2111", params, header);
} else {
resultData = HttpUtil.post(stoneUrl + "/user/logs/de2111", params, header);
}
log.info("HttpUtil e:{}", System.currentTimeMillis() - ss);
log.info("bizIntegralProcessing result:{}", resultData);
return true;
} catch (Exception e) {
log.error("bizIntegralProcessing e:{}", e);
return false;
}
}
/* ------------------------------------------------------------------------------------ */
}
...@@ -82,15 +82,21 @@ public class ZxinTradeCommonBiz { ...@@ -82,15 +82,21 @@ public class ZxinTradeCommonBiz {
}else if(StringUtil.isNotNull(nftOrderBo)){ }else if(StringUtil.isNotNull(nftOrderBo)){
if(nftOrderBo.getNftPublishStatus().equalsIgnoreCase(GalaxyEnum.TaskStatusEnum.TASK_SUCCESS.getCode()) if(nftOrderBo.getNftPublishStatus().equalsIgnoreCase(GalaxyEnum.TaskStatusEnum.TASK_SUCCESS.getCode())
&&nftOrderBo.getNftBuyStatus().equalsIgnoreCase(GalaxyEnum.TaskStatusEnum.TASK_SUCCESS.getCode())){ &&nftOrderBo.getNftBuyStatus().equalsIgnoreCase(GalaxyEnum.TaskStatusEnum.TASK_SUCCESS.getCode())){
return ResponseDto.failure(GalaxyErrorEnum.PUBLISH_FAIL_ALREADY_EXIST.getCode(), GalaxyErrorEnum.PUBLISH_FAIL_ALREADY_EXIST.getMessage()); GalaxyNftPublishAndBuyRespDto nftPublishAndBuyRespDto = GalaxyNftPublishAndBuyRespDto.getNew();
nftPublishAndBuyRespDto.setUserId(reqDto.getUserId());
nftPublishAndBuyRespDto.setNftId(nftOrderBo.getNftId());
log.error("开始执行nftPublishAndBuy error msg:{}", GalaxyErrorEnum.PUBLISH_FAIL_ALREADY_EXIST.toString());
return ResponseDto.success(nftPublishAndBuyRespDto);
} }
if(nftOrderBo.getNftPublishStatus().equalsIgnoreCase(GalaxyEnum.TaskStatusEnum.TASK_SUCCESS.getCode()) if(nftOrderBo.getNftPublishStatus().equalsIgnoreCase(GalaxyEnum.TaskStatusEnum.TASK_SUCCESS.getCode())
&&nftOrderBo.getNftBuyStatus().equalsIgnoreCase(GalaxyEnum.TaskStatusEnum.INIT.getCode())){ &&(nftOrderBo.getNftBuyStatus().equalsIgnoreCase(GalaxyEnum.TaskStatusEnum.INIT.getCode())
||nftOrderBo.getNftBuyStatus().equalsIgnoreCase(GalaxyEnum.TaskStatusEnum.PROCESSING.getCode()))){
//再次发起购买 //再次发起购买
GalaxyNftPublishAndBuyRespDto nftPublishAndBuyRespDto = this.executeBuyBusiness(reqDto,userInfoBo,seriesNftInfoBo,nftOrderBo); GalaxyNftPublishAndBuyRespDto nftPublishAndBuyRespDto = this.executeBuyBusiness(reqDto,userInfoBo,seriesNftInfoBo,nftOrderBo);
if(StringUtil.isNotNull(nftPublishAndBuyRespDto)&&StringUtil.isNotEmpty(nftPublishAndBuyRespDto.getNftId())){ if(StringUtil.isNotNull(nftPublishAndBuyRespDto)&&StringUtil.isNotEmpty(nftPublishAndBuyRespDto.getNftId())){
return ResponseDto.success(nftPublishAndBuyRespDto); return ResponseDto.success(nftPublishAndBuyRespDto);
}else{ }else{
log.error("开始执行nftPublishAndBuy-->executeBuyBusiness error msg:{}",GalaxyErrorEnum.NFT_BUY_FAIL.getMessage());
return ResponseDto.failure(GalaxyErrorEnum.NFT_BUY_FAIL.getCode(),GalaxyErrorEnum.NFT_BUY_FAIL.getMessage()); return ResponseDto.failure(GalaxyErrorEnum.NFT_BUY_FAIL.getCode(),GalaxyErrorEnum.NFT_BUY_FAIL.getMessage());
} }
} }
...@@ -205,6 +211,7 @@ public class ZxinTradeCommonBiz { ...@@ -205,6 +211,7 @@ public class ZxinTradeCommonBiz {
String nftIdBegin = null; String nftIdBegin = null;
long timeStart = System.currentTimeMillis(); long timeStart = System.currentTimeMillis();
while (StringUtil.isEmpty(nftIdBegin)) { while (StringUtil.isEmpty(nftIdBegin)) {
Thread.sleep(500l);
count++; count++;
ZxlnftResponseDto<Nft035PublishResultRespDto> nft035RespDtoTemp = zxlnftSdkUtil.nft035PublishResult(nft035ReqDto); ZxlnftResponseDto<Nft035PublishResultRespDto> nft035RespDtoTemp = zxlnftSdkUtil.nft035PublishResult(nft035ReqDto);
log.info("=======执行第{}次查询,taskId:{}", count, nft035ReqDto.getTaskId()); log.info("=======执行第{}次查询,taskId:{}", count, nft035ReqDto.getTaskId());
...@@ -345,45 +352,55 @@ public class ZxinTradeCommonBiz { ...@@ -345,45 +352,55 @@ public class ZxinTradeCommonBiz {
String nftBuyTradeHash = null; String nftBuyTradeHash = null;
String nftBuyPayTaskId = null; String nftBuyPayTaskId = null;
// 3.2.2调用购买NFT接口 //如果购买任务不为空,则直接进行购买任务查询
Nft043BuyReqDto nft043BuyReqDto = Nft043BuyReqDto.getNew(); if(StringUtil.isNotEmpty(nftOrderBo.getNftBuyTaskId())){
nft043BuyReqDto.setNftId(nftId); nftBuyTaskId = nftOrderBo.getNftBuyTaskId();
nft043BuyReqDto.setApplyScore(seriesNftInfoBo.getSellCount().intValue());
try {
nft043BuyReqDto.setReceiverPubKey(BASE64Util.decode(userInfoBo.getUserPubKey()));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} }
nft043BuyReqDto.setPointReceiverAddr(userInfoBo.getBlockChainAddress());
nft043BuyReqDto.setOfferCount(seriesNftInfoBo.getSellCount().longValue());
nft043BuyReqDto.setOperateId(IDGenerator.get32UUID());
/** if(StringUtil.isEmpty(nftBuyTaskId)){
* 接收人的私钥签名,签名对象是(platformPubKey_receiverPubKey_pointReceiverAddr_applyScore_接口名_nftId_offerCount_operateId) // 3.2.2调用购买NFT接口
* 接口名:buy_nft Nft043BuyReqDto nft043BuyReqDto = Nft043BuyReqDto.getNew();
*/ nft043BuyReqDto.setNftId(nftId);
String signMetaData = zxlnftConfig.getNftPlatformPubKey() nft043BuyReqDto.setApplyScore(seriesNftInfoBo.getSellCount().intValue());
.concat("_").concat(nft043BuyReqDto.getReceiverPubKey()) try {
.concat("_").concat(nft043BuyReqDto.getPointReceiverAddr()) nft043BuyReqDto.setReceiverPubKey(BASE64Util.decode(userInfoBo.getUserPubKey()));
.concat("_").concat(nft043BuyReqDto.getApplyScore().toString()) } catch (UnsupportedEncodingException e) {
.concat("_").concat("buy_nft") e.printStackTrace();
.concat("_").concat(nft043BuyReqDto.getNftId()) }
.concat("_").concat(nft043BuyReqDto.getOfferCount().toString()) nft043BuyReqDto.setPointReceiverAddr(userInfoBo.getBlockChainAddress());
.concat("_").concat(nft043BuyReqDto.getOperateId()); nft043BuyReqDto.setOfferCount(seriesNftInfoBo.getSellCount().longValue());
String signature = null; nft043BuyReqDto.setOperateId(IDGenerator.get32UUID());
try {
signature = zxlnftBiz.createSign(BASE64Util.decode(userInfoBo.getUserPriKey()),signMetaData);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
nft043BuyReqDto.setSignature(signature);
ZxlnftResponseDto<Nft043BuyRespDto> nft043RespDto = zxlnftSdkUtil.nft043Buy(nft043BuyReqDto); /**
if(nft043RespDto.isSuccess()){ * 接收人的私钥签名,签名对象是(platformPubKey_receiverPubKey_pointReceiverAddr_applyScore_接口名_nftId_offerCount_operateId)
try{ * 接口名:buy_nft
*/
String signMetaData = zxlnftConfig.getNftPlatformPubKey()
.concat("_").concat(nft043BuyReqDto.getReceiverPubKey())
.concat("_").concat(nft043BuyReqDto.getPointReceiverAddr())
.concat("_").concat(nft043BuyReqDto.getApplyScore().toString())
.concat("_").concat("buy_nft")
.concat("_").concat(nft043BuyReqDto.getNftId())
.concat("_").concat(nft043BuyReqDto.getOfferCount().toString())
.concat("_").concat(nft043BuyReqDto.getOperateId());
String signature = null;
try {
signature = zxlnftBiz.createSign(BASE64Util.decode(userInfoBo.getUserPriKey()),signMetaData);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
nft043BuyReqDto.setSignature(signature);
ZxlnftResponseDto<Nft043BuyRespDto> nft043RespDto = zxlnftSdkUtil.nft043Buy(nft043BuyReqDto);
if(nft043RespDto.isSuccess()){
nftBuyTaskId = nft043RespDto.getData().getTaskId(); nftBuyTaskId = nft043RespDto.getData().getTaskId();
nftOrderBo.setNftBuyTaskId(nftBuyTaskId); nftOrderBo.setNftBuyTaskId(nftBuyTaskId);
}
}
//如果购买任务id不为空
if(StringUtil.isNotEmpty(nftBuyTaskId)){
try{
//3.2.4查询NFT购买结果 //3.2.4查询NFT购买结果
Nft044BuyResultReqDto nft044ReqDto = Nft044BuyResultReqDto.getNew(); Nft044BuyResultReqDto nft044ReqDto = Nft044BuyResultReqDto.getNew();
nft044ReqDto.setTaskId(nftBuyTaskId); nft044ReqDto.setTaskId(nftBuyTaskId);
...@@ -392,6 +409,7 @@ public class ZxinTradeCommonBiz { ...@@ -392,6 +409,7 @@ public class ZxinTradeCommonBiz {
int count = 0; int count = 0;
while(nftBuyPayTaskId == null){ while(nftBuyPayTaskId == null){
Thread.sleep(500l);
count++; count++;
log.info("=======执行第{}次查询,taskId:{}",count,nft044ReqDto.getTaskId()); log.info("=======执行第{}次查询,taskId:{}",count,nft044ReqDto.getTaskId());
ZxlnftResponseDto<Nft044BuyResultRespDto> nft044RespDto = zxlnftSdkUtil.nft044BuyResult(nft044ReqDto); ZxlnftResponseDto<Nft044BuyResultRespDto> nft044RespDto = zxlnftSdkUtil.nft044BuyResult(nft044ReqDto);
...@@ -411,6 +429,8 @@ public class ZxinTradeCommonBiz { ...@@ -411,6 +429,8 @@ public class ZxinTradeCommonBiz {
nftBuyStatus = nft044RespDto.getData().getTaskStatus(); nftBuyStatus = nft044RespDto.getData().getTaskStatus();
} }
if(count==20){ if(count==20){
//查询超过20次,则把nftId设置为空,为后续重新入队
nftId = null;
log.info("=======查询共5次,跳出循环!taskId:{}",nft044ReqDto.getTaskId()); log.info("=======查询共5次,跳出循环!taskId:{}",nft044ReqDto.getTaskId());
break; break;
} }
...@@ -445,12 +465,13 @@ public class ZxinTradeCommonBiz { ...@@ -445,12 +465,13 @@ public class ZxinTradeCommonBiz {
nftOrderBo.setNftBuyTradeHash(nftBuyTradeHash); nftOrderBo.setNftBuyTradeHash(nftBuyTradeHash);
nftOrderBo.setNftBuyPayTaskId(nftBuyPayTaskId); nftOrderBo.setNftBuyPayTaskId(nftBuyPayTaskId);
nftOrderBo.setUpdatedAt(LocalDateTime.now()); nftOrderBo.setUpdatedAt(LocalDateTime.now());
//先更新nft发行数据 //先更新nft购买数据
dataUtils.updateNftOrderBuyInfo(routerType,nftOrderBo.getNftOrderPayId(),nftOrderBo); dataUtils.updateNftOrderBuyInfo(routerType,nftOrderBo.getNftOrderPayId(),nftOrderBo);
}else{ }else{
//购买失败 //购买失败
throw new GalaxyNftBuyException(GalaxyErrorEnum.NFT_BUY_ERROR.getCode(),"nft043Buy_resp:"+nft043RespDto.getMessage()); throw new GalaxyNftBuyException(GalaxyErrorEnum.NFT_BUY_ERROR.getCode(),"nft043Buy_resp: nftBuyTaskId:"+nftBuyTaskId);
} }
GalaxyNftBuyRespDto nftBuyRespDto = GalaxyNftBuyRespDto.getNew(); GalaxyNftBuyRespDto nftBuyRespDto = GalaxyNftBuyRespDto.getNew();
nftBuyRespDto.setUserId(userInfoBo.getUserId()); nftBuyRespDto.setUserId(userInfoBo.getUserId());
nftBuyRespDto.setNftId(nftId); nftBuyRespDto.setNftId(nftId);
......
...@@ -7,7 +7,6 @@ import com.liquidnet.common.third.zxlnft.dto.*; ...@@ -7,7 +7,6 @@ import com.liquidnet.common.third.zxlnft.dto.*;
import com.liquidnet.common.third.zxlnft.util.ZxlnftSdkUtil; import com.liquidnet.common.third.zxlnft.util.ZxlnftSdkUtil;
import com.liquidnet.commons.lang.util.*; import com.liquidnet.commons.lang.util.*;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.galaxy.biz.GalaxyBeanTransferBiz; import com.liquidnet.service.galaxy.biz.GalaxyBeanTransferBiz;
import com.liquidnet.service.galaxy.biz.GalaxyEnumBiz; import com.liquidnet.service.galaxy.biz.GalaxyEnumBiz;
import com.liquidnet.service.galaxy.constant.GalaxyEnum; import com.liquidnet.service.galaxy.constant.GalaxyEnum;
...@@ -192,13 +191,13 @@ public class ZxinTradeBiz { ...@@ -192,13 +191,13 @@ public class ZxinTradeBiz {
} }
//判断是否需要二次购买 //判断是否需要二次购买
if(isNeedSecondBuy){ // if(isNeedSecondBuy){
GalaxyNftPublishAndBuyReqDto galaxyNftPublishAndBuyReqDto = GalaxyNftPublishAndBuyReqDto.getNew(); // GalaxyNftPublishAndBuyReqDto galaxyNftPublishAndBuyReqDto = GalaxyNftPublishAndBuyReqDto.getNew();
BeanUtil.copy(reqDto,galaxyNftPublishAndBuyReqDto); // BeanUtil.copy(reqDto,galaxyNftPublishAndBuyReqDto);
galaxyNftPublishAndBuyReqDto.setSkuId(nftOrderBo.getSkuId()); // galaxyNftPublishAndBuyReqDto.setSkuId(nftOrderBo.getSkuId());
galaxyNftPublishAndBuyReqDto.setBuyTimestamp(DateUtil.getNowTime()); // galaxyNftPublishAndBuyReqDto.setBuyTimestamp(DateUtil.getNowTime());
queueUtil.sendMsgByRedis(MQConst.GalaxyQueue.JSON_NFT_PUBLISH_AND_BUY.getKey(), JsonUtils.toJson(galaxyNftPublishAndBuyReqDto)); // queueUtil.sendMsgByRedis(MQConst.GalaxyQueue.JSON_NFT_PUBLISH_AND_BUY.getKey(), JsonUtils.toJson(galaxyNftPublishAndBuyReqDto));
} // }
GalaxyNftPublishAndBuyResultQueryRespDto resultQueryRespDto = GalaxyNftPublishAndBuyResultQueryRespDto.getNew(); GalaxyNftPublishAndBuyResultQueryRespDto resultQueryRespDto = GalaxyNftPublishAndBuyResultQueryRespDto.getNew();
if(nftOrderBo.getNftPublishStatus().equalsIgnoreCase(GalaxyEnum.TaskStatusEnum.TASK_SUCCESS.getCode())&& if(nftOrderBo.getNftPublishStatus().equalsIgnoreCase(GalaxyEnum.TaskStatusEnum.TASK_SUCCESS.getCode())&&
......
...@@ -27,6 +27,8 @@ public class GoblinAppZhengzaiServiceImpl implements IGoblinAppZhengzaiService { ...@@ -27,6 +27,8 @@ public class GoblinAppZhengzaiServiceImpl implements IGoblinAppZhengzaiService {
@Autowired @Autowired
GoblinRedisUtils redisUtils; GoblinRedisUtils redisUtils;
@Autowired @Autowired
GoblinOrderUtils goblinOrderUtils;
@Autowired
GoblinMongoUtils mongoUtils; GoblinMongoUtils mongoUtils;
@Autowired @Autowired
QueueUtils queueUtils; QueueUtils queueUtils;
...@@ -205,7 +207,7 @@ public class GoblinAppZhengzaiServiceImpl implements IGoblinAppZhengzaiService { ...@@ -205,7 +207,7 @@ public class GoblinAppZhengzaiServiceImpl implements IGoblinAppZhengzaiService {
uid, now, storeOrderVo.getOrderId(), now, now)); uid, now, storeOrderVo.getOrderId(), now, now));
} }
if (priceActual.compareTo(BigDecimal.ZERO) != 0) { if (priceActual.compareTo(BigDecimal.ZERO) != 0) {
orderUtils.doTask(uid, priceActual); goblinOrderUtils.integral(uid, priceActual, "购买商品", 1);
} }
} }
return ResponseDto.success(); return ResponseDto.success();
......
...@@ -7,8 +7,10 @@ import com.liquidnet.commons.lang.util.CurrentUtil; ...@@ -7,8 +7,10 @@ import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.commons.lang.util.HttpUtil; import com.liquidnet.commons.lang.util.HttpUtil;
import com.liquidnet.commons.lang.util.JsonUtils; import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.candy.param.BackCouponParam; import com.liquidnet.service.candy.param.BackCouponParam;
import com.liquidnet.service.candy.vo.CandyCouponVo; import com.liquidnet.service.candy.vo.CandyCouponVo;
import com.liquidnet.service.goblin.dto.GoblinQueueBizIntegralDto;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo; import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -27,10 +29,10 @@ public class GoblinOrderUtils { ...@@ -27,10 +29,10 @@ public class GoblinOrderUtils {
@Value("${liquidnet.service.candy.url}") @Value("${liquidnet.service.candy.url}")
private String candyUrl; private String candyUrl;
@Value("${liquidnet.service.stone.url}")
private String stoneUrl;
@Autowired @Autowired
GoblinRedisUtils redisUtils; GoblinRedisUtils redisUtils;
@Autowired
QueueUtils queueUtils;
public void backCoupon(String uCouponId, String uid) { public void backCoupon(String uCouponId, String uid) {
try { try {
...@@ -76,18 +78,14 @@ public class GoblinOrderUtils { ...@@ -76,18 +78,14 @@ public class GoblinOrderUtils {
} }
} }
public void doTask(String uid, BigDecimal price) { public void integral(String uid, BigDecimal price, String content, int type) {
try { if (price.intValue() > 0) {
MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString(); GoblinQueueBizIntegralDto goblinQueueBizIntegralDto = GoblinQueueBizIntegralDto.getNew();
header.add("Accept", "application/json;charset=UTF-8"); goblinQueueBizIntegralDto.setUid(uid);
MultiValueMap<String, String> params = CollectionUtil.linkedMultiValueMapStringString(); goblinQueueBizIntegralDto.setScore(price);
params.add("score", price.intValue() + ""); goblinQueueBizIntegralDto.setContent(content);
params.add("content", "购买商品:"); goblinQueueBizIntegralDto.setType(type);
params.add("uid", uid); queueUtils.sendMsgByRedis(MQConst.GoblinQueue.BIZ_INTEGRAL.getKey(), goblinQueueBizIntegralDto.toJson());
String resultData = HttpUtil.post(stoneUrl + "/user/logs/in2111", params, header);
} catch (Exception e) {
log.error("添加积分失败,e:{}", e);
e.printStackTrace();
} }
} }
......
...@@ -8,7 +8,6 @@ import com.liquidnet.service.base.SqlMapping; ...@@ -8,7 +8,6 @@ import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.UserPathDto; import com.liquidnet.service.base.UserPathDto;
import com.liquidnet.service.base.constant.MQConst; import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst; import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.GoblinQueueBizArtworkGenDto;
import com.liquidnet.service.goblin.dto.vo.*; import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinNftOrder; import com.liquidnet.service.goblin.entity.GoblinNftOrder;
import com.liquidnet.service.goblin.param.GoblinNftOrderPayAgainParam; import com.liquidnet.service.goblin.param.GoblinNftOrderPayAgainParam;
...@@ -658,6 +657,8 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService { ...@@ -658,6 +657,8 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
}); });
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.GOBLIN_NFT_ORDER.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.GOBLIN_NFT_ORDER.getKey(),
SqlMapping.gets(sqls, sqlDataOrder)); SqlMapping.gets(sqls, sqlDataOrder));
// 加积分
goblinOrderUtils.integral(uid, orderVo.getPriceActual(), "购买数字藏品", 1);
// 处理订单退款和其他流程 // 处理订单退款和其他流程
if (Objects.equals(orderStatusOld, GoblinStatusConst.NftStatus.ORDER_STATUS_3.getValue())) {// 超时支付 退款 if (Objects.equals(orderStatusOld, GoblinStatusConst.NftStatus.ORDER_STATUS_3.getValue())) {// 超时支付 退款
log.info("Nft订单超时支付 param:[orderCode:{}]", orderCode); log.info("Nft订单超时支付 param:[orderCode:{}]", orderCode);
...@@ -673,8 +674,6 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService { ...@@ -673,8 +674,6 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
this.generateUserArtwork(orderVo); this.generateUserArtwork(orderVo);
// 增加销量 // 增加销量
goblinRedisUtils.incrSkuSaleCount(orderVo.getSpuId(), orderVo.getSkuId(), orderVo.getNum()); goblinRedisUtils.incrSkuSaleCount(orderVo.getSpuId(), orderVo.getSkuId(), orderVo.getNum());
// 加积分
goblinOrderUtils.doTask(uid, orderVo.getPriceActual());
} }
// 写入用户订单列表 因取消的订单不展示 所以放在这里 // 写入用户订单列表 因取消的订单不展示 所以放在这里
nftOrderUtils.addNftOrderList(uid, orderVo.getOrderId()); nftOrderUtils.addNftOrderList(uid, orderVo.getOrderId());
...@@ -740,7 +739,7 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService { ...@@ -740,7 +739,7 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.GOBLIN_NFT_ORDER.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.GOBLIN_NFT_ORDER.getKey(),
SqlMapping.gets(sqls, sqlsOrder, sqlsBackOrder)); SqlMapping.gets(sqls, sqlsOrder, sqlsBackOrder));
//减积分 //减积分
goblinOrderUtils.desTask(nftOrder.getUserId(), nftOrderRefundVo.getPrice()); goblinOrderUtils.integral(nftOrder.getUserId(), nftOrderRefundVo.getPrice(), "数字藏品退款", 2);
} else if (0 == status) { } else if (0 == status) {
log.info("NftRefundCallback: 支付平台返回状态为失败,编号{}", refundCallbackParam.getOrderRefundCode()); log.info("NftRefundCallback: 支付平台返回状态为失败,编号{}", refundCallbackParam.getOrderRefundCode());
return "fail"; return "fail";
......
...@@ -871,7 +871,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -871,7 +871,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
// } // }
//加分 //加分
if (orderUtils.noZhengzaiOrder(uid)) { if (orderUtils.noZhengzaiOrder(uid)) {
orderUtils.doTask(uid, priceActual); orderUtils.integral(uid, priceActual, "购买商品", 1);
} }
} }
return "success"; return "success";
...@@ -1029,7 +1029,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -1029,7 +1029,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.GOBLIN_STORE_ORDER_OPERA.getKey(), queueUtils.sendMsgByRedis(MQConst.GoblinQueue.GOBLIN_STORE_ORDER_OPERA.getKey(),
SqlMapping.gets(sqls, sqlsOrder, sqlsOrderSku, sqlsBackOrder)); SqlMapping.gets(sqls, sqlsOrder, sqlsOrderSku, sqlsBackOrder));
//减积分 //减积分
orderUtils.desTask(orderVo.getUserId(), backOrderVo.getRealBackPrice()); orderUtils.integral(orderVo.getUserId(), backOrderVo.getRealBackPrice(), "商品退款", 2);
} else if (0 == status) { } else if (0 == status) {
return "fail"; return "fail";
} }
...@@ -1153,7 +1153,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -1153,7 +1153,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
} }
//加分 //加分
if (orderUtils.noZhengzaiOrder(uid)) { if (orderUtils.noZhengzaiOrder(uid)) {
orderUtils.doTask(uid, priceActual); orderUtils.integral(uid, priceActual, "购买商品", 1);
} }
} else { } else {
// 业务处理失败 // 业务处理失败
......
...@@ -68,6 +68,8 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -68,6 +68,8 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
@Autowired @Autowired
private OrderUtils orderUtils; private OrderUtils orderUtils;
@Autowired @Autowired
GoblinOrderUtils goblinOrderUtils;
@Autowired
private MongoTemplate mongoTemplate; private MongoTemplate mongoTemplate;
@Autowired @Autowired
private MongoConverter mongoConverter; private MongoConverter mongoConverter;
...@@ -1032,7 +1034,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -1032,7 +1034,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
// log.info("下单消息模版错误",e); // log.info("下单消息模版错误",e);
// } // }
//加分 //加分
orderUtils.doTask(orderTicketData.getUserId(), orderTicketData.getPerformanceTitle(), orderTicketData.getPriceActual()); goblinOrderUtils.integral(orderTicketData.getUserId(), orderTicketData.getPriceActual(), "购买演出:".concat(orderTicketData.getPerformanceTitle()), 1);
// //
// innerService.reportO(orderTicketData, "摩登天空"); // innerService.reportO(orderTicketData, "摩登天空");
//大麦回调 //大麦回调
......
...@@ -10,6 +10,7 @@ import com.liquidnet.service.base.constant.MQConst; ...@@ -10,6 +10,7 @@ import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.candy.param.BackCouponParam; import com.liquidnet.service.candy.param.BackCouponParam;
import com.liquidnet.service.candy.vo.CandyUseResultVo; import com.liquidnet.service.candy.vo.CandyUseResultVo;
import com.liquidnet.service.goblin.constant.GoblinStatusConst; import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.GoblinQueueBizIntegralDto;
import com.liquidnet.service.goblin.dto.vo.*; import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinBackOrder; import com.liquidnet.service.goblin.entity.GoblinBackOrder;
import com.liquidnet.service.goblin.entity.GoblinBackOrderLog; import com.liquidnet.service.goblin.entity.GoblinBackOrderLog;
...@@ -30,12 +31,8 @@ import java.util.List; ...@@ -30,12 +31,8 @@ import java.util.List;
@Slf4j @Slf4j
public class GoblinOrderUtils { public class GoblinOrderUtils {
@Value("${liquidnet.service.adam.url}")
private String adamUrl;
@Value("${liquidnet.service.candy.url}") @Value("${liquidnet.service.candy.url}")
private String candyUrl; private String candyUrl;
@Value("${liquidnet.service.stone.url}")
private String stoneUrl;
@Value("${liquidnet.service.order.url-pay.goblinRefundUrl}") @Value("${liquidnet.service.order.url-pay.goblinRefundUrl}")
private String synUrl; private String synUrl;
@Value("${liquidnet.service.dragon.urls.refundApply}") @Value("${liquidnet.service.dragon.urls.refundApply}")
...@@ -212,33 +209,14 @@ public class GoblinOrderUtils { ...@@ -212,33 +209,14 @@ public class GoblinOrderUtils {
} }
} }
public void doTask(String uid, BigDecimal price) { public void integral(String uid, BigDecimal price, String content, int type) {
try { if (price.intValue() > 0) {
MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString(); GoblinQueueBizIntegralDto goblinQueueBizIntegralDto = GoblinQueueBizIntegralDto.getNew();
header.add("Accept", "application/json;charset=UTF-8"); goblinQueueBizIntegralDto.setUid(uid);
MultiValueMap<String, String> params = CollectionUtil.linkedMultiValueMapStringString(); goblinQueueBizIntegralDto.setScore(price);
params.add("score", price.intValue() + ""); goblinQueueBizIntegralDto.setContent(content);
params.add("content", "购买商品:"); goblinQueueBizIntegralDto.setType(type);
params.add("uid", uid); queueUtils.sendMsgByRedis(MQConst.GoblinQueue.BIZ_INTEGRAL.getKey(), goblinQueueBizIntegralDto.toJson());
String resultData = HttpUtil.post(stoneUrl + "/user/logs/in2111", params, header);
} catch (Exception e) {
log.error("添加积分失败,e:{}", e);
e.printStackTrace();
}
}
public void desTask(String uid, BigDecimal price) {
try {
MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString();
header.add("Accept", "application/json;charset=UTF-8");
MultiValueMap<String, String> params = CollectionUtil.linkedMultiValueMapStringString();
params.add("score", price.intValue() + "");
params.add("content", "购买商品:");
params.add("uid", uid);
String resultData = HttpUtil.post(stoneUrl + "/user/logs/de2111", params, header);
} catch (Exception e) {
log.error("添加积分失败,e:{}", e);
e.printStackTrace();
} }
} }
......
...@@ -152,21 +152,6 @@ public class OrderUtils { ...@@ -152,21 +152,6 @@ public class OrderUtils {
return surplusGeneral; return surplusGeneral;
} }
public void doTask(String uid, String title, BigDecimal price) {
try {
MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString();
header.add("Accept", "application/json;charset=UTF-8");
MultiValueMap<String, String> params = CollectionUtil.linkedMultiValueMapStringString();
params.add("score", price.intValue() + "");
params.add("content", "购买演出:" + title);
params.add("uid", uid);
String resultData = HttpUtil.post(stoneUrl + "/user/logs/in2111", params, header);
} catch (Exception e) {
log.error("添加积分失败,e:{}", e);
e.printStackTrace();
}
}
public AdamRscPolymer01Vo adamAddressEnterMember(String uid, String enterIds, String addressId) { public AdamRscPolymer01Vo adamAddressEnterMember(String uid, String enterIds, String addressId) {
try { try {
MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString(); MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString();
......
...@@ -3,21 +3,22 @@ package com.liquidnet.service.platform.service.refund; ...@@ -3,21 +3,22 @@ package com.liquidnet.service.platform.service.refund;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.liquidnet.commons.lang.util.*; import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.HttpUtil;
import com.liquidnet.service.base.UserPathDto; import com.liquidnet.service.base.UserPathDto;
import com.liquidnet.service.candy.param.BackCouponParam; import com.liquidnet.service.candy.param.BackCouponParam;
import com.liquidnet.service.feign.stone.api.FeignStoneIntegralClient;
import com.liquidnet.service.kylin.constant.KylinTableStatusConst; import com.liquidnet.service.kylin.constant.KylinTableStatusConst;
import com.liquidnet.service.kylin.dto.param.RefundCallbackParam; import com.liquidnet.service.kylin.dto.param.RefundCallbackParam;
import com.liquidnet.service.kylin.dto.param.ticketSystem.STRefundOrderParam; import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketEntitiesVo;
import com.liquidnet.service.kylin.dto.vo.mongo.*; import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo;
import com.liquidnet.service.kylin.dto.vo.returns.KylinOrderRefundsVo; import com.liquidnet.service.kylin.dto.vo.returns.KylinOrderRefundsVo;
import com.liquidnet.service.kylin.dto.vo.ticketSystem.RefundOrderVo; import com.liquidnet.service.kylin.dto.vo.ticketSystem.RefundOrderVo;
import com.liquidnet.service.kylin.entity.*; import com.liquidnet.service.kylin.entity.*;
import com.liquidnet.service.kylin.mapper.*; import com.liquidnet.service.kylin.mapper.*;
import com.liquidnet.service.platform.service.ticketSystem.ITicketSystemService;
import com.liquidnet.service.platform.utils.DataUtils; import com.liquidnet.service.platform.utils.DataUtils;
import com.liquidnet.service.platform.utils.GoblinRedisUtils;
import com.liquidnet.service.platform.utils.MongoVoUtils; import com.liquidnet.service.platform.utils.MongoVoUtils;
import com.mongodb.BasicDBObject; import com.mongodb.BasicDBObject;
import com.mongodb.client.result.UpdateResult; import com.mongodb.client.result.UpdateResult;
...@@ -30,7 +31,6 @@ import org.springframework.data.mongodb.core.convert.MongoConverter; ...@@ -30,7 +31,6 @@ import org.springframework.data.mongodb.core.convert.MongoConverter;
import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.MultiValueMap;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -82,10 +82,7 @@ public class KylinRefundsStatusServiceImpl { ...@@ -82,10 +82,7 @@ public class KylinRefundsStatusServiceImpl {
private MongoVoUtils mongoVoUtils; private MongoVoUtils mongoVoUtils;
@Autowired @Autowired
private FeignStoneIntegralClient feignStoneIntegralClient; private GoblinRedisUtils goblinRedisUtils;
@Autowired
private ITicketSystemService ticketSystemService;
@Value("${liquidnet.service.candy.url}") @Value("${liquidnet.service.candy.url}")
private String candyUrl; private String candyUrl;
...@@ -311,12 +308,7 @@ public class KylinRefundsStatusServiceImpl { ...@@ -311,12 +308,7 @@ public class KylinRefundsStatusServiceImpl {
}*/ }*/
} }
// 退积分 // 退积分
try { goblinRedisUtils.integral(orderInfo.getUserId(), refundCallbackParam.getRefundPrice(), "演出订单退款:".concat(orderInfo.getPerformanceTitle()).concat(":").concat(orderInfo.getOrderCode().substring(orderInfo.getOrderCode().length() - 10)), 2);
ResponseDto<String> de2111 = feignStoneIntegralClient.de2111(orderInfo.getUserId(), refundCallbackParam.getRefundPrice().setScale(0, BigDecimal.ROUND_DOWN).intValue(), "演出订单退款:".concat(orderInfo.getPerformanceTitle()).concat(":").concat(orderInfo.getOrderCode().substring(orderInfo.getOrderCode().length() - 10)));
log.info("订单退款回调退积分结果:[getCode={}, getData={}]", de2111.getCode(), de2111.getData());
} catch (Exception e) {
log.error("订单退款回调退积分异常:[refundId={}, errorMsg={}, e={}]", refundInfo.getRefundId(), e.getMessage(), e);
}
} }
return true; return true;
......
...@@ -5,7 +5,9 @@ import com.liquidnet.common.cache.redis.util.AbstractRedisUtil; ...@@ -5,7 +5,9 @@ import com.liquidnet.common.cache.redis.util.AbstractRedisUtil;
import com.liquidnet.common.cache.redis.util.RedisDataSourceUtil; import com.liquidnet.common.cache.redis.util.RedisDataSourceUtil;
import com.liquidnet.commons.lang.util.CollectionUtil; import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.JsonUtils; import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.goblin.constant.GoblinRedisConst; import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.dto.GoblinQueueBizIntegralDto;
import com.liquidnet.service.goblin.dto.GoblinStoreMarketDto; import com.liquidnet.service.goblin.dto.GoblinStoreMarketDto;
import com.liquidnet.service.goblin.dto.vo.GoblinOrderSkuVo; import com.liquidnet.service.goblin.dto.vo.GoblinOrderSkuVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreOrderVo; import com.liquidnet.service.goblin.dto.vo.GoblinStoreOrderVo;
...@@ -14,12 +16,16 @@ import org.springframework.stereotype.Component; ...@@ -14,12 +16,16 @@ import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
@Component @Component
public class GoblinRedisUtils { public class GoblinRedisUtils {
@Autowired @Autowired
private RedisDataSourceUtil redisDataSourceUtil; private RedisDataSourceUtil redisDataSourceUtil;
@Autowired
QueueUtils queueUtils;
public int randomMax = 10; public int randomMax = 10;
private AbstractRedisUtil getRedis() { private AbstractRedisUtil getRedis() {
...@@ -164,6 +170,17 @@ public class GoblinRedisUtils { ...@@ -164,6 +170,17 @@ public class GoblinRedisUtils {
} }
} }
public void integral(String uid, BigDecimal price, String content, int type) {
if (price.intValue() > 0) {
GoblinQueueBizIntegralDto goblinQueueBizIntegralDto = GoblinQueueBizIntegralDto.getNew();
goblinQueueBizIntegralDto.setUid(uid);
goblinQueueBizIntegralDto.setScore(price);
goblinQueueBizIntegralDto.setContent(content);
goblinQueueBizIntegralDto.setType(type);
queueUtils.sendMsgByGoblinRedis(MQConst.GoblinQueue.BIZ_INTEGRAL.getKey(), goblinQueueBizIntegralDto.toJson());
}
}
/* ---------------------------------------- ---------------------------------------- */ /* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */ /* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */ /* ---------------------------------------- ---------------------------------------- */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment