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
e94e2080
Commit
e94e2080
authored
Jul 28, 2020
by
linboxuan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'center-order' of
http://gitlab.gongsibao.com/jiangyong/zhichan
into center-order
parents
3c55753f
18cec1f2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
741 additions
and
0 deletions
+741
-0
center-order/app/base/api/impl/action/qcapi.js
+75
-0
center-order/app/base/service/impl/qcutils/aliyunqcSve.js
+666
-0
No files found.
center-order/app/base/api/impl/action/qcapi.js
0 → 100644
View file @
e94e2080
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
class
QcAPI
extends
APIBase
{
constructor
()
{
super
();
this
.
aliyunqcSve
=
system
.
getObject
(
"service.qcutils.aliyunqcSve"
);
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async
springBoard
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
actionType
)
{
return
system
.
getResult
(
null
,
"actionType参数不能为空"
);
}
if
(
pobj
.
actionType
==
'getPolicyNeedList'
||
pobj
.
actionType
==
'submitPolicyNeedNotes'
)
{
if
(
!
pobj
.
userInfo
)
{
return
system
.
getResult
(
system
.
noLogin
,
"user no login!"
);
}
if
(
!
pobj
.
appInfo
)
{
return
system
.
getResult
(
system
.
noLogin
,
"app is null!"
);
}
}
var
result
=
await
this
.
opActionProcess
(
pobj
,
pobj
.
actionType
,
req
);
return
result
;
}
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
var
opResult
=
null
;
switch
(
action_type
)
{
case
"receiveProgrammeNo"
:
//接收方案编号(方案推送至阿里后,接收保存方案信息)
opResult
=
await
this
.
aliyunqcSve
.
receiveProgrammeNo
(
pobj
);
break
;
case
"submitIcpProgramme"
:
//icp方案提交
opResult
=
await
this
.
aliyunqcSve
.
submitIcpProgramme
(
pobj
);
break
;
case
"submitIcpMaterial"
:
//icp材料提交
opResult
=
await
this
.
aliyunqcSve
.
submitIcpMaterial
(
pobj
);
break
;
case
"acceptIcpPartnerNotification"
:
//icp通知状态变更
opResult
=
await
this
.
aliyunqcSve
.
acceptIcpPartnerNotification
(
pobj
);
break
;
case
"abolishIcpProgramme"
:
//服务商icp方案关闭
opResult
=
await
this
.
aliyunqcSve
.
abolishIcpProgramme
(
pobj
);
break
;
case
"getIcpProgrammeDetail"
:
//获取icp方案
opResult
=
await
this
.
aliyunqcSve
.
getIcpProgrammeDetail
(
pobj
);
break
;
case
"getNeedSolutionDetailByUser"
:
//获取方案详情
opResult
=
await
this
.
aliyunqcSve
.
getNeedSolutionDetailByUser
(
pobj
);
break
;
case
"receiveIcpStatusNotify"
:
//接收渠道方案状态变更通知
opResult
=
await
this
.
aliyunqcSve
.
receiveIcpStatusNotify
(
pobj
);
break
;
case
"receiveIcpFeedback"
:
//接收icp用户方案反馈
opResult
=
await
this
.
aliyunqcSve
.
receiveIcpFeedback
(
pobj
);
break
;
case
"getIcpProgrammeDetail"
:
//获取方案详情(内部调用)
opResult
=
await
this
.
aliyunqcSve
.
getIcpProgrammeDetail
(
pobj
);
break
;
case
"getProgrammeInfoByChannelNeedNo"
:
//获取需求方案列表
opResult
=
await
this
.
aliyunqcSve
.
getProgrammeInfoByChannelNeedNo
(
pobj
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
}
return
opResult
;
}
}
module
.
exports
=
QcAPI
;
\ No newline at end of file
center-order/app/base/service/impl/qcutils/aliyunqcSve.js
0 → 100644
View file @
e94e2080
const
system
=
require
(
"../../../system"
);
const
moment
=
require
(
'moment'
)
/**
* 阿里云增值电信相关接口(ICP、EDI)
* created by zhuangbing
* created at 2020.07.27
*/
class
AliyunQcService
{
constructor
()
{
this
.
needsolutionDao
=
system
.
getObject
(
"db.dbneed.needsolutionDao"
);
this
.
needinfoDao
=
system
.
getObject
(
"db.dbneed.needinfoDao"
);
this
.
orderinfoDao
=
system
.
getObject
(
"db.dbcorder.orderinfoDao"
);
this
.
icpSolutionStatusReference
=
{
SOLUTION_SUBMIT
:
"提交服务单"
,
UN_PAID
:
"未支付"
,
PAID
:
"用户支付"
,
USER_UPLOADED
:
"用户上传资料"
,
MATERIAL_UNCONFIRM
:
"服务商递交⽂件"
,
USER_CONFIRMED
:
"⽤户已确认递交⽂件"
,
ACCOUNT_REGISTERED
:
"完成账户注册"
,
MATERIAL_SUBMITTED
:
"完成资料递交"
,
GXB_ACCEPT
:
"⼯信部已受理"
,
GXB_REFUSE
:
"⼯信部不予受理"
,
GXB_FAIL
:
"⼯信部未通过"
,
GXB_SUCCESS
:
"工信部通过"
,
CLOSE
:
"方案关闭"
};
this
.
icpApplicationStatusReference
=
{
507
:
"完成账户注册"
,
508
:
"服务商完成提交资料到⼯信部"
,
509
:
"⼯商部已受理"
,
510
:
"⼯商部不予受理"
,
511
:
"⼯商部通过"
,
512
:
"⼯商部未通过"
};
}
//根据需求查看方案列表
async
getProgrammeInfoByChannelNeedNo
(
pobj
)
{
var
ab
=
pobj
.
actionBody
;
var
user
=
pobj
.
userInfo
;
if
(
!
user
||
!
user
.
id
)
{
return
system
.
getResultFail
(
-
100
,
"未知用户"
);
}
ab
[
"createUserId"
]
=
user
.
id
;
if
(
!
ab
.
needNo
)
{
return
system
.
getResultFail
(
-
101
,
"需求号不能为空"
);
}
//获取需求信息
var
needinfo
=
await
this
.
needinfoDao
.
model
.
findOne
({
where
:
{
channelNeedNo
:
ab
.
needNo
},
raw
:
true
});
if
(
!
needinfo
||
!
needinfo
.
id
)
{
return
system
.
getResultFail
(
-
102
,
"未知需求信息"
);
}
var
ns
=
await
this
.
needsolutionDao
.
model
.
findAll
({
where
:
{
needNo
:
needinfo
.
needNo
,
createUserId
:
user
.
id
},
raw
:
true
,
attributes
:
[
"needNo"
,
"solutionNo"
,
"channelSolutionNo"
,
"orderNo"
,
"solutionContent"
,
"status"
,
"statusName"
]
});
return
system
.
getResultSuccess
(
ns
);
}
//获取方案详情(内部调用)
async
getIcpProgrammeDetail
(
pobj
)
{
var
ab
=
pobj
.
actionBody
;
if
(
!
ab
.
BizId
)
{
return
system
.
getResultFail
(
-
101
,
"方案编号不能为空"
);
}
//获取方案信息
var
ns
=
await
this
.
needsolutionDao
.
model
.
findAll
({
where
:
{
channelSolutionNo
:
ab
.
BizId
},
raw
:
true
});
return
system
.
getResultSuccess
(
ns
);
}
//获取方案详情(前端调用)
async
getNeedSolutionDetailByUser
(
pobj
)
{
var
ab
=
pobj
.
actionBody
;
var
user
=
pobj
.
userInfo
;
if
(
!
user
||
!
user
.
id
)
{
return
system
.
getResultFail
(
-
100
,
"未知用户"
);
}
// ab["createUserId"]=user.id;
if
(
!
ab
.
solutionNo
)
{
return
system
.
getResultFail
(
-
101
,
"方案编号不能为空"
);
}
//获取方案信息
var
ns
=
await
this
.
needsolutionDao
.
model
.
findOne
({
where
:
{
solutionNo
:
ab
.
solutionNo
,
createUserId
:
user
.
id
},
raw
:
true
});
if
(
ns
&&
ns
.
needNo
)
{
var
needinfo
=
await
this
.
needinfoDao
.
model
.
findOne
({
where
:
{
needNo
:
ns
.
needNo
},
raw
:
true
,
attributes
:
[
"publishName"
,
"publishMobile"
,
"channelUserId"
]
});
ns
.
needinfo
=
needinfo
;
}
return
system
.
getResultSuccess
(
ns
);
}
//提交方案
async
submitIcpProgramme
(
pobj
)
{
var
ab
=
pobj
.
actionBody
;
var
user
=
pobj
.
userInfo
;
if
(
!
user
||
!
user
.
id
)
{
return
system
.
getResultFail
(
-
100
,
"未知用户"
);
}
ab
[
"createUserId"
]
=
user
.
id
;
if
(
!
ab
.
needNo
)
{
return
system
.
getResultFail
(
-
101
,
"渠道需求号不能为空"
);
}
if
(
!
ab
.
solutionContent
)
{
return
system
.
getResultFail
(
-
102
,
"方案信息有误"
);
}
//获取需求信息
var
needinfo
=
await
this
.
needinfoDao
.
model
.
findOne
({
where
:
{
channelNeedNo
:
ab
.
needNo
},
raw
:
true
});
if
(
!
needinfo
||
!
needinfo
.
id
)
{
return
system
.
getResultFail
(
-
201
,
"未知需求信息"
);
}
if
(
needinfo
.
status
==
"ycd"
||
needinfo
.
status
==
"ygb"
)
{
return
system
.
getResultFail
(
-
202
,
"该方案需求状态为"
+
needinfo
.
statusName
+
",不能创建方案"
);
}
var
bizType
=
ab
.
solutionContent
.
bizType
;
//业务类型
if
(
!
bizType
||
!
needinfo
.
typeCode
||
bizType
!=
needinfo
.
typeCode
)
{
return
system
.
getResultFail
(
-
205
,
"方案类型错误"
);
}
if
(
!
needinfo
.
channelTypeCode
)
{
return
system
.
getResultFail
(
-
206
,
"渠道方案类型错误"
);
}
ab
.
solutionContent
.
typeCode
=
needinfo
.
typeCode
;
ab
.
solutionContent
.
typeName
=
needinfo
.
typeName
;
var
ns
=
await
this
.
needsolutionDao
.
model
.
findAll
({
where
:
{
channelNeedNo
:
ab
.
needNo
},
raw
:
true
});
for
(
var
i
=
0
;
i
<
ns
.
length
;
i
++
)
{
var
fa
=
ns
[
i
];
if
(
fa
.
status
==
"dqr"
||
fa
.
status
==
"ywc"
)
{
return
system
.
getResultFail
(
-
207
,
"需求方案已存在,不能重复提交"
);
}
}
// if (!ab.solutionContent.solution) {
// return system.getResultFail(-104, "业务方案信息不能为空");
// }
var
solution
=
ab
.
solutionContent
.
solution
;
if
(
!
solution
)
{
return
system
.
getResultFail
(
-
103
,
"方案交付信息有误"
);
}
if
(
needinfo
.
channelTypeCode
==
"7"
)
{
//edi
ab
.
solutionContent
.
solution
.
IcpType
=
2
;
}
else
if
(
needinfo
.
channelTypeCode
==
"5"
)
{
//icp
ab
.
solutionContent
.
solution
.
IcpType
=
1
;
}
else
{
return
system
.
getResultFail
(
-
208
,
"需求业务类型有误"
);
}
// ab.solutionContent.applicationStatusList = [{
// "OfficialFileURL": "",
// "ApplicationStatus": "submitIcpProgramme",
// "ApplicationStatusName": "提交方案",
// "created_at": new Date()
// }];
if
(
!
solution
.
CompanyName
)
{
return
system
.
getResultFail
(
-
105
,
"公司名不能为空"
);
}
if
(
!
solution
.
CompanyAddress
)
{
return
system
.
getResultFail
(
-
106
,
"公司地址不能为空"
);
}
if
(
!
solution
.
Area
)
{
return
system
.
getResultFail
(
-
107
,
"区域不能为空"
);
}
var
solutionFlowList
=
ab
.
solutionContent
.
solutionFlowList
||
[];
solutionFlowList
.
push
({
status
:
"SOLUTION_SUBMIT"
,
statusName
:
this
.
icpSolutionStatusReference
.
SOLUTION_SUBMIT
,
updated_at
:
new
Date
()
});
ab
.
solutionContent
.
status
=
"SOLUTION_SUBMIT"
;
ab
.
solutionContent
.
statusName
=
this
.
icpSolutionStatusReference
.
SOLUTION_SUBMIT
;
ab
.
solutionContent
.
solutionFlowList
=
solutionFlowList
;
ab
[
"channelNeedNo"
]
=
needinfo
.
channelNeedNo
;
var
solutionNo
=
await
this
.
getBusUid
(
"ns"
);
ab
[
"solutionNo"
]
=
solutionNo
;
ab
[
"status"
]
=
"dqr"
;
ab
.
solutionContent
=
JSON
.
stringify
(
ab
.
solutionContent
);
var
self
=
this
;
return
await
this
.
needsolutionDao
.
db
.
transaction
(
async
function
(
t
)
{
ab
[
"needNo"
]
=
needinfo
.
needNo
;
var
od
=
await
self
.
needsolutionDao
.
create
(
ab
,
t
);
if
(
od
&&
od
.
id
)
{
var
needObj
=
{
id
:
needinfo
.
id
};
if
(
!
needinfo
.
followManUserId
)
{
needObj
=
{
id
:
needinfo
.
id
,
followManUserId
:
user
.
id
,
//跟进人id
followManName
:
user
.
channel_username
,
//跟进人姓名
followManMobile
:
user
.
mobile
,
//跟进人手机号(合伙人)
followManOnlyCode
:
user
.
channel_userid
};
}
if
(
!
needinfo
.
followContent
)
{
var
followContent
=
[{
followDate
:
new
Date
(),
content
:
"icp提交方案"
}];
followContent
=
JSON
.
stringify
(
followContent
);
needObj
[
"followContent"
]
=
followContent
;
}
await
self
.
needinfoDao
.
update
(
needObj
,
t
);
needinfo
=
await
self
.
needinfoDao
.
model
.
findOne
({
where
:
{
id
:
needinfo
.
id
},
raw
:
true
});
return
system
.
getResultSuccess
({
needinfo
:
needinfo
,
needsolution
:
od
});
}
else
{
return
system
.
getResultFail
(
-
302
,
"提交方案失败"
);
}
})
}
//服务商方案作废 -- abolishIcpProgramme
async
abolishIcpProgramme
(
pobj
)
{
var
ab
=
pobj
.
actionBody
;
var
user
=
pobj
.
userInfo
;
if
(
!
user
||
!
user
.
id
)
{
return
system
.
getResultFail
(
-
100
,
"未知用户"
);
}
if
(
!
ab
.
BizId
)
{
return
system
.
getResultFail
(
-
101
,
"渠道方案号不能为空"
);
}
if
(
!
ab
.
Note
)
{
return
system
.
getResultFail
(
-
106
,
"关闭理由不能为空"
);
}
//获取方案信息
var
ns
=
await
this
.
needsolutionDao
.
model
.
findOne
({
where
:
{
channelSolutionNo
:
ab
.
BizId
,
createUserId
:
user
.
id
},
raw
:
true
});
if
(
!
ns
||
!
ns
.
id
)
{
return
system
.
getResultFail
(
-
300
,
"未知方案"
);
}
var
needinfo
=
await
this
.
needinfoDao
.
model
.
findOne
({
where
:
{
needNo
:
ns
.
needNo
},
raw
:
true
});
if
(
!
needinfo
)
{
return
system
.
getResultFail
(
-
400
,
"未知方案需求"
);
}
if
(
needinfo
.
status
==
"ycd"
||
needinfo
.
status
==
"ygb"
)
{
return
system
.
getResultFail
(
-
401
,
"该方案需求状态为"
+
needinfo
.
statusName
+
",不能执行此操作"
);
}
if
(
ns
.
status
!=
"dqr"
)
{
return
system
.
getResultFail
(
-
301
,
"方案状态错误,只能废弃待确认方案"
);
}
var
solutionContent
=
ns
.
solutionContent
;
// if (!solutionContent.status || ["USER_UPLOADED", "MATERIAL_UNCONFIRM", "USER_CONFIRMED", "ACCOUNT_REGISTERED", "MATERIAL_SUBMITTED"].indexOf(solutionContent.status) < 0) {
// return system.getResultFail(-302, "方案流程状态错误,不能执行此操作");
// }
solutionContent
.
serviceProviderNote
=
ab
.
Note
;
solutionContent
=
JSON
.
stringify
(
solutionContent
);
await
this
.
needsolutionDao
.
update
({
id
:
ns
.
id
,
status
:
"yzf"
,
solutionContent
:
solutionContent
});
//方案废弃
//获取方案信息
ns
=
await
this
.
needsolutionDao
.
model
.
findOne
({
where
:
{
channelSolutionNo
:
ab
.
BizId
,
createUserId
:
user
.
id
},
raw
:
true
});
return
system
.
getResultSuccess
(
ns
);
}
//提交icp材料信息
async
submitIcpMaterial
(
pobj
)
{
var
ab
=
pobj
.
actionBody
;
var
user
=
pobj
.
userInfo
;
if
(
!
user
||
!
user
.
id
)
{
return
system
.
getResultFail
(
-
100
,
"未知用户"
);
}
ab
[
"createUserId"
]
=
user
.
id
;
if
(
!
ab
.
BizId
)
{
return
system
.
getResultFail
(
-
101
,
"渠道方案编号不能为空"
);
}
if
(
!
ab
.
material
)
{
return
system
.
getResultFail
(
-
102
,
"材料信息有误"
);
}
//获取方案信息
var
needsolutioninfo
=
await
this
.
needsolutionDao
.
model
.
findOne
({
where
:
{
channelSolutionNo
:
ab
.
BizId
},
raw
:
true
});
if
(
!
needsolutioninfo
||
!
needsolutioninfo
.
id
)
{
return
system
.
getResultFail
(
-
400
,
"未知方案"
);
}
if
(
!
needsolutioninfo
.
needNo
)
{
return
system
.
getResultFail
(
-
401
,
"方案需求信息有误"
);
}
var
solutionContent
=
needsolutioninfo
.
solutionContent
;
if
(
!
solutionContent
)
{
return
system
.
getResultFail
(
-
402
,
"方案交付信息有误"
);
}
if
(
solutionContent
.
status
!=
"USER_UPLOADED"
)
{
return
system
.
getResultFail
(
-
403
,
"用户未上传材料,不能执行此操作"
);
}
//获取需求信息
var
needinfo
=
await
this
.
needinfoDao
.
model
.
findOne
({
where
:
{
needNo
:
needsolutioninfo
.
needNo
},
raw
:
true
});
if
(
!
needinfo
||
!
needinfo
.
id
)
{
return
system
.
getResultFail
(
-
201
,
"未知需求信息"
);
}
if
(
needinfo
.
status
==
"ycd"
||
needinfo
.
status
==
"ygb"
)
{
return
system
.
getResultFail
(
-
202
,
"该方案需求状态为"
+
needinfo
.
statusName
+
",不能执行此操作"
);
}
var
material
=
ab
.
material
;
if
(
!
material
.
Domain
)
{
return
system
.
getResultFail
(
-
101
,
"备案域名不能为空"
);
}
//CorporateName 法⼈名称
if
(
!
material
.
hasOwnProperty
(
"IncludeForeignInvestment"
))
{
return
system
.
getResultFail
(
-
102
,
"包含外贸参数不能为空"
);
}
if
(
!
material
.
PartnerBusinessLicense
)
{
return
system
.
getResultFail
(
-
103
,
"营业执照不能为空"
);
}
if
(
!
material
.
PartnerIdCardList
||
material
.
PartnerIdCardList
.
length
<
1
)
{
return
system
.
getResultFail
(
-
105
,
"相关人员身份证不能为空"
);
}
if
(
!
material
.
PartnerDomainCertificate
)
{
return
system
.
getResultFail
(
-
106
,
"域名证书不能为空"
);
}
solutionContent
.
material
=
ab
.
material
;
var
solutionFlowList
=
solutionContent
.
solutionFlowList
||
[];
solutionFlowList
.
push
({
status
:
"MATERIAL_UNCONFIRM"
,
statusName
:
this
.
icpSolutionStatusReference
.
MATERIAL_UNCONFIRM
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"MATERIAL_UNCONFIRM"
;
solutionContent
.
statusName
=
this
.
icpSolutionStatusReference
.
MATERIAL_UNCONFIRM
;
needsolutioninfo
.
solutionContent
=
JSON
.
stringify
(
solutionContent
);
var
self
=
this
;
return
await
this
.
needsolutionDao
.
db
.
transaction
(
async
function
(
t
)
{
await
self
.
needsolutionDao
.
update
(
needsolutioninfo
,
t
);
needsolutioninfo
=
await
self
.
needsolutionDao
.
model
.
findOne
({
where
:
{
channelSolutionNo
:
ab
.
BizId
},
raw
:
true
});
return
system
.
getResultSuccess
(
needsolutioninfo
);
})
}
//服务商通知状态变更
async
acceptIcpPartnerNotification
(
pobj
)
{
var
ab
=
pobj
.
actionBody
;
var
user
=
pobj
.
userInfo
;
if
(
!
user
||
!
user
.
id
)
{
return
system
.
getResultFail
(
-
100
,
"未知用户"
);
}
ab
[
"createUserId"
]
=
user
.
id
;
if
(
!
ab
.
BizId
)
{
return
system
.
getResultFail
(
-
101
,
"方案编号不能为空"
);
}
if
(
!
ab
.
ApplicationStatus
)
{
return
system
.
getResultFail
(
-
102
,
"通知状态不能为空"
);
}
//获取方案信息
var
needsolutioninfo
=
await
this
.
needsolutionDao
.
model
.
findOne
({
where
:
{
channelSolutionNo
:
ab
.
BizId
},
raw
:
true
});
if
(
!
needsolutioninfo
||
!
needsolutioninfo
.
id
)
{
return
system
.
getResultFail
(
-
400
,
"未知方案"
);
}
if
(
!
needsolutioninfo
.
needNo
)
{
return
system
.
getResultFail
(
-
401
,
"方案需求信息有误"
);
}
var
solutionContent
=
needsolutioninfo
.
solutionContent
;
if
(
!
solutionContent
)
{
return
system
.
getResultFail
(
-
402
,
"方案交付信息有误"
);
}
// if(solutionContent.)
//获取需求信息
var
needinfo
=
await
this
.
needinfoDao
.
model
.
findOne
({
where
:
{
needNo
:
needsolutioninfo
.
needNo
},
raw
:
true
});
if
(
!
needinfo
||
!
needinfo
.
id
)
{
return
system
.
getResultFail
(
-
201
,
"未知需求信息"
);
}
if
(
needinfo
.
status
==
"ycd"
||
needinfo
.
status
==
"ygb"
)
{
return
system
.
getResultFail
(
-
202
,
"该方案需求状态为"
+
needinfo
.
statusName
+
",不能执行此操作"
);
}
var
applicationStatusList
=
solutionContent
.
applicationStatusList
||
[];
var
solutionFlowList
=
solutionContent
.
solutionFlowList
||
[];
var
statusObj
=
{
"OfficialFileURL"
:
ab
.
OfficialFileURL
||
""
,
"ApplicationStatus"
:
ab
.
ApplicationStatus
,
"ApplicationStatusName"
:
this
.
icpApplicationStatusReference
[
ab
.
ApplicationStatus
],
"created_at"
:
new
Date
()
};
applicationStatusList
.
push
(
statusObj
);
solutionContent
.
applicationStatusList
=
applicationStatusList
;
if
(
ab
.
ApplicationStatus
==
507
)
{
//完成账户注册
solutionFlowList
.
push
({
file
:
ab
.
OfficialFileURL
||
""
,
status
:
"ACCOUNT_REGISTERED"
,
statusName
:
this
.
icpSolutionStatusReference
.
ACCOUNT_REGISTERED
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"ACCOUNT_REGISTERED"
;
solutionContent
.
statusName
=
this
.
icpSolutionStatusReference
.
ACCOUNT_REGISTERED
;
}
if
(
ab
.
ApplicationStatus
==
508
)
{
//"服务商完成提交资料到⼯信部
solutionFlowList
.
push
({
file
:
ab
.
OfficialFileURL
||
""
,
status
:
"MATERIAL_SUBMITTED"
,
statusName
:
this
.
icpSolutionStatusReference
.
MATERIAL_SUBMITTED
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"MATERIAL_SUBMITTED"
;
solutionContent
.
statusName
=
this
.
icpSolutionStatusReference
.
MATERIAL_SUBMITTED
;
}
if
(
ab
.
ApplicationStatus
==
509
)
{
//⼯商部已受理
solutionFlowList
.
push
({
file
:
ab
.
OfficialFileURL
||
""
,
status
:
"GXB_ACCEPT"
,
statusName
:
this
.
icpSolutionStatusReference
.
GXB_ACCEPT
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"GXB_ACCEPT"
;
solutionContent
.
statusName
=
this
.
icpSolutionStatusReference
.
GXB_ACCEPT
;
}
if
(
ab
.
ApplicationStatus
==
510
)
{
//⼯商部不予受理
solutionFlowList
.
push
({
file
:
ab
.
OfficialFileURL
||
""
,
status
:
"GXB_REFUSE"
,
statusName
:
this
.
icpSolutionStatusReference
.
GXB_REFUSE
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"GXB_REFUSE"
;
needsolutioninfo
.
status
=
"yzf"
;
solutionContent
.
statusName
=
this
.
icpSolutionStatusReference
.
GXB_REFUSE
;
}
if
(
ab
.
ApplicationStatus
==
511
)
{
//⼯商部通过
solutionFlowList
.
push
({
file
:
ab
.
OfficialFileURL
||
""
,
status
:
"GXB_SUCCESS"
,
statusName
:
this
.
icpSolutionStatusReference
.
GXB_SUCCESS
,
updated_at
:
new
Date
()
});
needsolutioninfo
.
status
=
"ywc"
;
needsolutioninfo
.
status
=
"ywc"
;
solutionContent
.
status
=
"GXB_SUCCESS"
;
solutionContent
.
statusName
=
this
.
icpSolutionStatusReference
.
GXB_SUCCESS
;
}
if
(
ab
.
ApplicationStatus
==
512
)
{
//⼯信部未通过
solutionFlowList
.
push
({
file
:
ab
.
OfficialFileURL
||
""
,
status
:
"GXB_FAIL"
,
statusName
:
this
.
icpSolutionStatusReference
.
GXB_FAIL
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"GXB_FAIL"
;
needsolutioninfo
.
status
=
"yzf"
;
solutionContent
.
statusName
=
this
.
icpSolutionStatusReference
.
GXB_FAIL
;
}
solutionContent
.
solutionFlowList
=
solutionFlowList
;
needsolutioninfo
.
solutionContent
=
JSON
.
stringify
(
solutionContent
);
var
self
=
this
;
return
await
this
.
needsolutionDao
.
db
.
transaction
(
async
function
(
t
)
{
await
self
.
needsolutionDao
.
update
(
needsolutioninfo
,
t
);
needsolutioninfo
=
await
self
.
needsolutionDao
.
model
.
findOne
({
where
:
{
channelSolutionNo
:
ab
.
BizId
},
raw
:
true
});
statusObj
[
"BizId"
]
=
ab
.
BizId
;
return
system
.
getResultSuccess
(
statusObj
);
})
}
//接收渠道方案状态变更通知
async
receiveIcpStatusNotify
(
pobj
)
{
var
ab
=
pobj
.
actionBody
;
if
(
!
ab
.
BizId
)
{
return
system
.
getResultFail
(
-
101
,
"渠道方案号不能为空"
);
}
if
(
!
ab
.
status
)
{
return
system
.
getResultFail
(
-
102
,
"方案状态不能为空"
);
}
//获取方案信息
var
ns
=
await
this
.
needsolutionDao
.
model
.
findOne
({
where
:
{
channelSolutionNo
:
ab
.
BizId
},
raw
:
true
});
if
(
!
ns
||
!
ns
.
id
)
{
return
system
.
getResultFail
(
-
102
,
"未知方案"
);
}
var
needinfo
=
await
this
.
needinfoDao
.
model
.
findOne
({
where
:
{
needNo
:
ns
.
needNo
},
raw
:
true
});
if
(
!
needinfo
)
{
return
system
.
getResultFail
(
-
104
,
"未知方案需求"
);
}
if
(
needinfo
.
status
==
"ycd"
||
needinfo
.
status
==
"ygb"
)
{
return
system
.
getResultFail
(
-
105
,
"该方案需求状态为"
+
needinfo
.
statusName
+
",不能执行此操作"
);
}
if
(
ns
.
status
!=
"dqr"
&&
ns
.
status
!=
"yzf"
)
{
return
system
.
getResultFail
(
-
103
,
"方案状态错误,不能作废已完成方案"
);
}
var
solutionContent
=
ns
.
solutionContent
;
//方案流程列表
var
solutionFlowList
=
solutionContent
.
solutionFlowList
||
[];
if
(
ab
.
status
==
"2"
)
{
//⽤户已上传
solutionFlowList
.
push
({
status
:
"USER_UPLOADED"
,
statusName
:
this
.
icpSolutionStatusReference
.
USER_UPLOADED
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"USER_UPLOADED"
;
solutionContent
.
statusName
=
this
.
icpSolutionStatusReference
.
USER_UPLOADED
;
}
if
(
ab
.
status
==
"4"
)
{
//⽤户已确认
solutionFlowList
.
push
({
status
:
"USER_CONFIRMED"
,
statusName
:
this
.
icpSolutionStatusReference
.
USER_CONFIRMED
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"USER_CONFIRMED"
;
solutionContent
.
statusName
=
this
.
icpSolutionStatusReference
.
USER_CONFIRMED
;
}
if
(
ab
.
status
==
"11"
)
{
//⽅案已关闭
solutionFlowList
.
push
({
status
:
"CLOSE"
,
statusName
:
this
.
icpSolutionStatusReference
.
CLOSE
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"CLOSE"
;
solutionContent
.
statusName
=
this
.
icpSolutionStatusReference
.
CLOSE
;
}
solutionContent
.
solutionFlowList
=
solutionFlowList
;
var
material
=
solutionContent
.
material
||
{};
if
(
ab
.
remark
)
{
solutionContent
.
customerRemark
=
ab
.
remark
;
}
if
(
ab
.
newbusinessLicense
)
{
material
.
PartnerBusinessLicense
=
ab
.
newbusinessLicense
;
material
.
aliPartnerBusinessLicense
=
ab
.
businessLicense
;
}
if
(
ab
.
newidCardUrlList
&&
ab
.
newidCardUrlList
.
length
>
0
)
{
material
.
PartnerIdCardList
=
ab
.
newidCardUrlList
;
material
.
aliPartnerIdCardList
=
ab
.
idCardUrlList
;
}
if
(
ab
.
newuserPlan
)
{
material
.
PartnerPlan
=
ab
.
newuserPlan
;
material
.
aliPartnerPlan
=
ab
.
userPlan
;
}
if
(
ab
.
newuserForeig
)
{
material
.
PartnerForeignInvestment
=
ab
.
newuserForeig
;
material
.
aliPartnerForeignInvestment
=
ab
.
userForeig
;
}
if
(
ab
.
newuserLaw
)
{
material
.
PartnerLaw
=
ab
.
newuserLaw
;
material
.
aliPartnerLaw
=
ab
.
userLaw
;
}
if
(
ab
.
newuserOtherList
&&
ab
.
newuserOtherList
.
length
>
0
)
{
material
.
PartnerSignAndStampOtherList
=
ab
.
newuserOtherList
;
material
.
aliPartnerSignAndStampOtherList
=
ab
.
userOtherList
;
}
solutionContent
.
customerMaterial
=
material
;
solutionContent
=
JSON
.
stringify
(
solutionContent
);
var
updateObj
=
{
id
:
ns
.
id
,
solutionContent
:
solutionContent
};
if
(
ab
.
status
==
"11"
)
{
//⽅案已关闭
updateObj
[
"status"
]
=
"yzf"
;
}
// else if(ab.status == "2" || ab.status == "4"){ //2, "⽤户已上传" 4, "⽤户已确认"
// updateObj["status"]="dqr";
// }
await
this
.
needsolutionDao
.
update
(
updateObj
);
//方案状态修改
ns
=
await
this
.
needsolutionDao
.
model
.
findOne
({
where
:
{
channelSolutionNo
:
ab
.
BizId
},
raw
:
true
});
return
system
.
getResultSuccess
(
ns
);
}
//接收icp用户方案反馈
async
receiveIcpFeedback
(
pobj
)
{
var
ab
=
pobj
.
actionBody
;
if
(
!
ab
.
intentionBizId
)
{
return
system
.
getResultFail
(
-
101
,
"渠道需求编号错误"
);
}
if
(
!
ab
.
description
)
{
return
system
.
getResultFail
(
-
102
,
"问题描述不能为空"
);
}
if
(
!
ab
.
hasOwnProperty
(
"intentionStatus"
))
{
return
system
.
getResultFail
(
-
103
,
"需求当前状态不能为空"
);
}
//获取需求信息
var
needinfo
=
await
this
.
needinfoDao
.
model
.
findOne
({
where
:
{
channelNeedNo
:
ab
.
intentionBizId
},
raw
:
true
});
if
(
!
needinfo
)
{
return
system
.
getResultFail
(
-
104
,
"未知方案需求"
);
}
if
(
needinfo
.
status
==
"ycd"
||
needinfo
.
status
==
"ygb"
)
{
return
system
.
getResultFail
(
-
105
,
"该方案需求状态为"
+
needinfo
.
statusName
+
",不能执行此操作"
);
}
//获取方案信息
var
ns
=
await
this
.
needsolutionDao
.
model
.
findOne
({
where
:
{
channelNeedNo
:
ab
.
intentionBizId
,
status
:
"dqr"
},
raw
:
true
});
if
(
!
ns
)
{
return
system
.
getResultFail
(
-
106
,
"未知方案"
);
}
var
intentionStatusList
=
[
"未知"
,
"⽅案待服务商确认"
,
"⽅案待⽤户确认"
,
"处理中"
,
"已完成"
,
"已关闭"
];
var
updateObj
=
{
id
:
ns
.
id
};
var
solutionContent
=
ns
.
solutionContent
;
solutionContent
.
customerRemark
=
ab
.
description
;
solutionContent
.
needStatus
=
ab
.
intentionStatus
;
if
(
ab
.
intentionStatus
==
1
||
ab
.
intentionStatus
==
2
||
ab
.
intentionStatus
==
3
)
{
updateObj
[
"status"
]
=
"dqr"
;
}
else
if
(
ab
.
intentionStatus
==
4
)
{
updateObj
[
"status"
]
=
"ywc"
;
}
else
if
(
ab
.
intentionStatus
==
5
)
{
updateObj
[
"status"
]
=
"yzf"
;
}
else
{
return
system
.
getResultFail
(
-
107
,
"需求当前状态错误--"
+
ab
.
intentionStatus
);
}
solutionContent
.
needStatusName
=
intentionStatusList
[
ab
.
intentionStatus
];
solutionContent
=
JSON
.
stringify
(
solutionContent
);
updateObj
[
"solutionContent"
]
=
solutionContent
;
await
this
.
needsolutionDao
.
update
(
updateObj
);
//方案状态修改
return
system
.
getResultSuccess
();
}
//接收方案编号(方案推送至阿里后,接收保存方案信息)
async
receiveProgrammeNo
(
pobj
)
{
var
ab
=
pobj
.
actionBody
;
if
(
!
ab
.
solutionBizId
)
{
return
system
.
getResultFail
(
-
101
,
"渠道方案业务编号不能为空"
);
}
if
(
!
ab
.
solutionNo
)
{
return
system
.
getResultFail
(
-
102
,
"方案业务编号不能为空"
);
}
var
ns
=
await
this
.
needsolutionDao
.
model
.
findOne
({
where
:
{
solutionNo
:
ab
.
solutionNo
},
raw
:
true
});
if
(
!
ns
||
!
ns
.
id
)
{
return
system
.
getResultFail
(
-
103
,
"未知方案"
);
}
var
needinfo
=
await
this
.
needinfoDao
.
model
.
findOne
({
where
:
{
needNo
:
ns
.
needNo
},
raw
:
true
});
if
(
!
needinfo
)
{
return
system
.
getResultFail
(
-
104
,
"未知方案需求"
);
}
if
(
needinfo
.
status
==
"ycd"
||
needinfo
.
status
==
"ygb"
)
{
return
system
.
getResultFail
(
-
105
,
"该方案需求状态为"
+
needinfo
.
statusName
+
",不能执行此操作"
);
}
await
this
.
needsolutionDao
.
model
.
update
({
channelSolutionNo
:
ab
.
solutionBizId
},
{
where
:
{
id
:
ns
.
id
}
});
//修改方案信息
return
system
.
getResultSuccess
();
}
/*
返回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
;
}
/*
len:返回长度
radix:参与计算的长度,最大为62
*/
async
getUidInfo
(
len
,
radix
)
{
var
chars
=
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
.
split
(
''
);
//长度62,到yz长度为长36
var
uuid
=
[],
i
;
radix
=
radix
||
chars
.
length
;
if
(
len
)
{
for
(
i
=
0
;
i
<
len
;
i
++
)
uuid
[
i
]
=
chars
[
0
|
Math
.
random
()
*
radix
];
}
else
{
var
r
;
uuid
[
8
]
=
uuid
[
13
]
=
uuid
[
18
]
=
uuid
[
23
]
=
'-'
;
uuid
[
14
]
=
'4'
;
for
(
i
=
0
;
i
<
36
;
i
++
)
{
if
(
!
uuid
[
i
])
{
r
=
0
|
Math
.
random
()
*
16
;
uuid
[
i
]
=
chars
[(
i
==
19
)
?
(
r
&
0x3
)
|
0x8
:
r
];
}
}
}
return
uuid
.
join
(
''
);
}
}
module
.
exports
=
AliyunQcService
;
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