seeyonExt重试插件
This commit is contained in:
parent
e7127e581e
commit
d33cff5e43
|
@ -0,0 +1,138 @@
|
|||
package com.hzya.frame.plugin.seeyonExt.plugin;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.base.PluginBaseEntity;
|
||||
import com.hzya.frame.seeyon.service.ISeeYonInterFace;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
||||
import com.hzya.frame.web.entity.BaseResult;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/5/15 08:34
|
||||
**/
|
||||
public class SeeyonExtPluginInitializer extends PluginBaseEntity {
|
||||
Logger logger = LoggerFactory.getLogger(SeeyonExtPluginInitializer.class);
|
||||
@Autowired
|
||||
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
||||
@Autowired
|
||||
private ISeeYonInterFace seeyInterFace;
|
||||
/***
|
||||
* 插件初始化方法
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2023-08-02 10:48
|
||||
* @Param []
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public void initialize() {
|
||||
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件销毁方法
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public void destroy() {
|
||||
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的ID
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return "SeeyonExtPlugin";
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的名称
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "seeyonExt插件";
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的显示值
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginLabel() {
|
||||
return "seeyonExt插件";
|
||||
}
|
||||
|
||||
/***
|
||||
* 插件类型 1、场景插件
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2023-08-02 14:01
|
||||
* @Param []
|
||||
* @return java.lang.String
|
||||
**/
|
||||
@Override
|
||||
public String getPluginType() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
/***
|
||||
* seeyonExt 重试专用插件
|
||||
* @Since 3.0
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2023-08-07 11:20
|
||||
* @param requestJson 执行业务代码的参数
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||
try {
|
||||
//重试方法
|
||||
if (null != requestJson){
|
||||
JSONObject jsonStr = requestJson.getJSONObject("jsonStr");
|
||||
//如果这个id不为空,说明是重试的
|
||||
String id = jsonStr.getString("integration_task_living_details_id");
|
||||
if (StrUtil.isNotEmpty(id)){
|
||||
//查询日志表
|
||||
IntegrationTaskLivingDetailsEntity taskDetailEntity = taskLivingDetailsService.get(id);
|
||||
if (null != taskDetailEntity && JSONUtil.isTypeJSON(taskDetailEntity.getRootAppPk())){
|
||||
//拿到这张表的源系统ID
|
||||
//调用seeyon标准重试方法
|
||||
JSONObject jsonObject = JSONObject.parseObject(taskDetailEntity.getRootAppPk());
|
||||
Map<String,String>extData = new HashMap<>();
|
||||
extData.put("integration_task_living_details_id",id);
|
||||
jsonObject.put("hzyaExtData",extData);
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("jsonStr", JSON.toJSONString(jsonObject));
|
||||
seeyInterFace.thirdInterfaceSeeYonDefinitionRePush(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.info("执行成功");
|
||||
return BaseResult.getSuccessMessageEntity("执行成功");
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return BaseResult.getSuccessMessageEntity("执行成功");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plugin>
|
||||
<id>SeeyonExtPlugin</id>
|
||||
<name>seeyonExt插件</name>
|
||||
<category>202405150001</category>
|
||||
</plugin>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean name="seeyonExtPluginInitializer" class="com.hzya.frame.plugin.seeyonExt.plugin.SeeyonExtPluginInitializer" />
|
||||
</beans>
|
|
@ -1,11 +1,16 @@
|
|||
package com.hzya.frame;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.plugin.seeyonExt.plugin.SeeyonExtPluginInitializer;
|
||||
import com.hzya.frame.util.AESUtil;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @ClassName dsasas
|
||||
* @Description
|
||||
|
@ -16,6 +21,21 @@ import org.springframework.test.context.junit4.SpringRunner;
|
|||
@SpringBootTest(classes = {WebappApplication.class})
|
||||
public class temButtom {
|
||||
|
||||
@Resource
|
||||
SeeyonExtPluginInitializer seeyonExtPluginInitializer;
|
||||
@Test
|
||||
public void seeyonExtTest(){
|
||||
JSONObject jsonStr = new JSONObject();
|
||||
jsonStr.put("integration_task_living_details_id","4276973516873482804");
|
||||
JSONObject requestJson = new JSONObject();
|
||||
requestJson.put("jsonStr", JSON.toJSONString(jsonStr));
|
||||
try {
|
||||
seeyonExtPluginInitializer.executeBusiness(requestJson);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test01() {
|
||||
String a = AESUtil.encrypt("hzya@1314");
|
||||
|
@ -26,4 +46,5 @@ public class temButtom {
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue