Commit 57430022 authored by hongguangwu's avatar hongguangwu

MVP1.7.12-保存人员档案1

parent 2e828e73
package com.yifu.cloud.plus.v1.yifu.archives.config;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
/**
* @Author: hgw
* @Date: 2025-6-23 10:41:07
* @Description:
* @return: 瓜子配置
**/
@Configuration
@Data
@Slf4j
public class GzConfig {
@Value("${gz.appkey}")
private String appkey;
@Value("${gz.appsecret}")
private String appsecret;
@Value("${gz.tid}")
private String tid;
@Value("${gz.appUrl}")
private String appUrl;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.yifu.cloud.plus.v1.yifu.archives.config.GzConfig;
import com.yifu.cloud.plus.v1.yifu.archives.service.TGzOfferInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.utils.GZSign;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* 瓜子交互控制器
*
* @author hgw
* @date 2025-6-23 09:39:27
*/
@Log4j2
@RestController
@RequiredArgsConstructor
@RequestMapping("/gz/core")
@Tag(name = "瓜子交互控制器")
public class TGzController {
@Autowired
private GzConfig gzConfig;
private final TGzOfferInfoService tGzOfferInfoService;
/**
* 接收推送信息的接口
*
* @param params 包含业务参数和签名的Map
* @return 处理结果
*/
@PostMapping("/receive")
public R<String> receivePush(@RequestBody Map<String, Object> params) {
// 1. 验证签名
String receivedSignature = (String) params.get("signature");
if (receivedSignature == null) {
return R.failed("签名参数缺失");
}
// 2. 计算期望的签名
String expectedSignature = GZSign.getSignature(params, gzConfig.getAppsecret());
// 3. 比较签名是否一致
if (!receivedSignature.equals(expectedSignature)) {
return R.failed("签名验证失败");
}
// 4. 验证时间戳是否过期
String expiresStr = (String) params.get("expires");
if (expiresStr == null) {
return R.failed("过期时间参数缺失");
}
try {
long expires = Long.parseLong(expiresStr);
long currentTime = System.currentTimeMillis() / 1000;
if (currentTime > expires) {
return R.failed("请求已过期");
}
} catch (NumberFormatException e) {
return R.failed("过期时间格式错误");
}
// 5. 签名验证通过,处理业务逻辑
return processPushData(params);
}
/**
* 处理推送的业务数据
*
* @param params 业务参数
* @return 处理结果
*/
private R<String> processPushData(Map<String, Object> params) {
// 这里实现你的业务逻辑
// 例如:解析参数、保存数据、触发后续处理等
return R.ok();
}
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
/**
* 瓜子合同提取方法
*
* @author hgw
* @date 2025-6-23 11:13:24
*/
public interface TGzContractService {
/**
* 生成瓜子档案里的合同信息
* chenyx
*
* @param contractInfo 合同信息
* @param offerId offerId
* @param workLocation 工作地点
*/
void saveContractInfoToGzEmpInfo(TEmployeeContractInfo contractInfo, Integer offerId, String workLocation);
}
......@@ -18,6 +18,7 @@
package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TGzEmpInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......
......@@ -125,12 +125,5 @@ public interface TGzOfferInfoService extends IService<TGzOfferInfo> {
*/
R batchUpdateStatus(TGzOfferInfoVo tGzOfferInfo);
/**
* 生成瓜子档案里的合同信息
* @param contractInfo 合同信息
* @param offerId offerId
* @param workLocation 工作地点
*/
void saveContractInfoToGzEmpInfo(TEmployeeContractInfo contractInfo, Integer offerId, String workLocation);
}
......@@ -106,7 +106,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
private final LGuaziOfferRecordService lGuaziOfferRecordService;
private final TGzOfferInfoService gzOfferInfoService;
private final TGzContractService tGzContractService;
/**
* 员工合同信息表简单分页查询
......@@ -2246,7 +2246,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
// updStatus == 8:合同审核通过 生成瓜子档案里的合同信息
if(CommonConstants.EIGHT_STRING.equals(updStatus)){
gzOfferInfoService.saveContractInfoToGzEmpInfo(contractInfo, gzOfferInfo.getId(), gzOfferInfo.getWorkLocation());
tGzContractService.saveContractInfoToGzEmpInfo(contractInfo, gzOfferInfo.getId(), gzOfferInfo.getWorkLocation());
}
// 瓜子状态变更增加操作日志
......
......@@ -139,6 +139,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
private final LGuaziOfferRecordService lGuaziOfferRecordService;
private final TGzContractService tGzContractService;
@Autowired
private OSSUtil ossUtil;
......@@ -146,8 +148,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
private final TGzOfferInfoMapper gzOfferInfoMapper;
private final TGzOfferInfoService gzOfferInfoService;
@Override
public IPage<TEmployeeInfo> getPage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo) {
return baseMapper.getPage(page, employeeInfo);
......@@ -2634,7 +2634,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
gzOfferInfoMapper.updateById(gzOfferInfo);
// 合同审核通过 生成瓜子档案里的合同信息
gzOfferInfoService.saveContractInfoToGzEmpInfo(c, gzOfferInfo.getId(), gzOfferInfo.getWorkLocation());
tGzContractService.saveContractInfoToGzEmpInfo(c, gzOfferInfo.getId(), gzOfferInfo.getWorkLocation());
// 瓜子状态变更增加操作日志
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TGzEmpInfo;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TGzEmpInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TGzContractService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;
/**
* 瓜子合同提取方法
*
* @author hgw
* @date 2025-6-23 11:15:28
*/
@Log4j2
@Service
@RequiredArgsConstructor
public class TGzContractServiceImpl implements TGzContractService {
private final TGzEmpInfoMapper tGzEmpInfoMapper;
/**
* 生成瓜子档案里的合同信息
* chenyx
*
* @param contractInfo 合同信息
* @param offerId offerId
* @param workLocation 工作地点
*/
@Override
public void saveContractInfoToGzEmpInfo(TEmployeeContractInfo contractInfo, Integer offerId, String workLocation) {
// 获取档案信息
TGzEmpInfo gzEmpInfo = tGzEmpInfoMapper.getInfoByOfferId(offerId);
if (Common.isNotNull(gzEmpInfo)) {
gzEmpInfo.setContractNum(contractInfo.getContractName());
// 客服申请处选择“标准合同”传“外签-劳动合同 ”;“实习协议”传“外签-实习协议 ”
if (CommonConstants.ONE_STRING.equals(contractInfo.getContractType())) {
gzEmpInfo.setContractType("1E");
}
if (CommonConstants.FIVE_STRING.equals(contractInfo.getContractType())) {
gzEmpInfo.setContractType("1F");
}
gzEmpInfo.setSginatureMethod("E");
gzEmpInfo.setSginatureType("01");
gzEmpInfo.setSginatureDt(contractInfo.getContractStart());
gzEmpInfo.setContractBeginDt(contractInfo.getContractStart());
gzEmpInfo.setContractExpEndDt(contractInfo.getContractEnd());
gzEmpInfo.setContractEndDt(contractInfo.getContractEnd());
// 合同申请处选择“无”传给瓜子为“0”;合同申请选择“六个月”,传给瓜子为“6”
if ("无".equals(contractInfo.getTryPeriod())) {
gzEmpInfo.setProbation(CommonConstants.ZERO_STRING);
}
if ("六个月".equals(contractInfo.getTryPeriod())) {
gzEmpInfo.setProbation(CommonConstants.SIX_STRING);
// 按照“合同起始日期”及“试用周期”进行推测
// 合同起始日期为20250603,试用期为6,试用期预计结束日期为20251202
// 将Date转换为LocalDate
LocalDate localDate = contractInfo.getContractStart().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate prcExpLocalDate = localDate.plusMonths(6); // 加上6个月
// 将LocalDate转换回Date对象
Date prcExpDt = Date.from(prcExpLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
// 试用期预计结束日期
gzEmpInfo.setPrcExpDt(prcExpDt);
// 默认等于试用期预计结束日期+1日(自然日),eg:”试用期预计结束日期“为20251202,”预计转正日期“为20251203“
LocalDate probationDtLocalDate = prcExpLocalDate.plusDays(1); // 加上+1日(自然日)
// 将LocalDate转换回Date对象
Date probationDt = Date.from(probationDtLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
// 预计转正日期
gzEmpInfo.setProbationDt(probationDt);
}
gzEmpInfo.setNeeProviderId(CommonConstants.GZ_NEE_PROVIDER_ID);
gzEmpInfo.setWorkLocation(workLocation);
gzEmpInfo.setContractState("A");
// 存合同信息
tGzEmpInfoMapper.updateById(gzEmpInfo);
}
}
}
......@@ -56,7 +56,9 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URL;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
/**
......
......@@ -38,10 +38,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TRegisteWarningEmployee;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.EmployeeRegistrationPreMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TGzOfferInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.LGuaziOfferRecordService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TGzEmpInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TGzOfferInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TRegisteWarningEmployeeService;
import com.yifu.cloud.plus.v1.yifu.archives.service.*;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
......@@ -88,6 +85,8 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
private final LGuaziOfferRecordService lGuaziOfferRecordService;
private final TEmployeeContractInfoMapper employeeContractInfoMapper;
// 瓜子合同信息提取方法————因为循环调用了
private final TGzContractService tGzContractService;
@Autowired
private UpmsDaprUtils upmsDaprUtils;
......@@ -323,14 +322,14 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
if(CommonConstants.ZERO_STRING.equals(contractInfo.getIsFile())
&& CommonConstants.ZERO_STRING.equals(contractInfo.getInUse())){
// 生成瓜子档案里的合同信息
this.saveContractInfoToGzEmpInfo(contractInfo, offerId, workLocation);
tGzContractService.saveContractInfoToGzEmpInfo(contractInfo, offerId, workLocation);
return "99";
}
// 合同审核通过
if(CommonConstants.TWO_INTEGER.equals(contractInfo.getAuditStatus())
&& CommonConstants.ZERO_STRING.equals(contractInfo.getInUse())){
// 生成瓜子档案里的合同信息
this.saveContractInfoToGzEmpInfo(contractInfo, offerId, workLocation);
tGzContractService.saveContractInfoToGzEmpInfo(contractInfo, offerId, workLocation);
return CommonConstants.EIGHT_STRING;
}
// 合同已提交待审核
......@@ -342,68 +341,6 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
return changeStatus;
}
/**
* 生成瓜子档案里的合同信息
* @param contractInfo 合同信息
* @param offerId offerId
* @param workLocation 工作地点
*/
@Override
public void saveContractInfoToGzEmpInfo(TEmployeeContractInfo contractInfo, Integer offerId, String workLocation){
// 获取档案信息
TGzEmpInfo gzEmpInfo = tGzEmpInfoService.getOne(Wrappers.<TGzEmpInfo>query().lambda()
.eq(TGzEmpInfo::getOfferId, offerId)
.eq(TGzEmpInfo::getDelFlag, CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if(Common.isNotNull(gzEmpInfo)){
gzEmpInfo.setContractNum(contractInfo.getContractName());
// 客服申请处选择“标准合同”传“外签-劳动合同 ”;“实习协议”传“外签-实习协议 ”
if(CommonConstants.ONE_STRING.equals(contractInfo.getContractType())){
gzEmpInfo.setContractType("1E");
}
if(CommonConstants.FIVE_STRING.equals(contractInfo.getContractType())){
gzEmpInfo.setContractType("1F");
}
gzEmpInfo.setSginatureMethod("E");
gzEmpInfo.setSginatureType("01");
gzEmpInfo.setSginatureDt(contractInfo.getContractStart());
gzEmpInfo.setContractBeginDt(contractInfo.getContractStart());
gzEmpInfo.setContractExpEndDt(contractInfo.getContractEnd());
gzEmpInfo.setContractEndDt(contractInfo.getContractEnd());
// 合同申请处选择“无”传给瓜子为“0”;合同申请选择“六个月”,传给瓜子为“6”
if("无".equals(contractInfo.getTryPeriod())){
gzEmpInfo.setProbation(CommonConstants.ZERO_STRING);
}
if("六个月".equals(contractInfo.getTryPeriod())){
gzEmpInfo.setProbation(CommonConstants.SIX_STRING);
// 按照“合同起始日期”及“试用周期”进行推测
// 合同起始日期为20250603,试用期为6,试用期预计结束日期为20251202
// 将Date转换为LocalDate
LocalDate localDate = contractInfo.getContractStart().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate prcExpLocalDate = localDate.plusMonths(6); // 加上6个月
// 将LocalDate转换回Date对象
Date prcExpDt = Date.from(prcExpLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
// 试用期预计结束日期
gzEmpInfo.setPrcExpDt(prcExpDt);
// 默认等于试用期预计结束日期+1日(自然日),eg:”试用期预计结束日期“为20251202,”预计转正日期“为20251203“
LocalDate probationDtLocalDate = prcExpLocalDate.plusDays(1); // 加上+1日(自然日)
// 将LocalDate转换回Date对象
Date probationDt = Date.from(probationDtLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
// 预计转正日期
gzEmpInfo.setProbationDt(probationDt);
}
gzEmpInfo.setNeeProviderId(CommonConstants.GZ_NEE_PROVIDER_ID);
gzEmpInfo.setWorkLocation(workLocation);
gzEmpInfo.setContractState("A");
// 存合同信息
tGzEmpInfoService.updateById(gzEmpInfo);
}
}
/**
* 获取当前状态下,允许更新的状态列表
*
......
package com.yifu.cloud.plus.v1.yifu.archives.utils;
import org.apache.commons.codec.binary.Base64;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.*;
/**
* @ClassName: GZSign 签名工具类 主要提供加签、验签、hash编码等功能
* ———— 瓜子提供的签名工具类
* @date 2018年3月21日 下午4:38:40
*/
public class GZSign {
private static final String STRING = "abcdefghijklmnopqrstuvwxyz";
private static final String APP_KEY = "appkey";
private static final String EXPIRES = "expires";
private static final String NONCE = "nonce";
private static final String SIGNATURE = "signature";
/**
* 生成签名并且将签名加到参数表中
*
* @param params 业务参数列表信息
* @param appKey
* @param appSecret
* @return
*/
public static Map<String, Object> addSignature(Map<String, Object> params, String appKey, String appSecret) {
String sign = generateSignature(params, appKey, appSecret);
params.put(SIGNATURE, sign);
return params;
}
/**
* 通过参数列表获取对应的签名值,验签时使用
*
* @param params 请求方传递过来的所有参数列表信息
* @return
*/
public static String getSignature(Map<String, Object> params, String appSecret) {
if (params == null || params.size() == 0) {
return null;
}
Map<String, Object> needParam = getNeedParam(params);
String sortedParams = getEncodeString(needParam);
return generateSignature(sortedParams, appSecret);
}
/**
* yangyuanzhu 替换掉了* 为%2A
*
* @param params
* @param appSecret
* @return
*/
public static String getSignatureReplaceStar(Map<String, Object> params, String appSecret) {
if (params == null || params.size() == 0) {
return null;
}
Map<String, Object> needParam = getNeedParam(params);
String sortedParams = getEncodeString(needParam);
sortedParams = sortedParams.replaceAll("\\*", "%2A");//给星号转成%2A
return generateSignature(sortedParams, appSecret);
}
/**
* yangyuanzhu 替换掉了空格 为%2A
*
* @param params
* @param appSecret
* @return
*/
public static String getSignatureReplaceSpace(Map<String, Object> params, String appSecret) {
if (params == null || params.size() == 0) {
return null;
}
Map<String, Object> needParam = getNeedParam(params);
String sortedParams = getEncodeString(needParam);
sortedParams = sortedParams.replaceAll("\\+", "%20");//空格转成%2A
return generateSignature(sortedParams, appSecret);
}
/**
* 根据参数计算签名值
*
* @param params
* @return
*/
private static String generateSignature(Map<String, Object> params, String appKey, String appSecret) {
if (params == null || params.size() == 0) {
return null;
}
params.put(APP_KEY, appKey);
params.put(EXPIRES, getCurrentSecond());
params.put(NONCE, generateRandomStr(6));
String sortedParams = getEncodeString(params);
return generateSignature(sortedParams, appSecret);
}
/**
* 去掉param里面计算签名时不需要的参数
*
* @param param
* @return
*/
private static Map<String, Object> getNeedParam(Map<String, Object> param) {
Map<String, Object> result = new HashMap<>();
for (Map.Entry<String, Object> entry : param.entrySet()) {
if (!SIGNATURE.equals(entry.getKey())) {
result.put(entry.getKey(), entry.getValue());
}
}
return result;
}
/**
* sha256取hash Base64编码
*
* @param params
* @param secret
* @return
*/
private static String sha256HMACEncode(String params, String secret) {
String result = "";
try {
Mac sha256HMAC = Mac.getInstance("HmacSHA256");
SecretKeySpec secretKey = new SecretKeySpec(secret.getBytes(), "HmacSHA256");
sha256HMAC.init(secretKey);
byte[] sha256HMACBytes = sha256HMAC.doFinal(params.getBytes());
String hash = Base64.encodeBase64String(sha256HMACBytes);
return hash;
} catch (Exception e) {
}
return result;
}
/**
* 生成签名 取5-15共10位返回
*
* @param params
* @param appSecret
* @return
*/
private static String generateSignature(String params, String appSecret) {
String result = md5(sha256HMACEncode(params, appSecret)).substring(5, 15);
return result;
}
private static String md5(String value) {
try {
MessageDigest md = MessageDigest.getInstance("md5");
byte[] e = md.digest(value.getBytes());
return byteToHexString(e);
} catch (NoSuchAlgorithmException e) {
}
return null;
}
private static String byteToHexString(byte[] salt) {
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < salt.length; i++) {
String hex = Integer.toHexString(salt[i] & 0xFF);
if (hex.length() == 1) {
hex = '0' + hex;
}
hexString.append(hex.toLowerCase());
}
return hexString.toString();
}
// 通过参数集合map 组装成需要签名的字符串id=123&name=456
private static String getEncodeString(Map<String, Object> params) {
if (params == null || params.size() == 0) {
return "";
}
Iterator<String> it = params.keySet().iterator();
ArrayList<String> al = new ArrayList<String>();
while (it.hasNext()) {
al.add(it.next());
}
// 字母升序排列
Collections.sort(al);
StringBuffer sb = new StringBuffer();
for (int i = 0; i < al.size(); i++) {
try {
String key = al.get(i);
sb.append(URLEncoder.encode(key == null ? "" : key.toString(), "UTF-8"));
sb.append("=");
String item = null;
Object value = params.get(key);
item = URLEncoder.encode(value == null ? "" : value.toString(), "UTF-8");
sb.append(item);
} catch (UnsupportedEncodingException e) {
} catch (NullPointerException e) {
}
sb.append("&");
}
String result = sb.toString();
return result.substring(0, result.length() - 1);
}
// 获取len个随机字符串
public static String generateRandomStr(int len) {
StringBuffer sb = new StringBuffer();
int count = len <= STRING.length() ? len : STRING.length();
Random random = new Random();
for (int i = 0; i < count; i++) {
sb.append(STRING.charAt(random.nextInt(STRING.length() - 1)));
}
return sb.toString();
}
// 获取当前时间秒数+60S
public static String getCurrentSecond() {
return (System.currentTimeMillis() / 1000 + 60) + "";
}
// 参数map转化成get接口参数格式
public static String map2GetString(Map<String, Object> map) {
if (map == null || map.size() < 1) {
return "";
}
StringBuilder params = new StringBuilder();
for (Map.Entry<String, Object> entry : map.entrySet()) {
params.append(entry.getKey()).append("=");
if (entry.getValue() != null) {
params.append(entry.getValue());
}
params.append("&");
}
params.deleteCharAt(params.lastIndexOf("&"));
return params.toString();
}
}
......@@ -38,4 +38,11 @@ wx:
authUrl: https://test-wx.worfu.com/yifu-auth/method/oauth/wxLogin
domainName: https://test-wx.worfu.com
#瓜子配置
gz:
appkey: hr_eny00002_test
appsecret: hr_eny00002_test_20250620
tid: c2da1d84e9bd4a30b6be5ecd209096fb
appUrl: https://eim-busin-api-test-jwtys.guazi.com
......@@ -34,6 +34,12 @@ wx:
authUrl: https://wx.worfu.com/yifu-auth/method/oauth/wxLogin
domainName: https://wx.worfu.com
#瓜子配置
gz:
appkey: hr_eny00002_test
appsecret: hr_eny00002_test_20250620
tid: c2da1d84e9bd4a30b6be5ecd209096fb
appUrl: https://eim-busin-api-test-jwtys.guazi.com
......@@ -54,4 +54,11 @@ wx:
corpsecret: 16kqEL_eU-ARwYyqLgEBWHgxm8gXVnkzv_eJMLy9NpU
agentid: 1000010
authUrl: https://test-wx.worfu.com/yifu-auth/method/oauth/wxLogin
domainName: https://test-wx.worfu.com
\ No newline at end of file
domainName: https://test-wx.worfu.com
#瓜子配置
gz:
appkey: hr_eny00002_test
appsecret: hr_eny00002_test_20250620
tid: c2da1d84e9bd4a30b6be5ecd209096fb
appUrl: https://eim-busin-api-test-jwtys.guazi.com
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment