Commit 7691c8c2 by linboxuan

Merge branch 'center-order' of http://gitlab.gongsibao.com/jiangyong/zhichan into center-order

parents 9ef60baf 4b57a3fd
......@@ -5,6 +5,7 @@ const uuidv4 = require('uuid/v4');
const md5 = require("MD5");
class APIBase {
constructor() {
this.execClientNew = system.getObject("util.execClientNew");
this.logCtl = system.getObject("service.common.oplogSve");
this.exTime = 2 * 3600;//缓存过期时间,2小时
}
......@@ -44,43 +45,49 @@ class APIBase {
isPassResult.requestId = "";
return isPassResult;
}
var rtn = await this[methodname](pobj, query, req);
var result = await this[methodname](pobj, query, req);
if (!result.requestId) {
result.requestId = pobj.RequestId ? pobj.RequestId : pobj.requestId || req.requestId;
}
this.logCtl.createDb({
appid: pobj.appInfo ? pobj.appInfo.uapp_id : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key : "",
requestId: req.requestId,
op: req.classname + "/" + methodname,
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(rtn),
resultInfo: JSON.stringify(result),
clientIp: req.clientIp,
agent: req.uagent,
opTitle: "api服务提供方appKey:" + settings.appKey,
});
rtn.requestId = req.requestId;
return rtn;
var tmpResult = pobj.actionType && pobj.actionType.indexOf("List") < 0 ? result : { status: result.status, message: result.message, requestId: result.requestId };
this.execClientNew.execLogs("center-order-doexecMethod-reqPath:" + req.path, pobj, "center-order-doexecMethod", tmpResult, null);
return result;
} catch (e) {
console.log(e.stack, "api调用出现异常,请联系管理员..........")
const stackStr = e.stack ? e.stack : JSON.stringify(e);
console.log(stackStr, "api调用出现异常,请联系管理员..........")
this.logCtl.createDb({
appid: pobj.appInfo ? pobj.appInfo.uapp_id : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key : "",
requestId: req.requestId,
op: req.classname + "/" + methodname,
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(e.stack),
resultInfo: stackStr,
clientIp: req.clientIp,
agent: req.uagent,
opTitle: "api调用出现异常,请联系管理员error,appKey:" + settings.appKey,
});
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key : "",
requestId: req.requestId,
op: req.classname + "/" + methodname,
content: e.stack,
clientIp: pobj.clientIp,
agent: req.uagent,
optitle: "api调用出现异常,请联系管理员",
});
// this.logCtl.error({
// appid: pobj.appInfo ? pobj.appInfo.uapp_id : "",
// appkey: pobj.appInfo ? pobj.appInfo.uapp_key : "",
// requestId: req.requestId,
// op: req.classname + "/" + methodname,
// content: e.stack,
// clientIp: pobj.clientIp,
// agent: req.uagent,
// optitle: "api调用出现异常,请联系管理员",
// });
this.execClientNew.execLogs("center-order-doexecMethod-reqPath异常:" + req.path, pobj, "center-channel-doexecMethod", null, stackStr);
var rtnerror = system.getResultFail(-200, "出现异常,error:" + e.stack);
rtnerror.requestId = req.requestId;
return rtnerror;
......
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class BaseAPI extends APIBase {
constructor() {
super();
this.aliyunqcSve = system.getObject("service.qcutils.aliyunqcSve");
this.baiduqcSve = system.getObject("service.qcutils.baiduqcSve");
this.baseqcSve = system.getObject("service.qcutils.baseqcSve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
if (pobj.actionType == 'getPolicyNeedList' || pobj.actionType == 'submitPolicyNeedNotes') {
if (!pobj.userInfo) {
return system.getResult(system.noLogin, "user no login!");
}
if (!pobj.appInfo) {
return system.getResult(system.noLogin, "app is null!");
}
}
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess(pobj, action_type, req) {
console.log("pobj",pobj)
var opResult = null;
switch (action_type) {
case "receiveProgrammeNo"://接收方案编号(方案推送至阿里后,接收保存方案信息)
opResult = await this.baseqcSve.receiveProgrammeNo(pobj);
break;
case "submitIcpProgramme"://icp方案提交
opResult = await this.baseqcSve.submitIcpProgramme(pobj);
break;
// case "submitIcpMaterial"://icp材料提交
// opResult = await this.baseqcSve.submitIcpMaterial(pobj);
// break;
case "acceptIcpPartnerNotification"://icp通知状态变更
opResult = await this.baseqcSve.acceptIcpPartnerNotification(pobj);
break;
case "abolishIcpProgramme"://服务商icp方案关闭
opResult = await this.baseqcSve.abolishIcpProgramme(pobj);
break;
case "getIcpProgrammeDetail"://获取icp方案
opResult = await this.baseqcSve.getIcpProgrammeDetail(pobj);
break;
case "getNeedSolutionDetailByUser"://获取方案详情
opResult = await this.baseqcSve.getNeedSolutionDetailByUser(pobj);
break;
case "receiveIcpStatusNotify"://接收渠道方案状态变更通知2.3
opResult = await this.baseqcSve.receiveIcpStatusNotify(pobj);
break;
case "receiveIcpFeedback"://接收icp用户方案反馈2.2
opResult = await this.baseqcSve.receiveIcpFeedback(pobj);
break;
case "getIcpProgrammeDetail"://获取方案详情(内部调用)
opResult = await this.baseqcSve.getIcpProgrammeDetail(pobj);
break;
case "getProgrammeInfoByChannelNeedNo"://获取需求方案列表
opResult = await this.baseqcSve.getProgrammeInfoByChannelNeedNo(pobj);
break;
case "serviceProviderSubmitMaterial"://交付商提交材料信息
opResult = await this.baseqcSve.serviceProviderSubmitMaterial(pobj);
break;
case "serviceProviderNotification"://交付商通知状态变更
opResult = await this.baseqcSve.serviceProviderNotification(pobj);
break;
case "closeOrderDelivery"://交付商关闭交付单
opResult = await this.baseqcSve.closeOrderDelivery(pobj);
break;
case "abolishIcpProgrammeByNeed"://前端关闭ICP需求及方案
opResult = await this.baseqcSve.abolishIcpProgrammeByNeed(pobj);
break;
case "receiveIcpConfirmUrl"://前端关闭ICP需求及方案
opResult = await this.baseqcSve.receiveIcpConfirmUrl(pobj);
break;
//-----------文网文-----------
case "serviceSubmitOption"://服务商提交服务操作
opResult = await this.baseqcSve.serviceSubmitOption(pobj);
break;
case "submitWangwenSolution"://提交方案
opResult = await this.baseqcSve.submitWangwenSolution(pobj);
break;
case "closeNeed"://关闭需求
opResult = await this.baseqcSve.closeNeed(pobj);
break;
case "recordLog"://提交沟通记录
opResult = await this.baseqcSve.recordLog(pobj);
break;
//-----------食品-----------
case "foodServiceSubmitOption"://服务商提交服务操作
opResult = await this.baseqcSve.foodServiceSubmitOption(pobj);
break;
case "submitFoodSolution"://提交方案
opResult = await this.baseqcSve.submitFoodSolution(pobj);
break;
case "foodCloseNeed"://关闭需求
opResult = await this.baseqcSve.foodCloseNeed(pobj);
break;
case "foodRecordLog"://提交沟通记录
opResult = await this.baseqcSve.foodRecordLog(pobj);
break;
case "receiveOrderStatusNotify"://接收订单状态推送 百度icp 2.3
opResult = await this.baiduqcSve.receiveOrderStatusNotify(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = BaseAPI;
\ No newline at end of file
......@@ -5,6 +5,7 @@ class IcAPI extends APIBase {
constructor() {
super();
this.needinfoSve = system.getObject("service.dbneed.needinfoSve");
this.needsolutionSve = system.getObject("service.dbneed.needsolutionSve");
}
/**
* 接口跳转-POST请求
......@@ -63,6 +64,9 @@ class IcAPI extends APIBase {
case "getUnCreated":// 获取需求列表
opResult = await this.needinfoSve.getUnCreated(pobj, pobj.actionBody, req);
break;
case "createSolution"://创建方案
opResult = await this.needsolutionSve.createNewSolution(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class IcAPI extends APIBase {
constructor() {
super();
this.needinfoSve = system.getObject("service.dbneed.needinfoSve");
this.needinfoSve2 = system.getObject("service.dbneed.needinfoSve2");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
if (pobj.actionType == 'getPolicyNeedList' || pobj.actionType == 'submitPolicyNeedNotes') {
if (!pobj.userInfo) {
return system.getResult(system.noLogin, "user no login!");
}
if (!pobj.appInfo) {
return system.getResult(system.noLogin, "app is null!");
}
}
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess(pobj, action_type, req) {
var opResult = null;
switch (action_type) {
case "submitNeed"://提交需求
opResult = await this.needinfoSve2.submitNeed(pobj, pobj.actionBody, req);
break;
case "submitNeedH5"://工商H5提交需求
opResult = await this.needinfoSve2.submitNeedH5(pobj, pobj.actionBody, req);
break;
case "getItemByNeedNo"://获取需求详情
opResult = await this.needinfoSve2.getItemByNeedNo(pobj);
break;
case "getItemByChannelNeedNo"://获取需求详情
opResult = await this.needinfoSve2.getItemByChannelNeedNo(pobj);
break;
case "needClose"://需求关闭
opResult = await this.needinfoSve2.needClose(pobj, pobj.actionBody, req);
break;
case "getItemByChannelSolutionNo"://渠道方案号获取需求详情
opResult = await this.needinfoSve2.getItemByChannelSolutionNo(pobj, pobj.actionBody, req);
break;
case "writeCommunicationLog"://渠道方案号获取需求详情
opResult = await this.needinfoSve2.writeCommunicationLog(pobj, pobj.actionBody, req);
break;
case "submitIcpIntention":// 2020 0827 lin 新增 4.1 提交需求
opResult = await this.needinfoSve2.submitIcpIntention(pobj, pobj.actionBody, req);
break;
case "queryIntentionList":// 2020 0827 lin 新增 4.2 需求列表查询
opResult = await this.needinfoSve2.queryIntentionList(pobj, pobj.actionBody, req);
break;
case "confirmIcpIntention":// 2020 0827 lin 新增 4.3 用户需求确认
opResult = await this.needinfoSve2.confirmIcpIntention(pobj, pobj.actionBody, req);
break;
case "getUnCreated":// 获取需求列表
opResult = await this.needinfoSve2.getUnCreated(pobj, pobj.actionBody, req);
break;
case "queryExpertApplyCommunicationLogs":// 查询需求沟通记录 2020-10-28 laolan
opResult = await this.needinfoSve2.queryExpertApplyCommunicationLogs(pobj, pobj.actionBody, req);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = IcAPI;
\ No newline at end of file
......@@ -26,16 +26,17 @@ class OrderAPI extends APIBase {
var opResult = null;
switch (action_type) {
case "addOrder"://创建订单
this.execClientNew.execLogs("center-order-addOrder-info-1:" + req.path, pobj, "center-order-doexecMethod", null, null);
opResult = await this.addOrder(pobj, pobj.actionBody);
break;
case "getOrderInfo"://获取订单列表信息
opResult = await this.orderinfoSve.getOrderInfo(pobj, pobj.actionBody);
break;
case "getOrderListByOrderServiceNo"://根据合同号获取子订单
opResult = await this.orderinfoSve.getOrderListByOrderServiceNo(pobj,pobj.actionBody);
opResult = await this.orderinfoSve.getOrderListByOrderServiceNo(pobj, pobj.actionBody);
break;
case "getOrderServiceNoByOrderNo"://根据订单号获取合同号
opResult = await this.orderinfoSve.getOrderServiceNoByOrderNo(pobj,pobj.actionBody);
opResult = await this.orderinfoSve.getOrderServiceNoByOrderNo(pobj, pobj.actionBody);
break;
case "getOrderDetails"://获取订单详情信息
opResult = await this.orderinfoSve.getOrderDetails(pobj, pobj.actionBody);
......@@ -68,7 +69,7 @@ class OrderAPI extends APIBase {
opResult = await this.orderinfoSve.getOrderByChannelOrderNo(pobj, pobj.actionBody);
break;
case "updateOrder":
opResult = await this.orderinfoSve.updateOrderById(pobj,pobj.actionBody);
opResult = await this.orderinfoSve.updateOrderById(pobj, pobj.actionBody);
break;
case "channeldelOrder"://阿里工商注册退款
opResult = await this.orderinfoSve.channeldelOrder(pobj, pobj.actionBody);
......@@ -142,6 +143,7 @@ class OrderAPI extends APIBase {
return system.getResult(null, "产品接口参数方法信息有误,20050");
}
var params = [pobj];
this.execClientNew.execLogs("center-order-addOrder-reflexAction-info-2:", params, "center-order-doexecMethod", null, null);
refResult = await invokeObj[interface_info.method_name].apply(invokeObj, params);
}
else if (interface_info.interface_type == "yc") {
......
......@@ -112,6 +112,12 @@ class QcAPI extends APIBase {
case "receiveOrderStatusNotify"://接收订单状态推送 百度icp 2.3
opResult = await this.baiduqcSve.receiveOrderStatusNotify(pobj);
break;
case "icpOrderClose"://关闭ICP订单 百度icp 2.4
opResult = await this.baiduqcSve.icpOrderClose(pobj);
break;
case "addIcpSalesmanInfo"://添加业务员信息,用于直接下单的icp订单
opResult = await this.baiduqcSve.addIcpSalesmanInfo(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -15,6 +15,7 @@ class OrderInfoDao extends Dao {
"orderNo",
"channelServiceNo",
"channelOrderNo",
"orderServiceNo",
"channelUserId",
"ownerUserId",
"payTime",
......@@ -49,5 +50,10 @@ class OrderInfoDao extends Dao {
};
return await this.delete(sqlWhere);
}
async addOrderDelivery(data, orderNo, t) {//新增交付信息
const sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" +
orderNo + "','" + JSON.stringify(data) + "')";
await this.customInsert(sql, null, t);
}
}
module.exports = OrderInfoDao;
......@@ -4,6 +4,7 @@ const settings = require("../../config/settings");
const md5 = require("MD5");
class AppServiceBase {
constructor() {
this.execClientNew = system.getObject("util.execClientNew");
this.restClient = system.getObject("util.restClient");
this.execClient = system.getObject("util.execClient");
this.cacheManager = system.getObject("db.common.cacheManager");
......@@ -57,5 +58,18 @@ class AppServiceBase {
var result = JSON.parse(rtn.stdout);
return result;
}
/**
* 带超时时间的post请求
* @param {*} req 请求信息
* @param {*} params 请求数据-json格式
* @param {*} url 请求地址
* @param {*} ContentType 请求头类型,默认application/json
* @param {*} headData 请求头内容-json格式,如:请求头中传递token,格式:{token:"9098902q849q0434q09439"}
* @param {*} timeOut 超时时间
*/
async execPostByTimeOut(req, params, url, ContentType, headData, timeOut = 60) {
const result = await this.execClientNew.execPostTimeOutByBusiness('app.base', params, url, ContentType, headData, timeOut, req);
return result;
}
}
module.exports = AppServiceBase;
const system = require("../../../system");
const AppBase = require("../../app.base");
var settings = require("../../../../config/settings");
class Push360Service extends AppBase{
constructor() {
super()
this.ordercontactsDao = system.getObject("db.dbcorder.ordercontactsDao");
this.orderinfoDao = system.getObject("db.dbcorder.orderinfoDao");
this.push360Url = settings.push360Url();
this.auth360Url = settings.auth360Url();
}
//推送数据至360
async pushTmStatus(actionBody,req) {
let status = 30;
if (actionBody.tmStatus == 3 || actionBody.tmStatus == "ROBOTPAY") {
status = 40;
}
let order_id = actionBody.orderNo;
var result, pushObj, url;
try {
let rtn = await this.execClient.exec360GetToken(this.auth360Url)
if (!rtn || !rtn.stdout) {
return system.getResult(null, "restPost data is empty");
}
let tokenResult = JSON.parse(rtn.stdout);
let token = tokenResult.access_token;
url = this.push360Url + 'api/v1/eshop/GsbOrderUpdate?token=' + token;
pushObj = {
order_id: order_id,
status: status
}
result = await this.execPostByTimeOut(null,pushObj, url);
console.log(result,'--------------result')
if (result.status != 0) {
return result;
}
if (result.data.code != 200) {
return result.data;
}
return system.getResultSuccess(result.data.data);
} catch (e) {
this.execClientNew.execLogs({
opTitle:"360订单状态推送",
params:actionBody.orderNo,
identifyCode: "360TmStatus",
resultInfo:"",
errorInfo: e.stack
})
return system.getResultFail(-500, JSON.stringify(e.stack));
}
}
//发送短信
async sendMessage(actionBody) {
try {
let orderNo = actionBody.orderNo;
if(!actionBody.registNumInfo){
return system.getResultFail(-1,'')
}
if(!actionBody.officialInfo){
return system.getResultFail(-1,'')
}
//获取联系人信息
let item = await this.ordercontactsDao.getItemByOrderNo(actionBody.orderNo);
let deliveryInfo = actionBody.deliveryInfo;
if (!item) {
return system.getResultFail(-1, '获取联系人信息失败');
}
let mobile = item.mobile;//联系人手机号
let tmRegistNum = actionBody.registNumInfo.tmRegistNum;//申请号
let tmName = deliveryInfo.tm.tmName;//商标名称
let uploadFileName = actionBody.officialInfo.uploadFileName;//文件名
let oneNcl = deliveryInfo.nclones[0].code;//大类
let templateId = 1;
// let failType = {
// "2": "商标注册申请补正通知书",
// "4": "商标注册申请不予受理通知书",
// "5": "商标注册同日申请补送使用证据通知书",
// "7": "商标驳回通知书",
// "8": "商标部分驳回通知书",
// "201": "超时未补正"
// }
//
// if (failType.hasOwnProperty(actionBody.tmStatus)) {
// templateId = 2;
// }
let rtn = await this.execClient.exec360GetToken(this.auth360Url)
if (!rtn || !rtn.stdout) {
return system.getResult(null, "restPost data is empty");
}
let tokenResult = JSON.parse(rtn.stdout);
let token = tokenResult.access_token;
let url = this.push360Url + 'api/v1/GsbSendsms';
let params = tmName + "|" + oneNcl + "|" + tmRegistNum + "|" + uploadFileName;
let subData = "token=" + token + "&mobile=" + mobile + "&templated=" + templateId + "&replaceContent=" + params;
let result = await this.execClient.execGet(subData, url);
this.execClientNew.execLogs({
opTitle:"360短信推送",
params:params,
identifyCode: "360Message",
resultInfo:result.data,
errorInfo: ""
})
return system.getResultSuccess()
} catch (e) {
this.execClientNew.execLogs({
opTitle:"360短信推送",
params:actionBody.orderNo,
identifyCode: "360Message",
resultInfo:"",
errorInfo: e.stack
})
return system.getResultFail(-500, JSON.stringify(e.stack));
}
}
}
module.exports = Push360Service;
......@@ -4,67 +4,67 @@ const uuidv4 = require('uuid/v4');
class InternalCallsNotifyService {
constructor() {
this.orderinfoDao = system.getObject("db.dbcorder.orderinfoDao");
this.delivery_status={
"dqrfa": "待确认方案",
"fabtg": "方案不通过",
"dfwsfw": "待服务",
"dsccl": "待上传材料",
"dsh": "待审核",
"ddj": "待递交",
"ydj": "已递交",
"ywc": "已完成"
this.delivery_status = {
"dqrfa": "待确认方案",
"fabtg": "方案不通过",
"dfwsfw": "待服务",
"dsccl": "待上传材料",
"dsh": "待审核",
"ddj": "待递交",
"ydj": "已递交",
"ywc": "已完成"
};
this.statusContrast={
"WAITCONFIRM":{name:"待确认方案",value:"dqrfa"},
"CONFIRMFAIL":{name:"方案不通过",value:"fabtg"},
"READY":{name:"待上传材料",value:"dsccl"},
"WAITCOMMIT":{name:"待递交",value:"ddj"},
"WAITARTIFICIALEXAMINE":{name:"待审核",value:"dsh"},
"DOCFINISH": {name:"待审核",value:"dsh"},
"AWAITCHECK": {name:"待审核",value:"dsh"},
"COMMITED": {name:"已递交",value:"ydj"},
"ROBOT": {name:"已递交",value:"ydj"},
"ROBOTPAY": {name:"已递交",value:"ydj"},
"RECVCOMMIT": {name:"已递交",value:"ydj"},
this.statusContrast = {
"WAITCONFIRM": { name: "待确认方案", value: "dqrfa" },
"CONFIRMFAIL": { name: "方案不通过", value: "fabtg" },
"READY": { name: "待上传材料", value: "dsccl" },
"WAITCOMMIT": { name: "待递交", value: "ddj" },
"WAITARTIFICIALEXAMINE": { name: "待审核", value: "dsh" },
"DOCFINISH": { name: "待审核", value: "dsh" },
"AWAITCHECK": { name: "待审核", value: "dsh" },
"COMMITED": { name: "已递交", value: "ydj" },
"ROBOT": { name: "已递交", value: "ydj" },
"ROBOTPAY": { name: "已递交", value: "ydj" },
"RECVCOMMIT": { name: "已递交", value: "ydj" },
};
}
//接收辅助、担保商标注册信息
async receiveAssistTmData(pobj){
async receiveAssistTmData(pobj) {
var checkRes = await this.checkParams(pobj);
if(checkRes.status==0){
var deliveryData = await this.packagingTmDeliveryData(pobj,null);
if (checkRes.status == 0) {
var deliveryData = await this.packagingTmDeliveryData(pobj, null);
//获取交付信息
var orderdeliveryRes = await this.getOrderDelivery(pobj.sourceOrderNo,pobj.serviceNo);
if(orderdeliveryRes && orderdeliveryRes.length>0){
return system.getResult(null,"保存商标订单交付信息失败,存在重复交付信息,不能重复提交,10300");
var orderdeliveryRes = await this.getOrderDelivery(pobj.sourceOrderNo, pobj.serviceNo);
if (orderdeliveryRes && orderdeliveryRes.length > 0) {
return system.getResult(null, "保存商标订单交付信息失败,存在重复交付信息,不能重复提交,10300");
}
this.addOrderDelivery(deliveryData,deliveryData.sourceOrderNo);
await this.orderinfoDao.model.update({isSolution:1}, { where: { orderNo: pobj.sourceOrderNo }});
await this.orderinfoDao.addOrderDelivery(deliveryData, deliveryData.sourceOrderNo);
await this.orderinfoDao.model.update({ isSolution: 1 }, { where: { orderNo: pobj.sourceOrderNo } });
return system.getResultSuccess();
}else{
} else {
return checkRes;
}
}
//接收辅助、担保商标注册修改信息
async receiveEditAssistTmData(pobj){
async receiveEditAssistTmData(pobj) {
var checkRes = await this.checkParams(pobj);
if(checkRes.status==0){
if (checkRes.status == 0) {
//获取交付信息
var orderdeliveryRes = await this.getOrderDelivery(pobj.sourceOrderNo,pobj.serviceNo);
if(!orderdeliveryRes || orderdeliveryRes.length<1){
return system.getResult(null,"未知交付信息,10150");
var orderdeliveryRes = await this.getOrderDelivery(pobj.sourceOrderNo, pobj.serviceNo);
if (!orderdeliveryRes || orderdeliveryRes.length < 1) {
return system.getResult(null, "未知交付信息,10150");
}
var orderdelivery = orderdeliveryRes[0];
var deliveryData = await this.packagingTmDeliveryData(pobj,orderdelivery.deliveryContent);
this.putOrderDelivery(deliveryData,deliveryData.sourceOrderNo,deliveryData.serviceNo);
await this.orderinfoDao.model.update({isSolution:1}, { where: { orderNo: pobj.sourceOrderNo }});
var deliveryData = await this.packagingTmDeliveryData(pobj, orderdelivery.deliveryContent);
this.putOrderDelivery(deliveryData, deliveryData.sourceOrderNo, deliveryData.serviceNo);
await this.orderinfoDao.model.update({ isSolution: 1 }, { where: { orderNo: pobj.sourceOrderNo } });
return system.getResultSuccess();
}else{
} else {
return checkRes;
}
}
//-----------------------------------------------------------------------------------------------------
async checkParams(pobj){//参数校验
//-----------------------------------------------------------------------------------------------------
async checkParams(pobj) {//参数校验
if (!pobj.serviceNo) {
return system.getResult(null, "业务单号不能为空不能为空,10100");
}
......@@ -72,9 +72,9 @@ class InternalCallsNotifyService {
return system.getResult(null, "来源单号不能为空,10110");
}
var orderinfo = await this.orderinfoDao.model.findOne({
where:{orderNo:pobj.sourceOrderNo},raw:true
where: { orderNo: pobj.sourceOrderNo }, raw: true
});
if(!orderinfo || !orderinfo.id){
if (!orderinfo || !orderinfo.id) {
return system.getResult(null, "未知订单,10120");
}
if (!pobj.tm) {
......@@ -124,15 +124,15 @@ class InternalCallsNotifyService {
}
return system.getResultSuccess(pobj);
}
async packagingTmDeliveryData(pobj,deliveryData) {//重新组装商标交付信息
async packagingTmDeliveryData(pobj, deliveryData) {//重新组装商标交付信息
var deliveryStatusList = [];
if(deliveryData && deliveryData.deliveryStatusList){
if (deliveryData && deliveryData.deliveryStatusList) {
deliveryStatusList = deliveryData.deliveryStatusList;
}
var nclOne = pobj.nclones[0];
if(nclOne.tmStatus){
if (nclOne.tmStatus) {
var deliveryStatusObj = this.statusContrast[nclOne.tmStatus];
if(deliveryStatusObj && deliveryStatusObj.value){
if (deliveryStatusObj && deliveryStatusObj.value) {
var deliveryStatus = deliveryStatusObj.value;
var deliveryStatusName = deliveryStatusObj.name;
deliveryStatusList.push({
......@@ -142,7 +142,7 @@ class InternalCallsNotifyService {
});
pobj.deliveryStatus = deliveryStatus;
pobj.deliveryStatusName = deliveryStatusName;
}else{
} else {
deliveryStatusList.push({
deliveryStatus: nclOne.tmStatus,
deliveryStatusName: nclOne.tmStatus,
......@@ -150,23 +150,23 @@ class InternalCallsNotifyService {
});
}
}
pobj.deliveryStatusList = deliveryStatusList;
pobj.deliveryStatusList = deliveryStatusList;
pobj.opNotes = ""; //操作备注
return pobj;
}
putOrderDelivery(data, orderNo, channelOrderNo) {//修改交付信息
var sql = "UPDATE `c_order_delivery` SET deliveryContent ='" + JSON.stringify(data) + "' where sourceOrderNo='" + orderNo + "'";
sql = sql + " and deliveryContent->'$.serviceNo' = '"+channelOrderNo+"'";
sql = sql + " and deliveryContent->'$.serviceNo' = '" + channelOrderNo + "'";
this.orderinfoDao.customUpdate(sql);
}
addOrderDelivery(data, orderNo) {//新增交付信息
addOrderDelivery(data, orderNo) {//新增交付信息--废弃,调用dao中的,20201102-sy
var sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" +
orderNo + "','" + JSON.stringify(data) + "')";
this.orderinfoDao.customQuery(sql);
}
async getOrderDelivery(orderNo,channelOrderNo) {//查询交付信息
async getOrderDelivery(orderNo, channelOrderNo) {//查询交付信息
var sql = "select * from `c_order_delivery` where sourceOrderNo='" + orderNo + "'";
sql = sql + " and deliveryContent->'$.serviceNo' = '"+channelOrderNo+"'";
sql = sql + " and deliveryContent->'$.serviceNo' = '" + channelOrderNo + "'";
return await this.orderinfoDao.customQuery(sql);
}
//----------------------------------------------------------------------------------------------------------
......
......@@ -6,6 +6,7 @@ class OrderInfoService extends ServiceBase {
constructor() {
super("dbcorder", ServiceBase.getDaoName(OrderInfoService));
this.flowlogDao = system.getObject("db.dbcorder.flowlogDao");
this.orderinfoDao = system.getObject("db.dbcorder.orderinfoDao");
this.orderproductDao = system.getObject("db.dbcorder.orderproductDao");
this.ordercontactsDao = system.getObject("db.dbcorder.ordercontactsDao");
this.orderReceiptVoucherDao = system.getObject("db.dbcpay.orderreceiptvoucherDao");
......@@ -82,7 +83,7 @@ class OrderInfoService extends ServiceBase {
quantity: actionBody.quantity,// 订单数量(即产品的倍数,默认值为1)
opPayType: "00",// 操作付款类型:00: 创建订单, 10: 补单
serviceItemSnapshot: JSON.stringify(actionBody.product_info), //产品快照
orderSnapshot:JSON.stringify(actionBody.deliveryData.apply)
orderSnapshot: JSON.stringify(actionBody.deliveryData.apply)
};
var orderProduct = await this.orderproductDao.create(orderProductObj, t);//订单产品
var orderReceiptVoucherObj = {
......@@ -118,7 +119,7 @@ class OrderInfoService extends ServiceBase {
return await self.db.transaction(async function (t) {
var orderNo = await self.getBusUid("ot" + pobj.appInfo.uapp_id);
if (pobj.actionBody.channelOrder && pobj.actionBody.channelOrder.channelOrderNo) {
var count = await self.dao.findCount({where: {channelOrderNo: pobj.actionBody.channelOrder.channelOrderNo}});
var count = await self.dao.findCount({ where: { channelOrderNo: pobj.actionBody.channelOrder.channelOrderNo } });
if (count > 0) {
return system.getResultFail(-1, "订单不能重复创建s");
}
......@@ -149,7 +150,7 @@ class OrderInfoService extends ServiceBase {
return await self.db.transaction(async function (t) {
var orderNo = await self.getBusUid("re" + pobj.appInfo.uapp_id);
var item = await self.createOrder(pobj, orderNo, t);
self.addOrderDelivery(pobj.actionBody.deliveryData, orderNo);
await self.orderinfoDao.addOrderDelivery(pobj.actionBody.deliveryData, orderNo, t);
return system.getResultSuccess({
orderNo: orderNo,
channelServiceNo: pobj.actionBody.channelOrder.channelServiceNo || orderNo,
......@@ -202,17 +203,17 @@ class OrderInfoService extends ServiceBase {
}
/**
* 新增交付信息
* 新增交付信息--废弃,从dao中调用,20201102-sy
* @param data
* @param orderNo
*/
addOrderDelivery(data, orderNo) {
try{
addOrderDelivery(data, orderNo, t) {
try {
var sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" +
orderNo + "','" + JSON.stringify(data) + "')";
this.customQuery(sql);
await this.customInsert(sql);
return system.getResultSuccess();
}catch (e) {
} catch (e) {
return system.getResultFail();
}
......@@ -225,7 +226,7 @@ class OrderInfoService extends ServiceBase {
* @returns {Promise<{msg: *, data: (*|null), status: number}>}
*/
async submitReview(pobj, actionBody) {
try{
try {
var packagingTmResult = await this.packagingTmReDeliveryData(pobj, pobj.actionBody);
if (packagingTmResult.status != 0) {
return packagingTmResult;
......@@ -236,7 +237,7 @@ class OrderInfoService extends ServiceBase {
sql = sql.replace('\n', '');
const result = await this.customUpdate(sql);
return system.getResultSuccess();
}catch (e) {
} catch (e) {
return system.getResultFail();
}
}
......@@ -296,11 +297,11 @@ class OrderInfoService extends ServiceBase {
sql += ` and json_extract(deliveryContent,'$.apply.askforId')='${actionBody.askforId}'`;
sqlCount += ` and json_extract(deliveryContent,'$.apply.askforId')='${actionBody.askforId}'`;
}
if(actionBody.applicantName){
if (actionBody.applicantName) {
sql += ` and json_extract(deliveryContent,'$.applyUser.applicantName') like '%${actionBody.applicantName}%'`;
sqlCount += ` and json_extract(deliveryContent,'$.applyUser.applicantName') like '%${actionBody.applicantName}%'`;
}
if(actionBody.status){
if (actionBody.status) {
sql += ` and json_extract(deliveryContent,'$.deliveryStatusName')='${actionBody.status}'`;
sqlCount += ` and json_extract(deliveryContent,'$.deliveryStatusName')='${actionBody.status}'`;
}
......@@ -332,7 +333,7 @@ class OrderInfoService extends ServiceBase {
* @param actionBody
* @returns {Promise<void>}
*/
async getOfficialList(pobj,actionBody){
async getOfficialList(pobj, actionBody) {
let pageSize = Number(actionBody.pageSize || 20);
if (pageSize > 50) {
pageSize = 50;
......@@ -355,11 +356,11 @@ class OrderInfoService extends ServiceBase {
sql += ` and json_extract(officialInfo,'$.askforId')='${actionBody.askforId}'`;
sqlCount += ` and json_extract(officialInfo,'$.askforId')='${actionBody.askforId}'`;
}
if (actionBody.applicantName){
if (actionBody.applicantName) {
sql += ` and json_extract(officialInfo,'$.applicantName') like '%${actionBody.applicantName}%'`;
sqlCount += ` and json_extract(officialInfo,'$.applicantName') like'%${actionBody.applicantName}%'`;
}
if(actionBody.fileType){
if (actionBody.fileType) {
sql += ` and json_extract(officialInfo,'$.fileType')='${actionBody.fileType}'`;
sqlCount += ` and json_extract(officialInfo,'$.fileType')='${actionBody.fileType}'`;
}
......@@ -390,11 +391,11 @@ class OrderInfoService extends ServiceBase {
* @param actionBody
* @returns {Promise<void>}
*/
async addOfficial(pobj,actionBody){
if(!actionBody.orderNo){
return system.getResult(null,'orderNo can not be empty');
async addOfficial(pobj, actionBody) {
if (!actionBody.orderNo) {
return system.getResult(null, 'orderNo can not be empty');
}
try{
try {
let orderSql = `select channelUserId from c_order_info where orderNo = '${actionBody.orderNo}'`;
let list = await this.customQuery(orderSql);
if (!list || list.length == 0) {
......@@ -403,14 +404,14 @@ class OrderInfoService extends ServiceBase {
let orderItem = list[0];
let data = {
serviceNo: actionBody.orderNo,
channelUserId:orderItem.channelUserId,
channelUserId: orderItem.channelUserId,
officialInfo: actionBody.officialData,
created_at: new Date(),
updated_at: new Date()
}
await this.officialDao.create(data);
return system.getResultSuccess();
}catch (e) {
} catch (e) {
return system.getResultFail();
}
......
......@@ -1251,7 +1251,54 @@ class NeedsolutionService extends ServiceBase {
}
// --------------庄冰2020.10.23-------百度Icp接入使用--------end------------------
//创建方案信息
async createNewSolution(pobj){
let ab = pobj.actionBody;
let app = pobj.appInfo;
if (!app || !app.uapp_id) {
return system.getResultFail(-100, "未知渠道");
}
if (!ab.channelSolutionNo) {
return system.getResultFail(-101, "渠道方案编号不能为空");
}
let newNsObj={
orderNo:ab.orderNo,channelSolutionNo:ab.channelSolutionNo,solutionNo:ab.channelSolutionNo,
needNo:ab.bizId,channelNeedNo:ab.bizId,status:"ywc"
};
let newSolutionCount = {
"status": "USER_UPLOADED",
"bizType": ab.product_info && ab.product_info.channel_item_code?ab.product_info.channel_item_code:"",
"solution": {
"Area": ab.product_info.price_item.price_desc || "",
"IcpType": '',
"CompanyName": ab.companyName || "",
"CompanyAddress": ab.area || ""
},
"totalSum": ab.order_info.totalSum || "",
"typeCode": ab.product_info && ab.product_info.channel_item_code?ab.product_info.channel_item_code:"",
"typeName": ab.product_info && ab.product_info.channel_item_name?ab.product_info.channel_item_name:"",
"needStatus": "3",
"statusName": "用户支付",
"customerInfo": {
"publishName": "",
"publishMobile": ""
},
"customerRemark": "",
"needStatusName": "处理中",
"customerMaterial": {},
"solutionFlowList": [
{
"status": "PAID",
"statusName": "用户支付",
"updated_at": new Date()
}
]
};
newNsObj.solutionContent = JSON.stringify(newSolutionCount);
let ns = await this.dao.create(newNsObj);
return system.getResultSuccess(ns)
}
}
module.exports = NeedsolutionService;
// var task = new NeedsolutionService();
......
......@@ -425,9 +425,9 @@ class AliyunQcService {
if (!needsolutioninfo || !needsolutioninfo.id) {
return system.getResultFail(-400, "未知方案");
}
if (!needsolutioninfo.needNo) {
return system.getResultFail(-401, "方案需求信息有误");
}
// if (!needsolutioninfo.needNo) {
// return system.getResultFail(-401, "方案需求信息有误");
// }
var solutionContent = needsolutioninfo.solutionContent;
if (!solutionContent) {
return system.getResultFail(-402, "方案交付信息有误");
......@@ -436,16 +436,16 @@ class AliyunQcService {
return system.getResultFail(-403, "用户未上传材料,不能执行此操作");
}
//获取需求信息
var needinfo = await this.needinfoDao.model.findOne({
where: { needNo: needsolutioninfo.needNo }, raw: true
});
if (!needinfo || !needinfo.id) {
return system.getResultFail(-201, "未知需求信息");
}
// var needinfo = await this.needinfoDao.model.findOne({
// where: { needNo: needsolutioninfo.needNo }, raw: true
// });
// if (!needinfo || !needinfo.id) {
// return system.getResultFail(-201, "未知需求信息");
// }
// if (needinfo.status == "ycd" || needinfo.status == "ygb") {
if (needinfo.status == "ygb") {
return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
}
// if (needinfo.status == "ygb") {
// return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
// }
var material = ab.material;
if (!material.Domain) {
return system.getResultFail(-101, "备案域名不能为空");
......@@ -558,9 +558,9 @@ class AliyunQcService {
// }
var solutionFlowList = solutionContent.solutionFlowList || [];
if (ab.ApplicationStatus == 507) {//完成账户注册
if (solutionContent.status != "USER_CONFIRMED") {
return system.getResultFail(-508, "交付流程错误,用户确认递交⽂件后才能执行此操作");
}
// if (solutionContent.status != "USER_CONFIRMED") {
// return system.getResultFail(-508, "交付流程错误,用户确认递交⽂件后才能执行此操作");
// }
solutionContent.ApplicationStatus = 507;
solutionFlowList.push({
file: ab.OfficialFileURL || "",
......
......@@ -7,7 +7,7 @@ class ExecClient {
this.cmdPostPattern = "curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {url}";
this.cmdGetPattern = "curl -G -X GET '{url}'";
this.cmdPushDataPostPattern = "curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'request-id:{requestId}' -d '{data}' {url}";
this.cmd360Token = "curl -u gongsibao:qPa4PsVsxbQ847i5pOKSmfPKrzRoNKqx -d '{data}' -X POST {url}"
}
getUUID() {
var uuid = uuidv4();
......@@ -41,6 +41,12 @@ class ExecClient {
console.log(cmd);
return cmd;
}
Fetch360TokenCmd(subData,url){
let cmd = this.cmd360Token.replace(
/\{data\}/g, subData).replace(/\{url\}/g, url);
console.log(cmd);
return cmd;
}
async execPost(subData, url) {
let cmd = this.FetchPostCmd(subData, url);
var result = await this.exec(cmd);
......@@ -56,6 +62,29 @@ class ExecClient {
var result = await this.exec2(cmd);
return result;
}
async exec360GetToken(url){
const qs = require('qs')
let obj = {"scope":"smart_business","grant_type":"client_credentials"}
// if(settings.env == 'dev'){
// const rs = await axios({
// method: 'post',
// url: url,
// data:qs.stringify(obj),
// auth: {
// username:"gongsibao",
// password:"qPa4PsVsxbQ847i5pOKSmfPKrzRoNKqx"
// }
// })
// const ret ={
// stdout:JSON.stringify(rs.data)
// }
// return ret;
// }
let cmd = this.Fetch360TokenCmd(qs.stringify(obj),url);
console.log(cmd);
var result = await this.exec(cmd);
return result;
}
FetchGetCmd(subData, url) {
var cmd = this.cmdGetPattern.replace(
......
......@@ -20,6 +20,13 @@ var settings = {
usertimeout: 3600,//单位秒
basepath: path.normalize(path.join(__dirname, '../..')),
port: process.env.NODE_PORT || 4011,
//记录日志地址
opNewLogUrl() {
if (this.env == 'dev') {
return "http://43.247.184.94:7200/center_order_req_log/_doc?pretty";
}
return "http://43.247.184.94:7200/center_order_req_log/_doc?pretty";
},
reqTransferurl: function () {
if (this.env == "dev") {
return "http://192.168.18.61:3003/";
......@@ -42,6 +49,20 @@ var settings = {
return "http://gsb.qifu.gongsibao.com:4012/";
}
},
push360Url: function () {
if (this.env == 'dev') {
return "http://180.163.239.98:38086/";
} else {
return "https://tobadminapi.e.360.cn/";
}
},
auth360Url: function () {
if (this.env == 'dev') {
return "https://oauth2.e.360.cn/site/token";
} else {
return "https://oauth2.e.360.cn/site/token";
}
},
apiconfig: {
opLogUrl: function () {
return settings.reqEsAddr() + "center_order_log/_doc?pretty";
......@@ -50,7 +71,7 @@ var settings = {
return 1;
},
},
homePage: function () {
if (this.env == "dev") {
var localsettings = require("./localsettings");
......@@ -100,8 +121,8 @@ var settings = {
};
}
},
addArr: function() {
return ["南海诸岛", "北京", "天津", "上海", "重庆", "河北", "河南", "云南", "辽宁", "黑龙江", "湖南", "安徽", "山东", "新疆", "江苏", "浙江", "江西", "湖北", "广西", "甘肃", "山西", "内蒙古", "陕西", "吉林", "福建", "贵州", "广东", "青海", "西藏", "四川", "宁夏", "海南", "台湾", "香港", "澳门"]
addArr: function () {
return ["南海诸岛", "北京", "天津", "上海", "重庆", "河北", "河南", "云南", "辽宁", "黑龙江", "湖南", "安徽", "山东", "新疆", "江苏", "浙江", "江西", "湖北", "广西", "甘肃", "山西", "内蒙古", "陕西", "吉林", "福建", "贵州", "广东", "青海", "西藏", "四川", "宁夏", "海南", "台湾", "香港", "澳门"]
}
};
module.exports = settings;
......@@ -15,6 +15,7 @@
"after": "^0.8.2",
"ali-oss": "^4.12.2",
"aliyun-api-gateway": "^1.1.6",
"axios": "^0.21.0",
"babel-polyfill": "^6.26.0",
"base64id": "^1.0.0",
"bluebird": "^3.5.1",
......@@ -57,4 +58,4 @@
"element-theme": "^2.0.1",
"element-theme-chalk": "^2.4.0"
}
}
\ 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