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
0934675b
Commit
0934675b
authored
Aug 14, 2020
by
v_vjyjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
1245482f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
31 deletions
+63
-31
ic-deliver/app/base/controller/impl/bizchance/initcost.js
+6
-0
ic-deliver/app/base/service/impl/bizchance/deliverybillSve.js
+28
-12
ic-deliver/app/base/system.js
+29
-19
No files found.
ic-deliver/app/base/controller/impl/bizchance/initcost.js
0 → 100644
View file @
0934675b
var
system
=
require
(
"../../../system"
);
let
dS
=
system
.
getObject
(
"service.bizchance.deliverybillSve"
);
dS
.
updateCostBySkuCode
().
then
(
r
=>
{
console
.
log
(
r
)
})
\ No newline at end of file
ic-deliver/app/base/service/impl/bizchance/deliverybillSve.js
View file @
0934675b
...
...
@@ -10,7 +10,23 @@ class DeliverybillService extends ServiceBase {
this
.
cacheDao
=
system
.
getObject
(
"db.bizchance.cacheinfoDao"
);
}
async
statBizDeliverySettleAmountBySp
(
settleStatus
)
{
async
updateCostBySkuCode
()
{
let
bills
=
await
this
.
dao
.
model
.
findAll
()
bills
.
forEach
(
async
b
=>
{
//远程调用去查询成本按照skucode
let
costqueryobj
=
await
system
.
postJsonTypeReq
(
"http://paas-service/api/common/product/findCostBySkuCode"
,
{
"skucode"
:
b
.
sku_code
},
"POST"
,
{
xappkey
:
"647a68c9- da01 - 40d3-9763 - 1ffa0f64cf3f"
})
let
rtn
=
costqueryobj
.
data
let
cn
=
rtn
.
data
.
cost
console
.
log
(
cn
,
"...................................................................."
,
b
.
sku_code
)
b
.
cost_price
=
cn
await
b
.
save
()
})
return
"ok"
}
async
statBizDeliverySettleAmountBySp
(
settleStatus
)
{
let
params
=
{}
let
where
=
settleStatus
!=
""
?
`where settle_status='
${
settleStatus
}
'`
:
''
...
...
@@ -26,7 +42,7 @@ class DeliverybillService extends ServiceBase {
let
s
=
await
this
.
dao
.
statGroupBy
(
params
,
null
)
return
s
}
async
statBizDeliveryCountBySp
(
deliverStatus
,
betweenTime
)
{
async
statBizDeliveryCountBySp
(
deliverStatus
,
betweenTime
)
{
let
params
=
{}
let
where
=
deliverStatus
!=
""
?
`where delivery_status='
${
deliverStatus
}
'`
:
''
if
(
deliverStatus
==
"handling"
)
{
...
...
@@ -47,7 +63,7 @@ class DeliverybillService extends ServiceBase {
let
s
=
await
this
.
dao
.
statGroupBy
(
params
,
null
)
return
s
}
async
statBizDelivery
(
companyId
,
opath
,
username
,
userid
,
betweenTime
)
{
async
statBizDelivery
(
companyId
,
opath
,
username
,
userid
,
betweenTime
)
{
// 时间 筛选
let
andWhere
=
[];
if
(
betweenTime
.
length
>
0
)
{
...
...
@@ -125,7 +141,7 @@ class DeliverybillService extends ServiceBase {
}
//为租户自己给交付打标记,表示中台已经给予结算,自己记账用
//租户自己临时记录结算情况
async
settleApplyForTacent
(
ids
,
uid
,
uname
,
spname
,
spid
)
{
async
settleApplyForTacent
(
ids
,
uid
,
uname
,
spname
,
spid
)
{
var
self
=
this
return
this
.
db
.
transaction
(
async
function
(
t
)
{
//先按照ids查询出交付单的合计服务成本
...
...
@@ -161,7 +177,7 @@ class DeliverybillService extends ServiceBase {
});
}
async
settleApply
(
ids
,
uid
,
uname
,
spname
,
spid
)
{
async
settleApply
(
ids
,
uid
,
uname
,
spname
,
spid
)
{
var
self
=
this
return
this
.
db
.
transaction
(
async
function
(
t
)
{
//先按照ids查询出交付单的合计服务成本
...
...
@@ -190,30 +206,30 @@ class DeliverybillService extends ServiceBase {
return
newentity
});
}
async
findAndCountAll
(
obj
)
{
async
findAndCountAll
(
obj
)
{
var
self
=
this
;
const
apps
=
await
self
.
dao
.
findAndCountAll
(
obj
);
return
apps
;
}
async
findInfoByDeliverCode
(
qobj
)
{
//*根据交付单编号获取交付单详情*/
async
findInfoByDeliverCode
(
qobj
)
{
//*根据交付单编号获取交付单详情*/
return
await
this
.
dao
.
findInfoByDeliverCode
(
qobj
);
}
async
updateStatusByDeliverCode
(
qobj
)
{
//* 根据交付单编号更新交付单状态 */
async
updateStatusByDeliverCode
(
qobj
)
{
//* 根据交付单编号更新交付单状态 */
var
self
=
this
;
return
self
.
db
.
transaction
(
async
function
(
t
)
{
return
await
self
.
dao
.
updateStatusByDeliverCode
(
qobj
,
t
);
});
}
/*更新业务员/交付员信息*/
async
updateSalesmanInfoByDeliverCode
(
qobj
)
{
async
updateSalesmanInfoByDeliverCode
(
qobj
)
{
var
self
=
this
;
return
self
.
db
.
transaction
(
async
function
(
t
)
{
return
await
self
.
dao
.
updateSalesmanInfoByDeliverCode
(
qobj
,
t
);
});
}
async
updateInfoByDeliverCode
(
qobj
)
{
//*更新交付单信息 */
async
updateInfoByDeliverCode
(
qobj
)
{
//*更新交付单信息 */
console
.
log
(
"--------------------------------------------------------------------------------------------------------------------------------------"
);
var
self
=
this
;
return
self
.
db
.
transaction
(
async
function
(
t
)
{
...
...
@@ -221,14 +237,14 @@ class DeliverybillService extends ServiceBase {
});
}
async
insertInfo
(
qobj
)
{
//*插入交付单信息*/从队列取数据的时候用
async
insertInfo
(
qobj
)
{
//*插入交付单信息*/从队列取数据的时候用
var
self
=
this
;
return
self
.
db
.
transaction
(
async
function
(
t
)
{
return
await
self
.
dao
.
insertInfo
(
qobj
,
t
);
});
}
async
insertInfoall
(
pobj
)
{
//*插入交付单信息,大事务*/从队列取数据的时候用
async
insertInfoall
(
pobj
)
{
//*插入交付单信息,大事务*/从队列取数据的时候用
var
self
=
this
;
return
await
self
.
db
.
transaction
(
async
function
(
t
)
{
var
res
=
await
self
.
dao
.
insertInfo
(
pobj
);
//插入交付单列表
...
...
ic-deliver/app/base/system.js
View file @
0934675b
...
...
@@ -5,7 +5,7 @@ const request = require('request');
const
cryptoJS
=
require
(
'crypto-js'
);
class
System
{
static
declare
(
ns
)
{
static
declare
(
ns
)
{
var
ar
=
ns
.
split
(
'.'
);
var
root
=
System
;
for
(
var
i
=
0
,
len
=
ar
.
length
;
i
<
len
;
++
i
)
{
...
...
@@ -18,7 +18,7 @@ class System {
}
}
}
static
async
delReq
(
url
,
qdata
)
{
static
async
delReq
(
url
,
qdata
)
{
let
rtn
=
{}
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
request
.
del
({
...
...
@@ -41,7 +41,7 @@ class System {
})
return
promise
;
}
static
async
getReq
(
url
,
qdata
)
{
static
async
getReq
(
url
,
qdata
)
{
let
rtn
=
{}
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
request
.
get
({
...
...
@@ -64,7 +64,7 @@ class System {
})
return
promise
;
}
static
async
postJsonTypeReq
(
url
,
data
,
md
=
"POST"
)
{
static
async
postJsonTypeReq
(
url
,
data
,
md
=
"POST"
,
otherHeaders
)
{
let
rtn
=
{}
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
request
({
...
...
@@ -73,6 +73,7 @@ class System {
json
:
true
,
headers
:
{
"content-type"
:
"application/json"
,
...
otherHeaders
},
body
:
data
},
function
(
error
,
response
,
body
)
{
...
...
@@ -92,7 +93,7 @@ class System {
})
return
promise
;
}
static
async
post3wFormTypeReq
(
url
,
data
)
{
static
async
post3wFormTypeReq
(
url
,
data
)
{
let
rtn
=
{}
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
request
.
post
({
...
...
@@ -111,7 +112,7 @@ class System {
})
return
promise
;
}
static
async
postMpFormTypeReq
(
url
,
formdata
)
{
static
async
postMpFormTypeReq
(
url
,
formdata
)
{
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
request
.
post
({
url
:
url
,
...
...
@@ -133,7 +134,7 @@ class System {
* @param {*} okmsg 操作成功的描述
* @param {*} req 请求头信息
*/
static
getResult
(
data
,
opmsg
=
"操作成功"
,
req
)
{
static
getResult
(
data
,
opmsg
=
"操作成功"
,
req
)
{
return
{
status
:
!
data
?
-
1
:
0
,
msg
:
opmsg
,
...
...
@@ -146,7 +147,7 @@ class System {
* @param {*} data 操作成功返回的数据
* @param {*} okmsg 操作成功的描述
*/
static
getResultSuccess
(
data
,
okmsg
=
"success"
)
{
static
getResultSuccess
(
data
,
okmsg
=
"success"
)
{
return
{
status
:
0
,
msg
:
okmsg
,
...
...
@@ -159,7 +160,7 @@ class System {
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} data 操作失败返回的数据
*/
static
getResultFail
(
status
=
-
1
,
errmsg
=
"fail"
,
data
=
null
)
{
static
getResultFail
(
status
=
-
1
,
errmsg
=
"fail"
,
data
=
null
)
{
return
{
status
:
status
,
msg
:
errmsg
,
...
...
@@ -171,14 +172,14 @@ class System {
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} data 操作失败返回的数据
*/
static
getResultError
(
errmsg
=
"fail"
,
data
=
null
)
{
static
getResultError
(
errmsg
=
"fail"
,
data
=
null
)
{
return
{
status
:
-
200
,
msg
:
errmsg
,
data
:
data
,
};
}
static
register
(
key
,
ClassObj
,
groupName
,
filename
)
{
static
register
(
key
,
ClassObj
,
groupName
,
filename
)
{
if
(
System
.
objTable
[
key
]
!=
null
)
{
throw
new
Error
(
"相同key的对象已经存在"
);
}
else
{
...
...
@@ -193,7 +194,7 @@ class System {
return
System
.
objTable
[
key
];
}
static
getObject
(
objpath
)
{
static
getObject
(
objpath
)
{
var
pathArray
=
objpath
.
split
(
"."
);
var
packageName
=
pathArray
[
0
];
var
groupName
=
pathArray
[
1
];
...
...
@@ -234,7 +235,7 @@ class System {
}
}
static
getSysConfig
()
{
static
getSysConfig
()
{
var
configPath
=
settings
.
basepath
+
"/app/base/db/metadata/index.js"
;
// if(settings.env=="dev"){
// console.log("delete "+configPath+"cache config");
...
...
@@ -244,7 +245,7 @@ class System {
var
configValue
=
require
(
configPath
);
return
configValue
.
config
;
}
static
get_client_ip
(
req
)
{
static
get_client_ip
(
req
)
{
var
ip
=
req
.
headers
[
'x-forwarded-for'
]
||
req
.
ip
||
req
.
connection
.
remoteAddress
||
...
...
@@ -267,7 +268,7 @@ class System {
* @param {*} resultInfo 返回结果
* @param {*} errorInfo 错误信息
*/
static
execLogs
(
opTitle
,
params
,
identifyCode
,
resultInfo
,
errorInfo
)
{
static
execLogs
(
opTitle
,
params
,
identifyCode
,
resultInfo
,
errorInfo
)
{
var
reqUrl
=
settings
.
logUrl
();
let
isLogData
=
true
if
(
params
.
method
&&
(
params
.
method
.
indexOf
(
"find"
)
>=
0
||
params
.
method
.
indexOf
(
"get"
)
>=
0
))
{
...
...
@@ -304,7 +305,7 @@ class System {
* 加密信息
* @param {*} opStr
*/
static
encryptStr
(
opStr
)
{
static
encryptStr
(
opStr
)
{
if
(
!
opStr
)
{
return
"opStr is empty"
;
}
...
...
@@ -317,7 +318,7 @@ class System {
* 解密信息
* @param {*} opStr
*/
static
decryptStr
(
opStr
)
{
static
decryptStr
(
opStr
)
{
if
(
!
opStr
)
{
return
"opStr is empty"
;
}
...
...
@@ -388,4 +389,14 @@ module.exports = System;
// }catch(e){
// console.log(e);
// }
// })()
\ No newline at end of file
// })()
// let otherHeaders = {
// xappkey: "647a68c9- da01 - 40d3-9763 - 1ffa0f64cf3f",
// }
// let header = {
// "content-type": "application/json",
// ...otherHeaders
// }
// console.log(JSON.stringify(header))
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