Commit a86fdf00 by 庄冰

policyTypeCount

parent 1c29c073
......@@ -59,6 +59,9 @@ class PolicyAPI extends APIBase {
case "getPolicysubscribeList"://获取政策订阅列表
opResult = this.policysubscribeSve.getPolicysubscribeList(pobj);
break;
case "policyTypeCount"://政策类型统计计数
opResult = this.policyinfoSve.policyTypeCount(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -6,7 +6,28 @@ class PolicyinfoService extends ServiceBase {
super("dbpolicy", ServiceBase.getDaoName(PolicyinfoService));
}
//政策检索
//政策统计计数
async policyTypeCount(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"];
var result = {};
//"policy_type":{'fzbt':'租金减免','jrdk':'金融贷款','zdfc':'扶持措施','ssjm':'税收优惠','rlzy':'人力资源'},
var rlzy=await this.findByParams("rlzy",paramObj,attributes);
var fzbt=await this.findByParams("fzbt",paramObj,attributes);
var jrdk=await this.findByParams("jrdk",paramObj,attributes);
var zdfc=await this.findByParams("zdfc",paramObj,attributes);
var ssjm=await this.findByParams("ssjm",paramObj,attributes);
result["rlzy"]= rlzy.length || 0;
result["fzbt"]= fzbt.length || 0;
result["jrdk"]= jrdk.length || 0;
result["zdfc"]= zdfc.length || 0;
result["ssjm"]= ssjm.length || 0;
return system.getResultSuccess(result);
}
//政策检索
async policyQuery(pobj){
var obj = pobj.actionBody;
var app = pobj.appInfo;
......@@ -37,7 +58,6 @@ class PolicyinfoService extends ServiceBase {
result["ssjm"]=await this.findByParams("ssjm",paramObj,attributes);
return system.getResultSuccess(result);
}
async findByParams(type,paramObj,attributes){
paramObj.policyType=type;
return await this.dao.model.findAll({
......@@ -46,7 +66,7 @@ class PolicyinfoService extends ServiceBase {
}
async addPolicyByExcel(){
var workbook = xl.readFile("policy6.xls");
var workbook = xl.readFile("policy7.xlsx");
const sheetNames = workbook.SheetNames; // 返回 ['sheet1', 'sheet2']
const worksheet = workbook.Sheets[sheetNames[0]];
var dataa =xl.utils.sheet_to_json(worksheet);
......@@ -60,7 +80,7 @@ class PolicyinfoService extends ServiceBase {
uapp_id:26,policyNo:data['政策编号'],policyName:data['政策名称'],
policySource:data['政策出处'],policyLinkUrl:data['政策链接'],
policyProvince:data['所属省份'],policyCity:data['所属城市'],
policyTypeName:data['政策类型'],policyContent:data['内容']};
policyTypeName:data['政策类型'],policyContent:data['备注'] || ""};
if(data['政策类型']){
var policy_type ={'租金减免':'fzbt','金融贷款':'jrdk','行政措施':'zdfc','税收优惠':'ssjm','人力资源':'rlzy'};
var typename = data['政策类型'];
......
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