Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
0f2086a6
Commit
0f2086a6
authored
Apr 23, 2020
by
huangjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hj
parent
18345b62
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
entprofile/service/Dataoper.py
+13
-5
entprofile/service/trade.py
+5
-4
No files found.
entprofile/service/Dataoper.py
View file @
0f2086a6
...
...
@@ -3,11 +3,17 @@
from
dao.Dataoper_dao
import
DataoperDao
from
db.mod_db
import
DataBase
import
time
class
Datao
:
def
Getdata
(
self
,
cate_name
):
def
Getdata
(
self
,
cate_name
,
establishment_time
):
try
:
Dataoper
=
DataoperDao
()
# 将时间戳转化为年
struct_time
=
time
.
localtime
(
establishment_time
)
# 得到结构化时间格式
establishment_time
=
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
,
struct_time
)
.
split
(
'-'
)[
0
]
establishment_time
=
int
(
establishment_time
)
print
(
establishment_time
,
"======establishment_time"
)
re1
=
Dataoper
.
select_sql_1
(
cate_name
)
if
re1
:
list
=
[]
...
...
@@ -15,8 +21,10 @@ class Datao:
if
ree
:
policy_name
=
ree
[
"policy_name"
]
life_cycle
=
ree
[
"life_cycle"
]
life_cycle
=
int
(
life_cycle
)
life_year
=
establishment_time
+
life_cycle
dict
=
{}
dict
[
policy_name
]
=
life_
cycle
dict
[
policy_name
]
=
life_
year
list
.
append
(
dict
)
return
1
,
list
...
...
@@ -29,6 +37,7 @@ class Datao:
DataInfo
.
close
()
return
-
1
,
{}
def
InsertData
(
self
,
datainfo
):
# 数据库连接
try
:
...
...
@@ -62,6 +71,4 @@ if __name__ == "__main__":
DataoInfo
=
Datao
()
re1
,
re2
=
DataoInfo
.
Getdata
(
cate_name
)
print
(
str
(
re1
))
print
(
str
(
re2
))
print
(
str
(
re2
))
\ No newline at end of file
entprofile/service/trade.py
View file @
0f2086a6
...
...
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
from
flask
import
request
import
json
import
Dataoper
from
Dataoper
import
Datao
from
dao.trade_es
import
trade_Es
...
...
@@ -18,8 +18,8 @@ def selectcyle(server):
company_cate_2
=
searched
[
"hits"
][
"hits"
][
0
][
'_source'
][
"gsb_company_cate_2"
]
# 行业第二大类
company_cate_3
=
searched
[
"hits"
][
"hits"
][
0
][
'_source'
][
"gsb_company_cate_3"
]
# 行业第三大类
establishment_time
=
searched
[
"hits"
][
"hits"
][
0
][
'_source'
][
"estibish_time"
]
# 成立时间
re1
,
re2
=
Dataoper
.
Getdata
(
company_cate_1
,
establishment_time
)
DataoperInfo
=
Datao
()
re1
,
re2
=
Dataoper
Info
.
Getdata
(
company_cate_1
,
establishment_time
)
if
re1
:
return
json
.
dumps
({
"status"
:
0
,
"msg"
:
"操作成功"
,
"data"
:
re2
},
ensure_ascii
=
False
)
else
:
...
...
@@ -35,7 +35,8 @@ def insertcycle(server):
try
:
data
=
request
.
get_json
()
.
get
(
"data"
)
print
(
data
)
re1
=
Dataoper
.
InsertData
(
data
)
DataoperInfo
=
Datao
()
re1
=
DataoperInfo
.
InsertData
(
data
)
if
re1
:
return
json
.
dumps
({
"status"
:
0
,
"msg"
:
"成功"
,
"data"
:
re1
},
ensure_ascii
=
False
)
else
:
...
...
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