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
4d3e6821
Commit
4d3e6821
authored
Feb 13, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'center-order' of gitlab.gongsibao.com:jiangyong/zhichan into center-order
parents
f018ded6
ed75666b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
center-order/app/base/service/impl/dbpolicy/policyinfoSve.js
+39
-0
No files found.
center-order/app/base/service/impl/dbpolicy/policyinfoSve.js
View file @
4d3e6821
const
system
=
require
(
"../../../system"
);
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
var
xl
=
require
(
'xlsx'
);
var
fs
=
require
(
'fs'
);
class
PolicyinfoService
extends
ServiceBase
{
class
PolicyinfoService
extends
ServiceBase
{
constructor
()
{
constructor
()
{
super
(
"dbpolicy"
,
ServiceBase
.
getDaoName
(
PolicyinfoService
));
super
(
"dbpolicy"
,
ServiceBase
.
getDaoName
(
PolicyinfoService
));
...
@@ -40,5 +42,42 @@ class PolicyinfoService extends ServiceBase {
...
@@ -40,5 +42,42 @@ class PolicyinfoService extends ServiceBase {
where
:
paramObj
,
raw
:
true
,
attributes
:
attributes
where
:
paramObj
,
raw
:
true
,
attributes
:
attributes
});
});
}
}
async
addPolicyByExcel
(){
var
workbook
=
xl
.
readFile
(
"policy.xlsx"
)
const
sheetNames
=
workbook
.
SheetNames
;
// 返回 ['sheet1', 'sheet2']
const
worksheet
=
workbook
.
Sheets
[
sheetNames
[
0
]];
var
dataa
=
xl
.
utils
.
sheet_to_json
(
worksheet
);
var
arr
=
[];
var
that
=
this
;
await
this
.
db
.
transaction
(
async
function
(
t
)
{
for
(
var
i
=
0
;
i
<
dataa
.
length
;
i
++
){
var
data
=
dataa
[
i
];
var
pobj
=
{
uapp_id
:
26
,
policyNo
:
data
[
'政策编号'
],
policyName
:
data
[
'政策名称'
],
policySource
:
data
[
'政策出处'
],
policyLinkUrl
:
data
[
'政策链接'
],
policyProvince
:
data
[
'所属省份'
],
policyCity
:
data
[
'所属城市'
],
policyTypeName
:
data
[
'政策类型'
]};
if
(
data
[
'政策类型'
]){
var
policy_type
=
{
'租金减免'
:
'fzbt'
,
'金融贷款'
:
'jrdk'
,
'扶持措施'
:
'zdfc'
,
'税收优惠'
:
'ssjm'
,
'人力资源'
:
'rlzy'
};
var
typename
=
data
[
'政策类型'
];
if
(
policy_type
[
typename
]){
pobj
[
"policyType"
]
=
policy_type
[
typename
];
}
}
if
(
pobj
.
policyNo
){
var
a
=
await
that
.
dao
.
create
(
pobj
,
t
);
arr
.
push
(
a
);
}
}
})
console
.
log
(
arr
.
length
,
"###################################"
);
}
}
}
module
.
exports
=
PolicyinfoService
;
module
.
exports
=
PolicyinfoService
;
// var task = new PolicyinfoService();
// task.addPolicyByExcel().then(d=>{
// console.log("----------end-------------------------");
// })
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