From f4b3f3a1b0895e4b53396129d455a4054bbec6fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Thu, 4 Dec 2025 14:38:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=94=E9=99=A2=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/util/SalaryTokenUtil.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/com/engine/salary/util/SalaryTokenUtil.java b/src/com/engine/salary/util/SalaryTokenUtil.java index 653a0a821..6d87a3ef5 100644 --- a/src/com/engine/salary/util/SalaryTokenUtil.java +++ b/src/com/engine/salary/util/SalaryTokenUtil.java @@ -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 { /** @@ -110,6 +112,7 @@ public class SalaryTokenUtil { } else { return resultMap; } + log.info("SalaryTokenUtil1 param appid{} uid{} " ,appid, uid); String sql= " SELECT conf_value FROM hrsa_salary_sys_conf t WHERE delete_type = 0 AND conf_key = 'SALARY_TOKEN_SECRET'"; rs.execute(sql); String secret = ""; @@ -126,8 +129,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 datas = JSONObject.parseObject(data, new TypeReference>() {}); + log.info("SalaryTokenUtil2 regist url{} heads{} datas{} ",url ,heads, datas); // ECOLOGY返回的系统公钥 String spk = (String) (datas.get("spk")); RSA rsa = new RSA(); @@ -137,17 +142,21 @@ public class SalaryTokenUtil { String date = SalaryDateUtil.getFormatLocalDateTime(LocalDateTime.now()); 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); + log.info("SalaryTokenUtil3 secretsql{} " ,sql); rs.execute(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); + log.info("SalaryTokenUtil4 spksql{} " ,sql); rs.execute(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("SalaryTokenUtil4 applytoken url{} heads{} data2{}" ,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); @@ -157,6 +166,7 @@ public class SalaryTokenUtil { RSA rsa = new RSA(); String encryptUid = rsa.encrypt(null, uid.toString(), null, "utf-8", spk, false); String token = (String)JSONObject.parseObject(data2, new TypeReference>() {}).get("token"); + log.info("SalaryTokenUtil5 encryptUid{} token{}" ,encryptUid,token); resultMap.put("userid", encryptUid); resultMap.put("token", token); resultMap.put("appid",appid);