Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
65dba53a
authored
2022-12-30 20:37:37 +0800
by
王聪
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fsm update
1 parent
4398d1df
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
1 deletions
src/apps/doc/consts.py
src/apps/doc/models.py
src/apps/doc/views.py
src/celery_compare/tasks.py
src/apps/doc/consts.py
View file @
65dba53
...
...
@@ -2378,3 +2378,5 @@ MPOS_MAP = {
}
FOLDER_WSC_CLASSIFY
=
199
APPLICANT_STATUS
=
...
...
src/apps/doc/models.py
View file @
65dba53
...
...
@@ -1042,3 +1042,59 @@ class AFCCompareReportNew(models.Model):
managed
=
False
db_table
=
'afc_compare_report_new'
situ_db_label
=
'afc'
invoice_code
=
content
.
get
(
'invoiceCode'
,
''
)
invoice_number
=
content
.
get
(
'invoiceNumber'
,
''
)
issue_date
=
content
.
get
(
'issueDate'
,
None
)
buyer_name
=
content
.
get
(
'buyerName'
,
''
)
buyer_id
=
content
.
get
(
'buyerId'
,
0
)
vin
=
content
.
get
(
'vin'
,
''
)
dealer
=
content
.
get
(
'dealer'
,
''
)
price_with_vat
=
content
.
get
(
'priceWithVat'
,
0.0
)
price_no_vat
=
content
.
get
(
'priceNoVat'
,
0.0
)
price_in_capitals
=
content
.
get
(
'priceInCapitals'
,
''
)
vat
=
content
.
get
(
'vat'
,
0.0
)
vat_rate
=
content
.
get
(
'vatRate'
,
0.0
)
class
AFCNscInvoice
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
True
,
verbose_name
=
"id"
)
# 主键
application_id
=
models
.
CharField
(
max_length
=
64
,
verbose_name
=
"申请id"
)
# 索引
content
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"nsc发票信息"
)
create_time
=
models
.
DateTimeField
(
verbose_name
=
'创建时间'
)
# 索引
invoice_code
=
models
.
CharField
(
max_length
=
64
,
verbose_name
=
"发票码"
)
issue_date
=
models
.
CharField
(
max_length
=
64
,
verbose_name
=
"开票日期"
)
buyer_name
=
models
.
CharField
(
max_length
=
64
,
verbose_name
=
"开票日期"
)
buyer_id
=
models
.
CharField
(
max_length
=
64
,
verbose_name
=
"开票日期"
)
vin
=
models
.
CharField
(
max_length
=
64
,
verbose_name
=
"开票日期"
)
dealer
=
models
.
CharField
(
max_length
=
64
,
verbose_name
=
"开票日期"
)
price_with_vat
=
models
.
CharField
(
max_length
=
64
,
verbose_name
=
"开票日期"
)
price_no_vat
=
models
.
CharField
(
max_length
=
64
,
verbose_name
=
"开票日期"
)
price_in_capitals
=
models
.
CharField
(
max_length
=
64
,
verbose_name
=
"开票日期"
)
vat
=
models
.
CharField
(
max_length
=
64
,
verbose_name
=
"开票日期"
)
vat_rate
=
models
.
CharField
(
max_length
=
64
,
verbose_name
=
"开票日期"
)
is_se
=
models
.
BooleanField
(
default
=
True
,
verbose_name
=
"是否Settlement"
)
is_auto
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
"是否Settlement Auto"
)
is_pass
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
"是否全对"
)
full_result
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"完整比对结果"
)
field_result
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"各证件字段统计"
)
start_time
=
models
.
DateTimeField
(
verbose_name
=
'开始时间'
)
# 索引
end_time
=
models
.
DateTimeField
(
verbose_name
=
'结束时间'
)
class
Meta
:
managed
=
False
db_table
=
'afc_nsc_invoice'
situ_db_label
=
'afc'
class
HILNscInvoice
(
models
.
Model
):
class
Meta
:
managed
=
False
db_table
=
'hil_nsc_invoice'
situ_db_label
=
'hil'
...
...
src/apps/doc/views.py
View file @
65dba53
...
...
@@ -53,7 +53,7 @@ from .named_enum import ErrorType, AutoResult, WholeResult, RPAResult, SystemNam
from
.mixins
import
DocHandler
,
MPOSHandler
,
PreSEHandler
from
.
import
consts
from
apps.account.authentication
import
OAuth2AuthenticationWithUser
from
celery_compare.tasks
import
compare
from
celery_compare.tasks
import
compare
,
fsm_compare
import
time
class
CustomDate
(
fields
.
Date
):
...
...
@@ -563,6 +563,8 @@ class UploadDocView(GenericView, DocHandler):
document
=
args
.
get
(
'document'
)
business_type
=
document
.
get
(
'businessType'
)
application_id
=
application_data
.
get
(
'applicationId'
)
# 包含FSM 激活状态
application_status
=
application_data
.
get
(
'applicationStatus'
,
''
)
document_scheme
=
document
.
get
(
'documentScheme'
)
data_source
=
document
.
get
(
'dataSource'
)
document_name
=
document
.
get
(
'documentName'
,
''
)
...
...
@@ -1363,6 +1365,15 @@ class SECMSView(GenericView):
content
=
content_str
,
)
# 检查是否fsm流程(SE)
fsm_contract
=
cms_info
.
get
(
'fsmContract'
,
False
)
fsm_best_price
=
cms_info
.
get
(
'fsmBestPrice'
,
False
)
if
fsm_contract
:
fsm_compare
.
apply_async
((
application_id
,
business_type
,
None
,
None
,
False
,
True
),
queue
=
'queue_compare'
)
# compare.apply_async((application_id, business_type, None, None, False, True),
# queue='queue_compare')
else
:
# 触发比对
compare
.
apply_async
((
application_id
,
business_type
,
None
,
None
,
False
,
True
),
queue
=
'queue_compare'
)
...
...
src/celery_compare/tasks.py
View file @
65dba53
...
...
@@ -3266,6 +3266,23 @@ def se_compare(application_id, application_entity, ocr_res_id, last_obj, ocr_res
@app.task
def
fsm_compare
(
application_id
,
application_entity
,
uniq_seq
,
ocr_res_id
,
is_ca
=
True
,
is_cms
=
False
):
# 调用java fsm 比对流程接口(http)
if
application_entity
==
consts
.
HIL_PREFIX
:
comparison_class
=
HILSECMSInfo
if
is_cms
else
HILSEComparisonInfo
else
:
comparison_class
=
AFCSECMSInfo
if
is_cms
else
AFCSEComparisonInfo
last_obj
=
comparison_class
.
objects
.
filter
(
application_id
=
application_id
)
.
last
()
if
last_obj
is
None
:
compare_log
.
info
(
'{0} [comparison info empty] [entity={1}] [id={2}] [uniq_seq={3}] [ocr_res_id={4}] '
'[is_ca={5}] [is_cms]={6}'
.
format
(
log_base
,
application_entity
,
application_id
,
uniq_seq
,
ocr_res_id
,
is_ca
,
is_cms
))
return
# 调用Java fsm 比对流程接口, fsm 是se流程, ca可以暂时忽略
@app.task
def
compare
(
application_id
,
application_entity
,
uniq_seq
,
ocr_res_id
,
is_ca
=
True
,
is_cms
=
False
):
# POS: application_id, application_entity, uniq_seq, None
# OCR: application_id, business_type(application_entity), None, ocr_res_id
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment