Commit 19645d24 by 高宇强

gyq

parent 0d76bb45
......@@ -8,6 +8,7 @@ const appconfig = system.getSysConfig();
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";
}
......@@ -45,31 +46,36 @@ class BizOptCtl extends CtlBase {
{
try{
var rs = await this.service.findInfoByDemandCode(pobj);
var ms = await this.schemeService.findInfoByDemandCode(pobj);
var rarr = {}
if (rs){
rarr.id = rs.id;//数据的id
rarr.businessMode = rs.demand_code;//商机编号
rarr.channelSource = rs.source_name;//渠道来源
rarr.businessType = rs.business_type;//商机类型代码
rarr.businessName = appconfig.pdict.businessType[rarr.businessType];//商机类型名称
rarr.currentStatus = rs.business_status;//商机状态
rarr.serviceCode = rs.service_address;//服务地区
if (rarr.businessName == "园区注册"){
rarr.serviceName = appconfig.pdict.registeredParkDict[rarr.serviceCode];//服务地区名称
var statusInfo = {"currentStatus":rs.business_status};//商机状态
var bussinessInfo = {};
bussinessInfo.businessMode = rs.demand_code;//商机编号
bussinessInfo.channelSource = rs.source_name;//渠道来源
bussinessInfo.businessType = rs.business_type;//商机类型代码
bussinessInfo.businessName = appconfig.pdict.businessType[rarr.businessType];//商机类型名称
bussinessInfo.serviceCode = rs.service_address;//服务地区
if (bussinessInfo.businessName == "云上园区注册"){
bussinessInfo.serviceName = appconfig.pdict.registeredParkDict[bussinessInfo.serviceCode];//服务地区名称
}
else{
rarr.serviceName = appconfig.pdict.registeredAreaDict[rarr.serviceCode];//服务地区名称
bussinessInfo.serviceName = appconfig.pdict.registeredAreaDict[bussinessInfo.serviceCode];//服务地区名称
}
rarr.statusReason = rs.close_reason;//商机关闭原因
rarr.clerkName = rs.salesman_name;//业务员名称
rarr.clerkPhone = rs.salesman_phone;//业务员联系方式
rarr.memoInfo = rs.business_info.memoInfo;//备注信息
rarr.contactsName = rs.business_info.contactsName;//联系人名称
rarr.contactsPhone = rs.business_info.contactsPhone;//联系人联系方式
rarr.servicerCode = rs.facilitator_id;//服务商编码
rarr.servicerName = rs.facilitator_name;//服务商名称
rarr.createdTime = this.timeFormat(rs.created_at);//商机创建时间
rarr.statusTime = this.timeFormat(rs.updated_at);//当前状态时间
bussinessInfo.statusReason = rs.close_reason;//商机关闭原因
bussinessInfo.memoInfo = rs.business_info.memoInfo;//备注信息
bussinessInfo.contactsName = rs.business_info.contactsName;//联系人名称
bussinessInfo.contactsPhone = rs.business_info.contactsPhone;//联系人联系方式
bussinessInfo.createdTime = this.timeFormat(rs.created_at);//商机创建时间
rarr.push(statusInfo);
rarr.push(bussinessInfo);
}
if (ms){
var planInfo = ms.scheme_info;
planInfo.schemeNumber = ms.scheme_number;
planInfo.currentStatus = ms.scheme_status;
planInfo.statusReason = ms.reject_reason;
rarr.push(planInfo);
}
return system.getResult(rarr);
}
......@@ -87,6 +93,7 @@ class BizOptCtl extends CtlBase {
if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.currentStatus && pobj.currentStatus != 'undefined'){
try{
var res = await this.service.updateStatusByDemandCode(pobj);
await this.schemeService.updateStatusByDemandCode(pobj);//同时更新方案的状态
//调商城接口,回传状态信息,后加
if (pobj.currentStatus == "isClosed"){
var rc = system.getObject("util.execClient");
......@@ -104,7 +111,7 @@ class BizOptCtl extends CtlBase {
return system.getResult("操作成功!");
}
else{
return system.getResultError("提交方案出错!");
return system.getResultError("更新方案状态出错!");
}
}
}
......
......@@ -28,6 +28,7 @@ class DeliverybillCtl extends CtlBase {
robj.sourceName = element.source_name;//渠道来源
robj.channelNumber = element.source_number;//渠道编码
robj.baseInfo = element.delivery_info;//交付单详情
robj.payStatus = element.delivery_info.payStatus;//交付状态
if (robj.businessName == '公司注册'){
if (robj.baseInfo.isWhether == "是" || robj.baseInfo.isVirtual == "是"){//如果有刻章需求或者是虚拟地址
robj.relatedProducts = '有';
......@@ -230,7 +231,7 @@ class DeliverybillCtl extends CtlBase {
}
/*根据交付单编号更新交付单状态*/
async updateInfoByDeliverCode(pobj,qobj,req){
async updateStatusByDeliverCode(pobj,qobj,req){
if (pobj.deliverNumber && pobj.deliverNumber != 'undefined' && pobj.deliverStatus && pobj.deliverStatus != 'undefined'){
try{
var res = await this.service.updateInfoByDeliverCode(pobj);
......@@ -247,6 +248,9 @@ class DeliverybillCtl extends CtlBase {
}
}
/*根据插入交付单信息*/
async insertInfo(pobj,qobj,req){
if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.schemeNumber && pobj.schemeNumber != 'undefined'){
try{
......
......@@ -94,11 +94,11 @@ class SchemeCtl extends CtlBase {
}
}
/*根据方案编号获取方案详情*/
async findInfoBySchemeNumber(pobj, qobj, req){
if (pobj.schemeNumber && pobj.schemeNumber != 'undefined'){
/*根据商机编号获取方案详情*/
async findInfoByDemandCode(pobj, qobj, req){
if (pobj.businessMode && pobj.businessMode != 'undefined'){
try{
var rs = await this.service.findInfoBySchemeNumber(pobj);
var rs = await this.service.findInfoByDemandCode(pobj);
var rarr = {}
if (rs){
rarr.businessMode = rs.demand_code;//商机编号
......@@ -175,11 +175,11 @@ class SchemeCtl extends CtlBase {
}
}
/* 根据方案编号更新方案状态及原因 */
async updateStatusBySchemeNumber(pobj, qobj, req){
if (pobj.schemeNumber && pobj.schemeNumber != 'undefined' && pobj.currentStatus && pobj.currentStatus != 'undefined'){
/* 根据商机编号更新方案状态及原因 */
async updateStatusByDemandCode(pobj, qobj, req){
if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.currentStatus && pobj.currentStatus != 'undefined'){
try{
await this.service.updateStatusBySchemeNumber(pobj);
await this.service.updateStatusByDemandCode(pobj);
return system.getResult("更新成功!");
}
catch(error){
......@@ -191,17 +191,14 @@ class SchemeCtl extends CtlBase {
}
}
/*根据方案编号更新方案详情*/
async updateInfoBySchemeNumber(pobj, qobj, req){
if (pobj.schemeNumber && pobj.schemeNumber != 'undefined'){
/*根据商机编号更新方案详情*/
async updateInfoByDemandCode(pobj, qobj, req){
if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.planInfo && pobj.planInfo != 'undefined'){
try{
var retn = await this.service.updateInfoBySchemeNumber(pobj);
if (retn == -1){
return system.getResultError("要更新的数据不存在!");
}
else{
return system.getResult("更新成功!");
}
var retn = await this.service.updateInfoByDemandCode(pobj);
var bobj = {"businessMode":pobj.businessMode,"currentStatus":"beforeSubmission"};//把商机状态更新回待提交方案
await this.bizoptService.updateStatusByDemandCode(bobj);
return system.getResult("更新成功!");
}
catch(error){
return system.getResultError(error);
......@@ -244,7 +241,7 @@ class SchemeCtl extends CtlBase {
pobj.clerkId = businessInfo.salesman_id;//业务员id
pobj.clerkName = businessInfo.salesman_name;//业务员名称
pobj.clerkPhone = businessInfo.salesman_phone;//业务员联系电话
pobj.currentStatus = businessInfo.business_status;//商机状态即为方案状态
pobj.currentStatus = appconfig.pdict.businessStatus[businessInfo.business_status];//商机状态即为方案状态
pobj.statusReason = businessInfo.close_reason;//状态原因
}
var mobj = pobj;
......
......@@ -26,7 +26,7 @@ class DeliverybillDao extends Dao {
}
/*根据交付单编号更新状态信息*/
async updateInfoByDeliverCode(qobj,t){
async updateStatusByDeliverCode(qobj,t){
var setobj = {"delivery_status":qobj.deliverStatus};
if (qobj.statusReason && qobj.statusReason != 'undefined'){
setobj.close_reason = qobj.statusReason;
......@@ -35,20 +35,27 @@ class DeliverybillDao extends Dao {
return await this.updateByWhere(setobj,whereobj,t);
}
// /*根据交付单更新交付材料信息*/
// async UpdateInfoByDeliverCode(qobj,t){
// // var
// }
/*插入交付单信息*/
async insertInfo(qobj,t){
async insertInfo(qobj,t){//到时候看交付单信息后再确定
var obj = {
"demand_code":qobj.businessMode,
"scheme_number":qobj.schemeNumber
"scheme_number":qobj.schemeNumber,
"delivery_code":qobj.deliverNumber,
"delivery_status":"received"
};
if (qobj.deliverNumber && qobj.deliverNumber != 'undefined'){
obj.delivery_code = qobj.deliverNumber;
}
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;
......@@ -83,45 +90,45 @@ class DeliverybillDao extends Dao {
if (qobj.payAmount && qobj.payAmount != 'undefined'){
obj.selling_price = qobj.payAmount;
}
if (qobj.deliverStatus && qobj.deliverStatus != 'undefined'){
obj.delivery_status = qobj.deliverStatus;
}
// 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.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;
}
......
......@@ -5,123 +5,27 @@ class SchemeDao extends Dao {
super(Dao.getModelName(SchemeDao));
}
/*根据方案编号获取方案信息详情*/
async findInfoBySchemeNumber(qobj){
var qcwhere = {"scheme_number":qobj.schemeNumber};
/*根据商机编号获取方案信息详情*/
async findInfoByDemandCode(qobj){
var qcwhere = {"demand_code":qobj.businessMode};
return await this.findOne(qcwhere);
}
/*根据方案编号更新方案状态及原因*/
async updateStatusBySchemeNumber(qobj,t){
async updateStatusByDemandCode(qobj,t){
var setobj = {"scheme_status":qobj.currentStatus};
if (qobj.statusReason && qobj.statusReason != 'undefined'){
setobj["reject_reason"] = qobj.statusReason;
}
var whereobj = {"scheme_number":qobj.schemeNumber};
var whereobj = {"demand_code":qobj.businessMode};
return await this.updateByWhere(setobj,whereobj,t);
}
/*根据方案编号更新方案详情*/
async updateInfoBySchemeNumber(qobj,t){
var whereobj = {"scheme_number":qobj.schemeNumber};
var setobj = await this.findOne(whereobj);
if (setobj){
if (qobj.businessMode && qobj.businessMode != 'undefined'){
setobj.demand_code = qobj.businessMode;
}
if (qobj.statusReason && qobj.statusReason != 'undefined'){
setobj.reject_reason = qobj.statusReason;
}
if (qobj.memoInfo && qobj.memoInfo != 'undefined'){
setobj.remark_info = qobj.memoInfo;
}
if (qobj.businessId && qobj.businessId != 'undefined'){
setobj.bizopt_id = qobj.businessId;
}
if (qobj.servicerCode && qobj.servicerCode != 'undefined'){
setobj.facilitator_id = qobj.servicerCode;
}
if (qobj.servicerName && qobj.servicerName != 'undefined'){
setobj.facilitator_name = qobj.servicerName;
}
if (qobj.clerkOpcode && qobj.clerkOpcode != 'undefined'){
setobj.salesman_opcode = qobj.clerkOpcode;
}
if (qobj.clerkId && qobj.clerkId != 'undefined'){
setobj.salesman_id = qobj.clerkId;
}
if (qobj.clerkName && qobj.clerkName != 'undefined'){
setobj.salesman_name = qobj.clerkName;
}
if (qobj.clerkPhone && qobj.clerkPhone != 'undefined'){
setobj.salesman_phone = qobj.clerkPhone;
}
if (qobj.taxpayerType && qobj.taxpayerType != 'undefined'){
setobj.scheme_info.taxpayerType = qobj.taxpayerType;
}
if (qobj.registeredType && qobj.registeredType != 'undefined'){
setobj.scheme_info.registeredType = qobj.registeredType;
}
if (qobj.companyProperties && qobj.companyProperties != 'undefined'){
setobj.scheme_info.companyProperties = qobj.companyProperties;
}
if (qobj.engagedIndustry && qobj.engagedIndustry != 'undefined'){
setobj.scheme_info.engagedIndustry = qobj.engagedIndustry;
}
if (qobj.addressType && qobj.addressType != 'undefined'){
setobj.scheme_info.addressType = qobj.addressType;
}
if (qobj.fullAddress && qobj.fullAddress != 'undefined'){
setobj.scheme_info.fullAddress = qobj.fullAddress;
}
if (qobj.businessScope && qobj.businessScope != 'undefined'){
setobj.scheme_info.businessScope = qobj.businessScope;
}
if (qobj.isWhether && qobj.isWhether != 'undefined'){
setobj.scheme_info.isWhether = qobj.isWhether;
}
if (qobj.whetherType && qobj.whetherType != 'undefined'){
setobj.scheme_info.whetherType = qobj.whetherType;
}
if (qobj.subjectType && qobj.subjectType != 'undefined'){
setobj.scheme_info.subjectType = qobj.subjectType;
}
if (qobj.buyTime && qobj.buyTime != 'undefined'){
setobj.scheme_info.buyTime = qobj.buyTime;
}
if (qobj.buyDuration && qobj.buyDuration != 'undefined'){
setobj.scheme_info.buyDuration = qobj.buyDuration;
}
if (qobj.isRenew && qobj.isRenew != 'undefined'){
setobj.scheme_info.isRenew = qobj.isRenew;
}
if (qobj.creditCode && qobj.creditCode != 'undefined'){
setobj.scheme_info.creditCode = qobj.creditCode;
}
if (qobj.companyType && qobj.companyType != 'undefined'){
setobj.scheme_info.companyType = qobj.companyType;
}
if (qobj.establishedTime && qobj.establishedTime != 'undefined'){
setobj.scheme_info.establishedTime = qobj.establishedTime;
}
if (qobj.registeredCapital && qobj.registeredCapital != 'undefined'){
setobj.scheme_info.registeredCapital = qobj.registeredCapital;
}
if (qobj.shareholderName && qobj.shareholderName != 'undefined'){
setobj.scheme_info.shareholderName = qobj.shareholderName;
}
if (qobj.businessTerm && qobj.businessTerm != 'undefined'){
setobj.scheme_info.businessTerm = qobj.businessTerm;
}
if (qobj.residenceAddress && qobj.residenceAddress != 'undefined'){
setobj.scheme_info.residenceAddress = qobj.residenceAddress;
}
return await this.updateByWhere(setobj,whereobj,t);
}
else{
return -1;
}
async updateInfoByDemandCode(qobj,t){
var whereobj = {"demand_code":qobj.businessMode};
var setobj = {"scheme_info":qobj.planInfo};
return await this.updateByWhere(setobj,whereobj,t);
}
/*根据商机编号更新方案编号*/
......
......@@ -17,7 +17,7 @@ module.exports = {
},
"businessType": {//商机类型
"companyCase": "公司注册",
"psCase":"园区注册",
"psCase":"云上园区注册",
// "psCase": "个体户注册",
// "soleCase": "个人独资企业注册",
"agentCase": "代理记账",
......@@ -34,7 +34,6 @@ module.exports = {
"beforeSubmission": "待提交方案",
"beforeConfirmation": "待用户确认",
"isFinished": "已成交",
"isexpired":"已到期",// 注册地址和代理记账
"isClosed": "已关闭"
},
"deliverStatus": {//交付单状态
......
......@@ -19,23 +19,23 @@ class SchemeService extends ServiceBase {
}
/*根据方案编号获取方案详情*/
async findInfoBySchemeNumber(qobj){
return await this.dao.findInfoBySchemeNumber(qobj);
async findInfoByDemandCode(qobj){
return await this.dao.findInfoByDemandCode(qobj);
}
/* 根据方案编号更新方案状态及原因 */
async updateStatusBySchemeNumber(qobj){
/* 根据商机编号号更新方案状态及原因 */
async updateStatusByDemandCode(qobj){
var self=this;
return self.db.transaction(async function (t) {
return await self.dao.updateStatusBySchemeNumber(qobj,t);
return await self.dao.updateStatusByDemandCode(qobj,t);
});
}
/*根据方案编号更新方案详情*/
async updateInfoBySchemeNumber(qobj){
/*根据商机编号更新方案详情*/
async updateInfoByDemandCode(qobj){
var self = this;
return self.db.transaction(async function (t) {
return await self.dao.updateInfoBySchemeNumber(qobj,t);
return await self.dao.updateInfoByDemandCode(qobj,t);
});
}
......
......@@ -18,10 +18,10 @@ class DeliverybillService extends ServiceBase {
}
/* 根据交付单编号更新交付单状态 */
async updateInfoByDeliverCode(qobj){
async updateStatusByDeliverCode(qobj){
var self=this;
return self.db.transaction(async function (t) {
return await self.dao.updateInfoByDeliverCode(qobj,t);
return await self.dao.updateStatusByDeliverCode(qobj,t);
});
}
......
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