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
9cf5b8b8
Commit
9cf5b8b8
authored
Dec 29, 2021
by
秦兴亮
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://gitlab.33.cn/yimu/mall-server
into dev
parents
01567e9d
3f86abba
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
8 deletions
+16
-8
UserAssetController.java
...ll/server/front/asset/controller/UserAssetController.java
+0
-2
UserAssetServiceImpl.java
...server/front/asset/service/impl/UserAssetServiceImpl.java
+3
-1
UserAssetTransferRecordServiceImpl.java
...sset/service/impl/UserAssetTransferRecordServiceImpl.java
+4
-2
UserAssetTransferConsumer.java
...l/server/front/mq/consumer/UserAssetTransferConsumer.java
+4
-3
TranDto.java
...ava/com/fzm/mall/server/front/order/model/po/TranDto.java
+5
-0
No files found.
mall-server-front/src/main/java/com/fzm/mall/server/front/asset/controller/UserAssetController.java
View file @
9cf5b8b8
...
...
@@ -86,9 +86,7 @@ public class UserAssetController {
public
ResponseVO
<
UserAssetVo
>
getOwnAsset
(
@ApiParam
(
name
=
"coin"
,
value
=
"币名称"
)
@RequestBody
JSONObject
obj
,
@ApiIgnore
@RequestAttribute
Header
header
)
{
String
uid
=
header
.
getUid
();
String
coin
=
obj
.
getString
(
"coin"
);
SkuVo
skuVo
=
skuService
.
querySkuByCoin
(
coin
);
UserAssetVo
userAssetVo
=
userAssetService
.
getOwnAsset
(
uid
,
coin
);
userAssetVo
.
setSkuVo
(
skuVo
);
User
user
=
userService
.
getByUid
(
uid
);
userAssetVo
.
setAddress
(
user
.
getAddress
());
return
new
ResponseVO
<>(
MallResponseEnum
.
SUCCESS
,
userAssetVo
);
...
...
mall-server-front/src/main/java/com/fzm/mall/server/front/asset/service/impl/UserAssetServiceImpl.java
View file @
9cf5b8b8
...
...
@@ -131,7 +131,8 @@ public class UserAssetServiceImpl extends ServiceImpl<UserAssetMapper, UserAsset
asset
.
setAmount
(
asset
.
getAmount
().
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
));
asset
.
setFrozen
(
asset
.
getFrozen
().
setScale
(
2
,
BigDecimal
.
ROUND_DOWN
));
BeanUtils
.
copyProperties
(
asset
,
userAssetVo
);
SkuVo
skuVo
=
skuService
.
querySkuByCoin
(
asset
.
getCoin
());
String
goodsCoin
=
asset
.
getGoodsCoin
();
SkuVo
skuVo
=
skuService
.
querySkuByCoin
(
goodsCoin
);
if
(
skuVo
!=
null
)
{
String
goodsId
=
skuVo
.
getGoodsId
();
GoodSpu
goodSpu
=
goodSpuService
.
goodSpu
(
goodsId
);
...
...
@@ -143,6 +144,7 @@ public class UserAssetServiceImpl extends ServiceImpl<UserAssetMapper, UserAsset
if
(
sysConfig
!=
null
)
{
userAssetVo
.
setLogo
(
sysConfig
.
getDictValue
());
}
userAssetVo
.
setSkuVo
(
skuVo
);
}
return
userAssetVo
;
}
...
...
mall-server-front/src/main/java/com/fzm/mall/server/front/asset/service/impl/UserAssetTransferRecordServiceImpl.java
View file @
9cf5b8b8
...
...
@@ -96,7 +96,7 @@ public class UserAssetTransferRecordServiceImpl extends ServiceImpl<UserAssetTra
/**
* 链上转账
*/
transferInChain
(
user
.
getAddress
(),
record
.
getCoin
(),
record
.
getToAddress
(),
record
.
getNum
(),
record
.
getTransferRecordId
(),
hash
,
tokenId
);
transferInChain
(
user
.
getAddress
(),
record
.
getCoin
(),
record
.
getToAddress
(),
record
.
getNum
(),
record
.
getTransferRecordId
(),
hash
,
tokenId
,
sku
.
getCoinName
()
);
}
}
...
...
@@ -127,7 +127,7 @@ public class UserAssetTransferRecordServiceImpl extends ServiceImpl<UserAssetTra
* @param toAddress
* @param num
*/
private
void
transferInChain
(
String
fromAddress
,
String
coin
,
String
toAddress
,
Integer
num
,
String
transferRecordId
,
String
hash
,
Long
tokenId
)
{
private
void
transferInChain
(
String
fromAddress
,
String
coin
,
String
toAddress
,
Integer
num
,
String
transferRecordId
,
String
hash
,
Long
tokenId
,
String
goodsCoin
)
{
/**
* 如果配置为不走链,则不操作链上资产
*/
...
...
@@ -144,6 +144,8 @@ public class UserAssetTransferRecordServiceImpl extends ServiceImpl<UserAssetTra
tranDto
.
setTableType
(
TranDto
.
USER_ASSET_TRANSFER
);
tranDto
.
setHash
(
hash
);
tranDto
.
setTokenId
(
tokenId
);
tranDto
.
setGoodsCoin
(
goodsCoin
);
tranDto
.
setCoinType
(
TranDto
.
COIN_TYPE_NFT_IN
);
producer
.
sendTTL
(
JSON
.
toJSONString
(
tranDto
),
QueueTTLTypeEnum
.
MALL_USER_ASSET_TRANSFER_TTL
,
5
*
1000
);
}
...
...
mall-server-front/src/main/java/com/fzm/mall/server/front/mq/consumer/UserAssetTransferConsumer.java
View file @
9cf5b8b8
...
...
@@ -141,7 +141,7 @@ public class UserAssetTransferConsumer {
* 成功:增加接收方的资产
* 失败:不做任何操作
*/
updateReciverAsset
(
transferRecord
,
successed
);
updateReciverAsset
(
transferRecord
,
successed
,
tranDto
.
getGoodsCoin
()
);
/**
* 转赠流水记录
...
...
@@ -176,7 +176,7 @@ public class UserAssetTransferConsumer {
private
String
getHash
(
TranDto
tranDto
)
{
String
hash
;
if
(
tranDto
.
getCoinType
().
equals
(
TranDto
.
COIN_TYPE_NFT_
IN
))
{
if
(
tranDto
.
getCoinType
().
equals
(
TranDto
.
COIN_TYPE_NFT_
OUT
))
{
long
[]
tokenIds
=
new
long
[]{
tranDto
.
getTokenId
()};
long
[]
amounts
=
new
long
[]{
tranDto
.
getAmount
().
longValue
()};
hash
=
chainUtil
.
evmExec
(
tokenIds
,
amounts
,
tranDto
.
getFromAddr
(),
tranDto
.
getToAddr
());
...
...
@@ -217,7 +217,7 @@ public class UserAssetTransferConsumer {
}
}
private
void
updateReciverAsset
(
UserAssetTransferRecord
transferRecord
,
boolean
successed
)
{
private
void
updateReciverAsset
(
UserAssetTransferRecord
transferRecord
,
boolean
successed
,
String
goodsCoin
)
{
if
(!
successed
)
{
return
;
}
...
...
@@ -232,6 +232,7 @@ public class UserAssetTransferConsumer {
receiveAsset
.
setUid
(
transferRecord
.
getToUid
());
receiveAsset
.
setType
(
1
);
receiveAsset
.
setAmount
(
reNumber
);
receiveAsset
.
setGoodsCoin
(
goodsCoin
);
boolean
reSave
=
userAssetService
.
save
(
receiveAsset
);
if
(!
reSave
)
{
log
.
error
(
"save asset fail, uid:"
+
receiveAsset
.
getUid
()
+
"coin:"
+
receiveAsset
.
getCoin
());
...
...
mall-server-front/src/main/java/com/fzm/mall/server/front/order/model/po/TranDto.java
View file @
9cf5b8b8
...
...
@@ -58,4 +58,9 @@ public class TranDto {
* 1.外部nft;2.内部nft;3.内部普通
*/
private
Integer
coinType
;
/**
* 复制的nft商品币前缀(原外部NFT)
*/
private
String
goodsCoin
;
}
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