Commit bad9bb7f authored by 秦兴亮's avatar 秦兴亮

nft拷贝加锁

parent d2cbb35d
...@@ -49,4 +49,5 @@ public class orderCloseCousumer { ...@@ -49,4 +49,5 @@ public class orderCloseCousumer {
pay.setState(2); pay.setState(2);
payService.updateById(pay); payService.updateById(pay);
} }
} }
...@@ -38,6 +38,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -38,6 +38,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.mall.server.front.redis.OrderRedis; import com.fzm.mall.server.front.redis.OrderRedis;
import com.fzm.mall.server.front.repository.RedisRepository; import com.fzm.mall.server.front.repository.RedisRepository;
import com.fzm.mall.server.front.user.model.User; import com.fzm.mall.server.front.user.model.User;
import com.fzm.mall.server.front.user.service.IRedisService;
import com.fzm.mall.server.front.user.service.IUserService; import com.fzm.mall.server.front.user.service.IUserService;
import com.fzm.mall.server.front.util.ChainUtil; import com.fzm.mall.server.front.util.ChainUtil;
import com.fzm.mall.server.front.util.OrderUtil; import com.fzm.mall.server.front.util.OrderUtil;
...@@ -96,6 +97,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -96,6 +97,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
private final IUserService userService; private final IUserService userService;
private final INftService nftService; private final INftService nftService;
private final ISpuService ispuService; private final ISpuService ispuService;
private final IRedisService redisService;
@Autowired @Autowired
private ChainUtil chainUtil; private ChainUtil chainUtil;
...@@ -331,6 +333,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -331,6 +333,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
if(commodity == 3){ if(commodity == 3){
int saleType = spuService.getNftSalesType(orderSkuVo.getSkuId()); int saleType = spuService.getNftSalesType(orderSkuVo.getSkuId());
if(saleType == 2){ if(saleType == 2){
while (!redisService.setNx("select"+skuVo.getCommodityPassId())){
}
String serialNo = skuService.getSerialNo(skuVo.getCommodityPassId()); String serialNo = skuService.getSerialNo(skuVo.getCommodityPassId());
List<Long> array = JSON.parseArray(serialNo, Long.class); List<Long> array = JSON.parseArray(serialNo, Long.class);
if(array.size()<orderSkuVo.getNum()){ if(array.size()<orderSkuVo.getNum()){
...@@ -348,6 +353,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -348,6 +353,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
} }
boolean remove = array.removeAll(list); boolean remove = array.removeAll(list);
skuService.updateSerialNo(JSON.toJSONString(array),skuVo.getCommodityPassId()); skuService.updateSerialNo(JSON.toJSONString(array),skuVo.getCommodityPassId());
redisService.del("select"+skuVo.getCommodityPassId());
orderDetail.setSerialNo(JSON.toJSONString(list)); orderDetail.setSerialNo(JSON.toJSONString(list));
} }
} }
...@@ -827,7 +833,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -827,7 +833,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
if (coin == null) { if (coin == null) {
coin = new UserAsset(); coin = new UserAsset();
coin.setCoin(o.toString()); coin.setCoin(o.toString());
coin.setAmount(new BigDecimal(orderDetail.getNumber())); coin.setAmount(new BigDecimal(1));
coin.setUid(order.getUid()); coin.setUid(order.getUid());
coin.setType(1); coin.setType(1);
coin.setGoodsCoin(orderDetail.getCoin()); coin.setGoodsCoin(orderDetail.getCoin());
...@@ -846,8 +852,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -846,8 +852,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
userAssetRecord.setNote(order.getOid()); userAssetRecord.setNote(order.getOid());
userAssetRecordService.save(userAssetRecord); userAssetRecordService.save(userAssetRecord);
//加销量 //加销量
countService.addSale(orderDetail.getGoodsId(), orderDetail.getNumber()); countService.addSale(orderDetail.getGoodsId(), 1);
goodSkuService.addSales(orderDetail.getSkuId(), orderDetail.getNumber()); goodSkuService.addSales(orderDetail.getSkuId(), 1);
//转币 //转币
TranDto tranDto = new TranDto(); TranDto tranDto = new TranDto();
tranDto.setId(userAssetRecord.getId()); tranDto.setId(userAssetRecord.getId());
...@@ -1086,7 +1092,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -1086,7 +1092,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
if (coin == null) { if (coin == null) {
coin = new UserAsset(); coin = new UserAsset();
coin.setCoin(o.toString()); coin.setCoin(o.toString());
coin.setAmount(new BigDecimal(orderDetail.getNumber())); coin.setAmount(new BigDecimal(1));
coin.setUid(order.getUid()); coin.setUid(order.getUid());
coin.setType(1); coin.setType(1);
coin.setGoodsCoin(orderDetail.getCoin()); coin.setGoodsCoin(orderDetail.getCoin());
...@@ -1105,8 +1111,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -1105,8 +1111,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
userAssetRecord.setNote(order.getOid()); userAssetRecord.setNote(order.getOid());
userAssetRecordService.save(userAssetRecord); userAssetRecordService.save(userAssetRecord);
//加销量 //加销量
countService.addSale(orderDetail.getGoodsId(), orderDetail.getNumber()); countService.addSale(orderDetail.getGoodsId(), 1);
goodSkuService.addSales(orderDetail.getSkuId(), orderDetail.getNumber()); goodSkuService.addSales(orderDetail.getSkuId(), 1);
//转币 //转币
TranDto tranDto = new TranDto(); TranDto tranDto = new TranDto();
tranDto.setId(userAssetRecord.getId()); tranDto.setId(userAssetRecord.getId());
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2514,6 +2514,7 @@ CREATE TABLE `goods_sku_usufruct` ( ...@@ -2514,6 +2514,7 @@ CREATE TABLE `goods_sku_usufruct` (
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='使用权'; ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='使用权';
ADD COLUMN `param` varchar(500) NOT NULL DEFAULT '' COMMENT '功能区跳转参数';
ALTER TABLE `order_detail` ALTER TABLE `order_detail`
ADD COLUMN `serial_no` JSON NULL DEFAULT NULL COMMENT '序列号' ; ADD COLUMN `serial_no` JSON NULL DEFAULT NULL COMMENT '序列号' ;
...@@ -2522,5 +2523,4 @@ ALTER TABLE `order_detail` ...@@ -2522,5 +2523,4 @@ ALTER TABLE `order_detail`
ADD COLUMN `goods_coin` VARCHAR(32) NOT NULL DEFAULT '0' COMMENT '商品coin' ; ADD COLUMN `goods_coin` VARCHAR(32) NOT NULL DEFAULT '0' COMMENT '商品coin' ;
update user_asset set goods_coin = coin; update user_asset set goods_coin = coin;
ALTER TABLE `user_asset_record` ADD COLUMN `goods_coin` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商品coin'; ALTER TABLE `user_asset_record` ADD COLUMN `goods_coin` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商品coin';
\ No newline at end of file
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