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
533da2e8
Commit
533da2e8
authored
Jun 21, 2020
by
sxy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 推送商城
parent
00a11d49
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
255 additions
and
29 deletions
+255
-29
icp-deliver/app/base/controller/ctl.base.js
+4
-0
icp-deliver/app/base/controller/impl/bizchance/bizoptCtl.js
+2
-2
icp-deliver/app/base/controller/impl/bizchance/schemeCtl.js
+1
-1
icp-deliver/app/base/db/models/delivery/status_log.js
+10
-2
icp-deliver/app/base/service/impl/bizchance/bizoptSve.js
+12
-4
icp-deliver/app/base/service/impl/bizchance/schemeSve.js
+11
-7
icp-deliver/app/base/service/impl/delivery/deliverSve.js
+65
-12
icp-deliver/app/base/utils/totxClient.js
+148
-0
icp-deliver/app/config/settings.js
+2
-1
No files found.
icp-deliver/app/base/controller/ctl.base.js
View file @
533da2e8
...
@@ -47,6 +47,7 @@ class CtlBase {
...
@@ -47,6 +47,7 @@ class CtlBase {
password
:
custtags
?
custtags
[
lastindex
].
split
(
"_"
)[
1
]
:
null
,
password
:
custtags
?
custtags
[
lastindex
].
split
(
"_"
)[
1
]
:
null
,
username
:
req
.
headers
[
"x-consumer-username"
],
username
:
req
.
headers
[
"x-consumer-username"
],
userid
:
req
.
headers
[
"x-consumer-custom-id"
],
userid
:
req
.
headers
[
"x-consumer-custom-id"
],
username
:
req
.
headers
[
"x-consumer-username"
],
credid
:
req
.
headers
[
"x-credential-identifier"
],
credid
:
req
.
headers
[
"x-credential-identifier"
],
regrole
:
req
.
headers
[
"xregrole"
],
regrole
:
req
.
headers
[
"xregrole"
],
bizpath
:
req
.
headers
[
"xbizpath"
],
bizpath
:
req
.
headers
[
"xbizpath"
],
...
@@ -75,6 +76,9 @@ class CtlBase {
...
@@ -75,6 +76,9 @@ class CtlBase {
if
(
req
.
xctx
.
userid
)
{
//在请求传递数据对象注入公司id
if
(
req
.
xctx
.
userid
)
{
//在请求传递数据对象注入公司id
pobj
.
userid
=
req
.
xctx
.
userid
;
pobj
.
userid
=
req
.
xctx
.
userid
;
}
}
if
(
req
.
xctx
.
username
)
{
//在请求传递数据对象注入公司名称
pobj
.
username
=
req
.
xctx
.
username
;
}
pobj
.
bizpath
=
req
.
xctx
.
bizpath
;
pobj
.
bizpath
=
req
.
xctx
.
bizpath
;
}
}
async
doexec
(
methodname
,
pobj
,
query
,
req
)
{
async
doexec
(
methodname
,
pobj
,
query
,
req
)
{
...
...
icp-deliver/app/base/controller/impl/bizchance/bizoptCtl.js
View file @
533da2e8
...
@@ -31,7 +31,7 @@ class BizOptCtl extends CtlBase {
...
@@ -31,7 +31,7 @@ class BizOptCtl extends CtlBase {
if
(
!
pobj
.
id
)
{
if
(
!
pobj
.
id
)
{
return
system
.
getResult
(
null
,
"id can not be empty,100290"
);
return
system
.
getResult
(
null
,
"id can not be empty,100290"
);
}
}
const
rs
=
await
this
.
service
.
findBizAndSheme
(
{
id
:
pobj
.
id
}
);
const
rs
=
await
this
.
service
.
findBizAndSheme
(
pobj
);
return
system
.
getResult
(
rs
);
return
system
.
getResult
(
rs
);
}
}
...
@@ -43,7 +43,7 @@ class BizOptCtl extends CtlBase {
...
@@ -43,7 +43,7 @@ class BizOptCtl extends CtlBase {
return
system
.
getResult
(
null
,
"close_reason can not be empty,100290"
);
return
system
.
getResult
(
null
,
"close_reason can not be empty,100290"
);
}
}
try
{
try
{
await
this
.
service
.
closeBiz
(
{
bizId
:
pobj
.
bizId
,
close_reason
:
pobj
.
close_reason
}
);
await
this
.
service
.
closeBiz
(
pobj
);
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
catch
(
err
)
{
}
catch
(
err
)
{
return
system
.
getResult
(
null
,
err
.
message
);
return
system
.
getResult
(
null
,
err
.
message
);
...
...
icp-deliver/app/base/controller/impl/bizchance/schemeCtl.js
View file @
533da2e8
...
@@ -23,7 +23,7 @@ class SchemeCtl extends CtlBase {
...
@@ -23,7 +23,7 @@ class SchemeCtl extends CtlBase {
if
(
!
pobj
.
bizopt_id
)
{
if
(
!
pobj
.
bizopt_id
)
{
return
system
.
getResult
(
null
,
"bizopt_id can not be empty,100290"
);
return
system
.
getResult
(
null
,
"bizopt_id can not be empty,100290"
);
}
}
const
rs
=
await
this
.
service
.
findOne
(
{
bizopt_id
:
pobj
.
bizopt_id
}
);
const
rs
=
await
this
.
service
.
findOne
(
pobj
);
return
system
.
getResult
(
rs
);
return
system
.
getResult
(
rs
);
}
}
}
}
...
...
icp-deliver/app/base/db/models/delivery/status_log.js
View file @
533da2e8
...
@@ -14,13 +14,21 @@ module.exports = (db, DataTypes) => {
...
@@ -14,13 +14,21 @@ module.exports = (db, DataTypes) => {
allowNull
:
false
,
allowNull
:
false
,
type
:
DataTypes
.
STRING
type
:
DataTypes
.
STRING
},
},
status_
date
:
{
// 状态日期
status_
reason
:
{
// 状态日期
allowNull
:
true
,
allowNull
:
true
,
type
:
DataTypes
.
DATE
type
:
DataTypes
.
STRING
},
},
status_code
:
{
// 流转状态
status_code
:
{
// 流转状态
allowNull
:
false
,
allowNull
:
false
,
type
:
DataTypes
.
STRING
type
:
DataTypes
.
STRING
},
salesman_id
:
{
allowNull
:
true
,
type
:
DataTypes
.
STRING
},
salesman_name
:
{
allowNull
:
true
,
type
:
DataTypes
.
STRING
}
}
},
{
},
{
paranoid
:
false
,
//假的删除
paranoid
:
false
,
//假的删除
...
...
icp-deliver/app/base/service/impl/bizchance/bizoptSve.js
View file @
533da2e8
...
@@ -2,6 +2,8 @@ const system = require("../../../system");
...
@@ -2,6 +2,8 @@ const system = require("../../../system");
const
ServiceBase
=
require
(
"../../sve.base"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
moment
=
require
(
"moment"
);
const
moment
=
require
(
"moment"
);
const
pushTx
=
require
(
"../../../utils/totxClient"
)
class
BizoptService
extends
ServiceBase
{
class
BizoptService
extends
ServiceBase
{
constructor
()
{
constructor
()
{
super
(
"bizchance"
,
ServiceBase
.
getDaoName
(
BizoptService
));
super
(
"bizchance"
,
ServiceBase
.
getDaoName
(
BizoptService
));
...
@@ -54,11 +56,11 @@ class BizoptService extends ServiceBase {
...
@@ -54,11 +56,11 @@ class BizoptService extends ServiceBase {
async
closeBiz
(
pobj
)
{
async
closeBiz
(
pobj
)
{
/**
/**
* 1.
查询 是否有权限
* 1.
回传给腾讯
* 2. 判断是否可以关闭
* 2. 判断是否可以关闭
* 3. 更改 商机、方案状态
* 3. 更改 商机、方案状态
* 4. 插入更改记录
* 4. 插入更改记录
* 5.
TODO:回传给腾讯
* 5.
查询 是否有权限
*/
*/
const
bizResult
=
await
this
.
dao
.
findOne
({
const
bizResult
=
await
this
.
dao
.
findOne
({
id
:
pobj
.
bizId
id
:
pobj
.
bizId
...
@@ -74,6 +76,8 @@ class BizoptService extends ServiceBase {
...
@@ -74,6 +76,8 @@ class BizoptService extends ServiceBase {
bizopt_id
:
pobj
.
bizId
bizopt_id
:
pobj
.
bizId
});
});
await
pushTx
.
pushCloseNeed
(
bizResult
,
pobj
.
close_reason
);
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
await
this
.
dao
.
updateByWhere
({
await
this
.
dao
.
updateByWhere
({
business_status
:
system
.
BUSSTATUS
.
CLOSED
,
business_status
:
system
.
BUSSTATUS
.
CLOSED
,
...
@@ -84,7 +88,9 @@ class BizoptService extends ServiceBase {
...
@@ -84,7 +88,9 @@ class BizoptService extends ServiceBase {
this
.
statuslogDao
.
create
({
this
.
statuslogDao
.
create
({
flow_type
:
system
.
FLOWCODE
.
BIZ
,
flow_type
:
system
.
FLOWCODE
.
BIZ
,
flow_id
:
pobj
.
bizId
,
flow_id
:
pobj
.
bizId
,
status_code
:
system
.
BUSSTATUS
.
CLOSED
status_code
:
system
.
BUSSTATUS
.
CLOSED
,
salesman_id
:
data
.
userid
,
salesman_name
:
data
.
username
});
});
if
(
schemeResult
)
{
if
(
schemeResult
)
{
await
this
.
schemeDao
.
updateByWhere
({
await
this
.
schemeDao
.
updateByWhere
({
...
@@ -95,7 +101,9 @@ class BizoptService extends ServiceBase {
...
@@ -95,7 +101,9 @@ class BizoptService extends ServiceBase {
this
.
statuslogDao
.
create
({
this
.
statuslogDao
.
create
({
flow_type
:
system
.
FLOWCODE
.
SCHEME
,
flow_type
:
system
.
FLOWCODE
.
SCHEME
,
flow_id
:
schemeResult
.
id
,
flow_id
:
schemeResult
.
id
,
status_code
:
system
.
SCHEMESTATUS
.
CLOSED
status_code
:
system
.
SCHEMESTATUS
.
CLOSED
,
salesman_id
:
data
.
userid
,
salesman_name
:
data
.
username
});
});
}
}
return
"success"
return
"success"
...
...
icp-deliver/app/base/service/impl/bizchance/schemeSve.js
View file @
533da2e8
...
@@ -2,6 +2,7 @@ const system = require("../../../system");
...
@@ -2,6 +2,7 @@ const system = require("../../../system");
const
ServiceBase
=
require
(
"../../sve.base"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
moment
=
require
(
"moment"
);
const
moment
=
require
(
"moment"
);
const
pushTx
=
require
(
"../../../utils/totxClient"
)
class
SchemeService
extends
ServiceBase
{
class
SchemeService
extends
ServiceBase
{
constructor
()
{
constructor
()
{
super
(
"bizchance"
,
ServiceBase
.
getDaoName
(
SchemeService
));
super
(
"bizchance"
,
ServiceBase
.
getDaoName
(
SchemeService
));
...
@@ -26,10 +27,10 @@ class SchemeService extends ServiceBase {
...
@@ -26,10 +27,10 @@ class SchemeService extends ServiceBase {
if
(
schemeData
&&
[
system
.
SCHEMESTATUS
.
WAITINGCONFIRM
,
system
.
SCHEMESTATUS
.
CLOSED
].
includes
(
schemeData
.
scheme_status
))
{
if
(
schemeData
&&
[
system
.
SCHEMESTATUS
.
WAITINGCONFIRM
,
system
.
SCHEMESTATUS
.
CLOSED
].
includes
(
schemeData
.
scheme_status
))
{
throw
new
Error
(
"此方案状态下不可操作"
);
throw
new
Error
(
"此方案状态下不可操作"
);
}
}
if
(
!
schemeData
)
{
// TODO: scheme_number 提交到腾讯获取
方案编号
// scheme_number 提交到腾讯 获取更新
方案编号
data
.
scheme_number
=
"TX回传"
data
.
scheme_number
=
await
pushTx
.
pushScheme
(
bizData
,
schemeData
||
data
);
}
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
/**
/**
...
@@ -37,7 +38,6 @@ class SchemeService extends ServiceBase {
...
@@ -37,7 +38,6 @@ class SchemeService extends ServiceBase {
* 2. 查询 是否有方案及方案状态
* 2. 查询 是否有方案及方案状态
* 3. 新增 或更改 方案
* 3. 新增 或更改 方案
* 4. 添加 状态记录更改
* 4. 添加 状态记录更改
* TODO:5. 传给腾讯状态
*/
*/
try
{
try
{
await
this
.
bizoptDao
.
updateByWhere
({
await
this
.
bizoptDao
.
updateByWhere
({
...
@@ -48,7 +48,9 @@ class SchemeService extends ServiceBase {
...
@@ -48,7 +48,9 @@ class SchemeService extends ServiceBase {
this
.
statuslogDao
.
create
({
this
.
statuslogDao
.
create
({
flow_type
:
system
.
FLOWCODE
.
BIZ
,
flow_type
:
system
.
FLOWCODE
.
BIZ
,
flow_id
:
data
.
bizopt_id
,
flow_id
:
data
.
bizopt_id
,
status_code
:
system
.
BUSSTATUS
.
WAITINGCONFIRM
status_code
:
system
.
BUSSTATUS
.
WAITINGCONFIRM
,
salesman_id
:
data
.
userid
,
salesman_name
:
data
.
username
});
});
let
scheme_id
=
null
;
let
scheme_id
=
null
;
if
(
schemeData
)
{
if
(
schemeData
)
{
...
@@ -72,7 +74,9 @@ class SchemeService extends ServiceBase {
...
@@ -72,7 +74,9 @@ class SchemeService extends ServiceBase {
this
.
statuslogDao
.
create
({
this
.
statuslogDao
.
create
({
flow_type
:
system
.
FLOWCODE
.
SCHEME
,
flow_type
:
system
.
FLOWCODE
.
SCHEME
,
flow_id
:
scheme_id
,
flow_id
:
scheme_id
,
status_code
:
system
.
SCHEMESTATUS
.
WAITINGCONFIRM
status_code
:
system
.
SCHEMESTATUS
.
WAITINGCONFIRM
,
salesman_id
:
data
.
userid
,
salesman_name
:
data
.
username
});
});
return
{
bizId
:
data
.
bizopt_id
};
return
{
bizId
:
data
.
bizopt_id
};
}
catch
(
err
)
{
}
catch
(
err
)
{
...
...
icp-deliver/app/base/service/impl/delivery/deliverSve.js
View file @
533da2e8
...
@@ -3,6 +3,8 @@ const ServiceBase = require("../../sve.base");
...
@@ -3,6 +3,8 @@ const ServiceBase = require("../../sve.base");
const
settings
=
require
(
"../../../../config/settings"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
moment
=
require
(
"moment"
);
const
moment
=
require
(
"moment"
);
const
System
=
require
(
"../../../system"
);
const
System
=
require
(
"../../../system"
);
const
pushTx
=
require
(
"../../../utils/totxClient"
)
class
DeliverService
extends
ServiceBase
{
class
DeliverService
extends
ServiceBase
{
constructor
()
{
constructor
()
{
super
(
"delivery"
,
ServiceBase
.
getDaoName
(
DeliverService
));
super
(
"delivery"
,
ServiceBase
.
getDaoName
(
DeliverService
));
...
@@ -33,10 +35,10 @@ class DeliverService extends ServiceBase {
...
@@ -33,10 +35,10 @@ class DeliverService extends ServiceBase {
async
submitMaterials
(
pobj
)
{
async
submitMaterials
(
pobj
)
{
/**
/**
* 1.此状态下是否可以提交材料
* 1.此状态下是否可以提交材料
* 2.推送到腾讯
* 2.同步暂存数据表
* 2.同步暂存数据表
* 3.存储到材料表
* 3.存储到材料表
* 4.更改 交付单流转状态
* 4.更改 交付单流转状态
* 5.推送到腾讯
*/
*/
const
deliverData
=
await
this
.
dao
.
findOne
({
const
deliverData
=
await
this
.
dao
.
findOne
({
id
:
pobj
.
deliver_id
id
:
pobj
.
deliver_id
...
@@ -48,6 +50,11 @@ class DeliverService extends ServiceBase {
...
@@ -48,6 +50,11 @@ class DeliverService extends ServiceBase {
].
includes
(
deliverData
.
delivery_status
))
{
].
includes
(
deliverData
.
delivery_status
))
{
throw
new
Error
(
"此交付单不可提交材料"
);
throw
new
Error
(
"此交付单不可提交材料"
);
}
}
// 推送到商城
await
pushTx
.
submitMaterials
(
deliverData
,
pobj
.
cache_info
)
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
await
this
.
cacheinfoDao
.
createOrUpdate
(
pobj
,
t
);
await
this
.
cacheinfoDao
.
createOrUpdate
(
pobj
,
t
);
await
this
.
materialDao
.
createOrUpdate
(
pobj
,
t
);
await
this
.
materialDao
.
createOrUpdate
(
pobj
,
t
);
...
@@ -60,7 +67,9 @@ class DeliverService extends ServiceBase {
...
@@ -60,7 +67,9 @@ class DeliverService extends ServiceBase {
this
.
statuslogDao
.
create
({
this
.
statuslogDao
.
create
({
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_id
:
pobj
.
deliver_id
,
flow_id
:
pobj
.
deliver_id
,
status_code
:
system
.
SERVERSESTATUS
.
SUBMITING
status_code
:
system
.
SERVERSESTATUS
.
SUBMITING
,
salesman_id
:
data
.
userid
,
salesman_name
:
data
.
username
});
});
}
}
...
@@ -93,14 +102,20 @@ class DeliverService extends ServiceBase {
...
@@ -93,14 +102,20 @@ class DeliverService extends ServiceBase {
throw
new
Error
(
"此状态下不可手动更新办理状态"
);
throw
new
Error
(
"此状态下不可手动更新办理状态"
);
}
}
let
status
;
let
status
;
let
txstatus
;
switch
(
deliverData
.
delivery_status
)
{
switch
(
deliverData
.
delivery_status
)
{
case
system
.
SERVERSESTATUS
.
SUBMITING
:
case
system
.
SERVERSESTATUS
.
SUBMITING
:
status
=
system
.
SERVERSESTATUS
.
DISPOSEING
status
=
system
.
SERVERSESTATUS
.
DISPOSEING
;
txstatus
=
pushTx
.
TXSTATUS
.
DISPOSEING
;
break
break
case
system
.
SERVERSESTATUS
.
POSTING
:
case
system
.
SERVERSESTATUS
.
POSTING
:
status
=
system
.
SERVERSESTATUS
.
SUCCESS
status
=
system
.
SERVERSESTATUS
.
SUCCESS
;
txstatus
=
pushTx
.
TXSTATUS
.
SUCCESS
;
break
break
}
}
await
pushTx
.
pushChangeOrder
(
txstatus
,
deliverData
.
source_number
);
await
this
.
dao
.
updateByWhere
({
await
this
.
dao
.
updateByWhere
({
delivery_status
:
status
delivery_status
:
status
},
{
},
{
...
@@ -109,7 +124,9 @@ class DeliverService extends ServiceBase {
...
@@ -109,7 +124,9 @@ class DeliverService extends ServiceBase {
this
.
statuslogDao
.
create
({
this
.
statuslogDao
.
create
({
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_id
:
pobj
.
id
,
flow_id
:
pobj
.
id
,
status_code
:
status
status_code
:
status
,
salesman_id
:
data
.
userid
,
salesman_name
:
data
.
username
});
});
return
"success"
return
"success"
}
}
...
@@ -138,7 +155,7 @@ class DeliverService extends ServiceBase {
...
@@ -138,7 +155,7 @@ class DeliverService extends ServiceBase {
}
}
});
});
if
(
annualReportData
&&
annualReportData
.
delivery_status
===
System
.
ANNUALREPORT
.
RECEIVED
)
{
if
(
annualReportData
&&
annualReportData
.
delivery_status
===
System
.
ANNUALREPORT
.
RECEIVED
)
{
let
year
=
annualReportData
.
delivery_info
&&
annualReportData
.
delivery_info
.
y
ear
||
5
let
year
=
annualReportData
.
delivery_info
&&
annualReportData
.
delivery_info
.
numY
ear
||
5
for
(
let
i
=
new
Date
().
getFullYear
();
i
<
new
Date
().
getFullYear
()
+
year
;
i
++
)
{
for
(
let
i
=
new
Date
().
getFullYear
();
i
<
new
Date
().
getFullYear
()
+
year
;
i
++
)
{
annualReportArry
.
push
({
annualReportArry
.
push
({
year
:
i
,
year
:
i
,
...
@@ -161,7 +178,9 @@ class DeliverService extends ServiceBase {
...
@@ -161,7 +178,9 @@ class DeliverService extends ServiceBase {
this
.
statuslogDao
.
create
({
this
.
statuslogDao
.
create
({
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_id
:
annualReportData
.
id
,
flow_id
:
annualReportData
.
id
,
status_code
:
System
.
ANNUALREPORT
.
TAKEEFFECT
status_code
:
System
.
ANNUALREPORT
.
TAKEEFFECT
,
salesman_id
:
data
.
userid
,
salesman_name
:
data
.
username
});
});
await
this
.
annualreportDao
.
bulkCreate
(
annualReportArry
,
t
);
await
this
.
annualreportDao
.
bulkCreate
(
annualReportArry
,
t
);
}
}
...
@@ -184,6 +203,11 @@ class DeliverService extends ServiceBase {
...
@@ -184,6 +203,11 @@ class DeliverService extends ServiceBase {
if
(
!
[
system
.
SERVERSESTATUS
.
RECEIVED
,
system
.
SERVERSESTATUS
.
COLLECTING
].
includes
(
deliverData
.
delivery_status
))
{
if
(
!
[
system
.
SERVERSESTATUS
.
RECEIVED
,
system
.
SERVERSESTATUS
.
COLLECTING
].
includes
(
deliverData
.
delivery_status
))
{
throw
new
Error
(
"该交付单状态下不可提交"
);
throw
new
Error
(
"该交付单状态下不可提交"
);
}
}
// 推送 关闭交付
await
pushTx
.
pushChangeOrder
(
pushTx
.
TXSTATUS
.
CLOSED
,
deliverData
.
source_number
,
{
close_reason
:
pobj
.
close_reason
});
let
annualReportData
;
let
annualReportData
;
if
(
deliverData
.
master_source_number
)
{
if
(
deliverData
.
master_source_number
)
{
annualReportData
=
await
this
.
dao
.
findOne
({
annualReportData
=
await
this
.
dao
.
findOne
({
...
@@ -192,6 +216,12 @@ class DeliverService extends ServiceBase {
...
@@ -192,6 +216,12 @@ class DeliverService extends ServiceBase {
[
this
.
db
.
Op
.
ne
]:
deliverData
.
id
[
this
.
db
.
Op
.
ne
]:
deliverData
.
id
}
}
});
});
// 推送 关闭交付 资质
if
(
annualReportData
)
{
await
pushTx
.
pushChangeOrder
(
pushTx
.
TXSTATUS
.
CLOSED
,
annualReportData
.
source_number
,
{
close_reason
:
"对应的资质交付关闭了"
});
}
}
}
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
await
this
.
dao
.
updateByWhere
({
await
this
.
dao
.
updateByWhere
({
...
@@ -203,18 +233,23 @@ class DeliverService extends ServiceBase {
...
@@ -203,18 +233,23 @@ class DeliverService extends ServiceBase {
this
.
statuslogDao
.
create
({
this
.
statuslogDao
.
create
({
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_id
:
pobj
.
id
,
flow_id
:
pobj
.
id
,
status_code
:
system
.
SERVERSESTATUS
.
CLOSED
status_code
:
system
.
SERVERSESTATUS
.
CLOSED
,
salesman_id
:
data
.
userid
,
salesman_name
:
data
.
username
});
});
if
(
annualReportData
&&
annualReportData
.
delivery_status
===
System
.
ANNUALREPORT
.
RECEIVED
)
{
if
(
annualReportData
)
{
await
this
.
dao
.
updateByWhere
({
await
this
.
dao
.
updateByWhere
({
delivery_status
:
system
.
SERVERSESTATUS
.
CLOSED
,
delivery_status
:
system
.
SERVERSESTATUS
.
CLOSED
,
close_reason
:
"对应的资质交付关闭了"
},
{
},
{
id
:
annualReportData
.
id
id
:
annualReportData
.
id
},
t
);
},
t
);
this
.
statuslogDao
.
create
({
this
.
statuslogDao
.
create
({
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_id
:
annualReportData
.
id
,
flow_id
:
annualReportData
.
id
,
status_code
:
system
.
SERVERSESTATUS
.
CLOSED
status_code
:
system
.
SERVERSESTATUS
.
CLOSED
,
salesman_id
:
data
.
userid
,
salesman_name
:
data
.
username
});
});
}
}
return
"success"
return
"success"
...
@@ -241,6 +276,14 @@ class DeliverService extends ServiceBase {
...
@@ -241,6 +276,14 @@ class DeliverService extends ServiceBase {
const
{
material
}
=
result
;
const
{
material
}
=
result
;
let
{
proposerInfo
}
=
material
let
{
proposerInfo
}
=
material
proposerInfo
.
recipientInfo
=
pobj
.
recipientInfo
;
proposerInfo
.
recipientInfo
=
pobj
.
recipientInfo
;
await
pushTx
.
pushChangeOrder
(
pushTx
.
TXSTATUS
.
POSTING
,
result
.
source_number
,
{
qualification
:
result
.
qualification
,
recipientInfo
:
pobj
.
recipientInfo
});
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
await
this
.
materialDao
.
updateByWhere
({
await
this
.
materialDao
.
updateByWhere
({
proposerInfo
proposerInfo
...
@@ -257,7 +300,9 @@ class DeliverService extends ServiceBase {
...
@@ -257,7 +300,9 @@ class DeliverService extends ServiceBase {
this
.
statuslogDao
.
create
({
this
.
statuslogDao
.
create
({
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_id
:
pobj
.
id
,
flow_id
:
pobj
.
id
,
status_code
:
system
.
SERVERSESTATUS
.
POSTING
status_code
:
system
.
SERVERSESTATUS
.
POSTING
,
salesman_id
:
data
.
userid
,
salesman_name
:
data
.
username
});
});
return
"success"
return
"success"
});
});
...
@@ -316,8 +361,14 @@ class DeliverService extends ServiceBase {
...
@@ -316,8 +361,14 @@ class DeliverService extends ServiceBase {
if
(
ids
.
length
===
1
&&
ids
.
includes
(
annualReportData
.
id
))
{
if
(
ids
.
length
===
1
&&
ids
.
includes
(
annualReportData
.
id
))
{
isChange
=
true
isChange
=
true
}
}
}
// 推送年报信息
await
pushTx
.
pushDeclareReport
({
id
:
pobj
.
id
,
file
:
pobj
.
file
},
deliverData
);
if
(
isChange
)
{
await
pushTx
.
pushChangeOrder
(
pushTx
.
TXSTATUS
.
SUCCESS
,
deliverData
.
source_number
);
}
}
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
await
this
.
annualreportDao
.
updateByWhere
({
await
this
.
annualreportDao
.
updateByWhere
({
file
:
pobj
.
file
,
file
:
pobj
.
file
,
...
@@ -334,7 +385,9 @@ class DeliverService extends ServiceBase {
...
@@ -334,7 +385,9 @@ class DeliverService extends ServiceBase {
this
.
statuslogDao
.
create
({
this
.
statuslogDao
.
create
({
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_type
:
system
.
FLOWCODE
.
DELIVERY
,
flow_id
:
deliverData
.
id
,
flow_id
:
deliverData
.
id
,
status_code
:
System
.
ANNUALREPORT
.
SUCCESS
status_code
:
System
.
ANNUALREPORT
.
SUCCESS
,
salesman_id
:
data
.
userid
,
salesman_name
:
data
.
username
});
});
}
}
return
'success'
;
return
'success'
;
...
...
icp-deliver/app/base/utils/totxClient.js
0 → 100644
View file @
533da2e8
const
axios
=
require
(
"axios"
);
const
settings
=
require
(
"../../config/settings"
);
const
system
=
require
(
"../system"
);
const
annualreportDao
=
system
.
getObject
(
"db.delivery.annualreportDao"
);
const
BUSINESSTYPE
=
{
ICP
:
"/qcfw/icp/"
,
EDI
:
"/qcfw/edi/"
}
const
TXSTATUS
=
{
SUBMITING
:
"80"
,
//递交材料中
DISPOSEING
:
"90"
,
//工信部处理中
POSTING
:
"150"
,
//证书已邮寄
SUCCESS
:
"170"
,
//服务已完成
CLOSED
:
"190"
,
//已关闭
WAITDECLARE
:
"200"
,
//待申报
DECLARESUCCESS
:
"210"
,
//申报成功
}
const
porApi
=
axios
.
create
({
baseURL
:
settings
.
txurl
(),
// api 的 base_url
timeout
:
5000
,
// request timeout
headers
:
{
'Content-Type'
:
'application/json'
}
})
/**
* 推送 方案
* @param {*} bizData
* @param {*} schemeData
*/
const
pushScheme
=
async
(
bizData
,
schemeData
)
=>
{
let
data
=
{
actionType
:
"submitSolution"
,
actionBody
:
{
needNum
:
bizData
.
source_number
,
solutionContent
:
{
scheme_info
:
schemeData
.
scheme_info
,
remark_info
:
schemeData
.
remark_info
,
businessType
:
BUSINESSTYPE
[
bizData
.
business_type
]
}
}
}
// 新增 还是修改
if
(
schemeData
.
scheme_number
)
{
data
.
actionBody
.
solutionNum
=
schemeData
.
scheme_number
;
}
let
result
=
await
postRequest
(
'api/receive/entService/springBoard'
,
data
);
return
result
.
data
;
}
/**
* 推送 关闭商机
* @param {*} bizData
* @param {*} note
*/
const
pushCloseNeed
=
async
(
bizData
,
note
)
=>
{
let
data
=
{
"actionType"
:
"closeNeed"
,
"actionBody"
:
{
"needNum"
:
bizData
.
source_number
,
"note"
:
note
}
}
let
result
=
await
postRequest
(
'api/receive/entService/springBoard'
,
data
);
return
result
.
data
;
}
/**
* 推送 订单状态改变
* @param {*} status
* @param {*} orderNum
* @param {*} data
*/
const
pushChangeOrder
=
async
(
status
,
orderNum
,
data
=
{})
=>
{
let
req
=
{
"actionType"
:
"updateOrderStatus"
,
"actionBody"
:
{
"orderNum"
:
orderNum
,
"status"
:
status
,
"deliverContent"
:
data
}
}
let
result
=
await
postRequest
(
'api/receive/entService/springBoard'
,
req
);
return
result
.
data
;
}
/**
* 提交材料
* @param {*} deliverData
* @param {*} materials
*/
const
submitMaterials
=
async
(
deliverData
,
materials
)
=>
{
let
status
;
if
(
deliverData
.
delivery_status
===
system
.
SERVERSESTATUS
.
COLLECTING
)
{
status
=
TXSTATUS
.
SUBMITING
;
}
if
(
deliverData
.
delivery_status
===
system
.
SERVERSESTATUS
.
DISPOSEING
)
{
status
=
TXSTATUS
.
DISPOSEING
;
}
await
pushChangeOrder
(
status
,
deliverData
.
source_number
,
materials
);
}
const
pushDeclareReport
=
async
(
annualReport
,
deliverData
)
=>
{
const
annualReports
=
await
annualreportDao
.
findAll
({
deliver_id
:
deliverData
.
id
});
const
result
=
annualReports
&&
annualReports
.
map
((
item
)
=>
{
if
(
item
.
id
===
annualReport
.
id
)
{
item
.
updated_at
=
new
Date
();
item
.
file
=
annualReport
.
file
;
}
item
.
status
=
item
.
status
===
system
.
ANNUALREPORT
.
WAITDECLARE
?
"待申报"
:
"已申报"
return
item
})
await
pushChangeOrder
(
TXSTATUS
.
DECLARESUCCESS
,
deliverData
.
source_number
,
result
)
}
/**
* 发送请求
* @param {*} url
* @param {*} data
*/
const
postRequest
=
async
(
url
,
data
)
=>
{
let
result
=
await
porApi
.
post
(
url
,
data
);
result
=
result
.
data
;
if
(
result
.
status
===
1
)
{
return
result
}
else
{
throw
new
Error
(
result
.
message
)
}
}
module
.
exports
=
{
pushScheme
,
pushCloseNeed
,
submitMaterials
,
pushChangeOrder
,
pushDeclareReport
,
TXSTATUS
}
\ No newline at end of file
icp-deliver/app/config/settings.js
View file @
533da2e8
...
@@ -17,7 +17,8 @@ var settings = {
...
@@ -17,7 +17,8 @@ var settings = {
defaultpwd
:
"gsb2020"
,
defaultpwd
:
"gsb2020"
,
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
port
:
process
.
env
.
NODE_PORT
||
8002
,
port
:
process
.
env
.
NODE_PORT
||
8002
,
kongurl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
return
localsettings
.
kongurl
;
}
else
{
return
ENVINPUT
.
KONG_ADMIAN
;
}
},
kongurl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
var
localsettings
=
require
(
"./localsettings"
);
return
localsettings
.
kongurl
;
}
else
{
return
ENVINPUT
.
KONG_ADMIAN
;
}
},
txurl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
var
localsettings
=
require
(
"./localsettings"
);
return
localsettings
.
txurl
;
}
else
{
return
ENVINPUT
.
TX_ADMIN
;
}
},
pmappid
:
1
,
pmappid
:
1
,
pmcompanyid
:
1
,
pmcompanyid
:
1
,
pmroleid
:
{
"ta"
:
1
,
"pr"
:
2
},
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