Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mall-server
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yimu
mall-server
Commits
2789df0b
Commit
2789df0b
authored
Dec 24, 2021
by
wlx@33.cn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copy nft修正
parent
16103378
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
27 deletions
+25
-27
MALLGlobalConfig.java
.../com/fzm/mall/server/admin/constant/MALLGlobalConfig.java
+0
-10
SpuMapper.java
.../fzm/mall/server/admin/goods_center/mapper/SpuMapper.java
+2
-1
GoodsSkuUsufruct.java
...all/server/admin/goods_center/model/GoodsSkuUsufruct.java
+2
-1
IAssetService.java
...com/fzm/mall/server/admin/user/service/IAssetService.java
+1
-1
AssetServiceImpl.java
...mall/server/admin/user/service/impl/AssetServiceImpl.java
+18
-13
GoodsSkuUsufructMapper.xml
.../resources/mapper/goods_center/GoodsSkuUsufructMapper.xml
+1
-0
SpuMapper.xml
...dmin/src/main/resources/mapper/goods_center/SpuMapper.xml
+1
-1
No files found.
mall-server-admin/src/main/java/com/fzm/mall/server/admin/constant/MALLGlobalConfig.java
View file @
2789df0b
...
@@ -139,14 +139,4 @@ public class MALLGlobalConfig {
...
@@ -139,14 +139,4 @@ public class MALLGlobalConfig {
//NFT 前缀
//NFT 前缀
public
static
final
String
NFT_PREFIX
=
"NFT-"
;
public
static
final
String
NFT_PREFIX
=
"NFT-"
;
/**
* 无效的序列号标识
*/
public
static
final
Integer
SERIAL_NO_INVALID
=
0
;
/**
* 有效的序列号标识
*/
public
static
final
Integer
SERIAL_NO_VALID
=
1
;
}
}
mall-server-admin/src/main/java/com/fzm/mall/server/admin/goods_center/mapper/SpuMapper.java
View file @
2789df0b
...
@@ -26,6 +26,7 @@ public interface SpuMapper extends BaseMapper<Spu> {
...
@@ -26,6 +26,7 @@ public interface SpuMapper extends BaseMapper<Spu> {
@Param
(
"spuStatusOnSale"
)
Integer
spuStatusOnSale
,
@Param
(
"spuStatusOnSale"
)
Integer
spuStatusOnSale
,
@Param
(
"goods"
)
String
goods
);
@Param
(
"goods"
)
String
goods
);
GoodsSpuVO
readByCoin
(
String
coin
);
GoodsSpuVO
readByCoin
(
@Param
(
"merchantId"
)
String
merchantId
,
@Param
(
"coin"
)
String
coin
);
}
}
mall-server-admin/src/main/java/com/fzm/mall/server/admin/goods_center/model/GoodsSkuUsufruct.java
View file @
2789df0b
...
@@ -41,5 +41,6 @@ public class GoodsSkuUsufruct implements Serializable {
...
@@ -41,5 +41,6 @@ public class GoodsSkuUsufruct implements Serializable {
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Long
updateTime
;
private
Long
updateTime
;
@ApiModelProperty
(
value
=
"卖家编号"
)
private
String
merchantId
;
}
}
mall-server-admin/src/main/java/com/fzm/mall/server/admin/user/service/IAssetService.java
View file @
2789df0b
...
@@ -33,5 +33,5 @@ public interface IAssetService extends IService<Asset> {
...
@@ -33,5 +33,5 @@ public interface IAssetService extends IService<Asset> {
*/
*/
void
integralDeduction
(
String
oid
,
String
uid
,
BigDecimal
amount
,
String
merchantId
,
List
<
OrderDetail
>
orderDetailList
,
Boolean
isApproved
);
void
integralDeduction
(
String
oid
,
String
uid
,
BigDecimal
amount
,
String
merchantId
,
List
<
OrderDetail
>
orderDetailList
,
Boolean
isApproved
);
void
refundCoinOnChain
(
int
tableType
,
String
tableId
,
String
coin
,
int
number
,
String
serialNo
,
String
fromAddr
,
String
toAddr
);
void
refundCoinOnChain
(
int
tableType
,
String
tableId
,
String
merchantId
,
String
coin
,
int
number
,
String
serialNo
,
String
fromAddr
,
String
toAddr
);
}
}
mall-server-admin/src/main/java/com/fzm/mall/server/admin/user/service/impl/AssetServiceImpl.java
View file @
2789df0b
...
@@ -36,6 +36,9 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -36,6 +36,9 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -105,9 +108,9 @@ public class AssetServiceImpl extends ServiceImpl<AssetMapper, Asset> implements
...
@@ -105,9 +108,9 @@ public class AssetServiceImpl extends ServiceImpl<AssetMapper, Asset> implements
}
}
@Override
@Override
public
void
refundCoinOnChain
(
int
tableType
,
String
tableId
,
String
coin
,
int
number
,
String
serialNo
,
String
fromAddr
,
String
toAddr
)
{
public
void
refundCoinOnChain
(
int
tableType
,
String
tableId
,
String
merchantId
,
String
coin
,
int
number
,
String
serialNo
,
String
fromAddr
,
String
toAddr
)
{
//判断商品是否为NFT
//判断商品是否为NFT
GoodsSpuVO
goodsSpu
=
spuMapper
.
readByCoin
(
coin
);
GoodsSpuVO
goodsSpu
=
spuMapper
.
readByCoin
(
merchantId
,
coin
);
goodsSpu
.
initTokenId
();
goodsSpu
.
initTokenId
();
boolean
isSalesNFTCopy
=
goodsSpu
.
getNftSalesType
().
equals
(
Spu
.
NFT_SALES_TYPE_COPY
);
boolean
isSalesNFTCopy
=
goodsSpu
.
getNftSalesType
().
equals
(
Spu
.
NFT_SALES_TYPE_COPY
);
...
@@ -121,7 +124,7 @@ public class AssetServiceImpl extends ServiceImpl<AssetMapper, Asset> implements
...
@@ -121,7 +124,7 @@ public class AssetServiceImpl extends ServiceImpl<AssetMapper, Asset> implements
*/
*/
List
<
Integer
>
serialNoList
=
JSON
.
parseArray
(
serialNo
,
int
.
class
);
List
<
Integer
>
serialNoList
=
JSON
.
parseArray
(
serialNo
,
int
.
class
);
if
(
updateSkuSerialNo
){
if
(
updateSkuSerialNo
){
updateSkuSerialNo
(
serialNoList
,
coin
,
isSalesNFTCopy
);
updateSkuSerialNo
(
serialNoList
,
merchantId
,
coin
,
isSalesNFTCopy
);
}
}
//根据开关判断是否走链,默认不走链
//根据开关判断是否走链,默认不走链
if
(
payInChain
)
{
if
(
payInChain
)
{
...
@@ -130,7 +133,7 @@ public class AssetServiceImpl extends ServiceImpl<AssetMapper, Asset> implements
...
@@ -130,7 +133,7 @@ public class AssetServiceImpl extends ServiceImpl<AssetMapper, Asset> implements
*/
*/
if
(
isSalesNFTCopy
){
if
(
isSalesNFTCopy
){
serialNoList
.
forEach
(
index
->
{
serialNoList
.
forEach
(
index
->
{
Long
tokenId
=
Long
.
valueOf
(
goodsSpu
.
getTokenIdStr
()
+
index
);
Long
tokenId
=
Long
.
valueOf
(
index
);
payInChain
(
tableType
,
tableId
,
fromAddr
,
toAddr
,
coin
,
1
,
tokenId
,
commodityPassAuto
,
isSalesNFTCopy
);
payInChain
(
tableType
,
tableId
,
fromAddr
,
toAddr
,
coin
,
1
,
tokenId
,
commodityPassAuto
,
isSalesNFTCopy
);
});
});
}
else
{
}
else
{
...
@@ -208,7 +211,7 @@ public class AssetServiceImpl extends ServiceImpl<AssetMapper, Asset> implements
...
@@ -208,7 +211,7 @@ public class AssetServiceImpl extends ServiceImpl<AssetMapper, Asset> implements
if
(
update
==
0
)
{
if
(
update
==
0
)
{
throw
new
MyException
(
MallResponseError
.
UPDATE_FAIL
);
throw
new
MyException
(
MallResponseError
.
UPDATE_FAIL
);
}
}
refundCoinOnChain
(
TranDto
.
TABLE_TYPE_ORDER_INFO
,
orderDetail
.
getOid
(),
orderDetail
.
getCoin
(),
orderDetail
.
getNumber
(),
orderDetail
.
getSerialNo
(),
user
.
getAddress
(),
merchant
.
getTokenIssueAddr
());
refundCoinOnChain
(
TranDto
.
TABLE_TYPE_ORDER_INFO
,
orderDetail
.
getOid
(),
merchantId
,
orderDetail
.
getCoin
(),
orderDetail
.
getNumber
(),
orderDetail
.
getSerialNo
(),
user
.
getAddress
(),
merchant
.
getTokenIssueAddr
());
});
});
}
else
{
}
else
{
orderDetailList
.
forEach
(
orderDetail
->
{
orderDetailList
.
forEach
(
orderDetail
->
{
...
@@ -241,13 +244,11 @@ public class AssetServiceImpl extends ServiceImpl<AssetMapper, Asset> implements
...
@@ -241,13 +244,11 @@ public class AssetServiceImpl extends ServiceImpl<AssetMapper, Asset> implements
tranDto
.
setTableId
(
tableId
);
tranDto
.
setTableId
(
tableId
);
tranDto
.
setTableType
(
tableType
);
tranDto
.
setTableType
(
tableType
);
String
hash
;
String
hash
;
boolean
doEvmExec
=
true
;
/**
/**
*
商品为外部导入或者NFT销售类型为“原商品销售”,用外部NFT转账合约
*
一幕所有的nft都是内部nft
*/
*/
if
(
commodityPassAuto
||
isSalesNFTCopy
)
{
doEvmExec
=
false
;
boolean
doEvmExec
=
false
;
}
if
(
doEvmExec
)
{
if
(
doEvmExec
)
{
long
[]
tokenIds
=
new
long
[]{
tokenId
};
long
[]
tokenIds
=
new
long
[]{
tokenId
};
long
[]
amounts
=
new
long
[]{
tranDto
.
getAmount
().
longValue
()};
long
[]
amounts
=
new
long
[]{
tranDto
.
getAmount
().
longValue
()};
...
@@ -268,15 +269,17 @@ public class AssetServiceImpl extends ServiceImpl<AssetMapper, Asset> implements
...
@@ -268,15 +269,17 @@ public class AssetServiceImpl extends ServiceImpl<AssetMapper, Asset> implements
* 商品为“使用权”时,退款和退货,需要重置已使用的编号
* 商品为“使用权”时,退款和退货,需要重置已使用的编号
*
*
* @param serialNoList
* @param serialNoList
* @param merchantId
* @param coin
* @param coin
* @param isSalesNFTCopy
* @param isSalesNFTCopy
*/
*/
private
void
updateSkuSerialNo
(
List
<
Integer
>
serialNoList
,
String
coin
,
boolean
isSalesNFTCopy
)
{
private
void
updateSkuSerialNo
(
List
<
Integer
>
serialNoList
,
String
merchantId
,
String
coin
,
boolean
isSalesNFTCopy
)
{
if
(!
isSalesNFTCopy
||
CollectionUtils
.
isEmpty
(
serialNoList
))
{
if
(!
isSalesNFTCopy
||
CollectionUtils
.
isEmpty
(
serialNoList
))
{
return
;
return
;
}
}
QueryWrapper
<
GoodsSkuUsufruct
>
queryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
GoodsSkuUsufruct
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"prefix"
,
coin
);
queryWrapper
.
eq
(
"prefix"
,
coin
)
.
eq
(
"merchant_id"
,
merchantId
);
GoodsSkuUsufruct
skuUsufruct
=
goodsSkuUsufructMapper
.
selectOne
(
queryWrapper
);
GoodsSkuUsufruct
skuUsufruct
=
goodsSkuUsufructMapper
.
selectOne
(
queryWrapper
);
if
(
skuUsufruct
==
null
)
{
if
(
skuUsufruct
==
null
)
{
return
;
return
;
...
@@ -284,12 +287,14 @@ public class AssetServiceImpl extends ServiceImpl<AssetMapper, Asset> implements
...
@@ -284,12 +287,14 @@ public class AssetServiceImpl extends ServiceImpl<AssetMapper, Asset> implements
List
<
Integer
>
dataSerialNoList
=
JSON
.
parseArray
(
skuUsufruct
.
getSerialNo
(),
int
.
class
);
List
<
Integer
>
dataSerialNoList
=
JSON
.
parseArray
(
skuUsufruct
.
getSerialNo
(),
int
.
class
);
serialNoList
.
forEach
(
index
->
{
serialNoList
.
forEach
(
index
->
{
dataSerialNoList
.
set
(
index
,
MALLGlobalConfig
.
SERIAL_NO_VALID
);
dataSerialNoList
.
add
(
index
);
});
});
Collections
.
sort
(
dataSerialNoList
,
Comparator
.
naturalOrder
());
skuUsufruct
.
setSerialNo
(
JSON
.
toJSONString
(
dataSerialNoList
));
skuUsufruct
.
setSerialNo
(
JSON
.
toJSONString
(
dataSerialNoList
));
UpdateWrapper
<
GoodsSkuUsufruct
>
updateWrapper
=
new
UpdateWrapper
<>();
UpdateWrapper
<
GoodsSkuUsufruct
>
updateWrapper
=
new
UpdateWrapper
<>();
updateWrapper
.
eq
(
"prefix"
,
coin
)
updateWrapper
.
eq
(
"prefix"
,
coin
)
.
eq
(
"merchant_id"
,
merchantId
)
.
eq
(
"update_time"
,
skuUsufruct
.
getUpdateTime
());
.
eq
(
"update_time"
,
skuUsufruct
.
getUpdateTime
());
int
update
=
goodsSkuUsufructMapper
.
update
(
skuUsufruct
,
updateWrapper
);
int
update
=
goodsSkuUsufructMapper
.
update
(
skuUsufruct
,
updateWrapper
);
...
...
mall-server-admin/src/main/resources/mapper/goods_center/GoodsSkuUsufructMapper.xml
View file @
2789df0b
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
<id
column=
"id"
property=
"id"
/>
<id
column=
"id"
property=
"id"
/>
<result
column=
"prefix"
property=
"prefix"
/>
<result
column=
"prefix"
property=
"prefix"
/>
<result
column=
"serial_no"
property=
"serialNo"
/>
<result
column=
"serial_no"
property=
"serialNo"
/>
<result
column=
"merchant_id"
property=
"merchantId"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
</resultMap>
</resultMap>
...
...
mall-server-admin/src/main/resources/mapper/goods_center/SpuMapper.xml
View file @
2789df0b
...
@@ -136,6 +136,6 @@
...
@@ -136,6 +136,6 @@
left join goods_nft n on sp.commodity_pass = 1 and sp.type = 6 and sp.goods_id = n.goods_id
left join goods_nft n on sp.commodity_pass = 1 and sp.type = 6 and sp.goods_id = n.goods_id
left join external_token t on sp.commodity_pass = 2 and s.commodity_pass_id = t.commodity_pass_id
left join external_token t on sp.commodity_pass = 2 and s.commodity_pass_id = t.commodity_pass_id
where s.status = 1
where s.status = 1
and s.coin_name = #{coin}
and s.coin_name = #{coin}
and sp.merchant_id = #{merchantId}
</select>
</select>
</mapper>
</mapper>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment