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
54c5b40c
Commit
54c5b40c
authored
Jun 03, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
2680ab05
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
140 deletions
+44
-140
xggsve-common/app/base/api/impl/op/action.js
+7
-0
xggsve-common/app/base/db/impl/deliver/deliverDao.js
+1
-1
xggsve-common/app/base/db/impl/deliver/deliverchannelDao.js
+11
-57
xggsve-common/app/base/db/models/deliver/deliverchannel.js
+0
-1
xggsve-common/app/base/service/impl/deliver/deliverchannelSve.js
+25
-81
No files found.
xggsve-common/app/base/api/impl/op/action.js
View file @
54c5b40c
...
...
@@ -10,6 +10,7 @@ class ActionAPI extends APIBase {
this
.
deliverSve
=
system
.
getObject
(
"service.deliver.deliverSve"
);
this
.
deliverschemeSve
=
system
.
getObject
(
"service.deliver.deliverschemeSve"
);
this
.
deliverchannelSve
=
system
.
getObject
(
"service.deliver.deliverchannelSve"
);
this
.
invoicecontentSve
=
system
.
getObject
(
"service.common.invoicecontentSve"
);
this
.
smsinfoSve
=
system
.
getObject
(
"service.common.smsinfoSve"
);
...
...
@@ -113,6 +114,12 @@ class ActionAPI extends APIBase {
case
"deliverEnable"
:
opResult
=
await
this
.
deliverSve
.
enable
(
action_body
);
break
;
case
"deliverBindChannel"
:
opResult
=
await
this
.
deliverchannelSve
.
bindChannel
(
action_body
);
break
;
case
"deliverChannels"
:
opResult
=
await
this
.
deliverchannelSve
.
byCondition
(
action_body
);
break
;
case
"deliverLogin"
:
opResult
=
await
this
.
deliverSve
.
login
(
action_body
);
break
;
...
...
xggsve-common/app/base/db/impl/deliver/deliverDao.js
View file @
54c5b40c
...
...
@@ -59,7 +59,7 @@ class DeliverDao extends Dao {
async
countChannelDeliver
(
params
)
{
let
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"COUNT(DISTINCT t1.`id`)"
);
sql
.
push
(
"COUNT(DISTINCT t1.`id`)
AS num
"
);
sql
.
push
(
"FROM `d_deliver_channel` t2"
);
sql
.
push
(
"INNER JOIN `d_deliver` t1 ON t2.`deliver_id` = t1.`id`"
);
sql
.
push
(
"WHERE 1 = 1"
);
...
...
xggsve-common/app/base/db/impl/deliver/deliverchannelDao.js
View file @
54c5b40c
...
...
@@ -5,71 +5,25 @@ class DeliverChannelDao extends Dao {
super
(
Dao
.
getModelName
(
DeliverChannelDao
));
}
async
dics
(
params
)
{
var
sql
=
[];
async
byCondition
(
params
)
{
let
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
params
.
attrs
||
"id, name"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"WHERE deleted_at IS NULL "
);
sql
.
push
(
params
.
attrs
||
"*"
);
sql
.
push
(
`FROM
${
this
.
model
.
tableName
}
`
);
sql
.
push
(
"WHERE 1 = 1 "
);
if
(
params
.
deliver_id
)
{
sql
.
push
(
"AND deliver_id = :deliver_id"
);
}
sql
.
push
(
"ORDER BY created_at ASC"
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
}
async
countByCondition
(
params
)
{
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"count(1) as num"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"WHERE deleted_at IS NULL"
);
this
.
setCondition
(
sql
,
params
);
var
list
=
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
if
(
!
list
||
list
.
length
==
0
)
{
return
0
;
if
(
params
.
channel_id
)
{
sql
.
push
(
"AND channel_id = :channel_id"
);
}
return
list
[
0
].
num
;
}
async
listByCondition
(
params
)
{
params
.
startRow
=
Number
(
params
.
startRow
||
0
);
params
.
pageSize
=
Number
(
params
.
pageSize
||
10
);
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
params
.
attrs
||
"*"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"WHERE deleted_at IS NULL"
);
this
.
setCondition
(
sql
,
params
);
sql
.
push
(
"ORDER BY created_at DESC"
);
sql
.
push
(
"LIMIT :startRow, :pageSize"
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
return
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
}
setCondition
(
sql
,
params
)
{
if
(
!
params
||
!
sql
)
{
return
;
}
if
(
params
.
deliver_id
)
{
sql
.
push
(
"AND deliver_id = :deliver_id"
);
}
if
(
params
.
name
)
{
params
.
nameLike
=
`%
${
params
.
name
}
%`
;
sql
.
push
(
"AND name LIKE :nameLike"
);
}
if
(
params
.
createBegin
)
{
sql
.
push
(
"AND created_at >= :createBegin"
);
}
if
(
params
.
createEnd
)
{
sql
.
push
(
"AND created_at <= :createEnd"
);
}
async
delByDC
(
params
)
{
let
sql
=
`DELETE FROM
${
this
.
model
.
tableName
}
WHERE deliver_id = :deliver_id AND channel_id = :channel_id`
;
this
.
customUpdate
(
sql
,
params
);
}
async
findListByIds
(
ids
)
{
...
...
xggsve-common/app/base/db/models/deliver/deliver
s
channel.js
→
xggsve-common/app/base/db/models/deliver/deliverchannel.js
View file @
54c5b40c
...
...
@@ -3,7 +3,6 @@ const settings = require("../../../../config/settings");
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"deliverchannel"
,
{
saas_id
:
DataTypes
.
STRING
,
channel_id
:
DataTypes
.
STRING
,
deliver_id
:
DataTypes
.
STRING
,
},
{
...
...
xggsve-common/app/base/service/impl/deliver/deliverchannelSve.js
View file @
54c5b40c
...
...
@@ -7,90 +7,34 @@ class DeliverChannelService extends ServiceBase {
super
(
"deliver"
,
ServiceBase
.
getDaoName
(
DeliverChannelService
));
}
async
save
(
params
)
{
let
id
=
params
.
id
;
let
scheme
;
if
(
id
)
{
scheme
=
await
this
.
dao
.
findById
(
id
);
}
else
{
scheme
=
{};
}
scheme
.
name
=
this
.
trim
(
params
.
name
);
if
(
params
.
common_tax_ladder
)
{
scheme
.
common_tax_ladder
=
JSON
.
stringify
(
params
.
common_tax_ladder
||
""
);
}
if
(
params
.
common_other_ladder
)
{
scheme
.
common_other_ladder
=
JSON
.
stringify
(
params
.
common_other_ladder
||
""
);
}
if
(
params
.
special_tax_ladder
)
{
scheme
.
special_tax_ladder
=
JSON
.
stringify
(
params
.
special_tax_ladder
||
""
);
}
if
(
params
.
special_other_ladder
)
{
scheme
.
special_other_ladder
=
JSON
.
stringify
(
params
.
special_other_ladder
||
""
);
}
scheme
.
cost_rate
=
system
.
y2f
(
params
.
cost_rate
||
0
);
scheme
.
tax_rate
=
system
.
y2f
(
params
.
tax_rate
||
0
);
scheme
.
add_value_up_type
=
this
.
trim
(
params
.
add_value_up_type
);
scheme
.
tax_up_type
=
this
.
trim
(
params
.
tax_up_type
);
if
(
scheme
.
id
)
{
scheme
=
await
scheme
.
save
();
}
else
{
scheme
.
deliver_id
=
this
.
trim
(
params
.
deliver_id
);
scheme
=
await
this
.
dao
.
create
(
scheme
);
}
return
system
.
getResultSuccess
(
scheme
);
}
async
info
(
params
)
{
let
item
=
await
this
.
dao
.
getById
(
params
.
id
);
this
.
handleDate
(
item
,
[
"created_at"
],
null
);
this
.
transField
([
item
]);
return
system
.
getResultSuccess
(
item
);
async
byCondition
(
params
)
{
let
rs
=
await
this
.
dao
.
byCondition
(
params
);
return
system
.
getResultSuccess
(
rs
);
}
async
pageByCondition
(
params
)
{
let
page
=
{
count
:
0
,
rows
:
[]
};
params
.
currentPage
=
Number
(
params
.
currentPage
||
1
);
params
.
pageSize
=
Number
(
params
.
pageSize
||
10
);
params
.
startRow
=
(
params
.
currentPage
-
1
)
*
params
.
pageSize
;
page
.
count
=
await
this
.
dao
.
countByCondition
(
params
);
if
(
page
.
count
==
0
)
{
return
system
.
getResultSuccess
(
page
);
}
page
.
rows
=
await
this
.
dao
.
listByCondition
(
params
);
if
(
page
.
rows
)
{
for
(
let
row
of
page
.
rows
)
{
this
.
handleDate
(
row
,
[
"created_at"
],
null
);
}
this
.
transField
(
page
.
rows
);
}
return
system
.
getResultSuccess
(
page
);
}
transField
(
rows
)
{
if
(
!
rows
||
rows
.
length
==
0
)
{
return
;
}
for
(
let
row
of
rows
)
{
if
(
!
row
)
{
continue
;
}
try
{
row
.
common_tax_ladder
=
JSON
.
parse
(
row
.
common_tax_ladder
?
row
.
common_tax_ladder
:
null
);
row
.
common_other_ladder
=
JSON
.
parse
(
row
.
common_other_ladder
?
row
.
common_other_ladder
:
null
);
row
.
special_tax_ladder
=
JSON
.
parse
(
row
.
special_tax_ladder
?
row
.
special_tax_ladder
:
null
);
row
.
special_other_ladder
=
JSON
.
parse
(
row
.
special_other_ladder
?
row
.
special_other_ladder
:
null
);
}
catch
(
e
)
{
console
.
log
(
e
);
}
row
.
cost_rate
=
system
.
f2y
(
row
.
cost_rate
);
row
.
tax_rate
=
system
.
f2y
(
row
.
tax_rate
);
async
bindChannel
(
pobj
)
{
let
deliver_id
=
this
.
trim
(
pobj
.
deliver_id
);
let
channel_id
=
this
.
trim
(
pobj
.
channel_id
);
if
(
!
deliver_id
||
!
channel_id
)
{
return
system
.
getResult
(
null
,
`参数错误deliver_id[
${
deliver_id
}
], channel_id
${
channel_id
}
`
);
}
let
dc
=
{
deliver_id
:
deliver_id
,
channel_id
:
channel_id
,
};
// 取消绑定
if
(
pobj
.
type
==
"unbind"
)
{
let
rs
=
await
this
.
dao
.
delByDC
(
dc
);
return
system
.
getResultSuccess
(
rs
);
}
// 绑定
let
exists
=
await
this
.
dao
.
findOne
(
dc
);
if
(
exists
)
{
return
system
.
getResultSuccess
(
exists
);
}
dc
.
autoIncrement
=
true
;
dc
=
await
this
.
dao
.
create
(
dc
);
return
system
.
getResultSuccess
(
dc
);
}
}
...
...
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