From b35b87cc5f8cd47af27154aa0b5386df09bafa00 Mon Sep 17 00:00:00 2001 From: lvleigang <957075182@qq.com> Date: Mon, 11 Nov 2024 14:32:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=9B=9E=E4=BC=A0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...BackStatusPrepaymentPluginInitializer.java | 3 +- ...ackStatusRequisitionPluginInitializer.java | 3 +- .../dgx/u9c/service/IU9CPluginService.java | 17 ++ .../service/impl/U9CPluginServiceImpl.java | 148 ++++++++++++++++++ .../src/main/resources/application-llg.yml | 14 +- 5 files changed, 175 insertions(+), 10 deletions(-) diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/plugin/BackStatusPrepaymentPluginInitializer.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/plugin/BackStatusPrepaymentPluginInitializer.java index d5bc9926..7b37729c 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/plugin/BackStatusPrepaymentPluginInitializer.java +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/plugin/BackStatusPrepaymentPluginInitializer.java @@ -91,11 +91,12 @@ public class BackStatusPrepaymentPluginInitializer extends PluginBaseEntity { * 执行业务代码 * @Author 👻👻👻👻👻👻👻👻 gjh * @Date 2023-08-07 11:20 - * @param requestJson 执行业务代码的参数 + * @param requestJson 德广信OA回传预付单状态到U9C * @return void **/ @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + u9CPluginService.backPrepaymentStartFlow(requestJson); return BaseResult.getSuccessMessageEntity(getPluginLabel()+"执行成功"); } } diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/plugin/BackStatusRequisitionPluginInitializer.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/plugin/BackStatusRequisitionPluginInitializer.java index 0d8a3c60..9d8a67ca 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/plugin/BackStatusRequisitionPluginInitializer.java +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/plugin/BackStatusRequisitionPluginInitializer.java @@ -85,11 +85,12 @@ public class BackStatusRequisitionPluginInitializer extends PluginBaseEntity { * 执行业务代码 * @Author 👻👻👻👻👻👻👻👻 gjh * @Date 2023-08-07 11:20 - * @param requestJson 执行业务代码的参数 + * @param requestJson 德广信OA请购单回传状态到U9c * @return void **/ @Override public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + u9CPluginService.backRequisitionStartFlow(requestJson); return BaseResult.getSuccessMessageEntity(getPluginName()+"执行成功"); } } diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/service/IU9CPluginService.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/service/IU9CPluginService.java index 492dee4d..b9e73167 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/service/IU9CPluginService.java +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/service/IU9CPluginService.java @@ -38,4 +38,21 @@ public interface IU9CPluginService { //根据应用key和应用密钥获取应用编码和应用名称 public SysExtensionApiEntity setQueryUrl(SysExtensionApiEntity sysExtensionApiEntity); + /*** + * 执行业务代码 + * @Author 👻👻👻👻👻👻👻👻 gjh + * @Date 2023-08-07 11:20 + * @param requestJson 德广信OA回传预付单状态到U9C + * @return void + **/ + JsonResultEntity backPrepaymentStartFlow(JSONObject requestJson); + + /*** + * 执行业务代码 + * @Author 👻👻👻👻👻👻👻👻 gjh + * @Date 2023-08-07 11:20 + * @param requestJson 德广信OA请购单回传状态到U9c + * @return void + **/ + JsonResultEntity backRequisitionStartFlow(JSONObject requestJson); } diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/service/impl/U9CPluginServiceImpl.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/service/impl/U9CPluginServiceImpl.java index 4c73c6d8..4fd4f38e 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/service/impl/U9CPluginServiceImpl.java +++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/dgx/u9c/service/impl/U9CPluginServiceImpl.java @@ -657,4 +657,152 @@ public class U9CPluginServiceImpl implements IU9CPluginService { return sysExtensionApiEntity; } + /*** + * 执行业务代码 + * @Author 👻👻👻👻👻👻👻👻 gjh + * @Date 2023-08-07 11:20 + * @param requestJson 德广信OA回传预付单状态到U9C + * @return void + **/ + @Override + public JsonResultEntity backPrepaymentStartFlow(JSONObject requestJson) { + //WHERE formmain_0049.field0044 is NULL and COL_SUMMARY.STATE in ( '1','3','0') + //and formmain_0049.finishedflag = 1 + //数据源编码 + String datasourceCode = requestJson.getString("sourceCode"); + //重试id + String taskId = requestJson.getString("integration_task_living_details_id"); + //查询OA预付单 + PrepaymentEntity prepaymentEntity = new PrepaymentEntity(); + //todo 查询数据 + prepaymentEntity.setDataSourceCode(datasourceCode); + if (!StrUtil.isEmpty(taskId)) { + prepaymentEntity.setId(taskId); + } + List prepaymentList = prepaymentService.queryList(prepaymentEntity); + + //发送数据 + if (CollectionUtils.isNotEmpty(prepaymentList)) { + for (PrepaymentEntity prepayment : prepaymentList) { + //todo 组装数据 + JSONObject senddata = new JSONObject(); + logger.info("德广信OA回传预付单状态到U9C参数:{}", senddata.toString()); + String res = null; + Boolean flag = false; + try { + //todo调用接口 + + } catch (Exception e) { + logger.error("调用oa接口出错:{}", e); + res = e.getMessage(); + } + //保存日志 + IntegrationTaskLivingDetailsEntity taskLivingDetail = new IntegrationTaskLivingDetailsEntity(); + taskLivingDetail.setCreate_time(new Date()); + taskLivingDetail.setModify_time(new Date()); + taskLivingDetail.setRootAppPk(prepayment.getId());// todo + taskLivingDetail.setRootAppBill(prepayment.getDocNo());// todo + taskLivingDetail.setPluginId("BackStatusPrepaymentPlugin"); + taskLivingDetail.setRootAppNewData(senddata.toString()); + taskLivingDetail.setNewTransmitInfo(res); + taskLivingDetail.setNewPushDate(new Date()); + saveLog(taskId, flag, taskLivingDetail); + logger.info("OA回传预付单状态到U9C流程返回结果:{}", res); + // 发送完成修改主表状态 已完成或发送失败 flag判断 + if (flag) { + // todo + PrepaymentEntity updatePrepayment = new PrepaymentEntity(); + updatePrepayment.setDataSourceCode(datasourceCode); + updatePrepayment.setId(prepayment.getId()); + updatePrepayment.setDataStatus("1"); + updatePrepayment.setDataMsg("成功"); + prepaymentService.updateStatus(updatePrepayment); + } else { + // todo + PrepaymentEntity updatePrepayment = new PrepaymentEntity(); + updatePrepayment.setDataSourceCode(datasourceCode); + updatePrepayment.setId(prepayment.getId()); + updatePrepayment.setDataStatus("1"); + updatePrepayment.setDataMsg("失败:" + res); + prepaymentService.updateStatus(updatePrepayment); + } + } + } + return BaseResult.getSuccessMessageEntity("德广信OA回传预付单状态到U9C插件执行成功"); + } + + /*** + * 执行业务代码 + * @Author 👻👻👻👻👻👻👻👻 gjh + * @Date 2023-08-07 11:20 + * @param requestJson 德广信OA请购单回传状态到U9c + * @return void + **/ + @Override + public JsonResultEntity backRequisitionStartFlow(JSONObject requestJson) { + //WHERE formmain_0049.field0044 is NULL and COL_SUMMARY.STATE in ( '1','3','0') + //and formmain_0049.finishedflag = 1 + //数据源编码 + String datasourceCode = requestJson.getString("sourceCode"); + //重试id + String taskId = requestJson.getString("integration_task_living_details_id"); + //查询OA预付单 + PrepaymentEntity prepaymentEntity = new PrepaymentEntity(); + //todo 查询数据 + prepaymentEntity.setDataSourceCode(datasourceCode); + if (!StrUtil.isEmpty(taskId)) { + prepaymentEntity.setId(taskId); + } + List prepaymentList = prepaymentService.queryList(prepaymentEntity); + + //发送数据 + if (CollectionUtils.isNotEmpty(prepaymentList)) { + for (PrepaymentEntity prepayment : prepaymentList) { + //todo 组装数据 + JSONObject senddata = new JSONObject(); + logger.info("德广信OA回传请购单状态到U9C参数:{}", senddata.toString()); + String res = null; + Boolean flag = false; + try { + //todo调用接口 + } catch (Exception e) { + logger.error("调用oa接口出错:{}", e); + res = e.getMessage(); + } + //保存日志 + IntegrationTaskLivingDetailsEntity taskLivingDetail = new IntegrationTaskLivingDetailsEntity(); + taskLivingDetail.setCreate_time(new Date()); + taskLivingDetail.setModify_time(new Date()); + taskLivingDetail.setRootAppPk(prepayment.getId());// todo + taskLivingDetail.setRootAppBill(prepayment.getDocNo());// todo + taskLivingDetail.setPluginId("BackStatusRequisitionPlugin"); + taskLivingDetail.setRootAppNewData(senddata.toString()); + taskLivingDetail.setNewTransmitInfo(res); + taskLivingDetail.setNewPushDate(new Date()); + saveLog(taskId, flag, taskLivingDetail); + logger.info("OA回传请购单状态到U9C流程返回结果:{}", res); + // 发送完成修改主表状态 已完成或发送失败 flag判断 + if (flag) { + // todo + PrepaymentEntity updatePrepayment = new PrepaymentEntity(); + updatePrepayment.setDataSourceCode(datasourceCode); + updatePrepayment.setId(prepayment.getId()); + updatePrepayment.setDataStatus("1"); + updatePrepayment.setDataMsg("成功"); + prepaymentService.updateStatus(updatePrepayment); + } else { + // todo + PrepaymentEntity updatePrepayment = new PrepaymentEntity(); + updatePrepayment.setDataSourceCode(datasourceCode); + updatePrepayment.setId(prepayment.getId()); + updatePrepayment.setDataStatus("1"); + updatePrepayment.setDataMsg("失败:" + res); + prepaymentService.updateStatus(updatePrepayment); + } + + } + } + return BaseResult.getSuccessMessageEntity("德广信OA回传请购单状态到U9C插件执行成功"); + } + } diff --git a/base-buildpackage/src/main/resources/application-llg.yml b/base-buildpackage/src/main/resources/application-llg.yml index 5770339a..75ee7692 100644 --- a/base-buildpackage/src/main/resources/application-llg.yml +++ b/base-buildpackage/src/main/resources/application-llg.yml @@ -25,16 +25,14 @@ spring: filters: stat,log4j2 datasource: master: - url: jdbc:mysql://ufidahz.com.cn:9096/dgx?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true - username: root - password: bd993088e8a7c3dc5f44441617f9b4bf - driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置 - - -# url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true +# url: jdbc:mysql://ufidahz.com.cn:9096/dgx?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true # username: root -# password: 62e4295b615a30dbf3b8ee96f41c820b +# password: bd993088e8a7c3dc5f44441617f9b4bf # driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置 + url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true + username: root + password: 62e4295b615a30dbf3b8ee96f41c820b + driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置 savefile: # 文件保存路径 path: /Users/apple/Desktop/log/local