Commit 5d828877 by 王昆

gsb

parent 1bf56c80
...@@ -43,14 +43,14 @@ class ObusinessmenDao extends Dao { ...@@ -43,14 +43,14 @@ class ObusinessmenDao extends Dao {
} }
if(params.name) { if(params.name) {
params.name_like = "%" + params.name + "%"; params.name_like = "%" + params.name + "%";
sql.push("AND t1.name = :name_like"); sql.push("AND t1.name LIKE :name_like");
} }
if(params.bd_id) { if(params.bd_id) {
sql.push("AND t1.bd_id = :bd_id"); sql.push("AND t1.bd_id = :bd_id");
} }
if(params.bd_path) { if(params.bd_path) {
params.bd_path_like = "%" + params.bd_path + "%"; params.bd_path_like = params.bd_path + "%";
sql.push("AND t1.bd_path = :bd_path_like"); sql.push("AND t1.bd_path LIKE :bd_path_like");
} }
if(params.order_id) { if(params.order_id) {
sql.push("AND t1.order_id = :order_id"); sql.push("AND t1.order_id = :order_id");
......
...@@ -52,5 +52,27 @@ class OorderDao extends Dao { ...@@ -52,5 +52,27 @@ class OorderDao extends Dao {
} }
async findMapByIds(ids, attrs) {
var result = {};
if (!ids || ids.length == 0) {
return result;
}
attrs = attrs || "*";
var sql = "SELECT " + attrs + " FROM `o_order` WHERE id IN (:ids)";
var list = await this.customQuery(sql, {
ids: ids
});
if (!list || list.length == 0) {
return result;
}
for (var item of list) {
result[item.id] = item;
}
return result;
}
} }
module.exports = OorderDao; module.exports = OorderDao;
\ No newline at end of file
...@@ -6,7 +6,7 @@ const ServiceBase = require("../../sve.base") ...@@ -6,7 +6,7 @@ const ServiceBase = require("../../sve.base")
class ObusinessmenService extends ServiceBase { class ObusinessmenService extends ServiceBase {
constructor() { constructor() {
super("order", ServiceBase.getDaoName(ObusinessmenService)); super("order", ServiceBase.getDaoName(ObusinessmenService));
this.oorderDao = system.getObject("service.order.oorderDao"); this.oorderDao = system.getObject("db.order.oorderDao");
this.ASSIGN_STATUS = ['1160', '1170', '1180', '1190', '1200']; this.ASSIGN_STATUS = ['1160', '1170', '1180', '1190', '1200'];
} }
...@@ -69,7 +69,7 @@ class ObusinessmenService extends ServiceBase { ...@@ -69,7 +69,7 @@ class ObusinessmenService extends ServiceBase {
if(!_order){ if(!_order){
return system.getResult(null,`订单存在`); return system.getResult(null,`订单存在`);
} }
if(this.ASSIGN_STATUS.indexOf(_order.status)==-1){ if(this.ASSIGN_STATUS.indexOf(_order.status.toString())==-1){
return system.getResult(null,`个体工商户不能签约`); return system.getResult(null,`个体工商户不能签约`);
} }
...@@ -133,9 +133,28 @@ class ObusinessmenService extends ServiceBase { ...@@ -133,9 +133,28 @@ class ObusinessmenService extends ServiceBase {
for (var row of list) { for (var row of list) {
this.handleDate(row, ["created_at", "assignTime"], null, -8); this.handleDate(row, ["created_at", "assignTime"], null, -8);
} }
await this.doSignBtn(list);
} }
return system.getResultSuccess({count: total, rows: list}); return system.getResultSuccess({count: total, rows: list});
} }
async doSignBtn(list) {
if (!list || list.length == 0) {
return;
}
let ids = [];
for (let item of list) {
ids.push(item.order_id);
}
let orderMap = await this.oorderDao.findMapByIds(ids, "id, status");
for (let item of list) {
let order = orderMap[item.order_id] || {};
item.showSign = this.ASSIGN_STATUS.indexOf(order.status.toString()) != -1;
}
}
} }
module.exports = ObusinessmenService; module.exports = ObusinessmenService;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment