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
fe5719ca
Commit
fe5719ca
authored
Dec 17, 2020
by
兰国旗
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
baidureg
parent
636e2320
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
920 additions
and
0 deletions
+920
-0
center-order/app/base/api/impl/action/regCenterOrder.js
+72
-0
center-order/app/base/service/impl/qcutils/baseqcSve.js
+1
-0
center-order/app/base/service/impl/qcutils/regCenterOrderSve.js
+847
-0
No files found.
center-order/app/base/api/impl/action/regCenterOrder.js
0 → 100644
View file @
fe5719ca
//工商注册
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
class
BaiduReg
extends
APIBase
{
constructor
()
{
super
();
this
.
regCenterOrder
=
system
.
getObject
(
"service.qcutils.regCenterOrder"
);
}
/**
* 接口跳转-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
)
{
console
.
log
(
"pobj"
,
pobj
)
var
opResult
=
null
;
switch
(
action_type
)
{
case
"receiveSolutionPayInfoNew"
:
//接收reg方案状态及支付信息(方案支付后创建订单时调用)
opResult
=
await
this
.
regCenterOrder
.
receiveSolutionPayInfoNew
(
pobj
);
break
;
case
"getItemByChannelSolutionNo"
:
//渠道方案号获取需求详情
opResult
=
await
this
.
regCenterOrder
.
getItemByChannelSolutionNo
(
pobj
,
pobj
.
actionBody
,
req
);
break
;
case
"getRegOrderStatus"
:
//接收订单状态推送 百度reg 2.3
opResult
=
await
this
.
regCenterOrder
.
getRegOrderStatus
(
pobj
);
break
;
case
"addRegSalesmanInfo"
:
//添加业务员信息,用于直接下单的reg订单
opResult
=
await
this
.
regCenterOrder
.
addRegSalesmanInfo
(
pobj
);
break
;
case
"submitRegNeed"
:
//提交需求
opResult
=
await
this
.
regCenterOrder
.
submitRegNeed
(
pobj
,
pobj
.
actionBody
,
req
);
break
;
case
"submitBdRegSolution"
:
//方案提交
opResult
=
await
this
.
regCenterOrder
.
submitBdRegSolution
(
pobj
);
break
;
case
"writeRegCommunicationLog"
:
//新增沟通记录
opResult
=
await
this
.
regCenterOrder
.
writeRegCommunicationLog
(
pobj
);
break
;
case
"queryExpertRegCommunicationLogs"
:
//获取沟通记录
opResult
=
await
this
.
regCenterOrder
.
queryExpertRegCommunicationLogs
(
pobj
);
break
;
case
"updateOrdertatus"
:
//提交交付信息/修改订单状态
opResult
=
await
this
.
regCenterOrder
.
updateOrdertatus
(
pobj
);
break
;
case
"closeBdRegNeed"
:
//需求关闭
opResult
=
await
this
.
regCenterOrder
.
closeBdRegNeed
(
pobj
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
}
return
opResult
;
}
}
module
.
exports
=
BaiduReg
;
\ No newline at end of file
center-order/app/base/service/impl/qcutils/baseqcSve.js
View file @
fe5719ca
...
...
@@ -123,6 +123,7 @@ class BaseQcService {
console
.
log
(
'guanbi ns +++'
,
ns
)
return
system
.
getResultSuccess
(
ns
);
}
return
system
.
getResultSuccess
();
})
}
...
...
center-order/app/base/service/impl/qcutils/regCenterOrderSve.js
0 → 100644
View file @
fe5719ca
//工商注册
const
system
=
require
(
"../../../system"
);
const
moment
=
require
(
'moment'
);
class
regCenterOrderService
{
constructor
()
{
this
.
needsolutionDao
=
system
.
getObject
(
"db.dbneed.needsolutionDao"
);
this
.
needinfoDao
=
system
.
getObject
(
"db.dbneed.needinfoDao"
);
this
.
orderinfoDao
=
system
.
getObject
(
"db.dbcorder.orderinfoDao"
);
this
.
orderdeliveryDao
=
system
.
getObject
(
"db.dbcorder.orderdeliveryDao"
);
this
.
db
=
system
.
getObject
(
"db.common.connection"
).
getCon
()
//工商注册状态
this
.
regSolutionStatus
=
{
"SOLUTION_SUBMIT"
:
"提交服务单"
,
"MATERIAL_UNCONFIRM"
:
"服务商递交⽂件"
,
"REGISTRATION"
:
"完成账户注册"
,
"SUBMITTED"
:
"服务商完成提交资料到⼯信部"
,
"ACCEPTED"
:
"⼯商部已受理"
,
"NOT_ACCEPTED"
:
"⼯商部不予受理"
,
"APPROVED"
:
"⼯商部通过"
,
"NOT_APPROVED"
:
"⼯商部未通过"
,
"CLOSE"
:
"方案关闭"
};
//工商注册状态
this
.
regNumberStatus
=
{
// "SOLUTION_SUBMIT": "提交服务单",
"MATERIAL_UNCONFIRM"
:
506
,
"REGISTRATION"
:
507
,
"SUBMITTED"
:
508
,
"ACCEPTED"
:
509
,
"NOT_ACCEPTED"
:
510
,
"APPROVED"
:
511
,
"NOT_APPROVED"
:
512
// "CLOSE": "方案关闭"
};
}
//添加业务员信息,用于直接下单的reg订单
async
addRegSalesmanInfo
(
pobj
)
{
var
ab
=
pobj
.
actionBody
;
if
(
!
ab
.
orderNo
)
{
return
system
.
getResultFail
(
-
101
,
"订单号不能为空"
);
}
var
salesmanObj
=
ab
.
salesmanInfo
;
//获取方案信息
var
ns
=
await
this
.
needsolutionDao
.
model
.
findOne
({
where
:
{
orderNo
:
ab
.
orderNo
,
isInvalid
:
0
},
raw
:
true
});
if
(
!
ns
||
!
ns
.
id
)
{
return
system
.
getResultFail
(
-
102
,
"未知方案"
);
}
var
solutionContent
=
ns
.
solutionContent
;
solutionContent
.
salesmanInfo
=
salesmanObj
;
var
updateObj
=
{
id
:
ns
.
id
,
solutionContent
:
JSON
.
stringify
(
solutionContent
)}
await
this
.
needsolutionDao
.
update
(
updateObj
);
//方案状态修改
return
system
.
getResultSuccess
(
solutionContent
);
}
//渠道方案号获取需求详情
async
getItemByChannelSolutionNo
(
pobj
)
{
var
i
=
0
;
var
bizIdLength
=
pobj
.
actionBody
.
length
;
var
bizIdList
=
[];
for
(
i
=
0
;
i
<=
bizIdLength
;
i
++
){
bizIdList
.
push
(
pobj
.
actionBody
[
i
].
bizId
)
}
bizIdListStr
=
bizIdList
.
join
(
","
);
// var solutionitem = await this.needsolutionDao.findOne({ channelSolutionNo: pobj.actionBody.bizId });
var
sql
=
"select * from n_need_solution where channelSolutionNo in ("
+
bizIdListStr
+
")"
;
var
solutionitem
=
await
this
.
customQuery
(
sql
);
if
(
solutionitem
.
length
<
1
)
{
return
system
.
getResult
(
null
,
"方案数据为空,30210"
);
}
var
item
=
await
this
.
dao
.
getItemByNeedNo
(
solutionitem
[
0
].
needNo
);
if
(
!
item
)
{
return
system
.
getResult
(
null
,
"需求数据为空,30210"
);
}
item
.
solutionProvince
=
solutionitem
[
0
].
solutionContent
.
solution
.
Area
||
solutionitem
[
0
].
solutionContent
.
solution
.
area
;
item
.
solutionContent
=
solutionitem
[
0
].
solutionContent
item
.
channelSolutionNo
=
solutionitem
[
0
].
channelSolutionNo
return
system
.
getResultSuccess
(
item
);
}
//接收渠道方案状态变更通知
async
getRegOrderStatus
(
pobj
)
{
var
ab
=
pobj
.
actionBody
;
if
(
!
ab
.
BizId
)
{
return
system
.
getResultFail
(
-
101
,
"渠道方案号不能为空"
);
}
if
(
!
ab
.
status
)
{
return
system
.
getResultFail
(
-
102
,
"方案状态不能为空"
);
}
if
(
ab
.
isDirectBuy
&&
ab
.
isDirectBuy
==
1
&&
ab
.
status
==
1
){
//直接下单,无方案 直接返回
return
system
.
getResultSuccess
();
}
//获取方案信息
var
ns
=
await
this
.
needsolutionDao
.
model
.
findOne
({
where
:
{
channelSolutionNo
:
ab
.
BizId
,
isInvalid
:
0
},
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
==
"ygb"
)
{
return
system
.
getResultFail
(
-
105
,
"该方案需求状态为"
+
needinfo
.
statusName
+
",不能执行此操作"
);
}
var
solutionContent
=
ns
.
solutionContent
;
var
checkStatus
=
{
ACCOUNT_REGISTERED
:
"完成账户注册"
,
MATERIAL_SUBMITTED
:
"完成资料递交"
,
GXB_ACCEPT
:
"⼯信部已受理"
,
GXB_REFUSE
:
"⼯信部不予受理"
,
GXB_FAIL
:
"⼯信部未通过"
,
GXB_SUCCESS
:
"工信部通过"
,
CLOSE
:
"方案关闭"
};
if
(
solutionContent
.
status
&&
checkStatus
[
solutionContent
.
status
])
{
return
system
.
getResultFail
(
-
111
,
"方案已进入"
+
solutionContent
.
statusName
+
"流程,不能执行此操作"
);
}
//方案流程列表
var
solutionFlowList
=
solutionContent
.
solutionFlowList
||
[];
if
(
ab
.
status
==
"1"
)
{
//⽤户已支付
var
afterStatusList
=
[
//用户支付后的流程状态
"USER_UPLOADED"
,
"MATERIAL_UNCONFIRM"
,
"USER_CONFIRMED"
,
"ACCOUNT_REGISTERED"
,
"MATERIAL_SUBMITTED"
,
"GXB_ACCEPT"
,
"GXB_REFUSE"
,
"GXB_FAIL"
,
"GXB_SUCCESS"
,
"CLOSE"
];
if
(
!
solutionContent
.
status
||
afterStatusList
.
indexOf
(
solutionContent
.
status
)
<
0
){
solutionFlowList
.
push
({
status
:
"PAID"
,
statusName
:
this
.
icpSolutionStatusReference
.
PAID
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"PAID"
;
solutionContent
.
statusName
=
this
.
icpSolutionStatusReference
.
PAID
;
}
//修改 n_need_info status为ycd 已成单
let
needObj
=
{
id
:
needinfo
.
id
,
status
:
"ycd"
}
await
this
.
needinfoDao
.
update
(
needObj
);
//关闭需求
}
else
if
(
ab
.
status
==
"2"
)
{
//⽤户已上传
if
(
solutionContent
.
status
==
"USER_CONFIRMED"
)
{
//防止用户确认后又否决
return
system
.
getResultFail
(
-
112
,
"操作失败,⽤户已确认递交⽂件"
);
}
solutionFlowList
.
push
({
status
:
"USER_UPLOADED"
,
statusName
:
this
.
icpSolutionStatusReference
.
USER_UPLOADED
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"USER_UPLOADED"
;
solutionContent
.
statusName
=
this
.
icpSolutionStatusReference
.
USER_UPLOADED
;
}
else
if
(
ab
.
status
==
"4"
)
{
//⽤户已确认
if
(
solutionContent
.
status
!=
"MATERIAL_UNCONFIRM"
)
{
return
system
.
getResultFail
(
-
113
,
"操作失败,服务商递交⽂件后才能执行此操作"
);
}
solutionFlowList
.
push
({
status
:
"USER_CONFIRMED"
,
statusName
:
this
.
icpSolutionStatusReference
.
USER_CONFIRMED
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"USER_CONFIRMED"
;
solutionContent
.
statusName
=
this
.
icpSolutionStatusReference
.
USER_CONFIRMED
;
}
else
if
(
ab
.
status
==
"11"
)
{
//⽅案已关闭
solutionFlowList
.
push
({
status
:
"CLOSE"
,
statusName
:
this
.
icpSolutionStatusReference
.
CLOSE
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"CLOSE"
;
solutionContent
.
statusName
=
this
.
icpSolutionStatusReference
.
CLOSE
;
}
else
{
return
system
.
getResultFail
(
-
110
,
"状态错误"
);
}
solutionContent
.
solutionFlowList
=
solutionFlowList
;
var
material
=
solutionContent
.
customerMaterial
||
{};
if
(
ab
.
remark
)
{
solutionContent
.
customerRemark
=
ab
.
remark
;
}
if
(
ab
.
newbusinessLicense
)
{
material
.
businessLicense
=
ab
.
newbusinessLicense
;
material
.
aliBusinessLicense
=
ab
.
businessLicense
;
}
if
(
ab
.
newidCardUrlList
&&
ab
.
newidCardUrlList
.
length
>
0
)
{
material
.
idCardUrlList
=
ab
.
newidCardUrlList
;
material
.
aliIdCardUrlList
=
ab
.
idCardUrlList
;
}
if
(
ab
.
newuserPlan
)
{
material
.
userPlan
=
ab
.
newuserPlan
;
material
.
aliUserPlan
=
ab
.
userPlan
;
}
if
(
ab
.
newuserForeig
)
{
material
.
userForeig
=
ab
.
newuserForeig
;
material
.
aliUserForeig
=
ab
.
userForeig
;
}
if
(
ab
.
newuserLaw
)
{
material
.
userLaw
=
ab
.
newuserLaw
;
material
.
aliUserLaw
=
ab
.
userLaw
;
}
if
(
ab
.
newuserOtherList
&&
ab
.
newuserOtherList
.
length
>
0
)
{
material
.
userOtherList
=
ab
.
newuserOtherList
;
material
.
aliUserOtherList
=
ab
.
userOtherList
;
}
solutionContent
.
customerMaterial
=
material
;
solutionContent
=
JSON
.
stringify
(
solutionContent
);
var
updateObj
=
{
id
:
ns
.
id
,
solutionContent
:
solutionContent
};
if
(
ab
.
status
==
"11"
)
{
//⽅案已关闭
updateObj
[
"status"
]
=
"yzf"
;
updateObj
[
"isInvalid"
]
=
1
;
}
await
this
.
needsolutionDao
.
update
(
updateObj
);
//方案状态修改
var
new_ns
=
await
this
.
needsolutionDao
.
model
.
findOne
({
where
:
{
id
:
ns
.
id
},
raw
:
true
});
return
system
.
getResultSuccess
(
ns
);
}
//交付商提交材料信息
async
ncSubmitMaterial
(
pobj
)
{
var
ab
=
pobj
.
actionBody
;
console
.
log
(
'ab++'
,
ab
)
if
(
!
ab
.
orderNo
)
{
return
system
.
getResultFail
(
-
101
,
"订单号不能为空"
);
}
var
ns
=
await
this
.
needsolutionDao
.
model
.
findOne
({
where
:
{
orderNo
:
ab
.
orderNo
},
raw
:
true
});
if
(
!
ns
||
!
ns
.
id
)
{
return
system
.
getResultFail
(
-
301
,
"未知方案"
);
}
ab
[
"bizId"
]
=
ns
.
channelSolutionNo
;
pobj
.
actionBody
=
ab
;
return
this
.
submitNcMaterial
(
pobj
);
}
//提交材料信息
async
submitNcMaterial
(
pobj
)
{
var
ab
=
pobj
.
actionBody
;
console
.
log
(
'ababab++'
,
ab
)
var
user
=
pobj
.
userInfo
;
if
(
!
user
||
!
user
.
id
)
{
return
system
.
getResultFail
(
-
100
,
"未知用户"
);
}
if
(
!
ab
.
bizId
)
{
return
system
.
getResultFail
(
-
101
,
"渠道方案编号不能为空"
);
}
if
(
!
ab
.
material
)
{
return
system
.
getResultFail
(
-
102
,
"材料信息有误"
);
}
//获取方案信息
var
needsolutioninfo
=
await
this
.
needsolutionDao
.
model
.
findOne
({
attributes
:
[
"id"
,
"needNo"
,
"orderNo"
,
"solutionContent"
],
where
:
{
channelSolutionNo
:
ab
.
bizId
,
isInvalid
:
0
},
raw
:
true
});
console
.
log
(
'needsolutioninfo+++'
,
needsolutioninfo
)
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
,
"方案交付信息有误"
);
}
//----
var
productType
=
solutionContent
.
solution
;
if
(
productType
&&
productType
.
IcpType
){
productType
=
productType
.
IcpType
}
//----
var
orderInfo
=
await
this
.
orderinfoDao
.
model
.
findOne
({
where
:
{
orderNo
:
needsolutioninfo
.
orderNo
},
raw
:
true
})
if
(
orderInfo
){
var
uappId
=
orderInfo
.
uapp_id
}
if
(
!
ab
.
material
.
businessLicense
.
name
)
{
return
system
.
getResultFail
(
-
101
,
"公司名称不能为空"
);
}
if
(
!
ab
.
material
.
partnerBusinessLicense
)
{
return
system
.
getResultFail
(
-
103
,
"营业执照不能为空"
);
}
console
.
log
(
'solutionContent++++++---------------'
,
solutionContent
)
solutionContent
.
material
=
ab
.
material
;
var
solutionFlowList
=
solutionContent
.
solutionFlowList
||
[];
solutionFlowList
.
push
({
status
:
"MATERIAL_UNCONFIRM"
,
statusName
:
this
.
regSolutionStatus
.
MATERIAL_UNCONFIRM
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"MATERIAL_UNCONFIRM"
;
solutionContent
.
statusName
=
this
.
regSolutionStatus
.
MATERIAL_UNCONFIRM
;
needsolutioninfo
.
solutionContent
=
JSON
.
stringify
(
solutionContent
);
let
deliveryContent
=
needsolutioninfo
.
solutionContent
;
let
orderdeliveryData
=
{
sourceOrderNo
:
ab
.
orderNo
,
deliveryContent
:
deliveryContent
,
}
let
orderdeliverySqlData
=
{
sourceOrderNo
:
ab
.
orderNo
}
let
orderdeliverySql
=
"SELECT * FROM `c_order_delivery` WHERE sourceOrderNo = :sourceOrderNo ORDER BY id DESC limit 1"
;
let
orderdeliveryInfo
=
await
this
.
orderdeliveryDao
.
customQuery
(
orderdeliverySql
,
orderdeliverySqlData
)
if
(
!
orderdeliveryInfo
[
0
]){
let
sql
=
"INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUES (:sourceOrderNo,:deliveryContent)"
;
var
orderdelivery
=
await
this
.
orderdeliveryDao
.
customInsert
(
sql
,
orderdeliveryData
);
}
else
{
let
sql
=
"UPDATE `c_order_delivery` SET deliveryContent ='"
+
deliveryContent
+
"' where sourceOrderNo='"
+
ab
.
orderNo
+
"'"
;
var
orderdelivery
=
await
this
.
orderdeliveryDao
.
customInsert
(
sql
);
}
needsolutioninfo
[
'orderChannelNo'
]
=
orderInfo
.
channelOrderNo
;
needsolutioninfo
[
'uapp_id'
]
=
uappId
;
needsolutioninfo
[
'productType'
]
=
productType
;
console
.
log
(
'nc orderdelivery+++'
,
needsolutioninfo
)
return
system
.
getResultSuccess
(
needsolutioninfo
);
}
//提交方案
async
submitBdRegSolution
(
pobj
)
{
console
.
log
(
"pobj++submitBdRegSolution++"
,
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
=
needinfo
.
typeCode
;
//ab.solutionContent.bizType;//业务类型
ab
.
solutionContent
.
bizType
=
bizType
;
if
(
!
bizType
)
{
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
,
order
:
[[
"id"
,
'asc'
]]
});
for
(
var
i
=
0
;
i
<
ns
.
length
;
i
++
)
{
var
fa
=
ns
[
i
];
if
(
fa
.
status
==
"dqr"
||
fa
.
status
==
"ywc"
)
{
return
system
.
getResultFail
(
-
207
,
"需求方案已存在,不能重复提交"
);
}
if
(
fa
.
status
==
"ybh"
)
{
ab
.
channelSolutionNo
=
fa
.
channelSolutionNo
;
}
if
(
fa
.
status
==
"yzf"
)
{
ab
.
channelSolutionNo
=
""
;
}
}
var
solution
=
ab
.
solutionContent
.
solution
;
if
(
!
solution
)
{
return
system
.
getResultFail
(
-
103
,
"方案交付信息有误"
);
}
if
(
!
needinfo
.
channelTypeCode
)
{
return
system
.
getResultFail
(
-
104
,
"需求业务类型有误"
);
}
if
(
!
solution
.
CompanyName
)
{
return
system
.
getResultFail
(
-
105
,
"公司名不能为空"
);
}
if
(
!
solution
.
LicenseType
)
{
return
system
.
getResultFail
(
-
106
,
"业务类型不能为空"
);
}
if
(
!
solution
.
Area
)
{
return
system
.
getResultFail
(
-
107
,
"区域不能为空"
);
}
if
(
!
solution
.
ActionType
)
{
return
system
.
getResultFail
(
-
108
,
"办理类型不能为空"
);
}
var
solutionFlowList
=
ab
.
solutionContent
.
solutionFlowList
||
[];
solutionFlowList
.
push
({
status
:
"SOLUTION_SUBMIT"
,
statusName
:
this
.
regSolutionStatus
.
SOLUTION_SUBMIT
,
updated_at
:
new
Date
()
});
ab
.
solutionContent
.
status
=
"SOLUTION_SUBMIT"
;
ab
.
solutionContent
.
statusName
=
this
.
regSolutionStatus
.
SOLUTION_SUBMIT
;
ab
.
solutionContent
.
solutionFlowList
=
solutionFlowList
;
ab
[
"channelNeedNo"
]
=
needinfo
.
channelNeedNo
;
var
solutionNo
=
await
this
.
getBusUid
(
"ns"
);
ab
[
"solutionNo"
]
=
solutionNo
;
ab
[
"status"
]
=
"dqr"
;
var
customerInfo
=
{
//客户信息
"publishName"
:
needinfo
.
publishName
,
"publishMobile"
:
needinfo
.
publishMobile
};
var
salesmanInfo
=
{
//业务员信息
"salesmanName"
:
user
.
channel_username
,
"salesmanMobile"
:
user
.
mobile
,
"salesmanId"
:
user
.
id
,
"salesmanChannelId"
:
user
.
channel_userid
};
ab
.
solutionContent
[
"customerInfo"
]
=
customerInfo
;
ab
.
solutionContent
[
"salesmanInfo"
]
=
salesmanInfo
;
ab
.
solutionContent
.
solution
.
SolutionPrice
=
(
ab
.
solutionContent
.
solution
.
SolutionPrice
)
/
100
||
""
;
//分转元
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
:
"nc提交方案"
}];
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
,
"提交方案失败"
);
}
})
}
//交付商通知状态变更
async
ncNotification
(
pobj
)
{
var
ab
=
pobj
.
actionBody
;
if
(
!
ab
.
orderNo
)
{
return
system
.
getResultFail
(
-
101
,
"订单号不能为空"
);
}
if
(
!
ab
.
status
)
{
return
system
.
getResultFail
(
-
102
,
"交付状态不能为空"
);
}
else
{
ab
[
"ApplicationStatus"
]
=
ab
.
status
;
}
if
(
ab
.
officialFileURL
)
{
ab
[
"OfficialFileURL"
]
=
ab
.
officialFileURL
;
}
var
ns
=
await
this
.
needsolutionDao
.
model
.
findOne
({
where
:
{
orderNo
:
ab
.
orderNo
},
raw
:
true
});
if
(
!
ns
||
!
ns
.
id
)
{
return
system
.
getResultFail
(
-
301
,
"未知方案"
);
}
ab
[
"bizId"
]
=
ns
.
channelSolutionNo
;
ab
[
"solutionNo"
]
=
ns
.
solutionNo
;
pobj
.
actionBody
=
ab
;
return
this
.
ncAcceptPartnerNotification
(
pobj
);
}
//服务商通知状态变更
async
ncAcceptPartnerNotification
(
pobj
)
{
console
.
log
(
'服务商通知状态变更pobj++++'
,
pobj
)
var
ab
=
pobj
.
actionBody
;
var
user
=
pobj
.
userInfo
;
if
(
!
user
||
!
user
.
id
)
{
return
system
.
getResultFail
(
-
100
,
"未知用户"
);
}
if
(
!
ab
.
solutionNo
)
{
return
system
.
getResultFail
(
-
101
,
"方案编号不能为空"
);
}
if
(
!
ab
.
ApplicationStatus
)
{
return
system
.
getResultFail
(
-
102
,
"通知状态不能为空"
);
}
//获取方案信息
var
needsolutioninfo
=
await
this
.
needsolutionDao
.
model
.
findOne
({
attributes
:
[
"id"
,
"status"
,
"solutionContent"
,
"needNo"
],
where
:
{
solutionNo
:
ab
.
solutionNo
},
raw
:
true
});
if
(
!
needsolutioninfo
||
!
needsolutioninfo
.
id
)
{
return
system
.
getResultFail
(
-
400
,
"未知方案"
);
}
if
(
!
needsolutioninfo
.
needNo
)
{
return
system
.
getResultFail
(
-
401
,
"方案需求信息有误"
);
}
//获取jiaofu信息
let
orderdeliverySqlData
=
{
sourceOrderNo
:
ab
.
orderNo
}
let
orderdeliverySql
=
"SELECT * FROM `c_order_delivery` WHERE sourceOrderNo = :sourceOrderNo ORDER BY id DESC limit 1"
;
let
orderdeliveryInfo
=
await
this
.
orderdeliveryDao
.
customQuery
(
orderdeliverySql
,
orderdeliverySqlData
)
if
(
orderdeliveryInfo
[
0
]
&&
orderdeliveryInfo
[
0
].
deliveryContent
){
var
deliveryContent
=
orderdeliveryInfo
[
0
].
deliveryContent
;
}
console
.
log
(
'nc +++ deliveryContent+++'
,
deliveryContent
)
if
(
!
deliveryContent
)
{
return
system
.
getResultFail
(
-
402
,
"方案交付信息有误"
);
}
if
(
this
.
regNumberStatus
[
deliveryContent
.
status
]
&&
this
.
regNumberStatus
[
deliveryContent
.
status
]
>
ab
.
ApplicationStatus
)
{
return
system
.
getResultFail
(
-
403
,
"操作失败,交付流程未按顺序执行"
);
}
if
(
this
.
regNumberStatus
[
deliveryContent
.
ApplicationStatus
]
&&
this
.
regNumberStatus
[
deliveryContent
.
ApplicationStatus
]
==
ab
.
ApplicationStatus
)
{
return
system
.
getResultFail
(
-
405
,
"操作失败,该流程状态已提交,不能重复提交"
);
}
var
solutionFlowList
=
deliveryContent
.
solutionFlowList
||
[];
var
orderInfo
=
await
this
.
orderinfoDao
.
model
.
findOne
({
attributes
:[
"uapp_id"
,
"channelOrderNo"
],
where
:
{
orderNo
:
ab
.
orderNo
},
raw
:
true
})
console
.
log
(
"orderInfo+++"
,
orderInfo
)
if
(
orderInfo
){
var
uappId
=
orderInfo
.
uapp_id
;
var
channelOrderNo
=
orderInfo
.
channelOrderNo
}
if
(
ab
.
ApplicationStatus
==
507
)
{
//完成账户注册
// if(uappId == '18'){
// if (deliveryContent.status != "USER_CONFIRMED") {
// return system.getResultFail(-507, "交付流程错误,用户确认递交⽂件后才能执行此操作");
// }
// }
deliveryContent
[
'ApplicationStatus'
]
=
507
;
solutionFlowList
.
push
({
file
:
ab
.
OfficialFileURL
||
""
,
status
:
"REGISTRATION"
,
statusName
:
this
.
regSolutionStatus
.
REGISTRATION
,
updated_at
:
new
Date
()
});
deliveryContent
.
status
=
"REGISTRATION"
;
deliveryContent
.
statusName
=
this
.
regSolutionStatus
.
REGISTRATION
;
}
if
(
ab
.
ApplicationStatus
==
508
)
{
//"服务商完成提交资料到⼯信部
if
(
deliveryContent
.
status
!=
"REGISTRATION"
)
{
return
system
.
getResultFail
(
-
508
,
"交付流程错误,请先完成账户注册"
);
}
deliveryContent
[
'ApplicationStatus'
]
=
508
;
solutionFlowList
.
push
({
file
:
ab
.
OfficialFileURL
||
""
,
status
:
"SUBMITTED"
,
statusName
:
this
.
regSolutionStatus
.
SUBMITTED
,
updated_at
:
new
Date
()
});
deliveryContent
.
status
=
"SUBMITTED"
;
deliveryContent
.
statusName
=
this
.
regSolutionStatus
.
SUBMITTED
;
}
if
(
ab
.
ApplicationStatus
==
509
)
{
//⼯商部已受理
if
(
deliveryContent
.
status
!=
"SUBMITTED"
)
{
return
system
.
getResultFail
(
-
509
,
"交付流程错误,请先完成资料递交"
);
}
deliveryContent
[
'ApplicationStatus'
]
=
509
;
solutionFlowList
.
push
({
file
:
ab
.
OfficialFileURL
||
""
,
status
:
"ACCEPTED"
,
statusName
:
this
.
regSolutionStatus
.
ACCEPTED
,
updated_at
:
new
Date
()
});
deliveryContent
.
status
=
"ACCEPTED"
;
deliveryContent
.
statusName
=
this
.
regSolutionStatus
.
ACCEPTED
;
}
if
(
ab
.
ApplicationStatus
==
510
)
{
//⼯商部不予受理
if
(
deliveryContent
.
status
!=
"SUBMITTED"
)
{
return
system
.
getResultFail
(
-
510
,
"交付流程错误,请先完成资料递交"
);
}
deliveryContent
[
'ApplicationStatus'
]
=
510
;
solutionFlowList
.
push
({
file
:
ab
.
OfficialFileURL
||
""
,
status
:
"NOT_ACCEPTED"
,
statusName
:
this
.
regSolutionStatus
.
NOT_ACCEPTED
,
updated_at
:
new
Date
()
});
deliveryContent
.
status
=
"NOT_ACCEPTED"
;
needsolutioninfo
.
status
=
"ywc"
;
deliveryContent
.
statusName
=
this
.
regSolutionStatus
.
NOT_ACCEPTED
;
}
if
(
ab
.
ApplicationStatus
==
511
)
{
//⼯商部通过
if
(
deliveryContent
.
status
!=
"ACCEPTED"
)
{
return
system
.
getResultFail
(
-
511
,
"交付流程错误,⼯信部已受理后才能执行此操作"
);
}
deliveryContent
[
'ApplicationStatus'
]
=
511
;
solutionFlowList
.
push
({
file
:
ab
.
OfficialFileURL
||
""
,
status
:
"APPROVED"
,
statusName
:
this
.
regSolutionStatus
.
APPROVED
,
updated_at
:
new
Date
()
});
needsolutioninfo
.
status
=
"ywc"
;
deliveryContent
.
status
=
"APPROVED"
;
deliveryContent
.
statusName
=
this
.
regSolutionStatus
.
APPROVED
;
}
if
(
ab
.
ApplicationStatus
==
512
)
{
//⼯信部未通过
if
(
deliveryContent
.
status
!=
"ACCEPTED"
)
{
return
system
.
getResultFail
(
-
512
,
"交付流程错误,⼯信部已受理后才能执行此操作"
);
}
deliveryContent
[
'ApplicationStatus'
]
=
512
;
solutionFlowList
.
push
({
file
:
ab
.
OfficialFileURL
||
""
,
status
:
"NOT_APPROVED"
,
statusName
:
this
.
regSolutionStatus
.
NOT_APPROVED
,
updated_at
:
new
Date
()
});
deliveryContent
.
status
=
"NOT_APPROVED"
;
needsolutioninfo
.
status
=
"ywc"
;
deliveryContent
.
statusName
=
this
.
regSolutionStatus
.
NOT_APPROVED
;
}
deliveryContent
.
solutionFlowList
=
solutionFlowList
;
var
applicationStatusList
=
deliveryContent
.
applicationStatusList
||
[];
var
statusObj
=
{
"OfficialFileURL"
:
ab
.
OfficialFileURL
||
""
,
"ApplicationStatus"
:
ab
.
ApplicationStatus
,
"ApplicationStatusName"
:
this
.
regSolutionStatus
[
ab
.
ApplicationStatus
],
"created_at"
:
new
Date
()
};
applicationStatusList
.
push
(
statusObj
);
deliveryContent
.
applicationStatusList
=
applicationStatusList
;
deliveryContent
[
"applicationStatus"
]
=
ab
.
applicationStatus
;
deliveryContent
=
JSON
.
stringify
(
deliveryContent
);
let
orderdeliveryData
=
{
sourceOrderNo
:
ab
.
orderNo
,
deliveryContent
:
deliveryContent
,
}
if
(
!
orderdeliveryInfo
[
0
]){
let
sql
=
"INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUES (:sourceOrderNo,:deliveryContent)"
;
var
orderdelivery
=
await
this
.
orderdeliveryDao
.
customInsert
(
sql
,
orderdeliveryData
);
}
else
{
let
sql
=
"UPDATE `c_order_delivery` SET deliveryContent ='"
+
deliveryContent
+
"' where sourceOrderNo='"
+
ab
.
orderNo
+
"'"
;
var
orderdelivery
=
await
this
.
orderdeliveryDao
.
customInsert
(
sql
);
}
let
orderdeliveryQuery
=
"SELECT * from `c_order_delivery` where sourceOrderNo='"
+
ab
.
orderNo
+
"'"
;
let
QueryDatas
=
{
sourceOrderNo
:
ab
.
orderNo
}
orderdelivery
=
await
this
.
orderdeliveryDao
.
customQuery
(
orderdeliveryQuery
,
QueryDatas
)
console
.
log
(
'orderdelivery++orderdelivery++++++'
,
orderdelivery
)
if
(
orderdelivery
){
orderdelivery
=
orderdelivery
[
0
]
orderdelivery
[
"bizId"
]
=
ab
.
bizId
;
orderdelivery
[
'uapp_id'
]
=
uappId
;
orderdelivery
[
'channelOrderNo'
]
=
channelOrderNo
;
}
console
.
log
(
'orderdelivery++'
,
orderdelivery
)
return
system
.
getResultSuccess
(
orderdelivery
);
}
//接收方案编号(方案推送至yun后,接收保存方案信息)
async
ncReceiveProgrammeNo
(
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
,
isInvalid
:
0
},
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
(
''
);
}
//根据需求关闭NC方案(关闭需求后调用)
async
ncClosePlan
(
pobj
)
{
console
.
log
(
"ncClosePlan+++"
,
pobj
)
var
ab
=
pobj
.
actionBody
;
var
app
=
pobj
.
appInfo
;
if
(
!
app
||
!
app
.
uapp_id
)
{
return
system
.
getResultFail
(
-
100
,
"未知渠道"
);
}
if
(
!
ab
.
needNo
)
{
return
system
.
getResultFail
(
-
101
,
"需求编号不能为空"
);
}
//获取需求信息
var
needinfo
=
await
this
.
needinfoDao
.
model
.
findOne
({
attributes
:
[
"id"
,
"status"
,
"statusName"
,
"needNo"
,
"uapp_id"
],
//2020-10-29 laolan xinzeng uapp_id
where
:
{
channelNeedNo
:
ab
.
needNo
},
raw
:
true
});
if
(
!
needinfo
||
!
needinfo
.
id
)
{
return
system
.
getResultFail
(
-
201
,
"未知需求信息"
);
}
if
(
needinfo
.
status
==
"ygb"
)
{
return
system
.
getResultFail
(
-
202
,
"该方案需求状态为"
+
needinfo
.
statusName
+
",不能执行此操作"
);
}
//获取方案信息
var
ns
=
await
this
.
needsolutionDao
.
model
.
findOne
({
where
:
{
needNo
:
needinfo
.
needNo
,
isInvalid
:
0
},
raw
:
true
});
// var newFlowStatus = [];
if
(
ns
&&
ns
.
id
)
{
if
(
ns
.
status
==
"ywc"
)
{
return
system
.
getResultFail
(
-
103
,
"方案状态错误,不能废弃已完成方案"
);
}
var
flowStatus
=
ns
.
solutionContent
&&
ns
.
solutionContent
.
status
?
ns
.
solutionContent
.
status
:
""
;
if
(
flowStatus
&&
[
"NOT_ACCEPTED"
,
"CLOSE"
].
indexOf
(
flowStatus
)
<
0
)
{
return
system
.
getResultFail
(
-
104
,
"⽅案状态为关闭或不予受理才可关闭需求"
);
}
}
var
self
=
this
;
return
await
self
.
needsolutionDao
.
db
.
transaction
(
async
function
(
t
)
{
var
needObj
=
{
id
:
needinfo
.
id
,
status
:
"ygb"
,
notes
:
ab
.
note
};
await
self
.
needinfoDao
.
update
(
needObj
,
t
);
//关闭需求
if
(
ns
&&
ns
.
id
)
{
await
self
.
needsolutionDao
.
model
.
update
({
status
:
"yzf"
,
isInvalid
:
1
},
{
where
:
{
id
:
ns
.
id
},
transaction
:
t
});
//方案废弃
return
system
.
getResultSuccess
(
ns
.
orderNo
);
}
//2020-10-29 laolan
var
uappId
=
{};
uappId
[
'uapp_id'
]
=
needinfo
.
uapp_id
;
ns
=
ns
?
ns
:
{};
ns
=
Object
.
assign
(
ns
,
uappId
)
console
.
log
(
'guanbi ns +++'
,
ns
)
return
system
.
getResultSuccess
(
ns
);
// return system.getResultSuccess();
})
}
//交付商关闭交付单
async
ncCloseOrderDelivery
(
pobj
)
{
var
ab
=
pobj
.
actionBody
;
if
(
!
ab
.
orderNo
)
{
return
system
.
getResultFail
(
-
101
,
"订单号不能为空"
);
}
if
(
!
ab
.
note
)
{
return
system
.
getResultFail
(
-
106
,
"关闭理由不能为空"
);
}
else
{
ab
.
note
=
ab
.
note
;
}
var
ns
=
await
this
.
needsolutionDao
.
model
.
findOne
({
where
:
{
orderNo
:
ab
.
orderNo
},
raw
:
true
});
if
(
!
ns
||
!
ns
.
id
)
{
return
system
.
getResultFail
(
-
301
,
"未知方案"
);
}
ab
[
"bizId"
]
=
ns
.
channelSolutionNo
;
pobj
.
actionBody
=
ab
;
return
this
.
ncAbolishProgramme
(
pobj
);
}
//服务商作废方案-- ncAbolishProgramme
async
ncAbolishProgramme
(
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
,
isInvalid
:
0
},
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
||
[
"MATERIAL_UNCONFIRM"
,
"REGISTRATION"
,
"SUBMITTED"
].
indexOf
(
solutionContent
.
status
)
<
0
)
{
return
system
.
getResultFail
(
-
302
,
"方案流程状态错误,不能执行此操作"
);
}
solutionContent
.
serviceProviderNote
=
ab
.
note
;
var
solutionFlowList
=
solutionContent
.
solutionFlowList
||
[];
solutionFlowList
.
push
({
status
:
"CLOSE"
,
statusName
:
this
.
regSolutionStatus
.
CLOSE
,
updated_at
:
new
Date
()
});
solutionContent
.
status
=
"CLOSE"
;
solutionContent
.
statusName
=
this
.
regSolutionStatus
.
CLOSE
;
solutionContent
=
JSON
.
stringify
(
solutionContent
);
await
this
.
needsolutionDao
.
update
({
id
:
ns
.
id
,
status
:
"yzf"
,
isInvalid
:
1
,
solutionContent
:
solutionContent
});
//方案废弃
//获取方案信息
var
new_ns
=
await
this
.
needsolutionDao
.
model
.
findOne
({
where
:
{
id
:
ns
.
id
},
raw
:
true
});
return
system
.
getResultSuccess
(
new_ns
);
}
}
module
.
exports
=
regCenterOrderService
;
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