Commit dac8fa8f by Sxy

feat: 广播 网文

parent 9b35fe57
...@@ -48,5 +48,20 @@ class NewdeliverCtl extends CtlBase { ...@@ -48,5 +48,20 @@ class NewdeliverCtl extends CtlBase {
return system.getResult(null, err.message) return system.getResult(null, err.message)
} }
} }
async addQualification(pobj, qobj, req) {
if (!pobj.id) {
return system.getResult(null, "deliver_id can not be empty,100290");
}
if (!pobj.file || !pobj.file.url) {
return system.getResult(null, "file can not be empty,100290");
}
try {
let rs = await this.service.addQualification(pobj);
return system.getResult(rs);
} catch (err) {
return system.getResult(null, err.message)
}
}
} }
module.exports = NewdeliverCtl; module.exports = NewdeliverCtl;
...@@ -170,8 +170,38 @@ class DeliverDao extends Dao { ...@@ -170,8 +170,38 @@ class DeliverDao extends Dao {
break break
} }
qc.where["$and"] = filters; qc.where["$and"] = filters;
} } else if (type === "guangboManagement") {
else { let filters = [];
filters.push({
product_code: "guangbo"
})
switch (qobj.bizpath) {
case "/guangboManagement/wait":
filters.push({
delivery_status: {
$notIn: [system.SERVERSESTATUS.SUCCESS, system.SERVERSESTATUS.CLOSED]
}
});
break
case "/guangboManagement/deliveryAllocated":
filters.push({
delivery_man_opcode: {
$ne: null
}
});
break
case "/guangboManagement/deliveryNoAllocate":
filters.push({
delivery_man_opcode: {
$eq: null
}
});
break
case "/guangboManagement/all":
break
}
qc.where["$and"] = filters;
} else {
throw new Error("页面路径错误") throw new Error("页面路径错误")
} }
return qw; return qw;
......
...@@ -110,5 +110,28 @@ class NewdeliverService extends ServiceBase { ...@@ -110,5 +110,28 @@ class NewdeliverService extends ServiceBase {
}); });
return "SUCCESS" return "SUCCESS"
} }
async addQualification(pobj) {
const deliverData = await this.deliveryDao.findOne({
id: pobj.id
});
if (!deliverData) {
throw new Error("查不到此交付单");
}
await this.deliveryDao.updateByWhere({
delivery_info: {
...deliverData.delivery_info,
qualification: pobj.file
}
}, {
id: pobj.id
});
return "SUCCESS"
}
} }
module.exports = NewdeliverService; module.exports = NewdeliverService;
...@@ -335,7 +335,8 @@ System.SERVICECODE = { ...@@ -335,7 +335,8 @@ System.SERVICECODE = {
ICPANNUALREPORT: "ICPANNUALREPORT", ICPANNUALREPORT: "ICPANNUALREPORT",
EDIANNUALREPORT: "EDIANNUALREPORT", EDIANNUALREPORT: "EDIANNUALREPORT",
WANGWEN: "wangwen", WANGWEN: "wangwen",
PANNONG: "pannong" PANNONG: "pannong",
GUANGBO: "guangbo"
} }
// 商机状态 // 商机状态
System.BUSSTATUS = { System.BUSSTATUS = {
......
const BaseClient = require("./baseClient")
const settings = require("../../../config/settings");
const system = require("../../system");
const { appKey, secret } = settings;
/**
* 广播电视 产品
*/
class WangwenClient extends BaseClient {
constructor() {
super(appKey, secret, "/web/action/qcapi/springBoard");
this.instance = null;
this.CIRCUITSTATUS = {
ACCOUNTREGISTRATION: 507, // 完成账户注册
SUBMITING: 508, // 提交材料到工信部
DISPOSEING: 509, // 工信部已受理
DISPOSEINGFAIL: 510, // 工信不予受理
THROUGH: 511, // 工信部通过
THROUGHFAIL: 512 // 工信部未通过
}
}
static getInstance() {
if (!this.instance) {
this.instance = new WangwenClient();
}
return this.instance;
}
async submitMaterials(username, deliverData, materials) {
const { businessLicense, materialFile, } = materials;
const {
address, businessTerm, createdAt,
enterpriseCode, legalRepresentative, name,
registeredCapital, scopeBusiness, type
} = businessLicense;
const {
partnerBusinessLicense,
legalPersonIdentityCard,
administrativeLicenseAuthorization,
companyPolicy,
mainManagement,
radioAndTelevisionQualifications,
registeredAddressCertificateDocument,
partnerOtherList,
} = materialFile;
await this.pushQiFuTong(username, {
actionType: "rtSubmitMaterial",
actionBody: {
orderNo: deliverData.delivery_code,
material: {
businessLicense: {
address, businessTerm,
createdAt: createdAt ? createdAt : undefined,
enterpriseCode, legalRepresentative, name,
registeredCapital, scopeBusiness, type
},
partnerBusinessLicense: partnerBusinessLicense.url,
legalPersonIdentityCard: legalPersonIdentityCard.url,
administrativeLicenseAuthorization: administrativeLicenseAuthorization.url,
companyPolicy: companyPolicy.url,
mainManagement: mainManagement.url,
radioAndTelevisionQualifications: radioAndTelevisionQualifications.url,
registeredAddressCertificateDocument: registeredAddressCertificateDocument.url,
partnerOtherList: partnerOtherList.url,
}
}
});
}
async changeStatus(username, deliverData, materials = {}) {
let status;
switch (deliverData.delivery_status) {
case system.SERVERSESTATUS.USERCONFIRMATIONRESOLVE:
case system.SERVERSESTATUS.COLLECTSUCCESS:
status = this.CIRCUITSTATUS.ACCOUNTREGISTRATION
break
case system.SERVERSESTATUS.ACCOUNTREGISTRATION:
status = this.CIRCUITSTATUS.SUBMITING
break
case system.SERVERSESTATUS.SUBMITING:
status = this.CIRCUITSTATUS.DISPOSEING
break
case system.SERVERSESTATUS.DISPOSEING:
status = this.CIRCUITSTATUS.THROUGH
if (deliverData.delivery_info && deliverData.delivery_info.qualification && deliverData.delivery_info.qualification.url) {
materials = {
officialFileURL: deliverData.delivery_info.qualification.url
}
}
break
case system.SERVERSESTATUS.THROUGH:
return "SUCCESS"
default:
throw new Error("此状态不能手动更改");
}
await this.pushQiFuTong(username, {
actionType: "rtNotification",
actionBody: {
orderNo: deliverData.delivery_code,
status,
...materials
}
});
}
}
module.exports = WangwenClient
\ No newline at end of file
const vatClient = require("./vatClient") const vatClient = require("./vatClient")
const wangwenClient = require("./wangwenClient") const wangwenClient = require("./wangwenClient")
const pannongClient = require("./pannongClient") const pannongClient = require("./pannongClient")
const guangboClient = require("./guangboClient")
const system = require("../../system"); const system = require("../../system");
...@@ -17,6 +19,8 @@ function getClientByType(type) { ...@@ -17,6 +19,8 @@ function getClientByType(type) {
return wangwenClient.getInstance(); return wangwenClient.getInstance();
case system.SERVICECODE.PANNONG: case system.SERVICECODE.PANNONG:
return pannongClient.getInstance(); return pannongClient.getInstance();
case system.SERVICECODE.GUANGBO:
return guangboClient.getInstance();
default: default:
throw new Error("无此产品类型"); throw new Error("无此产品类型");
} }
......
...@@ -57,7 +57,7 @@ class VatClient extends BaseClient { ...@@ -57,7 +57,7 @@ class VatClient extends BaseClient {
BusinessLicense: { BusinessLicense: {
Address: address, Address: address,
BusinessTerm: businessTerm, BusinessTerm: businessTerm,
CreatedAt: createdAt, CreatedAt: createdAt ? createdAt : undefined,
EnterpriseCode: enterpriseCode, EnterpriseCode: enterpriseCode,
LegalRepresentative: legalRepresentative, LegalRepresentative: legalRepresentative,
Name: name, Name: name,
......
...@@ -3,12 +3,20 @@ const settings = require("../../../config/settings"); ...@@ -3,12 +3,20 @@ const settings = require("../../../config/settings");
const system = require("../../system"); const system = require("../../system");
const { appKey, secret } = settings; const { appKey, secret } = settings;
/** /**
* 食品 网文 产品 * 网文 产品
*/ */
class WangwenClient extends BaseClient { class WangwenClient extends BaseClient {
constructor() { constructor() {
super(appKey, secret, "/web/action/qcapi/springBoard"); super(appKey, secret, "/web/action/qcapi/springBoard");
this.instance = null; this.instance = null;
this.CIRCUITSTATUS = {
ACCOUNTREGISTRATION: 507, // 完成账户注册
SUBMITING: 508, // 提交材料到工信部
DISPOSEING: 509, // 工信部已受理
DISPOSEINGFAIL: 510, // 工信不予受理
THROUGH: 511, // 工信部通过
THROUGHFAIL: 512 // 工信部未通过
}
} }
static getInstance() { static getInstance() {
...@@ -17,81 +25,83 @@ class WangwenClient extends BaseClient { ...@@ -17,81 +25,83 @@ class WangwenClient extends BaseClient {
} }
return this.instance; return this.instance;
} }
/**
* 文网文 递交材料,状态变更
601: "完成账户注册",
602: "服务商提交资料",
603: "服务商完成提交资料到⼯信部",
604: "⼯商部已受理",
605: "⼯商部不予受理",
606: "⼯商部通过",
607: "⼯商部未通过"
*/
async submitMaterials(username, deliverData, materials) {
const channelType = {
"wangwen": "esp.wangwen",
"food": "esp.food"
};
let req = {};
switch (deliverData.delivery_status) {
case system.SERVERSESTATUS.COLLECTING:
case system.SERVERSESTATUS.USERCONFIRMATIONREJECT:
let { basicInfo, materialList } = materials;
let extInfo = {};
for (let val in basicInfo) { async submitMaterials(username, deliverData, materials) {
if (basicInfo[val]) { const { businessLicense, materialFile, } = materials;
extInfo[val] = basicInfo[val]; const {
} address, businessTerm, createdAt,
} enterpriseCode, legalRepresentative, name,
for (let val of materialList) { registeredCapital, scopeBusiness, type
if (val.files || val.files.length > 0) { } = businessLicense;
let urls = []; const {
for (let file of val.files) { partnerBusinessLicense,
if (file && file.url) { legalPersonIdentityCard,
urls.push(file.url); businessDevelopmentDescription,
} companyPolicy,
} mainManagement,
if (urls.length > 0) { creditCertificateDocument,
extInfo[val.key] = urls registeredAddressCertificateDocument,
} partnerOtherList,
} } = materialFile;
} await this.pushQiFuTong(username, {
req = { actionType: "ncSubmitMaterial",
"ApplicationStatus": 601, actionBody: {
"extInfo": JSON.stringify(extInfo) orderNo: deliverData.delivery_code,
material: {
businessLicense: {
address, businessTerm,
createdAt: createdAt ? createdAt : undefined,
enterpriseCode, legalRepresentative, name,
registeredCapital, scopeBusiness, type
},
partnerBusinessLicense: partnerBusinessLicense.url,
legalPersonIdentityCard: legalPersonIdentityCard.url,
businessDevelopmentDescription: businessDevelopmentDescription.url,
companyPolicy: companyPolicy.url,
mainManagement: mainManagement.url,
creditCertificateDocument: creditCertificateDocument.url,
registeredAddressCertificateDocument: registeredAddressCertificateDocument.url,
partnerOtherList: partnerOtherList.url,
} }
break }
});
}
async changeStatus(username, deliverData, materials = {}) {
let status;
switch (deliverData.delivery_status) {
case system.SERVERSESTATUS.USERCONFIRMATIONRESOLVE: case system.SERVERSESTATUS.USERCONFIRMATIONRESOLVE:
req.ApplicationStatus = 602; case system.SERVERSESTATUS.COLLECTSUCCESS:
status = this.CIRCUITSTATUS.ACCOUNTREGISTRATION
break break
case system.SERVERSESTATUS.ACCOUNTREGISTRATION: case system.SERVERSESTATUS.ACCOUNTREGISTRATION:
req.ApplicationStatus = 603; status = this.CIRCUITSTATUS.SUBMITING
break break
case system.SERVERSESTATUS.SUBMITING: case system.SERVERSESTATUS.SUBMITING:
req.ApplicationStatus = 604; status = this.CIRCUITSTATUS.DISPOSEING
break break
case system.SERVERSESTATUS.DISPOSEING: case system.SERVERSESTATUS.DISPOSEING:
req.ApplicationStatus = 606; status = this.CIRCUITSTATUS.THROUGH
if (deliverData.delivery_info && deliverData.delivery_info.qualification && deliverData.delivery_info.qualification.url) {
materials = {
officialFileURL: deliverData.delivery_info.qualification.url
}
}
break break
case system.SERVERSESTATUS.THROUGH:
return "SUCCESS"
default: default:
throw new Error("此状态手动不能更改"); throw new Error("此状态不能手动更改");
} }
await this.pushQiFuTong(username, { await this.pushQiFuTong(username, {
actionType: "serviceSubmitOption", actionType: "ncNotification",
actionBody: { actionBody: {
"channelType": channelType[deliverData.product_code], orderNo: deliverData.delivery_code,
"orderNo": deliverData.delivery_code, status,
"extInfo": "{}", ...materials
...req,
} }
}); });
} }
async changeStatus(username, deliverData, materials) {
await this.submitMaterials(username, deliverData, materials);
}
} }
module.exports = WangwenClient module.exports = WangwenClient
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment