|
|
@ -1,10 +1,19 @@ |
|
|
|
package com.epmet.redis; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.redis.RedisKeys; |
|
|
|
import com.epmet.commons.tools.redis.RedisUtils; |
|
|
|
import com.epmet.dao.OpenSyncBizDataDao; |
|
|
|
import com.epmet.dto.OpenSyncBizDataDTO; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author zxc |
|
|
|
* @DateTime 2022/9/14 10:32 |
|
|
@ -14,6 +23,8 @@ import org.springframework.stereotype.Component; |
|
|
|
public class DingDingCallbackRedis { |
|
|
|
@Autowired |
|
|
|
private RedisUtils redisUtils; |
|
|
|
@Autowired |
|
|
|
private OpenSyncBizDataDao openSyncBizDataDao; |
|
|
|
|
|
|
|
public void set(String suiteKey,String suiteTicket){ |
|
|
|
String key = RedisKeys.getSuiteTicketKey(suiteKey); |
|
|
@ -21,6 +32,15 @@ public class DingDingCallbackRedis { |
|
|
|
} |
|
|
|
|
|
|
|
public String get(String suiteKey){ |
|
|
|
return redisUtils.getString(RedisKeys.getSuiteTicketKey(suiteKey)); |
|
|
|
String ticket = redisUtils.getString(RedisKeys.getSuiteTicketKey(suiteKey)); |
|
|
|
if (StringUtils.isNotBlank(ticket)){ |
|
|
|
return ticket; |
|
|
|
} |
|
|
|
List<OpenSyncBizDataDTO> openSyncData = openSyncBizDataDao.getOpenSyncData(suiteKey, NumConstant.TWO_STR, null); |
|
|
|
if (null == openSyncData){ |
|
|
|
throw new EpmetException("未查询到"+suiteKey+"的ticket"); |
|
|
|
} |
|
|
|
Map map = JSON.parseObject(openSyncData.get(NumConstant.ZERO).getBizData(), Map.class); |
|
|
|
return map.get("suiteTicket").toString(); |
|
|
|
} |
|
|
|
} |
|
|
|