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
521c2ac1
Commit
521c2ac1
authored
Apr 07, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dd
parent
d8e14779
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
404 additions
and
9 deletions
+404
-9
xggsve-merchant/app/base/api/impl/op/action.js
+19
-2
xggsve-merchant/app/base/db/impl/merchant/saasmerchantaddrDao.js
+18
-0
xggsve-merchant/app/base/db/impl/merchant/saasmerchanttitleDao.js
+17
-0
xggsve-merchant/app/base/db/models/merchant/saasmerchantaddr.js
+20
-0
xggsve-merchant/app/base/db/models/merchant/saasmerchanttitle.js
+24
-0
xggsve-merchant/app/base/service/impl/merchant/saasmerchantSve.js
+192
-7
xggsve-merchant/app/base/service/impl/merchant/saasmerchantaddrSve.js
+97
-0
xggsve-merchant/app/base/service/impl/merchant/saasmerchanttitleSve.js
+17
-0
No files found.
xggsve-merchant/app/base/api/impl/op/action.js
View file @
521c2ac1
...
...
@@ -9,8 +9,8 @@ class ActionAPI extends APIBase {
this
.
saasmainSve
=
system
.
getObject
(
"service.main.saasmainSve"
);
this
.
saaschannelSve
=
system
.
getObject
(
"service.channel.saaschannelSve"
);
this
.
saasmerchantSve
=
system
.
getObject
(
"service.merchant.saasmerchantSve"
);
this
.
saasmerchanttitleSve
=
system
.
getObject
(
"service.merchant.saasmerchanttitleSve"
);
this
.
saasmerchantaddrSve
=
system
.
getObject
(
"service.merchant.saasmerchantaddrSve"
);
// -------------------------------将要弃用------------------------------------------
this
.
merchantSve
=
system
.
getObject
(
"service.merchant.merchantSve"
);
this
.
merchantsignedSve
=
system
.
getObject
(
"service.merchant.merchantsignedSve"
);
...
...
@@ -107,7 +107,24 @@ class ActionAPI extends APIBase {
case
"mchtSettings"
:
opResult
=
await
this
.
saasmerchantSve
.
getSettings
(
action_body
);
break
;
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
;
case
"updateOrSaveTitleAndAddr"
:
//update or save title and addr
opResult
=
await
this
.
saasmerchantSve
.
updateOrSaveTitleAndAddr
(
action_body
);
break
;
// 签约主体
case
"invoiceInfoPage"
:
opResult
=
await
this
.
saasmerchanttitleSve
.
invoiceInfoPage
(
action_body
);
break
;
// ------------------------------以下api为历史将要弃用的---------------------------------------
// 商户api
// case "infoList":
...
...
xggsve-merchant/app/base/db/impl/merchant/saasmerchantaddrDao.js
0 → 100644
View file @
521c2ac1
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
SaasmerchantaddrDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
SaasmerchantaddrDao
));
}
/**
* 根据 saas_merchant_id 查询地址
* @param {*} id
*/
async
getAllByMerchantId
(
id
){
let
sql
=
`select * from saas_merchant_addr where saas_merchant_id = :saas_merchant_id`
;
return
await
this
.
customUpdate
(
sql
.
join
(
" "
),
{
saas_merchant_id
:
id
});
}
}
module
.
exports
=
SaasmerchantaddrDao
;
xggsve-merchant/app/base/db/impl/merchant/saasmerchanttitleDao.js
0 → 100644
View file @
521c2ac1
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
SaasmerchanttitleDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
SaasmerchanttitleDao
));
}
async
getAllByMerchantId
(
id
){
let
sql
=
`select * from saas_merchant_title where saas_merchant_id = :saas_merchant_id`
;
return
await
this
.
customUpdate
(
sql
.
join
(
" "
),
{
saas_merchant_id
:
id
});
}
}
module
.
exports
=
SaasmerchanttitleDao
;
xggsve-merchant/app/base/db/models/merchant/saasmerchantaddr.js
0 → 100644
View file @
521c2ac1
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"saasmerchantaddr"
,
{
saas_merchant_id
:
{
type
:
DataTypes
.
STRING
(
32
),
allowNull
:
false
,
COMMENT
:
'商户id'
},
mail_addr
:
{
type
:
DataTypes
.
STRING
(
200
),
allowNull
:
false
,
COMMENT
:
'邮寄地址'
},
mail_mobile
:
{
type
:
DataTypes
.
STRING
(
45
),
allowNull
:
false
,
COMMENT
:
'邮寄电话'
},
mail_to
:
{
type
:
DataTypes
.
STRING
(
4
),
allowNull
:
false
,
COMMENT
:
'邮寄人'
},
created_at
:
{
type
:
DataTypes
.
DATE
,
field
:
'created_at'
,
allowNull
:
false
},
updated_at
:
{
type
:
DataTypes
.
DATE
,
field
:
'updated_at'
,
allowNull
:
false
},
deleted_at
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
true
},
},{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
tableName
:
'saas_merchant_addr'
});
}
xggsve-merchant/app/base/db/models/merchant/saasmerchanttitle.js
0 → 100644
View file @
521c2ac1
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"saasmerchanttitle"
,
{
saas_merchant_id
:
{
type
:
DataTypes
.
STRING
(
32
),
allowNull
:
false
,
COMMENT
:
'商户id'
},
merchant_name
:
{
type
:
DataTypes
.
STRING
(
45
),
allowNull
:
false
,
COMMENT
:
'商户名称'
},
merchant_credit_code
:
{
type
:
DataTypes
.
STRING
(
45
),
allowNull
:
false
,
COMMENT
:
'商户纳税人识别号'
},
merchant_tax_type
:
{
type
:
DataTypes
.
STRING
(
4
),
allowNull
:
false
,
COMMENT
:
'纳税人类型 00一般纳税人 10小规模纳税人'
},
merchant_addr
:
{
type
:
DataTypes
.
STRING
(
45
),
allowNull
:
false
,
COMMENT
:
'商户地址'
},
merchant_mobile
:
{
type
:
DataTypes
.
STRING
(
45
),
allowNull
:
false
,
COMMENT
:
'商户电话'
},
merchant_bank
:
{
type
:
DataTypes
.
STRING
(
4
),
allowNull
:
true
,
defaultValue
:
""
,
COMMENT
:
'商户开户行'
},
merchant_account
:
{
type
:
DataTypes
.
STRING
(
32
),
allowNull
:
false
,
COMMENT
:
'商户银行账号'
},
created_at
:
{
type
:
DataTypes
.
DATE
,
field
:
'created_at'
,
allowNull
:
false
},
updated_at
:
{
type
:
DataTypes
.
DATE
,
field
:
'updated_at'
,
allowNull
:
false
},
deleted_at
:
{
type
:
DataTypes
.
DATE
,
allowNull
:
true
},
},{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
tableName
:
'saas_merchant_title'
});
}
xggsve-merchant/app/base/service/impl/merchant/saasmerchantSve.js
View file @
521c2ac1
...
...
@@ -7,6 +7,8 @@ class SaasMerchantService extends ServiceBase {
this
.
saasmerchantsignDao
=
system
.
getObject
(
"db.merchant.saasmerchantsignDao"
);
this
.
saasmerchantsettingsDao
=
system
.
getObject
(
"db.merchant.saasmerchantsettingsDao"
);
this
.
saasmerchanttitleDao
=
system
.
getObject
(
"db.merchant.saasmerchanttitleDao"
);
this
.
saasmerchantaddrDao
=
system
.
getObject
(
"db.merchant.saasmerchantaddrDao"
);
}
// -----------------------以此间隔,上面为API,下面为service---------------------------------
...
...
@@ -268,11 +270,195 @@ class SaasMerchantService extends ServiceBase {
secret
:
rs
.
secret
,
});
}
/**
* 商户抬头列表
* @param {*} params
*/
async
merchantTitleAddrPage
(
params
){
try
{
var
currentPage
=
Number
(
params
.
currentPage
||
1
);
var
pageSize
=
Number
(
params
.
pageSize
||
10
);
let
where
=
{};
if
(
params
.
merchant_name
){
where
=
{
merchant_name
:
this
.
trim
(
params
.
merchant_name
)
};
}
var
orderby
=
[
[
"id"
,
'desc'
]
];
var
page
=
await
this
.
saasmerchanttitleDao
.
getPageList
(
currentPage
,
pageSize
,
where
,
orderby
);
if
(
page
&&
page
.
rows
)
{
for
(
var
row
of
page
.
rows
)
{
this
.
handleDate
(
row
,
[
"created_at"
],
null
,
-
8
);
}
}
return
system
.
getResultSuccess
(
page
);
}
catch
(
error
)
{
console
.
log
(
error
);
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不能为空`
);
}
try
{
let
_saasmerchant
=
await
this
.
dao
.
getById
(
this
.
trim
(
params
.
id
));
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
};
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);
// 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,`系统错误`);
// }
// }
}
module
.
exports
=
SaasMerchantService
;
// var task=new UserService();
// task.getUserStatisticGroupByApp().then(function(result){
// console.log((result));
// }).catch(function(e){
// console.log(e);
// });
\ No newline at end of file
xggsve-merchant/app/base/service/impl/merchant/saasmerchantaddrSve.js
0 → 100644
View file @
521c2ac1
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
)
const
settings
=
require
(
"../../../../config/settings"
)
class
SaasmerchanttitleService
extends
ServiceBase
{
constructor
()
{
super
(
"merchant"
,
ServiceBase
.
getDaoName
(
SaasmerchanttitleService
));
this
.
saasMerchantAddrDao
=
system
.
getObject
(
"db.merchant.saasmerchantaddrDao"
);
}
/**
* 发票信息管理列表
* @param {*} params
*/
async
invoiceInfoPage
(
params
){
try
{
var
currentPage
=
Number
(
params
.
currentPage
||
1
);
var
pageSize
=
Number
(
params
.
pageSize
||
10
);
let
where
=
{};
if
(
params
.
merchant_name
){
where
=
{
merchant_name
:
this
.
trim
(
params
.
merchant_name
)
};
}
var
orderby
=
[
[
"id"
,
'desc'
]
];
var
page
=
await
this
.
getPageList
(
currentPage
,
pageSize
,
where
,
orderby
);
if
(
page
&&
page
.
rows
)
{
for
(
var
row
of
page
.
rows
)
{
this
.
handleDate
(
row
,
[
"created_at"
],
null
,
-
8
);
}
}
return
system
.
getResultSuccess
(
page
);
}
catch
(
error
)
{
console
.
log
(
error
);
return
system
.
getResult
(
null
,
`系统错误`
);
}
}
/**
* 发票信息管理修改
* @param {*} params
*/
async
updateinvoiceInfo
(
params
){
if
(
!
params
.
id
){
return
system
.
getResult
(
null
,
`参数错误 ID不能为空`
);
}
let
_saasInvoice
=
this
.
dao
.
getById
(
this
.
trim
(
params
.
id
));
if
(
!
_saasInvoice
){
return
system
.
getResult
(
null
,
`信息不存在,请核对信息ID`
);
}
// merchant_name: { type: DataTypes.STRING(45), allowNull: false, COMMENT: '商户名称' },
// merchant_credit_code: { type: DataTypes.STRING(45), allowNull: false, COMMENT: '商户纳税人识别号' },
// merchant_tax_type: { type: DataTypes.STRING(4), allowNull: false, COMMENT: '纳税人类型 00一般纳税人 10小规模纳税人' },
// merchant_addr: { type: DataTypes.STRING(45), allowNull: false, COMMENT: '商户地址' },
// merchant_mobile: { type: DataTypes.STRING(45), allowNull: false, COMMENT: '商户电话' },
// merchant_bank: { type: DataTypes.STRING(4), allowNull: true, defaultValue: "", COMMENT: '商户开户行' },
// merchant_account: { type: DataTypes.STRING(32), allowNull: false, COMMENT: '商户银行账号' },
let
_invoiceInfoPorperty
=
{};
if
(
params
.
merchant_name
){
_invoiceInfoPorperty
.
merchant_name
=
this
.
trim
(
params
.
_invoiceInfoPorperty
);
}
if
(
params
.
merchant_credit_code
){
_invoiceInfoPorperty
.
merchant_credit_code
=
this
.
trim
(
params
.
merchant_credit_code
);
}
if
(
params
.
merchant_tax_type
){
_invoiceInfoPorperty
.
merchant_tax_type
=
this
.
trim
(
params
.
merchant_tax_type
);
}
if
(
params
.
merchant_addr
){
_invoiceInfoPorperty
.
merchant_addr
=
this
.
trim
(
params
.
merchant_addr
);
}
if
(
params
.
merchant_mobile
){
_invoiceInfoPorperty
.
merchant_mobile
=
this
.
trim
(
params
.
merchant_mobile
);
}
if
(
params
.
merchant_bank
){
_invoiceInfoPorperty
.
merchant_bank
=
this
.
trim
(
params
.
merchant_bank
);
}
if
(
params
.
merchant_account
){
_invoiceInfoPorperty
.
merchant_account
=
this
.
trim
(
params
.
merchant_account
);
}
}
}
module
.
exports
=
SaasmerchanttitleService
;
\ No newline at end of file
xggsve-merchant/app/base/service/impl/merchant/saasmerchanttitleSve.js
0 → 100644
View file @
521c2ac1
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
)
const
settings
=
require
(
"../../../../config/settings"
)
class
SaasmerchanttitleService
extends
ServiceBase
{
constructor
()
{
super
(
"merchant"
,
ServiceBase
.
getDaoName
(
SaasmerchanttitleService
));
this
.
saasmerchantaddrDao
=
system
.
getObject
(
"db.merchant.saasmerchantaddrDao"
);
}
}
module
.
exports
=
SaasmerchanttitleService
;
\ 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