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
17f3776f
Commit
17f3776f
authored
Apr 08, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dd
parent
521c2ac1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
157 deletions
+88
-157
xggsve-merchant/app/base/api/impl/op/action.js
+0
-3
xggsve-merchant/app/base/db/impl/merchant/saasmerchantaddrDao.js
+1
-1
xggsve-merchant/app/base/db/impl/merchant/saasmerchanttitleDao.js
+1
-1
xggsve-merchant/app/base/service/impl/merchant/saasmerchantSve.js
+86
-152
No files found.
xggsve-merchant/app/base/api/impl/op/action.js
View file @
17f3776f
...
...
@@ -110,9 +110,6 @@ class ActionAPI extends APIBase {
case
"merchantTitleAddrPage"
:
//查询 title and addr list
opResult
=
await
this
.
saasmerchantSve
.
merchantTitleAddrPage
(
action_body
);
break
;
case
"updateMerchantTitleAndAddr"
:
opResult
=
await
this
.
saasmerchantSve
.
updateMerchantTitleAndAddr
(
action_body
);
break
;
case
"queryInvoiceTitleAndAddr"
:
//查询商户title&addr
opResult
=
await
this
.
saasmerchantSve
.
queryInvoiceTitleAndAddr
(
action_body
);
break
;
...
...
xggsve-merchant/app/base/db/impl/merchant/saasmerchantaddrDao.js
View file @
17f3776f
...
...
@@ -10,7 +10,7 @@ class SaasmerchantaddrDao extends Dao {
*/
async
getAllByMerchantId
(
id
){
let
sql
=
`select * from saas_merchant_addr where saas_merchant_id = :saas_merchant_id`
;
return
await
this
.
custom
Update
(
sql
.
join
(
" "
)
,
{
saas_merchant_id
:
id
});
return
await
this
.
custom
Query
(
sql
,
{
saas_merchant_id
:
id
});
}
...
...
xggsve-merchant/app/base/db/impl/merchant/saasmerchanttitleDao.js
View file @
17f3776f
...
...
@@ -7,7 +7,7 @@ class SaasmerchanttitleDao extends Dao {
async
getAllByMerchantId
(
id
){
let
sql
=
`select * from saas_merchant_title where saas_merchant_id = :saas_merchant_id`
;
return
await
this
.
custom
Update
(
sql
.
join
(
" "
)
,
{
saas_merchant_id
:
id
});
return
await
this
.
custom
Query
(
sql
,
{
saas_merchant_id
:
id
});
}
...
...
xggsve-merchant/app/base/service/impl/merchant/saasmerchantSve.js
View file @
17f3776f
...
...
@@ -179,17 +179,17 @@ class SaasMerchantService extends ServiceBase {
merchant
.
contact_addr
=
this
.
trim
(
params
.
contact_addr
);
merchant
.
term
=
term
;
if
(
term_end
)
{
if
(
term_end
)
{
merchant
.
term_end
=
term_end
;
}
if
(
term
==
1
)
{
if
(
term
==
1
)
{
merchant
.
term_end
=
null
;
}
merchant
.
validity
=
validity
;
if
(
validity_end
)
{
if
(
validity_end
)
{
merchant
.
validity_end
=
validity_end
;
}
if
(
validity
==
1
)
{
if
(
validity
==
1
)
{
merchant
.
validity_end
=
null
;
}
...
...
@@ -273,17 +273,17 @@ class SaasMerchantService extends ServiceBase {
/**
* 商户抬头列表
* 商户抬头
地址
列表
* @param {*} params
*/
async
merchantTitleAddrPage
(
params
){
async
merchantTitleAddrPage
(
params
)
{
try
{
var
currentPage
=
Number
(
params
.
currentPage
||
1
);
var
pageSize
=
Number
(
params
.
pageSize
||
10
);
let
where
=
{};
if
(
params
.
merchant_name
)
{
let
where
=
{};
if
(
params
.
merchant_name
)
{
where
=
{
merchant_name
:
this
.
trim
(
params
.
merchant_name
)
merchant_name
:
this
.
trim
(
params
.
merchant_name
)
};
}
var
orderby
=
[
...
...
@@ -298,167 +298,100 @@ class SaasMerchantService extends ServiceBase {
return
system
.
getResultSuccess
(
page
);
}
catch
(
error
)
{
console
.
log
(
error
);
return
system
.
getResult
(
null
,
`系统错误`
);
return
system
.
getResult
(
null
,
`系统错误`
);
}
}
/**
* 发票信息管理修改
* @param {*} params
*/
// async updateMerchantTitleAndAddr(params){
// if(!params.id){
// return system.getResult(null,`参数错误 ID不能为空`);
// }
// let _saasmerchant = await this.dao.getById(this.trim(params.id));
// if(!_saasmerchant){
// return system.getResult(null, `系统错误 商户不存在`);
// }
// let _saasmerchanttitleArray = this.saasmerchanttitleDao.getAllByMerchantId(this.trim(params.id));
// if(_saasmerchanttitleArray.length==0){
// return system.getResult(null, `信息不存在,请核对信息ID`);
// }
// let _saasmerchantaddrArray = this.saasmerchantaddrDao.getAllByMerchantId(this.trim(params.id));
// if(!_saasmerchantaddrArray.length==0){
// return system.getResult(null, `信息不存在,请核对信息ID`);
// }
// _saasmerchanttitlePorperty.id = _saasmerchanttitleArray[0].id;
// if(params.merchant_name){
// _saasmerchanttitlePorperty.merchant_name = this.trim(params.merchant_name);
// }
// if(params.merchant_credit_code){
// _saasmerchanttitlePorperty.merchant_credit_code = this.trim(params.merchant_credit_code);
// }
// if(params.merchant_tax_type){
// _saasmerchanttitlePorperty.merchant_tax_type = this.trim(params.merchant_tax_type);
// }
// if(params.merchant_addr){
// _saasmerchanttitlePorperty.merchant_addr = this.trim(params.merchant_addr);
// }
// if(params.merchant_mobile){
// _saasmerchanttitlePorperty.merchant_mobile = this.trim(params.merchant_mobile);
// }
// if(params.merchant_bank){
// _saasmerchanttitlePorperty.merchant_bank = this.trim(params.merchant_bank);
// }
// if(params.merchant_account){
// _saasmerchanttitlePorperty.merchant_account = this.trim(params.merchant_account);
// }
// _saasmerchantaddrPorperty.id = _saasmerchantaddrArray[0].id;
// if(params.mail_addr){
// _saasmerchantaddrPorperty.mail_addr = this.trim(params.mail_addr);
// }
// if(params.mail_mobile){
// _saasmerchantaddrPorperty.mail_mobile = this.trim(params.mail_mobile);
// }
// if(params.mail_to){
// _saasmerchantaddrPorperty.mail_to = this.trim(params.mail_to);
// }
// try {
// await this.db.transaction(async t => {
// await this.saasmerchanttitleDao.update(_saasmerchanttitlePorperty,t);
// await this.saasmerchantaddrDao.update(_saasmerchantaddrPorperty,t);
// });
// return system.getResultSuccess();
// } catch (error) {
// console.log(error);
// return system.getResult(null,`系统错误`);
// }
// }
/**
* 查询发票抬头和地址
* @param {*} params
*/
async
queryInvoiceTitleAndAddr
(
params
){
if
(
!
params
.
id
)
{
return
system
.
getResult
(
null
,
`参数错误 ID不能为空`
);
async
queryInvoiceTitleAndAddr
(
params
)
{
if
(
!
params
.
id
)
{
return
system
.
getResult
(
null
,
`参数错误 ID不能为空`
);
}
try
{
let
_saasmerchant
=
await
this
.
dao
.
getById
(
this
.
trim
(
params
.
id
));
if
(
!
_saasmerchant
)
{
if
(
!
_saasmerchant
)
{
return
system
.
getResult
(
null
,
`系统错误 商户不存在`
);
}
let
saas_merchant_title
=
await
this
.
saasmerchanttitleDao
.
getAllByMerchantId
(
_saasmerchant
.
id
);
let
saas_merchant_addr
=
await
this
.
saasmerchantaddrDao
.
getAllByMerchantId
(
_saasmerchant
.
id
);
let
res
=
{
saas_merchant_title
,
saas_merchant_addr
};
let
res
=
{
saas_merchant_title
,
saas_merchant_addr
};
return
system
.
getResult
(
res
);
}
catch
(
error
)
{
console
.
log
(
error
);
return
system
.
getResult
(
null
,
`系统错误`
);
return
system
.
getResult
(
null
,
`系统错误`
);
}
}
// async updateOrSaveTitleAndAddr(params)
{
// if(!params.id)
{
// return system.getResult(null,
`参数错误 ID不能为空`);
//
}
//
try {
//
let _saasmerchant = await this.dao.getById(this.trim(params.id));
// if(!_saasmerchant)
{
//
return system.getResult(null, `系统错误 商户不存在`);
//
}
//
let saas_merchant_title_res = await this.saasmerchanttitleDao.getAllByMerchantId(_saasmerchant.id);
//
let saas_merchant_addr_res = await this.saasmerchantaddrDao.getAllByMerchantId(_saasmerchant.id);
// if(params.merchant_name)
{
//
_saasmerchanttitlePorperty.merchant_name = this.trim(params.merchant_name);
//
}
// if(params.merchant_credit_code)
{
//
_saasmerchanttitlePorperty.merchant_credit_code = this.trim(params.merchant_credit_code);
//
}
// if(params.merchant_tax_type)
{
//
_saasmerchanttitlePorperty.merchant_tax_type = this.trim(params.merchant_tax_type);
//
}
// if(params.merchant_addr)
{
//
_saasmerchanttitlePorperty.merchant_addr = this.trim(params.merchant_addr);
//
}
// if(params.merchant_mobile)
{
//
_saasmerchanttitlePorperty.merchant_mobile = this.trim(params.merchant_mobile);
//
}
// if(params.merchant_bank)
{
//
_saasmerchanttitlePorperty.merchant_bank = this.trim(params.merchant_bank);
//
}
// if(params.merchant_account)
{
//
_saasmerchanttitlePorperty.merchant_account = this.trim(params.merchant_account);
//
}
// if(params.mail_addr)
{
//
_saasmerchantaddrPorperty.mail_addr = this.trim(params.mail_addr);
//
}
// if(params.mail_mobile)
{
//
_saasmerchantaddrPorperty.mail_mobile = this.trim(params.mail_mobile);
//
}
// if(params.mail_to)
{
//
_saasmerchantaddrPorperty.mail_to = this.trim(params.mail_to);
//
}
//
await this.db.transaction(async t => {
// if(saas_merchant_title_res.length==0)
{
// await this.saasmerchanttitleDao.create(_saasmerchanttitlePorperty,
t);
// }else
{
// _saasmerchanttitlePorperty.id = saas_merchant_addr
_res[0].id;
// await this.saasmerchanttitleDao.update(_saasmerchanttitlePorperty,
t);
//
}
// if(saas_merchant_addr_res.length==0)
{
// await this.saasmerchantaddrDao.create(_saasmerchanttitlePorperty,
t);
// }else
{
//
_saasmerchantaddrPorperty.id = saas_merchant_addr_res[0].id;
// await this.saasmerchantaddrDao.update(_saasmerchantaddrPorperty,
t);
//
}
// });
//
return system.getResult(res);
//
} catch (error) {
//
console.log(error);
// return system.getResult(null,
`系统错误`);
//
}
//
}
async
updateOrSaveTitleAndAddr
(
params
)
{
if
(
!
params
.
id
)
{
return
system
.
getResult
(
null
,
`参数错误 ID不能为空`
);
}
try
{
let
_saasmerchant
=
await
this
.
dao
.
getById
(
this
.
trim
(
params
.
id
));
if
(
!
_saasmerchant
)
{
return
system
.
getResult
(
null
,
`系统错误 商户不存在`
);
}
let
saas_merchant_title_res
=
await
this
.
saasmerchanttitleDao
.
getAllByMerchantId
(
_saasmerchant
.
id
);
let
saas_merchant_addr_res
=
await
this
.
saasmerchantaddrDao
.
getAllByMerchantId
(
_saasmerchant
.
id
);
let
_saasmerchanttitlePorperty
=
{
saas_merchant_id
:
_saasmerchant
.
id
};
if
(
params
.
merchant_name
)
{
_saasmerchanttitlePorperty
.
merchant_name
=
this
.
trim
(
params
.
merchant_name
);
}
if
(
params
.
merchant_credit_code
)
{
_saasmerchanttitlePorperty
.
merchant_credit_code
=
this
.
trim
(
params
.
merchant_credit_code
);
}
if
(
params
.
merchant_tax_type
)
{
_saasmerchanttitlePorperty
.
merchant_tax_type
=
this
.
trim
(
params
.
merchant_tax_type
);
}
if
(
params
.
merchant_addr
)
{
_saasmerchanttitlePorperty
.
merchant_addr
=
this
.
trim
(
params
.
merchant_addr
);
}
if
(
params
.
merchant_mobile
)
{
_saasmerchanttitlePorperty
.
merchant_mobile
=
this
.
trim
(
params
.
merchant_mobile
);
}
if
(
params
.
merchant_bank
)
{
_saasmerchanttitlePorperty
.
merchant_bank
=
this
.
trim
(
params
.
merchant_bank
);
}
if
(
params
.
merchant_account
)
{
_saasmerchanttitlePorperty
.
merchant_account
=
this
.
trim
(
params
.
merchant_account
);
}
let
_saasmerchantaddrPorperty
=
{
saas_merchant_id
:
_saasmerchant
.
id
};
if
(
params
.
mail_addr
)
{
_saasmerchantaddrPorperty
.
mail_addr
=
this
.
trim
(
params
.
mail_addr
);
}
if
(
params
.
mail_mobile
)
{
_saasmerchantaddrPorperty
.
mail_mobile
=
this
.
trim
(
params
.
mail_mobile
);
}
if
(
params
.
mail_to
)
{
_saasmerchantaddrPorperty
.
mail_to
=
this
.
trim
(
params
.
mail_to
);
}
let
res
=
await
this
.
db
.
transaction
(
async
t
=>
{
if
(
saas_merchant_title_res
.
length
==
0
)
{
await
this
.
saasmerchanttitleDao
.
create
(
_saasmerchanttitlePorperty
,
t
);
}
else
{
_saasmerchanttitlePorperty
.
id
=
saas_merchant_title
_res
[
0
].
id
;
await
this
.
saasmerchanttitleDao
.
update
(
_saasmerchanttitlePorperty
,
t
);
}
if
(
saas_merchant_addr_res
.
length
==
0
)
{
await
this
.
saasmerchantaddrDao
.
create
(
_saasmerchantaddrPorperty
,
t
);
}
else
{
_saasmerchantaddrPorperty
.
id
=
saas_merchant_addr_res
[
0
].
id
;
await
this
.
saasmerchantaddrDao
.
update
(
_saasmerchantaddrPorperty
,
t
);
}
});
return
system
.
getResult
(
res
);
}
catch
(
error
)
{
console
.
log
(
error
);
return
system
.
getResult
(
null
,
`系统错误`
);
}
}
}
module
.
exports
=
SaasMerchantService
;
module
.
exports
=
SaasMerchantService
;
\ No newline at end of file
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