报销单插件

This commit is contained in:
xiang2lin 2025-03-12 14:09:27 +08:00
parent e696d77bf0
commit 7e4174b729
8 changed files with 199 additions and 1 deletions

View File

@ -0,0 +1,107 @@
package com.hzya.frame.plugin.grp.plugin;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.plugin.grp.service.IExpensePluginService;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @Description 报销单
* @Author xiangerlin
* @Date 2025/3/7 15:27
**/
public class ExpensePluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(ExpensePluginInitializer.class);
@Autowired
private IExpensePluginService expensePluginService;
/***
* 插件初始化方法
* @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 "ExpensePlugin";
}
/****
* 插件的名称
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginName() {
return "ExpensePlugin插件";
}
/****
* 插件的显示值
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginLabel() {
return "ExpensePlugin插件";
}
/***
* 插件类型 1场景插件
* @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2023-08-02 14:01
* @Param []
* @return java.lang.String
**/
@Override
public String getPluginType() {
return "1";
}
/***
* 执行业务代码
* @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2023-08-07 11:20
* @param requestJson 执行业务代码的参数
* @return void
**/
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
try {
logger.info("======开始执行GRP报销单插件======:{}",requestJson.toString());
expensePluginService.execute(requestJson);
}catch (Exception e){
logger.error("执行GRP报销单插件出错:{}",e);
}
return null;
}
}

View File

@ -0,0 +1,19 @@
package com.hzya.frame.plugin.grp.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.web.entity.JsonResultEntity;
/**
* @Description 报销单service
* @Author xiangerlin
* @Date 2025/3/7 15:39
**/
public interface IExpensePluginService {
/**
* 执行插件
* @param jsonObject
* @return
*/
JsonResultEntity execute(JSONObject jsonObject)throws Exception;
}

View File

@ -0,0 +1,51 @@
package com.hzya.frame.plugin.grp.service.impl;
import cn.hutool.core.lang.Assert;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.grpU8.nxproof.oerdjml.service.IOerDjmlExtService;
import com.hzya.frame.grpU8.nxproof.oerdjml.service.IOerDjmlService;
import com.hzya.frame.plugin.grp.service.IExpensePluginService;
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;
/**
* @Description grp报销单
* @Author xiangerlin
* @Date 2025/3/7 15:39
**/
public class ExpensePluginServiceImpl implements IExpensePluginService {
@Autowired
private IOerDjmlExtService oerDjmlExtService;
@Autowired
private IOerDjmlService oerDjmlService;
Logger logger = LoggerFactory.getLogger(IExpensePluginService.class);
/**
* 执行插件
*
* @param json
* @return
*/
@Override
public JsonResultEntity execute(JSONObject json)throws Exception {
String headersStr = json.getString("headers");//请求头
String formAppId = json.getString("formAppId");
String eventType = json.getString("eventType");
String dataSouceCode = json.getString("apiDataSourceCode");
Assert.notEmpty(formAppId,"formAppId不能为空");
Assert.notEmpty(eventType,"eventType不能为空");
Assert.notEmpty(headersStr,"headers不能为空");
Assert.notEmpty(dataSouceCode,"数据源编码不能为空");
String param = oerDjmlExtService.saveExpensePrePlugin(json);
logger.info("OA单据组装好准备保存GRP的参数:{}",param);
JsonResultEntity resultEntity = (JsonResultEntity) oerDjmlService.handleOerDjml(JSON.parseObject(param));
logger.info("保存GRPU8响应参数:{}",JSONObject.toJSON(resultEntity));
return resultEntity;
}
}

View File

@ -35,7 +35,7 @@ savefile:
tomcatpath: D:\yongansystem\apache-tomcat-9.0.97
pluginpath: D:\yongansystem\apache-tomcat-9.0.97\webapps\kangarooDataCenterV3\WEB-INF\classes
zt:
url: http://127.0.0.1:9082/kangarooDataCenterV3/entranceController/externalCallInterface
url: http://127.0.0.1:10086/kangarooDataCenterV3/entranceController/externalCallInterface
database:
# databaseName: businesscenter

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<id>grpU8Plugin</id>
<name>grpU8Plugin插件</name>
<category>20250307</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">
</beans>

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="expensePluginInitializer" class="com.hzya.frame.plugin.grp.plugin.ExpensePluginInitializer" />
</beans>

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="expensePluginServiceImpl" class="com.hzya.frame.plugin.grp.service.impl.ExpensePluginServiceImpl" />
</beans>