状态回传接口测试

This commit is contained in:
lvleigang 2024-11-11 14:32:35 +08:00
parent 776c49dfc5
commit b35b87cc5f
5 changed files with 175 additions and 10 deletions

View File

@ -91,11 +91,12 @@ public class BackStatusPrepaymentPluginInitializer extends PluginBaseEntity {
* 执行业务代码 * 执行业务代码
* @Author 👻👻👻👻👻👻👻👻 gjh * @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2023-08-07 11:20 * @Date 2023-08-07 11:20
* @param requestJson 执行业务代码的参数 * @param requestJson 德广信OA回传预付单状态到U9C
* @return void * @return void
**/ **/
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
u9CPluginService.backPrepaymentStartFlow(requestJson);
return BaseResult.getSuccessMessageEntity(getPluginLabel()+"执行成功"); return BaseResult.getSuccessMessageEntity(getPluginLabel()+"执行成功");
} }
} }

View File

@ -85,11 +85,12 @@ public class BackStatusRequisitionPluginInitializer extends PluginBaseEntity {
* 执行业务代码 * 执行业务代码
* @Author 👻👻👻👻👻👻👻👻 gjh * @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2023-08-07 11:20 * @Date 2023-08-07 11:20
* @param requestJson 执行业务代码的参数 * @param requestJson 德广信OA请购单回传状态到U9c
* @return void * @return void
**/ **/
@Override @Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
u9CPluginService.backRequisitionStartFlow(requestJson);
return BaseResult.getSuccessMessageEntity(getPluginName()+"执行成功"); return BaseResult.getSuccessMessageEntity(getPluginName()+"执行成功");
} }
} }

View File

@ -38,4 +38,21 @@ public interface IU9CPluginService {
//根据应用key和应用密钥获取应用编码和应用名称 //根据应用key和应用密钥获取应用编码和应用名称
public SysExtensionApiEntity setQueryUrl(SysExtensionApiEntity sysExtensionApiEntity); 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);
} }

View File

@ -657,4 +657,152 @@ public class U9CPluginServiceImpl implements IU9CPluginService {
return sysExtensionApiEntity; 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<PrepaymentEntity> 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<PrepaymentEntity> 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插件执行成功");
}
} }

View File

@ -25,16 +25,14 @@ spring:
filters: stat,log4j2 filters: stat,log4j2
datasource: datasource:
master: 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 # 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
# username: root # username: root
# password: 62e4295b615a30dbf3b8ee96f41c820b # password: bd993088e8a7c3dc5f44441617f9b4bf
# driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置 # 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: savefile:
# 文件保存路径 # 文件保存路径
path: /Users/apple/Desktop/log/local path: /Users/apple/Desktop/log/local