Merge pull request 'yingdesai' (#31) from yingdesai into dev

Reviewed-on: http://192.168.2.237:3000/root/kangarooDataCenterV3/pulls/31
This commit is contained in:
xiaoguo001 2024-05-16 14:32:12 +08:00
commit 945ddc0ea8
11 changed files with 451 additions and 3442 deletions

View File

@ -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("执行成功");
}
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<id>SeeyonExtPlugin</id>
<name>seeyonExt插件</name>
<category>202405150001</category>
</plugin>

View File

@ -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>

View File

@ -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 {
}

View File

@ -30,15 +30,7 @@ public interface ISeeYonInterFace {
**/
JsonResultEntity thirdInterfaceSend(JSONObject requestData);
/***
* @Content:通过类型获取OA数据1
* @Author 👻👻👻👻yqh👻👻👻👻
* @Date2023年8月30日10:20:17seeYonPlugInInterfaceEntrance
* @Param requestData
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
JsonResultEntity thirdInterfacegetOADataByType(JSONObject requestData);
/***
* @Content: 提供给OA的标准接口方法包含参数 entity 为OA 的data信息 , eventType 为事件类型
@ -62,75 +54,6 @@ public interface ISeeYonInterFace {
* @return string
**/
JsonResultEntity thirdInterfaceSeeYonPlugInInterfaceEntrance(JSONObject requestData);
// String seeYonPlugInInterfaceEntrance(OAWorkflowEventDataEntity entity,String eventType);
/***
* @Content:通过附件关系获取fileurl
* @Author 👻👻👻👻yqh👻👻👻👻
* @Date 2023年9月4日13:03:35
* @Param requestData
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
/****
* 客户服务器无法外网连接数据库临时使用初始化方法
* @content:
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-09-05 8:43
* @param
* @return com.hzya.frame.web.entity.JsonResultEntity
**/
JsonResultEntity thirdInterfaceInitBipSupplierToOa(JSONObject jsonObject) throws Exception;
List<SeeyonEntity> getFileUrl(String sub_reference);
/***
*
* @content:推送无流程表单同步钉钉
* @author 👻👻👻👻👻👻👻👻 yuqh
* @date 2023年9月2日12:56:18
* @param
* @return void
**/
JsonResultEntity sendConDocTodd(JSONObject requestJson);
/***
*
* @content:流程表单传递钉钉
* @author 👻👻👻👻👻👻👻👻 yuqh
* @date 2023年9月5日09:38:38
* @param
* @return void
**/
JsonResultEntity sendProcessDocument(JSONObject requestJson);
/**
*
* @content 杭泰OA付款单传递CFS
* @Param
* @Return
* @Author hecan
* @Date 2023/10/12 15:50
* **/
String sendpayMentToCFS(Map<String, Object> businessData);
/**
*
* @content 杭泰OA报销单传递CFS
* @Param
* @Return
* @Author hecan
* @Date 2023/10/16 15:26
* **/
String sendBusinessExpenseToCFS(Map<String,Object> map,String formApp);
/**
*
* @content 杭泰OA资金归集资金拨付同名账户划转借款单传递CFS
* @Param
* @Return
* @Author hecan
* @Date 2023/12/20 10:04
* **/
String sendOtherFourReceipt(Map<String,Object> map,String formApp);
/***
@ -141,5 +64,5 @@ public interface ISeeYonInterFace {
*/
JsonResultEntity thirdInterfaceSeeYonDefinitionRePush(JSONObject jsonObject) throws Exception;
void setCfslogService(ICfsLogService cfsLogService);
}

View File

@ -0,0 +1,29 @@
package com.hzya.frame.seeyon.service;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
import com.hzya.frame.sysnew.messageManageLog.entity.SysMessageManageLogEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
/**
* @Description seeyon扩展类
* @Author xiangerlin
* @Date 2024/5/14 14:04
**/
public interface ISeeyonExtService {
/**
* @Since 3.0
* 英德赛 OA档案传U8
* 根据不同formApp来调U8不同接口
* @param entity
* @return
*/
SysExtensionApiEntity ydcSeeyon2u8(SysExtensionApiEntity entity);
/**
* @Since 3.0
* 回调方法
* @param logEntity
*/
void ydcSeeyon2u8CallBack(SysMessageManageLogEntity logEntity);
}

View File

@ -25,10 +25,6 @@ public class CfsLogServiceImpl implements ICfsLogService {
@Autowired
protected ISeeYonInterFace seeYonInterFace;
@PostConstruct
public void init() {
seeYonInterFace.setCfslogService(this);
}
/**
* 保存日志
*
@ -37,71 +33,6 @@ public class CfsLogServiceImpl implements ICfsLogService {
*/
@Override
public JsonResultEntity importCfsLog(CfsLogEntity entity) {
JSONArray jsonArray = new JSONArray();
JSONObject data = new JSONObject();
data.put("tab_name_ch",entity.getTab_name_ch());
data.put("tab_name_en",entity.getTab_name_en());
data.put("bill_code",getCode(entity));
data.put("form_app_id",entity.getOaWorkflowEventDataEntity().getFormApp());
data.put("event_type","onProcessFinished");
data.put("id",entity.getOaWorkflowEventDataEntity().getId());
data.put("title","");//流程标题这个字段暂时取不到
data.put("result",entity.getResult());//返回的报文
if (StrUtil.isNotEmpty(entity.getResult())){
JSONObject resultObj = JSONObject.parseObject(entity.getResult());
String statusMsg = resultObj.getString("statusMsg");//交行返回的状态
String serialNo = resultObj.getString("serialNo");//交行返回的流水号
data.put("status_msg",statusMsg);
data.put("serial_no",serialNo);
}
jsonArray.add(data);
JSONObject jsonStr = new JSONObject();
jsonStr.put("type","archives");
jsonStr.put("templateCode","formmain_0527");
jsonStr.put("attribute",jsonArray);
//1解析数据
//2保存日志
JSONObject jsonObject = new JSONObject();
jsonObject.put("jsonStr",jsonStr);
JsonResultEntity jsonResultEntity = seeYonInterFace.thirdInterfaceSend(jsonObject);
return jsonResultEntity;
}
private String getCode(CfsLogEntity entity){
if (null != entity && null != entity.getOaWorkflowEventDataEntity()){
String tableName = entity.getTab_name_en();
String jsonStr = entity.getOaWorkflowEventDataEntity().getBusinessDataStr();
JSONObject jsonObject = JSONObject.parseObject(jsonStr);
if (null != jsonObject){
String bill_code=null;
switch (tableName){
case "formmain_0307"://差旅报销单
bill_code=jsonObject.getJSONObject("formmain_0307").getString("field0094");
break;
case "formmain_0294"://招待费报销单
bill_code=jsonObject.getJSONObject("formmain_0294").getString("field0053");
break;
case "formmain_0314"://日常费用报销单
bill_code=jsonObject.getJSONObject("formmain_0314").getString("field0220");
break;
case "formmain_0362"://资金归集
bill_code=jsonObject.getJSONObject("formmain_0362").getString("field0047");
break;
case "formmain_0464"://资金拨付
bill_code=jsonObject.getJSONObject("formmain_0464").getString("field0045");
break;
case "formmain_0467"://同名账户划转
bill_code=jsonObject.getJSONObject("formmain_0467").getString("field0045");
break;
case "formmain_0293"://借款单(借还款)
bill_code=jsonObject.getJSONObject("formmain_0293").getString("field0056");
break;
case "formmain_0327"://对公付款单
bill_code = jsonObject.getJSONObject("formmain_0327").getString("field0146");
}
return bill_code;
}
}
return null;
}
}

View File

