数据看板分类 __ekbsagrjF60f5gJnBQQ __ekbsagrjF60f5gJnBQQ published __jLHEtB6BFlMJFn00kUn UTF-8 post /getdataboardcategory json " + context); var type = obj["type"]; if (!isNotNull(type)) { var result = new Packages.java.util.HashMap(); //创建指定类对象 result.put("code", "-1"); result.put("msg", "必须传参数"); return result; } //当前的组织类型 var sbczy = "select '" + getDomainid() + "' as domainid, (CASE institutional_code " + "WHEN '0102' THEN " + " '保安服务公司' " + "WHEN '0103' THEN " + " '保安培训单位' " + "WHEN '0104' THEN " + " '自行招用保安员单位' " + "WHEN '0105' THEN " + " '省级保安协会' " + "WHEN '0106' THEN " + " '市级保安协会' " + "WHEN '0107' THEN " + " '省级保安监管机构' " + "WHEN '0108' THEN " + " '市级保安监管机构' " + "WHEN '0201' THEN " + " '活动承办方' " + "WHEN '0202' THEN " + " '政府单位' " + "WHEN '0301' THEN " + " '其他' " + "ELSE institutional_code end) as institutional_code FROM tenant_organizations where id = '" + getDomainid() + "'"; println("数据看板分类api-查询企业机构类型sql:" + sbczy); var jsonUtil = new Packages.cn.myapps.util.json.JsonUtil(); var jg = queryByDSName("obpm2",sbczy); if (isNotNull(jg)&&jg!="[]"){ var institutional_code= jg.iterator().next().get("institutional_code"); if (isNotNull(institutional_code)&&institutional_code!=''){ println("institutional_code =======>" + institutional_code); //数据仓数据看板 var sql3 = "SELECT * from tlk_data_board_v3 where item_isOpen = 1 and item_datatype = '" + type + "' and FIND_IN_SET( '" + institutional_code + "',REPLACE(item_visible, ';', ',') ) <> 0 "; println("数据看板分类api-查询数据看板配置sql :" + sql3); var datas1 = queryByDSName("organizationAuth", sql3); if (isNotNull(datas1)&&datas1!="[]"){ var jsondata = jsonUtil.collection2Json(datas1); //println("jsondata ===============>" + jsondata); var obj = JSON.parse(jsondata); for (var i = 0; i < obj.length; i++) { //println("数据看板分类api-看板详情:"+JSON.stringify(obj[i])); var sc = obj[i].item_showrule; var boardname = obj[i].item_boardname; while (sc.indexOf('(') != -1 || sc.indexOf(')') != -1) { sc = sc.replace('(', '('); sc = sc.replace(')', ')'); } println("数据看板分类api-看板名称:"+boardname+",显示规则:"+sc); var flag = eval("" + sc + ""); if (!flag) { obj.splice(i,1); i--; continue; } var sql4 = "select * from tlk_data_board_v3_config where item_boardId = '" + obj[i]["id"] + "' and FIND_IN_SET( '" + institutional_code + "',REPLACE(item_visible, ';', ',') ) <> 0 order by item_sort" var datas4 = queryByDSName("organizationAuth", sql4); if (isNotNull(datas4)&&datas4!="[]") { var datas4json = jsonUtil.collection2Json(datas4); var datas4obj = JSON.parse(datas4json); for (var j = 0; j < datas4obj.length; j++) { datas4obj[j].item_datascript = ""; } obj[i].children = datas4obj; } } var r = JSON.stringify(obj); var re = jsonUtil.toCollection(r); result.put("code", "0"); result.put("data", re); return result; }else { println("数据看板分类api-查询数据看板配置为空"); } }else { println("获取id为:" + getDomainid()+"的公司信息的机构类型为空"); } }else { println("获取id为:" + getDomainid()+"的公司信息为空"); } }catch (e) { println("数据看板分类api异常"+e); } })()]]>