记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
董敬伟
liquidnet-bus-v1
Commits
59eb7fa6
Commit
59eb7fa6
authored
Dec 09, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配置 文件 构建 订单同步量
同步订单脚本
parent
2d366b3c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
140 additions
and
96 deletions
+140
-96
CollectionUtil.java
.../java/com/liquidnet/commons/lang/util/CollectionUtil.java
+5
-0
AbstractRedisUtil.java
....liquidnet.common.cache/redis/util/AbstractRedisUtil.java
+9
-0
application-dev.yml
liquidnet-bus-config/liquidnet-config/application-dev.yml
+16
-14
application-test.yml
liquidnet-bus-config/liquidnet-config/application-test.yml
+2
-0
GoblinOrderUtils.java
...a/com/liquidnet/service/order/utils/GoblinOrderUtils.java
+4
-4
GoblinRedisUtils.java
...a/com/liquidnet/service/order/utils/GoblinRedisUtils.java
+1
-7
WdtServiceImpl.java
...net/service/platform/service/impl/erp/WdtServiceImpl.java
+91
-69
GoblinRedisUtils.java
...om/liquidnet/service/platform/utils/GoblinRedisUtils.java
+12
-2
No files found.
liquidnet-bus-common/liquidnet-common-base/src/main/java/com/liquidnet/commons/lang/util/CollectionUtil.java
View file @
59eb7fa6
...
...
@@ -23,6 +23,7 @@ public class CollectionUtil {
private
static
final
HashSet
<
String
>
STRING_ARRAY_SET
=
new
HashSet
<>();
private
static
final
ArrayList
<
Integer
>
INTEGER_ARRAY_LIST
=
new
ArrayList
<>();
private
static
final
ArrayList
<
Object
>
OBJECT_ARRAY_LIST
=
new
ArrayList
<>();
private
static
final
ArrayList
<
ArrayList
<
String
>>
LIST_ARRAY_LIST
=
new
ArrayList
<>();
private
static
final
ArrayList
<
BigDecimal
>
BIG_DECIMALS_ARRAY_LIST
=
new
ArrayList
<>();
private
static
final
ArrayList
<
BigDecimal
>
BIGDECIMAL_ARRAY_LIST
=
new
ArrayList
<>();
private
static
final
String
[]
STRING_ARRAY
=
new
String
[]{};
...
...
@@ -32,6 +33,10 @@ public class CollectionUtil {
return
STRING_ARRAY
.
clone
();
}
public
static
ArrayList
<
List
<
String
>>
arrayListListString
()
{
return
(
ArrayList
<
List
<
String
>>)
LIST_ARRAY_LIST
.
clone
();
}
public
static
List
<
HashMap
<
String
,
Object
>>
listMapStringObject
()
{
return
(
List
<
HashMap
<
String
,
Object
>>)
HASH_MAP_ARRAY_LIST
.
clone
();
}
...
...
liquidnet-bus-common/liquidnet-common-cache/liquidnet-common-cache-redis/src/main/java/com.liquidnet.common.cache/redis/util/AbstractRedisUtil.java
View file @
59eb7fa6
...
...
@@ -804,6 +804,15 @@ public abstract class AbstractRedisUtil {
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
size
(
key
);
}
/**
* list 长度
* @param key
*/
public
List
<
Object
>
getRange
(
String
key
)
{
key
=
this
.
fillingKey
(
key
);
return
this
.
getRedisConfig
().
getRedisTemplateByDb
(
this
.
getIndex
(
key
)).
opsForList
().
range
(
key
,
0
,-
1
);
}
public
static
void
main
(
String
[]
args
)
{
String
[]
keys
=
{
...
...
liquidnet-bus-config/liquidnet-config/application-dev.yml
View file @
59eb7fa6
...
...
@@ -16,18 +16,18 @@ liquidnet:
urlHostAndPort
:
java-test.mysql.polardb.rds.aliyuncs.com:3306
username
:
zhengzai
password
:
Zhengzai@rd2U#
# rabbitmq:
# host: rabbitmq.zhengzai.tv
# port: 5672
# username: admin
# password: admin
# virtual-host: liquidnet
# adam:
# host: rabbitmq.zhengzai.tv
# port: 5672
# username: admin
# password: admin
# virtual-host: liquidnet
# rabbitmq:
# host: rabbitmq.zhengzai.tv
# port: 5672
# username: admin
# password: admin
# virtual-host: liquidnet
# adam:
# host: rabbitmq.zhengzai.tv
# port: 5672
# username: admin
# password: admin
# virtual-host: liquidnet
knife4j
:
disable
:
false
redis
:
...
...
@@ -108,7 +108,7 @@ liquidnet:
url
:
http://devorder.zhengzai.tv
url-pay
:
pay
:
http://devdragon.zhengzai.tv/dragon/pay/dragonPay
# applePay: http://devorder.zhengzai.tv/order/notify/apple/purchase
# applePay: http://devorder.zhengzai.tv/order/notify/apple/purchase
check
:
http://devdragon.zhengzai.tv/dragon/pay/checkOrder
localUrl
:
http://devorder.zhengzai.tv/order/order/syncOrder
goblinUrl
:
http://devorder.zhengzai.tv/goblin/order/pay/syncOrder
...
...
@@ -160,7 +160,7 @@ liquidnet:
addresses
:
39.107.71.112:8090
client
:
admin
:
# phpPayUrl: http://devorder.zhengzai.tv
# phpPayUrl: http://devorder.zhengzai.tv
phpMallUrl
:
https://devmall.zhengzai.tv
platformUrl
:
https://devplatform.zhengzai.tv
h5Url
:
https://devm.zhengzai.tv
...
...
@@ -257,6 +257,8 @@ liquidnet:
shop_no
:
mdtk2-test
warehouse_no
:
mdtk2-test
platform_id
:
127
contentSize
:
5
redisSize
:
255
#application-dev-end
\ No newline at end of file
liquidnet-bus-config/liquidnet-config/application-test.yml
View file @
59eb7fa6
...
...
@@ -257,5 +257,7 @@ liquidnet:
shop_no
:
mdtk2-test
warehouse_no
:
mdtk2-test
platform_id
:
127
contentSize
:
5
redisSize
:
255
#application-test-end
\ No newline at end of file
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/utils/GoblinOrderUtils.java
View file @
59eb7fa6
...
...
@@ -39,6 +39,10 @@ public class GoblinOrderUtils {
private
String
candyUrl
;
@Value
(
"${liquidnet.service.order.url-pay.goblinRefundUrl}"
)
private
String
synUrl
;
@Value
(
"${liquidnet.erp.wdt.contentSize}"
)
private
int
contentSize
;
@Value
(
"${liquidnet.erp.wdt.redisSize}"
)
private
int
redisSize
;
@Autowired
private
IDragonOrderRefundsService
dragonOrderRefundsService
;
...
...
@@ -554,16 +558,12 @@ public class GoblinOrderUtils {
public
void
addErpPush
(
String
orderId
,
int
erpHosting
)
{
int
contentSize
=
5
;
int
redisSize
=
255
;
if
(
erpHosting
==
0
)
{
}
else
{
for
(
int
i
=
0
;
i
<
redisSize
;
i
++)
{
// log.error("i:{},add:{}",i,orderId);
boolean
isFull
=
redisUtils
.
erpAddPush
(
i
,
orderId
)
>
contentSize
;
if
(
isFull
)
{
redisUtils
.
erpPopPush
(
i
);
// log.error("i:{},remove:{}",i,redisUtils.erpPopPush(i));
}
else
{
break
;
}
...
...
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/utils/GoblinRedisUtils.java
View file @
59eb7fa6
...
...
@@ -742,15 +742,9 @@ public class GoblinRedisUtils {
return
(
int
)
redisUtil
.
rightPush
(
rdk
,
orderId
);
}
//
添加
erp订单
//
移除
erp订单
public
String
erpPopPush
(
int
index
)
{
String
rdk
=
GoblinRedisConst
.
ERP_GOBLIN_GOODS_LIST
.
concat
(
index
+
""
);
return
(
String
)
redisUtil
.
rightPop
(
rdk
);
}
//获取erp订单长度
public
int
erpPushSize
(
int
index
)
{
String
rdk
=
GoblinRedisConst
.
ERP_GOBLIN_GOODS_LIST
.
concat
(
index
+
""
);
return
(
int
)
redisUtil
.
listSize
(
rdk
);
}
}
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/service/impl/erp/WdtServiceImpl.java
View file @
59eb7fa6
...
...
@@ -30,6 +30,7 @@ import com.liquidnet.service.platform.utils.QueueUtils;
import
com.mongodb.BasicDBObject
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.convert.MongoConverter
;
import
org.springframework.data.mongodb.core.query.Criteria
;
...
...
@@ -64,6 +65,12 @@ public class WdtServiceImpl implements IGoblinErpService {
MongoConverter
mongoConverter
;
@Autowired
QueueUtils
queueUtils
;
@Value
(
"${liquidnet.erp.wdt.contentSize}"
)
private
int
contentSize
;
@Value
(
"${liquidnet.erp.wdt.redisSize}"
)
private
int
redisSize
;
@Value
(
"${liquidnet.erp.wdt.store.shop_no}"
)
private
String
shopNo
;
@Override
public
ResponseDto
<
Boolean
>
initErpStock
(
String
spuId
,
int
min
)
{
...
...
@@ -166,79 +173,94 @@ public class WdtServiceImpl implements IGoblinErpService {
@Override
public
ResponseDto
<
Boolean
>
pushTrade
(
String
order
Id
)
{
public
ResponseDto
<
Boolean
>
pushTrade
(
String
single
Id
)
{
List
<
TradeListParam
>
listOrder
=
ErpObjectUtil
.
tradeListParam
();
TradeListParam
tradeListParam
=
TradeListParam
.
getNew
();
GoblinStoreOrderVo
orderVo
=
goblinRedisUtils
.
getGoblinOrder
(
orderId
);
List
<
String
>
orderSkuIds
=
orderVo
.
getOrderSkuVoIds
();
List
<
OrderListParam
>
listOrderSku
=
ErpObjectUtil
.
orderListParam
();
String
warehouseNo
=
""
;
int
erpHosting
=
0
;
//配置sku维度数据
for
(
String
orderSkuId
:
orderSkuIds
)
{
OrderListParam
orderSkuParam
=
OrderListParam
.
getNew
();
GoblinOrderSkuVo
orderSkuVo
=
goblinRedisUtils
.
getGoblinOrderSkuVo
(
orderSkuId
);
if
(
orderSkuVo
.
getErpHosting
()
==
1
&&
orderSkuVo
.
getStatus
()
==
GoblinStatusConst
.
Status
.
ORDER_STATUS_2
.
getValue
())
{
erpHosting
=
1
;
}
else
{
continue
;
List
<
List
<
String
>>
orderIdList
=
CollectionUtil
.
arrayListListString
();
// 获取 订单id 数据
if
(
""
.
equals
(
singleId
)
||
null
==
singleId
)
{
for
(
int
i
=
0
;
i
<
redisSize
;
i
++)
{
List
<
String
>
list
=
goblinRedisUtils
.
getRange
(
i
);
orderIdList
.
add
(
list
);
}
orderSkuParam
.
setOid
(
orderSkuVo
.
getOrderSkuId
());
orderSkuParam
.
setNum
(
BigDecimal
.
valueOf
(
orderSkuVo
.
getNum
()));
orderSkuParam
.
setPrice
(
orderSkuVo
.
getSkuPrice
());
orderSkuParam
.
setStatus
(
ErpEnum
.
WdtStatus
.
STATUS_UN_SEND
.
WdtStatus
());
orderSkuParam
.
setRefund_status
(
0
);
orderSkuParam
.
setGoods_id
(
orderSkuVo
.
getSpuId
());
orderSkuParam
.
setSpec_id
(
orderSkuVo
.
getSkuId
());
orderSkuParam
.
setGoods_no
(
orderSkuVo
.
getSpuErpCode
());
orderSkuParam
.
setSpec_no
(
orderSkuVo
.
getSkuErpCode
());
orderSkuParam
.
setGoods_name
(
orderSkuVo
.
getSpuName
());
orderSkuParam
.
setAdjust_amount
(
BigDecimal
.
ZERO
);
orderSkuParam
.
setDiscount
(
BigDecimal
.
ZERO
);
orderSkuParam
.
setShare_discount
(
orderSkuVo
.
getPriceVoucher
());
warehouseNo
=
orderSkuVo
.
getErpWarehouseNo
();
listOrderSku
.
add
(
orderSkuParam
);
}
//配置订单维度数据
tradeListParam
.
setOrder_list
(
listOrderSku
);
tradeListParam
.
setTid
(
orderVo
.
getOrderCode
());
tradeListParam
.
setTrade_status
(
ErpEnum
.
WdtStatus
.
STATUS_UN_SEND
.
WdtStatus
());
tradeListParam
.
setPay_status
(
2
);
tradeListParam
.
setDelivery_term
(
1
);
tradeListParam
.
setTrade_time
(
orderVo
.
getCreatedAt
());
tradeListParam
.
setPay_time
(
orderVo
.
getPayTime
());
tradeListParam
.
setBuyer_nick
(
orderVo
.
getUserName
());
tradeListParam
.
setPay_id
(
orderVo
.
getPayCode
());
tradeListParam
.
setReceiver_name
(
orderVo
.
getOrderAttrVo
().
getExpressContacts
());
String
[]
address
=
orderVo
.
getOrderAttrVo
().
getExpressAddress
().
split
(
" "
);
if
(
address
.
length
>
0
)
{
tradeListParam
.
setReceiver_province
(
address
[
0
]);
}
if
(
address
.
length
>
1
)
{
tradeListParam
.
setReceiver_city
(
address
[
1
]);
}
if
(
address
.
length
>
2
)
{
tradeListParam
.
setReceiver_district
(
address
[
2
]);
}
tradeListParam
.
setReceiver_address
(
orderVo
.
getOrderAttrVo
().
getExpressAddress
());
tradeListParam
.
setReceiver_mobile
(
orderVo
.
getOrderAttrVo
().
getExpressPhone
());
tradeListParam
.
setPost_amount
(
orderVo
.
getPriceExpress
());
tradeListParam
.
setExt_cod_fee
(
BigDecimal
.
ZERO
);
tradeListParam
.
setOther_amount
(
BigDecimal
.
ZERO
);
tradeListParam
.
setPaid
(
orderVo
.
getPriceActual
());
tradeListParam
.
setWarehouse_no
(
warehouseNo
);
if
(
erpHosting
==
1
)
{
listOrder
.
add
(
tradeListParam
);
}
else
{
List
<
String
>
a
=
CollectionUtil
.
arrayListString
();
a
.
add
(
singleId
);
orderIdList
.
add
(
a
);
}
//执行同步订单
Map
<
String
,
String
>
param
=
CollectionUtil
.
linkMapStringString
();
param
.
put
(
"shop_no"
,
"mdtk2-test"
);
param
.
put
(
"trade_list"
,
JSON
.
toJSONString
(
listOrder
));
String
json
=
erpWdtClient
.
execute
(
ErpEnum
.
WdtAPI
.
TRADE_PUSH
.
getUri
(),
param
);
TradePushVo
data
=
JsonUtils
.
fromJson
(
json
,
TradePushVo
.
class
);
//同步订单
for
(
List
<
String
>
b
:
orderIdList
)
{
for
(
String
orderId
:
b
)
{
TradeListParam
tradeListParam
=
TradeListParam
.
getNew
();
GoblinStoreOrderVo
orderVo
=
goblinRedisUtils
.
getGoblinOrder
(
orderId
);
List
<
String
>
orderSkuIds
=
orderVo
.
getOrderSkuVoIds
();
List
<
OrderListParam
>
listOrderSku
=
ErpObjectUtil
.
orderListParam
();
String
warehouseNo
=
""
;
int
erpHosting
=
0
;
//配置sku维度数据
for
(
String
orderSkuId
:
orderSkuIds
)
{
OrderListParam
orderSkuParam
=
OrderListParam
.
getNew
();
GoblinOrderSkuVo
orderSkuVo
=
goblinRedisUtils
.
getGoblinOrderSkuVo
(
orderSkuId
);
if
(
orderSkuVo
.
getErpHosting
()
==
1
&&
orderSkuVo
.
getStatus
()
==
GoblinStatusConst
.
Status
.
ORDER_STATUS_2
.
getValue
())
{
erpHosting
=
1
;
}
else
{
continue
;
}
orderSkuParam
.
setOid
(
orderSkuVo
.
getOrderSkuId
());
orderSkuParam
.
setNum
(
BigDecimal
.
valueOf
(
orderSkuVo
.
getNum
()));
orderSkuParam
.
setPrice
(
orderSkuVo
.
getSkuPrice
());
orderSkuParam
.
setStatus
(
ErpEnum
.
WdtStatus
.
STATUS_UN_SEND
.
WdtStatus
());
orderSkuParam
.
setRefund_status
(
0
);
orderSkuParam
.
setGoods_id
(
orderSkuVo
.
getSpuId
());
orderSkuParam
.
setSpec_id
(
orderSkuVo
.
getSkuId
());
orderSkuParam
.
setGoods_no
(
orderSkuVo
.
getSpuErpCode
());
orderSkuParam
.
setSpec_no
(
orderSkuVo
.
getSkuErpCode
());
orderSkuParam
.
setGoods_name
(
orderSkuVo
.
getSpuName
());
orderSkuParam
.
setAdjust_amount
(
BigDecimal
.
ZERO
);
orderSkuParam
.
setDiscount
(
BigDecimal
.
ZERO
);
orderSkuParam
.
setShare_discount
(
orderSkuVo
.
getPriceVoucher
());
warehouseNo
=
orderSkuVo
.
getErpWarehouseNo
();
listOrderSku
.
add
(
orderSkuParam
);
}
//配置订单维度数据
tradeListParam
.
setOrder_list
(
listOrderSku
);
tradeListParam
.
setTid
(
orderVo
.
getOrderCode
());
tradeListParam
.
setTrade_status
(
ErpEnum
.
WdtStatus
.
STATUS_UN_SEND
.
WdtStatus
());
tradeListParam
.
setPay_status
(
2
);
tradeListParam
.
setDelivery_term
(
1
);
tradeListParam
.
setTrade_time
(
orderVo
.
getCreatedAt
());
tradeListParam
.
setPay_time
(
orderVo
.
getPayTime
());
tradeListParam
.
setBuyer_nick
(
orderVo
.
getUserName
());
tradeListParam
.
setPay_id
(
orderVo
.
getPayCode
());
tradeListParam
.
setReceiver_name
(
orderVo
.
getOrderAttrVo
().
getExpressContacts
());
String
[]
address
=
orderVo
.
getOrderAttrVo
().
getExpressAddress
().
split
(
" "
);
if
(
address
.
length
>
0
)
{
tradeListParam
.
setReceiver_province
(
address
[
0
]);
}
if
(
address
.
length
>
1
)
{
tradeListParam
.
setReceiver_city
(
address
[
1
]);
}
if
(
address
.
length
>
2
)
{
tradeListParam
.
setReceiver_district
(
address
[
2
]);
}
tradeListParam
.
setReceiver_address
(
orderVo
.
getOrderAttrVo
().
getExpressAddress
());
tradeListParam
.
setReceiver_mobile
(
orderVo
.
getOrderAttrVo
().
getExpressPhone
());
tradeListParam
.
setPost_amount
(
orderVo
.
getPriceExpress
());
tradeListParam
.
setExt_cod_fee
(
BigDecimal
.
ZERO
);
tradeListParam
.
setOther_amount
(
BigDecimal
.
ZERO
);
tradeListParam
.
setPaid
(
orderVo
.
getPriceActual
());
tradeListParam
.
setWarehouse_no
(
warehouseNo
);
if
(
erpHosting
==
1
)
{
listOrder
.
add
(
tradeListParam
);
}
}
//执行同步订单
Map
<
String
,
String
>
param
=
CollectionUtil
.
linkMapStringString
();
param
.
put
(
"shop_no"
,
shopNo
);
param
.
put
(
"trade_list"
,
JSON
.
toJSONString
(
listOrder
));
String
json
=
erpWdtClient
.
execute
(
ErpEnum
.
WdtAPI
.
TRADE_PUSH
.
getUri
(),
param
);
TradePushVo
data
=
JsonUtils
.
fromJson
(
json
,
TradePushVo
.
class
);
}
return
ResponseDto
.
success
();
}
}
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/utils/GoblinRedisUtils.java
View file @
59eb7fa6
package
com
.
liquidnet
.
service
.
platform
.
utils
;
import
com.alibaba.fastjson.JSON
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.liquidnet.common.cache.redis.util.AbstractRedisUtil
;
import
com.liquidnet.common.cache.redis.util.RedisDataSourceUtil
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
...
...
@@ -391,6 +389,18 @@ public class GoblinRedisUtils {
}
}
//移除erp订单
public
List
<
String
>
getRange
(
int
index
)
{
String
rdk
=
GoblinRedisConst
.
ERP_GOBLIN_GOODS_LIST
.
concat
(
index
+
""
);
List
<
Object
>
list
=
getRedis
().
getRange
(
rdk
);
List
<
String
>
data
=
CollectionUtil
.
arrayListString
();
for
(
Object
str
:
list
){
data
.
add
((
String
)
str
);
}
return
data
;
}
/* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */
...
...
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