Commit 373ff7af by 王栋源

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

parents ac2fb22c 5e14e691
......@@ -14,6 +14,12 @@ class APIBase {
return u;
}
async checkAcck(gname, methodname, pobj, query, req) {
if (methodname.length > 4) {
var prefixStr = methodname.substr(0,4);
if (prefixStr == "task") {
return system.getResultSuccess();
}
}
if (!pobj.appInfo) {
return system.getResult(null, "pobj.appInfo can not be empty !!");
}
......
......@@ -61,7 +61,7 @@ class OrderAPI extends APIBase {
async addOrder(pobj, actionBody) {
if (!actionBody.product_info) {
return system.getResult(null, "产品信息有误,20010");
return system.getResult(null, "产品信息有误,20000");
}
var interface_info = null;
var interface_list = actionBody.product_info.interface_info;
......@@ -80,13 +80,13 @@ class OrderAPI extends APIBase {
}//使用默认的其他订单
if (!interface_info) {
return system.getResult(null, "产品接口信息有误,20030");
return system.getResult(null, "产品接口信息有误,20010");
}
if (!interface_info.interface_type) {
return system.getResult(null, "产品接口类型信息有误,20050");
return system.getResult(null, "产品接口类型信息有误,20020");
}
if (!interface_info.interface_url) {
return system.getResult(null, "产品接口地址信息有误,20080");
return system.getResult(null, "产品接口地址信息有误,20030");
}
var refOpResult = await this.reflexAction(interface_info, pobj);
return refOpResult;
......@@ -95,11 +95,11 @@ class OrderAPI extends APIBase {
var refResult = null;
if (interface_info.interface_type == "bd") {
if (!interface_info.method_name) {
return system.getResult(null, "产品接口参数信息有误,20110");
return system.getResult(null, "产品接口参数信息有误,20040");
}//操作的方法名称
var invokeObj = system.getObject(interface_info.interface_url);
if (!invokeObj[interface_info.method_name]) {
return system.getResult(null, "产品接口参数方法信息有误,20130");
return system.getResult(null, "产品接口参数方法信息有误,20050");
}
pobj.interface_params = interface_info.params;
var params = [pobj];
......
......@@ -68,6 +68,12 @@ class PolicyAPI extends APIBase {
case "policySubscribeQuery"://政策订阅检索列表(通过订阅信息查询订阅的政策信息)
opResult = this.policysubscribeSve.policySubscribeQuery(pobj);
break;
case "getPolicyBusinessFq"://政策商机(蜂擎)
opResult = this.policyneedSve.getPolicyBusinessFq(pobj);
break;
case "getPolicyNeedInfo"://政策需求信息(icompany)
opResult = this.policyneedSve.getPolicyNeedInfo(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 OrderAPI extends APIBase {
constructor() {
super();
this.orderinfoSve = system.getObject("service.dbcorder.orderinfoSve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.userInfo) {
return system.getResultFail(system.noLogin, "user no login!");
}
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess(pobj, action_type, req) {
var opResult = null;
switch (action_type) {
case "updateContacts"://修改订单联系人
opResult = await this.orderinfoSve.updateContacts(pobj, pobj.actionBody);
break;
case "updateTmOrder"://修改商标订单信息
opResult = await this.orderinfoSve.updateTmOrder(pobj, pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = OrderAPI;
\ No newline at end of file
......@@ -4,5 +4,20 @@ class OrderContactsDao extends Dao {
constructor() {
super(Dao.getModelName(OrderContactsDao));
}
async getItemByOrderNo(orderNo, uapp_id) {
return await this.model.findOne({
where: {
sourceOrderNo: orderNo
},
attributes: [
"id",
"contactName",
"mobile",
"tel",
"email",
"fax"],
raw: true
});
}
}
module.exports = OrderContactsDao;
......@@ -110,11 +110,10 @@ class PolicyinfoService extends ServiceBase {
}
async addPolicyByExcel(){
var workbook = xl.readFile("policy7.xlsx");
var workbook = xl.readFile("policy8.xls");
const sheetNames = workbook.SheetNames; // 返回 ['sheet1', 'sheet2']
const worksheet = workbook.Sheets[sheetNames[0]];
var dataa =xl.utils.sheet_to_json(worksheet);
var arr = [];
var that=this;
await this.db.transaction(async function (t) {
......
......@@ -164,5 +164,121 @@ class PolicyneedService extends ServiceBase {
var newPolicyNeed = await this.dao.update(paramObj);
return system.getResultSuccess();
}
//政策商机(蜂擎)
async getPolicyBusinessFq(pobj){
var app = pobj.appInfo;
var obj = pobj.actionBody || {};
var pageSize = Number(obj.pageSize || 20);
var pageIndex = Number(obj.pageIndex || 1);
var from = pageIndex == 1 ? 0 : Number((pageIndex - 1) * pageSize);
if (pageSize > 200) {
pageSize = 200;
}
var sql ="select need.created_at,need.region,need.mobile,need.industry,need.contacts,policy.policyNo,policy.policyName,policy.policyType,policy.policyTypeName,"+
"need.company,need.popularizeUserCode,policy.policyLinkUrl,policy.policyProvince from "+
"(select created_at,id,contacts,company,industry,region,mobile,policy_id,applyDate,opNotes,popularizeUserCode "+
"from b_policy_need where 1=1 ";
var sqlCount ="select count(1) as dataCount from "+
"(select created_at,id,contacts,company,industry,region,mobile,policy_id,applyDate,opNotes,popularizeUserCode "+
"from b_policy_need where 1=1 ";
if(obj.salesmanMobile){
sql=sql+" and popularizeUserCode='"+obj.salesmanMobile+"' ";
sqlCount=sqlCount+" and popularizeUserCode='"+obj.salesmanMobile+"' ";
}
sql=sql+" ) as need "+
"LEFT JOIN "+
"(select id, policyNo,policyName,policyType,policyTypeName,policySource,policyLinkUrl,"+
"policyDate,policyProvince,policyCity from b_policy_info) as policy "+
"on need.policy_id=policy.id where 1=1 ";
sqlCount=sqlCount+" ) as need "+
"LEFT JOIN "+
"(select id, policyNo,policyName,policyType,policyTypeName,policySource,policyLinkUrl,"+
"policyDate,policyProvince,policyCity from b_policy_info) as policy "+
"on need.policy_id=policy.id where 1=1 ";
if(obj.policyName){
sql=sql+" and policyName like '%"+obj.policyName+"%'";
sqlCount=sqlCount+" and policyName like '%"+obj.policyName+"%'";
}
if(obj.policyProvince){
sql=sql+" and policyProvince ='"+obj.policyProvince+"'";
sqlCount=sqlCount+" and policyProvince ='"+obj.policyProvince+"'";
if(obj.policyCity){
sql=sql+" and policyCity ='"+obj.policyCity+"'";
sqlCount=sqlCount+" and policyCity ='"+obj.policyCity+"'";
}
}
if(obj.policyType){
sql=sql+" and policyType = '"+obj.policyType+"'";
sqlCount=sqlCount+" and policyType = '"+obj.policyType+"'";
}
if(obj.customerIntention){
sql=sql+" and customerIntention = '"+obj.customerIntention+"'";
sqlCount=sqlCount+" and customerIntention = '"+obj.customerIntention+"'";
}
if(obj.startDate){
sql=sql+" and created_at >= '"+obj.startDate+"'";
sqlCount=sqlCount+" and created_at >= '"+obj.startDate+"'";
}
if(obj.endDate){
sql=sql+" and created_at <= '"+obj.endDate+"'";
sqlCount=sqlCount+" and created_at <= '"+obj.endDate+"'";
}
sql=sql+" order by need.id desc LIMIT " + pageSize + " OFFSET " + from + "";
console.log(sql);
var tmpResult = await this.customQuery(sql,{});
var tmpResultCount = await this.customQuery(sqlCount,{});
var result = system.getResultSuccess(tmpResult);
result.dataCount = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return result;
}
//政策需求信息(icompany)
async getPolicyNeedInfo(pobj){
var obj = pobj.actionBody || {};
var pageSize = Number(obj.pageSize || 20);
var pageIndex = Number(obj.pageIndex || 1);
var from = pageIndex == 1 ? 0 : Number((pageIndex - 1) * pageSize);
if (pageSize > 200) {
pageSize = 200;
}
var sql ="select contacts,company,industry,region,mobile,created_at "+
"from b_policy_need where 1=1 ";
var sqlCount ="select count(1) as dataCount from b_policy_need where 1=1 ";
if(obj.contacts){
sql=sql+" and contacts = '"+obj.contacts+"'";
sqlCount=sqlCount+" and contacts = '"+obj.contacts+"'";
}
if(obj.mobile){
sql=sql+" and mobile = '"+obj.mobile+"'";
sqlCount=sqlCount+" and mobile = '"+obj.mobile+"'";
}
if(obj.industry){
sql=sql+" and industry = '"+obj.industry+"'";
sqlCount=sqlCount+" and industry = '"+obj.industry+"'";
}
if(obj.region){
sql=sql+" and region = '"+obj.region+"'";
sqlCount=sqlCount+" and region = '"+obj.region+"'";
}
if(obj.company){
sql=sql+" and company = '"+obj.company+"'";
sqlCount=sqlCount+" and company = '"+obj.company+"'";
}
if(obj.startDate){
sql=sql+" and created_at >= '"+obj.startDate+"'";
sqlCount=sqlCount+" and created_at >= '"+obj.startDate+"'";
}
if(obj.endDate){
sql=sql+" and created_at <= '"+obj.endDate+"'";
sqlCount=sqlCount+" and created_at <= '"+obj.endDate+"'";
}
sql=sql+" order by created_at desc LIMIT " + pageSize + " OFFSET " + from + "";
console.log(sql);
var tmpResult = await this.customQuery(sql,{});
var tmpResultCount = await this.customQuery(sqlCount,{});
var result = system.getResultSuccess(tmpResult);
result.dataCount = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return result;
}
}
module.exports = PolicyneedService;
......@@ -112,6 +112,8 @@ class PolicysubscribeService extends ServiceBase {
if(!obj.policySubscribeId){
return system.getResult(null, "policySubscribeId不能为空");
}
var currentPage = obj.currentPage || 1;
var pageSize = obj.pageSize || 100 ;
var ps = await this.dao.model.findOne({
where:{id:obj.policySubscribeId,openid:obj.openid},
raw:true
......@@ -135,10 +137,27 @@ class PolicysubscribeService extends ServiceBase {
}
var pis = await this.policyinfoDao.model.findAll({//获取该订阅下的政策数据
where:whereObj,raw:true,attributes:attributes,
order:[["id", "DESC"]]
order:[["id", "DESC"]],
offset:(currentPage - 1) * pageSize,
limit:pageSize
});
if(!pis || pis.length<1){
delete whereObj["created_at"];
pis = await this.policyinfoDao.model.findAll({//获取该订阅下的政策数据
where:whereObj,raw:true,attributes:attributes,
order:[["id", "DESC"]],
offset:(currentPage - 1) * pageSize,
limit:pageSize
});
}
var picount = await this.policyinfoDao.model.findAll({//获取该订阅下的政策数据
where:whereObj,raw:true,attributes:["id"],
});
picount = picount.length;
var res = system.getResultSuccess(pis);
res.dataCount = picount;
await this.dao.update({id:obj.policySubscribeId,releaseDate:new Date()});//修改订阅发布日期
return system.getResultSuccess(pis);
return res;
}
}
......
已经使用的编码汇总:
已经使用的编码汇总:
1.对订单操作修改
30000
30010
30020
30030
30040
30050
30060
30070
30080
30090
30100
30110
30120
30130
30140
30150
========================================================
2.添加订单操作
20000
20010
20020
20030
20040
20050
\ 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