Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
岳巧源
/
python_script
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d40100bc
authored
Aug 05, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
script
parent
dbebea74
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
4 deletions
element_14_data_process.py
waldom_data_process_RMB.py
waldom_data_process_USD.py
element_14_data_process.py
View file @
d40100bc
...
@@ -93,7 +93,8 @@ class HandleTxT:
...
@@ -93,7 +93,8 @@ class HandleTxT:
ladder_item
[
'price_cn'
]
=
float
(
str
(
row
[
j
+
1
])
.
strip
())
ladder_item
[
'price_cn'
]
=
float
(
str
(
row
[
j
+
1
])
.
strip
())
table
[
'ladder_price'
]
.
append
(
ladder_item
)
table
[
'ladder_price'
]
.
append
(
ladder_item
)
json_str
=
json
.
dumps
(
table
)
json_str
=
json
.
dumps
(
table
)
producer
.
push
(
json_str
)
if
len
(
str
(
table
[
'brand_name'
]))
!=
0
and
len
(
str
(
table
[
'goods_name'
]))
!=
0
:
producer
.
push
(
json_str
)
count_msg
+=
1
count_msg
+=
1
print
(
json_str
)
print
(
json_str
)
...
...
waldom_data_process_RMB.py
View file @
d40100bc
...
@@ -116,8 +116,9 @@ class HandleCSV:
...
@@ -116,8 +116,9 @@ class HandleCSV:
table
[
'stock'
]
=
str
(
table
[
'stock'
])
table
[
'stock'
]
=
str
(
table
[
'stock'
])
json_str
=
json
.
dumps
(
table
,
ensure_ascii
=
False
)
json_str
=
json
.
dumps
(
table
,
ensure_ascii
=
False
)
count_msg
+=
1
count_msg
+=
1
self
.
push_to_mq
(
json_str
)
if
len
(
str
(
table
[
'brand_name'
]))
!=
0
and
len
(
str
(
table
[
'goods_name'
]))
!=
0
:
print
(
json_str
)
self
.
push_to_mq
(
json_str
)
print
(
json_str
)
logger
.
info
(
"文件
%
s 已解析"
%
file_name
)
logger
.
info
(
"文件
%
s 已解析"
%
file_name
)
logger
.
info
(
"解析行数:
%
s"
%
str
(
count_msg
))
logger
.
info
(
"解析行数:
%
s"
%
str
(
count_msg
))
...
...
waldom_data_process_USD.py
View file @
d40100bc
...
@@ -51,7 +51,8 @@ class HandleCSV:
...
@@ -51,7 +51,8 @@ class HandleCSV:
return
[]
return
[]
else
:
else
:
json_str
=
self
.
generate_json
(
row
,
first_line
)
json_str
=
self
.
generate_json
(
row
,
first_line
)
self
.
push_to_mq
(
json_str
)
if
json_str
!=
""
and
len
(
json_str
)
!=
0
:
self
.
push_to_mq
(
json_str
)
print
(
json_str
)
print
(
json_str
)
count_msg
+=
1
count_msg
+=
1
logger
.
info
(
"文件
%
s 已解析"
%
path
)
logger
.
info
(
"文件
%
s 已解析"
%
path
)
...
@@ -119,6 +120,8 @@ class HandleCSV:
...
@@ -119,6 +120,8 @@ class HandleCSV:
table
[
'batch_sn'
]
=
batch_sn_map
table
[
'batch_sn'
]
=
batch_sn_map
# 统一字符串处理
# 统一字符串处理
table
[
'stock'
]
=
str
(
table
[
'stock'
])
table
[
'stock'
]
=
str
(
table
[
'stock'
])
if
len
(
str
(
table
[
'brand_name'
]))
==
0
or
len
(
str
(
table
[
'goods_name'
]))
==
0
:
return
""
return
json
.
dumps
(
table
,
ensure_ascii
=
False
)
return
json
.
dumps
(
table
,
ensure_ascii
=
False
)
def
push_to_mq
(
self
,
msg
:
str
):
def
push_to_mq
(
self
,
msg
:
str
):
...
...
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