Commit 99bbcad8 by 宋毅

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

parents df7d888b e9fc92d6
......@@ -5,6 +5,7 @@ const logCtl = system.getObject("service.common.oplogSve");
class opLog extends WEBBase {
constructor() {
super();
this.pushlogSve = system.getObject("service.common.pushlogSve");
}
async info(pobj, qobj, req) {
this.logCtl.info(pobj);
......@@ -12,5 +13,29 @@ class opLog extends WEBBase {
async error(pobj, qobj, req) {
this.logCtl.error(pobj);
}
/**
* 获取推送失败日志列表
* @param pobj
* @param qobj
* @param req
* @returns {Promise<void>}
*/
async getPushFailLogList(pobj,qobj,req){
let list = await this.pushlogSve.getPushFailLogList(pobj.actionBody);
return list;
}
/**
* 重新推送
* @param pobj
* @param qobj
* @param req
* @returns {Promise<void>}
*/
async rePush(pobj,qobj,req){
let result = await this.pushlogSve.rePush(pobj.actionBody);
return result;
}
}
module.exports = opLog;
\ No newline at end of file
......@@ -60,6 +60,9 @@ class OpNeed extends APIBase {
case "getStatisticsByProduct":
opResult = await this.utilsOpNeedSve.getStatisticsByProduct(pobj);
break;
case "getNeedProductType":
opResult = await this.utilsOpNeedSve.getNeedProductType(pobj);
break;
case "getStatisticsByArea":
opResult = await this.utilsOpNeedSve.getStatisticsByArea(pobj);
break;
......
......@@ -127,6 +127,9 @@ class Need extends APIBase {
case "importNeeds":
opResult = await this.utilsNeedSve.importNeeds(pobj,req);
break;
case "getymicpProduce"://获取易名的icp产品信息
opResult = await this.centerorderSve.getymicpProduce(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -245,6 +245,12 @@ class AppServiceBase {
returnType: '1',
opTitle: opType + "数据推送成功->" + opTitleDesc
});
// TODO 更改需求推送状态
if (opType.indexOf('Need') >=0 && opType.indexOf('Business')>=0){
pobj.actionType = 'updateNeedPushStatus';
let url = settings.centerOrderUrl() + 'action/opNeed/springBoard';
let result = await this.execPostByTimeOut(null,pobj,url,null,null,60);
}
// result.data = null;
return result;
}
......
......@@ -86,6 +86,7 @@ class BaseCenterOrderService extends AppServiceBase {
//提交Icp注册方案
async submitIcpProgramme(pobj) {
console.log('提交Icp注册方案---',pobj)
var res = await this.reqCenterOrderApi(pobj, "action/qcapi/springBoard");
if (res && res.status == 0 && res.data && res.data.needinfo && res.data.needsolution) {
var needinfo = res.data.needinfo;//需求信息
......@@ -158,8 +159,9 @@ class BaseCenterOrderService extends AppServiceBase {
if(needinfo.uapp_id == uappId.ename){
//推送数据至易名
// var bizType = needinfo.channelTypeCode;//业务类型里
solution.Area = cityLetter[solution.Area]
// solution.Area = cityLetter[solution.Area]
console.log('solution.Area++',solution.Area)
console.log('solution++',solution)
var pushObj = {
IntentionBizId: needinfo.channelNeedNo,
CompanyName: solution.CompanyName,
......@@ -319,18 +321,18 @@ class BaseCenterOrderService extends AppServiceBase {
};
var a = await self.reqCenterOrderApi(reqObj2);//保存渠道方案id
console.log("保存渠道方案id aaaa++ ",a)
// if (a && a.status == 0 && resData.path) {
// var reqObj3 = {
// actionType: "receiveIcpConfirmUrl",
// appInfo: appInfo,
// actionBody: {
// solutionNo: solutionNo,
// confirmUrl: pushRes.path
// }
// };
// var url = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
// console.log('save confirmUrl ++ ',url)
// }
if (a && a.status == 0 && pushRes.ConfirmUrl) {
var reqObj3 = {
actionType: "receiveIcpConfirmUrl",
appInfo: appInfo,
actionBody: {
solutionNo: solutionNo,
confirmUrl: pushRes.ConfirmUrl
}
};
var url = await self.reqCenterOrderApi(reqObj3);//保存用户确认方案url
console.log('save confirmUrl ++ ',url)
}
}
return pushRes;
}
......
......@@ -650,9 +650,14 @@ class CenterorderService extends AppServiceBase {
if(pobj && pobj.appInfo && pobj.appInfo.uapp_id && pobj.appInfo.uapp_id=='52'){
if (pobj.actionBody.channelItemCode == '5') {
pobj.actionBody.regType = "ename.icp";
pobj.actionBody.regType = "yiming.icp";
} else if (pobj.actionBody.channelItemCode == '7') {
pobj.actionBody.regType = "ename.edi";
pobj.actionBody.regType = "yiming.edi";
}
else if (pobj.actionBody.channelItemCode == 'icpnb') {
pobj.actionBody.regType = "yiming.icpnb";
}else if (pobj.actionBody.channelItemCode == 'edinb') {
pobj.actionBody.regType = "yiming.edinb";
}
}
var fqobj = {
......@@ -715,9 +720,18 @@ class CenterorderService extends AppServiceBase {
}
return system.getResultSuccess();
}
//获取易名的icp产品信息
async getymicpProduce(pobj) {
pobj.actionType = 'getymicpProduce'
let url = settings.centerAppUrl() + "action/opProduct/springBoard";
return await this.restPostUrl(pobj, url);
}
}
module.exports = CenterorderService;
// var task = new CenterorderService();
// var pobj={
// "actionType":"submitProgramme",
// "actionBody":{
......
......@@ -51,6 +51,45 @@ class PushlogService extends ServiceBase {
return result;
}
async getPushFailLogList(actionBody) {
var sql = "SELECT id,appid,`content`,failType,pushNumber,opTitle,resultInfo,created_at FROM `center_channel_pushfaillog` WHERE pushNumber=10 ";
let whereParams = {};
if(actionBody.appid){
sql += " and appid = :appid";
whereParams.appid = actionBody.appid;
}
if(actionBody.likeStr){
sql += " and content like :likeStr";
whereParams.likeStr = "%"+ actionBody.likeStr +"%";
}
sql += " order by created_at desc"
var list = await this.pushfaillogDao.customQuery(sql,whereParams);
var result = system.getResultSuccess(list);
return result;
}
/**
* 重新推送
* @param actionBody
* @returns {Promise<void>}
*/
async rePush(actionBody){
let content = actionBody.content;
let sql = 'update `center_channel_pushfaillog` set pushNumber = :pushNumber';
let params = {
pushNumber: actionBody.pushNumber || 9
}
if(Object.keys(content).length>0){
sql += ',content=:content';
params.content = JSON.stringify(actionBody.content);
}
sql += ' where id = :id';
params.id = actionBody.id;
let result = await this.customUpdate(sql,params);
return system.getResult(result);
}
async addPublicServiceLog(pobj, req) {
var sql = "INSERT INTO `igirl_api`.`center_channel_public_servicelog` (`appkey`,`pushUrl`,`pushContent`,`resultInfo`,`pushNumber`,`clientIp`,created_at)" +
"VALUES(:appkey,:pushUrl,:pushContent,:resultInfo,:pushNumber,:clientIp,:created_at)";
......
......@@ -1436,11 +1436,17 @@ class UtilsNeedService extends AppServiceBase {
if(pobj.appInfo && pobj.appInfo.uapp_id && pobj.appInfo.uapp_id=="52"){
if (pobj.actionBody.channel_type_code == 5) {
pobj.actionBody.type = "ename.icp";
pobj.actionBody.idempotentSource = "ename_icp";
pobj.actionBody.type = "yiming.icp";
pobj.actionBody.idempotentSource = "yiming.icp";
} else if (pobj.actionBody.channel_type_code == 7) {
pobj.actionBody.type = "ename.edi";
pobj.actionBody.idempotentSource = "ename_edi";
pobj.actionBody.type = "yiming.edi";
pobj.actionBody.idempotentSource = "yiming.edi";
} else if (pobj.actionBody.channel_type_code == "icpnb") {
pobj.actionBody.type = "yiming.icpnb";
pobj.actionBody.idempotentSource = "yiming.icpnb";
} else if (pobj.actionBody.channel_type_code == "edinb") {
pobj.actionBody.type = "yiming.edinb";
pobj.actionBody.idempotentSource = "yiming.edinb";
}
}
if (pobj.actionBody.description && pobj.actionBody.description.indexOf("备#") < 0) {
......@@ -1591,14 +1597,8 @@ class UtilsNeedService extends AppServiceBase {
return system.getResultFail(-1,'渠道id 不能为空');
}
pobj.actionType = 'bulkCreateNeeds';
let result = await this.execPostByTimeOut(req,pobj,url,"json",null,60);
if (!result || result.status != 0) {
return system.getResult(null, result.msg);
}
if (!result.data || result.data.status != 0) {
return system.getResult(null, result.data.msg);
}
return system.getResult(result.data.data);
let result = await this.restPostUrl(pobj, url);
return result;
}
/**
......
......@@ -6,8 +6,9 @@ const { json } = require("sequelize");
const { getResult, getResultSuccess } = require("../../../system");
//区分渠道的uappid
const uappId = {
'ali': "18", //(阿里icp、edi)
'baidu': "44" //(百度icp、edi)
'ali': 18, //(阿里icp、edi)
'baidu': 44, //(百度icp、edi)
'ename':52
}
//需求操作类----ali对接的需求
class UtilsNeedService2 extends AppServiceBase {
......@@ -517,6 +518,11 @@ class UtilsNeedService2 extends AppServiceBase {
var ress = await self.baiduclient.baiduReqbyget({ path: "/api/bla/provider/communication", reqbody: { requirementId: pobj.actionBody.intentionBizId, content: pobj.actionBody.note } });
console.log("baidu+res", ress)
}
if (result.data == uappId.ename) {
console.log('settings.enameClientUrl()+"WriteCommunicationLog"----',settings.enameClientUrl()+"WriteCommunicationLog")
var resss = await self.execClient.execEnamePost({ IntentionBizId: pobj.actionBody.intentionBizId, Note: pobj.actionBody.note }, settings.enameClientUrl()+"WriteCommunicationLog");
console.log("ename+resss", resss)
}
}
//推送交付系统
......@@ -546,7 +552,7 @@ class UtilsNeedService2 extends AppServiceBase {
async queryExpertApplyCommunicationLogs(pobj) {
var reqUrl = this.centerOrderUrl + "action/need/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
console.log('jilu+++result++++', result)
console.log('jilu+++result++++1--', result)
if (result && result.status == 0 && result.data && result.data.uapp_id) {
if (result.data.uapp_id == uappId.ali) {
var res = await this.aliclient.reqbyget({
......@@ -576,6 +582,20 @@ class UtilsNeedService2 extends AppServiceBase {
});
console.log('xxcc+++', res)
}
if (result.data.uapp_id == uappId.ename) {// yiming / ename
console.log("queryExpertApplyCommunicationLogs---ename---pobj--", pobj)
console.log('settings.enameClientUrl()+"queryExpertApplyCommunicationLogs"----',settings.enameClientUrl()+"queryExpertApplyCommunicationLogs")
var res = await self.execClient.execEnamePost({
BeginTime: pobj.actionBody.BeginTime ? pobj.actionBody.BeginTime : "",
EndTime: pobj.actionBody.EndTime ? pobj.actionBody.EndTime : "",
BizId: pobj.actionBody.intentionBizId,
UserFeedBack: pobj.actionBody.userFeedBack || true,
PageNum: pobj.actionBody.pageNum || 1,
PageSize: pobj.actionBody.pageSize || 10,
}, settings.enameClientUrl()+"queryExpertApplyCommunicationLogs");
console.log('ename+++queryExpertApplyCommunicationLogs---res---', res)
}
}
if(res && res.data && res.data.result){
......
......@@ -407,6 +407,20 @@ class UtilsOpNeedService extends AppServiceBase {
}
/**
* 获取需求 的产品类型
* @param pobj
* @returns {Promise<void>}
*/
async getNeedProductType(pobj){
let url = this.centerOrderUrl + "action/opNeed/springBoard";
let result = await this.restPostUrl(pobj, url);
if(result.status != 0){
return system.getResultFail(-1);
}
return result;
}
/**
* 需求量对比
* @param pobj
* @returns {Promise<void>}
......
......@@ -300,14 +300,8 @@ class UtilsOrderService extends AppServiceBase {
return system.getResultFail(-1,'渠道id 不能为空');
}
pobj.actionType = 'bulkCreateOrders';
let result = await this.execPostByTimeOut(req,pobj,url,"json",null,60);
if (!result || result.status != 0) {
return system.getResult(null, result.msg);
}
if (!result.data || result.data.status != 0) {
return system.getResult(null, result.data.msg);
}
return system.getResultSuccess(result.data.data == null?[]:result.data.data);
let result = await this.restPostUrl(pobj,url);
return result;
}
async getOrderDetails(pobj, actionBody) {
......
......@@ -169,6 +169,9 @@ class ServiceBase {
async customQuery(sql, paras, t) {
return this.dao.customQuery(sql, paras, t);
}
async customUpdate(sql, paras, t) {
return this.dao.customUpdate(sql, paras, t);
}
async findCount(whereObj = null) {
return this.dao.findCount(whereObj);
}
......
......@@ -22,7 +22,7 @@ class dingClient {
//渠道钉钉提醒
async gatewayPushByChannel(orderNo,appInfo){
let gatewayUrl = setttings.dingRobotUrl(appInfo.uapp_id);
if (process.env.APP_ENV != "dev" && gatewayUrl) {
if (settings.env != "dev" && gatewayUrl) {
let c = `注意提醒:${appInfo.app_name}->有订单待处理,订单号${orderNo},老板们加油,加油,加油 !!!`
let t = new Date().toLocaleString()
this.execClient.execPost({
......
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