新增token日志
This commit is contained in:
parent
0cea01300d
commit
ffe8c88392
|
|
@ -6,6 +6,7 @@ import com.engine.salary.encrypt.AESEncryptUtil;
|
|||
import com.engine.salary.entity.salaryBill.param.SalaryBillGetTokenParam;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.util.db.IdGenerator;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
|
|
@ -23,6 +24,7 @@ import java.time.LocalDateTime;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
public class SalaryTokenUtil {
|
||||
|
||||
/**
|
||||
|
|
@ -126,8 +128,10 @@ public class SalaryTokenUtil {
|
|||
heads.put("appid", appid);
|
||||
heads.put("cpk", cpk);
|
||||
// 调用ECOLOGY系统接口进行注册
|
||||
String data = post(httpKey + ip + "/api/ec/dev/auth/regist", null, heads);
|
||||
String url = httpKey + ip + "/api/ec/dev/auth/regist";
|
||||
String data = post(url , null, heads);
|
||||
Map<String, Object> datas = JSONObject.parseObject(data, new TypeReference<Map<String, Object>>() {});
|
||||
log.info("GetToken regist url {} ,heads {}, data: {}",url ,heads, data);
|
||||
// ECOLOGY返回的系统公钥
|
||||
String spk = (String) (datas.get("spk"));
|
||||
RSA rsa = new RSA();
|
||||
|
|
@ -138,16 +142,20 @@ public class SalaryTokenUtil {
|
|||
sql = String.format("insert into hrsa_salary_sys_conf(id, conf_key, conf_value, title, module, order_weight, delete_type, create_time, update_time) values (%s,'%s','%s','%s','%s',%s,%s,'%s','%s')",
|
||||
IdGenerator.generate(), "SALARY_TOKEN_SECRET", secret, "token", "basic",0,0,date,date);
|
||||
rs.execute(sql);
|
||||
log.info("GetToken regist secret , sql: {}", sql);
|
||||
// 保存spk
|
||||
sql = String.format("insert into hrsa_salary_sys_conf(id, conf_key, conf_value, title, module, order_weight, delete_type, create_time, update_time) values (%s,'%s','%s','%s','%s',%s,%s,'%s','%s')",
|
||||
IdGenerator.generate(), "SALARY_TOKEN_SPK", spk, "spk", "basic",0,0,date,date);
|
||||
rs.execute(sql);
|
||||
log.info("GetToken regist spk , sql: {}", sql);
|
||||
}
|
||||
//封装参数到请求头
|
||||
heads.put("appid", appid);
|
||||
heads.put("secret", secret);
|
||||
//调用ECOLOGY系统接口进行注册
|
||||
String data2 = post(httpKey + ip + "/api/ec/dev/auth/applytoken", null, heads);
|
||||
String url = httpKey + ip + "/api/ec/dev/auth/applytoken";
|
||||
String data2 = post(url, null, heads);
|
||||
log.info("GetToken=====applytoken url {} ,heads {}, data: {}",url ,heads, data2);
|
||||
// 通过第一步注册许可时返回spk公钥对userid进行加密生成的密文
|
||||
sql= " SELECT conf_value FROM hrsa_salary_sys_conf t WHERE delete_type = 0 AND conf_key = 'SALARY_TOKEN_SPK'";
|
||||
rs.execute(sql);
|
||||
|
|
|
|||
Loading…
Reference in New Issue