@ -0,0 +1,214 @@
package com.hzya.frame.seeyon.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.seeyon.entity.OAWorkflowEventDataEntity;
import com.hzya.frame.seeyon.service.ISeeyonExtService;
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
import com.hzya.frame.sysnew.messageManageLog.entity.SysMessageManageLogEntity;
import com.hzya.frame.sysnew.messageManageLog.entity.SysMessageManageLogStatusEnum;
import com.hzya.frame.u8.util.U8Util;
import com.hzya.frame.uuid.UUIDLong;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* @Description seeyon扩展类
* @Author xiangerlin
* @Date 2024/5/14 14:04
**/
@Service(value = "seeyonExt")
public class SeeyonExtServiceImpl implements ISeeyonExtService {
Logger logger = LogManager.getLogger(getClass());
@Autowired
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
/**
* 英德赛 OA档案传U8
* 根据不同formApp来调U8不同接口
* @Since 3.0
* @param entity
* @return
*/
@Override
public SysExtensionApiEntity ydcSeeyon2u8(SysExtensionApiEntity entity) {
String bodys = entity.getBodys();
if (StrUtil.isNotEmpty(bodys)){
try {
OAWorkflowEventDataEntity dataEntity = JSON.parseObject(bodys,OAWorkflowEventDataEntity.class);
String businessDataStr = dataEntity.getBusinessDataStr();//oa表单参数
JSONObject businessData = JSON.parseObject(businessDataStr);
String formApp = dataEntity.getFormApp();
SysExtensionApiEntity param = new SysExtensionApiEntity();
Map<String, String> headerMap = entity.getHeaders();
JSONObject hzyaExtData = dataEntity.getHzyaExtData();//扩展参数
if (null == hzyaExtData){
hzyaExtData = new JSONObject();
}
//根据forApp组装不同参数
switch (formApp){
case "4728403652378707515"://
hzyaExtData.put("billCode", "cunhuoabc123456");
getInventory(businessData,param);
break;
case "供应商":
hzyaExtData.put("billCode", "");
getSupplier(businessData,param);
break;
case "客户":
hzyaExtData.put("billCode", "");
getCustomer(businessData,param);
break;
default:
param.setBodys("未匹配到表单当前formID"+ formApp);
logger.error("未匹配到表单当前formID"+formApp);
}
headerMap.put("hzyaExtData", JSON.toJSONString(hzyaExtData));
return param;
}catch (Exception e){
e.printStackTrace();
logger.error("执行英德赛OA存货同步U8接口报错{}", e);
}
}
return null;
}
/**
* 回调方法
* @Since 3.0
* @param logEntity
*/
@Override
public void ydcSeeyon2u8CallBack(SysMessageManageLogEntity logEntity) {
//在这里记录日志
JSONObject targetData = JSON.parseObject(logEntity.getTargetData());//这个对象里的body是 发送到u8的请求报文
JSONObject sourceData = JSON.parseObject(logEntity.getSourceData());
JSONObject sourceHeaders = sourceData.getJSONObject("header");//源数据header
JSONObject sourceBody = sourceData.getJSONObject("body");//源数据body
JSONObject hzyaExtData = sourceHeaders.getJSONObject("hzyaExtData");
JSONArray formMainIds = new JSONArray();
formMainIds.add(sourceBody.getString("id"));
JSONObject param = new JSONObject();
param.put("formAppId",sourceBody.getString("formApp"));
param.put("formMainIds",formMainIds);
param.put("dataSourceCode","ht_oa_sqlserver");
param.put("eventType",sourceBody.getString("eventType"));
IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity();
logDetails.setRootAppPk(JSON.toJSONString(param));
logDetails.setRootAppBill(hzyaExtData.getString("billCode"));
logDetails.setNewTransmitInfo(logEntity.getReturnData());
logDetails.setNewPushDate(new Date());
logDetails.setRootAppNewData(targetData.getString("body"));
//logDetails.setNewState(SysMessageManageLogStatusEnum.statusGetValue(logEntity.getStatus()));
logDetails.setPluginId("SeeyonExtPlugin");
try {
if (StrUtil.isEmpty(hzyaExtData.getString("integration_task_living_details_id"))){
if (SysMessageManageLogStatusEnum.SUCCESS.getType().equals(logEntity.getStatus())) {//成功
taskLivingDetailsService.saveLogToSuccess(logDetails);
}else {
taskLivingDetailsService.saveLogToFail(logDetails);//失败
}
}else {
logDetails.setId(hzyaExtData.getString("integration_task_living_details_id"));
if (SysMessageManageLogStatusEnum.SUCCESS.getType().equals(logEntity.getStatus())) {//成功
taskLivingDetailsService.saveLogFailToSuccess(logDetails);
}else {
taskLivingDetailsService.updateLogFailToSuccess(logDetails);//失败
}
}
}catch (Exception e){
logger.error("保存日志出错:{}",e);
}
}
//存货参数组装
private SysExtensionApiEntity getInventory(JSONObject businessData,SysExtensionApiEntity param){
if (null != businessData){
JSONObject jsonObject = new JSONObject();
jsonObject.put("Token", "Hzya1314_CheckSkip");
jsonObject.put("billid", "123");
jsonObject.put("AccId", "005");
JSONObject oArchives = new JSONObject();
oArchives.put("cInvCode", "cyp12");
oArchives.put("cInvCCode", "0101");
oArchives.put("cInvName", "测试");
oArchives.put("cGroupCode", "01");
oArchives.put("cComUnitCode", "0101");
jsonObject.put("oArchives", oArchives);
param.setBodys(JSON.toJSONString(jsonObject));
}
return param;
}
//供应商参数组装
private SysExtensionApiEntity getSupplier(JSONObject businessData,SysExtensionApiEntity param){
if (null != businessData){
JSONObject jsonObject = new JSONObject();
jsonObject.put("billid", "123");
jsonObject.put("AccId", "888");
jsonObject.put("Token", U8Util.getToken());
JSONObject oArchives = new JSONObject();
oArchives.put("cVenCode", "0001");
oArchives.put("cVenName ", "测试0001");
oArchives.put("cVenAbbName", "测试0001简称");
oArchives.put("cVCCode", "01");
oArchives.put("cVenExch_name", "人民币");
oArchives.put("bVenTax", "false");
oArchives.put("bLicenceDate", "false");
oArchives.put("bBusinessDate", "false");
oArchives.put("bProxyDate", "false");
oArchives.put("bPassGMP", "false");
oArchives.put("bVenCargo", "false");
oArchives.put("bProxyForeign", "true");
oArchives.put("bVenService", "true");
oArchives.put("iVenGSPType", "0");
oArchives.put("bVenOverseas", "false");
oArchives.put("bVenAccPeriodMng", "false");
oArchives.put("bVenHomeBranch", "false");
oArchives.put("dVenCreateDatetime", "2023-01-04 10:00");
oArchives.put("cVenRegCode", "税号");
oArchives.put("cVenBank", "开户银行");
oArchives.put("cVenAccount", "银行账号");
jsonObject.put("oArchives", oArchives);
param.setBodys(JSON.toJSONString(jsonObject));
}
return param;
}
//客户参数组装
private SysExtensionApiEntity getCustomer(JSONObject businessData,SysExtensionApiEntity param){
if (null != businessData){
JSONObject jsonObject = new JSONObject();
jsonObject.put("billid", "123");
jsonObject.put("AccId", "888");
jsonObject.put("Token", "Hzya1314_CheckSkip");
JSONObject oArchives = new JSONObject();
oArchives.put("cCusCode", "0001");
oArchives.put("cCusName", "测试0001");
oArchives.put("cCusAbbName", "测试0001");
oArchives.put("cCCCode", "01");
oArchives.put("cCusExch_name", "人民币");
oArchives.put("cCusMngTypeCode", "999");
jsonObject.put("oArchives", oArchives);
param.setBodys(JSON.toJSONString(jsonObject));
}
return param;
}
}

View File

@ -71,6 +71,14 @@
,def4
,def5
</sql>
<!--通过ID获取数据 -->
<select id="entity_get" resultMap="get-IntegrationTaskLivingDetailsEntity-result">
select
<include refid="IntegrationTaskLivingDetailsEntity_Base_Column_List" />
from integration_task_living_details where id = #{ id } and sts='Y'
</select>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-IntegrationTaskLivingDetailsEntity-result" parameterType = "com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity">
select

View File

@ -18,7 +18,7 @@ public class U8Util {
//获取token
public static String getToken() {
String url = "/Api/Base/GetToken";
String url = "http://127.0.0.1:51910/Api/Base/GetToken";
JSONObject jsonObject = new JSONObject();
jsonObject.put("secretkey", "L1NhkDrQhtBDzTxFxPI0jxWcBzTBSPvaI5xZusRRi9ofS9d6ngxrj1erwbdjxtUT");
logger.info("获取U8token参数:{}", jsonObject.toJSONString());