Commit 5889223c authored by hongguangwu's avatar hongguangwu

MVP1.6.3-HCM HCM的出差接口

parent 58dd59d5
......@@ -170,6 +170,8 @@ public interface CacheConstants {
// 项目报销token的key
String WX_REIMBURSEMENT_TOKEN = "WX_REIMBURSEMENT_TOKEN";
// HCM出差的sign
String HCM_CHU_CHAI_SIGN = "HCM_CHU_CHAI_SIGN";
public static final String WX_ACCOSS_TOKEN = "WX_ACCOSS_TOKEN";
......
......@@ -52,4 +52,19 @@ public class EkpPermissionTask {
log.info("-------------获取企业微信出差数据-定时任务结束------------");
}
/**
* @return
* @Author hgw
* @Description 每天1点,定时同步HCM审批出差数据
* @Date 2024-4-29 15:59:31
* @Param
**/
public void doSaveHcmChuChai() throws Exception {
log.info("-------------获取HCM出差数据-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprEkpPermissionProperties.getAppUrl(), daprEkpPermissionProperties.getAppId(),
"/qiWei/inner/everyDaySaveHcmChuChai", "", Object.class,
SecurityConstants.FROM_IN);
log.info("-------------获取HCM出差数据-定时任务结束------------");
}
}
\ No newline at end of file
......@@ -78,4 +78,8 @@ public class EkpQiwiChuchai {
@Schema(description = "创建时间")
private LocalDateTime createTime;
// 企微、HCM
@Schema(description = "数据源")
private String fdDataSource;
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Hex;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
......@@ -21,6 +22,8 @@ import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.web.client.RestTemplate;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.Map;
import java.util.concurrent.TimeUnit;
......@@ -47,12 +50,54 @@ public class WxConfig {
@Value("${wx.authUrl}")
private String authUrl;
// 获取HCM相关信息
@Value("${hcm.appId}")
private String hcmAppId;
@Value("${hcm.appSecret}")
private String hcmAppSecret;
@Value("${hcm.appUrl}")
private String hcmAppUrl;
@Autowired
private RedisTemplate redisTemplate;
//未授权
private String accossTokenInvliad = "40014";
/**
* @Description: 获取HCM出差的sign
* @Author: hgw
* @Date: 2024-4-29 15:34:54
* @return: java.lang.String
**/
public String getHcmSign() {
String sign = null;
Object wxToken = redisTemplate.opsForValue().get(CacheConstants.HCM_CHU_CHAI_SIGN);
if (null != wxToken) {
return String.valueOf(wxToken);
}
try {
byte[] a = (hcmAppId + hcmAppSecret).getBytes(StandardCharsets.UTF_8);
sign = Hex.encodeHexString(MessageDigest.getInstance("SHA-256").digest(a));
} catch (Exception e) {
e.printStackTrace();
log.error("2拉取HCM出差数据sign出错=" + e.getMessage());
}
redisTemplate.opsForValue().set(CacheConstants.HCM_CHU_CHAI_SIGN, sign);
redisTemplate.expire(CacheConstants.HCM_CHU_CHAI_SIGN, 3600, TimeUnit.SECONDS);
return sign;
}
/**
* @Description: 获取HCM出差的url
* @Author: hgw
* @Date: 2024-4-29 15:34:54
* @return: java.lang.String
**/
public String getHcmChuChaiUrl() {
return hcmAppUrl;
}
/**
* @param restTemplate
* @Description: 获取项目报销的token
......
......@@ -38,7 +38,7 @@ public class QiWeiController {
public R<List<EkpQiwiChuchai>> everyDaySaveQiWeiChuChai() {
String startDay = DateUtil.addDay(-29);
String endDay = DateUtil.addDay(0);
return wxSalaryService.getQiWeiChuChaiAndSave(startDay, endDay);
return wxSalaryService.getQiWeiChuChaiAndSave(startDay, endDay, 1);
}
/**
......@@ -53,7 +53,36 @@ public class QiWeiController {
@PostMapping("/getQiWeiChuCHaiInfoAndSave")
//@PreAuthorize("@pms.hasPermission('wxhr:wxsalaryauth')")
public R<List<EkpQiwiChuchai>> getQiWeiChuCHaiInfoAndSave(@RequestParam String startTime, @RequestParam String endTime) {
return wxSalaryService.getQiWeiChuChaiAndSave(startTime, endTime);
return wxSalaryService.getQiWeiChuChaiAndSave(startTime, endTime, 1);
}
/**
* @Description: 每日获取当日HCM的E人事审批里的出差
* @Author: hgw
* @Date: 2024-4-28 16:51:16
* @return: com.yifu.cloud.v1.common.core.util.R<java.util.List < com.yifu.cloud.v1.hrms.api.entity.TEventFeeDetail>>
**/
@PostMapping("/inner/everyDaySaveHcmChuChai")
@Inner
public R<List<EkpQiwiChuchai>> everyDaySaveHcmChuChai() {
String startDay = DateUtil.addDay(-1);
String endDay = DateUtil.addDay(0);
return wxSalaryService.getQiWeiChuChaiAndSave(startDay, endDay, 2);
}
/**
* @param startTime
* @param endTime
* @Description: 获取HCM的E人事审批里的出差
* @Author: hgw
* @Date: 2024-4-28 16:51:39
* @return: com.yifu.cloud.v1.common.core.util.R<java.util.List < com.yifu.cloud.v1.hrms.api.entity.TStatisticsProjectReimburse>>
**/
@Operation(description = "获取HCM的E人事审批里的出差:startTime格式:2024-04-10")
@PostMapping("/getHcmChuChaiInfoAndSave")
//@PreAuthorize("@pms.hasPermission('wxhr:wxsalaryauth')")
public R<List<EkpQiwiChuchai>> getHcmChuChaiInfoAndSave(@RequestParam String startTime, @RequestParam String endTime) {
return wxSalaryService.getQiWeiChuChaiAndSave(startTime, endTime, 2);
}
}
......@@ -17,11 +17,12 @@ public interface QiWeiService extends IService<EkpQiwiChuchai> {
/**
* @param startTime
* @param endTime
* @param type 1:企业微信;2:HCM的E人事
* @Description: 获取微信信息
* @Author: hgw
* @Date: 2021-7-28 17:46:01
* @return: com.yifu.cloud.v1.common.core.util.R<java.util.List < com.yifu.cloud.v1.hrms.api.entity.TStatisticsProjectReimburse>>
**/
R<List<EkpQiwiChuchai>> getQiWeiChuChaiAndSave(String startTime, String endTime);
R<List<EkpQiwiChuchai>> getQiWeiChuChaiAndSave(String startTime, String endTime, int type);
}
......@@ -26,3 +26,7 @@ spring:
maximum-pool-size: 12 # 连接池最大连接数,默认是10
auto-commit: true #此属性控制从池返回的连接的默认自动提交行为,默认值:true
max-lifetime: 0 #此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
hcm:
appId: 627673F79C6BAB92
appSecret: EA2641EF627673F79C6BAB9280137F00
appUrl: https://qas-hcm.yfzxtech.com:28950/api/v1/instance/business/list?startTime={startTime}&endTime={endTime}
\ No newline at end of file
......@@ -26,3 +26,7 @@ spring:
maximum-pool-size: 12 # 连接池最大连接数,默认是10
auto-commit: true #此属性控制从池返回的连接的默认自动提交行为,默认值:true
max-lifetime: 0 #此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
hcm:
appId: b2475bbd0a7ef3f3
appSecret: C800A676B2475BBD0A7EF3F3C4265582
appUrl: https://119.96.166.49:28950/api/v1/instance/business/list?startTime={startTime}&endTime={endTime}
\ No newline at end of file
......@@ -26,3 +26,7 @@ spring:
maximum-pool-size: 12 # 连接池最大连接数,默认是10
auto-commit: true #此属性控制从池返回的连接的默认自动提交行为,默认值:true
max-lifetime: 0 #此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认1800000即30分钟
hcm:
appId: 627673F79C6BAB92
appSecret: EA2641EF627673F79C6BAB9280137F00
appUrl: https://qas-hcm.yfzxtech.com:28950/api/v1/instance/business/list?startTime={startTime}&endTime={endTime}
\ No newline at end of file
......@@ -24,6 +24,7 @@
<result property="fdStatus" column="FD_STATUS"/>
<result property="fdSettleFormId" column="FD_SETTLE_FORM_ID"/>
<result property="createTime" column="create_time"/>
<result property="fdDataSource" column="FD_DATA_SOURCE"/>
</resultMap>
<sql id="Base_Column_List">
......@@ -45,7 +46,8 @@
a.FD_REN_SHU,
a.FD_STATUS,
a.FD_SETTLE_FORM_ID,
a.create_time
a.create_time,
a.FD_DATA_SOURCE
</sql>
<!--获取全部的,用来: 拉取企业微信时,不覆盖数据 -->
<select id="getAllInfo" resultMap="BaseResultMap">
......
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