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
1dede7eb
Commit
1dede7eb
authored
Apr 14, 2020
by
王栋源
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wdy
parent
63de000a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
229 additions
and
39 deletions
+229
-39
center-channel/app/base/api/impl/auth/accessAuth.js
+1
-1
center-channel/app/base/api/impl/opreceive/need.js
+12
-0
center-channel/app/base/service/impl/common/centerorderSve.js
+105
-21
center-channel/app/base/service/impl/utilsSve/utilsNeedSve.js
+76
-3
center-channel/app/base/utils/ossClient.js
+35
-14
No files found.
center-channel/app/base/api/impl/auth/accessAuth.js
View file @
1dede7eb
...
...
@@ -35,7 +35,7 @@ class AccessAuthAPI extends WEBBase {
endpoint
:
"https://trademark.aliyuncs.com"
,
apiVersion
:
"2019-09-02"
};
opResult
=
await
this
.
utilsTmAliyunSve
.
getAliOssInfo
(
null
,
"
ICON
"
,
rpcParam
);
opResult
=
await
this
.
utilsTmAliyunSve
.
getAliOssInfo
(
null
,
"
ATTORNEY
"
,
rpcParam
);
var
tmo
=
0
;
// opResult = system.getResultSuccess(null, "测试成功");
break
;
...
...
center-channel/app/base/api/impl/opreceive/need.js
View file @
1dede7eb
...
...
@@ -26,6 +26,7 @@ class Need extends APIBase {
}
async
opActionProcess
(
pobj
,
action_process
,
action_type
,
action_body
,
req
)
{
pobj
.
requestId
=
req
.
requestId
;
var
self
=
this
;
var
opResult
=
null
;
switch
(
action_type
)
{
case
"submitNeed"
:
//提交需求
...
...
@@ -37,6 +38,17 @@ class Need extends APIBase {
case
"receiveFeedback"
:
//接收方案反馈信息
opResult
=
await
this
.
centerorderSve
.
reqCenterOrderApi
(
pobj
);
break
;
case
"icpFeedbackSubmit"
:
//icp接收方案反馈信息
opResult
=
await
this
.
utilsNeedSve
.
icpFeedbackSubmit
(
pobj
);
break
;
case
"icpNotify"
:
//icp方案更新
var
rtn
=
await
this
.
utilsNeedSve
.
icpNotify
(
pobj
,
pobj
.
actionBody
);
if
(
pobj
.
actionBody
.
status
==
4
&&
rtn
.
status
==
0
)
{
opResult
=
await
self
.
utilsNeedSve
.
icpNotify
(
pobj
,
pobj
.
actionBody
);
}
else
{
opResult
=
rtn
;
}
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
...
...
center-channel/app/base/service/impl/common/centerorderSve.js
View file @
1dede7eb
...
...
@@ -23,21 +23,21 @@ class CenterorderService {
//提交公司注册方案
async
submitProgramme
(
pobj
)
{
var
res
=
await
this
.
reqCenterOrderApi
(
pobj
);
if
(
res
&&
res
.
status
==
0
&&
res
.
data
&&
res
.
data
.
needinfo
&&
res
.
data
.
needsolution
)
{
if
(
res
&&
res
.
status
==
0
&&
res
.
data
&&
res
.
data
.
needinfo
&&
res
.
data
.
needsolution
)
{
var
needinfo
=
res
.
data
.
needinfo
;
//需求信息
var
needsolution
=
res
.
data
.
needsolution
;
//方案信息
var
ab
=
pobj
.
actionBody
;
if
(
typeof
(
ab
.
solutionContent
)
==
"string"
)
{
if
(
typeof
(
ab
.
solutionContent
)
==
"string"
)
{
ab
.
solutionContent
=
JSON
.
parse
(
ab
.
solutionContent
);
}
//推送数据至阿里
var
bizType
=
needinfo
.
channelTypeCode
;
//业务类型里
var
pushObj
=
{
intentionBizId
:
needinfo
.
channelNeedNo
,
bizType
:
bizType
,
solution
:
JSON
.
stringify
(
ab
.
solutionContent
.
solution
)
intentionBizId
:
needinfo
.
channelNeedNo
,
bizType
:
bizType
,
solution
:
JSON
.
stringify
(
ab
.
solutionContent
.
solution
)
};
var
self
=
this
;
//推送方案
this
.
pushSubmitSolution
(
pushObj
,
needsolution
.
solutionNo
,
pobj
.
appInfo
,
self
);
this
.
pushSubmitSolution
(
pushObj
,
needsolution
.
solutionNo
,
pobj
.
appInfo
,
self
);
// this.aliclient.reqbyget({action:"SubmitSolution",reqbody:pushObj}).then(pushRes=>{
// if(pushRes && pushRes.status==0 && pushRes.data){
// var resData = pushRes.data;
...
...
@@ -52,26 +52,26 @@ class CenterorderService {
// }
// });
//推送需求小记
if
(
needinfo
.
pushflag
&&
needinfo
.
pushflag
==
1
)
{
//推送标志 值为1推送需求小记
var
pushObj2
=
{
intentionBizId
:
needinfo
.
channelNeedNo
,
note
:
"创建方案"
if
(
needinfo
.
pushflag
&&
needinfo
.
pushflag
==
1
)
{
//推送标志 值为1推送需求小记
var
pushObj2
=
{
intentionBizId
:
needinfo
.
channelNeedNo
,
note
:
"创建方案"
};
this
.
aliclient
.
reqbyget
({
action
:
"SubmitIntentionNote"
,
reqbody
:
pushObj2
});
this
.
aliclient
.
reqbyget
({
action
:
"SubmitIntentionNote"
,
reqbody
:
pushObj2
});
}
}
return
system
.
getResultSuccess
();
}
//推送方案
async
pushSubmitSolution
(
pushObj
,
solutionNo
,
appInfo
,
self
)
{
var
pushRes
=
await
self
.
aliclient
.
reqbyget
({
action
:
"SubmitSolution"
,
reqbody
:
pushObj
});
if
(
pushRes
&&
pushRes
.
status
==
0
&&
pushRes
.
data
)
{
async
pushSubmitSolution
(
pushObj
,
solutionNo
,
appInfo
,
self
)
{
var
pushRes
=
await
self
.
aliclient
.
reqbyget
({
action
:
"SubmitSolution"
,
reqbody
:
pushObj
});
if
(
pushRes
&&
pushRes
.
status
==
0
&&
pushRes
.
data
)
{
var
resData
=
pushRes
.
data
;
var
reqObj2
=
{
actionType
:
"receiveProgrammeNo"
,
appInfo
:
appInfo
,
actionBody
:{
solutionNo
:
solutionNo
,
solutionBizId
:
resData
.
SolutionBizId
actionType
:
"receiveProgrammeNo"
,
appInfo
:
appInfo
,
actionBody
:
{
solutionNo
:
solutionNo
,
solutionBizId
:
resData
.
SolutionBizId
}
};
var
a
=
await
self
.
reqCenterOrderApi
(
reqObj2
);
//保存渠道方案id
...
...
@@ -84,9 +84,9 @@ class CenterorderService {
if
(
res
&&
res
.
status
==
0
&&
res
.
data
&&
res
.
data
.
channelSolutionNo
)
{
//推送数据至阿里
var
pushObj
=
{
solutionBizId
:
res
.
data
.
channelSolutionNo
,
note
:
pobj
.
actionBody
.
note
||
""
solutionBizId
:
res
.
data
.
channelSolutionNo
,
note
:
pobj
.
actionBody
.
note
||
""
};
this
.
aliclient
.
reqbyget
({
action
:
"RejectSolution"
,
reqbody
:
pushObj
})
this
.
aliclient
.
reqbyget
({
action
:
"RejectSolution"
,
reqbody
:
pushObj
})
}
return
res
;
}
...
...
@@ -161,7 +161,7 @@ class CenterorderService {
}
var
orderrtn
=
await
this
.
utilsOrderSve
.
addOrder
(
pobj
,
pobj
.
actionBody
);
if
(
orderrtn
.
status
!=
0
)
{
if
(
orderrtn
.
status
==-
1
)
{
if
(
orderrtn
.
status
==
-
1
)
{
return
system
.
getResultSuccess
(
null
,
"订单已经创建"
);
}
return
system
.
getResultFail
(
-
5012
,
"订单创建失败"
);
...
...
@@ -170,7 +170,7 @@ class CenterorderService {
pobj
.
actionBody
.
orderNo
=
orderrtn
.
data
.
orderNo
}
if
(
pobj
.
actionBody
.
solutionBizId
)
{
pobj
.
actionBody
.
channelSolutionNo
=
pobj
.
actionBody
.
solutionBizId
;
pobj
.
actionBody
.
channelSolutionNo
=
pobj
.
actionBody
.
solutionBizId
;
pobj
.
actionType
=
"receiveSolutionPayInfo"
;
}
else
{
pobj
.
actionType
=
"createSolutionByOrder"
;
...
...
@@ -188,7 +188,91 @@ class CenterorderService {
pobj
.
actionBody
.
needId
=
solutiondata
.
data
.
channelNeedNo
;
}
if
(
solutiondata
.
status
==
0
)
{
pobj
.
actionBody
.
orderNo
=
pobj
.
actionBody
.
channelOrder
.
channelOrderNo
;
pobj
.
actionBody
.
orderNo
=
pobj
.
actionBody
.
channelOrder
.
channelOrderNo
;
this
.
utilsPushSve
.
aliBusiness2Fq
(
pobj
,
"pushOrderBusiness"
);
}
return
system
.
getResultSuccess
();
}
async
icppaysuccess
(
pobj
)
{
if
(
!
pobj
.
actionBody
.
bizId
)
{
return
system
.
getResult
(
null
,
"actionBody.bizId can not be empty,100491"
);
}
var
solutionobj
=
{
actionType
:
""
,
actionBody
:
pobj
.
actionBody
.
bizId
,
appInfo
:
pobj
.
appInfo
,
actionProcess
:
pobj
.
actionProcess
}
var
solutionrtn
=
await
this
.
execClient
.
execPost
(
solutionobj
,
url
);
if
(
!
solutionrtn
||
!
solutionrtn
.
stdout
)
{
return
system
.
getResultFail
(
-
5011
,
"方案查询失败"
);
}
var
solutiondata
=
JSON
.
parse
(
solutionrtn
.
stdout
);
if
(
solutiondata
.
status
!=
0
)
{
return
system
.
getResultFail
(
-
5011
,
"方案查询失败"
);
}
if
(
solutiondata
.
data
&&
solutiondata
.
data
.
channelNeedNo
)
{
pobj
.
actionBody
.
needId
=
solutiondata
.
data
.
channelNeedNo
;
}
var
reqUrl
=
this
.
centerOrderUrl
+
"action/need/springBoard"
;
var
itemResult
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
if
(
needResult
.
status
!=
0
)
{
return
needResult
;
}
var
sobj
=
{
actionType
:
"getaliicpProduce"
,
actionBody
:
pobj
.
actionBody
,
appInfo
:
pobj
.
appInfo
,
actionProcess
:
pobj
.
actionProcess
}
var
url
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
rtn
=
await
this
.
execClient
.
execPost
(
sobj
,
url
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResultFail
(
-
5010
,
"产品查询失败"
);
}
var
data
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
data
.
status
!=
0
)
{
return
system
.
getResultFail
(
-
5010
,
"产品查询失败"
);
}
pobj
.
actionBody
=
data
.
data
;
pobj
.
actionBody
.
orderNo
=
pobj
.
actionBody
.
bizId
;
pobj
.
actionBody
.
totalSum
=
pobj
.
actionBody
.
price
;
pobj
.
actionBody
.
payTotalSum
=
pobj
.
actionBody
.
price
;
pobj
.
actionBody
.
quantity
=
1
;
pobj
.
actionBody
.
channelOrder
=
{
channelServiceNo
:
pobj
.
actionBody
.
orderNo
,
channelOrderNo
:
pobj
.
actionBody
.
orderNo
,
orderStatus
:
2
}
var
orderrtn
=
await
this
.
utilsOrderSve
.
addOrder
(
pobj
,
pobj
.
actionBody
);
if
(
orderrtn
.
status
!=
0
)
{
if
(
orderrtn
.
status
==
-
1
)
{
return
system
.
getResultSuccess
(
null
,
"订单已经创建"
);
}
return
system
.
getResultFail
(
-
5012
,
"订单创建失败"
);
}
if
(
orderrtn
.
data
)
{
pobj
.
actionBody
.
orderNo
=
orderrtn
.
data
.
orderNo
}
pobj
.
actionBody
.
channelSolutionNo
=
pobj
.
actionBody
.
solutionBizId
;
pobj
.
actionType
=
"receiveSolutionPayInfo"
;
var
url
=
settings
.
centerOrderUrl
()
+
"action/icapi/springBoard"
;
var
solutionrtn
=
await
this
.
execClient
.
execPost
(
pobj
,
url
);
if
(
!
solutionrtn
||
!
solutionrtn
.
stdout
)
{
return
system
.
getResultFail
(
-
5011
,
"方案查询失败"
);
}
var
solutiondata
=
JSON
.
parse
(
solutionrtn
.
stdout
);
if
(
solutiondata
.
status
!=
0
)
{
return
system
.
getResultFail
(
-
5011
,
"方案查询失败"
);
}
if
(
solutiondata
.
data
&&
solutiondata
.
data
.
channelNeedNo
)
{
pobj
.
actionBody
.
needId
=
solutiondata
.
data
.
channelNeedNo
;
}
if
(
solutiondata
.
status
==
0
)
{
pobj
.
actionBody
.
orderNo
=
pobj
.
actionBody
.
channelOrder
.
channelOrderNo
;
this
.
utilsPushSve
.
aliBusiness2Fq
(
pobj
,
"pushOrderBusiness"
);
}
return
system
.
getResultSuccess
();
...
...
center-channel/app/base/service/impl/utilsSve/utilsNeedSve.js
View file @
1dede7eb
...
...
@@ -7,6 +7,7 @@ class UtilsNeedService extends AppServiceBase {
super
();
this
.
centerOrderUrl
=
settings
.
centerOrderUrl
();
this
.
utilsPushSve
=
system
.
getObject
(
"service.utilsSve.utilsPushSve"
);
this
.
ossClient
=
system
.
getObject
(
"util.ossClient"
);
}
/**
...
...
@@ -18,8 +19,8 @@ class UtilsNeedService extends AppServiceBase {
if
(
!
actionBody
.
intentionBizId
)
{
return
system
.
getResult
(
null
,
"actionBody.intentionBizId can not be empty,100380"
);
}
var
sobj
=
pobj
;
sobj
.
actionType
=
"getProductTypeInfo"
;
var
sobj
=
pobj
;
sobj
.
actionType
=
"getProductTypeInfo"
;
var
url
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
var
rtn
=
await
this
.
execClient
.
execPost
(
sobj
,
url
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
...
...
@@ -33,7 +34,7 @@ class UtilsNeedService extends AppServiceBase {
pobj
.
actionBody
.
type_name
=
data
.
data
.
type_name
;
pobj
.
actionBody
.
channel_type_code
=
data
.
data
.
channel_type_code
;
pobj
.
actionBody
.
channel_type_name
=
data
.
data
.
channel_type_name
;
pobj
.
actionType
=
"submitNeed"
;
pobj
.
actionType
=
"submitNeed"
;
var
reqUrl
=
this
.
centerOrderUrl
+
"action/need/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
if
(
result
.
status
==
0
)
{
...
...
@@ -41,6 +42,18 @@ class UtilsNeedService extends AppServiceBase {
}
return
result
;
}
//调用center-order icp需求反馈
async
reqCenterOrderApi
(
pobj
,
reqUrl
)
{
var
url
=
this
.
centerOrderUrl
+
"action/icpapi/springBoard"
;
if
(
reqUrl
)
{
var
url
=
this
.
centerOrderUrl
+
reqUrl
;
}
pobj
.
actionType
=
"abolishIcpProgramme"
;
var
rtn
=
await
this
.
execClient
.
execPost
(
pobj
,
url
);
var
data
=
JSON
.
parse
(
rtn
.
stdout
);
return
data
;
}
/**
* 获取需求详情
* @param {*} pobj
...
...
@@ -86,6 +99,66 @@ class UtilsNeedService extends AppServiceBase {
}
}
async
icpNotify
(
pobj
)
{
var
actionBody
=
pobj
.
actionBody
;
var
self
=
this
;
if
(
!
actionBody
.
bizId
)
{
return
system
.
getResult
(
null
,
"actionBody.bizId can not be empty,100495"
);
}
if
(
!
actionBody
.
status
)
{
return
system
.
getResult
(
null
,
"actionBody.status can not be empty,100495"
);
}
if
(
actionBody
.
businessLicense
)
{
actionBody
.
newbusinessLicense
=
await
self
.
ossClient
.
aliurl2zcurl
(
actionBody
.
businessLicense
);
}
if
(
actionBody
.
idCardUrlList
)
{
var
jsonidCardUrlList
=
JSON
.
stringify
(
actionBody
.
idCardUrlList
);
var
newidCardUrlList
=
[];
for
(
var
i
=
0
;
i
<
jsonidCardUrlList
.
length
;
i
++
)
{
var
key
=
jsonidCardUrlList
[
i
];
newidCardUrlList
.
push
(
await
self
.
ossClient
.
aliurl2zcurl
(
key
));
}
actionBody
.
newidCardUrlList
=
newidCardUrlList
;
}
if
(
actionBody
.
userPlan
)
{
actionBody
.
newuserPlan
=
await
self
.
ossClient
.
aliurl2zcurl
(
actionBody
.
userPlan
);
}
if
(
actionBody
.
userForeig
)
{
actionBody
.
newuserForeig
=
await
self
.
ossClient
.
aliurl2zcurl
(
actionBody
.
userForeig
);
}
if
(
actionBody
.
userLaw
)
{
actionBody
.
newuserLaw
=
await
self
.
ossClient
.
aliurl2zcurl
(
actionBody
.
userLaw
);
}
if
(
actionBody
.
userOtherList
)
{
var
jsonuserOtherList
=
JSON
.
stringify
(
actionBody
.
userOtherList
);
var
newuserOtherList
=
[];
for
(
var
i
=
0
;
i
<
jsonuserOtherList
.
length
;
i
++
)
{
var
key
=
jsonuserOtherList
[
i
];
newuserOtherList
.
push
(
await
self
.
ossClient
.
aliurl2zcurl
(
key
));
}
actionBody
.
newuserOtherList
=
newuserOtherList
;
}
if
(
actionBody
.
status
==
2
)
{
pobj
.
actionType
=
"submit"
;
var
url
=
settings
.
centerOrderUrl
()
+
"action/need/springBoard"
;
var
rtn
=
await
this
.
restPostUrl
(
pobj
,
url
);
return
rtn
;
}
if
(
actionBody
.
status
==
4
)
{
pobj
.
actionType
=
"close"
;
var
url
=
settings
.
centerOrderUrl
()
+
"action/need/springBoard"
;
var
rtn
=
await
this
.
restPostUrl
(
pobj
,
url
);
return
rtn
;
}
if
(
actionBody
.
status
==
11
)
{
pobj
.
actionType
=
"close"
;
var
url
=
settings
.
centerOrderUrl
()
+
"action/need/springBoard"
;
var
rtn
=
await
this
.
restPostUrl
(
pobj
,
url
);
return
rtn
;
}
}
}
module
.
exports
=
UtilsNeedService
;
center-channel/app/base/utils/ossClient.js
View file @
1dede7eb
var
co
=
require
(
'co'
);
var
OSS
=
require
(
'ali-oss'
);
class
OSSClient
{
constructor
(){
this
.
client
=
new
OSS
({
const
request
=
require
(
"request"
);
const
fs
=
require
(
"fs"
);
class
OSSClient
{
constructor
()
{
this
.
client
=
new
OSS
({
endpoint
:
'https://oss-cn-beijing.aliyuncs.com'
,
accessKeyId
:
'LTAIyAUK8AD04P5S'
,
accessKeySecret
:
'DHmRtFlw2Zr3KaRwUFeiu7FWATnmla'
});
this
.
client
.
useBucket
(
'gsb-zc'
);
}
async
downfile
(
key
){
var
me
=
this
;
var
result
=
await
co
(
function
*
()
{
var
result
=
yield
me
.
client
.
get
(
key
,
'/tmp/'
+
key
);
async
downfile
(
key
)
{
var
me
=
this
;
var
result
=
await
co
(
function
*
()
{
var
result
=
yield
me
.
client
.
get
(
key
,
'/tmp/'
+
key
);
return
result
;
});
return
result
;
}
async
upfile
(
key
,
filepath
)
{
var
me
=
this
;
var
result
=
await
co
(
function
*
()
{
async
upfile
(
key
,
filepath
)
{
var
me
=
this
;
var
result
=
await
co
(
function
*
()
{
var
result
=
yield
me
.
client
.
put
(
key
,
filepath
);
return
result
;
})
return
result
;
}
async
putBuffer
(
key
,
buf
)
{
async
putBuffer
(
key
,
buf
)
{
try
{
var
result
=
await
this
.
client
.
put
(
key
,
buf
);
console
.
log
(
result
);
...
...
@@ -35,10 +37,29 @@ class OSSClient{
return
null
}
}
async
aliurl2zcurl
(
key
)
{
var
writeStream
=
fs
.
createWriteStream
(
"/tmp/"
+
key
.
split
(
"/"
).
pop
())
request
(
key
).
pipe
(
writeStream
);
writeStream
.
on
(
'finish'
,
function
()
{
oss
.
upfile
(
"20200412aaa33.jpg"
,
"/tmp/"
+
key
.
split
(
"/"
).
pop
()).
then
(
function
(
result
)
{
console
.
log
(
result
.
res
.
requestUrls
[
0
]);
return
result
.
res
.
requestUrls
[
0
];
});
})
}
}
module
.
exports
=
OSSClient
;
// var oss=new OSSClient();
// var key="netsharp_QSzjD4HdKdTmRR6b5486pEA3AbsW8Pr8.jpg"
module
.
exports
=
OSSClient
;
// var oss = new OSSClient();
// var key = "https://gsb-zc.oss-cn-beijing.aliyuncs.com/zc_86315541780601882019212740188%E4%B9%A6.jpg";
// oss.downossurlfile(key);
// /tmp/zc_86315541780601882019212740188%E4%B9%A6.jpg
// oss.upfile("20200412aaa.jpg","/tmp/zc_86315541780601882019212740188%E4%B9%A6.jpg").then(function(result){
// console.log(result);
// });
// oss.upfile(key,"/usr/devws/OMC/igirl-api/r3.jpg").then(function(result){
// console.log(result);
// });
...
...
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