2024-1-30陕建代码最新同步

main
howec 1 year ago
parent 7affee8f1a
commit e91825226a

@ -229,6 +229,11 @@ public class ApplyPositionToNccQt implements EsbServerlessRpcRemoteInterface {
jsonObject2.put("id",id); jsonObject2.put("id",id);
jsonObject2.put("idtype",idtypePk); jsonObject2.put("idtype",idtypePk);
JSONArray r11 = getFjByCollectId(collectid); JSONArray r11 = getFjByCollectId(collectid);
if(r11.size() == 0) {
sql = "update uf_rcrt_entry_manage_qtry set entry_status = '1' where id = "+rzid;
jdbcTemplate.execute(sql);
return WeaResult.success(finresult);
}
jsonObject2.put("data",r11); jsonObject2.put("data",r11);
nccApiUtil = new NccApiUtil(); nccApiUtil = new NccApiUtil();
nccApiUtil.init(); nccApiUtil.init();

@ -70,7 +70,7 @@ public class ErrorfjResendToNcc implements EsbServerlessRpcRemoteInterface {
String rs11 = nccApiUtil.doJsonPost(url,token,jsonObject2.toJSONString()); String rs11 = nccApiUtil.doJsonPost(url,token,jsonObject2.toJSONString());
NccResultUtil rs = new NccResultUtil(rs11); NccResultUtil rs = new NccResultUtil(rs11);
if(rs.getResult()){ if(rs.getResult()){
sql = "update uf_rcrt_entry_manage set fjtbsfyc = '0' where id = "+rzid; sql = "update uf_rcrt_entry_manage set fjtbsfyc = '0', entry_status = '1' where id = "+rzid;
jdbcTemplate.execute(sql); jdbcTemplate.execute(sql);
return WeaResult.success(finresult); return WeaResult.success(finresult);
}else { }else {

@ -70,7 +70,7 @@ public class ErrorfjResendToNccQt implements EsbServerlessRpcRemoteInterface {
String rs11 = nccApiUtil.doJsonPost(url,token,jsonObject2.toJSONString()); String rs11 = nccApiUtil.doJsonPost(url,token,jsonObject2.toJSONString());
NccResultUtil rs = new NccResultUtil(rs11); NccResultUtil rs = new NccResultUtil(rs11);
if(rs.getResult()){ if(rs.getResult()){
sql = "update uf_rcrt_entry_manage_qtry set fjtbsfyc = '0' where id = "+rzid; sql = "update uf_rcrt_entry_manage_qtry set fjtbsfyc = '0',entry_status = '1' where id = "+rzid;
jdbcTemplate.execute(sql); jdbcTemplate.execute(sql);
return WeaResult.success(finresult); return WeaResult.success(finresult);
}else { }else {

@ -101,22 +101,22 @@ public class FrCompanyApplyToNcc implements EsbServerlessRpcRemoteInterface {
long negotiation = (long)r.get("negotiation");//谈判工资 long negotiation = (long)r.get("negotiation");//谈判工资
String xbdb = ""; String xbdb = "";
if(r.get("wa_seclv")!=null) { if(r.get("wa_seclv")!=null) {
long id1 = (long)r.get("wa_seclv"); String id1 = (String)r.get("wa_seclv");
if(id1 != 0l) { if(id1.length()>0) {
sql = "select levelname from uf_wa_prmlv where id = "+id1; sql = "select levelname from uf_wa_prmlv where id = "+id1;
Map<String,Object> rso= jdbcTemplate.queryForMap(sql); Map<String,Object> rso= jdbcTemplate.queryForMap(sql);
xbdb = (String)rso.get("levelname"); xbdb = (String)rso.get("levelname");
} }
} }
String nmoney = ""; String money = "";
if(r.get("waitem")!=null) { if(r.get("money")!=null) {
nmoney = (String)r.get("waitem");//金额 money = String.valueOf(r.get("money"));//金额
} }
String memo=(String)r.get("memo");//备注 String memo=(String)r.get("memo");//备注
//通过薪资标准表id获取薪资标准名称 //通过薪资标准表id获取薪资标准名称
String pk_wa_crt_name = ""; String pk_wa_crt_name = "";
if(r.get("pk_wa_crt") != null) { if(r.get("pk_wa_crt") != null) {
long pk_wa_crt = (long)r.get("pk_wa_crt");//薪资标准表 String pk_wa_crt = String.valueOf(r.get("pk_wa_crt"));//薪资标准表
sql = "select name from uf_wa_grade where id = "+pk_wa_crt; sql = "select name from uf_wa_grade where id = "+pk_wa_crt;
Map<String,Object> rso= jdbcTemplate.queryForMap(sql); Map<String,Object> rso= jdbcTemplate.queryForMap(sql);
pk_wa_crt_name = (String)rso.get("name"); pk_wa_crt_name = (String)rso.get("name");
@ -127,7 +127,7 @@ public class FrCompanyApplyToNcc implements EsbServerlessRpcRemoteInterface {
dataobj.put("begindate",usedate); dataobj.put("begindate",usedate);
dataobj.put("wa_prmlv",xbdb);//薪资级别 dataobj.put("wa_prmlv",xbdb);//薪资级别
// dataobj.put("wa_seclv","");//薪档级别 // dataobj.put("wa_seclv","");//薪档级别
dataobj.put("nmoney",nmoney); dataobj.put("nmoney",money);
dataobj.put("waflag","Y"); dataobj.put("waflag","Y");
dataobj.put("pk_wa_item_showname",xzxmmc); dataobj.put("pk_wa_item_showname",xzxmmc);
dataobj.put("pk_wa_grd_showname",pk_wa_crt_name); dataobj.put("pk_wa_grd_showname",pk_wa_crt_name);

@ -8,7 +8,9 @@ import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
import com.weaver.seconddev.sxjg.config.EbDbDataSourceConfig; import com.weaver.seconddev.sxjg.config.EbDbDataSourceConfig;
import com.weaver.seconddev.sxjg.config.EbDbDataSourceConfigResp; import com.weaver.seconddev.sxjg.config.EbDbDataSourceConfigResp;
import com.weaver.seconddev.sxjg.util.NccApiUtil; import com.weaver.seconddev.sxjg.util.NccApiUtil;
import com.weaver.seconddev.sxjg.util.NccApiUtil2;
import com.weaver.seconddev.sxjg.util.NccResultUtil; import com.weaver.seconddev.sxjg.util.NccResultUtil;
import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
@ -91,11 +93,11 @@ public class PersonDdToNcc implements EsbServerlessRpcRemoteInterface {
return WeaResult.success(finresult); return WeaResult.success(finresult);
} }
r1.put("data",array); r1.put("data",array);
nccApiUtil = new NccApiUtil(); NccApiUtil2 nccApiUtil2 = new NccApiUtil2();
nccApiUtil.init(); nccApiUtil2.init();
token = nccApiUtil.getToken(); token = nccApiUtil2.getToken();
url = nccApiUtil.getBaseUrl()+"nccloud/api/hrwa/customermanage/adjust/import"; url = nccApiUtil2.getBaseUrl()+"nccloud/api/hrwa/customermanage/adjust/import";
rs11 = nccApiUtil.doJsonPost(url,token,r1.toJSONString()); rs11 = nccApiUtil2.doJsonPost(url,token,r1.toJSONString());
rs = new NccResultUtil(rs11); rs = new NccResultUtil(rs11);
if(rs.getResult()) { if(rs.getResult()) {
return WeaResult.success(finresult); return WeaResult.success(finresult);
@ -133,22 +135,22 @@ public class PersonDdToNcc implements EsbServerlessRpcRemoteInterface {
long negotiation = (long)r.get("negotiation");//谈判工资 long negotiation = (long)r.get("negotiation");//谈判工资
String xbdb = ""; String xbdb = "";
if(r.get("wa_seclv")!=null) { if(r.get("wa_seclv")!=null) {
long id1 = (long)r.get("wa_seclv"); String id1 = (String)r.get("wa_seclv");
if(id1 != 0l) { if(id1.length()>0) {
sql = "select levelname from uf_wa_prmlv where id = "+id1; sql = "select levelname from uf_wa_prmlv where id = "+id1;
Map<String,Object> rso= jdbcTemplate.queryForMap(sql); Map<String,Object> rso= jdbcTemplate.queryForMap(sql);
xbdb = (String)rso.get("levelname"); xbdb = (String)rso.get("levelname");
} }
} }
String nmoney = ""; String nmoney = "";
if(r.get("waitem")!=null) { if(r.get("money")!=null) {
nmoney = (String)r.get("waitem");//金额 nmoney = String.valueOf(r.get("money"));//金额
} }
String memo=(String)r.get("memo");//备注 String memo=(String)r.get("memo");//备注
//通过薪资标准表id获取薪资标准名称 //通过薪资标准表id获取薪资标准名称
String pk_wa_crt_name = ""; String pk_wa_crt_name = "";
if(r.get("pk_wa_crt") != null) { if(r.get("pk_wa_crt") != null) {
long pk_wa_crt = (long)r.get("pk_wa_crt");//薪资标准表 String pk_wa_crt = String.valueOf(r.get("pk_wa_crt"));//薪资标准表
sql = "select name from uf_wa_grade where id = "+pk_wa_crt; sql = "select name from uf_wa_grade where id = "+pk_wa_crt;
Map<String,Object> rso= jdbcTemplate.queryForMap(sql); Map<String,Object> rso= jdbcTemplate.queryForMap(sql);
pk_wa_crt_name = (String)rso.get("name"); pk_wa_crt_name = (String)rso.get("name");

@ -108,22 +108,22 @@ public class PersonJxToNcc implements EsbServerlessRpcRemoteInterface {
long negotiation = (long)r.get("negotiation");//谈判工资 long negotiation = (long)r.get("negotiation");//谈判工资
String xbdb = ""; String xbdb = "";
if(r.get("wa_seclv")!=null) { if(r.get("wa_seclv")!=null) {
long id1 = (long)r.get("wa_seclv"); String id1 = (String)r.get("wa_seclv");
if(id1 != 0l) { if(id1.length()>0) {
sql = "select levelname from uf_wa_prmlv where id = "+id1; sql = "select levelname from uf_wa_prmlv where id = "+id1;
Map<String,Object> rso= jdbcTemplate.queryForMap(sql); Map<String,Object> rso= jdbcTemplate.queryForMap(sql);
xbdb = (String)rso.get("levelname"); xbdb = (String)rso.get("levelname");
} }
} }
String nmoney = ""; String nmoney = "";
if(r.get("waitem")!=null) { if(r.get("money")!=null) {
nmoney = (String)r.get("waitem");//金额 nmoney = String.valueOf(r.get("money"));//金额
} }
String memo=(String)r.get("memo");//备注 String memo=(String)r.get("memo");//备注
//通过薪资标准表id获取薪资标准名称 //通过薪资标准表id获取薪资标准名称
String pk_wa_crt_name = ""; String pk_wa_crt_name = "";
if(r.get("pk_wa_crt") != null) { if(r.get("pk_wa_crt") != null) {
long pk_wa_crt = (long)r.get("pk_wa_crt");//薪资标准表 String pk_wa_crt = String.valueOf(r.get("pk_wa_crt"));//薪资标准表
sql = "select name from uf_wa_grade where id = "+pk_wa_crt; sql = "select name from uf_wa_grade where id = "+pk_wa_crt;
Map<String,Object> rso= jdbcTemplate.queryForMap(sql); Map<String,Object> rso= jdbcTemplate.queryForMap(sql);
pk_wa_crt_name = (String)rso.get("name"); pk_wa_crt_name = (String)rso.get("name");

@ -119,22 +119,22 @@ public class SunCompanyDpToNcc implements EsbServerlessRpcRemoteInterface {
long negotiation = (long)r.get("negotiation");//谈判工资 long negotiation = (long)r.get("negotiation");//谈判工资
String xbdb = ""; String xbdb = "";
if(r.get("wa_seclv")!=null) { if(r.get("wa_seclv")!=null) {
long id1 = (long)r.get("wa_seclv"); String id1 = (String)r.get("wa_seclv");
if(id1 != 0l) { if(id1.length()>0) {
sql = "select levelname from uf_wa_prmlv where id = "+id1; sql = "select levelname from uf_wa_prmlv where id = "+id1;
Map<String,Object> rso= jdbcTemplate.queryForMap(sql); Map<String,Object> rso= jdbcTemplate.queryForMap(sql);
xbdb = (String)rso.get("levelname"); xbdb = (String)rso.get("levelname");
} }
} }
String nmoney = ""; String nmoney = "";
if(r.get("waitem")!=null) { if(r.get("money")!=null) {
nmoney = (String)r.get("waitem");//金额 nmoney = String.valueOf(r.get("money"));//金额
} }
String memo=(String)r.get("memo");//备注 String memo=(String)r.get("memo");//备注
//通过薪资标准表id获取薪资标准名称 //通过薪资标准表id获取薪资标准名称
String pk_wa_crt_name = ""; String pk_wa_crt_name = "";
if(r.get("pk_wa_crt") != null) { if(r.get("pk_wa_crt") != null) {
long pk_wa_crt = (long)r.get("pk_wa_crt");//薪资标准表 String pk_wa_crt = String.valueOf(r.get("pk_wa_crt"));//薪资标准表
sql = "select name from uf_wa_grade where id = "+pk_wa_crt; sql = "select name from uf_wa_grade where id = "+pk_wa_crt;
Map<String,Object> rso= jdbcTemplate.queryForMap(sql); Map<String,Object> rso= jdbcTemplate.queryForMap(sql);
pk_wa_crt_name = (String)rso.get("name"); pk_wa_crt_name = (String)rso.get("name");

@ -0,0 +1,16 @@
package com.weaver.seconddev.sxjg.esb;
import com.weaver.seconddev.sxjg.util.NccApiUtil;
import org.junit.Test;
public class TestDd {
@Test
public void test() throws Exception {
String str = "{\"data\":[{\"waflag\":\"Y\",\"begindate\":\"2024-01-25\",\"wa_prmlv\":\"01&服务类\",\"pk_wa_item_showname\":\"基本工资标准\",\"pk_wa_grd_showname\":\"陕建集团总部技能操作通道基本薪资规则\",\"negotiation_wage\":\"N\",\"nmoney\":\"8000.00\",\"psnName\":\"孟立超1\",\"psnCode\":\"00105895\"},{\"waflag\":\"Y\",\"begindate\":\"2024-01-25\",\"wa_prmlv\":\"\",\"pk_wa_item_showname\":\"绩效工资标准\",\"pk_wa_grd_showname\":\"\",\"negotiation_wage\":\"Y\",\"nmoney\":\"9000.00\",\"psnName\":\"孟立超1\",\"psnCode\":\"00105895\"}],\"state\":\"2\",\"pk_org\":\"0001A21000000000IR6D\"}";
NccApiUtil nccApiUtil = new NccApiUtil();
nccApiUtil.init();
String token = nccApiUtil.getToken();
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrwa/customermanage/adjust/import";
String rs11 = nccApiUtil.doJsonPost(url,token,str);
}
}

@ -118,22 +118,22 @@ public class ZhiGongBdToNcc implements EsbServerlessRpcRemoteInterface {
long negotiation = (long)r.get("negotiation");//谈判工资 long negotiation = (long)r.get("negotiation");//谈判工资
String xbdb = ""; String xbdb = "";
if(r.get("wa_seclv")!=null) { if(r.get("wa_seclv")!=null) {
long id1 = (long)r.get("wa_seclv"); String id1 = (String)r.get("wa_seclv");
if(id1 != 0l) { if(id1.length()>0) {
sql = "select levelname from uf_wa_prmlv where id = "+id1; sql = "select levelname from uf_wa_prmlv where id = "+id1;
Map<String,Object> rso= jdbcTemplate.queryForMap(sql); Map<String,Object> rso= jdbcTemplate.queryForMap(sql);
xbdb = (String)rso.get("levelname"); xbdb = (String)rso.get("levelname");
} }
} }
String nmoney = ""; String nmoney = "";
if(r.get("waitem")!=null) { if(r.get("money")!=null) {
nmoney = (String)r.get("waitem");//金额 nmoney = String.valueOf(r.get("money"));//金额
} }
String memo=(String)r.get("memo");//备注 String memo=(String)r.get("memo");//备注
//通过薪资标准表id获取薪资标准名称 //通过薪资标准表id获取薪资标准名称
String pk_wa_crt_name = ""; String pk_wa_crt_name = "";
if(r.get("pk_wa_crt") != null) { if(r.get("pk_wa_crt") != null) {
long pk_wa_crt = (long)r.get("pk_wa_crt");//薪资标准表 String pk_wa_crt = String.valueOf(r.get("pk_wa_crt"));//薪资标准表
sql = "select name from uf_wa_grade where id = "+pk_wa_crt; sql = "select name from uf_wa_grade where id = "+pk_wa_crt;
Map<String,Object> rso= jdbcTemplate.queryForMap(sql); Map<String,Object> rso= jdbcTemplate.queryForMap(sql);
pk_wa_crt_name = (String)rso.get("name"); pk_wa_crt_name = (String)rso.get("name");

@ -118,22 +118,22 @@ public class ZhiGongnbdpToNcc implements EsbServerlessRpcRemoteInterface {
long negotiation = (long)r.get("negotiation");//谈判工资 long negotiation = (long)r.get("negotiation");//谈判工资
String xbdb = ""; String xbdb = "";
if(r.get("wa_seclv")!=null) { if(r.get("wa_seclv")!=null) {
long id1 = (long)r.get("wa_seclv"); String id1 = (String)r.get("wa_seclv");
if(id1 != 0l) { if(id1.length()>0) {
sql = "select levelname from uf_wa_prmlv where id = "+id1; sql = "select levelname from uf_wa_prmlv where id = "+id1;
Map<String,Object> rso= jdbcTemplate.queryForMap(sql); Map<String,Object> rso= jdbcTemplate.queryForMap(sql);
xbdb = (String)rso.get("levelname"); xbdb = (String)rso.get("levelname");
} }
} }
String nmoney = ""; String nmoney = "";
if(r.get("waitem")!=null) { if(r.get("money")!=null) {
nmoney = (String)r.get("waitem");//金额 nmoney = String.valueOf(r.get("money"));//金额
} }
String memo=(String)r.get("memo");//备注 String memo=(String)r.get("memo");//备注
//通过薪资标准表id获取薪资标准名称 //通过薪资标准表id获取薪资标准名称
String pk_wa_crt_name = ""; String pk_wa_crt_name = "";
if(r.get("pk_wa_crt") != null) { if(r.get("pk_wa_crt") != null) {
long pk_wa_crt = (long)r.get("pk_wa_crt");//薪资标准表 String pk_wa_crt = String.valueOf(r.get("pk_wa_crt"));//薪资标准表
sql = "select name from uf_wa_grade where id = "+pk_wa_crt; sql = "select name from uf_wa_grade where id = "+pk_wa_crt;
Map<String,Object> rso= jdbcTemplate.queryForMap(sql); Map<String,Object> rso= jdbcTemplate.queryForMap(sql);
pk_wa_crt_name = (String)rso.get("name"); pk_wa_crt_name = (String)rso.get("name");

@ -141,8 +141,8 @@ public class NccApiUtil {
String line; String line;
while ((line = reader.readLine()) != null) while ((line = reader.readLine()) != null)
strber.append(line + "\n"); strber.append(line + "\n");
inStream.close();
result = strber.toString(); result = strber.toString();
inStream.close();
log.error("NCC接口"+url+",返回值:>>>>>>>>>>>>>>>>>>>>>>"+result); log.error("NCC接口"+url+",返回值:>>>>>>>>>>>>>>>>>>>>>>"+result);
} catch (Exception e) { } catch (Exception e) {
log.error("NCC接口"+url+",返回值:>>>>>>>>>>>>>>>>>>>>>>"+e.getMessage()); log.error("NCC接口"+url+",返回值:>>>>>>>>>>>>>>>>>>>>>>"+e.getMessage());

@ -0,0 +1,339 @@
package com.weaver.seconddev.sxjg.util;
import com.alibaba.fastjson.JSONObject;
import com.weaver.ebuilder.common.exception.BusinessException;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.OAEPParameterSpec;
import javax.crypto.spec.PSource;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.security.*;
import java.security.spec.MGF1ParameterSpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.HashMap;
import java.util.Map;
public class NccApiUtil2 {
private static final Logger log = LoggerFactory.getLogger(NccApiUtil2.class);
public String getBaseUrl() {
return baseUrl;
}
public void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl;
}
private String baseUrl;
// 访问的nccloud系统的账套编码开发环境使用develop生产环境需要使用用root账号登录在“系统管理”节点查看账套编码由陕西建工HR系统提供
private String biz_center;
public String getClient_id() {
return client_id;
}
public void setClient_id(String client_id) {
this.client_id = client_id;
}
//陕煤HR系统在陕西建工HR系统中应用注册当中的app_id
private String client_id;
//陕煤HR系统在陕西建工HR系统中应用注册当中的app_secret由陕西建工HR系统提供
private String client_secret;
//陕西建工HR系统中应用注册当中的(公钥)pubKey由陕西建工HR系统提供
private String pubKey;
private String signature;
public void init() {
PropertiesConfiguration p = null;
try {
p = new PropertiesConfiguration();
p.setEncoding("utf-8");
p.setFileName("config/nccconfig.properties");
p.load();
this.baseUrl = p.getString("sxjgncc.url");
this.biz_center = p.getString("sxjgncc.biz_center");
this.client_id = p.getString("sxjgncc.client_id");
this.client_secret = p.getString("sxjgncc.client_secret");
this.pubKey = p.getString("sxjgncc.public_key");
}catch (ConfigurationException e) {
throw new BusinessException("获取sxjg.properties配置文件失败", e);
}
}
/**
* ncctoken
* @return@
* @throws Exception
*/
public String getToken() throws Exception {
Map<String, String> paramMap = new HashMap();
//获取token方式固定为client_credentials
paramMap.put("grant_type", "client_credentials");
//陕煤HR系统在陕西建工HR系统中应用注册当中的app_id由陕西建工HR系统提供
paramMap.put("client_id", this.client_id);
//加密陕煤HR系统在陕西建工HR系统中应用注册当中的(公钥)pubKey和app_secret由陕西建工HR系统提供
String encode = URLEncoder.encode(pubEncrypt(this.pubKey, this.client_secret), "UTF-8");//需要写入报文头中
paramMap.put("client_secret", encode);
// 账套编码开发环境使用develop生产环境需要使用用root账号登录在“系统管理”节点查看账套编码由陕西建工HR系统提供
paramMap.put("biz_center", this.biz_center);
//请求加签其算法getSHA256(client_id + client_secret + pubKey)
String sign = getSHA256(this.client_id + this.client_secret + this.pubKey, this.pubKey);
paramMap.put("signature", sign);//需要写入报文头中
this.setSignature(sign);
//查询token的url
String url = this.baseUrl + "nccloud/opm/accesstoken";
String mediaType = "application/x-www-form-urlencoded";
String token = this.doPost(url, paramMap, mediaType, (Map)null, "");
JSONObject rs = JSONObject.parseObject(token);
if(rs.getBoolean("success")) {
JSONObject jsonObject = rs.getJSONObject("data");
String token1 = jsonObject.getString("access_token");
return token1;
}else {
log.error("howec::::::::::::111:"+token);
throw new Exception("获取toaken失败");
}
}
public String doJsonPost(String url, String accessToken, String json) {
log.error("NCC接口"+url+",推送报文:>>>>>>>>>>>>>>>>>>>>>>"+json);
CloseableHttpClient client = HttpClients.createDefault();
HttpPost post = new HttpPost(url);
post.setHeader("Content-Type", "application/json;charset=utf-8");
post.setHeader("access_token", accessToken);
post.setHeader("repeat_check","Y");
post.setHeader("ucg_flag","Y");
post.setHeader("signature",this.getSignature());
post.setHeader("client_id",this.getClient_id());
String result="";
try {
StringEntity s = new StringEntity(json,"UTF-8");
s.setContentEncoding("utf-8");
s.setContentType("application/json");
post.setEntity(s);
// 发送请求
HttpResponse httpResponse = client.execute(post);
// 获取响应输入流
InputStream inStream = httpResponse.getEntity().getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(
inStream,"utf-8"));
StringBuilder strber = new StringBuilder();
String line;
while ((line = reader.readLine()) != null)
strber.append(line + "\n");
inStream.close();
result = strber.toString();
log.error("NCC接口"+url+",返回值:>>>>>>>>>>>>>>>>>>>>>>"+result);
} catch (Exception e) {
e.printStackTrace();
log.error("NCC接口"+url+",返回值:>>>>>>>>>>>1>>>>>>>>>>>"+e.getMessage());
}
return result;
}
public static String pubEncrypt(String pubKey, String src) throws Exception {
String target = null;
ByteArrayOutputStream out = null;
try {
Key key = getPublicKey(pubKey);
Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA-256AndMGF1Padding");
cipher.init(1, key, new OAEPParameterSpec("SHA-256", "MGF1", new MGF1ParameterSpec("SHA-256"), PSource.PSpecified.DEFAULT));
byte[] data = src.getBytes();
int inputLen = data.length;
out = new ByteArrayOutputStream();
int offSet = 0;
for(int i = 0; inputLen - offSet > 0; offSet = i * 117) {
byte[] cache;
if (inputLen - offSet > 117) {
cache = cipher.doFinal(data, offSet, 117);
} else {
cache = cipher.doFinal(data, offSet, inputLen - offSet);
}
out.write(cache, 0, cache.length);
++i;
}
target = (new Base64()).encodeToString(out.toByteArray());
} catch (NoSuchPaddingException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException | NoSuchAlgorithmException var14) {
throw new Exception("加密失败", var14);
} finally {
if (out != null) {
out.close();
}
}
return target;
}
public static Key getPublicKey(String pubKey) throws Exception {
PublicKey key = null;
try {
byte[] keyBytes = (new Base64()).decode(pubKey);;
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes);
key = keyFactory.generatePublic(x509KeySpec);
return key;
} catch (Exception var5) {
throw new Exception("无效的密钥 ", var5);
}
}
public static String getSHA256(String str, String key) throws Exception {
byte[] salt = new byte[16];
SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
random.setSeed(key.getBytes());
random.nextBytes(salt);
String salt_value = (new Base64()).encodeToString(salt);
return getSHA256(str + salt_value.replaceAll("\r|\n", ""));
}
private static String getSHA256(String str) throws Exception {
String encodestr = "";
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
messageDigest.update(str.getBytes("UTF-8"));
encodestr = byte2Hex(messageDigest.digest());
return encodestr;
}
private static String byte2Hex(byte[] bytes) {
StringBuffer stringBuffer = new StringBuffer();
String temp = null;
for(int i = 0; i < bytes.length; ++i) {
temp = Integer.toHexString(bytes[i] & 255);
if (temp.length() == 1) {
stringBuffer.append("0");
}
stringBuffer.append(temp);
}
return stringBuffer.toString();
}
/**
* post
*
* @param baseUrl
* @param paramMap
* @param mediaType
* @param headers
* @param json
* @return
*/
private static String doPost(String baseUrl, Map<String, String> paramMap, String mediaType, Map<String, String> headers, String json) {
HttpURLConnection urlConnection = null;
InputStream in = null;
OutputStream out = null;
BufferedReader bufferedReader = null;
String result = null;
try {
StringBuffer sb = new StringBuffer();
sb.append(baseUrl);
if (paramMap != null) {
sb.append("?");
for (Map.Entry<String, String> entry : paramMap.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
sb.append(key + "=" + value).append("&");
}
baseUrl = sb.toString().substring(0, sb.toString().length() - 1);
}
URL urlObj = new URL(baseUrl);
urlConnection = (HttpURLConnection) urlObj.openConnection();
urlConnection.setConnectTimeout(50000);
urlConnection.setRequestMethod("POST");
urlConnection.setDoOutput(true);
urlConnection.setDoInput(true);
urlConnection.setUseCaches(false);
urlConnection.addRequestProperty("content-type", mediaType);
if (headers != null) {
for (String key : headers.keySet()) {
urlConnection.addRequestProperty(key, headers.get(key));
}
}
out = urlConnection.getOutputStream();
out.write(json.getBytes("utf-8"));
out.flush();
int resCode = urlConnection.getResponseCode();
if (resCode == HttpURLConnection.HTTP_OK || resCode == HttpURLConnection.HTTP_CREATED || resCode == HttpURLConnection.HTTP_ACCEPTED) {
in = urlConnection.getInputStream();
} else {
in = urlConnection.getErrorStream();
}
bufferedReader = new BufferedReader(new InputStreamReader(in, "utf-8"));
StringBuffer temp = new StringBuffer();
String line = bufferedReader.readLine();
while (line != null) {
temp.append(line).append("\r\n");
line = bufferedReader.readLine();
}
String ecod = urlConnection.getContentEncoding();
if (ecod == null) {
ecod = Charset.forName("utf-8").name();
}
result = new String(temp.toString().getBytes("utf-8"), ecod);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (null != bufferedReader) {
try {
bufferedReader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (null != out) {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (null != in) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
urlConnection.disconnect();
}
return result;
}
public String getSignature() {
return signature;
}
public void setSignature(String signature) {
this.signature = signature;
}
}

@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.weaver.common.base.entity.result.WeaResult; import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.ebuilder.common.exception.BusinessException;
import com.weaver.esb.api.rpc.EsbRpcRemoteInterface; import com.weaver.esb.api.rpc.EsbRpcRemoteInterface;
import com.weaver.eteams.file.client.file.FileObj; import com.weaver.eteams.file.client.file.FileObj;
import com.weaver.eteams.file.client.param.RemoteUploadParam; import com.weaver.eteams.file.client.param.RemoteUploadParam;
@ -26,7 +25,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.File; import java.io.File;
@ -71,7 +69,7 @@ public class EsbRpcPositionZhilian implements EsbRpcRemoteInterface {
@Autowired @Autowired
FileUploadService fileUploadService; FileUploadService fileUploadService;
public EsbRpcPositionZhilian() { public EsbRpcPositionZhilian() throws Exception {
PropertiesConfiguration p = null; PropertiesConfiguration p = null;
try { try {
p = new PropertiesConfiguration(); p = new PropertiesConfiguration();
@ -93,7 +91,7 @@ public class EsbRpcPositionZhilian implements EsbRpcRemoteInterface {
this.setManagerId(p.getString("managerid")); this.setManagerId(p.getString("managerid"));
this.setAnnex(p.getString("sxjg.annexurl")); this.setAnnex(p.getString("sxjg.annexurl"));
}catch (ConfigurationException e) { }catch (ConfigurationException e) {
throw new BusinessException("获取sxjg.properties配置文件失败", e); throw new Exception("获取sxjg.properties配置文件失败");
} }
} }

@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.weaver.common.base.entity.result.WeaResult; import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.ebuilder.common.exception.BusinessException;
import com.weaver.esb.api.rpc.EsbRpcRemoteInterface; import com.weaver.esb.api.rpc.EsbRpcRemoteInterface;
import com.weaver.eteams.file.client.file.FileObj; import com.weaver.eteams.file.client.file.FileObj;
import com.weaver.eteams.file.client.param.RemoteUploadParam; import com.weaver.eteams.file.client.param.RemoteUploadParam;
@ -57,7 +56,7 @@ public class EsbRpcPositionZhilianSz implements EsbRpcRemoteInterface {
RecruitCandidateRemoteService recruitCandidateRemoteService; RecruitCandidateRemoteService recruitCandidateRemoteService;
@Autowired @Autowired
FileUploadService fileUploadService; FileUploadService fileUploadService;
public EsbRpcPositionZhilianSz() { public EsbRpcPositionZhilianSz() throws Exception {
PropertiesConfiguration p = null; PropertiesConfiguration p = null;
try { try {
p = new PropertiesConfiguration(); p = new PropertiesConfiguration();
@ -74,7 +73,7 @@ public class EsbRpcPositionZhilianSz implements EsbRpcRemoteInterface {
this.setTenantKey(p.getString("tenantKey")); this.setTenantKey(p.getString("tenantKey"));
this.setManagerId(p.getString("managerid")); this.setManagerId(p.getString("managerid"));
} catch (ConfigurationException e) { } catch (ConfigurationException e) {
throw new BusinessException("获取sxjg.properties配置文件失败", e); throw new Exception("获取sxjg.properties配置文件失败");
} }
} }

@ -1,6 +1,5 @@
package com.weaver.sxjg.esb; package com.weaver.sxjg.esb;
import com.weaver.ebuilder.common.exception.BusinessException;
import com.weaver.esb.api.rpc.EsbRpcRemoteInterface; import com.weaver.esb.api.rpc.EsbRpcRemoteInterface;
import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.commons.configuration.PropertiesConfiguration;
@ -21,7 +20,7 @@ import java.util.Map;
*/ */
@Service("esbRpcRemoteSendDx_sj") @Service("esbRpcRemoteSendDx_sj")
public class EsbRpcRemoteSendDx implements EsbRpcRemoteInterface { public class EsbRpcRemoteSendDx implements EsbRpcRemoteInterface {
public EsbRpcRemoteSendDx() { public EsbRpcRemoteSendDx() throws Exception {
PropertiesConfiguration p = null; PropertiesConfiguration p = null;
try { try {
p = new PropertiesConfiguration(); p = new PropertiesConfiguration();
@ -33,7 +32,7 @@ public class EsbRpcRemoteSendDx implements EsbRpcRemoteInterface {
this.setCorpID(p.getString("message.CorpID")); this.setCorpID(p.getString("message.CorpID"));
this.setQm(p.getString("message.qm")); this.setQm(p.getString("message.qm"));
}catch (ConfigurationException e) { }catch (ConfigurationException e) {
throw new BusinessException("获取sxjg.properties配置文件失败", e); throw new Exception("获取sxjg.properties配置文件失败", e);
} }
} }
private static final Logger log = LoggerFactory.getLogger(EsbRpcRemoteSendDx.class); private static final Logger log = LoggerFactory.getLogger(EsbRpcRemoteSendDx.class);

@ -4,15 +4,12 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.weaver.common.base.entity.result.WeaResult; import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.ebuilder.common.exception.BusinessException; import com.weaver.ebuilder.common.exception.BusinessException;
import com.weaver.ebuilder.form.client.entity.obj.Obj;
import com.weaver.ebuilder.form.client.utils.UserUtils;
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface; import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
import com.weaver.eteams.file.client.file.FileObj; import com.weaver.eteams.file.client.file.FileObj;
import com.weaver.eteams.file.client.param.RemoteUploadParam; import com.weaver.eteams.file.client.param.RemoteUploadParam;
import com.weaver.file.ud.api.FileUploadService; import com.weaver.file.ud.api.FileUploadService;
import com.weaver.sxjg.assess.config.EbDbDataSourceConfig; import com.weaver.sxjg.assess.config.EbDbDataSourceConfig;
import com.weaver.sxjg.assess.util.SxjgUtil; import com.weaver.sxjg.assess.util.SxjgUtil;
import com.weaver.teams.security.UserAgentUtils;
import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.commons.configuration.PropertiesConfiguration;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -22,7 +19,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.InputStream; import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.util.Date; import java.util.Date;

@ -98,6 +98,11 @@ public class SxjgUtil{
} }
} }
public static void main(String[] args) {
String r =getApiResult(null,"950211276134719488","876950","950206388353032192","https://eas.zhaopin.com/Assessment/api/OpenApiResult.ashx","f65a0fc0c3cf0c1ff60343d8f771cc98");
System.out.println(r);
}
public static String getApiResult(JdbcTemplate jdbcTemplate, String personIds, String CompanyId, String jobid,String url1,String secret) { public static String getApiResult(JdbcTemplate jdbcTemplate, String personIds, String CompanyId, String jobid,String url1,String secret) {
String url = url1+"?CompanyId="+CompanyId+"&PersonIds="+personIds+"&JobId="+jobid+"&Signature="; String url = url1+"?CompanyId="+CompanyId+"&PersonIds="+personIds+"&JobId="+jobid+"&Signature=";
String r2 = CompanyId+jobid+personIds+secret; String r2 = CompanyId+jobid+personIds+secret;

Loading…
Cancel
Save