util
__KDXZvc8mnEmDqMARhK7G
__KDXZvc8mnEmDqMARhK7G
0){
serverAndPort="https://v5qy.te.baibaodun.com.cn";
}
var Url=serverAndPort+"/kms/api/kms/convert/htmlToDoc"
try{
var header = new Packages.java.util.HashMap();
header.put("Content-Type","application/json")
header.put("accessToken",accessToken);
req = Packages.com.alibaba.fastjson.JSON.toJSONString(req);
println("Url-->"+Url)
println("header-->"+header)
println("req-->"+req)
var response = Packages.cn.hutool.http.HttpUtil.createPost(Url).addHeaders(header).body(req).execute().body();
println("response-->"+response)
}catch(e){println("e=="+e); return e};
return 0
}
function htmlToPdfs(data,htmPath,pdfPath){
var Security = new Packages.cn.myapps.common.util.Security();
var accessToken = Security.getToken(getWebUser().getId());
var req = new Packages.java.util.HashMap();
req.put("data",data)
req.put("htmPath",htmPath)
req.put("pdfPath",pdfPath)
var serverAndPort = "https://v5qy.te.baibaodun.com.cn";
var Url = serverAndPort + "/kms/api/kms/convert/htmlToDoc"
try{
var header = new Packages.java.util.HashMap();
header.put("Content-Type","application/json")
header.put("accessToken",accessToken);
req = Packages.com.alibaba.fastjson.JSON.toJSONString(req);
println("Url-->"+Url)
println("header-->"+header)
println("req-->"+req)
var response = Packages.cn.hutool.http.HttpUtil.createPost(Url)
.addHeaders(header)
.body(req)
.execute()
.body();
println("response-->"+response)
}catch(e){
println("htmlToPdf Error: "+e);
throw e; // 抛出异常以便上层捕获
}
return 0;
}
//获取编号
function getNumberImpl(officePoliceIDIndex,type){
var sql = "select * from organizationauth.tlk_num_cofig where item_matter_type='"+type+"' and item_num_type='0' and ( item_office_police_index = '"+officePoliceIDIndex+"' or '" + officePoliceIDIndex + "' like CONCAT(item_office_police_index,'\\_\\_\\_%')) order by item_office_police_index desc limit 1 ";
//println("查询文书编码sql===" + sql);
var datas = queryByDSName("securitygovernment",sql);
var head_text="";
var is_year="";
var year_back_text="";
var num_length=0;
var num_back_text="";
if(datas.size()>0){
for(var iterator = datas.iterator();iterator.hasNext();){
var map1 = iterator.next();//取值
head_text= map1.get("item_head_text");
is_year= map1.get("item_is_year");
year_back_text= map1.get("item_year_back_text");
num_length= map1.get("item_num_length");
num_back_text= map1.get("item_num_back_text");
}
}
var join="";
join+=head_text;
if("1".equals(is_year)){
join+=getYear(getToday())
}
join+=year_back_text
println("join0-->"+join)
if(isNotNull(num_length)){
var ResultCodeJsonObject = new Packages.cn.myapps.util.serial.number.GenerateSerialNumber();
join=ResultCodeJsonObject.getSerialNumberByPrefix(join,false,false,false,4);
}
join+=num_back_text
return join;
}
//获取文书编码
function getNumber(officePoliceIDIndex,type){
try{
//当前环境
var env = getSettingValueByCategoryAndKeyWithExpired("电子政务Env","curEnv",60);
//println("env====" + env)
//互联网调用政务网接口。政务网直接调用getNumberImpl函数
if(isNotNull(env) && "政务网".equals(env)){
//println("调用政务网了====" + env);
return getNumberImpl(officePoliceIDIndex,type);
}
var region = getCurrentSuperviseRegionCode().substring(0,2);
//println("调用文书编码接口区域====" + region);
if(!isNotNull(region)){
return "";
}
//调政务的api来获取下一个编码
var host = getSettingValueByCategoryAndKeyWithExpired("电子政务url",region,60);
var token = getSettingValueByCategoryAndKeyWithExpired("电子政务token",region,60);
var url = host + "/magic-api/zhengwu/codenumber";
//println("获取的文书编码url为======" + url);
var header = new Packages.java.util.HashMap();
header.put("accesstoken",token);
var body = new Packages.java.util.HashMap();
body.put("officePoliceIDIndex",officePoliceIDIndex);
body.put("type",type);
var bodyJson = Packages.com.alibaba.fastjson.JSON.toJSONString(body);
var response = Packages.cn.hutool.http.HttpUtil.createPost(url).addHeaders(header).body(bodyJson).execute().body();
println("获取的文书编码接口response======" + response);
var code_number = Packages.com.alibaba.fastjson.JSON.parse(response).get("code_number");
if(isNotNull(code_number)){
return code_number;
}else{
return "";
}
}catch(e){
println("获取文书编码接口异常==========" + e);
return "";
}
}
//获取区域
/**function getCurrentRegionName(){
var regionCode = getCurrentSuperviseRegionCode().substring(0,2);
var region="";
if("11".equals(regionCode)){
region="北京市";
}else if("43".equals(regionCode)){
region="湖南省";
}else if("61".equals(regionCode)){
region="陕西省";
}else if("64".equals(regionCode)){
region="宁夏回族自治区";
}
return region;
}
*/
//机构性质
function getCompanyQuality(code){
code += "";
var value = "";
switch(code){
case "1" : { value += "国有"; break; }
case "2" : { value += "国有控股"; break; }
case "3" : { value += "民营"; break; }
case "4" : { value += "中外合资"; break; }
case "5" : { value += "中外合作"; break; }
case "6" : { value += "外资独资"; break; }
}
return value;
}
//经营范围
function getBusinessScope(code){
code += "";
println("code-->"+code)
var arr = splitString (code, ";");
println("arr-->"+arr)
var value = "";
for (var i=0;i"+arr[i]);
if("01".equals(arr[i])){
value += " 门卫 "
}else if("02".equals(arr[i])){
value += " 巡逻 "
}else if("03".equals(arr[i])){
value += " 守护 "
}else if("04".equals(arr[i])){
value += " 押运 "
}else if("05".equals(arr[i])){
value += " 随身护卫 "
}else if("06".equals(arr[i])){
value += " 安全检查 "
}else if("07".equals(arr[i])){
value += " 区域秩序维护 "
}else if("08".equals(arr[i])){
value += " 安全风险评估 "
}else if("09".equals(arr[i])){
value += " 安全技术防范 "
}else if("10".equals(arr[i])){
value += " 其他 "
}
println("value-->"+value);
}
return value;
}
//性别
function getSex(code){
code += "";
var value = "";
switch(code){
case "1" : { value += "男"; break; }
case "2" : { value += "女"; break; }
}
return value;
}
//法人的机构性质
function getShareholderCompanyQuality(code){
code += "";
var value = "";
switch(code){
case "1" : { value += "企业"; break; }
case "2" : { value += "政府授权国有资产监管管理机构"; break; }
case "3" : { value += "具有法人资格的事业单位"; break; }
case "4" : { value += "具有法人资格的民办非企业单位"; break; }
}
return value;
}
//民族
function getNation(code){
code += "";
var nation = "";
if("01".equals(code)){
nation += " 汉族 "
}else if("02".equals(code)){
nation += " 蒙古族 "
}else if("03".equals(code)){
nation += " 回族 "
}else if("04".equals(code)){
nation += " 藏族 "
}else if("05".equals(code)){
nation += " 维吾尔族 "
}else if("06".equals(code)){
nation += " 苗族 "
}else if("07".equals(code)){
nation += " 彝族 "
}else if("08".equals(code)){
nation += " 壮族 "
}else if("09".equals(code)){
nation += " 布依族 "
}
switch(code){
case "1" : { nation += "汉族"; break; }
case "2" : { nation += "蒙古族"; break; }
case "3" : { nation += "回族"; break; }
case "4" : { nation += "藏族"; break; }
case "5" : { nation += "维吾尔族"; break; }
case "6" : { nation += "苗族"; break; }
case "7" : { nation += "彝族"; break; }
case "8" : { nation += "壮族"; break; }
case "9" : { nation += "布依族"; break; }
case "10" : { nation += "朝鲜族"; break; }
case "11" : { nation += "满族"; break; }
case "12" : { nation += "侗族"; break; }
case "13" : { nation += "瑶族"; break; }
case "14" : { nation += "白族"; break; }
case "15" : { nation += "土家族"; break; }
case "16" : { nation += "哈尼族"; break; }
case "17" : { nation += "哈萨克族"; break; }
case "18" : { nation += "傣族"; break; }
case "19" : { nation += "黎族"; break; }
case "20" : { nation += "傈僳族"; break; }
case "21" : { nation += "佤族"; break; }
case "22" : { nation += "畲族"; break; }
case "23" : { nation += "高山族"; break; }
case "24" : { nation += "拉祜族"; break; }
case "25" : { nation += "水族"; break; }
case "26" : { nation += "东乡族"; break; }
case "27" : { nation += "纳西族"; break; }
case "28" : { nation += "景颇族"; break; }
case "29" : { nation += "柯尔克孜族"; break; }
case "30" : { nation += "土族"; break; }
case "31" : { nation += "达斡尔族"; break; }
case "32" : { nation += "仫佬族"; break; }
case "33" : { nation += "羌族"; break; }
case "34" : { nation += "布朗族"; break; }
case "35" : { nation += "撒拉族"; break; }
case "36" : { nation += "毛难族"; break; }
case "37" : { nation += "仡佬族"; break; }
case "38" : { nation += "锡伯族"; break; }
case "39" : { nation += "阿昌族"; break; }
case "40" : { nation += "普米族"; break; }
case "41" : { nation += "塔吉克族"; break; }
case "42" : { nation += "怒族"; break; }
case "43" : { nation += "乌孜别克族"; break; }
case "44" : { nation += "俄罗斯族"; break; }
case "45" : { nation += "鄂温克族"; break; }
case "46" : { nation += "崩龙族"; break; }
case "47" : { nation += "保安族"; break; }
case "48" : { nation += "裕固族"; break; }
case "49" : { nation += "京族"; break; }
case "50" : { nation += "塔塔尔族"; break; }
case "51" : { nation += "独龙族"; break; }
case "52" : { nation += "鄂伦春族"; break; }
case "53" : { nation += "赫哲族"; break; }
case "54" : { nation += "门巴族"; break; }
case "55" : { nation += "珞巴族"; break; }
case "56" : { nation += "基诺族"; break; }
case "57" : { nation += "其他"; break; }
case "58" : { nation += "外国血统中国籍人士"; break; }
}
return nation;
}
//学历
function getEducation(code){
code += "";
var education = "";
switch(code){
case "1" : { education += "小学"; break; }
case "2" : { education += "初中"; break; }
case "3" : { education += "高中"; break; }
case "4" : { education += "中专"; break; }
case "5" : { education += "大专"; break; }
case "6" : { education += "本科"; break; }
case "7" : { education += "硕士研究生"; break; }
case "8" : { education += "博士"; break; }
case "9" : { education += "博士后"; break; }
case "10" : { education += "其他"; break; }
}
return education;
}
//职位
function getJobType(code){
code += "";
var value = "";
switch(code){
case "1" : { value += "总经理"; break; }
case "2" : { value += "副总经理"; break; }
case "3" : { value += "法定代表人"; break; }
case "4" : { value += "法定代表人兼总经理"; break; }
}
return value;
}
//证件类型
function getIdCardType(code){
code += "";
var value = "";
switch(code){
case "1" : { value += "居民身份证/户口簿"; break; }
case "4" : { value += "香港特区护照/身份证明"; break; }
case "5" : { value += "澳门特区护照/身份证明"; break; }
case "6" : { value += "台湾居民来往大陆通行证"; break; }
case "7" : { value += "外国人护照"; break; }
}
return value;
}
//证件类型
function getEnterType(code){
code += "";
var value = "";
switch(code){
case "0" : { value += "全民所有制企业"; break; }
case "1" : { value += "集体所有制企业"; break; }
case "2" : { value += "联营企业"; break; }
case "3" : { value += "中国境内设立的外商投资企业"; break; }
case "4" : { value += "其他企业"; break; }
}
return value;
}
/**调用保安室检验api;判断是否未本公司保安师
paramObjet = new Packages.java.util.HashMap();
paramObjet.put("legalCardNumber", legalCardnumber);
paramObjet.put("legalName", legalName);
paramObjet.put("securityCompany", companyName);*/
function securityManagerIsInCompany(paramObjet){
try {
//获取`obpm2`.`meta_settings` 配置
var v5qyApiUrl = getSettingValueByCategoryAndKeyWithExpired("企业端api请求域名", "v5qyApiUrl", 60);
println("请求校验apiURL域名:" + v5qyApiUrl);
var url = v5qyApiUrl + "/security/management/incompany/check";
var Security = new Packages.cn.myapps.common.util.Security();
//获取默认登录用户的职员id,通过职员id获取token进行登录,请求api
var employeesId = getSettingValueByCategoryAndKeyWithExpired("登录账号职员id", "employeesId", 60);
println("默认登录用户employeesId:" + employeesId);
var accessToken = Security.getToken(employeesId);//获取
var data = Packages.com.alibaba.fastjson.JSON.toJSONString(paramObjet);
//println("POST的url" + url);
//println("POST的param" + data);
//println("POST的accessToken" + accessToken);
var header = new Packages.java.util.HashMap();
header.put("Content-Type", "application/json")
header.put("accessToken", accessToken);
var response = Packages.cn.hutool.http.HttpUtil.createPost(url).addHeaders(header).body(data).execute().body();
var success = Packages.com.alibaba.fastjson.JSON.parse(response).get("success");
var msg = Packages.com.alibaba.fastjson.JSON.parse(response).get("msg");
println("response: " + response);
if ("1".equals(success)) {
return msg;
} else {
println("校验保安师异常:" + msg);
return "保安师校验失败!";
}
} catch (e) {
println("请求保安师校验接口异常:e==" + e);
return "保安师校验失败!";
}
return "";
}
/**判断管理层职务是否和原来的相同
参数:管理层对象(包含人员的名字,身份证号,职务(1,总经理;2,副总经理;3,法人),职务编号)数组
*/
function managementLayerVerify(perArr){
try{
var verifyMsg = "";
var whereStr = ""; //sql的where条件
for(var i = 0; i < perArr.length; i++){
var person = perArr[i];
whereStr += "(item_name='" + person.name + "' and item_documentid = '" + person.idcard + "' and item_jobtype like '%" + person.jobtype + "%')";
if(i < perArr.length-1){
whereStr += " or ";
}
}
var sql = "select item_name,item_documentid,item_jobtype from baibaodunflow.tlk_managementlayer where (" + whereStr + ") and domainid = '" + getDomainid() +"' and item_is_delete = '0'";
//println("验证管理层职务sql==========" + sql);
var datas = queryByDSName("baibaodunFlow",sql);
var existManagers = new Packages.java.util.HashSet();//已存在的管理层的信息。姓名+身份证号+职务类型用来唯一区分一个管理层
if(datas!=null){
for(var iterator = datas.iterator();iterator.hasNext();){
var map1 = iterator.next();
var item_jobtype = map1.get("item_jobtype");
var jobtypes = item_jobtype.split(";");
for(var k = 0; k < jobtypes.length; k++){
existManagers.add(map1.get("item_name") + ";" + map1.get("item_documentid") + ";" + jobtypes[k]);
}
}
}
println("已存在管理层信息=======" + existManagers);
//遍历找到不存在或者信息有误的。
for(var j = 0; j < perArr.length;j++){
var perStr = perArr[j].name + ";" + perArr[j].idcard + ";" + perArr[j].jobtype;
if(existManagers.contains(perStr)){
continue;
}
verifyMsg += perArr[j].jobtypename + ":" + perArr[j].name + ",";
}
if(isNotNull(verifyMsg)){
verifyMsg += "管理层信息填写有误,请重新填写!"
}
return verifyMsg;
}catch(e){
println("验证管理层是发生异常:===" + e);
}
}
]]>
78