Commit c64e897e by 王勇飞

gyq

parent 9cf7636e
......@@ -9,7 +9,9 @@ class BizOptCtl extends CtlBase {
constructor() {
super("bizchance", CtlBase.getServiceName(BizOptCtl));
this.schemeService = system.getObject("service.bizchance.schemeSve");
this.receiveUrl = "http://192.168.1.140:4011/api/receive/entService/springBoard";
this.logService = system.getObject("service.bizchance.statuslogSve");
this.receiveUrl = "http://192.168.1.128:4011/api/receive/entService/springBoard";
this.queueUrl = "http://192.168.1.128:4018/api/queueAction/producer/springBoard";
}
/*根据用户id获取商机信息,分页获取*/
......@@ -98,20 +100,37 @@ class BizOptCtl extends CtlBase {
}
/*根据商机编号更新商机状态*/
async updateStatusByDemandCode(pobj,qobj,req){//关闭需求时调用
async updateStatusByDemandCode(pobj,qobj,req){
if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.currentStatus && pobj.currentStatus != 'undefined'){
try{
var res = await this.service.updateStatusByDemandCode(pobj);
await this.service.updateStatusByDemandCode(pobj);
await this.schemeService.updateStatusByDemandCode(pobj);//同时更新方案的状态
//如果商机状态为关闭,需要回传给商城
if (pobj.currentStatus == "isClosed"){
var res = this.service.findInfoByDemandCode(pobj);
if (res && res != 'undefined'){
var logInfo = {
"flowType":"BIZ",
"flowId":res.id,
"statusCode":pobj.currentStatus,
"statusReason":res.close_reason,
"clerkName":res.salesman_name,
"clerkId":res.salesman_id
}
await this.logService.insertInfo(logInfo);//插入状态日至表
}
if (pobj.currentStatus == "isClosed"){ //关闭需求时调用
var rc = system.getObject("util.execClient");
var requrl = this.receiveUrl;
var requrl = this.queueUrl;
var params = {
"actionType":"closeNeed",
"actionType":"produceData",
"actionBody":{
"needNum": pobj.businessMode,
"note":pobj.statusReason
"pushUrl":this.receiveUrl,
"actionType":"closeNeed",
"identifyCode":"ic-manage",
"messageBody":{
"needNum": pobj.businessMode,
"note":pobj.statusReason
}
}
}
var rtn = await rc.execPost(params, requrl);
......@@ -138,8 +157,23 @@ class BizOptCtl extends CtlBase {
if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.businessType && pobj.businessType != 'undefined'){
try{
pobj.currentStatus = "beforeSubmission";//加上当前状态为待提交方案
await this.service.insertInfo(pobj);
return system.getResult("插入成功!");
pobj.channelSource = "tencentCloud";//目前渠道只有腾讯
pobj.sourceNumber = "1111111";
var buInfo = await this.service.insertInfo(pobj);
var logInfo = {
"flowType":"BIZ",
"flowId":buInfo.id,
"statusCode":pobj.currentStatus,
"clerkName":pobj.clerkName,
"clerkId":pobj.salesmanId
}
await this.logService.insertInfo(logInfo);//插入状态日至表
return {
"status":1, //1代表成功,否则失败
"message":"操作成功",
"data":"",
"requestId":""
};
}
catch(error){
......
......@@ -50,24 +50,24 @@ class CacheInfoCtl extends CtlBase {
/*插入或更新缓存信息 */
async createInfo(pobj,qobj,req){
if (pobj.deliverNumber && pobj.deliverNumber != 'undefined' && pobj.cacheInfo && pobj.cacheInfo != 'undefined'){
try{
var rs = await this.service.findInfoByDeliverId(pobj);
if (rs){
await this.service.updateInfoByDeliverId(pobj);
}
else{
await this.service.insertInfo(pobj);
}
return system.getResult("操作成功!");
try{
var rs = await this.service.findInfoByDeliverId(pobj);
if (rs){
await this.service.updateInfoByDeliverId(pobj);
}
catch (error){
return system.getResultError(error);
else{
await this.service.insertInfo(pobj);
}
return system.getResult("操作成功!");
}
else{
return system.getResultError("参数错误!");
catch (error){
return system.getResultError(error);
}
}
else{
return system.getResultError("参数错误!");
}
}
timeFormat(date) {
......
......@@ -9,7 +9,9 @@ class SchemeCtl extends CtlBase {
constructor() {
super("bizchance", CtlBase.getServiceName(SchemeCtl));
this.bizoptService = system.getObject("service.bizchance.bizoptSve");
this.receiveUrl = "http://192.168.1.140:4011/api/receive/entService/springBoard";
this.logService = system.getObject("service.bizchance.statuslogSve");
this.receiveUrl = "http://192.168.1.128:4011/api/receive/entService/springBoard";
// this.queueUrl = "http://192.168.1.128:4018/api/queueAction/producer/springBoard";
}
/*根据id获取方案信息详情*/
......@@ -139,6 +141,26 @@ class SchemeCtl extends CtlBase {
if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.currentStatus && pobj.currentStatus != 'undefined'){
try{
await this.service.updateStatusByDemandCode(pobj);
var res= thsi.service.findInfoByDemandCode(pobj);
if (res){
var logInfo = {
"flowType":"SCHEME",
"flowId":res.id,
"statusCode":res.scheme_status,
"statusReason":res.reject_reason,
"clerkName":res.salesman_name,
"clerkId":res.salesman_id
}
await this.logService.insertInfo(logInfo);//插入状态日至表
}
if (pobj.currentStatus == "已退回"){
var parms ={
"businessMode": pobj.businessMode,
"currentStatus": "beforeSubmission"
}
await this.bizoptService.updateStatusByDemandCode(parms);//把商机状态修改为待提交方案
}
return system.getResult("更新成功!");
}
catch(error){
......@@ -182,12 +204,13 @@ class SchemeCtl extends CtlBase {
if (pobj.baseInfo.psSealSevCase && pobj.baseInfo.psSealSevCase != 'undefined'){
pobj.baseInfo.isWhether = pobj.baseInfo.psSealSevCase
}
//纳税人类型
if (pobj.baseInfo.psTaxpayerType && pobj.baseInfo.psTaxpayerType != 'undefined'){
pobj.baseInfo.taxpayerType = pobj.baseInfo.taxpayerType;
pobj.baseInfo.taxpayerType = pobj.baseInfo.psTaxpayerType;
}
if (pobj.baseInfo.cmpTaxPayerType && pobj.baseInfo.cmpTaxPayerType != 'undefined'){
pobj.baseInfo.taxpayerType = pobj.baseInfo.taxpayerType;
pobj.baseInfo.taxpayerType = pobj.baseInfo.cmpTaxPayerType;
}
if (pobj.baseInfo.agentTaxpayerType && pobj.baseInfo.agentTaxpayerType != 'undefined'){
pobj.baseInfo.taxpayerType = pobj.baseInfo.agentTaxpayerType;
......@@ -271,7 +294,7 @@ class SchemeCtl extends CtlBase {
var rc = system.getObject("util.execClient");
var requrl = this.receiveUrl;
var params = {
"actionType":"submitSolution",
"actionType":"actionType",
"actionBody":{
"needNum": pobj.businessMode,
"solutionNum":pobj.schemeNumber,
......@@ -280,11 +303,10 @@ class SchemeCtl extends CtlBase {
}
var rtn = await rc.execPost(params, requrl);
var j = JSON.parse(rtn.stdout);
console.log("777777777777777777");
console.log(JSON.stringify(j));
if (j.status == 1){
pobj.businessType = ttype;
var retn = await this.service.updateInfoByDemandCode(pobj);//更新方案详情
pobj.schemeNumber = j.data;
await this.service.updateInfoByDemandCode(pobj);//更新方案详情,同时更新新的方案编号
var bobj = {"businessMode":pobj.businessMode,"currentStatus":"beforeConfirmation"};//同时把商机状态更新回待确认
await this.bizoptService.updateStatusByDemandCode(bobj);
return system.getResult("更新成功!");
......@@ -294,13 +316,10 @@ class SchemeCtl extends CtlBase {
}
}
catch(error){
console.log("ffffffffffffffffffffffffffffffff");
console.log(error);
return system.getResultError(error);
}
}
else{
console.log("DDDDDDDDDDDDDDD");
return system.getResultError("参数错误!");
}
}
......@@ -323,8 +342,6 @@ class SchemeCtl extends CtlBase {
/*插入方案信息*/
async insertInfo(pobj, qobj, req){
console.log("11111111111111111111111");
console.log(JSON.stringify(pobj));
if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.baseInfo && pobj.baseInfo != 'undefined'){//商机编号必须存在
try{
pobj.currentStatus = "beforeConfirmation";//商机状态为待用户确认
......@@ -357,10 +374,10 @@ class SchemeCtl extends CtlBase {
}
//纳税人类型
if (pobj.baseInfo.psTaxpayerType && pobj.baseInfo.psTaxpayerType != 'undefined'){
pobj.baseInfo.taxpayerType = pobj.baseInfo.taxpayerType;
pobj.baseInfo.taxpayerType = pobj.baseInfo.psTaxpayerType;
}
if (pobj.baseInfo.cmpTaxPayerType && pobj.baseInfo.cmpTaxPayerType != 'undefined'){
pobj.baseInfo.taxpayerType = pobj.baseInfo.taxpayerType;
pobj.baseInfo.taxpayerType = pobj.baseInfo.cmpTaxPayerType;
}
if (pobj.baseInfo.agentTaxpayerType && pobj.baseInfo.agentTaxpayerType != 'undefined'){
pobj.baseInfo.taxpayerType = pobj.baseInfo.agentTaxpayerType;
......@@ -454,8 +471,6 @@ class SchemeCtl extends CtlBase {
}
var rtn = await rc.execPost(params, requrl);
var j = JSON.parse(rtn.stdout);
console.log("!!!!!!!!!!!!!!!!");
console.log(JSON.stringify(j));
if (j.status == 1){
pobj.schemeNumber = j.data;
pobj.businessType = btype;
......@@ -469,8 +484,6 @@ class SchemeCtl extends CtlBase {
}
catch(error){
console.log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
console.log(error);
return system.getResultError(error);
}
}
......
......@@ -54,7 +54,7 @@ class BizoptDao extends Dao {
var obj = {
"demand_code": qobj.businessMode,
"business_type": qobj.businessType,
"business_status": "beforeSubmission"
"business_status": qobj.currentStatus
};
if (qobj.channelSource && qobj.channelSource != 'undefined') {
obj.source_name = qobj.channelSource;
......@@ -77,6 +77,9 @@ class BizoptDao extends Dao {
if (qobj.contactsPhone && qobj.contactsPhone != 'undefined') {
obj.business_info.contactsPhone = qobj.contactsPhone;
}
if (qobj.serviceName && qobj.serviceName != 'undefined'){
obj.business_info.serviceName = qobj.serviceName;
}
if (qobj.servicerCode && qobj.servicerCode != 'undefined') {
obj.facilitator_id = qobj.servicerCode;
}
......
......@@ -51,32 +51,52 @@ class DeliverybillDao extends Dao {
setobj.close_reason = qobj.statusReason;
}
var whereobj = { "delivery_code": qobj.deliverNumber };
var rs = await this.findOne(whereobj);
if (rs && rs != 'undefined'){
if (qobj.deliverStatus == "collecting" || qobj.deliverStatus == "received" || qobj.deliverStatus == "paid"){
rs.delivery_info.payStatus = "待交付";
}
else if (qobj.deliverStatus == "closed"){
rs.delivery_info.payStatus = "已关闭";
}
else{
rs.delivery_info.payStatus = "已交付";
}
setobj.delivery_info = rs.delivery_info;
}
return await this.updateByWhere(setobj, whereobj, t);
}
/*根据交付单更新交付材料信息*/
async UpdateInfoByDeliverCode(qobj, t) {//公司注册、云上园区注册时填写交付材料
async updateInfoByDeliverCode(qobj, t) {//公司注册、云上园区注册时填写交付材料
var whereobj = { "delivery_code": qobj.deliverNumber };
var setobj = { "delivery_info": qobj.baseInfo };
if (qobj.deliverStatus && qobj.deliverStatus != 'undefined'){
setobj.delivery_status = qobj.deliverStatus;
}
if (qobj.statusReason && qobj.statusReason != 'undefined') {
setobj.close_reason = qobj.statusReason;
}
return await this.updateByWhere(setobj, whereobj, t);
}
/*插入交付单信息*/
async insertInfo(qobj, t) {//到时候看交付单信息后再确定
var obj = {
"demand_code": qobj.businessMode,
"scheme_number": qobj.schemeNumber,
"delivery_code": qobj.deliverNumber,
"delivery_status": "received"
"delivery_status": qobj.deliverStatus
};
if (qobj.businessMode && qobj.businessMode != 'undefined'){
obj.demand_code = qobj.businessMode;
}
if (qobj.schemeNumber && qobj.schemeNumber != 'undefined'){
obj.scheme_number = qobj.schemeNumber;
}
if (qobj.businessName && qobj.businessName != 'undefined') {
obj.product_name = qobj.businessName;
}
if (qobj.businessType && qobj.businessType != 'undefined') {
obj.product_code = qobj.businessType;
//if (qobj.businessType == "companyCase" || qobj.businessType == "psCase"){
obj.delivery_info.payStatus = "待交付";
//}
}
if (qobj.channelSource && qobj.channelSource != 'undefined') {
obj.source_name = qobj.channelSource;
......@@ -108,54 +128,15 @@ class DeliverybillDao extends Dao {
if (qobj.clerkId && qobj.clerkId != 'undefined') {
obj.salesman_id = qobj.clerkId;
}
if (qobj.payAmount && qobj.payAmount != 'undefined') {
obj.selling_price = qobj.payAmount;
if (qobj.sellingPrice && qobj.sellingPrice != 'undefined') {
obj.selling_price = qobj.sellingPrice;
}
// if (qobj.deliverStatus && qobj.deliverStatus != 'undefined'){
// obj.delivery_status = qobj.deliverStatus;
// }
if (qobj.costPrice && qobj.costPrice != 'undefined') {
obj.cost_price = qobj.costPrice;
}
if (qobj.statusReason && qobj.statusReason != 'undefined') {
obj.close_reason = qobj.statusReason;
}
// if (qobj.isWhether && qobj.isWhether != 'undefined'){
// obj.delivery_info.isWhether = qobj.isWhether;
// }
// if (qobj.isVirtual && qobj.isVirtual != 'undefined'){
// obj.delivery_info.isVirtual = qobj.isVirtual;
// }
// if (qobj.officialSeal && qobj.officialSeal != 'undefined'){
// obj.delivery_info.officialSeal = qobj.officialSeal;
// }
// if (qobj.businessLicense && qobj.businessLicense != 'undefined'){
// obj.delivery_info.businessLicense = obj.businessLicense;
// }
// if (qobj.taxpayerType && qobj.taxpayerType != 'undefined'){
// obj.delivery_info.taxpayerType = qobj.taxpayerType;
// }
// if (qobj.whetherType && qobj.whetherType != 'undefined'){
// obj.delivery_info.whetherType = qobj.whetherType;
// }
// if (qobj.subjectType && qobj.subjectType != 'undefined'){
// obj.delivery_info.subjectType = qobj.subjectType;
// }
// if (qobj.buyTime && qobj.buyTime != 'undefined'){
// obj.delivery_info.buyTime = qobj.buyTime;
// }
// if (qobj.buyDuration && qobj.buyDuration != 'undefined'){
// obj.delivery_info.buyDuration = qobj.buyDuration;
// }
// if (qobj.isRenew && qobj.isRenew != 'undefined'){
// obj.delivery_info.isRenew = qobj.isRenew;
// }
if (qobj.contactsName && qobj.contactsName != 'undefined') {
obj.delivery_info.contactsName = qobj.contactsName;
}
if (qobj.contactsPhone && qobj.contactsPhone != 'undefined') {
obj.delivery_info.contactsPhone = qobj.contactsPhone;
}
return await this.create(obj, t);
}
......
......@@ -25,6 +25,9 @@ class SchemeDao extends Dao {
async updateInfoByDemandCode(qobj,t){
var whereobj = {"demand_code":qobj.businessMode};
var setobj = {"scheme_info":qobj.baseInfo,"scheme_status":qobj.currentStatus};
if (qobj.schemeNumber && qobj.schemeNumber != 'undefined'){
setobj.scheme_number = qobj.schemeNumber;
}
return await this.updateByWhere(setobj,whereobj,t);
}
......
......@@ -10,10 +10,16 @@ class StatuslogDao extends Dao {
var obj = {
"flow_type":qobj.flowType,
"flow_id":qobj.flowId,
"status_code":qobj.statusCode,
"status_code":qobj.statusCode
};
if (qobj.statusDate && qobj.statusDate != 'undefined'){
obj["status_date"] = qobj.statusDate
if (qobj.statusReason && qobj.statusReason != 'undefined'){
obj.status_reason = qobj.statusReason;
}
if (qobj.clerkName && qobj.clerkName != 'undefined'){
obj.salesman_name = qobj.clerkName;
}
if (qobj.clerkId && qobj.clerkId != 'undefined'){
obj.salesman_id = qobj.clerkId;
}
return await this.create(obj,t);
}
......
......@@ -14,14 +14,22 @@ module.exports = (db, DataTypes) => {
allowNull: false,
type: DataTypes.STRING
},
status_date: { // 状态日期
status_reason: { // 状态原因
allowNull: true,
type: DataTypes.DATE
type: DataTypes.STRING
},
status_code: { // 流转状态
allowNull: false,
type: DataTypes.STRING
}
},
salesman_id: {// 业务员id
allowNull: true,
type: DataTypes.STRING
},
salesman_name: { // 业务员姓名
allowNull: true,
type: DataTypes.STRING
}
}, {
paranoid: false,//假的删除
underscored: true,
......
......@@ -14,6 +14,7 @@ class SchemeService extends ServiceBase {
async findInfoByDemandCode(qobj){//根据方案编号获取方案详情
return await this.dao.findInfoByDemandCode(qobj);
}
async updateStatusByDemandCode(qobj){//根据商机编号号更新方案状态及原因
......
......@@ -28,29 +28,26 @@ class DeliverybillService extends ServiceBase {
return apps;
}
/*根据交付单编号获取交付单详情*/
async findInfoByDeliverCode(qobj){
async findInfoByDeliverCode(qobj){//*根据交付单编号获取交付单详情*/
return await this.dao.findInfoByDeliverCode(qobj);
}
/* 根据交付单编号更新交付单状态 */
async updateStatusByDeliverCode(qobj){
async updateStatusByDeliverCode(qobj){//* 根据交付单编号更新交付单状态 */
var self=this;
return self.db.transaction(async function (t) {
return await self.dao.updateStatusByDeliverCode(qobj,t);
});
}
/*更新交付单信息 */
async UpdateInfoByDeliverCode(qobj){
async updateInfoByDeliverCode(qobj){//*更新交付单信息 */
console.log("--------------------------------------------------------------------------------------------------------------------------------------");
var self=this;
return self.db.transaction(async function (t) {
return await self.dao.UpdateInfoByDeliverCode(qobj,t);
return await self.dao.updateInfoByDeliverCode(qobj,t);
});
}
/*插入交付单信息*/
async insertInfo(qobj){//从队列取数据的时候用
async insertInfo(qobj){//*插入交付单信息*/从队列取数据的时候用
var self=this;
return self.db.transaction(async function (t) {
return await self.dao.insertInfo(qobj,t);
......
......@@ -217,7 +217,8 @@ class System {
try {
ClassObj = require(objabspath);
} catch (e) {
// console.log(e)
console.log("ooooooooooooooooooooooooooo");
console.log(e)
let fname = objsettings[packageName + "base"];
ClassObj = require(fname);
}
......
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