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
183dec7c
Commit
183dec7c
authored
Mar 31, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
d04441e9
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
179 additions
and
142 deletions
+179
-142
xgg-saas-merchant/app/base/controller/impl/invoice/invoiceCtl.js
+0
-10
xgg-saas-merchant/app/base/controller/impl/trade/tradeCtl.js
+19
-0
xgg-saas-merchant/app/base/service/impl/business/businessmenSve.js
+8
-129
xgg-saas-merchant/app/base/service/impl/trade/tradeSve.js
+140
-0
xgg-saas-merchant/app/base/service/impl/uc/userSve.js
+0
-2
xgg-saas-merchant/app/config/settings.js
+11
-1
xgg-saas-merchant/package.json
+1
-0
No files found.
xgg-saas-merchant/app/base/controller/impl/invoice/invoiceCtl.js
deleted
100644 → 0
View file @
d04441e9
var
system
=
require
(
"../../../system"
)
const
CtlBase
=
require
(
"../../ctlms.base"
);
class
InvoiceCtl
extends
CtlBase
{
constructor
()
{
super
();
this
.
invoiceSve
=
system
.
getObject
(
"service.invoice.invoiceSve"
);
}
}
module
.
exports
=
InvoiceCtl
;
\ No newline at end of file
xgg-saas-merchant/app/base/controller/impl/trade/tradeCtl.js
0 → 100644
View file @
183dec7c
var
system
=
require
(
"../../../system"
)
const
CtlBase
=
require
(
"../../ctlms.base"
);
class
TradeCtl
extends
CtlBase
{
constructor
()
{
super
();
this
.
tradeSve
=
system
.
getObject
(
"service.trade.tradeSve"
);
}
async
parseItem
(
params
,
pobj2
,
req
)
{
try
{
return
await
this
.
tradeSve
.
parseItems
(
params
);
}
catch
(
error
)
{
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
}
}
}
module
.
exports
=
TradeCtl
;
\ No newline at end of file
xgg-saas-merchant/app/base/service/impl/business/businessmenSve.js
View file @
183dec7c
...
...
@@ -6,7 +6,6 @@ class BusinessmenService extends ServiceBase {
constructor
()
{
super
();
}
async
allPage
(
params
)
{
let
rs
=
await
this
.
callms
(
"order"
,
"businessmenPage"
,
params
);
if
(
rs
.
status
!=
0
||
!
rs
.
data
||
!
rs
.
data
.
rows
)
{
...
...
@@ -16,6 +15,14 @@ class BusinessmenService extends ServiceBase {
return
rs
;
}
async
mapByCreditCodes
(
params
)
{
let
rs
=
await
this
.
callms
(
"order"
,
"businessmenMapByCreditCodes"
,
params
);
if
(
!
rs
||
!
rs
.
data
)
{
return
{};
}
return
rs
.
data
;
}
transField
(
rows
)
{
if
(
!
rows
)
{
...
...
@@ -52,134 +59,6 @@ class BusinessmenService extends ServiceBase {
}
}
}
//
// async signPage(params) {
// var rs = await this.callms("order", "businessmenSignPage", params);
// if (rs.status != 0 || !rs.data || !rs.data.rows) {
// return rs;
// }
// this.transField(rs.data.rows);
// return rs;
// }
//
// async deliverPage(params) {
// var rs = await this.callms("order", "businessmenDeliverPage", params);
// if (rs.status != 0 || !rs.data || !rs.data.rows) {
// return rs;
// }
// this.transField(rs.data.rows);
// return rs;
// }
//
// async info(params) {
// var rs = await this.callms("order", "businessmenInfo", params);
// await this.setMerchant([rs.data]);
// this.transField([rs.data]);
// return rs;
// }
//
// async sign(params) {
// return await this.callms("order", "businessmenSign", params);
// }
//
// async nameList(params) {
// return await this.callms("order", "businessmenNameList", params);
// }
//
// async queryBusinessmen(params) {
// var condition = {
// merchantId: this.trim(params.merchant_id || params.merchantId),
// channelOrderNo: this.trim(params.channelOrderNo),
// }
// var rs = await this.callms("order", "businessmenByChannelOrderNo", condition);
// if (rs.status != 0 && !rs.data) {
// return rs;
// }
// var businessmen = rs.data;
// if(!businessmen) {
// return system.getResult(null, "个体户不存在");
// }
// var dto = {};
//
// dto.orderNo = this.trim(businessmen.orderNo);
// dto.channelOrderNo = this.trim(businessmen.channelOrderNo);
// dto.status = this.trim(businessmen.gstatus);
// dto.legalName = this.trim(businessmen.legalName);
// dto.legalMobile = this.trim(businessmen.legalMobile);
// dto.legalIdCard = this.trim(businessmen.legalIdCard);
// dto.name = this.trim(businessmen.name);
// dto.creditCode = this.trim(businessmen.creditCode);
// dto.businessPlace = this.trim(businessmen.businessPlace);
// dto.businessScope = this.trim(businessmen.businessScope);
// dto.regDate = this.trim(businessmen.regDate);
// dto.businessImg = this.trim(businessmen.businessImg);
// dto.gongzhang = this.trim(businessmen.gongzhang);
// dto.caiwuzhang = this.trim(businessmen.caiwuzhang);
// dto.fapiaozhang = this.trim(businessmen.fapiaozhang);
// dto.hetongzhang = this.trim(businessmen.hetongzhang);
// dto.farenzhang = this.trim(businessmen.farenzhang);
// dto.isBank = businessmen.isBank ? 1 : 0;
// dto.bankName = this.trim(businessmen.bankName);
// dto.bankNo = this.trim(businessmen.bankNo);
// dto.bank = this.trim(businessmen.bank);
// dto.bankImg = this.trim(businessmen.bankImg);
// dto.caImg = this.trim(businessmen.caImg);
// dto.taxRegDay = this.trim(businessmen.taxRegDay);
// dto.taxOrg = this.trim(businessmen.taxOrg);
// dto.courierNo = this.trim(businessmen.courierNo);
// dto.courierImg = this.trim(businessmen.courierImg);
// dto.addedValueRate = this.trim(businessmen.addedValueRate);
// dto.supertaxRate = this.trim(businessmen.supertaxRate);
// dto.commonTaxLadder = this.trim(businessmen.commonTaxLadder);
// dto.commonOtherLadder = this.trim(businessmen.commonOtherLadder);
// dto.specialTaxLadder = this.trim(businessmen.specialTaxLadder);
// dto.specialOtherLadder = this.trim(businessmen.specialOtherLadder);
// dto.contractStartData = this.trim(businessmen.contractStartData);
// dto.contractEndData = this.trim(businessmen.contractEndData);
// dto.contract = this.trim(businessmen.contract);
// dto.opNotes = this.trim(businessmen.opNotes);
// dto.taxUpType = this.trim(businessmen.taxUpType);
// dto.costRate = this.trim(businessmen.costRate);
// dto.signNotes = this.trim(businessmen.signNotes);
// dto.invoiceContents = this.trim(businessmen.invoiceContents);
// return system.getResultSuccess(dto);
// }
//
// async putContract(params) {
// var merchantId = params.merchant_id || params.merchantId;
//
// var condition = {
// merchantId: merchantId,
// channelOrderNo: params.channelOrderNo,
// contractStartData: params.contractStartData,
// contractEndData: params.contractEndData,
// contract: params.contract,
// };
// var rs = await this.callms("order", "addBusinessmenContract", condition);
// return rs;
// }
//
// async setMerchant(rows) {
// if (!rows || rows.length == 0) {
// return;
// }
//
// var merchantIds = [];
// for (var row of rows) {
// merchantIds.push(row.merchant_id);
// }
//
// var mmap = await this.callms("merchant", "getMapByIds", {
// ids: merchantIds,
// attrs: "id, name"
// });
// mmap = mmap.data || {};
// for (var row of rows) {
// row.merchant = mmap[row.merchant_id] || {};
// }
// }
}
module
.
exports
=
BusinessmenService
;
...
...
xgg-saas-merchant/app/base/service/impl/trade/tradeSve.js
0 → 100644
View file @
183dec7c
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../svems.base"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
fs
=
require
(
"fs"
);
const
xlsx
=
require
(
'node-xlsx'
);
const
axios
=
require
(
"axios"
);
const
path
=
require
(
"path"
);
class
TradeService
extends
ServiceBase
{
constructor
()
{
super
();
this
.
businessmenSve
=
system
.
getObject
(
"service.business.businessmenSve"
);
}
async
downloadFile
(
url
,
filePath
)
{
let
writer
=
fs
.
createWriteStream
(
filePath
);
let
response
=
await
axios
({
url
,
method
:
"GET"
,
responseType
:
"stream"
,
});
response
.
data
.
pipe
(
writer
);
return
new
Promise
((
resolve
,
reject
)
=>
{
writer
.
on
(
"finish"
,
resolve
);
writer
.
on
(
"error"
,
reject
);
});
}
async
parseItems
(
params
)
{
let
dataList
=
[];
let
filePath
=
settings
.
localpath
()
+
"saas_xgg_trade_order_"
+
this
.
trim
(
params
.
fileName
)
+
".xlsx"
;
try
{
await
this
.
downloadFile
(
params
.
url
,
filePath
);
// await this.restClient.execDownload("'" + ossurl + "'", filePath);
let
sheets
=
xlsx
.
parse
(
filePath
);
fs
.
unlinkSync
(
filePath
);
if
(
!
sheets
||
sheets
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"打款文件无数据"
)
}
let
sheet
=
sheets
[
0
];
if
(
!
sheet
||
!
sheet
.
data
||
sheet
.
data
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"打款文件无数据"
)
}
let
rows
=
sheet
.
data
;
let
dataList
=
[];
for
(
let
idx
=
6
;
idx
<
rows
.
length
;
idx
++
)
{
var
data
=
{
errors
:
[]
};
let
cells
=
rows
[
idx
];
let
cellLength
=
cells
.
length
;
if
(
cellLength
==
0
)
{
continue
;
}
if
(
cellLength
<
7
)
{
data
.
errors
.
push
(
"缺少数据, 列数不全"
);
continue
;
}
data
.
acc_name
=
this
.
trim
(
cells
[
1
]);
data
.
credit_code
=
this
.
trim
(
cells
[
2
]).
toUpperCase
();
data
.
acc_no
=
this
.
trim
(
cells
[
3
]);
data
.
open_bank
=
this
.
trim
(
cells
[
4
]);
data
.
amt
=
this
.
trim
(
cells
[
5
]);
data
.
remark
=
this
.
trim
(
cells
[
6
]);
dataList
.
push
(
data
);
}
return
await
this
.
checkDataList
(
dataList
);
}
catch
(
error
)
{
console
.
log
(
error
);
return
system
.
getResult
(
null
,
"excel解析出错"
)
}
}
async
checkDataList
(
dataList
)
{
let
result
=
{
hasError
:
false
,
};
if
(
!
dataList
||
dataList
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"打款文件无数据"
)
}
// 统一社会信用代码获取
let
creditCodes
=
[];
for
(
let
data
of
dataList
)
{
creditCodes
.
push
(
data
.
credit_code
);
}
let
creditCodeMap
=
await
this
.
businessmenSve
.
mapByCreditCodes
({
creditCodes
:
creditCodes
,
attrs
:
"credit_code"
});
for
(
let
data
of
dataList
)
{
this
.
checkField
(
data
,
"acc_name"
,
{
is_require
:
true
,
maxLen
:
64
});
let
bm
=
creditCodeMap
[
data
.
credit_code
];
if
(
!
bm
)
{
data
.
errors
.
push
(
`统一社会信用代码[
${
data
.
credit_code
}
]不存在`
);
}
this
.
checkField
(
data
,
"credit_code"
,
{
is_require
:
true
,
eqLen
:
18
});
this
.
checkField
(
data
,
"acc_no"
,
{
is_require
:
true
,
maxLen
:
30
,
is_number
:
true
});
this
.
checkField
(
data
,
"open_bank"
,
{
maxLen
:
100
});
this
.
checkField
(
data
,
"amt"
,
{
is_require
:
true
,
maxLen
:
100
,
is_number
:
true
});
this
.
checkField
(
data
,
"remark"
,
{
maxLen
:
100
});
if
(
!
result
.
hasError
&&
data
.
errors
.
length
>
0
)
{
result
.
hasError
=
true
;
}
}
result
.
dataList
=
dataList
;
return
result
;
}
checkField
(
data
,
field
,
rule
)
{
if
(
!
data
||
!
field
)
{
return
;
}
let
v
=
data
[
field
];
if
(
rule
.
is_require
&&
!
v
)
{
data
.
errors
.
push
(
`
${
rule
.
name
}
未填写`
);
}
if
(
rule
.
maxLen
&&
v
.
length
>
rule
.
maxLen
)
{
data
.
errors
.
push
(
`
${
rule
.
name
}
长度不允许超过
${
rule
.
maxLen
}
`
);
}
if
(
rule
.
minLen
&&
v
.
length
<
rule
.
minLen
)
{
data
.
errors
.
push
(
`
${
rule
.
name
}
长度不允许少于
${
rule
.
minLen
}
`
);
}
if
(
rule
.
eqLen
&&
v
.
length
!=
rule
.
eqLen
)
{
data
.
errors
.
push
(
`
${
rule
.
name
}
长度为
${
rule
.
eqLen
}
`
);
}
if
(
rule
.
is_number
&&
isNaN
(
v
))
{
data
.
errors
.
push
(
`
${
rule
.
name
}
需要填写数字类型`
);
}
if
(
rule
.
is_number
&&
isNaN
(
v
))
{
data
.
errors
.
push
(
`
${
rule
.
name
}
需要填写数字类型`
);
}
}
}
module
.
exports
=
TradeService
;
\ No newline at end of file
xgg-saas-merchant/app/base/service/impl/uc/userSve.js
View file @
183dec7c
...
...
@@ -4,8 +4,6 @@ const ServiceBase = require("../../svems.base")
class
UserService
extends
ServiceBase
{
constructor
()
{
super
();
this
.
platformUtils
=
system
.
getObject
(
"util.businessManager.opPlatformUtils"
);
this
.
opuserrelationDao
=
system
.
getObject
(
"db.common.opuserrelationDao"
);
}
async
login
(
params
)
{
...
...
xgg-saas-merchant/app/config/settings.js
View file @
183dec7c
var
path
=
require
(
'path'
);
const
path
=
require
(
'path'
);
const
os
=
require
(
'os'
);
var
ENVINPUT
=
{
DB_HOST
:
process
.
env
.
DB_HOST
,
DB_PORT
:
process
.
env
.
DB_PORT
,
...
...
@@ -27,6 +28,15 @@ var settings = {
defaultpwd
:
"987456"
,
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
port
:
process
.
env
.
NODE_PORT
||
3702
,
localpath
:
function
()
{
let
platform
=
os
.
platform
()
||
""
;
// windows
if
(
platform
.
toLocaleLowerCase
().
startsWith
(
'win'
))
{
return
"d:/tmp/"
}
else
{
return
"/tmp/"
}
},
reqEsAddr
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
var
localsettings
=
require
(
"./localsettings"
);
...
...
xgg-saas-merchant/package.json
View file @
183dec7c
...
...
@@ -38,6 +38,7 @@
"
mysql2
"
:
"^1.5.3"
,
"
node-cron
"
:
"^2.0.1"
,
"
node-uuid
"
:
"^1.4.8"
,
"
node-xlsx
"
:
"^0.15.0"
,
"
qr-image
"
:
"^3.2.0"
,
"
sequelize
"
:
"^4.37.8"
,
"
sequelize-cli
"
:
"^4.1.1"
,
...
...
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