同步插件
This commit is contained in:
parent
a5e9345296
commit
89496fb10f
|
@ -0,0 +1,135 @@
|
||||||
|
package com.hzya.frame.plugin.ydc.plugin;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.base.PluginBaseEntity;
|
||||||
|
import com.hzya.frame.seeyon.service.ISeeYonInterFace;
|
||||||
|
import com.hzya.frame.seeyon.ydc.entity.Formmain0226Entity;
|
||||||
|
import com.hzya.frame.seeyon.ydc.service.IFormmain0226Service;
|
||||||
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description ydc客户档案同步
|
||||||
|
* @Author xiangerlin
|
||||||
|
* @Date 2024/7/9 08:59
|
||||||
|
**/
|
||||||
|
public class CustomerPluginInitializer extends PluginBaseEntity {
|
||||||
|
Logger logger = LoggerFactory.getLogger(getClass());
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IFormmain0226Service formmain0226Service;
|
||||||
|
@Autowired
|
||||||
|
private ISeeYonInterFace seeYonInterFace;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 插件初始化方法
|
||||||
|
* @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 "YDCCustomerPlugin";
|
||||||
|
}
|
||||||
|
|
||||||
|
/****
|
||||||
|
* 插件的名称
|
||||||
|
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
* @date 2023-08-02 10:48
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public String getPluginName() {
|
||||||
|
return "OA客户档案同步U8插件";
|
||||||
|
}
|
||||||
|
|
||||||
|
/****
|
||||||
|
* 插件的显示值
|
||||||
|
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
* @date 2023-08-02 10:48
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public String getPluginLabel() {
|
||||||
|
return "OA客户档案同步U8插件";
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 插件类型 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 {
|
||||||
|
//1、查询OA审批完成且未推送U8的客户申请
|
||||||
|
Formmain0226Entity formmain0226Entity = new Formmain0226Entity();
|
||||||
|
formmain0226Entity.setFinishedflag("1");
|
||||||
|
formmain0226Entity.setField0028Flag("1");
|
||||||
|
formmain0226Entity.setDataSourceCode(YdcConstant.dataSourceCode);
|
||||||
|
List<Formmain0226Entity> list = formmain0226Service.query(formmain0226Entity);
|
||||||
|
if (CollectionUtils.isNotEmpty(list)){
|
||||||
|
for (Formmain0226Entity f : list) {
|
||||||
|
try {
|
||||||
|
//2、调用插件方法
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("formAppId", "-9122508232154527168");
|
||||||
|
param.put("formMainIds", Convert.toStrArray(f.getId()));
|
||||||
|
param.put("dataSourceCode", "ydc_oa_sqlserver");
|
||||||
|
param.put("eventType", "onProcessFinished");
|
||||||
|
System.out.println(JSONObject.toJSONString(param));
|
||||||
|
seeYonInterFace.thirdInterfaceSeeYonDefinitionRePush(param);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("OA客户档案同步U8出错:{}", e);
|
||||||
|
} finally {
|
||||||
|
f.setField0028("1");
|
||||||
|
f.setDataSourceCode(YdcConstant.dataSourceCode);
|
||||||
|
formmain0226Service.updateFlag(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,137 @@
|
||||||
|
package com.hzya.frame.plugin.ydc.plugin;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.base.PluginBaseEntity;
|
||||||
|
import com.hzya.frame.seeyon.service.ISeeYonInterFace;
|
||||||
|
import com.hzya.frame.seeyon.ydc.entity.Formmain0227Entity;
|
||||||
|
import com.hzya.frame.seeyon.ydc.service.IFormmain0227Service;
|
||||||
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 英德赛 OA存货档案同步到U8
|
||||||
|
* @Author xiangerlin
|
||||||
|
* @Date 2024/7/8 09:56
|
||||||
|
**/
|
||||||
|
public class InventoryPluginInitializer extends PluginBaseEntity {
|
||||||
|
Logger logger = LoggerFactory.getLogger(getClass());
|
||||||
|
|
||||||
|
static String dataSourceCode = "ydc_oa_sqlserver_test";
|
||||||
|
@Autowired
|
||||||
|
private ISeeYonInterFace seeYonInterFace;
|
||||||
|
@Autowired
|
||||||
|
private IFormmain0227Service formmain0227Service;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 插件初始化方法
|
||||||
|
* @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 "YDCInventoryPlugin";
|
||||||
|
}
|
||||||
|
|
||||||
|
/****
|
||||||
|
* 插件的名称
|
||||||
|
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
* @date 2023-08-02 10:48
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public String getPluginName() {
|
||||||
|
return "OA存货档案同步U8插件";
|
||||||
|
}
|
||||||
|
|
||||||
|
/****
|
||||||
|
* 插件的显示值
|
||||||
|
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
* @date 2023-08-02 10:48
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public String getPluginLabel() {
|
||||||
|
return "OA存货档案同步U8插件";
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 插件类型 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 {
|
||||||
|
//1、查询OA审批完成且未推送U8的存货申请
|
||||||
|
Formmain0227Entity formmain0227 = new Formmain0227Entity();
|
||||||
|
formmain0227.setFinishedflag("1");
|
||||||
|
formmain0227.setField0022Flag("1");
|
||||||
|
formmain0227.setId("-8891720615522383237");
|
||||||
|
formmain0227.setDataSourceCode(YdcConstant.dataSourceCode);
|
||||||
|
List<Formmain0227Entity> list = formmain0227Service.query(formmain0227);
|
||||||
|
if (CollectionUtils.isNotEmpty(list)){
|
||||||
|
for (Formmain0227Entity f : list) {
|
||||||
|
try {
|
||||||
|
//2、调用插件方法
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("formAppId","-8691606453890363968");
|
||||||
|
param.put("formMainIds", Convert.toStrArray(f.getId()));
|
||||||
|
param.put("dataSourceCode","ydc_oa_sqlserver");
|
||||||
|
param.put("eventType","onProcessFinished");
|
||||||
|
System.out.println(JSONObject.toJSONString(param));
|
||||||
|
seeYonInterFace.thirdInterfaceSeeYonDefinitionRePush(param);
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("OA存货档案同步U8出错:{}",e);
|
||||||
|
}finally {
|
||||||
|
f.setField0022("1");
|
||||||
|
f.setDataSourceCode(YdcConstant.dataSourceCode);
|
||||||
|
formmain0227Service.updateFlag(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,137 @@
|
||||||
|
package com.hzya.frame.plugin.ydc.plugin;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.base.PluginBaseEntity;
|
||||||
|
import com.hzya.frame.seeyon.service.ISeeYonInterFace;
|
||||||
|
import com.hzya.frame.seeyon.ydc.entity.Formmain0225Entity;
|
||||||
|
import com.hzya.frame.seeyon.ydc.service.IFormmain0225Service;
|
||||||
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description ydc供应商档案同步
|
||||||
|
* @Author xiangerlin
|
||||||
|
* @Date 2024/7/8 14:31
|
||||||
|
**/
|
||||||
|
public class SupplierPluginInitializer extends PluginBaseEntity {
|
||||||
|
|
||||||
|
Logger logger = LoggerFactory.getLogger(getClass());
|
||||||
|
@Autowired
|
||||||
|
private IFormmain0225Service formmain0225Service;
|
||||||
|
@Autowired
|
||||||
|
private ISeeYonInterFace seeYonInterFace;
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 插件初始化方法
|
||||||
|
* @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 "YDCSupplierPlugin";
|
||||||
|
}
|
||||||
|
|
||||||
|
/****
|
||||||
|
* 插件的名称
|
||||||
|
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
* @date 2023-08-02 10:48
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public String getPluginName() {
|
||||||
|
return "OA供应商档案同步U8插件";
|
||||||
|
}
|
||||||
|
|
||||||
|
/****
|
||||||
|
* 插件的显示值
|
||||||
|
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||||
|
* @date 2023-08-02 10:48
|
||||||
|
* @return void
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public String getPluginLabel() {
|
||||||
|
return "OA供应商档案同步U8插件";
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 插件类型 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 {
|
||||||
|
//1、查询OA审批完成且为推送U8的供应商申请
|
||||||
|
Formmain0225Entity formmain0225Entity = new Formmain0225Entity();
|
||||||
|
formmain0225Entity.setFinishedflag("1");
|
||||||
|
formmain0225Entity.setField0025Flag("1");
|
||||||
|
formmain0225Entity.setDataSourceCode(YdcConstant.dataSourceCode);
|
||||||
|
List<Formmain0225Entity> list = formmain0225Service.query(formmain0225Entity);
|
||||||
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
|
for (Formmain0225Entity f : list) {
|
||||||
|
//2、调用插件方法
|
||||||
|
try {
|
||||||
|
//2、调用插件方法
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("formAppId", "6223456019738676230");
|
||||||
|
param.put("formMainIds", Convert.toStrArray(f.getId()));
|
||||||
|
param.put("dataSourceCode", "ydc_oa_sqlserver");
|
||||||
|
param.put("eventType", "onProcessFinished");
|
||||||
|
System.out.println(JSONObject.toJSONString(param));
|
||||||
|
seeYonInterFace.thirdInterfaceSeeYonDefinitionRePush(param);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("OA供应商档案同步U8出错:{}", e);
|
||||||
|
} finally {
|
||||||
|
f.setField0025("1");
|
||||||
|
f.setDataSourceCode(YdcConstant.dataSourceCode);
|
||||||
|
formmain0225Service.updateFlag(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.hzya.frame.plugin.ydc.plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description
|
||||||
|
* @Author xiangerlin
|
||||||
|
* @Date 2024/7/8 15:31
|
||||||
|
**/
|
||||||
|
public class YdcConstant {
|
||||||
|
|
||||||
|
public static String dataSourceCode = "ydc_oa_sqlserver_test";
|
||||||
|
}
|
Loading…
Reference in New Issue