Commit 1c2ab05b by 宋毅

tj

parent 3277561f
node_modules/ node_modules/
\ No newline at end of file localsettings.js
\ No newline at end of file
...@@ -18,9 +18,9 @@ class APIBase { ...@@ -18,9 +18,9 @@ class APIBase {
"SelPrice2TX": "selPrice2TX", "SelPrice2TX": "selPrice2TX",
"GetOverviewInfoByUser": "getOverviewInfoByUser", "GetOverviewInfoByUser": "getOverviewInfoByUser",
"SubmitGoodsinfo": "submitGoodsinfo", "SubmitGoodsinfo": "submitGoodsinfo",
"NeedSubmit": "needSubmit", "SubmitNeed": "needSubmit",
"NeedList": "needList", "GetNeedList": "needList",
"NeedDetail": "needDetail", "GetNeedDetail": "needDetail",
"GetOrderListByStatus": "getOrderListByStatus", "GetOrderListByStatus": "getOrderListByStatus",
"GetQualificationCertificateListByUserAndType": "getQualificationCertificateListByUserAndType", "GetQualificationCertificateListByUserAndType": "getQualificationCertificateListByUserAndType",
"GetQualificationCertificateDetail": "getQualificationCertificateDetail", "GetQualificationCertificateDetail": "getQualificationCertificateDetail",
......
...@@ -16,7 +16,7 @@ class Need extends APIBase { ...@@ -16,7 +16,7 @@ class Need extends APIBase {
if (!pobj.interface || !pobj.interface.interfaceName) { if (!pobj.interface || !pobj.interface.interfaceName) {
return system.getResult(null, "interfaceName参数不能为空"); return system.getResult(null, "interfaceName参数不能为空");
} }
var result = await this.opActionProcess(pobj, pobj.interface, req); var result = await this.opActionProcess(pobj, pobj.interface.interfaceName, req);
return result; return result;
} }
async opActionProcess(pobj, action_type, req) { async opActionProcess(pobj, action_type, req) {
......
...@@ -4,7 +4,6 @@ var settings = require("../../../../config/settings"); ...@@ -4,7 +4,6 @@ var settings = require("../../../../config/settings");
class NotifyApi extends APIBase { class NotifyApi extends APIBase {
constructor() { constructor() {
super(); super();
this.needSolutionSve = system.getObject("service.need.needSolutionSve");
this.needInfoSve = system.getObject("service.need.needInfoSve"); this.needInfoSve = system.getObject("service.need.needInfoSve");
} }
/** /**
...@@ -27,7 +26,7 @@ class NotifyApi extends APIBase { ...@@ -27,7 +26,7 @@ class NotifyApi extends APIBase {
opResult = system.getResultSuccess("测试接口"); opResult = system.getResultSuccess("测试接口");
break; break;
case "needSubmit"://提交需求 case "needSubmit"://提交需求
opResult = await this.needSolutionSve.notifyNeedSubmit(pobj); opResult = await this.needInfoSve.notifyNeedSubmit(pobj.actionBody);
break; break;
case "closeNeed"://关闭需求 case "closeNeed"://关闭需求
opResult = await this.needInfoSve.closeNeed(pobj); opResult = await this.needInfoSve.closeNeed(pobj);
......
...@@ -67,6 +67,18 @@ class OrderDeliveryDao extends Dao{ ...@@ -67,6 +67,18 @@ class OrderDeliveryDao extends Dao{
return list; return list;
} }
/** /**
* 根据订单号获取订单详情
* @param {*} orderNum 订单号
*/
async getOrderDetailByOrderNum(orderNum){
var params = {
orderNum: orderNum
};
var sql = "select * from v_order_oproduct_odelivery where order_num = :orderNum order by updated_at desc limit 1 ";
var list = await this.customQuery(sql, params);
return list;
}
/**
* 通过订单号获取资质证照信息 * 通过订单号获取资质证照信息
*/ */
async getQcInfoByOrderNum(orderNum){ async getQcInfoByOrderNum(orderNum){
......
...@@ -21,6 +21,7 @@ module.exports = (db, DataTypes) => { ...@@ -21,6 +21,7 @@ module.exports = (db, DataTypes) => {
}, },
status_name: DataTypes.STRING(100), // status_name: DataTypes.STRING(100), //
notes: DataTypes.STRING(255), //notes 备注 notes: DataTypes.STRING(255), //notes 备注
close_reason: DataTypes.STRING(255), //关闭原因
need_info: DataTypes.JSON, //need_info 需求信息(往服务商那边推送的信息) need_info: DataTypes.JSON, //need_info 需求信息(往服务商那边推送的信息)
servicer_code: DataTypes.STRING(100), //服务商 servicer_code: DataTypes.STRING(100), //服务商
servicer_name:DataTypes.STRING(100), servicer_name:DataTypes.STRING(100),
......
...@@ -9,7 +9,7 @@ module.exports = (db, DataTypes) => { ...@@ -9,7 +9,7 @@ module.exports = (db, DataTypes) => {
solution_content: DataTypes.JSON, //solution_content 方案内容 solution_content: DataTypes.JSON, //solution_content 方案内容
is_refusal: DataTypes.INTEGER, //is_refusal 是否驳回 is_refusal: DataTypes.INTEGER, //is_refusal 是否驳回
refusal_notes: DataTypes.INTEGER, //驳回原因 refusal_notes: DataTypes.INTEGER, //驳回原因
refusal_notes: DataTypes.STRING(255), //驳回/关闭原因 notes: DataTypes.STRING(255), //驳回/关闭原因
}, { }, {
paranoid: true,//假的删除 paranoid: true,//假的删除
underscored: true, underscored: true,
......
...@@ -7,7 +7,7 @@ module.exports = (db, DataTypes) => { ...@@ -7,7 +7,7 @@ module.exports = (db, DataTypes) => {
need_num: DataTypes.STRING, //需求号 need_num: DataTypes.STRING, //需求号
user_id: DataTypes.STRING, //用户id user_id: DataTypes.STRING, //用户id
user_name: DataTypes.STRING, //用户名称 user_name: DataTypes.STRING, //用户名称
pay_time:DataTypes.DATE,//付款时间
quantity: DataTypes.INTEGER, //订单数量 quantity: DataTypes.INTEGER, //订单数量
total_sum: DataTypes.INTEGER, //订单总额 total_sum: DataTypes.INTEGER, //订单总额
discount_amount: DataTypes.INTEGER, //折扣金额 discount_amount: DataTypes.INTEGER, //折扣金额
......
...@@ -11,51 +11,57 @@ module.exports = (db, DataTypes) => { ...@@ -11,51 +11,57 @@ module.exports = (db, DataTypes) => {
product_type: DataTypes.STRING, //需求类型(产品二类id) product_type: DataTypes.STRING, //需求类型(产品二类id)
product_type_name: DataTypes.STRING, //需求类型名称(产品二类名称) product_type_name: DataTypes.STRING, //需求类型名称(产品二类名称)
order_snapshot: DataTypes.JSON, //订单快照 order_snapshot: DataTypes.JSON, //订单快照
product_snapshot:DataTypes.STRING //产品快照 tx_order_snapshot: DataTypes.JSON, //腾讯订单快照
product_snapshot: DataTypes.STRING, //产品快照
time_span: DataTypes.STRING, //计费数量
time_unit: DataTypes.STRING, //计费周期 年:y,月:m,日:d,时:h,分:M,秒:s,一次性购买:p
end_time: DataTypes.DATE, //到期时间
servicer_code: DataTypes.STRING, //服务商
servicer_name: DataTypes.STRING
}, { }, {
paranoid: false,//假的删除 paranoid: false,//假的删除
underscored: true, underscored: true,
version: true, version: true,
freezeTableName: true, freezeTableName: true,
timestamps: true, timestamps: true,
// updatedAt: true, // updatedAt: true,
// createdAt: true, // createdAt: true,
//freezeTableName: true, //freezeTableName: true,
// define the table's name // define the table's name
tableName: 'b_order_product', tableName: 'b_order_product',
validate: { validate: {
}, },
indexes: [ indexes: [
// Create a unique index on email // Create a unique index on email
// { // {
// unique: true, // unique: true,
// fields: ['email'] // fields: ['email']
// }, // },
// //
// // Creates a gin index on data with the jsonb_path_ops operator // // Creates a gin index on data with the jsonb_path_ops operator
// { // {
// fields: ['data'], // fields: ['data'],
// using: 'gin', // using: 'gin',
// operator: 'jsonb_path_ops' // operator: 'jsonb_path_ops'
// }, // },
// //
// // By default index name will be [table]_[fields] // // By default index name will be [table]_[fields]
// // Creates a multi column partial index // // Creates a multi column partial index
// { // {
// name: 'public_by_author', // name: 'public_by_author',
// fields: ['author', 'status'], // fields: ['author', 'status'],
// where: { // where: {
// status: 'public' // status: 'public'
// } // }
// }, // },
// //
// // A BTREE index with a ordered field // // A BTREE index with a ordered field
// { // {
// name: 'title_index', // name: 'title_index',
// method: 'BTREE', // method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}] // fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// } // }
] ]
}); });
} }
...@@ -19,6 +19,7 @@ class TxPushLogService extends ServiceBase { ...@@ -19,6 +19,7 @@ class TxPushLogService extends ServiceBase {
} }
async createCbsInstance(pobj, req) { async createCbsInstance(pobj, req) {
var self=this;
if (!pobj.interface.para.dealName) { if (!pobj.interface.para.dealName) {
return self.returnTX(-1, "cgateway", "参数错误", null) return self.returnTX(-1, "cgateway", "参数错误", null)
} }
...@@ -26,7 +27,7 @@ class TxPushLogService extends ServiceBase { ...@@ -26,7 +27,7 @@ class TxPushLogService extends ServiceBase {
if (loginfo) { if (loginfo) {
return self.returnTX(1, "cgateway", "ok", {"flowId":loginfo.flow_id,"resourceIds":[pobj.interface.para.dealName]}) return self.returnTX(1, "cgateway", "ok", {"flowId":loginfo.flow_id,"resourceIds":[pobj.interface.para.dealName]})
} }
var flow_id=this.getBusUid("f"); var flow_id=await this.getBusUid("f");
var newobj = { var newobj = {
flow_id: flow_id, flow_id: flow_id,
deal_name: pobj.interface.para.dealName, deal_name: pobj.interface.para.dealName,
...@@ -40,20 +41,20 @@ class TxPushLogService extends ServiceBase { ...@@ -40,20 +41,20 @@ class TxPushLogService extends ServiceBase {
if(!creatlog){ if(!creatlog){
return self.returnTX(-1, "cgateway", "参数错误", null) return self.returnTX(-1, "cgateway", "参数错误", null)
} }
pobj.logId=creatlog.dataValues.id;
var pushobj = { var pushobj = {
"actionType": "orderSubmit",// Y 功能名称 "actionType": "produceData",// Y 功能名称
"actionBody": { "actionBody": {
notifyUrl: "http://192.168.1.113:4011/api/action/need/springBoard", notifyUrl: "",
actionType: "queryFlow", actionType: "orderPayNotify",
pushUrl: settings.apiconfig.opPushUrl() + "/entService/consultation/springBoard", pushUrl: "192.168.1.113:4011/api/action/order/springBoard",
messageBody: actionBody, messageBody: pobj,
identifyCode: "needSubmit" identifyCode: "orderPayNotify"
} }
}; };
this.execPostByTimeOut(pushobj, settings.apiconfig.opPushUrl()); this.execPostByTimeOut(pushobj, settings.apiconfig.opPushUrl());
return self.returnTX(1, "cgateway", "ok", {"flowId":loginfo.flow_id,"resourceIds":[pobj.interface.para.dealName]}) return self.returnTX(1, "cgateway", "ok", {"flowId":creatlog.flow_id,"resourceIds":[pobj.interface.para.dealName]})
} }
async queryFlow(pobj) { async queryFlow(pobj) {
...@@ -64,6 +65,33 @@ class TxPushLogService extends ServiceBase { ...@@ -64,6 +65,33 @@ class TxPushLogService extends ServiceBase {
if (!loginfo) { if (!loginfo) {
return self.returnTX(-1, "cgateway", "产品不存在", null) return self.returnTX(-1, "cgateway", "产品不存在", null)
} }
var orderInfo=await this.orderInfoDao.findOne({order_num:loginfo.dataValues.dealName});
if(!orderInfo){
return self.returnTX(-1, "cgateway", "资源不存在", null)
}
var status=0;
if(orderInfo.status==302){
status=3;
}
return self.returnTX(1, "cgateway", "ok", {"status":status})
}
async queryResources(pobj) {
if (!pobj.interface.para.resourceIds[0]) {
return self.returnTX(-1, "cgateway", "参数错误", null)
}
var loginfo = await this.findOne({ flow_id: pobj.interface.para.flowId, push_action_type: "orderPayNotify" });
if (!loginfo) {
return self.returnTX(-1, "cgateway", "产品不存在", null)
}
var orderInfo=await this.orderInfoDao.findOne({order_num:loginfo.dataValues.dealName});
if(!orderInfo){
return self.returnTX(-1, "cgateway", "资源不存在", null)
}
var status=0;
if(orderInfo.status==302){
status=3;
}
return self.returnTX(1, "cgateway", "ok", {"status":loginfo.push_status}) return self.returnTX(1, "cgateway", "ok", {"status":loginfo.push_status})
} }
......
...@@ -31,14 +31,14 @@ class NeedInfoService extends ServiceBase { ...@@ -31,14 +31,14 @@ class NeedInfoService extends ServiceBase {
} }
var self = this; var self = this;
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
await self.dao.update({ id: needinfo.id, status: 5 }, t); await self.dao.update({ id: needinfo.id, status: 5,close_reason:ab.note }, t);
var needsolution = await self.needSolutionDao.model.findOne({ // var needsolution = await self.needSolutionDao.model.findOne({
where: { need_num: ab.needNum }, // where: { need_num: ab.needNum },
raw: true // raw: true
}); // });
if (needsolution && needsolution.id) { // if (needsolution && needsolution.id) {
await sqlf.needSolutionDao.update({ id: needsolution.id, refusal_notes: ab.note }, t); // await sqlf.needSolutionDao.update({ id: needsolution.id, refusal_notes: ab.note }, t);
} // }
return system.getResultSuccess(); return system.getResultSuccess();
}) })
...@@ -78,8 +78,8 @@ class NeedInfoService extends ServiceBase { ...@@ -78,8 +78,8 @@ class NeedInfoService extends ServiceBase {
if (serviceinfo.status < 0) { if (serviceinfo.status < 0) {
return system.getResultFail(-203, "servicer is empty"); return system.getResultFail(-203, "servicer is empty");
} }
actionBody.servicerCode = serviceinfo.data.servicer_code; actionBody.ServicerCode = serviceinfo.data.servicer_code;
actionBody.servicerName = serviceinfo.data.servicer_name; actionBody.ServicerName = serviceinfo.data.servicer_name;
//需求创建 //需求创建
var need_num = await this.getBusUid("n"); var need_num = await this.getBusUid("n");
var datavalue = { var datavalue = {
...@@ -92,8 +92,8 @@ class NeedInfoService extends ServiceBase { ...@@ -92,8 +92,8 @@ class NeedInfoService extends ServiceBase {
consult_type: actionBody.ConsultType, consult_type: actionBody.ConsultType,
consult_type_name: actionBody.ConsultTypeName, consult_type_name: actionBody.ConsultTypeName,
notes: actionBody.Notes, notes: actionBody.Notes,
servicer_code: actionBody.servicerCode, servicer_code: actionBody.ServicerCode,
servicer_name: actionBody.servicerName, servicer_name: actionBody.ServicerName,
status: 1 status: 1
} }
if (actionBody.CompanyName) { if (actionBody.CompanyName) {
...@@ -101,49 +101,53 @@ class NeedInfoService extends ServiceBase { ...@@ -101,49 +101,53 @@ class NeedInfoService extends ServiceBase {
companyName: actionBody.CompanyName companyName: actionBody.CompanyName
}; };
} }
var newneedinfo = await this.create(datavalue);
if (!newneedinfo) {
return system.getResultFail(-310, "newneedinfo cannot be created");
}
actionBody.NeedNum = need_num; actionBody.NeedNum = need_num;
//生产者------需求推送 //生产者------需求推送
var pushobj = { var pushobj = {
"actionType": "needSubmit",// Y 功能名称 "actionType": "produceData",// Y 功能名称
"actionBody": { "actionBody": {
notifyUrl: "http://192.168.1.113:4011/api/action/need/springBoard", notifyUrl: "http://192.168.1.113:4011/api/receive/notifyApi/springBoard",
actionType: "needSubmit", actionType: "needSubmit",
pushUrl: settings.apiconfig.deliveryUrl() + "/entService/consultation/springBoard", pushUrl: settings.apiconfig.deliveryUrl() + "/entService/consultation/springBoard",
messageBody: actionBody, messageBody: actionBody,
identifyCode: "needSubmit" identifyCode: "needSubmit"
} }
}; };
this.execPostByTimeOut(pushobj, settings.apiconfig.opPushUrl()); var r = await this.execPostByTimeOut(pushobj, settings.apiconfig.opPushUrl());
if (r.status < 1) {
return system.getResultFail(-102, "Post error");
}
var newneedinfo = await this.create(datavalue);
if (!newneedinfo) {
return system.getResultFail(-310, "newneedinfo cannot be created");
}
return system.getResultSuccess(); return system.getResultSuccess();
} catch (e) { } catch (e) {
console.log(e)
return system.getResultFail(-510, e) return system.getResultFail(-510, e)
} }
} }
//需求提交回调 //需求提交回调
async notifyNeedSubmit(actionBody) { async notifyNeedSubmit(actionBody) {
if (!actionBody.needNum) { if (actionBody.resultInfo.status < 1) {
return system.getResultFail(-1, "返回值异常")
}
if (!actionBody.messageBody.NeedNum) {
return system.getResultFail(-102, "needNum cannot be empty"); return system.getResultFail(-102, "needNum cannot be empty");
} }
var needinfo = await this.findOne({ need_num: needNum }); var needinfo = await this.findOne({ need_num: actionBody.messageBody.NeedNum });
if (!needinfo) { if (!needinfo) {
return system.getResultFail(-102, "needinfo is empty"); return system.getResultFail(-102, "needinfo is empty");
} }
needinfo.DataValue.status = 2;
try { try {
await this.update(needinfo.DataValue); await this.update({ id: needinfo.dataValues.id, status: 2 });
return system.getResultSuccess(); return system.getResultSuccess();
} catch (error) { } catch (error) {
return system.getResultFail(-510, error)
} }
} }
...@@ -153,7 +157,7 @@ class NeedInfoService extends ServiceBase { ...@@ -153,7 +157,7 @@ class NeedInfoService extends ServiceBase {
} }
var sort = [["created_at", 'desc']]; var sort = [["created_at", 'desc']];
if (searchObj.Sort) { if (searchObj.Sort) {
searchObj.Sort=JSON.parse(searchObj.Sort); searchObj.Sort = JSON.parse(searchObj.Sort);
if (searchObj.Sort.key == "createdAt") { if (searchObj.Sort.key == "createdAt") {
searchObj.Sort.key = "created_at"; searchObj.Sort.key = "created_at";
} }
...@@ -192,7 +196,9 @@ class NeedInfoService extends ServiceBase { ...@@ -192,7 +196,9 @@ class NeedInfoService extends ServiceBase {
} }
var solutionInfo = await this.needSolutionDao.findOne(sobj); var solutionInfo = await this.needSolutionDao.findOne(sobj);
if (!solutionInfo) { if (!solutionInfo) {
return system.getResultFail(-102, "solutionInfo is empty"); solutionInfo = {
dataValues: null
}
} }
var rtn = { var rtn = {
needInfo: needInfo.dataValues, needInfo: needInfo.dataValues,
......
...@@ -47,13 +47,13 @@ class NeedSolutionService extends ServiceBase { ...@@ -47,13 +47,13 @@ class NeedSolutionService extends ServiceBase {
if (needsolution.is_refusal != 1) { if (needsolution.is_refusal != 1) {
return system.getResultFail(-303, "只能修改用户驳回方案"); return system.getResultFail(-303, "只能修改用户驳回方案");
} }
var new_solution_num = await this.getBusUid("NS_"); // var new_solution_num = await this.getBusUid("NS_");
var updateObj = { id: needsolution.id, is_refusal: 0, solution_num: new_solution_num, solution_content: ab.solutionContent }; var updateObj = { id: needsolution.id, is_refusal: 0, solution_content: ab.solutionContent };
var self = this; var self = this;
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
await self.dao.update(updateObj, t); await self.dao.update(updateObj, t);
await self.needInfoDao.update({ id: needinfo.id, status: "3" }, t); await self.needInfoDao.update({ id: needinfo.id, status: "3" }, t);
return system.getResultSuccess(new_solution_num); return system.getResultSuccess();
}); });
} else { } else {
...@@ -104,15 +104,10 @@ class NeedSolutionService extends ServiceBase { ...@@ -104,15 +104,10 @@ class NeedSolutionService extends ServiceBase {
if (!solutionInfo) { if (!solutionInfo) {
return system.getResultFail(-102, "solutionInfo is empty"); return system.getResultFail(-102, "solutionInfo is empty");
} }
needInfo.dataValues.status = 2;
solutionInfo.dataValues.is_refusal = 1;
solutionInfo.dataValues.solution_content.refusal_content = actionBody.RefusalContent;
await self.needInfoDao.update(needInfo.dataValues, t);
await self.dao.update(solutionInfo.dataValues, t);
//生产者------方案反馈 //生产者------方案反馈
var pushobj = { var pushobj = {
"actionType": "needClose",// Y 功能名称 "actionType": "produceData",// Y 功能名称
"actionBody": { "actionBody": {
notifyUrl: "", notifyUrl: "",
actionType: "needClose", actionType: "needClose",
...@@ -121,7 +116,12 @@ class NeedSolutionService extends ServiceBase { ...@@ -121,7 +116,12 @@ class NeedSolutionService extends ServiceBase {
identifyCode: "needClose" identifyCode: "needClose"
} }
}; };
self.execPostByTimeOut(pushobj, settings.apiconfig.opPushUrl()); var r = await self.execPostByTimeOut(pushobj, settings.apiconfig.opPushUrl());
if (r.status < 1) {
return system.getResultFail(-102, "Post error");
}
await self.needInfoDao.update({ id: needInfo.dataValues.id, status: 2 }, t);
await self.dao.update({ id: solutionInfo.dataValues.id, is_refusal: 1, refusal_notes: actionBody.RefusalContent }, t);
return system.getResultSuccess(); return system.getResultSuccess();
}) })
} }
......
const system = require("../../../system"); const system = require("../../../system");
const ServiceBase = require("../../sve.base"); const ServiceBase = require("../../sve.base");
var settings = require("../../../../config/settings"); var settings = require("../../../../config/settings");
const {PDICT} = require("../../../../config/platform"); const {PDICT,MsgTemplate} = require("../../../../config/platform");
class OrderDeliveryService extends ServiceBase { class OrderDeliveryService extends ServiceBase {
constructor() { constructor() {
super("order", ServiceBase.getDaoName(OrderDeliveryService)); super("order", ServiceBase.getDaoName(OrderDeliveryService));
...@@ -10,6 +10,7 @@ class OrderDeliveryService extends ServiceBase { ...@@ -10,6 +10,7 @@ class OrderDeliveryService extends ServiceBase {
this.qualificationCertificateDao = system.getObject("db.order.qualificationCertificateDao"); this.qualificationCertificateDao = system.getObject("db.order.qualificationCertificateDao");
this.applyInfoDao = system.getObject("db.order.applyInfoDao"); this.applyInfoDao = system.getObject("db.order.applyInfoDao");
this.execClient = system.getObject("util.execClient"); this.execClient = system.getObject("util.execClient");
this.utilsMsgSendSve = system.getObject("service.utilsSve.utilsMsgSendSve");
} }
//服务商提交交付信息 //服务商提交交付信息
async submitDeliveryInfo(pobj){ async submitDeliveryInfo(pobj){
...@@ -144,9 +145,71 @@ class OrderDeliveryService extends ServiceBase { ...@@ -144,9 +145,71 @@ class OrderDeliveryService extends ServiceBase {
this.createQualificationCertificateInfo(ab.orderNum);//创建资质证照信息 this.createQualificationCertificateInfo(ab.orderNum);//创建资质证照信息
this.createApplyInfo(ab.orderNum);//创建申请主体信息 this.createApplyInfo(ab.orderNum);//创建申请主体信息
} }
//发送短信通知
// this.sendSmsNotification(ab.orderNum,ab.status);
return system.getResultSuccess(); return system.getResultSuccess();
} }
/** /**
* 发送短信通知
* @param {*} orderNum 订单号
* @param {*} status 订单交付状态
*/
async sendSmsNotification(orderNum,status){
try {
//获取订单详情
var orderDetailRes = await this.dao.getOrderDetailByOrderNum(orderNum);
if(orderDetailRes && orderDetailRes.length>0){
var orderdetail = orderDetailRes[0];
var params = {phoneNumber:null,messageBody:null};
params.phoneNumber=orderdetail.order_snapshot && orderdetail.order_snapshot.contactsPhone?orderdetail.order_snapshot.contactsPhone:"13075556693";//联系人手机号
if(params.phoneNumber && orderdetail.product_type ){
var productType=orderdetail.product_type;//产品类型
var product_type_name = orderdetail.product_type_name;//产品类型名称
var productArr = product_type_name.split("/");
if(productArr && productArr.length==4){
product_type_name = productArr[2];
}
if(productType=="/ic/cpreg/" && status==130){
return;
}
var messageBody= null;//短信模板
if(productType.indexOf("/ic/")>=0){//工商产品
messageBody=MsgTemplate.ic.order[status] && MsgTemplate.ic.order[status].sms?MsgTemplate.ic.order[status].sms:"";
}
if(productType.indexOf("/qcfw/")>=0){//资质证照
messageBody=MsgTemplate.qcfw.order[status] && MsgTemplate.qcfw.order[status].sms?MsgTemplate.qcfw.order[status].sms:"";
}
if(messageBody){
messageBody = messageBody.replace(/{productName}/g,product_type_name)
.replace(/{orderNum}/g,orderdetail.order_num);
if(orderdetail.end_time){//过期时间
messageBody = messageBody.replace(/{expirationDate}/g,orderdetail.end_time);
}
var deliverContent = orderdetail.deliver_content;
if(deliverContent){
if(productType=="/ic/cpreg/" && deliverContent.companyInfo && deliverContent.companyInfo.registeredPark){//注册园区
messageBody = messageBody.replace(/{parkName}/g,deliverContent.companyInfo.registeredPark);
}
}
params.messageBody = messageBody;
params.phoneNumber = "13075556693";
console.log(JSON.stringify(params))
this.utilsMsgSendSve.sendMessageByPhone(params);//发送短信
}
}
}
} catch (e) {
this.execClient.execLogs("orderDeliverySve.js/sendSmsNotification(发送短信通知)方法出现异常", {mobile:mobile,orderDeliveryInfo:orderDeliveryInfo}, "", null, e.stack);
}
}
/**
* 创建资质信息 * 创建资质信息
* @param {*} orderNum 订单号 * @param {*} orderNum 订单号
*/ */
...@@ -266,6 +329,6 @@ class OrderDeliveryService extends ServiceBase { ...@@ -266,6 +329,6 @@ class OrderDeliveryService extends ServiceBase {
} }
module.exports = OrderDeliveryService; module.exports = OrderDeliveryService;
// var task = new OrderDeliveryService(); // var task = new OrderDeliveryService();
// task.createQualificationCertificateInfo("O202006130014").then(d=>{ // task.sendSmsNotification("1111125",120).then(d=>{
// }) // })
...@@ -69,7 +69,7 @@ class UtilsMsgSendService extends AppServiceBase { ...@@ -69,7 +69,7 @@ class UtilsMsgSendService extends AppServiceBase {
var sendResult = await this.sendPhoneMsg(params); var sendResult = await this.sendPhoneMsg(params);
return sendResult; return sendResult;
} }
async sendPhoneMsg(params) { async sendPhoneMsg(obj) {
var params = { var params = {
"version": 1, "version": 1,
"caller": "postman", "caller": "postman",
...@@ -82,14 +82,14 @@ class UtilsMsgSendService extends AppServiceBase { ...@@ -82,14 +82,14 @@ class UtilsMsgSendService extends AppServiceBase {
"themeId": 364, "themeId": 364,
"tplParams": { "tplParams": {
"smsTpl": [ "smsTpl": [
params.messageBody obj.messageBody
] ]
}, },
"receiver": { "receiver": {
"wechatList": [ "wechatList": [
], ],
"phoneList": [ "phoneList": [
params.phoneNumber obj.phoneNumber
], ],
"emailList": [ "emailList": [
], ],
......
var settings = {
redis: {
host: "43.247.184.32",
port: 8967,
password: "Gongsibao2018",
db: 5,
},
database: {
dbname: "tx-shop",
user: "write",
password: "write",
config: {
host: '43.247.184.35',
port: 8899,
dialect: 'mysql',
operatorsAliases: false,
pool: {
max: 5,
min: 0,
acquire: 90000000,
idle: 1000000
},
debug: false,
dialectOptions: {
requestTimeout: 999999,
// timezone: '+8:00'
// instanceName:'DEV'
} //设置MSSQL超时时间
}
},
reqEsDevUrl: "http://192.168.4.249:9200/",
reqHomePageDevUrl: "http://zcchannel.apps.com:4003/",
reqAuthUrl: "http://sj.app.com:4002/auth"
};
module.exports = settings;
...@@ -22,7 +22,7 @@ var settings = { ...@@ -22,7 +22,7 @@ var settings = {
return "http://60.205.209.94:4019/api/queueAction/producer/springBoard"; return "http://60.205.209.94:4019/api/queueAction/producer/springBoard";
}, },
opPushUrl: function () { opPushUrl: function () {
return "http://192.168.1.128/api/queueAction/producer/springBoard"; return "http://192.168.1.128:4018/api/queueAction/producer/springBoard";
}, },
deliveryUrl: function () { deliveryUrl: function () {
return "http://tx.g.com:8000"; return "http://tx.g.com:8000";
......
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
1. [商城询价接口](#SelPrice2TX) 1. [商城询价接口](#SelPrice2TX)
1. [用户获取概览数据](#GetOverviewInfoByUser) 1. [用户获取概览数据](#GetOverviewInfoByUser)
1. [立即购买](#SubmitGoodsinfo) 1. [立即购买](#SubmitGoodsinfo)
1. [需求提交](#NeedSubmit) 1. [需求提交](#SubmitNeed)
1. [需求列表](#NeedList) 1. [需求列表](#GetNeedList)
1. [需求详情](#NeedDetail) 1. [需求详情](#GetNeedDetail)
1. [根据交付状态获取订单列表](#GetOrderListByStatus) 1. [根据交付状态获取订单列表](#GetOrderListByStatus)
1. [关闭需求](#RefusalSolution) 1. [关闭需求](#RefusalSolution)
1. [我的资质证照列表](#GetQualificationCertificateListByUserAndType) 1. [我的资质证照列表](#GetQualificationCertificateListByUserAndType)
...@@ -173,13 +173,15 @@ ...@@ -173,13 +173,15 @@
"DiscountAmount": 0, "DiscountAmount": 0,
"PayTotalSum": 300, "PayTotalSum": 300,
"RefundSum": 0, "RefundSum": 0,
"PayTime": null,
"OrderStatus": 1, "OrderStatus": 1,
"Notes": "第一单", "Notes": "第一单",
"CreatedAt": "2020-06-03T10:17:28.000Z", "CreatedAt": "2020-06-03T10:17:28.000Z",
"UpdatedAt": null, "UpdatedAt": null,
"Orderdeliveryinfo": "{\"deliver_content\":{\"agent\":\"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) snap Chromium/83.0.4103.61 Chrome/83.0.4103.61 Safari/537.36\",\"userid\":\"13\",\"bizpath\":\"/deliverManage/cmpBizDeliverCase\",\"baseInfo\":{\"isVirtual\":\"\",\"isWhether\":\"\",\"payStatus\":\"已交付\",\"contactsName\":\"wangyongfei1122\",\"contactsPhone\":\"23456789\"},\"clientIp\":\"192.168.1.199\",\"username\":\"wangyongfei\",\"classname\":\"bizchance.deliverybillCtl\",\"company_id\":\"11\",\"companyInfo\":{\"spareName\":[\"兴业1\",\"兴业2\",\"兴业3\"],\"spareName1\":\"兴业1\",\"spareNames\":[{\"value\":\"兴业2\",\"status\":1},{\"value\":\"兴业3\",\"status\":1}],\"addressType\":\"practical\",\"companyName\":\"兴业有限公司\",\"fullAddress\":\"发发地方\",\"serviceArea\":\"shanghai\",\"taxpayerType\":\"generalTaxpayer\",\"businessScope\":\"演出及经纪业务;组织文化艺术活动;演出票务代理;字画、工艺美术品(金饰品除外)、旅游纪念品的销售;演出器材的销售、租赁;艺术装饰;艺术品展示;舞台美术、工艺美术品、包装装璜设计、制作。\",\"registeredDate\":\"2020-06-16\",\"engagedIndustry\":\"culturalMedia\",\"operatingPeriod\":\"发到付\",\"companyProperties\":\"limitedLiabilityCompany\",\"registeredCapital\":80,\"reserveProportion\":79},\"deliverInfo\":{\"isVirtual\":\"\",\"isWhether\":\"\",\"payStatus\":\"已交付\",\"contactsName\":\"张三\",\"contactsPhone\":\"13800138000\"},\"contactsInfo\":{\"contactsName\":\"wangyongfei1122\",\"contactsPhone\":\"23456789\"},\"positionInfo\":{\"positionData\":[{\"fixedPhone\":\"2345678\",\"mailboxInfo\":\"2839273\",\"mobilePhone\":\"45678\",\"persionName\":\"附近的酸辣粉\",\"functionInfo\":\"发链接\",\"houseAddress\":\"的激发了肯德基\"}]},\"deliverNumber\":\"1111115\",\"registeredInfo\":{\"registeredDate\":\"2020-06-16\",\"registeredCapital\":80,\"reserveProportion\":79},\"contributionInfo\":{\"contributionData\":[{\"phoneNumber\":\"1234567\",\"contactAddress\":\"房间爱老师肯定放假啦\",\"hareholderName\":\"兴业\",\"contributionAmount\":\"80\",\"IdentificationNumber\":\"2345678\",\"contributionProportion\":\"10\"}]}},\"created_at\":\"2020-06-12T16:19:53.000Z\",\"updated_at\":\"2020-06-17T08:16:34.000Z\",\"delivery_status\":130,\"delivery_status_name\":\"工商审核环节\"}" "OrderDeliveryInfo": "{\"deliver_content\":{\"agent\":\"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) snap Chromium/83.0.4103.61 Chrome/83.0.4103.61 Safari/537.36\",\"userid\":\"13\",\"bizpath\":\"/deliverManage/cmpBizDeliverCase\",\"baseInfo\":{\"isVirtual\":\"\",\"isWhether\":\"\",\"payStatus\":\"已交付\",\"contactsName\":\"wangyongfei1122\",\"contactsPhone\":\"23456789\"},\"clientIp\":\"192.168.1.199\",\"username\":\"wangyongfei\",\"classname\":\"bizchance.deliverybillCtl\",\"company_id\":\"11\",\"companyInfo\":{\"spareName\":[\"兴业1\",\"兴业2\",\"兴业3\"],\"spareName1\":\"兴业1\",\"spareNames\":[{\"value\":\"兴业2\",\"status\":1},{\"value\":\"兴业3\",\"status\":1}],\"addressType\":\"practical\",\"companyName\":\"兴业有限公司\",\"fullAddress\":\"发发地方\",\"serviceArea\":\"shanghai\",\"taxpayerType\":\"generalTaxpayer\",\"businessScope\":\"演出及经纪业务;组织文化艺术活动;演出票务代理;字画、工艺美术品(金饰品除外)、旅游纪念品的销售;演出器材的销售、租赁;艺术装饰;艺术品展示;舞台美术、工艺美术品、包装装璜设计、制作。\",\"registeredDate\":\"2020-06-16\",\"engagedIndustry\":\"culturalMedia\",\"operatingPeriod\":\"发到付\",\"companyProperties\":\"limitedLiabilityCompany\",\"registeredCapital\":80,\"reserveProportion\":79},\"deliverInfo\":{\"isVirtual\":\"\",\"isWhether\":\"\",\"payStatus\":\"已交付\",\"contactsName\":\"张三\",\"contactsPhone\":\"13800138000\"},\"contactsInfo\":{\"contactsName\":\"wangyongfei1122\",\"contactsPhone\":\"23456789\"},\"positionInfo\":{\"positionData\":[{\"fixedPhone\":\"2345678\",\"mailboxInfo\":\"2839273\",\"mobilePhone\":\"45678\",\"persionName\":\"附近的酸辣粉\",\"functionInfo\":\"发链接\",\"houseAddress\":\"的激发了肯德基\"}]},\"deliverNumber\":\"1111115\",\"registeredInfo\":{\"registeredDate\":\"2020-06-16\",\"registeredCapital\":80,\"reserveProportion\":79},\"contributionInfo\":{\"contributionData\":[{\"phoneNumber\":\"1234567\",\"contactAddress\":\"房间爱老师肯定放假啦\",\"hareholderName\":\"兴业\",\"contributionAmount\":\"80\",\"IdentificationNumber\":\"2345678\",\"contributionProportion\":\"10\"}]}},\"created_at\":\"2020-06-12T16:19:53.000Z\",\"updated_at\":\"2020-06-17T08:16:34.000Z\",\"delivery_status\":130,\"delivery_status_name\":\"工商审核环节\"}",
"OrderProductInfo": "{\"time_span\":null,\"time_unit\":null,\"end_time\":null}"
}, },
"RequestId": "bba7f390-b29c-11ea-97f7-efd638e57201" "RequestId": "16c9d3d0-b43a-11ea-9bcc-11a1d3415630"
} }
} }
...@@ -515,13 +517,13 @@ ...@@ -515,13 +517,13 @@
} }
``` ```
## **<a name="NeedSubmit"> 创建需求</a>** ## **<a name="SubmitNeed"> 创建需求</a>**
[返回到目录](#menu) [返回到目录](#menu)
##### URL ##### URL
[/api/action/need/springBoard] [/api/action/need/springBoard]
#### 参数格式 `JSON` #### 参数格式 `JSON`
#### HTTP请求方式 `POST` #### HTTP请求方式 `POST`
#### 功能模块 Action:NeedSubmit #### 功能模块 Action:SubmitNeed
#### 参数说明 #### 参数说明
...@@ -542,7 +544,7 @@ ...@@ -542,7 +544,7 @@
#### 参数示例 #### 参数示例
``` javascript ``` javascript
{ {
"Action": "needSubmit", "Action": "SubmitNeed",
"ActionBody": { "ActionBody": {
"UserId": "011", "UserId": "011",
"ContactsMoblie":"17610163852", "ContactsMoblie":"17610163852",
...@@ -566,13 +568,13 @@ ...@@ -566,13 +568,13 @@
} }
``` ```
## **<a name="NeedList"> 需求列表</a>** ## **<a name="GetNeedList"> 需求列表</a>**
[返回到目录](#menu) [返回到目录](#menu)
##### URL ##### URL
[/api/action/need/springBoard] [/api/action/need/springBoard]
#### 参数格式 `JSON` #### 参数格式 `JSON`
#### HTTP请求方式 `POST` #### HTTP请求方式 `POST`
#### 功能模块 Action:NeedList #### 功能模块 Action:GetNeedList
#### 参数说明 #### 参数说明
...@@ -591,7 +593,7 @@ ...@@ -591,7 +593,7 @@
#### 参数示例 #### 参数示例
``` javascript ``` javascript
{ {
"Action": "NeedList", "Action": "GetNeedList",
"ActionBody": { "ActionBody": {
"UserId": "011", "UserId": "011",
"PageNo":"1", "PageNo":"1",
...@@ -618,13 +620,13 @@ ...@@ -618,13 +620,13 @@
} }
``` ```
## **<a name="needDetail"> 需求详情</a>** ## **<a name="GetNeedDetail"> 需求详情</a>**
[返回到目录](#menu) [返回到目录](#menu)
##### URL ##### URL
[/api/action/need/springBoard] [/api/action/need/springBoard]
#### 参数格式 `JSON` #### 参数格式 `JSON`
#### HTTP请求方式 `POST` #### HTTP请求方式 `POST`
#### 功能模块 Action:NeedDetail #### 功能模块 Action:GetNeedDetail
#### 参数说明 #### 参数说明
...@@ -636,7 +638,7 @@ ...@@ -636,7 +638,7 @@
#### 参数示例 #### 参数示例
``` javascript ``` javascript
{ {
"Action": "NeedDetail", "Action": "GetNeedDetail",
"ActionBody": { "ActionBody": {
"NeedNum": "202006100003" "NeedNum": "202006100003"
} }
......
...@@ -128,7 +128,7 @@ order_snapshot | Y | string | 500 | 订单快照(json转字符串) ...@@ -128,7 +128,7 @@ order_snapshot | Y | string | 500 | 订单快照(json转字符串)
"contactsName":"", "contactsName":"",
"contactsMoblie":"", "contactsMoblie":"",
"productType":"" "productType":""
"order_snapshot":{} "orderSnapshot":{}
} }
} }
``` ```
...@@ -154,15 +154,16 @@ order_snapshot | Y | string | 500 | 订单快照(json转字符串) ...@@ -154,15 +154,16 @@ order_snapshot | Y | string | 500 | 订单快照(json转字符串)
参数名 | 必须 | 字段类型 | 长度限制 | 说明 参数名 | 必须 | 字段类型 | 长度限制 | 说明
-|-|-|-|- -|-|-|-|-
needNum | Y | string | 100 | 需求号 NeedNum | Y | string | 100 | 需求号
refusalContent | Y | string | 100 | 备注信息 RefusalContent | Y | string | 100 | 备注信息
SolutionNum | Y | string | 100 | 方案号
``` javascript ``` javascript
{ {
"actionType": "needClose", "actionType": "needClose",
"actionBody": { "actionBody": {
"needNum":"", "NeedNum":"",
"refusalContent":"" //描述 "RefusalContent":"", //描述
"SolutionNum":""
} }
} }
......
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