Commit 8211cb3c by 蒋勇

Merge branch 'ic-deliver' of gitlab.gongsibao.com:jiangyong/zhichan into ic-deliver

parents e58bab2c c7b5a9c1
...@@ -84,6 +84,12 @@ class BizOptCtl extends CtlBase { ...@@ -84,6 +84,12 @@ class BizOptCtl extends CtlBase {
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"){
planInfo.currentStatus = "已退回";
}
else{
planInfo.currentStatus = ms.scheme_status;
}
planInfo.statusReason = ms.reject_reason; planInfo.statusReason = ms.reject_reason;
rarr.planInfo = planInfo; rarr.planInfo = planInfo;
} }
...@@ -155,8 +161,8 @@ class BizOptCtl extends CtlBase { ...@@ -155,8 +161,8 @@ class BizOptCtl extends CtlBase {
} }
/*插入数据信息 */ /*插入数据信息 */
async insertInfo(mobj,qobj,req){ async insertInfo(nobj,qobj,req){
var pobj = mobj.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";//加上当前状态为待提交方案
......
...@@ -7,6 +7,7 @@ const moment = require('moment'); ...@@ -7,6 +7,7 @@ const moment = require('moment');
class CacheInfoCtl extends CtlBase { class CacheInfoCtl extends CtlBase {
constructor() { constructor() {
super("bizchance", CtlBase.getServiceName(CacheInfoCtl)); super("bizchance", CtlBase.getServiceName(CacheInfoCtl));
this.deliverService = system.getObject("service.bizchance.deliverybillSve");
} }
/*根据交付单id获取缓存详情*/ /*根据交付单id获取缓存详情*/
...@@ -16,11 +17,20 @@ class CacheInfoCtl extends CtlBase { ...@@ -16,11 +17,20 @@ class CacheInfoCtl extends CtlBase {
{ {
try{ try{
var rs = await this.service.findInfoByDeliverId(pobj); var rs = await this.service.findInfoByDeliverId(pobj);
var divInfo = await this.deliverService.findInfoByDeliverCode(pobj);
var rarr = {}; var rarr = {};
if (rs){ if (rs && rs != 'undefined'){
rarr.deliverNumber = rs.deliver_id; rarr.deliverNumber = rs.deliver_id;
rarr.cacheInfo = rs.cache_info; rarr.cacheInfo = rs.cache_info;
rarr.statusInfo = {};
if (divInfo && divInfo != 'undefined'){
rarr.statusInfo.deliverStatus = divInfo.delivery_status;//状态
rarr.statusInfo.statusReason = divInfo.close_reason;//状态原因
rarr.statusInfo.createdTime = this.timeFormat(divInfo.created_at);
rarr.statusInfo.updateTime = this.timeFormat(divInfo.updated_at)
}
} }
return system.getResult(rarr); return system.getResult(rarr);
} }
catch(error){ catch(error){
......
...@@ -11,6 +11,7 @@ class DeliverybillCtl extends CtlBase { ...@@ -11,6 +11,7 @@ class DeliverybillCtl extends CtlBase {
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.logService = system.getObject("service.bizchance.statuslogSve"); this.logService = system.getObject("service.bizchance.statuslogSve");
this.cacheService = system.getObject("service.bizchance.cacheinfoSve");
this.receiveUrl = "http://192.168.1.140:4011/api/receive/entService/springBoard"; this.receiveUrl = "http://192.168.1.140:4011/api/receive/entService/springBoard";
this.queueUrl = "http://192.168.1.128:4018/api/queueAction/producer/springBoard"; this.queueUrl = "http://192.168.1.128:4018/api/queueAction/producer/springBoard";
} }
...@@ -37,10 +38,10 @@ class DeliverybillCtl extends CtlBase { ...@@ -37,10 +38,10 @@ class DeliverybillCtl extends CtlBase {
robj.baseInfo = element.delivery_info;//交付单详情 robj.baseInfo = element.delivery_info;//交付单详情
robj.payStatus = element.delivery_info.payStatus;//交付状态 robj.payStatus = element.delivery_info.payStatus;//交付状态
robj.costPrice = this.FenToYuan(element.cost_price);//成本 robj.costPrice = this.FenToYuan(element.cost_price);//成本
robj.settle_status=element.settle_status; robj.settle_status = element.settle_status;
robj.settlebill=element.settlebill; robj.settlebill = element.settlebill;
if (robj.businessName == '公司注册'){ if (robj.businessName == '公司注册') {
if (robj.baseInfo.isWhether == "是" || robj.baseInfo.isVirtual == "是"){//如果有刻章需求或者是虚拟地址 if (robj.baseInfo.isWhether == "是" || robj.baseInfo.isVirtual == "是") {//如果有刻章需求或者是虚拟地址
robj.relatedProducts = '有'; robj.relatedProducts = '有';
} }
else { else {
...@@ -75,6 +76,28 @@ class DeliverybillCtl extends CtlBase { ...@@ -75,6 +76,28 @@ class DeliverybillCtl extends CtlBase {
} }
} }
/*根据交付单编号获取交付单xinxi*/
async findInfoByDeliverCode(mobj, qobj, req){
var pobj = mobj.d;
if (pobj.deliverNumber && pobj.deliverNumber != 'undefined') {
try{
var rs = await this.service.findInfoByDeliverCode(pobj);
if (rs){
return system.getResult(rs);
}
else{
return system.getResultError("数据不存在");
}
}
catch(error){
return system.getResultError(error);
}
}
else{
return system.getResultError("参数错误!");
}
}
/*根据交付单编号获取交付单详情和材料详情*/ /*根据交付单编号获取交付单详情和材料详情*/
async dealInfo(mobj, qobj, req) { async dealInfo(mobj, qobj, req) {
var pobj = mobj.d; var pobj = mobj.d;
...@@ -116,8 +139,16 @@ class DeliverybillCtl extends CtlBase { ...@@ -116,8 +139,16 @@ class DeliverybillCtl extends CtlBase {
else { else {
rarr.baseInfo.serviceArea = appconfig.pdict.registeredAreaDict[rarr.serviceCode];//服务地区名称 rarr.baseInfo.serviceArea = appconfig.pdict.registeredAreaDict[rarr.serviceCode];//服务地区名称
} }
if (rs.delivery_info.contactsName && rs.delivery_info.contactsName != 'undefined'){
rarr.contactsInfo.contactsName = rs.delivery_info.contactsName;//联系人信息 rarr.contactsInfo.contactsName = rs.delivery_info.contactsName;//联系人信息
rarr.baseInfo.contactsName = rs.delivery_info.contactsName;//联系人信息
}
if (rs.delivery_info.contactsPhone && rs.delivery_info.contactsPhone != 'undefined'){
rarr.contactsInfo.contactsPhone = rs.delivery_info.contactsPhone;//联系电话信息 rarr.contactsInfo.contactsPhone = rs.delivery_info.contactsPhone;//联系电话信息
rarr.baseInfo.contactsPhone = rs.delivery_info.contactsPhone;//联系电话信息
}
if (rs.delivery_info.isWhether && rs.delivery_info.isWhether != 'undefined') { if (rs.delivery_info.isWhether && rs.delivery_info.isWhether != 'undefined') {
rarr.baseInfo.isWhether = rs.delivery_info.isWhether;//是否刻章 rarr.baseInfo.isWhether = rs.delivery_info.isWhether;//是否刻章
} }
...@@ -148,9 +179,9 @@ class DeliverybillCtl extends CtlBase { ...@@ -148,9 +179,9 @@ class DeliverybillCtl extends CtlBase {
} }
if (rs.delivery_info.buyDuration && rs.delivery_info.buyDuration != 'undefined' && rarr.baseInfo.buyTime && rarr.baseInfo.buyTime != 'undefined') { if (rs.delivery_info.buyDuration && rs.delivery_info.buyDuration != 'undefined' && rarr.baseInfo.buyTime && rarr.baseInfo.buyTime != 'undefined') {
var d = new Date(rarr.baseInfo.buyTime); var d = new Date(rarr.baseInfo.buyTime);
rarr.baseInfo.endTime = this.oneYearPast(d,Number(rs.delivery_info.buyDuration));//到期时间 rarr.baseInfo.endTime = this.oneYearPast(d, Number(rs.delivery_info.buyDuration));//到期时间
var ss = moment(); var ss = moment();
rarr.baseInfo.surplusDuration =this.diffDays(ss,rarr.baseInfo.endTime);//剩余时长 rarr.baseInfo.surplusDuration = this.diffDays(ss, rarr.baseInfo.endTime);//剩余时长
} }
if (rs.delivery_info.isRenew && rs.delivery_info.isRenew != 'undefined') { if (rs.delivery_info.isRenew && rs.delivery_info.isRenew != 'undefined') {
rarr.baseInfo.isRenew = rs.delivery_info.isRenew;//是否自动续费 rarr.baseInfo.isRenew = rs.delivery_info.isRenew;//是否自动续费
...@@ -189,6 +220,7 @@ class DeliverybillCtl extends CtlBase { ...@@ -189,6 +220,7 @@ class DeliverybillCtl extends CtlBase {
/*根据交付单编号更新交付单状态*/ /*根据交付单编号更新交付单状态*/
async updateStatusByDeliverCode(mobj, qobj, req) { async updateStatusByDeliverCode(mobj, qobj, req) {
var pobj = mobj.d; var pobj = mobj.d;
console.log("--------------------" + JSON.stringify(pobj));
if (pobj.deliverNumber && pobj.deliverNumber != 'undefined' && pobj.deliverStatus && pobj.deliverStatus != 'undefined') { if (pobj.deliverNumber && pobj.deliverNumber != 'undefined' && pobj.deliverStatus && pobj.deliverStatus != 'undefined') {
try { try {
//调商城接口,回传状态信息,放队列 //调商城接口,回传状态信息,放队列
...@@ -201,26 +233,27 @@ class DeliverybillCtl extends CtlBase { ...@@ -201,26 +233,27 @@ class DeliverybillCtl extends CtlBase {
"actionType": "updateOrderStatus", "actionType": "updateOrderStatus",
"identifyCode": "ic-manage", "identifyCode": "ic-manage",
"messageBody": { "messageBody": {
"orderNum": pobj.businessMode,//订单编码 "orderNum": pobj.deliverNumber,//订单编码
"status": appconfig.pdict.ddyDict[pobj.deliverStatus] "status": appconfig.pdict.ddyDict[pobj.deliverStatus]
//"deliverContent":pobj //"deliverContent":pobj
} }
} }
} }
var rtn = await rc.execPost(params, requrl); var rtn = await rc.execPost(params, requrl);
console.log("_____________________________" + rtn.stdout);
var j = JSON.parse(rtn.stdout); var j = JSON.parse(rtn.stdout);
if (j.status == 1) { if (j.status == 1) {
await this.service.updateStatusByDeliverCode(pobj); await this.service.updateStatusByDeliverCode(pobj);
var pInfo = this.service.findInfoByDeliverCode(pobj); var pInfo = this.service.findInfoByDeliverCode(pobj);
if (pInfo){ if (pInfo) {
var logInfo = { var logInfo = {
"flowType":"DELIVERY", "flowType": "DELIVERY",
"flowId":pInfo.id, "flowId": pInfo.id,
"statusCode":pobj.deliverStatus, "statusCode": pobj.deliverStatus,
"clerkName":pInfo.salesman_name, "clerkName": pInfo.salesman_name,
"clerkId":pInfo.salesman_id "clerkId": pInfo.salesman_id
} }
if (pInfo.statusReason && pInfo.statusReason != 'undefined'){ if (pInfo.statusReason && pInfo.statusReason != 'undefined') {
logInfo.statusReason = pInfo.statusReason; logInfo.statusReason = pInfo.statusReason;
} }
await this.logService.insertInfo(logInfo);//插入状态日至表 await this.logService.insertInfo(logInfo);//插入状态日至表
...@@ -262,9 +295,9 @@ class DeliverybillCtl extends CtlBase { ...@@ -262,9 +295,9 @@ class DeliverybillCtl extends CtlBase {
"actionType": "updateOrderStatus", "actionType": "updateOrderStatus",
"identifyCode": "ic-manage", "identifyCode": "ic-manage",
"messageBody": { "messageBody": {
"orderNum": pobj.businessMode,//订单编码 "orderNum": pobj.deliverNumber,//订单编码
"status": appconfig.pdict.ddyDict[rs.delivery_status], "status": appconfig.pdict.ddyDict[rs.delivery_status],
"deliverContent": rs.delivery_info "deliverContent": {"baseInfo":rs.delivery_info}
} }
} }
} }
...@@ -311,6 +344,7 @@ class DeliverybillCtl extends CtlBase { ...@@ -311,6 +344,7 @@ class DeliverybillCtl extends CtlBase {
//回传信息给庄冰,放队列 //回传信息给庄冰,放队列
var rc = system.getObject("util.execClient"); var rc = system.getObject("util.execClient");
var requrl = this.queueUrl; var requrl = this.queueUrl;
console.log("deliverNumber---------------------------" + pobj.deliverNumber);
var params = { var params = {
"actionType": "produceData", "actionType": "produceData",
"actionBody": { "actionBody": {
...@@ -318,14 +352,15 @@ class DeliverybillCtl extends CtlBase { ...@@ -318,14 +352,15 @@ class DeliverybillCtl extends CtlBase {
"actionType": "updateOrderStatus", "actionType": "updateOrderStatus",
"identifyCode": "ic-manage", "identifyCode": "ic-manage",
"messageBody": { "messageBody": {
"orderNum": pobj.businessMode,//订单编码 "orderNum": pobj.deliverNumber,//订单编码
"status": appconfig.pdict.ddyDict[deliverInfo.delivery_status], "status": appconfig.pdict.ddyDict[deliverInfo.delivery_status],
"deliverContent": rs.delivery_info "deliverContent": {"expressInfo":pobj.expressInfo}
} }
} }
} }
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);
console.log("EXEXEXEXEXEEEEEEEEEEEEEEEEEEE" + rtn.stdout);
if (j.status == 1) { if (j.status == 1) {
await this.materialService.updateInfoByDeliverNumber(pobj); await this.materialService.updateInfoByDeliverNumber(pobj);
return system.getResult("更新成功"); return system.getResult("更新成功");
...@@ -340,7 +375,8 @@ class DeliverybillCtl extends CtlBase { ...@@ -340,7 +375,8 @@ class DeliverybillCtl extends CtlBase {
} }
} }
catch{ catch(error){
console.log("Error-----------------------------------------------" + error);
return system.getResultError(error); return system.getResultError(error);
} }
} }
...@@ -419,6 +455,7 @@ class DeliverybillCtl extends CtlBase { ...@@ -419,6 +455,7 @@ class DeliverybillCtl extends CtlBase {
} }
} }
async settleApplyForTacent(p,q,req){ async settleApplyForTacent(p,q,req){
let ids=p.ids let ids=p.ids
let spname=p.spname let spname=p.spname
...@@ -436,16 +473,105 @@ class DeliverybillCtl extends CtlBase { ...@@ -436,16 +473,105 @@ class DeliverybillCtl extends CtlBase {
/*根据商机编号插入交付单信息*/ /*根据商机编号插入交付单信息*/
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.schemeNumber && pobj.schemeNumber != 'undefined' if (pobj.deliverNumber && pobj.deliverNumber != 'undefined') {
&& pobj.deliverNumber && pobj.deliverNumber != 'undefined') {
try { try {
pobj.deliverStatus = "received"; pobj.deliverStatus = "received";
pobj.businessType = appconfig.pdict.dyDict[pobj.businessType];
if (pobj.companyInfo.companyPropertiesName && pobj.companyInfo.companyPropertiesName != 'undefined') {
if (pobj.businessName == "公司注册"){
pobj.companyInfo.companyProperties = appconfig.pdict.companyNatureDictT[pobj.companyInfo.companyPropertiesName];
}
else if (pobj.businessName == "云上园区注册"){
pobj.companyInfo.companyProperties = appconfig.pdict.registeredTypeDictT[pobj.companyInfo.companyPropertiesName];
}
pobj.deliveryInfo.companyProperties = pobj.companyInfo.companyProperties;
pobj.companyInfo.companyType = pobj.companyInfo.companyProperties;
pobj.deliveryInfo.companyType = pobj.companyInfo.companyProperties;
}
if (pobj.companyInfo.engagedIndName && pobj.companyInfo.engagedIndName != 'undefined') {
pobj.companyInfo.engagedIndustry = appconfig.pdict.engagedIndustryDictT[pobj.companyInfo.engagedIndName];
}
if (pobj.deliveryInfo.taxpayerName && pobj.deliveryInfo.taxpayerName != 'undefined') {
pobj.deliveryInfo.taxpayerType = appconfig.pdict.TaxpayerTypeDictT[pobj.deliveryInfo.taxpayerName];
if (pobj.businessName == "公司注册" || pobj.businessName == "云上园区注册"){
pobj.companyInfo.taxpayerType = pobj.deliveryInfo.taxpayerType;
}
}
pobj.schemeNumber = "";
pobj.channelSource = "tencentCloud";//目前渠道只有腾讯
pobj.channelNumber = "1111111";
pobj.cacheInfo = {
"cmpDeliverInfo":{},
"cmpContactInfo":{}
};
if (pobj.businessMode && pobj.businessMode != 'undefined') {//如果有商机编号,需要取方案编号 if (pobj.businessMode && pobj.businessMode != 'undefined') {//如果有商机编号,需要取方案编号
var schemeInfo = await this.schemeService.findInfoByDemandCode(pobj); var schemeInfo = await this.schemeService.findInfoByDemandCode(pobj);
if (schemeInfo && schemeInfo != 'undefined') { if (schemeInfo && schemeInfo != 'undefined') {
pobj.schemeNumber = schemeInfo.scheme_number; pobj.schemeNumber = schemeInfo.scheme_number;
pobj.cacheInfo.cmpDeliverInfo = schemeInfo.scheme_info;//获取方案中的缓存信息
}
}
//缓存信息和交付单保持一致
console.log("---------------------------------------------------------------------------------------------------------------------------------------");
if (pobj.companyInfo.companyProperties && pobj.companyInfo.companyProperties != 'undefined') {
pobj.cacheInfo.cmpDeliverInfo.companyProperties = pobj.companyInfo.companyProperties;
}
else {
if (pobj.cacheInfo.cmpDeliverInfo.companyType && pobj.cacheInfo.cmpDeliverInfo.companyType) {
pobj.cacheInfo.cmpDeliverInfo.companyProperties = pobj.cacheInfo.cmpDeliverInfo.companyType;
}
}
console.log("---------------------------------------------------------------------------------------------------------------------------------------");
if (pobj.deliveryInfo.memoInfo && pobj.deliveryInfo.memoInfo != 'undefined') {
pobj.cacheInfo.cmpDeliverInfo.memoInfo = pobj.deliveryInfo.memoInfo;
}
if (pobj.deliveryInfo.isWhether && pobj.deliveryInfo.isWhether != 'undefined') {
pobj.cacheInfo.cmpDeliverInfo.isWhether = pobj.deliveryInfo.isWhether;
}
if (pobj.deliveryInfo.addressType && pobj.deliveryInfo.addressType != 'undefined') {
pobj.cacheInfo.cmpDeliverInfo.addressType = pobj.deliveryInfo.addressType;
}
if (pobj.deliveryInfo.companyName && pobj.deliveryInfo.companyName != 'undefined') {
pobj.cacheInfo.cmpDeliverInfo.companyName = pobj.deliveryInfo.companyName;
}
if (pobj.serviceCode && pobj.serviceCode != 'undefined') {
pobj.cacheInfo.cmpDeliverInfo.serviceArea = pobj.serviceCode;
}
if (pobj.serviceName && pobj.serviceName != 'undefined') {
pobj.cacheInfo.cmpDeliverInfo.serviceAreaName = pobj.serviceName;
pobj.deliveryInfo.serviceName = pobj.serviceName;
} }
if (pobj.companyInfo.businessScope && pobj.companyInfo.businessScope != 'undefined') {
pobj.cacheInfo.cmpDeliverInfo.businessScope = pobj.companyInfo.businessScope;
} }
if (pobj.deliveryInfo.taxpayerType && pobj.deliveryInfo.taxpayerType != 'undefined') {
pobj.cacheInfo.cmpDeliverInfo.taxpayerType = pobj.deliveryInfo.taxpayerType;
}
if (pobj.deliveryInfo.taxpayerName && pobj.deliveryInfo.taxpayerName != 'undefined') {
pobj.cacheInfo.cmpDeliverInfo.taxpayerName = pobj.deliveryInfo.taxpayerName;
}
if (pobj.companyInfo.engagedIndustry && pobj.companyInfo.engagedIndustry != 'undefined') {
pobj.cacheInfo.cmpDeliverInfo.engagedIndustry = pobj.companyInfo.engagedIndustry;
}
if (pobj.companyInfo.engagedIndName && pobj.companyInfo.engagedIndName) {
pobj.cacheInfo.cmpDeliverInfo.engagedIndName = pobj.companyInfo.engagedIndName
}
if (pobj.companyInfo.fullAddress && pobj.companyInfo.fullAddress != 'undefined') {
pobj.cacheInfo.cmpDeliverInfo.fullAddress = pobj.companyInfo.fullAddress;
pobj.cacheInfo.cmpDeliverInfo.residenceAddress = pobj.companyInfo.fullAddress;
}
if (pobj.deliveryInfo.contactsName && pobj.deliveryInfo.contactsName != 'undefined'){
pobj.cacheInfo.cmpContactInfo.contactsName = pobj.deliveryInfo.contactsName;
}
if (pobj.deliveryInfo.contactsPhone && pobj.deliveryInfo.contactsPhone != 'undefined'){
pobj.cacheInfo.cmpContactInfo.contactsPhone = pobj.deliveryInfo.contactsPhone;
}
//更新状态给庄冰 //更新状态给庄冰
var rc = system.getObject("util.execClient"); var rc = system.getObject("util.execClient");
var requrl = this.queueUrl; var requrl = this.queueUrl;
...@@ -463,28 +589,27 @@ class DeliverybillCtl extends CtlBase { ...@@ -463,28 +589,27 @@ class DeliverybillCtl extends CtlBase {
} }
} }
var rtn = await rc.execPost(params, requrl); var rtn = await rc.execPost(params, requrl);
console.log("rtn---------------------------" + rtn.stdout);
var j = JSON.parse(rtn.stdout); var j = JSON.parse(rtn.stdout);
if (j.status == 1) { if (j.status == 1) {
var res = await this.service.insertInfo(pobj); // var res = await this.service.insertInfo(pobj);//插入交付单列表
var mobj = { // pobj.deliverId = res.id;
"deliverId": res.id, // //插入暂存
"deliverNumber": pobj.deliverNumber // if (pobj.cacheInfo && (pobj.businessType == "companyCase" || pobj.businessType == "psCase")) {
} // await this.cacheService.insertInfo(pobj);
var logInfo = { // }
"flowType":"DELIVERY", // var logInfo = {
"flowId":res.id, // "flowType": "DELIVERY",
"statusCode":res.delivery_status, // "flowId": res.id,
"statusReason":res.close_reason, // "statusCode": res.delivery_status,
"clerkName":res.salesman_name, // "statusReason": res.close_reason,
"clerkId":res.salesman_id // "clerkName": res.salesman_name,
} // "clerkId": res.salesman_id
await this.logService.insertInfo(logInfo);//插入状态日至表 // }
// await this.logService.insertInfo(logInfo);//插入状态日至表
if (pobj.companyInfo && pobj.companyInfo != 'undefined') { // await this.materialService.insertInfo(pobj);//插入材料信息
mobj.companyInfo = pobj.companyInfo; // return system.getResult("插入成功!");
} return await this.service.insertInfoall(pobj);
await this.materialService.insertInfo(mobj);
return system.getResult("插入成功!");
} }
else { else {
return system.getResultError("插入数据失败!"); return system.getResultError("插入数据失败!");
...@@ -492,6 +617,7 @@ class DeliverybillCtl extends CtlBase { ...@@ -492,6 +617,7 @@ class DeliverybillCtl extends CtlBase {
} }
catch (error) { catch (error) {
console.log("ERROR---------------------------" + error);
return system.getResultError(error); return system.getResultError(error);
} }
} else { } else {
...@@ -546,20 +672,20 @@ class DeliverybillCtl extends CtlBase { ...@@ -546,20 +672,20 @@ class DeliverybillCtl extends CtlBase {
} }
//time时间n年后的的前一天 //time时间n年后的的前一天
oneYearPast(time,n) { oneYearPast(time, n) {
//var time=new Date(); //var time=new Date();
var year = time.getFullYear() + n; var year = time.getFullYear() + n;
var d = time.setFullYear(year); var d = time.setFullYear(year);
var date = time.getDate(d) -1; var date = time.getDate(d) - 1;
var xx = time.setDate(date); var xx = time.setDate(date);
return moment( new Date(xx)).format('yyyy-MM-DD'); return moment(new Date(xx)).format('yyyy-MM-DD');
} }
//计算俩日期相差多少天 //计算俩日期相差多少天
diffDays(time1,time2){ diffDays(time1, time2) {
var m1 = moment(time1); var m1 = moment(time1);
var m2 = moment(time2); var m2 = moment(time2);
return m2.diff(m1,'day'); return m2.diff(m1, 'day');
} }
} }
module.exports = DeliverybillCtl; module.exports = DeliverybillCtl;
......
...@@ -144,7 +144,7 @@ class SchemeCtl extends CtlBase { ...@@ -144,7 +144,7 @@ class SchemeCtl extends CtlBase {
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);
var res= thsi.service.findInfoByDemandCode(pobj); var res= await this.service.findInfoByDemandCode(pobj);
if (res){ if (res){
var logInfo = { var logInfo = {
"flowType":"SCHEME", "flowType":"SCHEME",
...@@ -157,7 +157,7 @@ class SchemeCtl extends CtlBase { ...@@ -157,7 +157,7 @@ class SchemeCtl extends CtlBase {
await this.logService.insertInfo(logInfo);//插入状态日至表 await this.logService.insertInfo(logInfo);//插入状态日至表
} }
if (pobj.currentStatus == "已退回"){ if (pobj.currentStatus == "isReject"){
var parms ={ var parms ={
"businessMode": pobj.businessMode, "businessMode": pobj.businessMode,
"currentStatus": "beforeSubmission" "currentStatus": "beforeSubmission"
...@@ -181,10 +181,10 @@ class SchemeCtl extends CtlBase { ...@@ -181,10 +181,10 @@ class SchemeCtl extends CtlBase {
console.log("------------------------------修改方案------------------------------------"); console.log("------------------------------修改方案------------------------------------");
console.log(JSON.stringify(pobj)); console.log(JSON.stringify(pobj));
console.log("------------------------------修改方案------------------------------------"); console.log("------------------------------修改方案------------------------------------");
if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.schemeNumber && pobj.schemeNumber != 'undefined' if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.schemeNumber && pobj.schemeNumber != 'undefined' && pobj.baseInfo && pobj.baseInfo != 'undefined'){
&& pobj.baseInfo && pobj.baseInfo != 'undefined'){
try{ try{
pobj.currentStatus = "beforeConfirmation";//同时把方案的状态也更新为待确认 pobj.currentStatus = "beforeConfirmation";//同时把方案的状态也更新为待确认
pobj.statusReason = " ";
var businessInfo = await this.bizoptService.findInfoByDemandCode(pobj);//得到商机的信息,插入方案表时要用到 var businessInfo = await this.bizoptService.findInfoByDemandCode(pobj);//得到商机的信息,插入方案表时要用到
if (businessInfo){ if (businessInfo){
pobj.businessId = businessInfo.id;//商机id pobj.businessId = businessInfo.id;//商机id
...@@ -198,6 +198,7 @@ class SchemeCtl extends CtlBase { ...@@ -198,6 +198,7 @@ class SchemeCtl extends CtlBase {
//pobj.currentStatus = appconfig.pdict.businessStatus[businessInfo.business_status];//商机状态即为方案状态 //pobj.currentStatus = appconfig.pdict.businessStatus[businessInfo.business_status];//商机状态即为方案状态
//pobj.statusReason = businessInfo.close_reason;//状态原因 //pobj.statusReason = businessInfo.close_reason;//状态原因
} }
if (pobj.baseInfo.caseRemarks && pobj.baseInfo.caseRemarks != 'undefined'){ if (pobj.baseInfo.caseRemarks && pobj.baseInfo.caseRemarks != 'undefined'){
pobj.baseInfo.memoInfo = pobj.baseInfo.caseRemarks;//备注信息 pobj.baseInfo.memoInfo = pobj.baseInfo.caseRemarks;//备注信息
} }
...@@ -297,7 +298,9 @@ class SchemeCtl extends CtlBase { ...@@ -297,7 +298,9 @@ class SchemeCtl extends CtlBase {
//修改方案的时候,需要把修改的方案传给商城 //修改方案的时候,需要把修改的方案传给商城
var ttype = pobj.businessType; var ttype = pobj.businessType;
console.log("ttype:" + ttype);
pobj.businessType = appconfig.pdict.fdyDict[pobj.businessType]; pobj.businessType = appconfig.pdict.fdyDict[pobj.businessType];
console.log("businessType:" + pobj.businessType);
var rc = system.getObject("util.execClient"); var rc = system.getObject("util.execClient");
var requrl = this.receiveUrl; var requrl = this.receiveUrl;
var params = { var params = {
...@@ -314,7 +317,7 @@ class SchemeCtl extends CtlBase { ...@@ -314,7 +317,7 @@ class SchemeCtl extends CtlBase {
console.log(JSON.stringify(j) + "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII"); console.log(JSON.stringify(j) + "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII");
if (j.status == 1){ if (j.status == 1){
pobj.businessType = ttype; pobj.businessType = ttype;
pobj.schemeNumber = j.data; //pobj.schemeNumber = j.data;
await this.service.updateInfoByDemandCode(pobj);//更新方案详情,同时更新新的方案编号 await this.service.updateInfoByDemandCode(pobj);//更新方案详情,同时更新新的方案编号
var bobj = {"businessMode":pobj.businessMode,"currentStatus":"beforeConfirmation"};//同时把商机状态更新回待确认 var bobj = {"businessMode":pobj.businessMode,"currentStatus":"beforeConfirmation"};//同时把商机状态更新回待确认
await this.bizoptService.updateStatusByDemandCode(bobj); await this.bizoptService.updateStatusByDemandCode(bobj);
...@@ -325,10 +328,12 @@ class SchemeCtl extends CtlBase { ...@@ -325,10 +328,12 @@ class SchemeCtl extends CtlBase {
} }
} }
catch(error){ catch(error){
console.log("EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE" + error);
return system.getResultError(error); return system.getResultError(error);
} }
} }
else{ else{
console.log("CCCCCCCCCCCCCCCCCCCCCCC参数错误!");
return system.getResultError("参数错误!"); return system.getResultError("参数错误!");
} }
} }
...@@ -353,6 +358,7 @@ class SchemeCtl extends CtlBase { ...@@ -353,6 +358,7 @@ class SchemeCtl extends CtlBase {
/*插入方案信息*/ /*插入方案信息*/
async insertInfo(mobj, qobj, req){ async insertInfo(mobj, qobj, req){
var pobj = mobj.d; var pobj = mobj.d;
console.log("22222222222222222" + JSON.stringify(pobj));
if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.baseInfo && pobj.baseInfo != 'undefined'){//商机编号必须存在 if (pobj.businessMode && pobj.businessMode != 'undefined' && pobj.baseInfo && pobj.baseInfo != 'undefined'){//商机编号必须存在
try{ try{
pobj.currentStatus = "beforeConfirmation";//商机状态为待用户确认 pobj.currentStatus = "beforeConfirmation";//商机状态为待用户确认
...@@ -445,12 +451,10 @@ class SchemeCtl extends CtlBase { ...@@ -445,12 +451,10 @@ class SchemeCtl extends CtlBase {
if (pobj.baseInfo.buyDuration && pobj.baseInfo.buyDuration != 'undefined'){ if (pobj.baseInfo.buyDuration && pobj.baseInfo.buyDuration != 'undefined'){
pobj.baseInfo.buyDuration = appconfig.pdict.buyDurationDict[pobj.baseInfo.buyDuration]; pobj.baseInfo.buyDuration = appconfig.pdict.buyDurationDict[pobj.baseInfo.buyDuration];
} }
if (pobj.baseInfo.isRenew ){ if (pobj.baseInfo.isRenew && pobj.baseInfo.isRenew != 'undefined' ){
pobj.baseInfo.isRenew = appconfig.pdict.isRenewDict[pobj.baseInfo.isRenew]; pobj.baseInfo.isRenew = appconfig.pdict.isRenewDict[pobj.baseInfo.isRenew];
} }
else{
pobj.baseInfo.isRenew = "不开启"
}
if (pobj.baseInfo.engagedIndustry && pobj.baseInfo.engagedIndustry != 'undefined'){ if (pobj.baseInfo.engagedIndustry && pobj.baseInfo.engagedIndustry != 'undefined'){
pobj.baseInfo.engagedIndName = appconfig.pdict.engagedIndustryDict[pobj.baseInfo.engagedIndustry];//从事行业名称 pobj.baseInfo.engagedIndName = appconfig.pdict.engagedIndustryDict[pobj.baseInfo.engagedIndustry];//从事行业名称
} }
...@@ -482,6 +486,7 @@ class SchemeCtl extends CtlBase { ...@@ -482,6 +486,7 @@ class SchemeCtl extends CtlBase {
} }
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);
console.log("------------------------------------------" + rtn.stdout);
if (j.status == 1){ if (j.status == 1){
pobj.schemeNumber = j.data; pobj.schemeNumber = j.data;
pobj.businessType = btype; pobj.businessType = btype;
...@@ -490,7 +495,7 @@ class SchemeCtl extends CtlBase { ...@@ -490,7 +495,7 @@ class SchemeCtl extends CtlBase {
return system.getResult("操作成功!"); return system.getResult("操作成功!");
} }
else{ else{
return system.getResultError("提交方案出错!"); return j;
} }
} }
...@@ -503,6 +508,25 @@ class SchemeCtl extends CtlBase { ...@@ -503,6 +508,25 @@ class SchemeCtl extends CtlBase {
} }
} }
/*插入或更新方案*/
async createInfo(datajson,qobj, req){
console.log("datejson:" + JSON.stringify(datajson));
try{
var rs = await this.service.findInfoByDemandCode(datajson.d);
if (rs && rs != 'undefined'){
datajson.d.schemeNumber = rs.scheme_number;
return await this.updateInfoByDemandCode(datajson);
}
else{
return await this.insertInfo(datajson);
}
}
catch(error){
return system.getResultError(error);
}
}
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");
......
...@@ -45,6 +45,9 @@ class BizoptDao extends Dao { ...@@ -45,6 +45,9 @@ class BizoptDao extends Dao {
if (qobj.statusReason && qobj.statusReason != 'undefined') { if (qobj.statusReason && qobj.statusReason != 'undefined') {
setobj["close_reason"] = qobj.statusReason; setobj["close_reason"] = qobj.statusReason;
} }
else{
setobj["close_reason"] = "";
}
var whereobj = { "demand_code": qobj.businessMode }; var whereobj = { "demand_code": qobj.businessMode };
return await this.updateByWhere(setobj, whereobj, t); return await this.updateByWhere(setobj, whereobj, t);
} }
...@@ -84,6 +87,9 @@ class BizoptDao extends Dao { ...@@ -84,6 +87,9 @@ class BizoptDao extends Dao {
if (qobj.businessName && qobj.businessName != 'undefined'){ if (qobj.businessName && qobj.businessName != 'undefined'){
obj.business_info.businessName = qobj.businessName; obj.business_info.businessName = qobj.businessName;
} }
if (qobj.companyName && qobj.companyName != 'undefined'){
obj.business_info.companyName = qobj.companyName;
}
if (qobj.servicerCode && qobj.servicerCode != 'undefined') { if (qobj.servicerCode && qobj.servicerCode != 'undefined') {
obj.facilitator_id = qobj.servicerCode; obj.facilitator_id = qobj.servicerCode;
} }
...@@ -100,7 +106,7 @@ class BizoptDao extends Dao { ...@@ -100,7 +106,7 @@ class BizoptDao extends Dao {
obj.salesman_name = qobj.clerkName; obj.salesman_name = qobj.clerkName;
} }
if (qobj.clerkPhone && qobj.clerkPhone != 'undefined') { if (qobj.clerkPhone && qobj.clerkPhone != 'undefined') {
obj.salesman_phone = qobj.salesman_phone; obj.salesman_phone = qobj.clerkPhone;
} }
return await this.create(obj, t); return await this.create(obj, t);
} }
......
...@@ -59,6 +59,9 @@ class DeliverybillDao extends Dao { ...@@ -59,6 +59,9 @@ class DeliverybillDao extends Dao {
if (qobj.statusReason && qobj.statusReason != 'undefined') { if (qobj.statusReason && qobj.statusReason != 'undefined') {
setobj.close_reason = qobj.statusReason; setobj.close_reason = qobj.statusReason;
} }
else{
setobj.close_reason = "";
}
var whereobj = { "delivery_code": qobj.deliverNumber }; var whereobj = { "delivery_code": qobj.deliverNumber };
var rs = await this.findOne(whereobj); var rs = await this.findOne(whereobj);
if (rs && rs != 'undefined'){ if (rs && rs != 'undefined'){
...@@ -86,6 +89,9 @@ class DeliverybillDao extends Dao { ...@@ -86,6 +89,9 @@ class DeliverybillDao extends Dao {
if (qobj.statusReason && qobj.statusReason != 'undefined') { if (qobj.statusReason && qobj.statusReason != 'undefined') {
setobj.close_reason = qobj.statusReason; setobj.close_reason = qobj.statusReason;
} }
else{
setobj.close_reason = "";
}
return await this.updateByWhere(setobj, whereobj, t); return await this.updateByWhere(setobj, whereobj, t);
} }
...@@ -93,7 +99,8 @@ class DeliverybillDao extends Dao { ...@@ -93,7 +99,8 @@ class DeliverybillDao extends Dao {
async insertInfo(qobj, t) {//到时候看交付单信息后再确定 async insertInfo(qobj, t) {//到时候看交付单信息后再确定
var obj = { var obj = {
"delivery_code": qobj.deliverNumber, "delivery_code": qobj.deliverNumber,
"delivery_status": qobj.deliverStatus "delivery_status": qobj.deliverStatus,
"delivery_info":qobj.deliveryInfo
}; };
if (qobj.businessMode && qobj.businessMode != 'undefined'){ if (qobj.businessMode && qobj.businessMode != 'undefined'){
obj.demand_code = qobj.businessMode; obj.demand_code = qobj.businessMode;
...@@ -107,6 +114,10 @@ class DeliverybillDao extends Dao { ...@@ -107,6 +114,10 @@ class DeliverybillDao extends Dao {
if (qobj.businessType && qobj.businessType != 'undefined') { if (qobj.businessType && qobj.businessType != 'undefined') {
obj.product_code = qobj.businessType; obj.product_code = qobj.businessType;
} }
if (qobj.txOrderNum && qobj.txOrderNum != 'undefined'){
obj.master_source_number= qobj.txOrderNum;
}
if (qobj.channelSource && qobj.channelSource != 'undefined') { if (qobj.channelSource && qobj.channelSource != 'undefined') {
obj.source_name = qobj.channelSource; obj.source_name = qobj.channelSource;
} }
......
...@@ -6,64 +6,64 @@ class MaterialDao extends Dao { ...@@ -6,64 +6,64 @@ class MaterialDao extends Dao {
} }
/*根据交付单编号获取注册材料信息详情*/ /*根据交付单编号获取注册材料信息详情*/
async findInfoByDeliverNumber(qobj){ async findInfoByDeliverNumber(qobj) {
var qcwhere = {"delivery_code":qobj.deliverNumber}; var qcwhere = { "delivery_code": qobj.deliverNumber };
return await this.findOne(qcwhere); return await this.findOne(qcwhere);
} }
/*根据交付单编号更新交材料详情*/ /*根据交付单编号更新交材料详情*/
async updateInfoByDeliverNumber(qobj,t){ async updateInfoByDeliverNumber(qobj, t) {
var whereobj = {"delivery_code":qobj.deliverNumber}; var whereobj = { "delivery_code": qobj.deliverNumber };
var setobj = {}; var setobj = {};
if (qobj.companyInfo && qobj.companyInfo != 'undefined'){ if (qobj.companyInfo && qobj.companyInfo != 'undefined') {
setobj.company_info = qobj.companyInfo; setobj.company_info = qobj.companyInfo;
} }
if (qobj.registeredInfo && qobj.registeredInfo != 'undefined'){ if (qobj.registeredInfo && qobj.registeredInfo != 'undefined') {
setobj.registered_info = qobj.registeredInfo; setobj.registered_info = qobj.registeredInfo;
} }
if (qobj.contributionInfo && qobj.contributionInfo != 'undefined'){ if (qobj.contributionInfo && qobj.contributionInfo != 'undefined') {
setobj.contribution_info = qobj.contributionInfo; setobj.contribution_info = qobj.contributionInfo;
} }
if (qobj.positionInfo && qobj.positionInfo != 'undefined'){ if (qobj.positionInfo && qobj.positionInfo != 'undefined') {
setobj.position_info = qobj.positionInfo; setobj.position_info = qobj.positionInfo;
} }
if (qobj.managerInfo && qobj.managerInfo != 'undefined'){ if (qobj.managerInfo && qobj.managerInfo != 'undefined') {
setobj.position_info = qobj.managerInfo; setobj.position_info = qobj.managerInfo;
} }
if (qobj.regInfo && qobj.regInfo != 'undefined'){ if (qobj.regInfo && qobj.regInfo != 'undefined') {
setobj.file_info = qobj.regInfo; setobj.file_info = qobj.regInfo;
} }
if (qobj.expressInfo && qobj.expressInfo != 'undefined'){ if (qobj.expressInfo && qobj.expressInfo != 'undefined') {
setobj.express_info = qobj.expressInfo; setobj.express_info = qobj.expressInfo;
} }
return await this.updateByWhere(setobj,whereobj,t); return await this.updateByWhere(setobj, whereobj, t);
} }
/*插入注册材料信息*/ /*插入注册材料信息*/
async insertInfo(qobj,t){//公司注册,云上园区注册时的信息 async insertInfo(pobj, t) {//公司注册,云上园区注册时的信息
var obj = { var obj = {
"delivery_code":qobj.deliverNumber "delivery_code": pobj.deliverNumber
}; };
if (qobj.deliverId && qobj.deliverId != 'undefined'){ if (pobj.deliverId && pobj.deliverId != 'undefined') {
obj["delivery_id"] = qobj.deliverId; obj["delivery_id"] = pobj.deliverId;
} }
if (qobj.companyInfo && qobj.companyInfo != 'undefined'){ if (pobj.companyInfo && pobj.companyInfo != 'undefined') {
obj.company_info = qobj.companyInfo; obj.company_info = pobj.companyInfo;
} }
if (pobj.registeredInfo && pobj.registeredInfo != 'undefined'){ if (pobj.registeredInfo && pobj.registeredInfo != 'undefined') {
obj.registered_info = pobj.registeredInfo; obj.registered_info = pobj.registeredInfo;
} }
if (pobj.positionInfo && pobj.positionInfo != 'undefined'){ if (pobj.positionInfo && pobj.positionInfo != 'undefined') {
obj.position_info = pobj.positionInfo; obj.position_info = pobj.positionInfo;
} }
if (pobj.regInfo && pobj.regInfo != 'undefined'){ if (pobj.regInfo && pobj.regInfo != 'undefined') {
obj.file_info = pobj.regInfo; obj.file_info = pobj.regInfo;
} }
if (pobj.expressInfo && pobj.expressInfo != 'undefined'){ if (pobj.expressInfo && pobj.expressInfo != 'undefined') {
obj.express_info = pobj.expressInfo; obj.express_info = pobj.expressInfo;
} }
return await this.create(obj,t); return await this.create(obj, t);
} }
......
...@@ -17,6 +17,9 @@ class SchemeDao extends Dao { ...@@ -17,6 +17,9 @@ class SchemeDao extends Dao {
if (qobj.statusReason && qobj.statusReason != 'undefined'){ if (qobj.statusReason && qobj.statusReason != 'undefined'){
setobj["reject_reason"] = qobj.statusReason; setobj["reject_reason"] = qobj.statusReason;
} }
else{
setobj["reject_reason"] = "";
}
var whereobj = {"demand_code":qobj.businessMode}; var whereobj = {"demand_code":qobj.businessMode};
return await this.updateByWhere(setobj,whereobj,t); return await this.updateByWhere(setobj,whereobj,t);
} }
...@@ -28,6 +31,12 @@ class SchemeDao extends Dao { ...@@ -28,6 +31,12 @@ class SchemeDao extends Dao {
if (qobj.schemeNumber && qobj.schemeNumber != 'undefined'){ if (qobj.schemeNumber && qobj.schemeNumber != 'undefined'){
setobj.scheme_number = qobj.schemeNumber; setobj.scheme_number = qobj.schemeNumber;
} }
if (qobj.statusReason && qobj.statusReason != 'undefined'){
setobj.reject_reason = qobj.statusReason;
}
else{
setobj.reject_reason = "";
}
return await this.updateByWhere(setobj,whereobj,t); return await this.updateByWhere(setobj,whereobj,t);
} }
......
...@@ -15,6 +15,9 @@ class StatuslogDao extends Dao { ...@@ -15,6 +15,9 @@ class StatuslogDao extends Dao {
if (qobj.statusReason && qobj.statusReason != 'undefined'){ if (qobj.statusReason && qobj.statusReason != 'undefined'){
obj.status_reason = qobj.statusReason; obj.status_reason = qobj.statusReason;
} }
else{
obj.status_reason = "";
}
if (qobj.clerkName && qobj.clerkName != 'undefined'){ if (qobj.clerkName && qobj.clerkName != 'undefined'){
obj.salesman_name = qobj.clerkName; obj.salesman_name = qobj.clerkName;
} }
......
...@@ -196,18 +196,24 @@ module.exports = { ...@@ -196,18 +196,24 @@ module.exports = {
"350200":"厦门", "350200":"厦门",
"350700":"南平" "350700":"南平"
}, },
"TaxpayerTypeDict": {//纳税人类型 "TaxpayerTypeDict": {//纳税人类型
"smallScaleTaxpayer": "小规模纳税人", "smallScaleTaxpayer": "小规模纳税人",
"generalTaxpayer": "一般纳税人" "generalTaxpayer": "一般纳税人"
}, },
"TaxpayerTypeDictT": {//纳税人类型取反
"小规模纳税人":"smallScaleTaxpayer",
"一般纳税人":"generalTaxpayer",
},
"companyNatureDict": {//公司类型 "companyNatureDict": {//公司类型
"limitedLiabilityCompany": "有限责任公司", "limitedLiabilityCompany": "有限责任公司",
"incorporatedCompany": "股份有限公司", "incorporatedCompany": "股份有限公司",
"groupLimitedCompany": "集团有限公司" "groupLimitedCompany": "集团有限公司"
}, },
"companyNatureDictT": {//公司类型取反
"有限责任公司":"limitedLiabilityCompany" ,
"股份有限公司":"incorporatedCompany" ,
"集团有限公司":"groupLimitedCompany"
},
"engagedIndustryDict": {//从事行业 "engagedIndustryDict": {//从事行业
"culturalMedia": "文化传媒类", "culturalMedia": "文化传媒类",
"scienceAndTechnology": "科技类", "scienceAndTechnology": "科技类",
...@@ -223,6 +229,21 @@ module.exports = { ...@@ -223,6 +229,21 @@ module.exports = {
"service": "服务类", "service": "服务类",
"engineering": "工程类" "engineering": "工程类"
}, },
"engagedIndustryDictT": {//从事行业取反
"文化传媒类":"culturalMedia" ,
"科技类":"scienceAndTechnology",
"影业类":"filmIndustry" ,
"贸易类":"trade",
"咨询类":"consult" ,
"广告类":"advertisement",
"管理类":"administration" ,
"租赁类":"lease",
"代理类":"proxy" ,
"培训类":"train",
"设计类":"design",
"服务类":"service",
"工程类":"engineering"
},
"SealSevCaseDict": {//是否刻章 "SealSevCaseDict": {//是否刻章
"yes": "需要", "yes": "需要",
...@@ -238,13 +259,16 @@ module.exports = { ...@@ -238,13 +259,16 @@ module.exports = {
"practical": "实际经营地址", "practical": "实际经营地址",
"virtual": "虚拟地址" "virtual": "虚拟地址"
}, },
"registeredTypeDict": {//个体户类型 "registeredTypeDict": {//个体户类型
"selfEmployed": "个体商户", "selfEmployed": "个体商户",
"soleProprietorship": "个人独资", "soleProprietorship": "个人独资企业",
"company": "有限公司" "company": "有限公司"
}, },
"registeredTypeDictT": {//个体户类型反
"个体工商户":"selfEmployed" ,
"个人独资企业":"soleProprietorship",
"有限公司":"company"
},
"registeredParkDict": {//注册园区 "registeredParkDict": {//注册园区
"410200":"开封", "410200":"开封",
"321300":"宿迁", "321300":"宿迁",
...@@ -329,7 +353,7 @@ module.exports = { ...@@ -329,7 +353,7 @@ module.exports = {
"engraving": 140, "engraving": 140,
"posting": 150, "posting": 150,
"signed": 160, "signed": 160,
"completed": 170, "success": 170,
"expired": 180, "expired": 180,
"closed": 190 "closed": 190
}, },
......
...@@ -8,7 +8,7 @@ module.exports = (db, DataTypes) => { ...@@ -8,7 +8,7 @@ module.exports = (db, DataTypes) => {
return db.define("cacheinfo", { return db.define("cacheinfo", {
deliver_id: { // 交付单id deliver_id: { // 交付单id
allowNull: false, allowNull: false,
type: DataTypes.INTEGER type: DataTypes.STRING
}, },
cache_info: { // 缓存信息 cache_info: { // 缓存信息
allowNull: false, allowNull: false,
......
...@@ -50,6 +50,10 @@ module.exports = (db, DataTypes) => { ...@@ -50,6 +50,10 @@ module.exports = (db, DataTypes) => {
allowNull: false, allowNull: false,
type: DataTypes.STRING type: DataTypes.STRING
}, },
master_source_number:{//主订单号
allowNull: false,
type: DataTypes.STRING
},
settle_status: {// 服务单流转状态 settle_status: {// 服务单流转状态
allowNull: false, allowNull: false,
type: DataTypes.STRING, type: DataTypes.STRING,
......
...@@ -8,7 +8,7 @@ const appconfig = system.getSysConfig(); ...@@ -8,7 +8,7 @@ const appconfig = system.getSysConfig();
module.exports = (db, DataTypes) => { module.exports = (db, DataTypes) => {
return db.define("material", { return db.define("material", {
delivery_id: { // 交付单id delivery_id: { // 交付单id
allowNull: false, allowNull: true,
type: DataTypes.INTEGER type: DataTypes.INTEGER
}, },
delivery_code: { // 交付单编号 delivery_code: { // 交付单编号
......
...@@ -5,73 +5,76 @@ const appconfig = system.getSysConfig(); ...@@ -5,73 +5,76 @@ const appconfig = system.getSysConfig();
class DeliverybillService extends ServiceBase { class DeliverybillService extends ServiceBase {
constructor() { constructor() {
super("bizchance", ServiceBase.getDaoName(DeliverybillService)); super("bizchance", ServiceBase.getDaoName(DeliverybillService));
this.materialDao = system.getObject("db.bizchance.materialDao");
this.logDao = system.getObject("db.bizchance.statuslogDao");
this.cacheDao = system.getObject("db.bizchance.cacheinfoDao");
} }
async statBizDelivery(companyId,opath,username,userid){ async statBizDelivery(companyId, opath, username, userid) {
//如果当前登录人是平台,返回所有商机 //如果当前登录人是平台,返回所有商机
let waittoHandledCount=0//received let waittoHandledCount = 0//received
let handlingCount=0 let handlingCount = 0
let finishedCount=0//success let finishedCount = 0//success
let closedCount=0//closed let closedCount = 0//closed
let toSettle=0 let toSettle = 0
let toSettleAmount=0 let toSettleAmount = 0
let settling=0 let settling = 0
let settlingAmount=0 let settlingAmount = 0
let settled=0 let settled = 0
let settledAmount=0 let settledAmount = 0
if(companyId==1){ if (companyId == 1) {
waittoHandledCount=await this.dao.findCount({where:{delivery_status:'received'}}) waittoHandledCount = await this.dao.findCount({ where: { delivery_status: 'received' } })
handlingCount=await this.dao.findCount({where:{delivery_status:{[this.db.Op.notIn]:['received','success','closed']}}}) handlingCount = await this.dao.findCount({ where: { delivery_status: { [this.db.Op.notIn]: ['received', 'success', 'closed'] } } })
finishedCount=await this.dao.findCount({where:{delivery_status:'success'}}) finishedCount = await this.dao.findCount({ where: { delivery_status: 'success' } })
closedCount=await this.dao.findCount({where:{delivery_status:'closed'}}) closedCount = await this.dao.findCount({ where: { delivery_status: 'closed' } })
toSettle=await this.dao.findCount({where:{settle_status:'waittosettle'}}) toSettle = await this.dao.findCount({ where: { settle_status: 'waittosettle' } })
toSettleAmount=await this.dao.findSum('cost_price',{where:{settle_status:'waittosettle'}}) toSettleAmount = await this.dao.findSum('cost_price', { where: { settle_status: 'waittosettle' } })
settling=await this.dao.findCount({where:{settle_status:'settling'}}) settling = await this.dao.findCount({ where: { settle_status: 'settling' } })
settlingAmount=await this.dao.findSum('cost_price',{where:{settle_status:'settling'}}) settlingAmount = await this.dao.findSum('cost_price', { where: { settle_status: 'settling' } })
settled=await this.dao.findCount({where:{settle_status:'settled'}}) settled = await this.dao.findCount({ where: { settle_status: 'settled' } })
settledAmount=await this.dao.findSum('cost_price',{where:{settle_status:'settled'}}) settledAmount = await this.dao.findSum('cost_price', { where: { settle_status: 'settled' } })
}else{ } else {
let opathstr='' let opathstr = ''
if(opath){ if (opath) {
opathstr=opath opathstr = opath
waittoHandledCount=await this.dao.findCount({where:{delivery_status:'received',salesman_opcode:{ [this.db.Op.like]:`%${opathstr}%`},'facilitator_id':companyId}}) waittoHandledCount = await this.dao.findCount({ where: { delivery_status: 'received', salesman_opcode: { [this.db.Op.like]: `%${opathstr}%` }, 'facilitator_id': companyId } })
handlingCount=await this.dao.findCount({where:{delivery_status:{[this.db.Op.notIn]:['received','success','closed']},salesman_opcode:{ [this.db.Op.like]:`%${opathstr}%`},'facilitator_id':companyId}}) handlingCount = await this.dao.findCount({ where: { delivery_status: { [this.db.Op.notIn]: ['received', 'success', 'closed'] }, salesman_opcode: { [this.db.Op.like]: `%${opathstr}%` }, 'facilitator_id': companyId } })
finishedCount=await this.dao.findCount({where:{delivery_status:'success',salesman_opcode:{ [this.db.Op.like]:`%${opathstr}%`},'facilitator_id':companyId}}) finishedCount = await this.dao.findCount({ where: { delivery_status: 'success', salesman_opcode: { [this.db.Op.like]: `%${opathstr}%` }, 'facilitator_id': companyId } })
closedCount=await this.dao.findCount({where:{delivery_status:'closed',salesman_opcode:{ [this.db.Op.like]:`%${opathstr}%`},'facilitator_id':companyId}}) closedCount = await this.dao.findCount({ where: { delivery_status: 'closed', salesman_opcode: { [this.db.Op.like]: `%${opathstr}%` }, 'facilitator_id': companyId } })
toSettle=await this.dao.findCount({where:{settle_status:'waittosettle',salesman_opcode:{ [this.db.Op.like]:`%${opathstr}%`},'facilitator_id':companyId}}) toSettle = await this.dao.findCount({ where: { settle_status: 'waittosettle', salesman_opcode: { [this.db.Op.like]: `%${opathstr}%` }, 'facilitator_id': companyId } })
toSettleAmount=await this.dao.findSum('cost_price',{where:{settle_status:'waittosettle',salesman_opcode:{ [this.db.Op.like]:`%${opathstr}%`},'facilitator_id':companyId}}) toSettleAmount = await this.dao.findSum('cost_price', { where: { settle_status: 'waittosettle', salesman_opcode: { [this.db.Op.like]: `%${opathstr}%` }, 'facilitator_id': companyId } })
settling=await this.dao.findCount({where:{settle_status:'settling',salesman_opcode:{ [this.db.Op.like]:`%${opathstr}%`},'facilitator_id':companyId}}) settling = await this.dao.findCount({ where: { settle_status: 'settling', salesman_opcode: { [this.db.Op.like]: `%${opathstr}%` }, 'facilitator_id': companyId } })
settlingAmount=await this.dao.findSum('cost_price',{where:{settle_status:'settling',salesman_opcode:{ [this.db.Op.like]:`%${opathstr}%`},'facilitator_id':companyId}}) settlingAmount = await this.dao.findSum('cost_price', { where: { settle_status: 'settling', salesman_opcode: { [this.db.Op.like]: `%${opathstr}%` }, 'facilitator_id': companyId } })
settled=await this.dao.findCount({where:{settle_status:'settled',salesman_opcode:{ [this.db.Op.like]:`%${opathstr}%`},'facilitator_id':companyId}}) settled = await this.dao.findCount({ where: { settle_status: 'settled', salesman_opcode: { [this.db.Op.like]: `%${opathstr}%` }, 'facilitator_id': companyId } })
settledAmount=await this.dao.findSum('cost_price',{where:{settle_status:'settled',salesman_opcode:{ [this.db.Op.like]:`%${opathstr}%`},'facilitator_id':companyId}}) settledAmount = await this.dao.findSum('cost_price', { where: { settle_status: 'settled', salesman_opcode: { [this.db.Op.like]: `%${opathstr}%` }, 'facilitator_id': companyId } })
}else{ } else {
waittoHandledCount=await this.dao.findCount({where:{delivery_status:'received','facilitator_id':companyId}}) waittoHandledCount = await this.dao.findCount({ where: { delivery_status: 'received', 'facilitator_id': companyId } })
handlingCount=await this.dao.findCount({where:{delivery_status:{[this.db.Op.notIn]:['received','success','closed']},'facilitator_id':companyId}}) handlingCount = await this.dao.findCount({ where: { delivery_status: { [this.db.Op.notIn]: ['received', 'success', 'closed'] }, 'facilitator_id': companyId } })
finishedCount=await this.dao.findCount({where:{delivery_status:'success','facilitator_id':companyId}}) finishedCount = await this.dao.findCount({ where: { delivery_status: 'success', 'facilitator_id': companyId } })
closedCount=await this.dao.findCount({where:{delivery_status:'closed','facilitator_id':companyId}}) closedCount = await this.dao.findCount({ where: { delivery_status: 'closed', 'facilitator_id': companyId } })
toSettle=await this.dao.findCount({where:{settle_status:'waittosettle','facilitator_id':companyId}}) toSettle = await this.dao.findCount({ where: { settle_status: 'waittosettle', 'facilitator_id': companyId } })
toSettleAmount=await this.dao.findSum('cost_price',{where:{settle_status:'waittosettle','facilitator_id':companyId}}) toSettleAmount = await this.dao.findSum('cost_price', { where: { settle_status: 'waittosettle', 'facilitator_id': companyId } })
settling=await this.dao.findCount({where:{settle_status:'settling','facilitator_id':companyId}}) settling = await this.dao.findCount({ where: { settle_status: 'settling', 'facilitator_id': companyId } })
settlingAmount=await this.dao.findSum('cost_price',{where:{settle_status:'settling','facilitator_id':companyId}}) settlingAmount = await this.dao.findSum('cost_price', { where: { settle_status: 'settling', 'facilitator_id': companyId } })
settled=await this.dao.findCount({where:{settle_status:'settled','facilitator_id':companyId}}) settled = await this.dao.findCount({ where: { settle_status: 'settled', 'facilitator_id': companyId } })
settledAmount=await this.dao.findSum('cost_price',{where:{settle_status:'settled','facilitator_id':companyId}}) settledAmount = await this.dao.findSum('cost_price', { where: { settle_status: 'settled', 'facilitator_id': companyId } })
} }
} }
//成单率 //成单率
let allHandled=finishedCount+closedCount let allHandled = finishedCount + closedCount
//如果当前登录人不是平台,那么需要按照opath查询 //如果当前登录人不是平台,那么需要按照opath查询
return { return {
waittoHandledCount:waittoHandledCount, waittoHandledCount: waittoHandledCount,
handlingCount:handlingCount, handlingCount: handlingCount,
finishedCount:finishedCount, finishedCount: finishedCount,
closedCount:closedCount, closedCount: closedCount,
allHandled:allHandled, allHandled: allHandled,
toSettle:toSettle, toSettle: toSettle,
toSettleAmount:toSettleAmount?toSettleAmount:0, toSettleAmount: toSettleAmount ? toSettleAmount : 0,
settling:settling, settling: settling,
settlingAmount:settlingAmount?settlingAmount:0, settlingAmount: settlingAmount ? settlingAmount : 0,
settled:settled, settled: settled,
settledAmount:settledAmount?settledAmount:0 settledAmount: settledAmount ? settledAmount : 0
} }
} }
...@@ -144,29 +147,52 @@ class DeliverybillService extends ServiceBase { ...@@ -144,29 +147,52 @@ class DeliverybillService extends ServiceBase {
return apps; return apps;
} }
async findInfoByDeliverCode(qobj){//*根据交付单编号获取交付单详情*/ async findInfoByDeliverCode(qobj) {//*根据交付单编号获取交付单详情*/
return await this.dao.findInfoByDeliverCode(qobj); return await this.dao.findInfoByDeliverCode(qobj);
} }
async updateStatusByDeliverCode(qobj){//* 根据交付单编号更新交付单状态 */ async updateStatusByDeliverCode(qobj) {//* 根据交付单编号更新交付单状态 */
var self=this; var self = this;
return self.db.transaction(async function (t) { return self.db.transaction(async function (t) {
return await self.dao.updateStatusByDeliverCode(qobj,t); return await self.dao.updateStatusByDeliverCode(qobj, t);
}); });
} }
async updateInfoByDeliverCode(qobj){//*更新交付单信息 */ async updateInfoByDeliverCode(qobj) {//*更新交付单信息 */
console.log("--------------------------------------------------------------------------------------------------------------------------------------"); console.log("--------------------------------------------------------------------------------------------------------------------------------------");
var self=this; var self = this;
return self.db.transaction(async function (t) { 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; var self = this;
return self.db.transaction(async function (t) { return self.db.transaction(async function (t) {
return await self.dao.insertInfo(qobj,t); return await self.dao.insertInfo(qobj, t);
});
}
async insertInfoall(pobj) {//*插入交付单信息,大事务*/从队列取数据的时候用
var self = this;
return await self.db.transaction(async function (t) {
var res = await self.dao.insertInfo(pobj);//插入交付单列表
pobj.deliverId = res.id;
//插入暂存
if (pobj.cacheInfo && (pobj.businessType == "companyCase" || pobj.businessType == "psCase")) {
await self.cacheDao.insertInfo(pobj);
}
var logInfo = {
"flowType": "DELIVERY",
"flowId": res.id,
"statusCode": res.delivery_status,
"statusReason": res.close_reason,
"clerkName": res.salesman_name,
"clerkId": res.salesman_id
}
await self.logDao.insertInfo(logInfo);//插入状态日至表
await self.materialDao.insertInfo(pobj);//插入材料信息
return system.getResultSuccess();
}); });
} }
......
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