Commit dac8fa8f by Sxy

feat: 广播 网文

parent 9b35fe57
......@@ -48,5 +48,20 @@ class NewdeliverCtl extends CtlBase {
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;
......@@ -170,8 +170,38 @@ class DeliverDao extends Dao {
break
}
qc.where["$and"] = filters;
}
else {
} else if (type === "guangboManagement") {
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("页面路径错误")
}
return qw;
......
......@@ -110,5 +110,28 @@ class NewdeliverService extends ServiceBase {
});
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;
......@@ -335,7 +335,8 @@ System.SERVICECODE = {
ICPANNUALREPORT: "ICPANNUALREPORT",
EDIANNUALREPORT: "EDIANNUALREPORT",
WANGWEN: "wangwen",
PANNONG: "pannong"
PANNONG: "pannong",
GUANGBO: "guangbo"
}
// 商机状态
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 wangwenClient = require("./wangwenClient")
const pannongClient = require("./pannongClient")
const guangboClient = require("./guangboClient")
const system = require("../../system");
......@@ -17,6 +19,8 @@ function getClientByType(type) {
return wangwenClient.getInstance();
case system.SERVICECODE.PANNONG:
return pannongClient.getInstance();
case system.SERVICECODE.GUANGBO:
return guangboClient.getInstance();
default:
throw new Error("无此产品类型");
}
......
......@@ -57,7 +57,7 @@ class VatClient extends BaseClient {
BusinessLicense: {
Address: address,
BusinessTerm: businessTerm,
CreatedAt: createdAt,
CreatedAt: createdAt ? createdAt : undefined,
EnterpriseCode: enterpriseCode,
LegalRepresentative: legalRepresentative,
Name: name,
......
......@@ -3,12 +3,20 @@ 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() {
......@@ -17,81 +25,83 @@ class WangwenClient extends BaseClient {
}
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) {
if (basicInfo[val]) {
extInfo[val] = basicInfo[val];
}
}
for (let val of materialList) {
if (val.files || val.files.length > 0) {
let urls = [];
for (let file of val.files) {
if (file && file.url) {
urls.push(file.url);
}
}
if (urls.length > 0) {
extInfo[val.key] = urls
}
}
}
req = {
"ApplicationStatus": 601,
"extInfo": JSON.stringify(extInfo)
async submitMaterials(username, deliverData, materials) {
const { businessLicense, materialFile, } = materials;
const {
address, businessTerm, createdAt,
enterpriseCode, legalRepresentative, name,
registeredCapital, scopeBusiness, type
} = businessLicense;
const {
partnerBusinessLicense,
legalPersonIdentityCard,
businessDevelopmentDescription,
companyPolicy,
mainManagement,
creditCertificateDocument,
registeredAddressCertificateDocument,
partnerOtherList,
} = materialFile;
await this.pushQiFuTong(username, {
actionType: "ncSubmitMaterial",
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,
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:
req.ApplicationStatus = 602;
case system.SERVERSESTATUS.COLLECTSUCCESS:
status = this.CIRCUITSTATUS.ACCOUNTREGISTRATION
break
case system.SERVERSESTATUS.ACCOUNTREGISTRATION:
req.ApplicationStatus = 603;
status = this.CIRCUITSTATUS.SUBMITING
break
case system.SERVERSESTATUS.SUBMITING:
req.ApplicationStatus = 604;
status = this.CIRCUITSTATUS.DISPOSEING
break
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
case system.SERVERSESTATUS.THROUGH:
return "SUCCESS"
default:
throw new Error("此状态手动不能更改");
throw new Error("此状态不能手动更改");
}
await this.pushQiFuTong(username, {
actionType: "serviceSubmitOption",
actionType: "ncNotification",
actionBody: {
"channelType": channelType[deliverData.product_code],
"orderNo": deliverData.delivery_code,
"extInfo": "{}",
...req,
orderNo: deliverData.delivery_code,
status,
...materials
}
});
}
async changeStatus(username, deliverData, materials) {
await this.submitMaterials(username, deliverData, materials);
}
}
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