Commit 6a1147e8 by 宋毅

修改订单推送信息

parents b4104a53 3db5b6cc
......@@ -28,7 +28,7 @@ class APIBase {
return system.getResultSuccess();
}
}
if (["updateTmStatus"].indexOf(methodname) >= 0) {
if (["updateTmStatus","bulkCreateNeeds","bulkCreateOrders"].indexOf(methodname) >= 0) {
return system.getResultSuccess();
}
if (!pobj.appInfo) {
......
......@@ -48,6 +48,9 @@ class IcAPI extends APIBase {
case "getStatisticsByProduct":
opResult = await this.opNeedInfoSve.getStatisticsByProduct(pobj);
break;
case "getNeedProductType":
opResult = await this.opNeedInfoSve.getNeedProductType(pobj);
break;
case "getStatisticsByArea":
opResult = await this.opNeedInfoSve.getStatisticsByCity(pobj);
break;
......
......@@ -131,6 +131,10 @@ class QcAPI extends APIBase {
case "addIcpSalesmanInfo"://添加业务员信息,用于直接下单的icp订单
opResult = await this.baiduqcSve.addIcpSalesmanInfo(pobj);
break;
case "tmFeedbackSubmit"://商标用户反馈
opResult = await this.aliyunqcSve.tmFeedbackSubmit(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
// var system = require("../../../system");
// var settings = require("../../../../config/settings");
class TaskAction extends APIBase {
constructor() {
super();
this.orderinfoSve = system.getObject("service.dbcorder.orderinfoSve");
this.opneedinfoSve = system.getObject("service.dbneed.opneedinfoSve");
this.orderproductSve = system.getObject("service.dbcorder.orderproductSve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async taskNeed(pobj, qobj, req) {
var result = await this.opneedinfoSve.syncNeedBusiness();
return result;
}
async taskProduct(pobj, qobj, req) {
var result = await this.orderproductSve.syncProductData();
return result;
}
// constructor() {//由dba进行处理了
// super();
// this.orderinfoSve = system.getObject("service.dbcorder.orderinfoSve");
// this.opneedinfoSve = system.getObject("service.dbneed.opneedinfoSve");
// this.orderproductSve = system.getObject("service.dbcorder.orderproductSve");
// }
// /**
// * 需求商机同步
// * action_process 执行的流程
// * action_type 执行的类型
// * action_body 执行的参数
// */
// async taskNeed(pobj, qobj, req) {
// var result = await this.opneedinfoSve.syncNeedBusiness();
// return result;
// }
//
// async taskProduct(pobj, qobj, req) {
// var result = await this.orderproductSve.syncProductData();
// }
// /**
// * 订单商机同步
// * action_process 执行的流程
// * action_type 执行的类型
// * action_body 执行的参数
// */
// async taskOrder(pobj, qobj, req) {
// var result = await this.orderinfoSve.syncOrderBusiness();
// return result;
// }
}
module.exports = TaskAction;
\ No newline at end of file
const system = require("../../../system");
const Dao = require("../../dao.base");
const {Op} = require("sequelize");
class OrderInfoDao extends Dao {
constructor() {
super(Dao.getModelName(OrderInfoDao));
......@@ -56,5 +57,50 @@ class OrderInfoDao extends Dao {
await this.customInsert(sql, null, t);
return system.getResultSuccess()
}
/**
* 根据ids 获取需求
* @param ids
* @returns {Promise<void>}
*/
async getOrdersByIds(ids){
let orders = await this.findAll({
where: {
channelOrderNo: {
[Op.in]:ids
}
}
})
return orders;
}
/**
* 批量更新
* @param needs
* @returns {Promise<Array<Model>|*>}
*/
async bulkUpdate(orders){
let result = await this.bulkCreate(orders,{
fields:["id", "status","statusName"] ,
updateOnDuplicate: ["status","statusName"]
});
return result;
}
/**
* 批量更新
* @param needs
* @returns {Promise<Array<Model>|*>}
*/
async bulkUpdateStatus(status,statusName,ids){
let result = await this.updateByWhere({orderStatus:status,orderStatusName:statusName},{
where : {
channelOrderNo:{
[Op.in]:ids
}
}
});
return result;
}
}
module.exports = OrderInfoDao;
const system = require("../../../system");
const Dao = require("../../dao.base");
const {Op} = require("sequelize");
class OrderinfofqDao extends Dao {
constructor() {
super(Dao.getModelName(OrderinfofqDao));
}
/**
* 取300条未处理的数据
* @returns {Promise<Array<Model>>}
*/
async getAllOrders(){
let fqNeeds = await this.findAll({
where: {
handleStatus: 0
},
order: [["id","desc"]],
limit: 300
})
return fqNeeds;
}
/**
* 批量更新
* @param needs
* @returns {Promise<Array<Model>|*>}
*/
async bulkUpdate(ids){
let result = await this.updateByWhere({handleStatus:1},{
where : {
channelOrderNo:{
[Op.in]:ids
}
}
});
return result;
}
}
module.exports = OrderinfofqDao;
......@@ -6,6 +6,10 @@ class NeedinfofqDao extends Dao {
super(Dao.getModelName(NeedinfofqDao));
}
/**
* 取300条未处理的数据
* @returns {Promise<Array<Model>>}
*/
async getAllNeeds(){
let fqNeeds = await this.findAll({
where: {
......
......@@ -38,6 +38,8 @@ module.exports = (db, DataTypes) => {
opNotes :DataTypes.STRING,// 备注
notes :DataTypes.STRING,// 备注
isSolution :DataTypes.INTEGER,// 是否有方案,0无,1有
isPushNum :DataTypes.INTEGER,// 推送次数
pushStatus :DataTypes.INTEGER,// 推送状态0待推送2推送失败3已成功推送
}, {
paranoid: true,//假的删除
underscored: true,
......
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("orderinfofq", {
sourceName :DataTypes.STRING(128),// 来源名称(source_name)
serviceOrderNo :DataTypes.STRING(128),// 服务商订单号(页面中列表中显示该单号)-云服(no)
channelServiceNo :DataTypes.STRING(128),// 渠道服务单号
channelOrderNo :DataTypes.STRING(128),// 渠道订单号(页面中列表中显示该单号)(idempotent_no)
channelNeedNo :DataTypes.STRING(128), // 渠道需求号(页面中列表中显示该需求号)
needNo :DataTypes.STRING(128), //需求号(need_no)
payTime :DataTypes.DATE,// 支付时间(first_pay_time)
quantity :DataTypes.INTEGER,// 项目订单数量(即服务项目的倍数,默认值为1)
orderStatusName :DataTypes.STRING(50),//订单状态名称
orderStatus :DataTypes.INTEGER,// 订单状态: 1: 待付款, 2: 已付款, 4: 服务中, 8: 已完成, 16: 已退款, 32: 已作废
totalSum :DataTypes.DECIMAL(12, 2),// 订单总额(产品价格×优惠费率×订单件数)
payTotalSum :DataTypes.DECIMAL(12, 2),// 订单付款总额
refundSum :DataTypes.DECIMAL(12, 2),// 退款金额
refundTime :DataTypes.DATE, //2020/6/17 lin新增 退款时间
notes :DataTypes.STRING,// 备注
isSolution :DataTypes.INTEGER,// 是否有方案,0无,1有
handleStatus :DataTypes.INTEGER, // 处理状态,0否,1是
source_code :DataTypes.STRING
}, {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updated_at: true,// 2020 0618 lin修改
//freezeTableName: true,
// define the table's name
tableName: 'c_order_info_fq',
validate: {
},
indexes: [
]
});
}
......@@ -5,10 +5,10 @@ module.exports = (db, DataTypes) => {
return db.define("needinfofq", {
sourceCode: DataTypes.STRING(128), //来源code )idempotent_source
channelNeedNo: DataTypes.STRING(128), //渠道需求号(页面中列表中显示该需求号)
publishContent: DataTypes.STRING,//发布内容
publishContent: DataTypes.TEXT,//发布内容
publishMobile: DataTypes.STRING,//发布者手机号
followContent: DataTypes.JSON,//跟进内容
notes: DataTypes.STRING,//备注
followContent: DataTypes.TEXT,//跟进内容
notes: DataTypes.TEXT,//备注
disposeNotes: DataTypes.STRING,//处理的备注
statusName: DataTypes.STRING,
status: DataTypes.INTEGER,
......
......@@ -184,6 +184,7 @@ class NeedinfoService2 extends ServiceBase {
}
async writeCommunicationLog(pobj, actionBody) {
console.log('actionBody---writeCommunicationLog---',actionBody)
// 查询需求沟通记录
// 2020 0820 lin 修改channel传过来的参数 为 note/intentionBizId
actionBody.Note = ["noteTime", moment().format("YYYY-MM-DD HH:mm:ss"), "note", actionBody.note];
......
......@@ -841,6 +841,48 @@ class AliyunQcService {
await this.needsolutionDao.update(updateObj);//方案状态修改
return system.getResultSuccess(needinfo);
}
//接收tm用户方案反馈
async tmFeedbackSubmit(pobj) {
var ab = pobj.actionBody;
if (!ab.intentionBizId) {
return system.getResultFail(-101, "渠道需求编号错误");
}
if (!ab.description) {
return system.getResultFail(-102, "问题描述不能为空");
}
//获取需求信息
var needinfo = await this.needinfoDao.model.findOne({
where: { channelNeedNo: ab.intentionBizId }, raw: true
});
if (!needinfo) {
return system.getResultFail(-104, "未知方案需求");
}
if (needinfo.status == "ygb") {
return system.getResultFail(-105, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
}
//获取方案信息
var ns = await this.needsolutionDao.model.findOne({
where: { channelNeedNo: ab.intentionBizId, isInvalid: 0 }, raw: true
});
if (!ns) {
return system.getResultSuccess();
}
var intentionStatusList = ["未知", "⽅案待服务商确认", "⽅案待⽤户确认", "处理中", "已完成", "已关闭"];
var updateObj = {
id: ns.id
};
var solutionContent = ns.solutionContent;
solutionContent.customerRemark = ab.description;
solutionContent.needStatus = 1;
updateObj["status"] = "ybh";
solutionContent.needStatusName = intentionStatusList[ab.intentionStatus];
solutionContent = JSON.stringify(solutionContent);
updateObj["solutionContent"] = solutionContent;
await this.needsolutionDao.update(updateObj);//方案状态修改
return system.getResultSuccess(needinfo);
}
//接收方案编号(方案推送至阿里后,接收保存方案信息)
async receiveProgrammeNo(pobj) {
var ab = pobj.actionBody;
......
......@@ -40,6 +40,9 @@ class BaseQcService {
107: "管局已受理"
};
this.icpApplicationStatusReference = {
504: "创建交付订单",
505: "资料收集完成",
506: "资料加工完成",
507: "完成账户注册",
508: "服务商完成提交资料到⼯信部",
509: "⼯信部已受理",
......@@ -231,12 +234,28 @@ class BaseQcService {
if (!solution) {
return system.getResultFail(-103, "方案交付信息有误");
}
if (needinfo.channelTypeCode == "7") {//edi
ab.solutionContent.solution.IcpType = 2;
} else if (needinfo.channelTypeCode == "5") {//icp
ab.solutionContent.solution.IcpType = 1;
} else {
return system.getResultFail(-208, "需求业务类型有误");
//判断属于百度还是易名
if(needinfo.uapp_id == 44){
if (needinfo.channelTypeCode == "7") {//edi
ab.solutionContent.solution.IcpType = 2;
} else if (needinfo.channelTypeCode == "5") {//icp
ab.solutionContent.solution.IcpType = 1;
} else {
return system.getResultFail(-208, "需求业务类型有误");
}
}
if(needinfo.uapp_id == 52){
if (needinfo.channelTypeCode == "7") {//edi
ab.solutionContent.solution.IcpType = 2;
} else if (needinfo.channelTypeCode == "5") {//icp
ab.solutionContent.solution.IcpType = 1;
} else if (needinfo.channelTypeCode == "icpnb") {//icpnb
ab.solutionContent.solution.IcpType = 4;
} else if (needinfo.channelTypeCode == "edinb") {//edinb
ab.solutionContent.solution.IcpType = 3;
} else {
return system.getResultFail(-208, "需求业务类型有误");
}
}
if (!solution.CompanyName) {
return system.getResultFail(-105, "公司名不能为空");
......@@ -529,6 +548,16 @@ class BaseQcService {
if (ab.officialFileURL) {
ab["OfficialFileURL"] = ab.officialFileURL;
}
//2021-3-18 addNew
if (ab.officialFileURL) {
ab["CertificateNumber"] = ab.certificateNumber;
}
if (ab.officialFileURL) {
ab["CertificateStartTime"] = ab.certificateStartTime;
}
if (ab.officialFileURL) {
ab["CertificateEndTime"] = ab.certificateEndTime;
}
var ns = await this.needsolutionDao.model.findOne({
where: { orderNo: ab.orderNo }, raw: true
......@@ -694,7 +723,11 @@ class BaseQcService {
"OfficialFileURL": ab.OfficialFileURL || "",
"ApplicationStatus": ab.ApplicationStatus,
"ApplicationStatusName": this.icpApplicationStatusReference[ab.ApplicationStatus],
"created_at": new Date()
"created_at": new Date(),
//2021-3-18 addNew
"CertificateNumber":ab.CertificateNumber || "",//证书编号
"CertificateStartTime":ab.CertificateStartTime || "",//证书有效期 开始时间
"CertificateEndTime":ab.CertificateEndTime || ""//证书有效期 结束时间
};
applicationStatusList.push(statusObj);
solutionContent.applicationStatusList = applicationStatusList;
......
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