Commit d7690ded by 王勇飞

bizopt fix api

parent fab0d54a
......@@ -97,6 +97,7 @@ class BizOptCtl extends CtlBase {
let params = {
demand_code: "",//需求编号
close_reason: "",//关闭原因
remarks: ""//备注
}
//根据需求编号去更新该条需求的状态为已关闭
try {
......
......@@ -6,20 +6,45 @@ class FitaxcompanyCtl extends CtlBase {
constructor() {
super("bizchance", CtlBase.getServiceName(FitaxcompanyCtl));
}
/**
* 新建企业信息
* 根据需求编号查询企业信息
* @param {*} mobj
*/
async findOne(mobj, qobj, req) {
let pobj = mobj.d;
try {
if (!pobj.demand_code) {
return system.getResultError("fitaxschemeCtl/findOne 缺少需求编号!");
}
let res = await this.service.findInfo(pobj);
return system.getResult(res);
} catch (error) {
console.log("fitaxschemeCtl/findOne " + error);
return system.getResultError("fitaxschemeCtl/findOne 查询企业失败!");
}
}
/**
* 新建&更新企业信息
* @param {*} mobj
*/
async insertInfo(mobj, qobj, req) {
async insertOrUpdateInfo(mobj, qobj, req) {
let pobj = mobj.d;
try {
if (!pobj.demand_code) {
return system.getResultError("fitaxschemeCtl/insertInfo 缺少需求编号!");
}
let res = await this.service.insertInfo(pobj);
return system.getResult("新建方案成功!");
let findRes = await this.service.findInfo(pobj);
if (!findRes) {
let insertRes = await this.service.insertInfo(pobj);
return system.getResult("添加企业成功!");
}
let updateRes = await this.service.updateInfo(pobj);
return system.getResult("修改企业信息成功!");
} catch (error) {
return system.getResultError("fitaxschemeCtl/insertInfo 新建方案出错!");
console.log("fitaxschemeCtl/insertOrUpdateInfo " + error);
return system.getResultError("fitaxschemeCtl/insertOrUpdateInfo 添加&修改企业信息失败!");
}
}
}
......
......@@ -19,6 +19,7 @@ class FitaxschemeCtl extends CtlBase {
let res = await this.service.insertInfo(pobj);
return system.getResult("新建方案成功!");
} catch (error) {
console.log("fitaxschemeCtl/insertInfo " + error);
return system.getResultError("fitaxschemeCtl/insertInfo 新建方案出错!");
}
}
......
var system = require("../../../system");
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
const appconfig = system.getSysConfig();
class OperationrecordCtl extends CtlBase {
constructor() {
super("bizchance", CtlBase.getServiceName(OperationrecordCtl));
}
/**
* 查询记录信息
* @param {*} mobj
*/
async findOne(mobj, qobj, req) {
let pobj = mobj.d;
let params = {
demand_code: "",//需求编号
close_reason: "",//关闭原因
remarks: ""//备注
}
try {
if (!pobj.demand_code) {
return system.getResultError("fitaxschemeCtl/findOne 缺少需求编号!");
}
let res = await this.service.findInfo(pobj);
return system.getResult(res);
} catch (error) {
console.log("fitaxschemeCtl/findOne " + error);
return system.getResultError("fitaxschemeCtl/findOne 查询企业失败!");
}
}
/**
* 新建记录信息
* @param {*} mobj
*/
async insertInfo(mobj, qobj, req) {
let pobj = mobj.d;
let params = {
demand_code: "",//需求编号
close_reason: "",//关闭原因
remarks: ""//备注
}
try {
if (!pobj.demand_code) {
return system.getResultError("fitaxschemeCtl/insertInfo 缺少需求编号!");
}
let insertRes = await this.service.insertInfo(pobj);
return system.getResult("添加企业成功!");
} catch (error) {
console.log("operationrecordCtl/insertInfo " + error);
return system.getResultError("operationrecordCtl/insertInfo 添加&修改企业信息失败!");
}
}
}
module.exports = OperationrecordCtl;
......@@ -6,16 +6,38 @@ class FitaxcompanyDao extends Dao {
}
/**
*增删改查
*查询
*@param {*} qobj
*/
async findInfo(qobj) {
let obj = {
"demand_code": qobj.demand_code// 需求编码
}
return await this.findOne(obj);
}
/**
*修改
*@param {*} qobj
* @param {*} t
*/
async updateInfo(qobj, t) {
let obj = this.buildObj(qobj);
let whereObj = { "demand_code": obj.demand_code };
return await this.updateByWhere(obj, whereObj, t);
}
/**
* 插入状态信息
* 插入信息
* @param {*} qobj
* @param {*} t
*/
async insertInfo(qobj, t) {
let obj = this.buildObj(qobj);
return await this.create(obj, t);
}
buildObj(qobj) {
let obj = {
"demand_code": qobj.demand_code,// 需求编码
}
......@@ -40,8 +62,7 @@ class FitaxcompanyDao extends Dao {
if (qobj.address) {// 企业地址
obj.address = qobj.address;
}
return await this.create(obj, t);
return obj;
}
}
module.exports = FitaxcompanyDao;
......@@ -5,22 +5,37 @@ class FitaxschemeDao extends Dao {
super(Dao.getModelName(FitaxschemeDao));
}
/**
*增删改查
*/
/**
*查询
*@param {*} qobj
*/
async findInfo(qobj) {
let obj = {
"demand_code": qobj.demand_code,// 需求编码
}
return await this.findOne(obj);
}
/**
* 插入状态信息
* 插入方案信息
* @param {*} qobj
* @param {*} t
*/
async insertInfo(qobj, t) {
let obj = this.buildObj(qobj);
return await this.create(obj, t);
}
buildObj(qobj) {
let obj = {
"demand_code": qobj.demand_code,// 需求编码
}
if (qobj.solution_bizid) {// 方案编号
obj.solution_bizid = qobj.solution_bizid;
}
if (qobj.service_type) {// 服务类型
obj.service_type = qobj.service_type;
}
if (qobj.company_type) {// 公司类型
obj.company_type = qobj.company_type;
}
......@@ -42,7 +57,7 @@ class FitaxschemeDao extends Dao {
if (qobj.remarks) {// 备注
obj.remarks = qobj.remarks;
}
return await this.create(obj, t);
return obj;
}
}
module.exports = FitaxschemeDao;
......@@ -5,17 +5,34 @@ class OperationrecordDao extends Dao {
super(Dao.getModelName(OperationrecordDao));
}
/**
*增删改查
*/
/**
*查询
*@param {*} qobj
*/
async findAllInfo(qobj) {
qobj.raw = true;
return await this.model.findAll(qobj);
}
/**
* 插入状态信息
* @param {*} qobj
* @param {*} t
*/
async insertInfo(qobj,t){
async insertInfo(qobj, t) {
let obj = {
"demand_code": qobj.demand_code,// 需求编码
}
if (qobj.operator) {// 操作人
obj.operator = qobj.operator;
}
if (qobj.operation_type) {// 操作类型
obj.operation_type = qobj.operation_type;
}
if (qobj.operation_details) {// 操作详细记录json
obj.operation_details = qobj.operation_details;
}
return await this.create(obj, t);
}
}
module.exports = OperationrecordDao;
......@@ -41,7 +41,7 @@ module.exports = (db, DataTypes) => {
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
version: false,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
......
......@@ -25,7 +25,7 @@ module.exports = (db, DataTypes) => {
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
version: false,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
......
......@@ -14,6 +14,10 @@ module.exports = (db, DataTypes) => {
allowNull: true,
type: DataTypes.STRING
},
service_type: { // 服务类型
allowNull: true,
type: DataTypes.STRING
},
company_type: { // 公司类型
allowNull: true,
type: DataTypes.STRING
......@@ -45,7 +49,7 @@ module.exports = (db, DataTypes) => {
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
version: false,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
......
......@@ -7,42 +7,23 @@ class FitaxcompanyService extends ServiceBase {
super("bizchance", ServiceBase.getDaoName(FitaxcompanyService));
}
async findById(qobj){//根据id获取方案信息
var oid = qobj.id;
return await this.dao.findById(oid);
}
async findInfoByDemandCode(qobj){//根据方案编号获取方案详情
return await this.dao.findInfoByDemandCode(qobj);
}
async updateStatusByDemandCode(qobj){//根据商机编号号更新方案状态及原因
var self=this;
return self.db.transaction(async function (t) {
return await self.dao.updateStatusByDemandCode(qobj,t);
});
}
async updateInfoByDemandCode(qobj){//根据商机编号更新方案详情
async insertInfo(qobj) {//插入企业信息
var self = this;
return self.db.transaction(async function (t) {
return await self.dao.updateInfoByDemandCode(qobj,t);
});
}
async updateSchemeNumberByDemandCode(qobj){//根据商机编号更新方案编号
var self = this;
return self.db.transaction(async function (t) {
return await self.dao.updateSchemeNumberByDemandCode(qobj,t);
return await self.db.transaction(async function (t) {
return await self.dao.insertInfo(qobj, t);
});
}
async insertInfo(qobj){//插入方案信息
async updateInfo(qobj) {//修改企业信息
var self = this;
return await self.db.transaction(async function (t) {
return await self.dao.insertInfo(qobj,t);
});
return await self.dao.updateInfo(qobj, t);
})
}
async findInfo(qobj) {//查询企业信息
let res = await this.dao.findInfo(qobj);
return res;
}
}
module.exports = FitaxcompanyService;
\ No newline at end of file
......@@ -7,36 +7,6 @@ class FitaxschemeService extends ServiceBase {
super("bizchance", ServiceBase.getDaoName(FitaxschemeService));
}
async findById(qobj){//根据id获取方案信息
var oid = qobj.id;
return await this.dao.findById(oid);
}
async findInfoByDemandCode(qobj){//根据方案编号获取方案详情
return await this.dao.findInfoByDemandCode(qobj);
}
async updateStatusByDemandCode(qobj){//根据商机编号号更新方案状态及原因
var self=this;
return self.db.transaction(async function (t) {
return await self.dao.updateStatusByDemandCode(qobj,t);
});
}
async updateInfoByDemandCode(qobj){//根据商机编号更新方案详情
var self = this;
return self.db.transaction(async function (t) {
return await self.dao.updateInfoByDemandCode(qobj,t);
});
}
async updateSchemeNumberByDemandCode(qobj){//根据商机编号更新方案编号
var self = this;
return self.db.transaction(async function (t) {
return await self.dao.updateSchemeNumberByDemandCode(qobj,t);
});
}
async insertInfo(qobj){//插入方案信息
var self = this;
return await self.db.transaction(async function (t) {
......@@ -44,5 +14,9 @@ class FitaxschemeService extends ServiceBase {
});
}
async findInfo(qobj) {//查询方案信息
var self = this;
return await self.dao.findInfo(qobj);
}
}
module.exports = FitaxschemeService;
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
const appconfig = system.getSysConfig();
class OperationrecordService extends ServiceBase {
constructor() {
super("bizchance", ServiceBase.getDaoName(OperationrecordService));
}
async insertInfo(qobj) {//插入需求分配记录信息
var self = this;
return await self.db.transaction(async function (t) {
return await self.dao.insertInfo(qobj, t);
});
}
async findAllInfo(qobj) {//查询记录信息
let res = await this.dao.findAllInfo(qobj);
return res;
}
}
module.exports = OperationrecordService;
\ 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