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
a1504767
authored
2023-01-05 20:51:20 +0800
by
王聪
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fsm update
1 parent
65dba53a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
16 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 @
a150476
...
...
@@ -2379,4 +2379,25 @@ MPOS_MAP = {
FOLDER_WSC_CLASSIFY
=
199
APPLICANT_STATUS
=
FSM_BEFORE_ACTIVITED_STATUS
=
{
"APSVD"
:
"Saved"
,
"APEAE"
:
"E-app Editing"
,
"APADA"
:
"Awaiting Dealer Action"
,
"APAPR"
:
"Acceptance Processing"
,
"APPSB"
:
"Pre-submit Processed"
,
"APSBT"
:
"Submitted"
,
"APAPP"
:
"Approved"
,
"APHOC"
:
"Held Offer-Docs"
,
"APHOD"
:
"Held Offer-Data"
,
"APINI"
:
"Initiated"
,
"APSEP"
:
"Settlement Processing"
}
FSM_ACTIVITED_STATUS
=
{
"APADF"
:
"Activated-Document Follow up"
,
"APASC"
:
"Activated-Awaiting Settlement Check"
,
"APIPN"
:
"Activated-Invoice Passed-Non PT"
,
"APIPP"
:
"Activated-Invoice Passed-PT Doc Required"
,
"APARD"
:
"Activated-Review done"
,
}
\ No newline at end of file
...
...
src/apps/doc/models.py
View file @
a150476
...
...
@@ -330,6 +330,11 @@ class AFCOCRResult(models.Model):
hil_contract_3_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"HIL合同3"
)
qrs_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"AFC合同确认书"
)
fsm_wep_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"延长保修合同"
)
fsm_msi_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"长悦保养合同"
)
fsm_sc_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"汽车销售合同"
)
fsm_activited
=
models
.
IntegerField
(
null
=
False
,
default
=
0
,
verbose_name
=
"fsm激活状态 1:激活"
)
update_time
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
'修改时间'
)
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
...
...
@@ -366,6 +371,11 @@ class HILOCRResult(models.Model):
hil_contract_3_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"HIL合同3"
)
qrs_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"AFC合同确认书"
)
fsm_wep_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"延长保修合同"
)
fsm_msi_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"长悦保养合同"
)
fsm_sc_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"汽车销售合同"
)
fsm_activited
=
models
.
IntegerField
(
null
=
False
,
default
=
0
,
verbose_name
=
"fsm激活状态 1:激活"
)
update_time
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
'修改时间'
)
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
...
...
@@ -401,6 +411,11 @@ class AFCSEOCRResult(models.Model):
hil_contract_3_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"HIL合同3"
)
qrs_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"AFC合同确认书"
)
fsm_wep_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"延长保修合同"
)
fsm_msi_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"长悦保养合同"
)
fsm_sc_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"汽车销售合同"
)
fsm_activited
=
models
.
IntegerField
(
null
=
False
,
default
=
0
,
verbose_name
=
"fsm激活状态 1:激活"
)
update_time
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
'修改时间'
)
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
...
...
@@ -436,6 +451,10 @@ class HILSEOCRResult(models.Model):
hil_contract_2_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"HIL合同2"
)
hil_contract_3_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"HIL合同3"
)
qrs_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"AFC合同确认书"
)
fsm_wep_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"延长保修合同"
)
fsm_msi_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"长悦保养合同"
)
fsm_sc_ocr
=
models
.
TextField
(
null
=
True
,
verbose_name
=
"汽车销售合同"
)
fsm_activited
=
models
.
IntegerField
(
null
=
False
,
default
=
0
,
verbose_name
=
"fsm激活状态 1:激活"
)
update_time
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
'修改时间'
)
create_time
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'创建时间'
)
...
...
src/apps/doc/views.py
View file @
a150476
...
...
@@ -48,8 +48,12 @@ from .models import (
MposReport
,
GenericOCRReport
,
InterfaceReport
,
HILOCRResult
,
HILSEOCRResult
,
AFCOCRResult
,
AFCSEOCRResult
)
from
.named_enum
import
ErrorType
,
AutoResult
,
WholeResult
,
RPAResult
,
SystemName
from
.named_enum
import
ErrorType
,
AutoResult
,
WholeResult
,
RPAResult
,
SystemName
,
RequestTeam
from
.mixins
import
DocHandler
,
MPOSHandler
,
PreSEHandler
from
.
import
consts
from
apps.account.authentication
import
OAuth2AuthenticationWithUser
...
...
@@ -572,7 +576,25 @@ class UploadDocView(GenericView, DocHandler):
data_source
=
self
.
fix_data_source
(
data_source
)
document_scheme
=
self
.
fix_scheme
(
document_scheme
)
# fsm激活状态, 更新ocr_result 表fsm状态
if
consts
.
FSM_ACTIVITED_STATUS
.
get
(
application_status
):
ocr_result_obj
=
None
if
business_type
==
consts
.
HIL_PREFIX
:
if
document_scheme
==
RequestTeam
.
ACCEPTANCE
[
1
]:
ocr_result_obj
=
HILOCRResult
.
objects
.
filter
(
application_id
=
application_id
)
.
first
()
elif
document_scheme
==
RequestTeam
.
SETTLEMENT
[
1
]:
ocr_result_obj
=
HILSEOCRResult
.
objects
.
filter
(
application_id
=
application_id
)
.
first
()
elif
business_type
==
consts
.
AFC_PREFIX
:
if
document_scheme
==
RequestTeam
.
ACCEPTANCE
[
1
]:
ocr_result_obj
=
AFCOCRResult
.
objects
.
filter
(
application_id
=
application_id
)
.
first
()
elif
document_scheme
==
RequestTeam
.
SETTLEMENT
[
1
]:
ocr_result_obj
=
AFCSEOCRResult
.
objects
.
filter
(
application_id
=
application_id
)
.
first
()
if
ocr_result_obj
:
ocr_result_obj
.
fsmActivited
=
1
ocr_result_obj
.
save
()
if
data_source
==
consts
.
DATA_SOURCE_LIST
[
1
]:
if
document_name
.
endswith
(
'-证书.pdf'
)
or
document_name
.
endswith
(
'-证书'
):
self
.
running_log
.
info
(
'[doc upload success] [eapp license skip] [args={0}]'
.
format
(
args
))
...
...
@@ -1371,8 +1393,7 @@ class SECMSView(GenericView):
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
),
...
...
src/celery_compare/tasks.py
View file @
a150476
...
...
@@ -7,6 +7,9 @@ import traceback
import
numpy
as
np
from
datetime
import
datetime
,
timedelta
from
collections
import
OrderedDict
import
requests
from
.
import
app
from
settings
import
conf
from
apps.doc.models
import
(
...
...
@@ -3267,19 +3270,25 @@ 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
):
compare_log
.
info
(
'{0} [receive fsm task] [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
))
# 调用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可以暂时忽略
url
=
conf
.
FSM_URL
body
=
{
'applicationId'
:
application_id
,
'businessType'
:
application_entity
,
'ocrResId'
:
ocr_res_id
,
'isCa'
:
is_ca
,
'isCms'
:
is_cms
}
try
:
resp
=
requests
.
post
(
url
,
data
=
body
)
compare_log
.
info
(
resp
.
text
)
except
Exception
as
e
:
compare_log
.
error
(
"fsm full request to java error, url:{0}, param:{1}, errorMsg:{2}"
.
format
(
url
,
json
.
dumps
(
body
),
traceback
.
format_exc
()))
@app.task
...
...
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