劳务费

This commit is contained in:
xiang2lin 2025-05-16 13:42:26 +08:00
parent 00930d9d95
commit 41a506e414
5 changed files with 173 additions and 0 deletions

View File

@ -0,0 +1,96 @@
package com.hzya.frame.plugin.grp.plugin;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @Description 劳务费插件
* @Author xiangerlin
* @Date 2025/5/13 17:49
**/
public class LwfPluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(ExpensePluginInitializer.class);
/***
* 插件初始化方法
* @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 "LwfPlugin";
}
/****
* 插件的名称
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginName() {
return "劳务费插件";
}
/****
* 插件的显示值
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginLabel() {
return "劳务费插件";
}
/***
* 插件类型 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 {
logger.info("======开始执行GRP劳务费插件======:{}",requestJson.toString());
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/5/13 17:52
**/
public interface ILwfPluginService {
/**
* 执行插件
* @param jsonObject
* @return
*/
JsonResultEntity execute(JSONObject jsonObject)throws Exception;
}

View File

@ -0,0 +1,56 @@
package com.hzya.frame.plugin.grp.service.impl;
import cn.hutool.core.lang.Assert;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.grpU8.nxproof.gzlwfml.service.IGzLwfExtService;
import com.hzya.frame.plugin.grp.service.ILwfPluginService;
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 org.springframework.beans.factory.annotation.Value;
/**
* @Description 劳务费插件
* @Author xiangerlin
* @Date 2025/5/13 17:52
**/
public class LwfPluginServiceImpl implements ILwfPluginService {
Logger logger = LoggerFactory.getLogger(ILwfPluginService.class);
@Autowired
private IGzLwfExtService lwfExtService;
@Value("${zt.url}")
private String interfaceUrl;
/**
* 执行插件
*
* @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,"数据源编码不能为空");
logger.info("准备开始组装参数");
String param = lwfExtService.saveLwfPrePlugin(json);
logger.info("OA单据组装好准备保存劳务费的参数:{}",param);
String result = HttpRequest.post(interfaceUrl)
.header("appId","800042")// grp应用
.header("apiCode","8000420043")//劳务费接口
.header("publicKey","ZJYAcDv1SMgN1oUwzfpV5byfUaN78sVw+L+DB9XTT30aS8hCe7eDIk+3zDUT+v578prj")//OA应用key
.header("secretKey","ZLQWG13Z30FoeuCgi6/Uc41XF6oLO63550OAa6ggXUmtOZj5MgQNZMjVgL/M4BRkj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//OA应用密钥
.body(param).execute().body();
// JsonResultEntity resultEntity = (JsonResultEntity) oerDjmlService.handleOerDjml(paramJSON);
// logger.info("保存GRPU8响应参数:{}",JSONObject.toJSON(resultEntity));
logger.info("保存GRPU8响应参数:{}",result);
return BaseResult.getSuccessMessageEntity(result);
}
}

View File

@ -2,4 +2,5 @@
<!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" />
<bean name="lwfPluginInitializer" class="com.hzya.frame.plugin.grp.plugin.LwfPluginInitializer" />
</beans>

View File

@ -2,4 +2,5 @@
<!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" />
<bean name="lwfPluginServiceImpl" class="com.hzya.frame.plugin.grp.service.impl.LwfPluginServiceImpl" />
</beans>