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
87382b23
Commit
87382b23
authored
Apr 02, 2021
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处理渠道退款
parent
c7065bd9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
157 additions
and
132 deletions
+157
-132
center-order/app/base/db/impl/dbcorder/orderinfoDao.js
+157
-132
center-order/app/base/service/impl/dbcorder/orderinfoSve.js
+0
-0
No files found.
center-order/app/base/db/impl/dbcorder/orderinfoDao.js
View file @
87382b23
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
const
{
Op
}
=
require
(
"sequelize"
);
const
{
Op
}
=
require
(
"sequelize"
);
class
OrderInfoDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
OrderInfoDao
));
}
async
getItemStatusByOrderNo
(
orderNo
,
uapp_id
)
{
var
sqlWhere
=
{
where
:
{
orderNo
:
orderNo
},
attributes
:
[
"id"
,
"uapp_id"
,
"orderNo"
,
"channelServiceNo"
,
"channelOrderNo"
,
"orderServiceNo"
,
"channelUserId"
,
"ownerUserId"
,
"payTime"
,
"quantity"
,
"serviceQuantity"
,
"orderStatusName"
,
"orderStatus"
,
"totalSum"
,
"payTotalSum"
,
"refundSum"
,
"invoiceApplyStatus"
,
"created_at"
],
raw
:
true
};
if
(
uapp_id
)
{
sqlWhere
.
where
.
uapp_id
=
uapp_id
;
constructor
()
{
super
(
Dao
.
getModelName
(
OrderInfoDao
));
}
return
await
this
.
model
.
findOne
(
sqlWhere
);
}
async
getItemStatusByChannelOrderNo
(
channelOrderNo
,
uapp_id
)
{
var
sqlWhere
=
{
where
:
{
channelOrderNo
:
channelOrderNo
},
attributes
:
[
"id"
,
"uapp_id"
,
"orderNo"
,
"channelServiceNo"
,
"channelOrderNo"
,
"orderServiceNo"
,
"channelUserId"
,
"ownerUserId"
,
"payTime"
,
"quantity"
,
"serviceQuantity"
,
"orderStatusName"
,
"orderStatus"
,
"totalSum"
,
"payTotalSum"
,
"refundSum"
,
"invoiceApplyStatus"
,
"created_at"
],
raw
:
true
};
if
(
uapp_id
)
{
sqlWhere
.
where
.
uapp_id
=
uapp_id
;
/**
* 更新订单
* @param status
* @param statusName
* @param channelOrderNo
* @param uapp_id
* @returns {Promise<*>}
*/
async
updateStatus
(
status
,
statusName
,
channelOrderNo
,
uapp_id
)
{
let
result
=
await
this
.
updateByWhere
({
orderStatus
:
status
,
orderStatusName
:
statusName
},
{
where
:
{
channelOrderNo
:
channelOrderNo
,
uapp_id
:
uapp_id
,
}
});
return
result
;
}
return
await
this
.
model
.
findOne
(
sqlWhere
);
}
async
delOrderByOrderNo
(
orderNo
,
uapp_id
,
channelUserId
)
{
var
sqlWhere
=
{
orderNo
:
orderNo
,
uapp_id
:
uapp_id
,
channelUserId
:
channelUserId
};
return
await
this
.
delete
(
sqlWhere
);
}
async
delOrderByOrderNoEname
(
orderNo
)
{
var
sqlWhere
=
{
orderNo
:
orderNo
};
return
await
this
.
delete
(
sqlWhere
);
}
async
channeldelOrder
(
channelOrderNo
,
uapp_id
)
{
var
sqlWhere
=
{
channelOrderNo
:
channelOrderNo
,
uapp_id
:
uapp_id
,
};
return
await
this
.
delete
(
sqlWhere
);
}
async
addOrderDelivery
(
data
,
orderNo
,
t
)
{
//新增交付信息
const
sql
=
"INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('"
+
orderNo
+
"','"
+
JSON
.
stringify
(
data
)
+
"')"
;
await
this
.
customInsert
(
sql
,
null
,
t
);
return
system
.
getResultSuccess
()
}
async
getItemStatusByOrderNo
(
orderNo
,
uapp_id
)
{
var
sqlWhere
=
{
where
:
{
orderNo
:
orderNo
},
attributes
:
[
"id"
,
"uapp_id"
,
"orderNo"
,
"channelServiceNo"
,
"channelOrderNo"
,
"orderServiceNo"
,
"channelUserId"
,
"ownerUserId"
,
"payTime"
,
"quantity"
,
"serviceQuantity"
,
"orderStatusName"
,
"orderStatus"
,
"totalSum"
,
"payTotalSum"
,
"refundSum"
,
"invoiceApplyStatus"
,
"created_at"
],
raw
:
true
};
if
(
uapp_id
)
{
sqlWhere
.
where
.
uapp_id
=
uapp_id
;
}
return
await
this
.
model
.
findOne
(
sqlWhere
);
}
/**
* 根据ids 获取需求
* @param ids
* @returns {Promise<void>}
*/
async
getOrdersByIds
(
ids
)
{
let
orders
=
await
this
.
findAll
({
where
:
{
channelOrderNo
:
{
[
Op
.
in
]:
ids
async
getItemStatusByChannelOrderNo
(
channelOrderNo
,
uapp_id
)
{
var
sqlWhere
=
{
where
:
{
channelOrderNo
:
channelOrderNo
},
attributes
:
[
"id"
,
"uapp_id"
,
"orderNo"
,
"channelServiceNo"
,
"channelOrderNo"
,
"orderServiceNo"
,
"channelUserId"
,
"ownerUserId"
,
"payTime"
,
"quantity"
,
"serviceQuantity"
,
"orderStatusName"
,
"orderStatus"
,
"totalSum"
,
"payTotalSum"
,
"refundSum"
,
"invoiceApplyStatus"
,
"created_at"
],
raw
:
true
};
if
(
uapp_id
)
{
sqlWhere
.
where
.
uapp_id
=
uapp_id
;
}
}
})
return
orders
;
}
return
await
this
.
model
.
findOne
(
sqlWhere
);
}
/**
* 批量更新
* @param needs
* @returns {Promise<Array<Model>|*>}
*/
async
bulkUpdate
(
orders
)
{
let
result
=
await
this
.
bulkCreate
(
orders
,
{
fields
:
[
"id"
,
"status"
,
"statusName"
],
updateOnDuplicate
:
[
"status"
,
"statusName"
]
});
return
result
;
}
async
delOrderByOrderNo
(
orderNo
,
uapp_id
,
channelUserId
)
{
var
sqlWhere
=
{
orderNo
:
orderNo
,
uapp_id
:
uapp_id
,
channelUserId
:
channelUserId
};
return
await
this
.
delete
(
sqlWhere
);
}
/**
* 批量更新
* @param needs
* @returns {Promise<Array<Model>|*>}
*/
async
bulkUpdateStatus
(
status
,
statusName
,
ids
)
{
let
result
=
await
this
.
updateByWhere
({
orderStatus
:
status
,
orderStatusName
:
statusName
},
{
where
:
{
channelOrderNo
:
{
[
Op
.
in
]:
ids
}
}
});
return
result
;
}
async
delOrderByOrderNoEname
(
orderNo
)
{
var
sqlWhere
=
{
orderNo
:
orderNo
};
return
await
this
.
delete
(
sqlWhere
);
}
async
channeldelOrder
(
channelOrderNo
,
uapp_id
)
{
var
sqlWhere
=
{
channelOrderNo
:
channelOrderNo
,
uapp_id
:
uapp_id
,
};
return
await
this
.
delete
(
sqlWhere
);
}
async
addOrderDelivery
(
data
,
orderNo
,
t
)
{
//新增交付信息
const
sql
=
"INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('"
+
orderNo
+
"','"
+
JSON
.
stringify
(
data
)
+
"')"
;
await
this
.
customInsert
(
sql
,
null
,
t
);
return
system
.
getResultSuccess
()
}
/**
* 根据ids 获取需求
* @param ids
* @returns {Promise<void>}
*/
async
getOrdersByIds
(
ids
)
{
let
orders
=
await
this
.
findAll
({
where
:
{
channelOrderNo
:
{
[
Op
.
in
]:
ids
}
}
})
return
orders
;
}
/**
* 批量更新
* @param needs
* @returns {Promise<Array<Model>|*>}
*/
async
bulkUpdate
(
orders
)
{
let
result
=
await
this
.
bulkCreate
(
orders
,
{
fields
:
[
"id"
,
"status"
,
"statusName"
],
updateOnDuplicate
:
[
"status"
,
"statusName"
]
});
return
result
;
}
/**
* 批量更新
* @param needs
* @returns {Promise<Array<Model>|*>}
*/
async
bulkUpdateStatus
(
status
,
statusName
,
ids
)
{
let
result
=
await
this
.
updateByWhere
({
orderStatus
:
status
,
orderStatusName
:
statusName
},
{
where
:
{
channelOrderNo
:
{
[
Op
.
in
]:
ids
}
}
});
return
result
;
}
}
module
.
exports
=
OrderInfoDao
;
center-order/app/base/service/impl/dbcorder/orderinfoSve.js
View file @
87382b23
This diff is collapsed.
Click to expand it.
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