Commit d1cc94d3 by Sxy

feat: 更新批次信息'

parent 0a972d97
var settings = {
redis: {
host: "192.168.4.119",
port: 6379,
password: "Gongsibao2018",
db: 9,
},
database: {
dbname: "gsbcenter_manage",
user: "write",
password: "write",
config: {
host: '43.247.184.35',
port: 8899,
dialect: 'mysql',
operatorsAliases: false,
pool: {
max: 5,
min: 0,
acquire: 90000000,
idle: 1000000
},
debug: false,
dialectOptions: {
requestTimeout: 999999,
// instanceName:'DEV'
} //设置MSSQL超时时间
}
},
kongurl: 'http://192.168.4.119:8001/',
};
module.exports = settings;
...@@ -286,6 +286,21 @@ class BizOptCtl extends CtlBase { ...@@ -286,6 +286,21 @@ class BizOptCtl extends CtlBase {
} }
} }
/**
* 更新商机批次信息
* @param {*} pobj
* @param {*} qobj
* @param {*} req
*/
async batchChanceUpdate(pobj, qobj, req) {
try {
const rs = await this.service.batchChanceUpdate(pobj);
return system.getResult(rs);
} catch (err) {
return system.getResult(null, err.message)
}
}
timeFormat(date) { timeFormat(date) {
let localTime = moment.utc(date).toDate(); let localTime = moment.utc(date).toDate();
localTime = moment(localTime).format("YYYY-MM-DD"); localTime = moment(localTime).format("YYYY-MM-DD");
......
const system = require("../../../system");
const Dao = require("../../dao.base");
class BizbatchDao extends Dao {
constructor() {
super(Dao.getModelName(BizbatchDao));
}
}
module.exports = BizbatchDao;
const system = require("../../../system");
const settings = require("../../../../config/settings");
const appconfig = system.getSysConfig();
/**
* 商机批次表
*/
module.exports = (db, DataTypes) => {
return db.define("bizbatch", {
batchNumber: { // 需求批次
allowNull: false,
type: DataTypes.STRING
},
batchInfo: { // 批次详情
allowNull: false,
type: DataTypes.JSON
},
processingStatus: { // 处理状态 processing(处理中) success(成功)
allowNull: false,
type: DataTypes.STRING,
},
paymentLink: { // 支付链接
allowNull: true,
type: DataTypes.STRING
},
createrId: { //创建人id
allowNull: true,
type: DataTypes.STRING
},
createrName: { // 创建人名称
allowNull: true,
type: DataTypes.STRING
},
createrOpcode: {// 创建人 组织结构路径
allowNull: true,
type: DataTypes.STRING
}
}, {
paranoid: false, //假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'bussiness_bath',
validate: {
},
indexes: []
});
}
\ No newline at end of file
...@@ -5,6 +5,8 @@ const appconfig = system.getSysConfig(); ...@@ -5,6 +5,8 @@ const appconfig = system.getSysConfig();
class BizOptService extends ServiceBase { class BizOptService extends ServiceBase {
constructor() { constructor() {
super("bizchance", ServiceBase.getDaoName(BizOptService)); super("bizchance", ServiceBase.getDaoName(BizOptService));
this.bizbatchDao = system.getObject("db.bizchance.bizbatchDao");
} }
async statBizChanceCountBySp(bizStatus, betweenTime) { async statBizChanceCountBySp(bizStatus, betweenTime) {
let params = {} let params = {}
...@@ -109,6 +111,33 @@ class BizOptService extends ServiceBase { ...@@ -109,6 +111,33 @@ class BizOptService extends ServiceBase {
return await self.dao.insertInfo(qobj, t); return await self.dao.insertInfo(qobj, t);
}); });
} }
/*更新商机批次信息*/
async batchChanceUpdate(qobj) {
let data = await this.bizbatchDao.findOne({
batchNumber: qobj.batchNumber
});
if (!data) {
throw new Error("查不到商机批次信息")
}
if (data.processingStatus === "success") {
return "已处理成功,重复请求"
}
let demandObj = {};
for (let val of qobj.demands) {
demandObj[val.uniqueCode] = val.demandCode;
}
await this.bizbatchDao.updateByWhere({
processingStatus: "success",
paymentLink: qobj.paymentLink,
batchInfo: data.batchInfo.map(item => {
item.demandCode = demandObj[item.uniqueCode] || ''
return item
})
}, {
id: data.id
})
return "SUCESS"
}
} }
module.exports = BizOptService; module.exports = BizOptService;
\ No newline at end of file
var settings = {
redis: {
host: "192.168.4.119",
port: 6379,
password: "Gongsibao2018",
db: 9,
},
database: {
dbname: "ent_deliver",
user: "write",
password: "write",
config: {
host: '43.247.184.35',
port: 8899,
dialect: 'mysql',
operatorsAliases: false,
pool: {
max: 5,
min: 0,
acquire: 90000000,
idle: 1000000
},
debug: false,
dialectOptions: {
requestTimeout: 999999,
// instanceName:'DEV'
} //设置MSSQL超时时间
}
},
kongurl: 'http://192.168.4.119:8001/',
};
module.exports = settings;
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