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
97c05708
Commit
97c05708
authored
Sep 02, 2020
by
王悦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init zhiquanquan
parent
18e35fcb
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
1549 additions
and
3 deletions
+1549
-3
gsb-marketplat/app/base/api/impl/transfer/tradeApi.js
+121
-0
gsb-marketplat/app/base/controller/impl/transfer/notarizationflowCtl.js
+41
-0
gsb-marketplat/app/base/controller/impl/transfer/tmjsonfileCtl.js
+53
-0
gsb-marketplat/app/base/controller/impl/transfer/tradetransferCtl.js
+128
-0
gsb-marketplat/app/base/db/basemodel/voucherbase.js
+1
-1
gsb-marketplat/app/base/db/impl/transfer/notarizationflowDao.js
+8
-0
gsb-marketplat/app/base/db/impl/transfer/tmjsonfileDao.js
+8
-0
gsb-marketplat/app/base/db/impl/transfer/tradetransferDao.js
+8
-0
gsb-marketplat/app/base/db/metadata/app/platform.js
+63
-0
gsb-marketplat/app/base/db/models/transfer/notarizationflow.js
+118
-0
gsb-marketplat/app/base/db/models/transfer/tmjsonfile.js
+24
-0
gsb-marketplat/app/base/db/models/transfer/tradetransfer.js
+107
-0
gsb-marketplat/app/base/service/impl/common/appSve.js
+1
-1
gsb-marketplat/app/base/service/impl/transfer/notarizationflowSve.js
+198
-0
gsb-marketplat/app/base/service/impl/transfer/tmjsonfileSve.js
+93
-0
gsb-marketplat/app/base/service/impl/transfer/tradetransferSve.js
+555
-0
gsb-marketplat/app/config/settings.js
+22
-1
No files found.
gsb-marketplat/app/base/api/impl/transfer/tradeApi.js
0 → 100644
View file @
97c05708
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
const
Client
=
require
(
'aliyun-api-gateway'
).
Client
;
const
client
=
new
Client
(
'203756933'
,
'1hxwkxz2tyn80i3ucrdbchru59zpxibz'
);
class
TradeTransferAPI
extends
APIBase
{
constructor
()
{
super
();
this
.
tradetransferSve
=
system
.
getObject
(
"service.transfer.tradetransferSve"
);
this
.
notarizationflowSve
=
system
.
getObject
(
"service.transfer.notarizationflowSve"
);
}
async
acceptOrder
(
pobj
,
query
)
{
pobj
.
channelParams
.
fq_ordernum
=
pobj
.
orderNo
;
return
await
this
.
tradetransferSve
.
createtransfer
(
pobj
.
channelParams
);
}
async
closeOrder
(
pobj
,
query
)
{
return
await
this
.
tradetransferSve
.
orderclose
(
pobj
);
}
async
queryOrderState
(
pobj
,
query
)
{
return
await
this
.
tradetransferSve
.
ordersel
(
pobj
);
}
async
queryOrder
(
pobj
,
query
)
{
return
await
this
.
tradetransferSve
.
querytradeproducelist
(
pobj
);
}
async
selnotarytype
(
pobj
,
query
)
{
return
await
this
.
notarizationflowSve
.
selnotarytype
(
pobj
);
}
async
writecommunicationlog
(
pobj
,
query
)
{
return
await
this
.
tradetransferSve
.
writecommunicationlog
(
pobj
);
}
async
uppaymentstatus
()
{
return
await
this
.
tradetransferSve
.
uppaymentstatus
();
}
async
m5
(
p
)
{
var
keys
=
p
.
keys
(
jsonObj
).
sort
();
if
(
keys
.
length
==
0
)
{
reqResult
.
code
=
-
230
;
reqResult
.
msg
=
"请求参数信息为空"
;
return
reqResult
;
}
for
(
let
k
=
0
;
k
<
keys
.
length
;
k
++
)
{
const
tKey
=
keys
[
k
];
if
(
tKey
!=
"sign"
&&
jsonObj
[
tKey
])
{
signArr
.
push
(
tKey
+
"="
+
jsonObj
[
tKey
]);
}
}
if
(
signArr
.
length
==
0
)
{
reqResult
.
code
=
-
250
;
reqResult
.
msg
=
"请求组装签名参数信息为空"
;
return
reqResult
;
}
signArr
.
push
(
"key="
+
pay_key
);
var
signStr
=
signArr
.
join
(
"&"
);
// console.log(signStr, ",signStr.......................");
var
tmpSign
=
md5
(
signStr
).
toUpperCase
();
var
signStr
=
"appid=00000051&body=sdfg&cusid=990581007426001¬ify_url=dfgdsfgdf&randomstr=dfghrtjjn&reqsn=1564125456123&returl=sdsd154541&trxamt=100&version=12"
var
tmpSign
=
md5
(
signStr
).
toUpperCase
();
return
tmpSign
}
async
test
(
pobj
,
query
)
{
var
url
=
'https://jaxiya.gongsibao.com/orders/refuse'
;
var
result
=
await
client
.
post
(
url
,
{
data
:
{
"BizId"
:
"trademark_prepayment_pre-cn-o401er9gv01"
,
"UserName"
:
"阿里云"
,
"Mobile"
:
"18600480430"
,
"RegisterNumber"
:
"25559504"
,
"Classification"
:
"20"
,
"Price"
:
"10"
},
headers
:
{
accept
:
'application/json'
}
});
return
result
;
console
.
log
(
JSON
.
stringify
(
result
));
}
exam
()
{
return
"xxx"
;
}
classDesc
()
{
return
{
groupName
:
"auth"
,
groupDesc
:
"认证相关的包"
,
name
:
"AccessAuthAPI"
,
desc
:
"关于认证的类"
,
exam
:
""
,
};
}
methodDescs
()
{
return
[
{
methodDesc
:
"生成访问token"
,
methodName
:
"getAccessKey"
,
paramdescs
:
[
{
paramDesc
:
"访问appkey"
,
paramName
:
"appkey"
,
paramType
:
"string"
,
defaultValue
:
"x"
,
},
{
paramDesc
:
"访问secret"
,
paramName
:
"secret"
,
paramType
:
"string"
,
defaultValue
:
null
,
}
],
rtnTypeDesc
:
"xxxx"
,
rtnType
:
"xxx"
}
];
}
}
module
.
exports
=
TradeTransferAPI
;
\ No newline at end of file
gsb-marketplat/app/base/controller/impl/transfer/notarizationflowCtl.js
0 → 100644
View file @
97c05708
var
system
=
require
(
"../../../system"
)
var
settings
=
require
(
"../../../../config/settings"
);
const
CtlBase
=
require
(
"../../ctl.base"
);
var
moment
=
require
(
"moment"
);
class
NotarizationflowCtl
extends
CtlBase
{
constructor
()
{
super
(
"transfer"
,
CtlBase
.
getServiceName
(
NotarizationflowCtl
));
//this.appS=system.getObject("service.appSve");
}
//首次加载
async
firstload
(
p
,
q
)
{
var
notarinfo
=
await
this
.
service
.
firstload
(
p
);
return
notarinfo
;
}
//提交阿里
async
submitali
(
p
,
q
,
req
)
{
var
notarinfo
=
p
;
if
(
notarinfo
)
{
var
rtn
=
await
this
.
service
.
update
(
notarinfo
);
if
(
rtn
)
{
var
alirtn
=
await
this
.
service
.
setfiletoali
(
notarinfo
);
if
(
alirtn
)
{
return
{
data
:
alirtn
,
status
:
0
,
msg
:
"提交成功"
}
}
else
{
return
{
data
:
null
,
status
:
-
202
,
msg
:
"提交失败"
}
}
}
else
{
return
{
data
:
null
,
status
:
-
201
,
msg
:
"保存失败"
}
}
}
else
{
return
{
data
:
null
,
status
:
-
200
,
msg
:
"参数异常"
}
}
}
}
module
.
exports
=
NotarizationflowCtl
;
gsb-marketplat/app/base/controller/impl/transfer/tmjsonfileCtl.js
0 → 100644
View file @
97c05708
var
system
=
require
(
"../../../system"
)
const
http
=
require
(
"http"
)
const
querystring
=
require
(
'querystring'
);
var
settings
=
require
(
"../../../../config/settings"
);
const
CtlBase
=
require
(
"../../ctl.base"
);
const
logCtl
=
system
.
getObject
(
"web.common.oplogCtl"
);
class
TmjsonfileCtl
extends
CtlBase
{
constructor
()
{
super
(
"transfer"
,
CtlBase
.
getServiceName
(
TmjsonfileCtl
));
this
.
execS
=
system
.
getObject
(
"util.execClient"
);
this
.
uploadfileossurl
=
settings
.
uploadfileossurl
();
}
async
createjsonfile
(
p
,
o
,
q
)
{
var
rtn
=
await
this
.
service
.
createjsonfile
();
var
self
=
this
;
console
.
log
(
rtn
);
if
(
rtn
.
status
>
-
1
)
{
var
newdate
=
new
Date
();
var
strdate
=
""
if
(
newdate
.
getHours
()
>
12
)
{
strdate
=
newdate
.
toISOString
().
split
(
"T"
)[
0
].
replace
(
/
\-
/g
,
""
)
+
"_2.json"
;
}
else
{
strdate
=
newdate
.
toISOString
().
split
(
"T"
)[
0
].
replace
(
/
\-
/g
,
""
)
+
"_1.json"
;
}
var
self
=
this
;;
var
gobj
=
{
action
:
"GenerateUploadFilePolicy"
,
reqbody
:
{
FileType
:
"PARTNER_SYNC_FILE"
}
}
var
rst
=
await
self
.
service
.
aliclient
(
gobj
);
console
.
log
(
rst
)
var
url
=
this
.
uploadfileossurl
+
"/uploadfile/"
+
strdate
+
"/"
+
rst
.
EncodedPolicy
+
"/"
+
rst
.
Signature
;
var
upl
=
await
self
.
execS
.
execGet
(
null
,
url
);
console
.
log
(
upl
);
if
(
upl
.
stdout
){
var
obj
=
{
zc_url
:
"https://partner-sync-file.oss-cn-beijing.aliyuncs.com/1525276744866147/"
+
strdate
};
var
rtn
=
await
this
.
service
.
create
(
obj
);
if
(
rtn
)
{
return
{
status
:
0
,
msg
:
"成功"
};
}
else
{
return
{
status
:
-
201
,
msg
:
"创建失败"
};
}
}
else
{
return
{
status
:
-
202
,
msg
:
"上传失败"
};
}
}
else
{
return
{
status
:
-
200
,
msg
:
"json文件生成失败"
};
}
}
}
module
.
exports
=
TmjsonfileCtl
;
gsb-marketplat/app/base/controller/impl/transfer/tradetransferCtl.js
0 → 100644
View file @
97c05708
var
system
=
require
(
"../../../system"
)
const
http
=
require
(
"http"
)
const
querystring
=
require
(
'querystring'
);
var
settings
=
require
(
"../../../../config/settings"
);
const
CtlBase
=
require
(
"../../ctl.base"
);
const
logCtl
=
system
.
getObject
(
"web.common.oplogCtl"
);
var
cacheBaseComp
=
null
;
class
TradetransferCtl
extends
CtlBase
{
constructor
()
{
super
(
"transfer"
,
CtlBase
.
getServiceName
(
TradetransferCtl
));
this
.
postfile
=
system
.
getObject
(
"util.restClient"
);
}
async
submit
(
p
,
q
,
req
)
{
if
(
req
&&
req
.
session
&&
req
.
session
.
user
)
{
p
.
onlyCode
=
req
.
session
.
user
.
unionId
;
}
if
(
req
.
codepath
)
{
p
.
codepath
=
req
.
codepath
;
}
var
result
=
null
;
try
{
if
(
p
.
transfer_status
==
"CONFIRM_ORDER"
)
{
p
.
aliorder_status
=
"1"
,
result
=
await
this
.
service
.
confirmorder
(
p
);
console
.
log
(
result
)
}
if
(
p
.
transfer_status
==
"CLOSE_ORDER_ONLY"
)
{
p
.
aliorder_status
=
"11"
,
result
=
await
this
.
service
.
refuseorder
(
p
)
}
if
(
p
.
transfer_status
==
"PROVIDE_MATERIAL"
)
{
p
.
aliorder_status
=
"3"
,
result
=
await
this
.
service
.
supplymaterail
(
p
)
}
if
(
p
.
transfer_status
==
"BUYER_EXPRESS"
)
{
p
.
aliorder_status
=
"5"
,
result
=
await
this
.
service
.
posttransfermatereial
(
p
)
}
if
(
p
.
transfer_status
==
"BUYER_PROVIDE_MATERIAL"
)
{
p
.
aliorder_status
=
"6"
,
result
=
await
this
.
service
.
receivedtransfermaterail
(
p
)
}
if
(
p
.
transfer_status
==
"SUBMIT_TO_SBJ"
)
{
p
.
aliorder_status
=
"7"
,
result
=
await
this
.
service
.
submittedtransfermaterail
(
p
)
}
if
(
p
.
transfer_status
==
"SBJ_ACCEPT"
)
{
p
.
aliorder_status
=
"8"
,
result
=
await
this
.
service
.
acceptedtransfermaterail
(
p
)
}
if
(
p
.
transfer_status
==
"SBJ_SUCCESS"
)
{
p
.
aliorder_status
=
"8"
,
result
=
await
this
.
service
.
approvedtransfer
(
p
)
}
if
(
p
.
transfer_status
==
"SBJ_FAIL"
)
{
p
.
aliorder_status
=
"8"
,
result
=
await
this
.
service
.
refusetransfer
(
p
)
}
if
(
p
.
transfer_status
==
"TRANSFER_SUCCESS"
)
{
p
.
aliorder_status
=
"12"
,
result
=
await
this
.
service
.
tradesuccess
(
p
)
}
if
(
p
.
transfer_status
==
"TRANSFER_FAIL"
)
{
p
.
aliorder_status
=
"10"
,
result
=
await
this
.
service
.
tradefail
(
p
)
}
if
(
p
.
transfer_status
==
"RefuseOrder"
)
{
p
.
aliorder_status
=
"10"
,
result
=
await
this
.
service
.
tradefail
(
p
)
}
if
(
result
&&
result
.
Success
)
{
var
rd
=
await
this
.
service
.
update
(
p
);
return
system
.
getResult
(
rd
);
}
else
{
return
system
.
getResult
(
null
,
"阿里请求失败"
);
}
}
catch
(
error
)
{
return
system
.
getResult
(
null
,
"请求异常"
);
}
}
async
findone
(
p
,
q
,
req
)
{
var
traninfo
=
await
this
.
service
.
findOne
({
ali_bizid
:
p
.
ali_bizid
});
return
{
data
:
traninfo
.
dataValues
,
status
:
0
,
msg
:
"操作成功"
}
}
//获取签名
async
generateuploadfilepolicy
(
p
,
q
,
req
)
{
var
self
=
this
;;
var
gobj
=
{
action
:
"GenerateUploadFilePolicy"
,
reqbody
:
{
FileType
:
"LEGAL_NOTICE"
}
}
if
(
p
.
mtype
&&
p
.
mtype
==
'json'
)
{
gobj
.
reqbody
.
FileType
=
'PARTNER_SYNC_FILE'
;
}
try
{
var
rst
=
await
self
.
service
.
aliclient
(
gobj
);
console
.
log
(
rst
)
var
source
=
{
OSSAccessKeyId
:
rst
.
AccessId
,
policy
:
rst
.
EncodedPolicy
,
Signature
:
rst
.
Signature
,
Bucket
:
'trade-mark-user-upload'
,
url
:
"https://trade-mark-user-upload.oss-cn-beijing.aliyuncs.com"
,
filedir
:
rst
.
FileDir
}
if
(
p
.
mtype
&&
p
.
mtype
==
'json'
)
{
source
.
url
=
"https://partner-sync-file.oss-cn-beijing.aliyuncs.com"
;
source
.
Bucket
=
"partner-sync-file"
;
}
console
.
log
(
source
)
return
source
;
}
catch
(
e
)
{
console
.
log
(
e
)
}
}
}
module
.
exports
=
TradetransferCtl
;
gsb-marketplat/app/base/db/basemodel/voucherbase.js
View file @
97c05708
...
...
@@ -26,7 +26,7 @@ function exp(db, DataTypes) {
sourceTypeName
:
DataTypes
.
STRING
(
50
),
sourceType
:
{
//来源类型 "order": "订单","expensevoucher": "费用单","receiptvoucher": "收款单", "trademark": "商标单"
type
:
DataTypes
.
ENUM
,
values
:
Object
.
keys
(
uiconfig
.
config
.
pdict
.
source_type
),
values
:
Object
.
keys
(
app
config
.
pdict
.
source_type
),
set
:
function
(
val
)
{
this
.
setDataValue
(
"sourceType"
,
val
);
this
.
setDataValue
(
"sourceTypeName"
,
appconfig
.
pdict
.
source_type
[
val
]);
...
...
gsb-marketplat/app/base/db/impl/transfer/notarizationflowDao.js
0 → 100644
View file @
97c05708
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
NotarizationflowDao
extends
Dao
{
constructor
(){
super
(
Dao
.
getModelName
(
NotarizationflowDao
));
}
}
module
.
exports
=
NotarizationflowDao
;
gsb-marketplat/app/base/db/impl/transfer/tmjsonfileDao.js
0 → 100644
View file @
97c05708
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
TmjsonfileDao
extends
Dao
{
constructor
(){
super
(
Dao
.
getModelName
(
TmjsonfileDao
));
}
}
module
.
exports
=
TmjsonfileDao
;
gsb-marketplat/app/base/db/impl/transfer/tradetransferDao.js
0 → 100644
View file @
97c05708
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
TradetransferDao
extends
Dao
{
constructor
(){
super
(
Dao
.
getModelName
(
TradetransferDao
));
}
}
module
.
exports
=
TradetransferDao
;
gsb-marketplat/app/base/db/metadata/app/platform.js
View file @
97c05708
...
...
@@ -24,6 +24,69 @@ module.exports = {
},
"record_status"
:{
"1"
:
"未读"
,
"2"
:
"已读"
,
"3"
:
"无效"
},
"transfer_status"
:
{
"READY_ORDER"
:
"订单准备"
,
"CONFIRM_ORDER"
:
"确认订单"
,
"CLOSE_ORDER_ONLY"
:
"拒绝订单"
,
"PROVIDE_MATERIAL"
:
"上传卖家资料"
,
"PAY_OVER"
:
"尾款已支付"
,
"BUYER_EXPRESS"
:
"邮寄资料"
,
"MATERIAL_PROVIDE"
:
"资料已收到"
,
"BUYER_PROVIDE_MATERIAL"
:
"确认收件"
,
"SUBMIT_TO_SBJ"
:
"提交官方"
,
"SBJ_ACCEPT"
:
"商标局受理"
,
"SBJ_SUCCESS"
:
"商标局核准"
,
"SBJ_FAIL"
:
"商标局不核准"
,
"TRANSFER_FAIL"
:
"交易失败"
,
"TRANSFER_SUCCESS"
:
"交易成功"
,
"CLOSE_ORDER_REFUND"
:
"订单关闭"
,
"REFUSE_ORDER"
:
"取消订单"
},
"transfer_statusshow"
:
{
"READY_ORDER"
:
"订单准备"
,
"CONFIRM_ORDER"
:
"确认订单"
,
"CLOSE_ORDER_ONLY"
:
"拒绝订单"
,
"PAY_OVER"
:
"尾款已支付"
,
"BUYER_EXPRESS"
:
"邮寄资料"
,
"BUYER_PROVIDE_MATERIAL"
:
"确认收件"
,
"SUBMIT_TO_SBJ"
:
"提交官方"
,
"SBJ_ACCEPT"
:
"商标局受理"
,
"SBJ_SUCCESS"
:
"商标局核准"
,
"SBJ_FAIL"
:
"商标局不核准"
,
"TRANSFER_FAIL"
:
"交易失败"
,
"TRANSFER_SUCCESS"
:
"交易成功"
,
"CLOSE_ORDER_REFUND"
:
"订单关闭"
,
"REFUSE_ORDER"
:
"取消订单"
},
"aliorder_status"
:
{
"1"
:
"确认商标状态"
,
"11"
:
"订单关闭(不退款)"
,
"2"
:
"文档清单及模板"
,
"3"
:
"提供交易文件"
,
"4"
:
"确认交易文档"
,
"5"
:
"确认展示文档,快递卖家"
,
"6"
:
"买家提供文件"
,
"7"
:
"转让申请递交"
,
"8"
:
"官文转达(受通)"
,
"9"
:
"官文转达(补正)"
,
"10"
:
"退款"
,
"12"
:
"订单完成"
},
"tranferperson_type"
:
{
"person"
:
"个人"
,
"ent"
:
"企业"
},
"certificate_type"
:
{
"1"
:
"身份证"
,
"2"
:
"护 照"
},
"notary_status"
:
{
"0"
:
"创建订单待提交"
,
"1"
:
"已提交"
,
"2"
:
"已受理"
,
"3"
:
"已出证"
,
"4"
:
"已终⽌"
}
}
}
...
...
gsb-marketplat/app/base/db/models/transfer/notarizationflow.js
0 → 100644
View file @
97c05708
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
appconfig
=
system
.
getSysConfig
();
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"notarizationflow"
,
{
ali_bizid
:
DataTypes
.
STRING
,
//'阿里订单号'
fq_ordernum
:
DataTypes
.
STRING
,
//合作方订单号
//材料信息
tmRegisterCertificate
:
DataTypes
.
STRING
,
// "商标注册证",
businessLicense
:
DataTypes
.
STRING
,
// "机构营业执照(卖家营业执照证件)",
buyerIdentification
:
DataTypes
.
STRING
,
// "受让人身份证明材料",
tmAcceptCertificate
:
DataTypes
.
STRING
,
// "商标受理通知书",
sellerFrontOfIdCard
:
DataTypes
.
STRING
,
// "卖家身份证正面",
sellerBackOfIdCard
:
DataTypes
.
STRING
,
// "卖家身份证反面",
tmRegisterChangeCertificate
:
DataTypes
.
STRING
,
// "商标注册证变更证明",
//买家信息
buyerType
:
{
// "买方类型",
type
:
DataTypes
.
ENUM
,
values
:
Object
.
keys
(
appconfig
.
pdict
.
tranferperson_type
),
//
set
:
function
(
val
)
{
this
.
setDataValue
(
"buyerType"
,
val
);
this
.
setDataValue
(
"buyerTypeName"
,
appconfig
.
pdict
.
tranferperson_type
[
val
]);
}
},
buyerTypeName
:
DataTypes
.
STRING
,
// "买方类型",
buyerCompany
N
ame
:
DataTypes
.
STRING
,
// "买方企业名称",
buyerName
:
DataTypes
.
STRING
,
// "买家姓名",
certificateNo
:
DataTypes
.
STRING
,
// "证件号",
certificateType
:
{
// "证件类型(目前仅支持身份证,支持汉字),枚举取值:1、身份证2、护 照"
type
:
DataTypes
.
ENUM
,
values
:
Object
.
keys
(
appconfig
.
pdict
.
certificate_type
),
//
set
:
function
(
val
)
{
this
.
setDataValue
(
"buyerType"
,
val
);
this
.
setDataValue
(
"buyerTypeName"
,
appconfig
.
pdict
.
certificate_type
[
val
]);
}
},
certificateType
N
ame
:
DataTypes
.
STRING
,
// "证件类型
//卖家信息
sellerType
:
{
// "卖方类型",
type
:
DataTypes
.
ENUM
,
values
:
Object
.
keys
(
appconfig
.
pdict
.
tranferperson_type
),
set
:
function
(
val
)
{
this
.
setDataValue
(
"sellerType"
,
val
);
this
.
setDataValue
(
"sellerTypeName"
,
appconfig
.
pdict
.
tranferperson_type
[
val
]);
}
},
sellerTypeName
:
DataTypes
.
STRING
,
// "卖方类型",
legalPersonPhone
:
DataTypes
.
STRING
,
// "法定代表人手机号",
companyContactName
:
DataTypes
.
STRING
,
// "企业联系人姓名,可以和法人姓名一致",
verifyPhone
:
DataTypes
.
STRING
,
// "验证手机号",
phone
:
DataTypes
.
STRING
,
// "手机号",
businessLicenseId
:
DataTypes
.
STRING
,
// "统一社会信用代码(营业执照)",
sellerCompanyName
:
DataTypes
.
STRING
,
// "企业名称",
sellerCompanyAddress
:
DataTypes
.
STRING
,
// "卖方公司地址",
legalPersonIdCard
:
DataTypes
.
STRING
,
// "法定代表人身份证号码",
companyContactPhone
:
DataTypes
.
STRING
,
// "企业联系人电话,可以和法人手机号一致",
legalPersonName
:
DataTypes
.
STRING
,
// "法定代表人姓名"
//商标信息
tmRegisterNo
:
DataTypes
.
STRING
,
// "商标注册号",
tmClassification
:
DataTypes
.
STRING
,
// "商标第几类"
owner_id
:
DataTypes
.
STRING
,
//业务员id
owner_name
:
DataTypes
.
STRING
,
//业务员姓名
owner_mobile
:
DataTypes
.
STRING
,
//业务员电话
notaryStatus
:
{
// "公证订单状态",
type
:
DataTypes
.
ENUM
,
values
:
Object
.
keys
(
appconfig
.
pdict
.
tranferperson_type
),
set
:
function
(
val
)
{
this
.
setDataValue
(
"notaryStatus"
,
val
);
this
.
setDataValue
(
"notaryStatusName"
,
appconfig
.
pdict
.
tranferperson_type
[
val
]);
}
},
notaryStatusName
:
DataTypes
.
STRING
,
// "公证订单状态",
desc
:
DataTypes
.
STRING
,
//备注
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'notarization_flow'
,
validate
:
{
},
indexes
:
[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
gsb-marketplat/app/base/db/models/transfer/tmjsonfile.js
0 → 100644
View file @
97c05708
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"tmjsonfile"
,
{
status
:
DataTypes
.
STRING
,
//'状态'
zc_url
:
DataTypes
.
STRING
,
jsonfile_url
:
DataTypes
.
STRING
,
//json文件链接
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'tm_jsonfile'
,
validate
:
{
},
indexes
:
[
]
});
}
gsb-marketplat/app/base/db/models/transfer/tradetransfer.js
0 → 100644
View file @
97c05708
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
appconfig
=
system
.
getSysConfig
();
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"tradetransfer"
,
{
tm_number
:
DataTypes
.
STRING
,
//注册号
ali_bizid
:
DataTypes
.
STRING
,
//'阿里订单号'
user_name
:
DataTypes
.
STRING
,
//买家姓名
mobile
:
DataTypes
.
STRING
,
//买方电话
contact_name
:
DataTypes
.
STRING
,
//买家联系人姓名
contact_mobile
:
DataTypes
.
STRING
,
//联系人联系方式
contact_email
:
DataTypes
.
STRING
,
//买家联系方式
cardno
:
DataTypes
.
STRING
,
//证件编号
complete
:
DataTypes
.
STRING
,
//是否补充完成,补充完成的话会展示给购买人确认资料。
user_type_name
:
DataTypes
.
STRING
,
//买家用户类型
user_type
:
{
// "买家用户类型",
type
:
DataTypes
.
ENUM
,
values
:
Object
.
keys
(
appconfig
.
pdict
.
tranferperson_type
),
//
set
:
function
(
val
)
{
this
.
setDataValue
(
"user_type"
,
val
);
this
.
setDataValue
(
"user_type_name"
,
appconfig
.
pdict
.
tranferperson_type
[
val
]);
}
},
buyer_address
:
DataTypes
.
STRING
,
//买家地址
buyer_businesslicense
:
DataTypes
.
STRING
,
//买家营业执照
buyer_name
:
DataTypes
.
STRING
,
//买家姓名
buyer_idcard
:
DataTypes
.
STRING
,
//买家身份证
seller_businesslicense
:
DataTypes
.
STRING
,
//卖家营业执照
seller_idcard
:
DataTypes
.
STRING
,
//卖家身份证
seller_proxy
:
DataTypes
.
STRING
,
//代理委托书
seller_apply
:
DataTypes
.
STRING
,
//申请书
ncl_one
:
DataTypes
.
STRING
,
//尼斯大类
price
:
DataTypes
.
STRING
,
//价格
fq_ordernum
:
DataTypes
.
STRING
,
//合作方订单号
tm_cert_url
:
DataTypes
.
STRING
,
//商标证书
transfer_cert_url
:
DataTypes
.
STRING
,
//转让证明
notarization_url
:
DataTypes
.
STRING
,
//公证书
notarization_flow_id
:
DataTypes
.
STRING
,
//公证流程id
transfer_status_name
:
DataTypes
.
STRING
,
//流程状态名称
transfer_status
:
{
type
:
DataTypes
.
ENUM
,
//
values
:
Object
.
keys
(
appconfig
.
pdict
.
transfer_status
),
//
set
:
function
(
val
)
{
this
.
setDataValue
(
"transfer_status"
,
val
);
this
.
setDataValue
(
"transfer_status_name"
,
appconfig
.
pdict
.
transfer_status
[
val
]);
}
},
aliorder_status_name
:
DataTypes
.
STRING
,
//阿里订单状态名称
aliorder_status
:
{
type
:
DataTypes
.
ENUM
,
//
values
:
Object
.
keys
(
appconfig
.
pdict
.
aliorder_status
),
//
set
:
function
(
val
)
{
this
.
setDataValue
(
"aliorder_status"
,
val
);
this
.
setDataValue
(
"aliorder_status_name"
,
appconfig
.
pdict
.
aliorder_status
[
val
]);
}
},
owner_id
:
DataTypes
.
STRING
,
//业务员id
owner_name
:
DataTypes
.
STRING
,
//业务员姓名
owner_mobile
:
DataTypes
.
STRING
,
//业务员电话
mail_zip_url
:
DataTypes
.
STRING
,
//邮寄文件链接
logistics
:
DataTypes
.
STRING
//邮寄单编号
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'trade_transfer'
,
validate
:
{
},
indexes
:
[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
gsb-marketplat/app/base/service/impl/common/appSve.js
View file @
97c05708
...
...
@@ -52,7 +52,7 @@ class AppService extends ServiceBase {
});
}
for
(
var
app
of
apps
)
{
var
tmk
=
uiconfig
.
config
.
pdict
.
app_type
[
app
.
appType
];
var
tmk
=
app
config
.
pdict
.
app_type
[
app
.
appType
];
if
(
!
dicRtn
[
tmk
])
{
dicRtn
[
tmk
]
=
[];
dicRtn
[
tmk
].
push
(
app
);
...
...
gsb-marketplat/app/base/service/impl/transfer/notarizationflowSve.js
0 → 100644
View file @
97c05708
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
var
settings
=
require
(
"../../../../config/settings"
);
class
NotarizationflowService
extends
ServiceBase
{
constructor
()
{
super
(
"transfer"
,
ServiceBase
.
getDaoName
(
NotarizationflowService
));
this
.
tradetransferDao
=
system
.
getObject
(
"db.transfer.tradetransferDao"
);
this
.
aliclient
=
system
.
getObject
(
"util.aliApiClient"
);
}
//公证信息推送阿里
async
setfiletoali
(
obj
)
{
var
uploadContext
=
{
buyerData
:
{},
sellerData
:
{},
transferData
:
{}
}
console
.
log
(
obj
.
sellerFrontOfIdCard
.
split
(
"com//"
)[
1
]);
obj
.
sellerFrontOfIdCard
=
obj
.
sellerFrontOfIdCard
==
null
?
null
:
obj
.
sellerFrontOfIdCard
.
split
(
"com//"
)[
1
];
obj
.
sellerBackOfIdCard
=
obj
.
sellerBackOfIdCard
==
null
?
null
:
obj
.
sellerBackOfIdCard
.
split
(
"com//"
)[
1
];
obj
.
tmRegisterCertificate
=
obj
.
tmRegisterCertificate
==
null
?
null
:
obj
.
tmRegisterCertificate
.
split
(
"com//"
)[
1
];
obj
.
businessLicense
=
obj
.
businessLicense
==
null
?
null
:
obj
.
businessLicense
.
split
(
"com//"
)[
1
];
obj
.
tmAcceptCertificate
=
obj
.
tmAcceptCertificate
==
null
?
null
:
obj
.
tmAcceptCertificate
.
split
(
"com//"
)[
1
];
obj
.
buyerIdentification
=
obj
.
buyerIdentification
==
null
?
null
:
obj
.
buyerIdentification
.
split
(
"com//"
)[
1
];
obj
.
tmRegisterChangeCertificate
=
obj
.
tmRegisterChangeCertificate
==
null
?
null
:
obj
.
tmRegisterChangeCertificate
.
split
(
"com//"
)[
1
];
//买家信息 个人
if
(
obj
.
buyerType
==
"person"
)
{
if
(
this
.
isStrEmpty
(
obj
.
buyerName
)
&&
this
.
isStrEmpty
(
obj
.
certificateNo
)
&&
this
.
isStrEmpty
(
obj
.
certificateType
))
{
uploadContext
.
buyerData
=
{
buyerName
:
obj
.
buyerName
,
certificateNo
:
obj
.
certificateNo
,
certificateType
:
obj
.
certificateType
}
}
else
{
return
false
;
}
}
else
{
//买家信息 企业
if
(
this
.
isStrEmpty
(
obj
.
buyerCompanyName
))
{
uploadContext
.
buyerData
=
{
buyerCompanyName
:
obj
.
buyerCompanyName
}
}
else
{
return
false
;
}
}
//卖家信息 个人
if
(
obj
.
sellerType
==
"person"
)
{
if
(
this
.
isStrEmpty
(
obj
.
verifyPhone
)
&&
this
.
isStrEmpty
(
obj
.
phone
)
&&
this
.
isStrEmpty
(
obj
.
sellerFrontOfIdCard
)
&&
this
.
isStrEmpty
(
obj
.
sellerBackOfIdCard
)
&&
this
.
isStrEmpty
(
obj
.
buyerIdentification
)
&&
(
this
.
isStrEmpty
(
obj
.
tmRegisterCertificate
)
||
this
.
isStrEmpty
(
obj
.
tmAcceptCertificate
)
||
this
.
isStrEmpty
(
obj
.
tmRegisterChangeCertificate
)))
{
uploadContext
.
sellerData
=
{
verifyPhone
:
obj
.
verifyPhone
,
phone
:
obj
.
phone
};
uploadContext
.
transferData
=
{
sellerFrontOfIdCard
:
obj
.
sellerFrontOfIdCard
,
sellerBackOfIdCard
:
obj
.
sellerBackOfIdCard
,
buyerIdentification
:
obj
.
buyerIdentification
,
tmRegisterCertificate
:
obj
.
tmRegisterCertificate
,
tmAcceptCertificate
:
obj
.
tmAcceptCertificate
,
tmRegisterChangeCertificate
:
obj
.
tmRegisterChangeCertificate
}
}
else
{
return
false
;
}
}
else
{
//卖家信息 企业
if
(
this
.
isStrEmpty
(
obj
.
legalPersonPhone
)
&&
this
.
isStrEmpty
(
obj
.
companyContactName
)
&&
this
.
isStrEmpty
(
obj
.
verifyPhone
)
&&
this
.
isStrEmpty
(
obj
.
phone
)
&&
this
.
isStrEmpty
(
obj
.
businessLicenseId
)
&&
this
.
isStrEmpty
(
obj
.
sellerCompanyName
)
&&
this
.
isStrEmpty
(
obj
.
sellerCompanyAddress
)
&&
this
.
isStrEmpty
(
obj
.
legalPersonIdCard
)
&&
this
.
isStrEmpty
(
obj
.
companyContactPhone
)
&&
this
.
isStrEmpty
(
obj
.
legalPersonName
)
&&
this
.
isStrEmpty
(
obj
.
buyerIdentification
)
&&
this
.
isStrEmpty
(
obj
.
businessLicense
)
&&
(
this
.
isStrEmpty
(
obj
.
tmRegisterCertificate
)
||
this
.
isStrEmpty
(
obj
.
tmAcceptCertificate
)
||
this
.
isStrEmpty
(
obj
.
tmRegisterChangeCertificate
)))
{
uploadContext
.
sellerData
=
{
legalPersonPhone
:
obj
.
legalPersonPhone
,
// "法定代表人手机号",
companyContactName
:
obj
.
companyContactName
,
// "企业联系人姓名,可以和法人姓名一致",
verifyPhone
:
obj
.
verifyPhone
,
// "验证手机号",
phone
:
obj
.
phone
,
// "手机号",
businessLicenseId
:
obj
.
businessLicenseId
,
// "统一社会信用代码(营业执照)",
sellerCompanyName
:
obj
.
sellerCompanyName
,
// "企业名称",
sellerCompanyAddress
:
obj
.
sellerCompanyAddress
,
// "卖方公司地址",
legalPersonIdCard
:
obj
.
legalPersonIdCard
,
// "法定代表人身份证号码",
companyContactPhone
:
obj
.
companyContactPhone
,
// "企业联系人电话,可以和法人手机号一致",
legalPersonName
:
obj
.
legalPersonName
// "法定代表人姓名"
},
uploadContext
.
transferData
=
{
sellerFrontOfIdCard
:
obj
.
sellerFrontOfIdCard
,
sellerBackOfIdCard
:
obj
.
sellerBackOfIdCard
,
tmRegisterCertificate
:
obj
.
tmRegisterCertificate
,
businessLicense
:
obj
.
businessLicense
,
tmAcceptCertificate
:
obj
.
tmAcceptCertificate
,
buyerIdentification
:
obj
.
buyerIdentification
,
tmRegisterChangeCertificate
:
obj
.
tmRegisterChangeCertificate
}
}
else
{
return
false
;
}
}
var
source
=
{
action
:
"UploadNotaryData"
,
reqbody
:
{
NotaryType
:
1
,
BizOrderNo
:
obj
.
ali_bizid
,
UploadContext
:
JSON
.
stringify
(
uploadContext
)
}
}
console
.
log
(
source
);
var
result
=
await
this
.
aliclient
(
source
);
console
.
log
(
result
);
return
result
;
}
async
selnotarytype
(
obj
)
{
if
(
!
obj
.
ali_bizid
)
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
"ali_bizid不能为空"
,
"module"
:
{
"orderNumber"
:
""
},
"requestId"
:
obj
.
requestid
,
"success"
:
false
}
}
if
(
!
obj
.
token
)
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
"token不能为空"
,
"module"
:
{
"orderNumber"
:
""
},
"requestId"
:
obj
.
requestid
,
"success"
:
false
}
}
var
source
=
{
action
:
"ListNotaryInfos"
,
reqbody
:
{
NotaryType
:
1
,
BizOrderNo
:
obj
.
ali_bizid
,
PageNum
:
1
,
PageSize
:
10
,
Token
:
obj
.
token
}
}
var
result
=
await
this
.
aliclient
(
source
);
console
.
log
(
result
);
return
result
;
}
async
firstload
(
obj
)
{
var
self
=
this
;
var
traninfo
=
await
this
.
tradetransferDao
.
findOne
({
ali_bizid
:
obj
.
ali_bizid
});
if
(
traninfo
.
dataValues
)
{
if
(
traninfo
.
dataValues
.
notarization_flow_id
)
{
var
notarinfo
=
await
this
.
dao
.
findOne
({
ali_bizid
:
obj
.
ali_bizid
});
if
(
notarinfo
)
{
return
{
data
:
notarinfo
.
dataValues
,
status
:
0
,
msg
:
"操作成功"
}
}
else
{
return
{
data
:
null
,
status
:
-
201
,
msg
:
"查询失败失败"
}
}
}
else
{
var
source
=
{
ali_bizid
:
traninfo
.
dataValues
.
ali_bizid
,
fq_ordernum
:
traninfo
.
dataValues
.
fq_ordernum
,
tmRegisterNo
:
traninfo
.
dataValues
.
tm_number
,
tmClassification
:
traninfo
.
dataValues
.
ncl_one
}
return
this
.
db
.
transaction
(
async
function
(
t
)
{
var
notarinfo
=
await
self
.
dao
.
create
(
source
,
t
);
if
(
notarinfo
)
{
traninfo
.
dataValues
.
notarization_flow_id
=
notarinfo
.
dataValues
.
id
;
await
self
.
tradetransferDao
.
update
(
traninfo
.
dataValues
);
return
{
data
:
notarinfo
.
dataValues
,
status
:
0
,
msg
:
"操作成功"
}
}
else
{
return
{
data
:
null
,
status
:
-
202
,
msg
:
"创建失败"
}
}
})
}
}
else
{
return
{
data
:
null
,
status
:
-
200
,
msg
:
"参数异常"
}
}
}
async
sellist
()
{
var
obj
=
{
}
}
}
module
.
exports
=
NotarizationflowService
;
gsb-marketplat/app/base/service/impl/transfer/tmjsonfileSve.js
0 → 100644
View file @
97c05708
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
var
settings
=
require
(
"../../../../config/settings"
);
var
RPCClient
=
require
(
'@alicloud/pop-core'
).
RPCClient
;
var
OSS
=
require
(
'ali-oss'
);
const
crypto
=
require
(
'crypto'
);
var
fs
=
require
(
'fs'
);
class
TmjsonfileService
extends
ServiceBase
{
constructor
()
{
super
(
"transfer"
,
ServiceBase
.
getDaoName
(
TmjsonfileService
));
this
.
connectionigirl
=
system
.
getObject
(
"db.common.connection"
).
getConigirl
();
}
async
createjsonfile
()
{
var
lastsql
=
"select * from tm_jsonfile order by id desc limit 1"
;
var
lastinfo
=
await
this
.
dao
.
customQuery
(
lastsql
);
var
lasttime
=
0
if
(
lastinfo
){
lasttime
=
lastinfo
[
0
].
updated_at
.
toISOString
().
split
(
"T"
)[
0
];
}
var
sql
=
"select * from bi_trademarktransaction where updated_at>='"
+
lasttime
+
"'"
;
// var sql = "select * from bi_trademarktransaction where id=175342";
var
tminfos
=
await
this
.
connectionigirl
.
query
(
sql
);
var
sources
=
[];
if
(
tminfos
[
0
])
{
for
(
var
i
=
0
;
i
<
tminfos
[
0
].
length
;
i
++
)
{
var
tmg
=
tminfos
[
0
][
i
].
tm_group
;
var
status
=
1
;
if
(
tminfos
[
0
][
i
].
deleted_at
||
"lowershelf"
==
tminfos
[
0
][
i
].
publish_status
){
status
=
0
;
}
var
strlist
=
null
;
if
(
tmg
)
{
strlist
=
tmg
.
replace
(
/"/g
,
""
).
replace
(
/
\[
/g
,
""
).
replace
(
/
\]
/g
,
""
).
split
(
","
);
for
(
var
n
=
0
;
n
<
strlist
.
length
;
n
++
)
{
if
(
!
strlist
[
n
])
{
strlist
.
shift
();
}
}
}
var
des
=
""
;
if
(
tminfos
[
0
][
i
].
tm_ncl_third
)
{
des
=
tminfos
[
0
][
i
].
tm_ncl_third
.
replace
(
/
\[
/g
,
""
).
replace
(
/
\]
/g
,
""
).
replace
(
/
\'
/g
,
""
);
}
var
source
=
{
beginTime
:
1574388139000
,
classificationCode
:
tminfos
[
0
][
i
].
ncl_one_code
,
description
:
des
,
endTime
:
1668089537981
,
label
:
"商标标签"
,
originalPrice
:
parseInt
(
tminfos
[
0
][
i
].
platform_quoted_price
),
ownerEnName
:
""
,
ownerName
:
tminfos
[
0
][
i
].
tm_applier
,
partnerCode
:
"gong_si_bao"
,
regAnnDate
:
tminfos
[
0
][
i
].
tm_regist_day
*
1000
,
secondaryClassification
:
strlist
,
status
:
status
,
thirdClassification
:
tminfos
[
0
][
i
].
tm_ncl_third
,
tmIcon
:
tminfos
[
0
][
i
].
pic_url
,
tmName
:
tminfos
[
0
][
i
].
name
,
tmNumber
:
tminfos
[
0
][
i
].
code
}
sources
.
push
(
source
);
}
var
newdate
=
new
Date
();
var
strdate
=
""
if
(
newdate
.
getHours
()
>
12
)
{
strdate
=
newdate
.
toISOString
().
split
(
"T"
)[
0
].
replace
(
/
\-
/g
,
""
)
+
"_2.json"
;
}
else
{
strdate
=
newdate
.
toISOString
().
split
(
"T"
)[
0
].
replace
(
/
\-
/g
,
""
)
+
"_1.json"
;
}
var
jsonstr
=
JSON
.
stringify
(
sources
,
null
,
"
\
t"
);
return
new
Promise
(
function
(
resv
,
rej
)
{
fs
.
writeFile
(
'/tmp/'
+
strdate
,
jsonstr
,
function
(
err
)
{
if
(
err
)
{
console
.
error
(
err
);
}
console
.
log
(
'--------------------修改成功11111111111111'
);
return
resv
({
status
:
0
,
msg
:
"成功"
})
})
}
)
console
.
log
(
'--------------------修改成功'
);
}
}
}
module
.
exports
=
TmjsonfileService
;
gsb-marketplat/app/base/service/impl/transfer/tradetransferSve.js
0 → 100644
View file @
97c05708
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
var
settings
=
require
(
"../../../../config/settings"
);
var
RPCClient
=
require
(
'@alicloud/pop-core'
).
RPCClient
;
var
OSS
=
require
(
'ali-oss'
);
const
crypto
=
require
(
'crypto'
);
var
moment
=
require
(
"moment"
);
class
TradetransferService
extends
ServiceBase
{
constructor
()
{
super
(
"transfer"
,
ServiceBase
.
getDaoName
(
TradetransferService
));
}
//订单创建
async
createtransfer
(
obj
)
{
if
(
!
obj
.
BizId
)
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
"订单号不能为空"
,
"module"
:
{
"orderNumber"
:
""
},
"requestId"
:
obj
.
requestid
,
"success"
:
false
}
}
if
(
!
obj
.
UserName
)
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
"用户不能为空"
,
"module"
:
{
"orderNumber"
:
""
},
"requestId"
:
obj
.
requestid
,
"success"
:
false
}
}
if
(
!
obj
.
Mobile
)
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
"用户手机号不能为空"
,
"module"
:
{
"orderNumber"
:
""
},
"requestId"
:
obj
.
requestid
,
"success"
:
false
}
}
if
(
!
obj
.
RegisterNumber
)
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
"注册号不能为空"
,
"module"
:
{
"orderNumber"
:
""
},
"requestId"
:
obj
.
requestid
,
"success"
:
false
}
}
if
(
!
obj
.
Classification
)
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
"大类不能为空"
,
"module"
:
{
"orderNumber"
:
""
},
"requestId"
:
obj
.
requestid
,
"success"
:
false
}
}
if
(
!
obj
.
Price
)
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
"价格不能为空"
,
"module"
:
{
"orderNumber"
:
""
},
"requestId"
:
obj
.
requestid
,
"success"
:
false
}
}
var
transferinfo
=
await
this
.
findOne
({
ali_bizid
:
obj
.
BizId
});
if
(
transferinfo
)
{
return
{
"status"
:
2
,
"msg"
:
"交付单已存在"
,
"data"
:
{
"orderNo"
:
obj
.
fq_ordernum
,
"channelServiceNo"
:
obj
.
BizId
,
"channelParams"
:
{}
},
"requestid"
:
obj
.
requestid
}
}
else
{
var
source
=
{
tm_number
:
obj
.
RegisterNumber
,
user_name
:
obj
.
UserName
,
ali_bizid
:
obj
.
BizId
,
mobile
:
obj
.
Mobile
,
price
:
obj
.
Price
,
ncl_one
:
obj
.
Classification
,
fq_ordernum
:
obj
.
fq_ordernum
}
var
rtn
=
await
this
.
create
(
source
);
if
(
rtn
)
{
return
{
"status"
:
0
,
"msg"
:
"success"
,
"data"
:
{
"orderNo"
:
obj
.
fq_ordernum
,
"channelServiceNo"
:
obj
.
BizId
,
"channelParams"
:
{}
},
"requestid"
:
obj
.
requestid
}
}
else
{
return
{
"status"
:
-
1
,
"msg"
:
"error"
,
"data"
:
{
"orderNo"
:
obj
.
fq_ordernum
,
"channelServiceNo"
:
obj
.
BizId
,
"channelParams"
:
{}
},
"requestid"
:
obj
.
requestid
}
}
}
}
//订单查询
async
ordersel
(
obj
)
{
if
(
!
obj
.
BizId
)
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
"订单号不能为空"
,
"module"
:
{
"orderId"
:
""
,
"orderStatus"
:
""
},
"requestId"
:
obj
.
requestid
,
"success"
:
false
}
}
var
transferinfo
=
await
this
.
findOne
({
ali_bizid
:
obj
.
BizId
});
if
(
transferinfo
)
{
return
{
"errorCode"
:
"OK"
,
"errorMsg"
:
""
,
"module"
:
{
"orderId"
:
transferinfo
.
fq_ordernum
,
"orderStatus"
:
transferinfo
.
aliorder_status
},
"requestId"
:
obj
.
requestid
,
"success"
:
true
}
}
else
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
"订单不存在"
,
"module"
:
{
"orderId"
:
""
,
"orderStatus"
:
""
},
"requestId"
:
obj
.
requestid
,
"success"
:
false
}
}
}
/*
返回20位业务订单号
prefix:业务前缀
*/
async
getBusUid
(
prefix
)
{
prefix
=
(
prefix
||
""
);
if
(
prefix
)
{
prefix
=
prefix
.
toUpperCase
();
}
var
prefixlength
=
prefix
.
length
;
var
subLen
=
8
-
prefixlength
;
var
uidStr
=
""
;
if
(
subLen
>
0
)
{
uidStr
=
await
this
.
getUidInfo
(
subLen
,
60
);
}
var
timStr
=
moment
().
format
(
"YYYYMMDDHHmm"
);
return
prefix
+
timStr
+
uidStr
;
}
//订单关闭
async
orderclose
(
obj
)
{
if
(
!
obj
.
BizId
)
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
"订单号不能为空"
,
"requestId"
:
obj
.
requestid
,
"success"
:
false
}
}
var
transferinfo
=
await
this
.
findOne
({
ali_bizid
:
obj
.
BizId
});
if
(
transferinfo
)
{
transferinfo
=
transferinfo
.
dataValues
;
if
(
transferinfo
.
transfer_status
==
"CLOSE_ORDER_REFUND"
)
{
return
{
"errorCode"
:
"OK"
,
"errorMsg"
:
""
,
"requestId"
:
obj
.
requestid
,
"success"
:
true
}
}
else
{
transferinfo
.
transfer_status
=
"CLOSE_ORDER_REFUND"
;
transferinfo
.
aliorder_status
=
"11"
;
await
this
.
update
(
transferinfo
);
return
{
"errorCode"
:
"OK"
,
"errorMsg"
:
""
,
"requestId"
:
obj
.
requestid
,
"success"
:
true
}
}
}
else
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
"订单不存在"
,
"requestId"
:
obj
.
requestid
,
"success"
:
false
}
}
}
//业务员分配
async
fenpeiowner
(
obj
)
{
if
(
!
obj
.
BizId
)
{
return
{
"errorCode"
:
"error"
,
"errorMsg"
:
"订单号不能为空"
,
"requestId"
:
obj
.
requestid
,
"success"
:
false
}
}
var
transferinfo
=
await
this
.
findOne
({
ali_bizid
:
obj
.
BizId
});
}
//订单确认
async
confirmorder
(
obj
)
{
if
(
!
obj
.
ali_bizid
)
{
return
{
status
:
"-1"
,
msg
:
"参数异常"
}
}
var
BizId
=
obj
.
ali_bizid
;
var
obj
=
{
action
:
"ConfirmOrder"
,
reqbody
:
{
BizId
:
BizId
}
}
try
{
var
result
=
await
this
.
aliclient
(
obj
)
return
result
;
}
catch
(
error
)
{
console
.
log
(
error
)
}
}
//取消订单
async
refuseorder
(
obj
)
{
if
(
!
obj
.
ali_bizid
)
{
return
{
status
:
"-1"
,
msg
:
"参数异常"
}
}
var
BizId
=
obj
.
ali_bizid
;
var
obj
=
{
action
:
"RefuseOrder"
,
reqbody
:
{
BizId
:
BizId
}
}
var
rtn
=
await
this
.
aliclient
(
obj
)
console
.
log
(
rtn
)
return
rtn
;
}
//补充材料
async
supplymaterail
(
obj
)
{
obj
.
buyer_businesslicense
=
obj
.
buyer_businesslicense
==
null
?
null
:
obj
.
buyer_businesslicense
.
split
(
"com//"
)[
1
];
obj
.
buyer_idcard
=
obj
.
buyer_idcard
==
null
?
null
:
obj
.
buyer_idcard
.
split
(
"com//"
)[
1
];
obj
.
seller_businesslicense
=
obj
.
seller_businesslicense
==
null
?
null
:
obj
.
seller_businesslicense
.
split
(
"com//"
)[
1
];
obj
.
seller_idcard
=
obj
.
seller_idcard
==
null
?
null
:
obj
.
seller_idcard
.
split
(
"com//"
)[
1
];
obj
.
seller_proxy
=
obj
.
seller_proxy
==
null
?
null
:
obj
.
seller_proxy
.
split
(
"com//"
)[
1
];
obj
.
tm_cert_url
=
obj
.
tm_cert_url
==
null
?
null
:
obj
.
tm_cert_url
.
split
(
"com//"
)[
1
];
obj
.
seller_apply
=
obj
.
seller_apply
==
null
?
null
:
obj
.
seller_apply
.
split
(
"com//"
)[
1
];
obj
.
transfer_cert_url
=
obj
.
transfer_cert_url
==
null
?
null
:
obj
.
transfer_cert_url
.
split
(
"com//"
)[
1
];
obj
.
notarization_url
=
obj
.
notarization_url
==
null
?
null
:
obj
.
notarization_url
.
split
(
"com//"
)[
1
];
obj
.
user_type
=
obj
.
user_type
==
"person"
?
2
:
1
;
var
sobj
=
{
action
:
"SupplyMaterail"
,
reqbody
:
{
BizId
:
obj
.
ali_bizid
,
ContactName
:
obj
.
contact_name
,
ContactMobile
:
parseInt
(
obj
.
contact_mobile
),
ContactEmail
:
obj
.
contact_email
,
CardNo
:
obj
.
cardno
,
Complete
:
true
,
UserType
:
obj
.
user_type
,
BuyerAddress
:
obj
.
buyer_address
,
BuyerBusinessLicense
:
obj
.
buyer_businesslicense
,
BuyerName
:
obj
.
buyer_name
,
BuyerIdCard
:
obj
.
buyer_idcard
,
SellerBusinessLicense
:
obj
.
seller_businesslicense
,
SellerIdCard
:
obj
.
seller_idcard
,
SellerProxy
:
obj
.
seller_proxy
,
RegistrationCert
:
obj
.
tm_cert_url
,
SellerApply
:
obj
.
seller_apply
,
Notarization
:
obj
.
notarization_url
+
","
+
obj
.
transfer_cert_url
}
}
console
.
log
(
sobj
);
var
result
=
await
this
.
aliclient
(
sobj
)
return
result
;
}
//尾款支付---调取阿里云查询后修改订单
async
querytradeproducelist
(
obj
)
{
if
(
!
obj
.
ali_bizid
)
{
return
{
status
:
"-1"
,
msg
:
"参数异常"
}
}
var
BizId
=
obj
.
ali_bizid
;
var
obj
=
{
action
:
"QueryTradeProduceList"
,
BizId
:
BizId
}
var
tradeinfo
=
await
this
.
aliclient
(
obj
);
return
tradeinfo
;
}
//服务商邮寄材料给用户
async
posttransfermatereial
(
obj
)
{
if
(
!
obj
.
ali_bizid
)
{
return
{
status
:
"-1"
,
msg
:
"参数异常"
}
}
if
(
!
obj
.
logistics
)
{
return
{
status
:
"-1"
,
msg
:
"参数异常"
}
}
var
BizId
=
obj
.
ali_bizid
;
var
obj
=
{
action
:
"PostTransferMaterial"
,
reqbody
:
{
BizId
:
BizId
,
Logistics
:
obj
.
logistics
}
}
var
result
=
await
this
.
aliclient
(
obj
)
return
result
;
}
//用户盖章后邮寄服务商
async
receivedtransfermaterail
(
obj
)
{
if
(
!
obj
.
ali_bizid
)
{
return
{
status
:
"-1"
,
msg
:
"参数异常"
}
}
var
BizId
=
obj
.
ali_bizid
;
var
obj
=
{
action
:
"ReceivedTransferMaterail"
,
reqbody
:
{
BizId
:
BizId
}
}
var
rtn
=
await
this
.
aliclient
(
obj
)
console
.
log
(
rtn
)
return
rtn
;
}
//服务商递交到商标局
async
submittedtransfermaterail
(
obj
)
{
if
(
!
obj
.
ali_bizid
)
{
return
{
status
:
"-1"
,
msg
:
"参数异常"
}
}
var
BizId
=
obj
.
ali_bizid
;
var
obj
=
{
action
:
"SubmittedTransferMaterail"
,
reqbody
:
{
BizId
:
BizId
}
}
return
await
this
.
aliclient
(
obj
);
}
//商标局受理
async
acceptedtransfermaterail
(
obj
)
{
if
(
!
obj
.
ali_bizid
)
{
return
{
status
:
"-1"
,
msg
:
"参数异常"
}
}
var
obj
=
{
action
:
"AcceptedTransferMaterail"
,
reqbody
:
{
BizId
:
obj
.
ali_bizid
}
}
var
rtn
=
await
this
.
aliclient
(
obj
)
console
.
log
(
rtn
)
return
rtn
;
}
//商标局核准通过
async
approvedtransfer
(
obj
)
{
if
(
!
obj
.
ali_bizid
)
{
return
{
status
:
"-1"
,
msg
:
"参数异常"
}
}
var
obj
=
{
action
:
"ApprovedTransfer"
,
reqbody
:
{
BizId
:
obj
.
ali_bizid
}
}
var
rtn
=
await
this
.
aliclient
(
obj
)
console
.
log
(
rtn
)
return
rtn
;
}
//商标局核准不通过
async
refusetransfer
(
obj
)
{
if
(
!
obj
.
ali_bizid
)
{
return
{
status
:
"-1"
,
msg
:
"参数异常"
}
}
var
obj
=
{
action
:
"RefuseTransfer"
,
reqbody
:
{
BizId
:
obj
.
ali_bizid
}
}
var
rtn
=
await
this
.
aliclient
(
obj
)
console
.
log
(
rtn
)
return
rtn
;
}
//完成交易成功
async
tradesuccess
(
obj
)
{
if
(
!
obj
.
ali_bizid
)
{
return
{
status
:
"-1"
,
msg
:
"参数异常"
}
}
var
obj
=
{
action
:
"TradeSuccess"
,
reqbody
:
{
BizId
:
obj
.
ali_bizid
}
}
var
rtn
=
await
this
.
aliclient
(
obj
)
console
.
log
(
rtn
)
return
rtn
;
}
//交易失败
async
tradefail
(
obj
)
{
if
(
!
obj
.
ali_bizid
)
{
return
{
status
:
"-1"
,
msg
:
"参数异常"
}
}
var
obj
=
{
action
:
"TradeFail"
,
reqbody
:
{
BizId
:
obj
.
ali_bizid
}
}
var
rtn
=
await
this
.
aliclient
(
obj
)
console
.
log
(
rtn
)
return
rtn
;
}
//买卖家沟通记录
async
writecommunicationlog
(
obj
)
{
var
obj
=
{
action
:
"WriteCommunicationLog"
,
reqbody
:
{
BizId
:
obj
.
ali_bizid
,
note
:
obj
.
note
}
}
var
rtn
=
await
this
.
aliclient
(
obj
)
console
.
log
(
rtn
)
return
rtn
;
}
//获取签名
async
generateuploadfilepolicy
(
obj
)
{
var
self
=
this
;;
var
gobj
=
{
action
:
"GenerateUploadFilePolicy"
,
reqbody
:
{
FileType
:
"ATTORNEY"
}
}
if
(
obj
.
BizId
)
{
gobj
[
"reqbody"
]
=
{
BizId
:
BizId
,
FilyType
:
"PARTNER_SYNC_FILE"
};
}
return
await
self
.
aliclient
(
gobj
);
}
async
uppaymentstatus
()
{
var
selsql
=
"select * from trade_transfer where transfer_status='PROVIDE_MATERIAL' or transfer_status='BUYER_EXPRESS'"
;
var
transferinfos
=
await
this
.
dao
.
customQuery
(
selsql
);
var
obj
=
{
action
:
"QueryTradeProduceList"
}
var
tradeinfo
=
await
this
.
aliclient
(
obj
);
if
(
!
tradeinfo
&&
tradeinfo
.
Data
.
TradeProduces
.
length
>
0
)
{
return
{
status
:
-
1
,
msg
:
"阿里订单查询失败"
,
data
:
null
}
}
var
aliorder
=
tradeinfo
.
Data
.
TradeProduces
;
var
faillist
=
[];
if
(
transferinfos
)
{
for
(
let
i
=
0
;
i
<
transferinfos
.
length
;
i
++
)
{
var
transferinfo
=
transferinfos
[
i
];
var
aliorderindex
=
aliorder
.
findIndex
(
f
=>
f
.
BizId
==
transferinfo
.
ali_bizid
)
if
(
aliorderindex
>
-
1
&&
aliorder
[
aliorderindex
].
BuyerStatus
==
11
)
{
var
upd
=
await
this
.
dao
.
model
.
update
({
transfer_status
:
"PAY_OVER"
},
{
where
:
{
ali_bizid
:
transferinfo
.
ali_bizid
}
});
if
(
!
upd
)
{
faillist
.
push
(
transferinfo
.
ali_bizid
);
}
}
if
(
aliorderindex
>
-
1
&&
aliorder
[
aliorderindex
].
BuyerStatus
==
22
)
{
var
upd
=
await
this
.
dao
.
model
.
update
({
transfer_status
:
"MATERIAL_PROVIDE"
},
{
where
:
{
ali_bizid
:
transferinfo
.
ali_bizid
}
});
if
(
!
upd
)
{
faillist
.
push
(
transferinfo
.
ali_bizid
);
}
}
}
}
return
{
status
:
0
,
msg
:
"成功"
,
data
:
faillist
}
}
}
module
.
exports
=
TradetransferService
;
gsb-marketplat/app/config/settings.js
View file @
97c05708
...
...
@@ -16,7 +16,7 @@ var settings = {
salt
:
"%iatpD1gcxz7iF#B"
,
defaultpwd
:
"gsb2020"
,
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
port
:
process
.
env
.
NODE_PORT
||
8002
,
port
:
process
.
env
.
NODE_PORT
||
3003
,
logindex
:
"center_manage"
,
appname
:
"gsb_marketplat"
,
kongurl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
var
localsettings
=
require
(
"./localsettings"
);
return
localsettings
.
kongurl
;
}
else
{
return
ENVINPUT
.
KONG_ADMIAN
;
}
},
...
...
@@ -48,6 +48,27 @@ var settings = {
return
"http://sytxpublic-msgq-service"
;
}
},
paasUrl
:
function
(){
if
(
this
.
env
==
"dev"
){
return
"http://60.205.209.94:4001/"
;
}
else
{
return
"https://open.gongsibao.com/"
;
}
},
channelApiUrl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
return
"http://60.205.209.94:4003"
;
}
else
{
return
"http://zc-channel-service"
;
}
},
uploadfileossurl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
return
"http://192.168.49.170:8080"
;
}
else
{
return
"http://localhost:8080"
;
}
},
pmappid
:
1
,
pmcompanyid
:
1
,
pmroleid
:
{
"ta"
:
1
,
"pr"
:
2
},
...
...
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