Commit ecd0e8cc by 王勇飞

gyq

parent 0739419f
...@@ -10,8 +10,9 @@ class BizOptCtl extends CtlBase { ...@@ -10,8 +10,9 @@ class BizOptCtl extends CtlBase {
super("bizchance", CtlBase.getServiceName(BizOptCtl)); super("bizchance", CtlBase.getServiceName(BizOptCtl));
this.schemeService = system.getObject("service.bizchance.schemeSve"); this.schemeService = system.getObject("service.bizchance.schemeSve");
this.logService = system.getObject("service.bizchance.statuslogSve"); this.logService = system.getObject("service.bizchance.statuslogSve");
this.receiveUrl = "http://192.168.1.140:4011/api/receive/entService/springBoard"; this.receiveUrl = settings.receiveUrl();
this.queueUrl = "http://192.168.1.128:4018/api/queueAction/producer/springBoard"; this.queueUrl = settings.queueUrl();
//this.wdyUrl = settings.wdyUrl();
} }
/*根据用户id获取商机信息,分页获取*/ /*根据用户id获取商机信息,分页获取*/
...@@ -19,7 +20,7 @@ class BizOptCtl extends CtlBase { ...@@ -19,7 +20,7 @@ class BizOptCtl extends CtlBase {
try { try {
//TODO 根据业务员id获取该业务员所有列表 //TODO 根据业务员id获取该业务员所有列表
//设置查询条件 //设置查询条件
console.log("pobj--",pobj) console.log("pobj--", pobj)
const rs = await this.service.findAndCountAll(pobj); const rs = await this.service.findAndCountAll(pobj);
let rarr = []; let rarr = [];
let results = rs.results.rows; let results = rs.results.rows;
...@@ -48,47 +49,46 @@ class BizOptCtl extends CtlBase { ...@@ -48,47 +49,46 @@ class BizOptCtl extends CtlBase {
} }
/*根据商机编号获取商机详情*/ /*根据商机编号获取商机详情*/
async findInfoByDemandCode(mobj,qobj,req){ async findInfoByDemandCode(mobj, qobj, req) {
var pobj = mobj.d; var pobj = mobj.d;
if (pobj.businessMode && pobj.businessMode != 'undefined') if (pobj.businessMode && pobj.businessMode != 'undefined') {
{ try {
try{
var rs = await this.service.findInfoByDemandCode(pobj); var rs = await this.service.findInfoByDemandCode(pobj);
var ms = await this.schemeService.findInfoByDemandCode(pobj); var ms = await this.schemeService.findInfoByDemandCode(pobj);
var rarr = {} var rarr = {}
if (rs){ if (rs) {
var statusInfo = {"currentStatus":rs.business_status};//商机状态 var statusInfo = { "currentStatus": rs.business_status };//商机状态
var businessInfo = {}; var businessInfo = {};
businessInfo.businessMode = rs.demand_code;//商机编号 businessInfo.businessMode = rs.demand_code;//商机编号
businessInfo.channelSource = appconfig.pdict.source[rs.source_name];///渠道来源 businessInfo.channelSource = appconfig.pdict.source[rs.source_name];///渠道来源
// businessInfo.businessType = rs.business_type;//商机类型代码 // businessInfo.businessType = rs.business_type;//商机类型代码
businessInfo.businessType = appconfig.pdict.businessType[rs.business_type];//商机类型名称 businessInfo.businessType = appconfig.pdict.businessType[rs.business_type];//商机类型名称
// businessInfo.serviceArea = rs.service_address;//服务地区 // businessInfo.serviceArea = rs.service_address;//服务地区
if (businessInfo.businessName == "云上园区注册"){ if (businessInfo.businessName == "云上园区注册") {
businessInfo.serviceArea = appconfig.pdict.registeredParkDict[rs.service_address];//服务地区名称 businessInfo.serviceArea = appconfig.pdict.registeredParkDict[rs.service_address];//服务地区名称
} }
else{ else {
businessInfo.serviceArea = appconfig.pdict.registeredAreaDict[rs.service_address];//服务地区名称 businessInfo.serviceArea = appconfig.pdict.registeredAreaDict[rs.service_address];//服务地区名称
} }
if (businessInfo.businessName == "注册地址"){ if (businessInfo.businessName == "注册地址") {
businessInfo.registeredAddress = appconfig.pdict.registeredAreaDict[rs.service_address];//注册地址名称 businessInfo.registeredAddress = appconfig.pdict.registeredAreaDict[rs.service_address];//注册地址名称
} }
businessInfo.statusReason = rs.close_reason;//商机关闭原因 businessInfo.statusReason = rs.close_reason;//商机关闭原因
businessInfo.memoInfo = rs.business_info.memoInfo;//备注信息 businessInfo.memoInfo = rs.business_info.memoInfo;//备注信息
businessInfo.contactsName = rs.business_info.contactsName;//联系人名称 businessInfo.contactsName = rs.business_info.contactsName;//联系人名称
businessInfo.contactsPhone = rs.business_info.contactsPhone;//联系人联系方式 businessInfo.contactsPhone = rs.business_info.contactsPhone;//联系人联系方式
businessInfo.createdTime = this.timeFormat(rs.created_at);//商机创建时间 businessInfo.createdTime = this.timeFormat(rs.created_at);//商机创建时间
rarr.statusInfo = statusInfo; rarr.statusInfo = statusInfo;
rarr.businessInfo = businessInfo; rarr.businessInfo = businessInfo;
} }
if (ms){ if (ms) {
var planInfo = ms.scheme_info; var planInfo = ms.scheme_info;
planInfo.schemeNumber = ms.scheme_number; planInfo.schemeNumber = ms.scheme_number;
planInfo.currentStatus = ms.scheme_status; planInfo.currentStatus = ms.scheme_status;
if ( ms.scheme_status && ms.scheme_status == "isReject"){ if (ms.scheme_status && ms.scheme_status == "isReject") {
planInfo.currentStatus = "已退回"; planInfo.currentStatus = "已退回";
} }
else{ else {
planInfo.currentStatus = ms.scheme_status; planInfo.currentStatus = ms.scheme_status;
} }
planInfo.statusReason = ms.reject_reason; planInfo.statusReason = ms.reject_reason;
...@@ -96,103 +96,106 @@ class BizOptCtl extends CtlBase { ...@@ -96,103 +96,106 @@ class BizOptCtl extends CtlBase {
} }
return system.getResult(rarr); return system.getResult(rarr);
} }
catch(error){ catch (error) {
console.log("eeeeeeeeeeeeeeeeeeeeee"); console.log("eeeeeeeeeeeeeeeeeeeeee");
console.log(error); console.log(error);
return system.getResultError(error); return system.getResultError(error);
} }
} }
else{ else {
return system.getResultError("参数错误!"); return system.getResultError("参数错误!");
} }
} }
/*根据商机编号更新商机状态*/ /*根据商机编号更新商机状态*/
async updateStatusByDemandCode(mobj,qobj,req){ async updateStatusByDemandCode(mobj, qobj, req) {
var pobj = mobj.d; var pobj = mobj.d;
if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.currentStatus && pobj.currentStatus != 'undefined'){ if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.currentStatus && pobj.currentStatus != 'undefined') {
try{ try {
await this.service.updateStatusByDemandCode(pobj); await this.service.updateStatusByDemandCode(pobj);
await this.schemeService.updateStatusByDemandCode(pobj);//同时更新方案的状态 await this.schemeService.updateStatusByDemandCode(pobj);//同时更新方案的状态
var res = this.service.findInfoByDemandCode(pobj); var res = this.service.findInfoByDemandCode(pobj);
if (res && res != 'undefined'){ if (res && res != 'undefined') {
var logInfo = { var logInfo = {
"flowType":"BIZ", "flowType": "BIZ",
"flowId":res.id, "flowId": res.id,
"statusCode":pobj.currentStatus, "statusCode": pobj.currentStatus,
"statusReason":res.close_reason, "statusReason": res.close_reason,
"clerkName":res.salesman_name, "clerkName": res.salesman_name,
"clerkId":res.salesman_id "clerkId": res.salesman_id
} }
await this.logService.insertInfo(logInfo);//插入状态日至表 await this.logService.insertInfo(logInfo);//插入状态日至表
} }
if (pobj.currentStatus == "isClosed"){ //关闭需求时调用 if (pobj.currentStatus == "isClosed") { //关闭需求时调用
var rc = system.getObject("util.execClient"); var rc = system.getObject("util.execClient");
var requrl = this.queueUrl; var requrl = this.queueUrl;
var params = { var params = {
"actionType":"produceData", "actionType": "produceData",
"actionBody":{ "actionBody": {
"pushUrl":this.receiveUrl, "pushUrl": this.receiveUrl,
"actionType":"closeNeed", "actionType": "closeNeed",
"identifyCode":"ic-manage", "identifyCode": "ic-manage",
"messageBody":{ "messageBody": {
"needNum": pobj.businessMode, "needNum": pobj.businessMode,
"note":pobj.statusReason "note": pobj.statusReason
} }
} }
} }
var rtn = await rc.execPost(params, requrl); var rtn = await rc.execPost(params, requrl);
var j = JSON.parse(rtn.stdout); var j = JSON.parse(rtn.stdout);
if (j.status == 1){ if (j.status == 1) {
return system.getResult("操作成功!"); return system.getResult("操作成功!");
} }
else{ else {
return system.getResultError("更新方案状态出错!"); return system.getResultError("更新方案状态出错!");
} }
} }
else {
return system.getResult("操作成功!");
}
} }
catch (error){ catch (error) {
return system.getResultError(error); return system.getResultError(error);
} }
} }
else{ else {
return system.getResultError("参数错误!"); return system.getResultError("参数错误!");
} }
} }
/*插入数据信息 */ /*插入数据信息 */
async insertInfo(nobj,qobj,req){ async insertInfo(nobj, qobj, req) {
var pobj = nobj.d; var pobj = nobj.d;
if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.businessType && pobj.businessType != 'undefined'){ if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.businessType && pobj.businessType != 'undefined') {
try{ try {
pobj.currentStatus = "beforeSubmission";//加上当前状态为待提交方案 pobj.currentStatus = "beforeSubmission";//加上当前状态为待提交方案
pobj.channelSource = "tencentCloud";//目前渠道只有腾讯 pobj.channelSource = "tencentCloud";//目前渠道只有腾讯
pobj.sourceNumber = "1111111"; pobj.sourceNumber = "1111111";
pobj.businessType = appconfig.pdict.dyDict[pobj.businessType]; pobj.businessType = appconfig.pdict.dyDict[pobj.businessType];
var buInfo = await this.service.insertInfo(pobj); var buInfo = await this.service.insertInfo(pobj);
var logInfo = { var logInfo = {
"flowType":"BIZ", "flowType": "BIZ",
"flowId":buInfo.id, "flowId": buInfo.id,
"statusCode":pobj.currentStatus, "statusCode": pobj.currentStatus,
"clerkName":pobj.clerkName, "clerkName": pobj.clerkName,
"clerkId":pobj.salesmanId "clerkId": pobj.salesmanId
} }
await this.logService.insertInfo(logInfo);//插入状态日至表 await this.logService.insertInfo(logInfo);//插入状态日至表
return { return {
"status":1, //1代表成功,否则失败 "status": 1, //1代表成功,否则失败
"message":"操作成功", "message": "操作成功",
"data":"", "data": "",
"requestId":"" "requestId": ""
}; };
} }
catch(error){ catch (error) {
console.log("TTTTTTTTTTTTTTTTTTTTTTT"); console.log("TTTTTTTTTTTTTTTTTTTTTTT");
console.log(error); console.log(error);
return system.getResultError(error); return system.getResultError(error);
} }
} }
else{ else {
return system.getResultError("参数错误!"); return system.getResultError("参数错误!");
} }
} }
......
...@@ -10,11 +10,12 @@ class DeliverybillCtl extends CtlBase { ...@@ -10,11 +10,12 @@ class DeliverybillCtl extends CtlBase {
super("bizchance", CtlBase.getServiceName(DeliverybillCtl)); super("bizchance", CtlBase.getServiceName(DeliverybillCtl));
this.materialService = system.getObject("service.bizchance.materialSve"); this.materialService = system.getObject("service.bizchance.materialSve");
this.schemeService = system.getObject("service.bizchance.schemeSve"); this.schemeService = system.getObject("service.bizchance.schemeSve");
this.bizoptService = system.getObject("service.bizchance.bizoptSve");
this.logService = system.getObject("service.bizchance.statuslogSve"); this.logService = system.getObject("service.bizchance.statuslogSve");
this.cacheService = system.getObject("service.bizchance.cacheinfoSve"); this.cacheService = system.getObject("service.bizchance.cacheinfoSve");
this.receiveUrl = "http://192.168.1.140:4011/api/receive/entService/springBoard"; this.receiveUrl = settings.receiveUrl();
this.queueUrl = "http://192.168.1.128:4018/api/queueAction/producer/springBoard"; this.queueUrl = settings.queueUrl();
this.wdyUrl = "http://192.168.1.113:4011/api/action/order/springBoard"; this.wdyUrl = settings.wdyUrl();
} }
/*根据用户id获取商机信息,分页获取*/ /*根据用户id获取商机信息,分页获取*/
...@@ -584,13 +585,20 @@ class DeliverybillCtl extends CtlBase { ...@@ -584,13 +585,20 @@ class DeliverybillCtl extends CtlBase {
if (pobj.companyInfo.companyPropertiesName && pobj.companyInfo.companyPropertiesName != 'undefined') { if (pobj.companyInfo.companyPropertiesName && pobj.companyInfo.companyPropertiesName != 'undefined') {
if (pobj.businessName == "公司注册") { if (pobj.businessName == "公司注册") {
pobj.companyInfo.companyProperties = appconfig.pdict.companyNatureDictT[pobj.companyInfo.companyPropertiesName]; pobj.companyInfo.companyProperties = appconfig.pdict.companyNatureDictT[pobj.companyInfo.companyPropertiesName];
pobj.baseInfo.companyProperties = pobj.companyInfo.companyProperties;
pobj.baseInfo.companyType = pobj.companyInfo.companyProperties;
} }
else if (pobj.businessName == "云上园区注册") { else if (pobj.businessName == "云上园区注册") {
pobj.companyInfo.companyProperties = appconfig.pdict.registeredTypeDictT[pobj.companyInfo.companyPropertiesName]; pobj.companyInfo.companyProperties = appconfig.pdict.registeredTypeDictT[pobj.companyInfo.companyPropertiesName];
pobj.baseInfo.companyProperties = pobj.companyInfo.companyProperties;
pobj.baseInfo.companyType = pobj.companyInfo.companyProperties;
} }
pobj.baseInfo.companyProperties = pobj.companyInfo.companyProperties; else{
pobj.companyInfo.companyType = pobj.companyInfo.companyProperties; pobj.companyInfo.companyType = pobj.companyInfo.companyPropertiesName;
pobj.baseInfo.companyType = pobj.companyInfo.companyProperties; pobj.baseInfo.companyProperties = pobj.companyInfo.companyPropertiesName;
pobj.baseInfo.companyType = pobj.companyInfo.companyPropertiesName;
}
} }
if (pobj.companyInfo.engagedIndName && pobj.companyInfo.engagedIndName != 'undefined') { if (pobj.companyInfo.engagedIndName && pobj.companyInfo.engagedIndName != 'undefined') {
pobj.companyInfo.engagedIndustry = appconfig.pdict.engagedIndustryDictT[pobj.companyInfo.engagedIndName]; pobj.companyInfo.engagedIndustry = appconfig.pdict.engagedIndustryDictT[pobj.companyInfo.engagedIndName];
...@@ -732,8 +740,6 @@ class DeliverybillCtl extends CtlBase { ...@@ -732,8 +740,6 @@ class DeliverybillCtl extends CtlBase {
} }
} }
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");
...@@ -809,7 +815,7 @@ class DeliverybillCtl extends CtlBase { ...@@ -809,7 +815,7 @@ class DeliverybillCtl extends CtlBase {
} }
module.exports = DeliverybillCtl; module.exports = DeliverybillCtl;
// var task = new DeliverybillCtl(); //var task = new DeliverybillCtl();
// var d = new Date("2020-06-05"); // var d = new Date("2020-06-05");
// console.log("dddddddddddd:" + d); // console.log("dddddddddddd:" + d);
// var oneYear = task.oneYearPast(d,1); // var oneYear = task.oneYearPast(d,1);
......
...@@ -10,8 +10,9 @@ class SchemeCtl extends CtlBase { ...@@ -10,8 +10,9 @@ class SchemeCtl extends CtlBase {
super("bizchance", CtlBase.getServiceName(SchemeCtl)); super("bizchance", CtlBase.getServiceName(SchemeCtl));
this.bizoptService = system.getObject("service.bizchance.bizoptSve"); this.bizoptService = system.getObject("service.bizchance.bizoptSve");
this.logService = system.getObject("service.bizchance.statuslogSve"); this.logService = system.getObject("service.bizchance.statuslogSve");
this.receiveUrl = "http://192.168.1.140:4011/api/receive/entService/springBoard"; this.receiveUrl = settings.receiveUrl();
// this.queueUrl = "http://192.168.1.128:4018/api/queueAction/producer/springBoard"; //this.queueUrl = settings.queueUrl();
//this.wdyUrl = settings.wdyUrl();
} }
/*根据id获取方案信息详情*/ /*根据id获取方案信息详情*/
......
var path = require('path'); var path = require('path');
var ENVINPUT={ var ENVINPUT = {
DB_HOST:process.env.DB_HOST, DB_HOST: process.env.DB_HOST,
DB_PORT:process.env.DB_PORT, DB_PORT: process.env.DB_PORT,
DB_USER:process.env.DB_USER, DB_USER: process.env.DB_USER,
DB_PWD:process.env.DB_PWD, DB_PWD: process.env.DB_PWD,
DB_NAME:process.env.PAAS_DB_NAME, DB_NAME: process.env.PAAS_DB_NAME,
REDIS_HOST:process.env.REDIS_HOST, REDIS_HOST: process.env.REDIS_HOST,
REDIS_PORT:process.env.REDIS_PORT, REDIS_PORT: process.env.REDIS_PORT,
REDIS_PWD:process.env.REDIS_PWD, REDIS_PWD: process.env.REDIS_PWD,
REDIS_DB:process.env.PAAS_REDIS_DB, REDIS_DB: process.env.PAAS_REDIS_DB,
APP_ENV:process.env.APP_ENV?process.env.APP_ENV:"dev" APP_ENV: process.env.APP_ENV ? process.env.APP_ENV : "dev"
}; };
var settings = { var settings = {
env:ENVINPUT.APP_ENV, env: ENVINPUT.APP_ENV,
salt: "%iatpD1gcxz7iF#B", salt: "%iatpD1gcxz7iF#B",
defaultpwd:"gsb2020", defaultpwd: "gsb2020",
basepath : path.normalize(path.join(__dirname, '../..')), basepath: path.normalize(path.join(__dirname, '../..')),
port : process.env.NODE_PORT || 8888, port: process.env.NODE_PORT || 8888,
kongurl: function(){ kongurl: function () {
if(this.env=="dev"){ if (this.env == "dev") {
return localsettings.kongurl; return localsettings.kongurl;
}else { } else {
return ENVINPUT.KONG_ADMIAN; return ENVINPUT.KONG_ADMIAN;
} }
}, },
pmappid:1, receiveUrl: function () {
pmcompanyid:1, if (this.env == "dev") {
pmroleid:{"ta":1,"pr":2}, return "http://192.168.1.140:4011/api/receive/entService/springBoard";
redis:function(){ } else {
if(this.env=="dev"){ return "";
var localsettings=require("./localsettings"); }
},
queueUrl: function () {
if (this.env == "dev") {
return "http://192.168.1.128:4018/api/queueAction/producer/springBoard";
} else {
return "";
}
},
wdyUrl: function () {
if (this.env == "dev") {
return "http://192.168.1.113:4011/api/action/order/springBoard";
} else {
return "";
}
},
pmappid: 1,
pmcompanyid: 1,
pmroleid: { "ta": 1, "pr": 2 },
redis: function () {
if (this.env == "dev") {
var localsettings = require("./localsettings");
return localsettings.redis; return localsettings.redis;
}else { } else {
return { return {
host:ENVINPUT.REDIS_HOST, host: ENVINPUT.REDIS_HOST,
port:ENVINPUT.REDIS_PORT, port: ENVINPUT.REDIS_PORT,
password:ENVINPUT.REDIS_PWD, password: ENVINPUT.REDIS_PWD,
db:ENVINPUT.REDIS_DB, db: ENVINPUT.REDIS_DB,
}; };
} }
}, },
database:function(){ database: function () {
if(this.env=="dev"){ if (this.env == "dev") {
var localsettings=require("./localsettings"); var localsettings = require("./localsettings");
return localsettings.database; return localsettings.database;
}else{ } else {
return { return {
dbname : ENVINPUT.DB_NAME, dbname: ENVINPUT.DB_NAME,
user : ENVINPUT.DB_USER, user: ENVINPUT.DB_USER,
password : ENVINPUT.DB_PWD, password: ENVINPUT.DB_PWD,
config : { config: {
host: ENVINPUT.DB_HOST, host: ENVINPUT.DB_HOST,
dialect: 'mysql', dialect: 'mysql',
operatorsAliases: false, operatorsAliases: false,
pool: { pool: {
max: 5, max: 5,
min: 0, min: 0,
acquire: 90000000, acquire: 90000000,
idle: 1000000 idle: 1000000
}, },
debug:false, debug: false,
timezone:'+08:00', timezone: '+08:00',
dialectOptions:{ dialectOptions: {
requestTimeout: 999999, requestTimeout: 999999,
// instanceName:'DEV' // instanceName:'DEV'
} //设置MSSQL超时时间 } //设置MSSQL超时时间
}, },
}; };
} }
} }
}; };
settings.ENVINPUT=ENVINPUT; settings.ENVINPUT = ENVINPUT;
module.exports = settings; 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