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
4e322908
Commit
4e322908
authored
Dec 16, 2019
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
ed256dfd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
114 additions
and
81 deletions
+114
-81
laowubao/app/base/db/impl/operator/taxinfoDao.js
+101
-58
laowubao/app/base/service/impl/operator/taxinfoSve.js
+13
-23
No files found.
laowubao/app/base/db/impl/operator/taxinfoDao.js
View file @
4e322908
...
...
@@ -2,83 +2,125 @@ const system = require("../../../system");
const
Dao
=
require
(
"../../dao.base"
);
class
TaxinfoDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
TaxinfoDao
));
constructor
()
{
super
(
Dao
.
getModelName
(
TaxinfoDao
));
}
async
statCount
(
companyNames
)
{
var
result
=
{};
if
(
!
companyNames
||
companyNames
.
length
==
0
)
{
return
result
;
}
async
statCount
(
companyNames
)
{
var
result
=
{};
if
(
!
companyNames
||
companyNames
.
length
==
0
)
{
return
result
;
}
var
sql
=
"SELECT company_name, COUNT(1) AS num FROM `tax_info` WHERE company_name IN (:companyNames) GROUP BY name"
;
var
sql
=
"SELECT company_name, COUNT(1) AS num FROM `tax_info` WHERE company_name IN (:companyNames) GROUP BY name"
;
let
list
=
await
this
.
customQuery
(
sql
,
{
companyNames
:
companyNames
});
let
list
=
await
this
.
customQuery
(
sql
,
{
companyNames
:
companyNames
});
if
(
list
||
list
.
length
==
0
)
{
return
result
;
}
if
(
list
||
list
.
length
==
0
)
{
return
result
;
}
for
(
var
item
of
list
)
{
result
[
item
.
company_name
]
=
item
.
num
||
0
;
}
return
result
;
for
(
var
item
of
list
)
{
result
[
item
.
company_name
]
=
item
.
num
||
0
;
}
async
statCounts
(
companyNames
)
{
var
result
=
{};
if
(
!
companyNames
||
companyNames
.
length
==
0
)
{
return
result
;
}
var
sql
=
"SELECT company_name, SUM(actual_amount) AS num FROM `tax_info` WHERE company_name IN (:companyNames) GROUP BY name"
;
return
result
;
}
let
list
=
await
this
.
customQuery
(
sql
,
{
companyNames
:
companyNames
});
async
statCounts
(
companyNames
)
{
var
result
=
{};
if
(
!
companyNames
||
companyNames
.
length
==
0
)
{
return
result
;
}
var
sql
=
"SELECT company_name, SUM(actual_amount) AS num FROM `tax_info` WHERE company_name IN (:companyNames) GROUP BY name"
;
if
(
list
||
list
.
length
==
0
)
{
return
result
;
}
let
list
=
await
this
.
customQuery
(
sql
,
{
companyNames
:
companyNames
});
for
(
var
item
of
list
)
{
result
[
item
.
company_name
]
=
item
.
num
||
0
;
}
return
result
;
if
(
list
||
list
.
length
==
0
)
{
return
result
;
}
async
sCount
(
idno
)
{
var
result
=
{};
if
(
!
idno
||
idno
.
length
==
0
)
{
return
result
;
}
var
sql
=
"SELECT id_no, COUNT(1) AS num FROM `tax_info` WHERE id_no IN (:idno) GROUP BY name"
;
for
(
var
item
of
list
)
{
result
[
item
.
company_name
]
=
item
.
num
||
0
;
}
return
result
;
}
let
list
=
await
this
.
customQuery
(
sql
,
{
idno
:
idno
});
async
sCount
(
idno
)
{
var
result
=
{};
if
(
!
idno
||
idno
.
length
==
0
)
{
return
result
;
}
var
sql
=
"SELECT id_no, COUNT(1) AS num FROM `tax_info` WHERE id_no IN (:idno) GROUP BY name"
;
let
list
=
await
this
.
customQuery
(
sql
,
{
idno
:
idno
});
if
(
list
||
list
.
length
==
0
)
{
return
result
;
}
if
(
list
||
list
.
length
==
0
)
{
return
result
;
}
for
(
var
item
of
list
)
{
result
[
item
.
id_no
]
=
item
.
num
||
0
;
}
return
result
;
}
for
(
var
item
of
list
)
{
result
[
item
.
id_no
]
=
item
.
num
||
0
;
}
return
result
;
async
sCountS
(
inno
)
{
var
result
=
{}
;
if
(
!
inno
||
inno
.
length
==
0
)
{
return
result
;
}
var
sql
=
"SELECT id_no, SUM(actual_amount) AS num FROM `tax_info` WHERE company_name IN (:inno) GROUP BY name"
;
let
list
=
await
this
.
customQuery
(
sql
,
{
inno
:
inno
});
async
sCountS
(
inno
)
{
var
result
=
{};
if
(
!
inno
||
inno
.
length
==
0
)
{
return
result
;
}
var
sql
=
"SELECT id_no, SUM(actual_amount) AS num FROM `tax_info` WHERE company_name IN (:inno) GROUP BY name"
;
if
(
list
||
list
.
length
==
0
)
{
return
result
;
}
let
list
=
await
this
.
customQuery
(
sql
,
{
inno
:
inno
});
for
(
var
item
of
list
)
{
result
[
item
.
id_no
]
=
item
.
num
||
0
;
}
return
result
;
}
if
(
list
||
list
.
length
==
0
)
{
return
result
;
}
async
countByUser
(
params
)
{
var
sql
=
[];
sql
.
push
(
"SELECT COUNT(DISTINCT(id_no)) AS num FROM `tax_info` WHERE status = 1"
);
this
.
setCondition
(
sql
,
params
);
for
(
var
item
of
list
)
{
result
[
item
.
id_no
]
=
item
.
num
||
0
;
}
return
result
;
let
rs
=
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
if
(
!
rs
||
rs
.
length
==
0
)
{
return
0
;
}
return
rs
[
0
].
num
||
0
;
}
async
pageByUser
(
params
)
{
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"`id`, `company_name`, `usc_code`, `name`, `id_no`, `actual_amount`, `income_tax`,"
);
sql
.
push
(
"`tax_time`, `sign_body`, `tax_url`, `created_at`, `updated_at`, `deleted_at`,"
);
sql
.
push
(
"`version`, `redundance_1`, `redundance_2`, `redundance_3`, `redundance_4`,"
);
sql
.
push
(
"count(1) AS times"
);
sql
.
push
(
"FROM `tax_info`"
);
sql
.
push
(
"WHERE 1 = 1"
);
this
.
setCondition
(
sql
,
params
);
sql
.
push
(
"GROUP BY id_no"
);
sql
.
push
(
"LIMIT :startRow, :pageSize"
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
}
setCondition
(
sql
,
params
)
{
if
(
params
.
user_id
)
{
sql
.
push
(
"AND user_id = :user_id"
);
}
if
(
params
.
idNo
)
{
sql
.
push
(
"AND id_no = :idNo"
);
}
if
(
params
.
name
)
{
sql
.
push
(
"AND name = :name"
);
}
}
}
module
.
exports
=
TaxinfoDao
;
\ No newline at end of file
laowubao/app/base/service/impl/operator/taxinfoSve.js
View file @
4e322908
...
...
@@ -13,7 +13,7 @@ class TaxinfoService extends ServiceBase {
*/
async
taxinfoListByMonth
(
params
)
{
try
{
var
currentPage
=
Number
(
params
.
currentPage
||
0
);
var
currentPage
=
Number
(
params
.
currentPage
||
1
);
var
pageSize
=
Number
(
params
.
pageSize
||
10
);
if
(
!
params
.
userId
){
return
system
.
getResult
(
null
,
`参数错误 userId不能为空`
);
...
...
@@ -51,36 +51,26 @@ class TaxinfoService extends ServiceBase {
}
/**
* 按
月
查询按照人信息
* 按
ren
查询按照人信息
* @param {*} params
*/
async
taxinfoListByUser
(
params
)
{
try
{
var
currentPage
=
Number
(
params
.
currentPage
||
0
);
var
pageSize
=
Number
(
params
.
pageSize
||
10
);
if
(
!
params
.
userId
){
return
system
.
getResult
(
null
,
`参数错误 userId不能为空`
);
}
var
where
=
{};
if
(
params
.
name
){
where
.
name
=
this
.
trim
(
params
.
name
);
}
// if(params.mobile){
// where.mobile = this.trim(params.mobile);
// }
if
(
params
.
idNo
){
where
.
id_no
=
this
.
trim
(
params
.
idNo
);
params
.
currentPage
=
Number
(
params
.
currentPage
||
1
);
params
.
pageSize
=
Number
(
params
.
pageSize
||
10
);
let
total
=
await
this
.
dao
.
countByUser
(
params
);
if
(
total
===
0
)
{
return
{
count
:
1
,
rows
:
[]};
}
where
.
user_id
=
this
.
trim
(
params
.
userId
);
var
orderby
=
[
[
"id"
,
'desc'
]
];
var
page
=
await
this
.
dao
.
taxinfoList
(
currentPage
,
pageSize
,
where
,
orderby
);
if
(
page
&&
page
.
rows
)
{
for
(
var
row
of
page
.
rows
)
{
params
.
startRow
=
(
params
.
currentPage
-
1
)
*
params
.
pageSize
;
let
list
=
await
this
.
dao
.
pageByUser
(
params
);
if
(
list
)
{
for
(
var
item
of
list
)
{
this
.
handleDate
(
row
,
[
"tax_time"
],
null
,
-
8
);
}
}
return
{
count
:
total
,
rows
:
list
};
return
system
.
getResult
(
page
);
}
catch
(
error
)
{
console
.
log
(
error
);
...
...
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