Commit a7c917a9 by 庄冰

policyTypeQuery

parent a86fdf00
......@@ -39,6 +39,9 @@ class PolicyAPI extends APIBase {
case "policyQuery"://政策检索
opResult = await this.policyinfoSve.policyQuery(pobj);
break;
case "policyTypeQuery"://政策检索(根据政策类型检索)
opResult = await this.policyinfoSve.policyTypeQuery(pobj);
break;
case "submitPolicyNeed"://政策申请提报
// opResult = system.getResult(null, "接口开发中");
opResult = this.policyneedSve.submitPolicyNeed(pobj);
......
......@@ -13,6 +13,21 @@ class PolicyinfoService extends ServiceBase {
var paramObj={uapp_id:app.uapp_id};
var attributes =["id","policyType","policyTypeName","policyDate","policyCity","policyProvince",
"policyLinkUrl","policySource","policyName","policyNo"];
if(obj){
if(obj.policyProvince){
paramObj["policyProvince"]=obj.policyProvince;
if(obj.policyCity){
paramObj["policyCity"]=obj.policyCity;
}
}
if(obj.policyName){
paramObj[this.db.Op.or]=[
{policyName:{ [this.db.Op.like]: "%" + obj.policyName + "%" }},
{policyContent:{ [this.db.Op.like]: "%" + obj.policyName + "%" }}
];
}
console.log(paramObj);
}
var result = {};
//"policy_type":{'fzbt':'租金减免','jrdk':'金融贷款','zdfc':'扶持措施','ssjm':'税收优惠','rlzy':'人力资源'},
var rlzy=await this.findByParams("rlzy",paramObj,attributes);
......@@ -58,10 +73,39 @@ class PolicyinfoService extends ServiceBase {
result["ssjm"]=await this.findByParams("ssjm",paramObj,attributes);
return system.getResultSuccess(result);
}
//政策检索(根据政策类型检索)
async policyTypeQuery(pobj){
var obj = pobj.actionBody;
var app = pobj.appInfo;
var paramObj={uapp_id:app.uapp_id};
var attributes =["id","policyType","policyTypeName","policyDate","policyCity","policyProvince",
"policyLinkUrl","policySource","policyName","policyNo"];
if(!obj || !obj.policyType){
return system.getResult(null,"政策类型不能为空");
}
if(obj.policyProvince){
paramObj["policyProvince"]=obj.policyProvince;
if(obj.policyCity){
paramObj["policyCity"]=obj.policyCity;
}
}
if(obj.policyName){
paramObj[this.db.Op.or]=[
{policyName:{ [this.db.Op.like]: "%" + obj.policyName + "%" }},
{policyContent:{ [this.db.Op.like]: "%" + obj.policyName + "%" }}
];
}
console.log(paramObj);
var result = null;
//"policy_type":{'fzbt':'租金减免','jrdk':'金融贷款','zdfc':'扶持措施','ssjm':'税收优惠','rlzy':'人力资源'},
result=await this.findByParams(obj.policyType,paramObj,attributes);
return system.getResultSuccess(result);
}
async findByParams(type,paramObj,attributes){
paramObj.policyType=type;
return await this.dao.model.findAll({
where:paramObj,raw:true,attributes:attributes
where:paramObj,raw:true,attributes:attributes,
order:[["id", "DESC"]]
});
}
......
......@@ -56,10 +56,10 @@ class PolicyneedService extends ServiceBase {
}
var sql ="select need.*,policy.policyNo,policy.policyName,policy.policyType,policy.policyTypeName,policy.policySource,"+
"policy.policyLinkUrl,policy.policyDate,policy.policyProvince,policy.policyCity from "+
"(select id,uapp_id,contacts,customerIntention,customerIntentionName,company,industry,region,mobile,policy_id,applyDate,opNotes,popularizeUserCode "+
"(select created_at,id,uapp_id,contacts,customerIntention,customerIntentionName,company,industry,region,mobile,policy_id,applyDate,opNotes,popularizeUserCode "+
"from b_policy_need where uapp_id="+app.uapp_id+" and (popularizeUserCode='"+user.channel_userid+"' ";
var sqlCount ="select count(1) as dataCount from "+
"(select id,uapp_id,contacts,customerIntention,customerIntentionName,company,industry,region,mobile,policy_id,applyDate,opNotes,popularizeUserCode "+
"(select created_at,id,uapp_id,contacts,customerIntention,customerIntentionName,company,industry,region,mobile,policy_id,applyDate,opNotes,popularizeUserCode "+
"from b_policy_need where uapp_id="+app.uapp_id+" and (popularizeUserCode='"+user.channel_userid+"' ";
if(user.channel_userid=="18611219500"){
sql=sql+" or popularizeUserCode is null or popularizeUserCode='' ";
......@@ -96,6 +96,14 @@ class PolicyneedService extends ServiceBase {
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 sqlCount = "SELECT count(1) as dataCount FROM b_policy_need where " +
......
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