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

Commit 2aa46f40 authored by 张禹's avatar 张禹

Merge branch 'pre' into 'master'

Pre

See merge request !302
parents a39000b7 7e9644eb
...@@ -36,7 +36,7 @@ public class GoblinGagoController extends BaseController { ...@@ -36,7 +36,7 @@ public class GoblinGagoController extends BaseController {
RedisDataSourceUtil redisDataSourceUtil; RedisDataSourceUtil redisDataSourceUtil;
@Autowired @Autowired
GoblinRedisUtils goblinRedisUtils; GoblinRedisUtils goblinRedisUtils;
@Value("${liquidnet.service.order.url}") @Value("${liquidnet.service.order.url}")
private String orderUrl; private String orderUrl;
// private String orderUrl = "http://127.0.0.1:9004/order"; // private String orderUrl = "http://127.0.0.1:9004/order";
...@@ -75,6 +75,7 @@ public class GoblinGagoController extends BaseController { ...@@ -75,6 +75,7 @@ public class GoblinGagoController extends BaseController {
public AjaxResult listByStatus(@RequestParam(value = "skuId") String skuId, @RequestParam(value = "nftNum") int nftNum, @RequestParam(value = "uid") String uid) { public AjaxResult listByStatus(@RequestParam(value = "skuId") String skuId, @RequestParam(value = "nftNum") int nftNum, @RequestParam(value = "uid") String uid) {
//当前 nft序号 //当前 nft序号
GoblinGoodsSkuInfoVo skuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(skuId); GoblinGoodsSkuInfoVo skuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(skuId);
String routeType = skuInfoVo.getRouteType();
int cNufCount = goblinRedisUtils.getNftCountBySku(skuInfoVo.getRouteType(), skuId); int cNufCount = goblinRedisUtils.getNftCountBySku(skuInfoVo.getRouteType(), skuId);
if (cNufCount >= nftNum) { if (cNufCount >= nftNum) {
return AjaxResult.error("该序号已售卖"); return AjaxResult.error("该序号已售卖");
...@@ -90,9 +91,9 @@ public class GoblinGagoController extends BaseController { ...@@ -90,9 +91,9 @@ public class GoblinGagoController extends BaseController {
return AjaxResult.error("该序号已被占用"); return AjaxResult.error("该序号已被占用");
} }
// //
int count = goblinRedisUtils.decrSkuStock(null,skuId,1); int count = goblinRedisUtils.decrSkuStock(null, skuId, 1);
if(count<0){ if (count < 0) {
goblinRedisUtils.incrSkuStock(null,skuId,1); goblinRedisUtils.incrSkuStock(null, skuId, 1);
goblinRedisUtils.removeNftList(skuId, nftNum + ""); goblinRedisUtils.removeNftList(skuId, nftNum + "");
return AjaxResult.error("已售罄"); return AjaxResult.error("已售罄");
} }
...@@ -113,6 +114,7 @@ public class GoblinGagoController extends BaseController { ...@@ -113,6 +114,7 @@ public class GoblinGagoController extends BaseController {
dto.setNftOrderPayId(innerReturnVo.getData()); dto.setNftOrderPayId(innerReturnVo.getData());
dto.setSkuId(skuId); dto.setSkuId(skuId);
dto.setUserId(uid); dto.setUserId(uid);
dto.setRouterType(routeType);
goblinRedisUtils.setNftNumDetails(nftNum + "", skuId, dto); goblinRedisUtils.setNftNumDetails(nftNum + "", skuId, dto);
return AjaxResult.success(); return AjaxResult.success();
} else { } else {
......
...@@ -8,12 +8,13 @@ import com.liquidnet.service.galaxy.dto.bo.GalaxyNftOrderBindBo; ...@@ -8,12 +8,13 @@ import com.liquidnet.service.galaxy.dto.bo.GalaxyNftOrderBindBo;
import com.liquidnet.service.galaxy.dto.bo.GalaxySeriesNftInfoBo; import com.liquidnet.service.galaxy.dto.bo.GalaxySeriesNftInfoBo;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftPublishAndBuyReqDto; import com.liquidnet.service.galaxy.dto.param.GalaxyNftPublishAndBuyReqDto;
import com.liquidnet.service.galaxy.dto.param.GalaxyNftPublishAndBuyRespDto; import com.liquidnet.service.galaxy.dto.param.GalaxyNftPublishAndBuyRespDto;
import com.liquidnet.service.galaxy.router.zxin.biz.ZxinTradeCommonBiz; import com.liquidnet.service.galaxy.service.IGalaxyTradeService;
import com.liquidnet.service.galaxy.utils.GalaxyDataUtils; import com.liquidnet.service.galaxy.utils.GalaxyDataUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
...@@ -32,8 +33,8 @@ public class GalaxyTradeBiz { ...@@ -32,8 +33,8 @@ public class GalaxyTradeBiz {
@Autowired @Autowired
private GalaxyDataUtils dataUtils; private GalaxyDataUtils dataUtils;
@Autowired @Resource(name = "galaxyTradeServiceImpl")
private ZxinTradeCommonBiz zxinTradeCommonBiz; private IGalaxyTradeService galaxyTradeService;
/** /**
* 根据skuid和nftIndex判断是否切换nft购买订单 * 根据skuid和nftIndex判断是否切换nft购买订单
* @param skuid * @param skuid
...@@ -71,7 +72,7 @@ public class GalaxyTradeBiz { ...@@ -71,7 +72,7 @@ public class GalaxyTradeBiz {
//执行nft购买订单切换 //执行nft购买订单切换
log.info("开始执行nft购买订单切换===>>>>> reqParam:{}", JsonUtils.toJson(reqDto)); log.info("开始执行nft购买订单切换===>>>>> reqParam:{}", JsonUtils.toJson(reqDto));
ResponseDto<GalaxyNftPublishAndBuyRespDto> responseDto = zxinTradeCommonBiz.nftPublishAndBuy(reqDto); ResponseDto<GalaxyNftPublishAndBuyRespDto> responseDto = galaxyTradeService.nftPublishAndBuy(reqDto);
log.info("执行nft购买订单切换结果===>>>>> response:{}",JsonUtils.toJson(responseDto)); log.info("执行nft购买订单切换结果===>>>>> response:{}",JsonUtils.toJson(responseDto));
} }
} }
...@@ -13,6 +13,7 @@ import com.liquidnet.commons.lang.util.StringUtil; ...@@ -13,6 +13,7 @@ import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
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.biz.GalaxyTradeBiz;
import com.liquidnet.service.galaxy.constant.GalaxyEnum; import com.liquidnet.service.galaxy.constant.GalaxyEnum;
import com.liquidnet.service.galaxy.constant.GalaxyErrorEnum; import com.liquidnet.service.galaxy.constant.GalaxyErrorEnum;
import com.liquidnet.service.galaxy.dto.bo.GalaxyNftOrderBindBo; import com.liquidnet.service.galaxy.dto.bo.GalaxyNftOrderBindBo;
...@@ -30,6 +31,8 @@ import org.springframework.stereotype.Component; ...@@ -30,6 +31,8 @@ import org.springframework.stereotype.Component;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* @author AnJiabin <anjiabin@zhengzai.tv> * @author AnJiabin <anjiabin@zhengzai.tv>
...@@ -55,6 +58,11 @@ public class XuperTradeCommonBiz { ...@@ -55,6 +58,11 @@ public class XuperTradeCommonBiz {
@Autowired @Autowired
private GalaxyBeanTransferBiz galaxyBeanTransferBiz; private GalaxyBeanTransferBiz galaxyBeanTransferBiz;
@Autowired
private GalaxyTradeBiz galaxyTradeBiz;
private ExecutorService executorService = Executors.newFixedThreadPool(10);
/** /**
* 发行和购买 * 发行和购买
* @param reqDto * @param reqDto
...@@ -139,6 +147,17 @@ public class XuperTradeCommonBiz { ...@@ -139,6 +147,17 @@ public class XuperTradeCommonBiz {
//发行失败 //发行失败
throw new GalaxyNftPublishException(GalaxyErrorEnum.NFT_PUBLISH_ERROR.getCode(),"该sku:"+reqDto.getSkuId()+" 总共"+seriesNftInfoBo.getNftTotalCount()+"个NFT已经发行完毕,没有剩余库存!"); throw new GalaxyNftPublishException(GalaxyErrorEnum.NFT_PUBLISH_ERROR.getCode(),"该sku:"+reqDto.getSkuId()+" 总共"+seriesNftInfoBo.getNftTotalCount()+"个NFT已经发行完毕,没有剩余库存!");
} }
//判断是否切换订单
while(galaxyTradeBiz.isNeedSwitch(reqDto.getSkuId(),String.valueOf(nftIdNo))){
long finalNftIdNo = nftIdNo;
//开启新线程去执行购买
executorService.submit(() -> {
galaxyTradeBiz.switchBuyRouterBySkuId(reqDto.getSkuId(),String.valueOf(finalNftIdNo),seriesNftInfoBo);
});
nftIdNo = dataUtils.incrNftIdNo(reqDto.getRouterType(),reqDto.getSkuId());
}
nftOrderBindBo = GalaxyNftOrderBindBo.getNew(); nftOrderBindBo = GalaxyNftOrderBindBo.getNew();
nftOrderBindBo.setNftOrderPayId(reqDto.getNftOrderPayId()); nftOrderBindBo.setNftOrderPayId(reqDto.getNftOrderPayId());
nftOrderBindBo.setSeriesId(seriesNftInfoBo.getSeriesId()); nftOrderBindBo.setSeriesId(seriesNftInfoBo.getSeriesId());
......
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