薪酬token加解密
This commit is contained in:
parent
dbb332e07f
commit
5953c2b938
|
|
@ -249,9 +249,9 @@ public class SalaryBillBO {
|
|||
String title = billTitle; // 标题
|
||||
String context = "点击查看详情"; // 内容
|
||||
// PC端链接
|
||||
String linkUrl = weaver.general.GCONST.getContextPath() + "/spa/hrmSalary/static/index.html#/main/hrmSalary/mobilepayroll?id=" + id + "&recipient=" + AESEncryptUtil.encrypt4SalaryBill(employeeId.toString());
|
||||
String linkUrl = weaver.general.GCONST.getContextPath() + "/spa/hrmSalary/static/index.html#/main/hrmSalary/mobilepayroll?id=" + id + "&salaryCode=" + AESEncryptUtil.encrypt4SalaryBill(employeeId.toString());
|
||||
// 移动端链接
|
||||
String linkMobileUrl = weaver.general.GCONST.getContextPath() + "/spa/hrmSalary/static/index.html#/main/hrmSalary/mobilepayroll?type=phone&id=" + id + "&recipient=" + AESEncryptUtil.encrypt4SalaryBill(employeeId.toString());
|
||||
String linkMobileUrl = weaver.general.GCONST.getContextPath() + "/spa/hrmSalary/static/index.html#/main/hrmSalary/mobilepayroll?type=phone&id=" + id + "&salaryCode=" + AESEncryptUtil.encrypt4SalaryBill(employeeId.toString());
|
||||
try {
|
||||
MessageBean messageBean = Util_Message.createMessage(messageType, userIdList, title, context, linkUrl, linkMobileUrl);
|
||||
messageBean.setCreater(Integer.parseInt(salaryBillSendParam.getSendUser().getUID() + ""));// 创建人id
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package com.engine.salary.entity.salaryBill.param;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @ClassName SalaryBillGetTokenParam
|
||||
* @author Harryxzy
|
||||
* @date 2024/11/6 9:59
|
||||
* @description 第三方获取token参数
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SalaryBillGetTokenParam {
|
||||
|
||||
// 新
|
||||
private String salaryCode;
|
||||
|
||||
// 老 未加密
|
||||
private String recipient;
|
||||
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package com.engine.salary.util;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
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 org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -77,8 +78,13 @@ public class SalaryTokenUtil {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, String> GetToken(String uid) {
|
||||
uid = AESEncryptUtil.decrypt4SalaryBill(uid);
|
||||
public static Map<String, String> GetToken(SalaryBillGetTokenParam param) {
|
||||
String uid = "";
|
||||
if (StringUtils.isNotBlank(param.getSalaryCode())) {
|
||||
uid = AESEncryptUtil.decrypt4SalaryBill(param.getSalaryCode());
|
||||
} else {
|
||||
uid = param.getRecipient();
|
||||
}
|
||||
Map<String, String> heads = new HashMap<>();
|
||||
if (StringUtils.isBlank(uid)) {
|
||||
return heads;
|
||||
|
|
@ -101,10 +107,12 @@ public class SalaryTokenUtil {
|
|||
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 = "";
|
||||
if (rs.next() && StringUtils.isNotEmpty(rs.getString("conf_value"))) {
|
||||
if (rs.next() && StringUtils.isNotBlank(rs.getString("conf_value"))) {
|
||||
// 从数据库中拿secret
|
||||
secret = rs.getString("conf_value");
|
||||
} else {
|
||||
sql= " update hrsa_salary_sys_conf set delete_type=1 WHERE delete_type = 0 AND conf_key in( 'SALARY_TOKEN_SECRET', 'SALARY_TOKEN_SPK')";
|
||||
rs.execute(sql);
|
||||
// 注册获取secret
|
||||
// 获取当前异构系统RSA加密的公钥
|
||||
String cpk = new RSA().getRSA_PUB();
|
||||
|
|
|
|||
|
|
@ -642,12 +642,12 @@ public class SalaryBillController {
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@POST
|
||||
@Path("/getToken")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getToken(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "uid") String uid) {
|
||||
public String getToken(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryBillGetTokenParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<String, Map<String, String>>(user).run(getSalarySendWrapper(user)::getToken, uid);
|
||||
return new ResponseResult<SalaryBillGetTokenParam, Map<String, String>>(user).run(getSalarySendWrapper(user)::getToken, param);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -744,8 +744,8 @@ public class SalarySendWrapper extends Service implements SalarySendWrapperProxy
|
|||
return getSalaryBillService(user).exportPdf(param);
|
||||
}
|
||||
|
||||
public Map<String, String> getToken(String uid) {
|
||||
return SalaryTokenUtil.GetToken( uid);
|
||||
public Map<String, String> getToken(SalaryBillGetTokenParam param) {
|
||||
return SalaryTokenUtil.GetToken(param);
|
||||
}
|
||||
|
||||
public String genPdfBeforeExport(SalaryExportPdfParam salaryExportPdfParam) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue