主数据下发,重新发送
This commit is contained in:
parent
e1adda59ae
commit
53000de5ae
|
@ -2,6 +2,8 @@ package com.hzya.frame.plugin.mdmDistribute.plugin;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hzya.frame.base.PluginBaseEntity;
|
import com.hzya.frame.base.PluginBaseEntity;
|
||||||
import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao;
|
import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao;
|
||||||
|
@ -17,6 +19,7 @@ import com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDe
|
||||||
import com.hzya.frame.mdm.mdmModuleSendLog.dao.IMdmModuleSendLogDao;
|
import com.hzya.frame.mdm.mdmModuleSendLog.dao.IMdmModuleSendLogDao;
|
||||||
import com.hzya.frame.mdm.mdmModuleSendLog.entity.MdmModuleSendLogEntity;
|
import com.hzya.frame.mdm.mdmModuleSendLog.entity.MdmModuleSendLogEntity;
|
||||||
import com.hzya.frame.mdm.service.IMdmServiceCache;
|
import com.hzya.frame.mdm.service.IMdmServiceCache;
|
||||||
|
import com.hzya.frame.sys.sysenum.SysEnum;
|
||||||
import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao;
|
import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao;
|
||||||
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
|
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
|
||||||
import com.hzya.frame.sysnew.application.dao.ISysApplicationDao;
|
import com.hzya.frame.sysnew.application.dao.ISysApplicationDao;
|
||||||
|
@ -273,6 +276,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
if(mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0){
|
if(mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0){
|
||||||
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
|
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
|
||||||
if(mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())){
|
if(mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())){
|
||||||
|
if(object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName()) != null){
|
||||||
Map<String,Object> mapDetail = new HashMap<>();
|
Map<String,Object> mapDetail = new HashMap<>();
|
||||||
mapDetail.put("tableName",mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
|
mapDetail.put("tableName",mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
|
||||||
mapDetail.put("id",object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName()));
|
mapDetail.put("id",object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName()));
|
||||||
|
@ -286,6 +290,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
|
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
|
||||||
if("2".equals(mdmModuleDbEntities.get(i).getDbType())){
|
if("2".equals(mdmModuleDbEntities.get(i).getDbType())){
|
||||||
|
@ -302,12 +307,15 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
|
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
|
||||||
if(mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())){
|
if(mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())){
|
||||||
for (int i3 = 0; i3 < detail.size(); i3++) {
|
for (int i3 = 0; i3 < detail.size(); i3++) {
|
||||||
|
if(detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName()) != null){
|
||||||
Map<String,Object> mapDetail = new HashMap<>();
|
Map<String,Object> mapDetail = new HashMap<>();
|
||||||
mapDetail.put("tableName",mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
|
mapDetail.put("tableName",mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
|
||||||
mapDetail.put("id",detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName()));
|
mapDetail.put("id",detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName()));
|
||||||
JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
|
JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
|
||||||
detail.get(i3).put(mdmModuleDbFiledsEntities.get(i2).getEnName(),objectDetail);
|
detail.get(i3).put(mdmModuleDbFiledsEntities.get(i2).getEnName(),objectDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -340,10 +348,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
JSONObject groovyStr = new JSONObject();
|
JSONObject groovyStr = new JSONObject();
|
||||||
groovyStr.put("jsonStr",groovy);
|
groovyStr.put("jsonStr",groovy);
|
||||||
try {
|
try {
|
||||||
SysExtensionApiEntity jsonResultEntity = groovyIntegrationService.groovyScriptExecution(groovy);
|
Object str = groovyIntegrationService.groovyScriptExecution(groovyStr);
|
||||||
header = jsonResultEntity.getHeaders();
|
JSONObject jsonResultEntity = JSONObject.parseObject(str.toString());
|
||||||
querys = jsonResultEntity.getQuerys();
|
header = (Map<String, String>) jsonResultEntity.get("header");
|
||||||
bodys = jsonResultEntity.getBodys();
|
querys = jsonResultEntity.getString("querys");
|
||||||
|
bodys = jsonResultEntity.getString("bodys");
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
taskDetailEntity.setResult("分发脚本转换错误");
|
taskDetailEntity.setResult("分发脚本转换错误");
|
||||||
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
|
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
|
||||||
|
@ -358,6 +367,33 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
if(header != null){
|
if(header != null){
|
||||||
headers.putAll(header);
|
headers.putAll(header);
|
||||||
}
|
}
|
||||||
|
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
|
||||||
|
//找到登陆接口
|
||||||
|
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
||||||
|
if (null == loginApi) {
|
||||||
|
taskDetailEntity.setResult("发送错误,认证接口不存在");
|
||||||
|
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
|
||||||
|
return BaseResult.getFailureMessageEntity("发送错误,认证接口不存在");
|
||||||
|
}
|
||||||
|
String rzquerys = getQuery(loginApi,null,null);
|
||||||
|
Map<String, String> headersa = new HashMap<>();
|
||||||
|
headersa.put("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj");
|
||||||
|
headersa.put("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=");
|
||||||
|
headersa.put("appId", sysApplicationEntity.getAppId().toString());
|
||||||
|
headersa.put("apiCode", loginApi.getApiCode().toString());
|
||||||
|
Map<String, String> rzheaders = getHeaders(loginApi,headersa,null);
|
||||||
|
String rzbodys = getBodys(loginApi,null,null);
|
||||||
|
JsonResultEntity rzjsonResultEntity = sendData(loginApi,rzheaders,rzbodys,rzquerys);
|
||||||
|
if (!rzjsonResultEntity.isFlag()) {
|
||||||
|
taskDetailEntity.setResult("发送错误,认证接口错误");
|
||||||
|
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
|
||||||
|
return BaseResult.getFailureMessageEntity("发送错误:"+rzjsonResultEntity.getMsg());
|
||||||
|
}
|
||||||
|
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||||
|
querys = getQuery(apiEntity,querys,attritube);
|
||||||
|
headers = getHeaders(apiEntity,headers,attritube);
|
||||||
|
bodys = getBodys(apiEntity,bodys,attritube);
|
||||||
|
}
|
||||||
//组装数据发送
|
//组装数据发送
|
||||||
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
||||||
if(jsonResultEntity.isFlag()){
|
if(jsonResultEntity.isFlag()){
|
||||||
|
@ -534,10 +570,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
JSONObject groovyStr = new JSONObject();
|
JSONObject groovyStr = new JSONObject();
|
||||||
groovyStr.put("jsonStr",groovy);
|
groovyStr.put("jsonStr",groovy);
|
||||||
try {
|
try {
|
||||||
SysExtensionApiEntity jsonResultEntity = groovyIntegrationService.groovyScriptExecution(groovy);
|
Object str = groovyIntegrationService.groovyScriptExecution(groovyStr);
|
||||||
header = jsonResultEntity.getHeaders();
|
JSONObject jsonResultEntity = JSONObject.parseObject(str.toString());
|
||||||
querys = jsonResultEntity.getQuerys();
|
header = (Map<String, String>) jsonResultEntity.get("header");
|
||||||
bodys = jsonResultEntity.getBodys();
|
querys = jsonResultEntity.getString("querys");
|
||||||
|
bodys = jsonResultEntity.getString("bodys");
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
saveMdmModuleSendLogEntity("2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3");
|
saveMdmModuleSendLogEntity("2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"3");
|
||||||
continue;
|
continue;
|
||||||
|
@ -551,6 +588,31 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
if(header != null){
|
if(header != null){
|
||||||
headers.putAll(header);
|
headers.putAll(header);
|
||||||
}
|
}
|
||||||
|
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
|
||||||
|
//找到登陆接口
|
||||||
|
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
||||||
|
if (null == loginApi) {
|
||||||
|
saveMdmModuleSendLogEntity("2","发送错误,认证接口不存在",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String rzquerys = getQuery(loginApi,null,null);
|
||||||
|
Map<String, String> headersa = new HashMap<>();
|
||||||
|
headersa.put("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj");
|
||||||
|
headersa.put("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=");
|
||||||
|
headersa.put("appId", sysApplicationEntity.getAppId().toString());
|
||||||
|
headersa.put("apiCode", loginApi.getApiCode().toString());
|
||||||
|
Map<String, String> rzheaders = getHeaders(loginApi,headersa,null);
|
||||||
|
String rzbodys = getBodys(loginApi,null,null);
|
||||||
|
JsonResultEntity rzjsonResultEntity = sendData(loginApi,rzheaders,rzbodys,rzquerys);
|
||||||
|
if (!rzjsonResultEntity.isFlag()) {
|
||||||
|
saveMdmModuleSendLogEntity("2","发送错误,认证接口错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||||
|
querys = getQuery(apiEntity,querys,attritube);
|
||||||
|
headers = getHeaders(apiEntity,headers,attritube);
|
||||||
|
bodys = getBodys(apiEntity,bodys,attritube);
|
||||||
|
}
|
||||||
//组装数据发送
|
//组装数据发送
|
||||||
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
||||||
if(jsonResultEntity.isFlag()){
|
if(jsonResultEntity.isFlag()){
|
||||||
|
@ -591,7 +653,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
Map<String, Object> map1 = new HashMap<>();
|
Map<String, Object> map1 = new HashMap<>();
|
||||||
map1.put("tableName",mainDb);
|
map1.put("tableName",mainDb);
|
||||||
map1.put("dataStatus", "F");
|
//map1.put("dataStatus", "F");
|
||||||
map1.put("updateStatus", "0");
|
map1.put("updateStatus", "0");
|
||||||
map1.put("size", 1000);
|
map1.put("size", 1000);
|
||||||
objects = mdmModuleDao.queryMdmSTs(map1);
|
objects = mdmModuleDao.queryMdmSTs(map1);
|
||||||
|
@ -608,7 +670,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
//查询这一千条数据是否符合规则
|
//查询这一千条数据是否符合规则
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("tableName", mainDb);
|
map.put("tableName", mainDb);
|
||||||
map.put("dataStatus", "F");
|
//map.put("dataStatus", "F");
|
||||||
map.put("updateStatus", "0");
|
map.put("updateStatus", "0");
|
||||||
map.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities);
|
map.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities);
|
||||||
map.put("ids", objects);
|
map.put("ids", objects);
|
||||||
|
@ -674,10 +736,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
JSONObject groovyStr = new JSONObject();
|
JSONObject groovyStr = new JSONObject();
|
||||||
groovyStr.put("jsonStr",groovy);
|
groovyStr.put("jsonStr",groovy);
|
||||||
try {
|
try {
|
||||||
SysExtensionApiEntity jsonResultEntity = groovyIntegrationService.groovyScriptExecution(groovy);
|
Object str = groovyIntegrationService.groovyScriptExecution(groovyStr);
|
||||||
header = jsonResultEntity.getHeaders();
|
JSONObject jsonResultEntity = JSONObject.parseObject(str.toString());
|
||||||
querys = jsonResultEntity.getQuerys();
|
header = (Map<String, String>) jsonResultEntity.get("header");
|
||||||
bodys = jsonResultEntity.getBodys();
|
querys = jsonResultEntity.getString("querys");
|
||||||
|
bodys = jsonResultEntity.getString("bodys");
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
saveMdmModuleSendLogEntity("2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2");
|
saveMdmModuleSendLogEntity("2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"2");
|
||||||
continue;
|
continue;
|
||||||
|
@ -691,6 +754,31 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
if(header != null){
|
if(header != null){
|
||||||
headers.putAll(header);
|
headers.putAll(header);
|
||||||
}
|
}
|
||||||
|
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
|
||||||
|
//找到登陆接口
|
||||||
|
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
||||||
|
if (null == loginApi) {
|
||||||
|
saveMdmModuleSendLogEntity("2","发送错误,认证接口不存在",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String rzquerys = getQuery(loginApi,null,null);
|
||||||
|
Map<String, String> headersa = new HashMap<>();
|
||||||
|
headersa.put("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj");
|
||||||
|
headersa.put("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=");
|
||||||
|
headersa.put("appId", sysApplicationEntity.getAppId().toString());
|
||||||
|
headersa.put("apiCode", loginApi.getApiCode().toString());
|
||||||
|
Map<String, String> rzheaders = getHeaders(loginApi,headersa,null);
|
||||||
|
String rzbodys = getBodys(loginApi,null,null);
|
||||||
|
JsonResultEntity rzjsonResultEntity = sendData(loginApi,rzheaders,rzbodys,rzquerys);
|
||||||
|
if (!rzjsonResultEntity.isFlag()) {
|
||||||
|
saveMdmModuleSendLogEntity("2","发送错误,认证接口错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||||
|
querys = getQuery(apiEntity,querys,attritube);
|
||||||
|
headers = getHeaders(apiEntity,headers,attritube);
|
||||||
|
bodys = getBodys(apiEntity,bodys,attritube);
|
||||||
|
}
|
||||||
//组装数据发送
|
//组装数据发送
|
||||||
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
||||||
if(jsonResultEntity.isFlag()){
|
if(jsonResultEntity.isFlag()){
|
||||||
|
@ -709,7 +797,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
for (int i = 0; i < objects.size(); i++) {
|
for (int i = 0; i < objects.size(); i++) {
|
||||||
Map<String, Object> updateMap = new HashMap<>();
|
Map<String, Object> updateMap = new HashMap<>();
|
||||||
updateMap.put("tableName",mainDb);
|
updateMap.put("tableName",mainDb);
|
||||||
updateMap.put("dataStatus", "F");
|
//updateMap.put("dataStatus", "F");
|
||||||
updateMap.put("updateStatus", "1");
|
updateMap.put("updateStatus", "1");
|
||||||
updateMap.put("id", objects.get(i).getString("id"));
|
updateMap.put("id", objects.get(i).getString("id"));
|
||||||
mdmModuleDao.updateMdmSTs(updateMap);
|
mdmModuleDao.updateMdmSTs(updateMap);
|
||||||
|
@ -738,7 +826,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
Map<String, Object> map1 = new HashMap<>();
|
Map<String, Object> map1 = new HashMap<>();
|
||||||
map1.put("tableName",mainDb);
|
map1.put("tableName",mainDb);
|
||||||
map1.put("dataStatus", "Y");
|
//map1.put("dataStatus", "Y");
|
||||||
map1.put("addStatus", "0");
|
map1.put("addStatus", "0");
|
||||||
map1.put("size", 1000);
|
map1.put("size", 1000);
|
||||||
objects = mdmModuleDao.queryMdmSTs(map1);
|
objects = mdmModuleDao.queryMdmSTs(map1);
|
||||||
|
@ -755,7 +843,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
//查询这一千条数据是否符合规则
|
//查询这一千条数据是否符合规则
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("tableName", mainDb);
|
map.put("tableName", mainDb);
|
||||||
map.put("dataStatus", "Y");
|
//map.put("dataStatus", "Y");
|
||||||
map.put("addStatus", "0");
|
map.put("addStatus", "0");
|
||||||
map.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities);
|
map.put("mdmModuleDistributeDetailEntities", mdmModuleDistributeDetailEntities);
|
||||||
map.put("ids", objects);
|
map.put("ids", objects);
|
||||||
|
@ -830,10 +918,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
JSONObject groovyStr = new JSONObject();
|
JSONObject groovyStr = new JSONObject();
|
||||||
groovyStr.put("jsonStr",groovy);
|
groovyStr.put("jsonStr",groovy);
|
||||||
try {
|
try {
|
||||||
SysExtensionApiEntity jsonResultEntity = groovyIntegrationService.groovyScriptExecution(groovy);
|
Object str = groovyIntegrationService.groovyScriptExecution(groovyStr);
|
||||||
header = jsonResultEntity.getHeaders();
|
JSONObject jsonResultEntity = JSONObject.parseObject(str.toString());
|
||||||
querys = jsonResultEntity.getQuerys();
|
header = (Map<String, String>) jsonResultEntity.get("header");
|
||||||
bodys = jsonResultEntity.getBodys();
|
querys = jsonResultEntity.getString("querys");
|
||||||
|
bodys = jsonResultEntity.getString("bodys");
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
saveMdmModuleSendLogEntity("2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
saveMdmModuleSendLogEntity("2","脚本处理失败",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||||
continue;
|
continue;
|
||||||
|
@ -847,6 +936,32 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
if(header != null){
|
if(header != null){
|
||||||
headers.putAll(header);
|
headers.putAll(header);
|
||||||
}
|
}
|
||||||
|
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
|
||||||
|
//找到登陆接口
|
||||||
|
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
||||||
|
if (null == loginApi) {
|
||||||
|
saveMdmModuleSendLogEntity("2","发送错误,认证接口不存在",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String rzquerys = getQuery(loginApi,null,null);
|
||||||
|
Map<String, String> headersa = new HashMap<>();
|
||||||
|
headersa.put("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj");
|
||||||
|
headersa.put("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=");
|
||||||
|
headersa.put("appId", sysApplicationEntity.getAppId().toString());
|
||||||
|
headersa.put("apiCode", loginApi.getApiCode().toString());
|
||||||
|
Map<String, String> rzheaders = getHeaders(loginApi,headersa,null);
|
||||||
|
String rzbodys = getBodys(loginApi,null,null);
|
||||||
|
JsonResultEntity rzjsonResultEntity = sendData(loginApi,rzheaders,rzbodys,rzquerys);
|
||||||
|
if (!rzjsonResultEntity.isFlag()) {
|
||||||
|
saveMdmModuleSendLogEntity("2","发送错误,认证接口错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),apiEntity.getApiName(),doObjects.get(i).toJSONString(),"1");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||||
|
querys = getQuery(apiEntity,querys,attritube);
|
||||||
|
headers = getHeaders(apiEntity,headers,attritube);
|
||||||
|
bodys = getBodys(apiEntity,bodys,attritube);
|
||||||
|
}
|
||||||
|
|
||||||
//组装数据发送
|
//组装数据发送
|
||||||
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
|
||||||
if(jsonResultEntity.isFlag()){
|
if(jsonResultEntity.isFlag()){
|
||||||
|
@ -859,18 +974,13 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//所有下发发送完成,修改数据状态
|
//所有下发发送完成,修改数据状态
|
||||||
for (int i = 0; i < objects.size(); i++) {
|
for (int i = 0; i < objects.size(); i++) {
|
||||||
Map<String, Object> updateMap = new HashMap<>();
|
Map<String, Object> updateMap = new HashMap<>();
|
||||||
updateMap.put("tableName",mainDb);
|
updateMap.put("tableName",mainDb);
|
||||||
updateMap.put("dataStatus", "Y");
|
//updateMap.put("dataStatus", "Y");
|
||||||
updateMap.put("addStatus", "1");
|
updateMap.put("addStatus", "1");
|
||||||
updateMap.put("id", objects.get(i).getString("id"));
|
updateMap.put("id", objects.get(i).getString("id"));
|
||||||
mdmModuleDao.updateMdmSTs(updateMap);
|
mdmModuleDao.updateMdmSTs(updateMap);
|
||||||
|
@ -880,7 +990,6 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
private void saveMdmModuleSendLogEntity(String dataType,String remark,String dbname,String formmain_id, String target_app, String target_api, String source_data, String option_type) {
|
private void saveMdmModuleSendLogEntity(String dataType,String remark,String dbname,String formmain_id, String target_app, String target_api, String source_data, String option_type) {
|
||||||
MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity();
|
MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity();
|
||||||
mdmModuleSendLogEntity.setTableName(dbname+"_send_log");
|
mdmModuleSendLogEntity.setTableName(dbname+"_send_log");
|
||||||
mdmModuleSendLogEntity.setCreate();
|
|
||||||
mdmModuleSendLogEntity.setId(UUIDUtils.getUUID());
|
mdmModuleSendLogEntity.setId(UUIDUtils.getUUID());
|
||||||
mdmModuleSendLogEntity.setSts("Y");
|
mdmModuleSendLogEntity.setSts("Y");
|
||||||
mdmModuleSendLogEntity.setCreate_user_id("1");
|
mdmModuleSendLogEntity.setCreate_user_id("1");
|
||||||
|
@ -916,6 +1025,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
|
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
|
||||||
if(mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())){
|
if(mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())){
|
||||||
for (int i3 = 0; i3 < detail.size(); i3++) {
|
for (int i3 = 0; i3 < detail.size(); i3++) {
|
||||||
|
if(detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName()) != null){
|
||||||
Map<String,Object> mapDetail = new HashMap<>();
|
Map<String,Object> mapDetail = new HashMap<>();
|
||||||
mapDetail.put("tableName",mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
|
mapDetail.put("tableName",mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
|
||||||
mapDetail.put("id",detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName()));
|
mapDetail.put("id",detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName()));
|
||||||
|
@ -929,6 +1039,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
object.put(mdmModuleDbEntities.get(i).getDbName(),detail);
|
object.put(mdmModuleDbEntities.get(i).getDbName(),detail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1007,4 +1118,159 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
|
||||||
return BaseResult.getFailureMessageEntity("转发失败", body);
|
return BaseResult.getFailureMessageEntity("转发失败", body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Map<String, String> getHeaders(SysApplicationApiEntity loginApi,Map<String, String> map,JSONObject loginData) {
|
||||||
|
if(loginData == null){
|
||||||
|
loginData = new JSONObject();
|
||||||
|
}
|
||||||
|
if (loginApi.getHeaderIn() != null && !"".equals(loginApi.getHeaderIn())) {
|
||||||
|
if (JSONUtil.isTypeJSONArray(loginApi.getHeaderIn())) {
|
||||||
|
JSONArray headerArray = JSON.parseArray(loginApi.getHeaderIn());
|
||||||
|
for (int i = 0; i < headerArray.size(); i++) {
|
||||||
|
JSONObject querys = headerArray.getJSONObject(i);
|
||||||
|
//query 只有基本类型,不用循环判断下级
|
||||||
|
//判断参数是否有值
|
||||||
|
//获取对象下面的层级数据
|
||||||
|
if (SysEnum.AUTHPORT.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//认证类型
|
||||||
|
String query = querys.getString(SysEnum.EXAMPLE.getValue());
|
||||||
|
if (query != null && !"".equals(query)) {
|
||||||
|
JSONArray example = JSONArray.parseArray(query);
|
||||||
|
String logValue = getObjectValue(loginData, example);
|
||||||
|
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), logValue);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (querys.getString(SysEnum.EXAMPLE.getValue()) != null && !"".equals(querys.getString(SysEnum.EXAMPLE.getValue()))) {//入参没有值用实例值,如果没有不添加
|
||||||
|
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
|
||||||
|
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), querys.getString(SysEnum.EXAMPLE.getValue()));
|
||||||
|
}
|
||||||
|
} else {//没有值直接拼接
|
||||||
|
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
|
||||||
|
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String getQuery(SysApplicationApiEntity loginApi,String sendDatastr,JSONObject loginData) {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
if(sendDatastr != null){
|
||||||
|
String[] parts = sendDatastr.split("&");
|
||||||
|
if(parts != null && parts.length > 0){
|
||||||
|
for (int i = 0; i < parts.length; i++) {
|
||||||
|
String[] part = parts[i].split("=");
|
||||||
|
if(part != null && part.length >=2 ){
|
||||||
|
for (int a = 0; a < part.length; a++) {
|
||||||
|
map.put(part[0],part[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(loginData == null){
|
||||||
|
loginData = new JSONObject();
|
||||||
|
}
|
||||||
|
if (loginApi.getQueryIn() != null && !"".equals(loginApi.getQueryIn())) {
|
||||||
|
if (JSONUtil.isTypeJSONArray(loginApi.getQueryIn())) {
|
||||||
|
JSONArray headerArray = JSON.parseArray(loginApi.getQueryIn());
|
||||||
|
for (int i = 0; i < headerArray.size(); i++) {
|
||||||
|
JSONObject querys = headerArray.getJSONObject(i);
|
||||||
|
//query 只有基本类型,不用循环判断下级
|
||||||
|
//判断参数是否有值
|
||||||
|
//获取对象下面的层级数据
|
||||||
|
if (SysEnum.AUTHPORT.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//认证类型
|
||||||
|
String query = querys.getString(SysEnum.EXAMPLE.getValue());
|
||||||
|
if (query != null && !"".equals(query)) {
|
||||||
|
JSONArray example = JSONArray.parseArray(query);
|
||||||
|
String logValue = getObjectValue(loginData, example);
|
||||||
|
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), logValue);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//不是认证类型直接取值
|
||||||
|
if (querys.getString(SysEnum.EXAMPLE.getValue()) != null && !"".equals(querys.getString(SysEnum.EXAMPLE.getValue()))) {//入参没有值用实例值,如果没有不添加
|
||||||
|
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
|
||||||
|
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), querys.getString(SysEnum.EXAMPLE.getValue()));
|
||||||
|
}
|
||||||
|
} else {//没有值直接拼接
|
||||||
|
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
|
||||||
|
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
StringBuffer returnStr = new StringBuffer();
|
||||||
|
if(map != null && map.size() > 0){
|
||||||
|
for (String key : map.keySet()) {
|
||||||
|
if("".equals(returnStr)){
|
||||||
|
returnStr.append(key).append("=").append(map.get(key));
|
||||||
|
}else {
|
||||||
|
returnStr.append("&").append(key).append("=").append(map.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returnStr.toString();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param loginData
|
||||||
|
* @param example
|
||||||
|
* @return java.lang.String
|
||||||
|
* @Author lvleigang
|
||||||
|
* @Description 根据jsonArray 获取jsonobject中的值
|
||||||
|
* @Date 11:47 上午 2023/8/31
|
||||||
|
**/
|
||||||
|
private String getObjectValue(JSONObject loginData, JSONArray example) {
|
||||||
|
String values = "";
|
||||||
|
if (example != null && example.size() > 0) {
|
||||||
|
for (int i = 0; i < example.size(); i++) {
|
||||||
|
if (loginData.getString(example.getString(i)) != null && !"".equals(loginData.getString(example.getString(i)))) {
|
||||||
|
if (i == (example.size() - 1)) {
|
||||||
|
values = loginData.getString(example.getString(i));
|
||||||
|
} else {
|
||||||
|
loginData = JSONObject.parseObject(loginData.getString(example.getString(i)));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
private String getBodys(SysApplicationApiEntity loginApi,String sendDatastr, JSONObject loginData) {
|
||||||
|
JSONObject sendData = new JSONObject();
|
||||||
|
if(sendDatastr != null ){
|
||||||
|
sendData = JSONObject.parseObject(sendDatastr);
|
||||||
|
}
|
||||||
|
if(loginData == null){
|
||||||
|
loginData = new JSONObject();
|
||||||
|
}
|
||||||
|
if (loginApi.getBodyIn() != null && !"".equals(loginApi.getBodyIn())) {
|
||||||
|
if (JSONUtil.isTypeJSONArray(loginApi.getBodyIn())) {
|
||||||
|
JSONArray headerArray = JSON.parseArray(loginApi.getBodyIn());
|
||||||
|
for (int i = 0; i < headerArray.size(); i++) {
|
||||||
|
//获取到第一个数据
|
||||||
|
JSONObject querys = headerArray.getJSONObject(i);
|
||||||
|
if (SysEnum.AUTHPORT.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//认证类型
|
||||||
|
String query = querys.getString(SysEnum.EXAMPLE.getValue());
|
||||||
|
if (query != null && !"".equals(query)) {
|
||||||
|
JSONArray example = JSONArray.parseArray(query);
|
||||||
|
String logValue = getObjectValue(loginData, example);
|
||||||
|
sendData.put(querys.getString(SysEnum.PARAMETERNAME.getValue()),logValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sendData.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -559,7 +559,7 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
|
||||||
documentRule.setShowType("1");
|
documentRule.setShowType("1");
|
||||||
documentRule.setQueryType("1");
|
documentRule.setQueryType("1");
|
||||||
documentRule.setListType("1");
|
documentRule.setListType("1");
|
||||||
documentRule.setViewType("1");
|
documentRule.setViewType("2");
|
||||||
documentRule.setFiledLength("50");
|
documentRule.setFiledLength("50");
|
||||||
documentRule.setCreate();
|
documentRule.setCreate();
|
||||||
documentRule.setDataType("1");
|
documentRule.setDataType("1");
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
package com.hzya.frame.mdm.service.impl;
|
package com.hzya.frame.mdm.service.impl;
|
||||||
|
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.http.Method;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
|
@ -49,7 +52,9 @@ import com.hzya.frame.mdm.mdmTableCodeRule.entity.MdmTableCodeRuleEntity;
|
||||||
import com.hzya.frame.mdm.service.IMdmService;
|
import com.hzya.frame.mdm.service.IMdmService;
|
||||||
|
|
||||||
import com.hzya.frame.mdm.service.IMdmServiceCache;
|
import com.hzya.frame.mdm.service.IMdmServiceCache;
|
||||||
|
import com.hzya.frame.sys.appApi.entity.AppApi;
|
||||||
import com.hzya.frame.sys.entity.FormmainDeleteDto;
|
import com.hzya.frame.sys.entity.FormmainDeleteDto;
|
||||||
|
import com.hzya.frame.sys.sysenum.SysEnum;
|
||||||
import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao;
|
import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao;
|
||||||
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
|
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
|
||||||
import com.hzya.frame.sysnew.application.dao.ISysApplicationDao;
|
import com.hzya.frame.sysnew.application.dao.ISysApplicationDao;
|
||||||
|
@ -1329,6 +1334,7 @@ public class MdmServiceImpl implements IMdmService {
|
||||||
//String tablename = null;
|
//String tablename = null;
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
for (int i = 0; i < mdmModuleDbEntityList.size(); i++) {
|
for (int i = 0; i < mdmModuleDbEntityList.size(); i++) {
|
||||||
|
if("1".equals(mdmModuleDbEntityList.get(i).getDbType()) || "2".equals(mdmModuleDbEntityList.get(i).getDbType())){
|
||||||
//查询数据
|
//查询数据
|
||||||
Map<String, Object> queryData = new HashMap<>();
|
Map<String, Object> queryData = new HashMap<>();
|
||||||
queryData.put("tableName", mdmModuleDbEntityList.get(i).getDbName());//表名
|
queryData.put("tableName", mdmModuleDbEntityList.get(i).getDbName());//表名
|
||||||
|
@ -1345,6 +1351,8 @@ public class MdmServiceImpl implements IMdmService {
|
||||||
jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(), datas);
|
jsonObject.put(mdmModuleDbEntityList.get(i).getDbName(), datas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
//if (tablename != null && !"".equals(tablename)) {
|
//if (tablename != null && !"".equals(tablename)) {
|
||||||
// Map<String, Object> queryData = new HashMap<>();
|
// Map<String, Object> queryData = new HashMap<>();
|
||||||
// queryData.put("tableName", tablename);//表名
|
// queryData.put("tableName", tablename);//表名
|
||||||
|
@ -1691,6 +1699,7 @@ public class MdmServiceImpl implements IMdmService {
|
||||||
if (mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0) {
|
if (mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0) {
|
||||||
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
|
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
|
||||||
if (mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())) {
|
if (mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())) {
|
||||||
|
if(object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName()) != null){
|
||||||
Map<String, Object> mapDetail = new HashMap<>();
|
Map<String, Object> mapDetail = new HashMap<>();
|
||||||
mapDetail.put("tableName", mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
|
mapDetail.put("tableName", mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
|
||||||
mapDetail.put("id", object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName()));
|
mapDetail.put("id", object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName()));
|
||||||
|
@ -1704,6 +1713,7 @@ public class MdmServiceImpl implements IMdmService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
|
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
|
||||||
if ("2".equals(mdmModuleDbEntities.get(i).getDbType())) {
|
if ("2".equals(mdmModuleDbEntities.get(i).getDbType())) {
|
||||||
|
@ -1720,6 +1730,7 @@ public class MdmServiceImpl implements IMdmService {
|
||||||
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
|
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
|
||||||
if (mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())) {
|
if (mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())) {
|
||||||
for (int i3 = 0; i3 < detail.size(); i3++) {
|
for (int i3 = 0; i3 < detail.size(); i3++) {
|
||||||
|
if(detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName()) != null){
|
||||||
Map<String, Object> mapDetail = new HashMap<>();
|
Map<String, Object> mapDetail = new HashMap<>();
|
||||||
mapDetail.put("tableName", mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
|
mapDetail.put("tableName", mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
|
||||||
mapDetail.put("id", detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName()));
|
mapDetail.put("id", detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName()));
|
||||||
|
@ -1733,9 +1744,11 @@ public class MdmServiceImpl implements IMdmService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
object.put(mdmModuleDbEntities.get(i).getDbName(), detail);
|
object.put(mdmModuleDbEntities.get(i).getDbName(), detail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//执行脚本
|
//执行脚本
|
||||||
JSONObject groovy = new JSONObject();
|
JSONObject groovy = new JSONObject();
|
||||||
JSONObject parameterJson = new JSONObject();
|
JSONObject parameterJson = new JSONObject();
|
||||||
|
@ -1758,12 +1771,11 @@ public class MdmServiceImpl implements IMdmService {
|
||||||
JSONObject groovyStr = new JSONObject();
|
JSONObject groovyStr = new JSONObject();
|
||||||
groovyStr.put("jsonStr", groovy);
|
groovyStr.put("jsonStr", groovy);
|
||||||
try {
|
try {
|
||||||
//SysExtensionApiEntity jsonResultEntity = groovyIntegrationService.groovyScriptExecution(groovy);
|
Object str = groovyIntegrationService.groovyScriptExecution(groovyStr);
|
||||||
SysExtensionApiEntity jsonResultEntity = new SysExtensionApiEntity();
|
JSONObject jsonResultEntity = JSONObject.parseObject(str.toString());
|
||||||
jsonResultEntity.setBodys("{\"ufinterface\":{\"billtype\":\"supplier\",\"sender\":\"OA\",\"replace\":\"Y\",\"isexchange\":\"Y\",\"account\":\"01\",\"groupcode\":\"00\"},\"bill\":{\"billhead\":{\"pk_country\":\"CN\",\"pk_group\":\"00\",\"enablestate\":\"2\",\"code\":\"01004\",\"supprop\":\"0\",\"pk_format\":\"ZH-CN\",\"pk_supplierclass\":\"S01\",\"custstate\":\"1\",\"name\":\"\",\"pk_timezone\":\"P0800\",\"taxpayerid\":\"087981489021135119\",\"pk_org\":\"003\"}}}");
|
header = (Map<String, String>) jsonResultEntity.get("header");
|
||||||
header = jsonResultEntity.getHeaders();
|
querys = jsonResultEntity.getString("querys");
|
||||||
querys = jsonResultEntity.getQuerys();
|
bodys = jsonResultEntity.getString("bodys");
|
||||||
bodys = jsonResultEntity.getBodys();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return BaseResult.getFailureMessageEntity("分发脚本转换错误");
|
return BaseResult.getFailureMessageEntity("分发脚本转换错误");
|
||||||
}
|
}
|
||||||
|
@ -1776,37 +1788,354 @@ public class MdmServiceImpl implements IMdmService {
|
||||||
if (header != null) {
|
if (header != null) {
|
||||||
headers.putAll(header);
|
headers.putAll(header);
|
||||||
}
|
}
|
||||||
|
if (SysEnum.NEED_LOGIN.getValue().equals(apiEntity.getNeedLogin())) {
|
||||||
|
//找到登陆接口
|
||||||
|
SysApplicationApiEntity loginApi = sysApplicationApiDao.get(apiEntity.getAuthenticationPort());
|
||||||
|
if (null == loginApi) {
|
||||||
|
saveMdmModuleSendLogEntity("2","转发失败,认证接口不存在",dbname,object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||||
|
return BaseResult.getFailureMessageEntity("发送错误,认证接口不存在");
|
||||||
|
|
||||||
|
}
|
||||||
|
String rzquerys = getQuery(loginApi,null,null);
|
||||||
|
Map<String, String> headersa = new HashMap<>();
|
||||||
|
headersa.put("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj");
|
||||||
|
headersa.put("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=");
|
||||||
|
headersa.put("appId", sysApplicationEntity.getAppId().toString());
|
||||||
|
headersa.put("apiCode", loginApi.getApiCode().toString());
|
||||||
|
Map<String, String> rzheaders = getHeaders(loginApi,headersa,null);
|
||||||
|
String rzbodys = getBodys(loginApi,null,null);
|
||||||
|
JsonResultEntity rzjsonResultEntity = sendData(loginApi,rzheaders,rzbodys,rzquerys);
|
||||||
|
if (!rzjsonResultEntity.isFlag()) {
|
||||||
|
saveMdmModuleSendLogEntity("2","转发失败,认证接口调用失败",dbname,object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||||
|
return BaseResult.getFailureMessageEntity("发送错误:"+rzjsonResultEntity.getMsg());
|
||||||
|
}
|
||||||
|
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
|
||||||
|
//JSONObject attritube = attritube1.getJSONObject("attribute");
|
||||||
|
querys = getQuery(apiEntity,querys,attritube);
|
||||||
|
headers = getHeaders(apiEntity,headers,attritube);
|
||||||
|
bodys = getBodys(apiEntity,bodys,attritube);
|
||||||
|
}
|
||||||
//组装数据发送
|
//组装数据发送
|
||||||
JsonResultEntity jsonResultEntity = sendData(apiEntity, headers, bodys, querys);
|
JsonResultEntity jsonResultEntity = sendData(apiEntity, headers,bodys,querys);
|
||||||
if (jsonResultEntity.isFlag()) {
|
if (jsonResultEntity.isFlag()) {
|
||||||
saveMdmModuleSendLogEntity("1","发送成功",dbname,object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
saveMdmModuleSendLogEntity("1","发送成功",dbname,object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||||
return BaseResult.getFailureMessageEntity("发送成功");
|
return BaseResult.getSuccessMessageEntity("发送成功");
|
||||||
} else {
|
} else {
|
||||||
saveMdmModuleSendLogEntity("2","转发失败",dbname,object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
saveMdmModuleSendLogEntity("2","转发失败",dbname,object.getString("id"), sysApplicationEntity.getName(), apiEntity.getApiName(), object.toJSONString(), type);
|
||||||
return BaseResult.getFailureMessageEntity("发送错误:"+jsonResultEntity.getMsg());
|
return BaseResult.getFailureMessageEntity("发送错误:"+jsonResultEntity.getMsg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private Map<String, String> getHeaders(SysApplicationApiEntity loginApi,Map<String, String> map,JSONObject loginData) {
|
||||||
|
if(loginData == null){
|
||||||
|
loginData = new JSONObject();
|
||||||
|
}
|
||||||
|
if (loginApi.getHeaderIn() != null && !"".equals(loginApi.getHeaderIn())) {
|
||||||
|
if (JSONUtil.isTypeJSONArray(loginApi.getHeaderIn())) {
|
||||||
|
JSONArray headerArray = JSON.parseArray(loginApi.getHeaderIn());
|
||||||
|
for (int i = 0; i < headerArray.size(); i++) {
|
||||||
|
JSONObject querys = headerArray.getJSONObject(i);
|
||||||
|
//query 只有基本类型,不用循环判断下级
|
||||||
|
//判断参数是否有值
|
||||||
|
//获取对象下面的层级数据
|
||||||
|
if (SysEnum.AUTHPORT.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//认证类型
|
||||||
|
String query = querys.getString(SysEnum.EXAMPLE.getValue());
|
||||||
|
if (query != null && !"".equals(query)) {
|
||||||
|
JSONArray example = JSONArray.parseArray(query);
|
||||||
|
String logValue = getObjectValue(loginData, example);
|
||||||
|
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), logValue);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (querys.getString(SysEnum.EXAMPLE.getValue()) != null && !"".equals(querys.getString(SysEnum.EXAMPLE.getValue()))) {//入参没有值用实例值,如果没有不添加
|
||||||
|
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
|
||||||
|
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), querys.getString(SysEnum.EXAMPLE.getValue()));
|
||||||
|
}
|
||||||
|
} else {//没有值直接拼接
|
||||||
|
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
|
||||||
|
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
|
||||||
private void saveMdmModuleSendLogEntity(String dataType,String remark,String dbname,String formmain_id, String target_app, String target_api, String source_data, String option_type) {
|
|
||||||
MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity();
|
|
||||||
mdmModuleSendLogEntity.setTableName(dbname+"_send_log");
|
|
||||||
mdmModuleSendLogEntity.setCreate();
|
}
|
||||||
mdmModuleSendLogEntity.setId(UUIDUtils.getUUID());
|
|
||||||
mdmModuleSendLogEntity.setSts("Y");
|
|
||||||
mdmModuleSendLogEntity.setCreate_user_id("1");
|
private String getQuery(SysApplicationApiEntity loginApi,String sendDatastr,JSONObject loginData) {
|
||||||
mdmModuleSendLogEntity.setModify_user_id("1");
|
Map<String, String> map = new HashMap<>();
|
||||||
mdmModuleSendLogEntity.setCreate_time(new Date());
|
if(sendDatastr != null){
|
||||||
mdmModuleSendLogEntity.setModify_time(new Date());
|
String[] parts = sendDatastr.split("&");
|
||||||
mdmModuleSendLogEntity.setOrg_id("0");
|
if(parts != null && parts.length > 0){
|
||||||
mdmModuleSendLogEntity.setCompanyId("0");
|
for (int i = 0; i < parts.length; i++) {
|
||||||
mdmModuleSendLogEntity.setFormmainId(formmain_id);
|
String[] part = parts[i].split("=");
|
||||||
mdmModuleSendLogEntity.setTargetApp(target_app);
|
if(part != null && part.length >=2 ){
|
||||||
mdmModuleSendLogEntity.setTargetApi(target_api);
|
for (int a = 0; a < part.length; a++) {
|
||||||
mdmModuleSendLogEntity.setSourceData(source_data);
|
map.put(part[0],part[1]);
|
||||||
mdmModuleSendLogEntity.setOptionType(option_type);
|
}
|
||||||
mdmModuleSendLogEntity.setDataType(dataType);
|
}
|
||||||
mdmModuleSendLogEntity.setRemark(remark);
|
}
|
||||||
mdmModuleSendLogDao.save(mdmModuleSendLogEntity);
|
}
|
||||||
|
}
|
||||||
|
if(loginData == null){
|
||||||
|
loginData = new JSONObject();
|
||||||
|
}
|
||||||
|
if (loginApi.getQueryIn() != null && !"".equals(loginApi.getQueryIn())) {
|
||||||
|
if (JSONUtil.isTypeJSONArray(loginApi.getQueryIn())) {
|
||||||
|
JSONArray headerArray = JSON.parseArray(loginApi.getQueryIn());
|
||||||
|
for (int i = 0; i < headerArray.size(); i++) {
|
||||||
|
JSONObject querys = headerArray.getJSONObject(i);
|
||||||
|
//query 只有基本类型,不用循环判断下级
|
||||||
|
//判断参数是否有值
|
||||||
|
//获取对象下面的层级数据
|
||||||
|
if (SysEnum.AUTHPORT.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//认证类型
|
||||||
|
String query = querys.getString(SysEnum.EXAMPLE.getValue());
|
||||||
|
if (query != null && !"".equals(query)) {
|
||||||
|
JSONArray example = JSONArray.parseArray(query);
|
||||||
|
String logValue = getObjectValue(loginData, example);
|
||||||
|
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), logValue);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//不是认证类型直接取值
|
||||||
|
if (querys.getString(SysEnum.EXAMPLE.getValue()) != null && !"".equals(querys.getString(SysEnum.EXAMPLE.getValue()))) {//入参没有值用实例值,如果没有不添加
|
||||||
|
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
|
||||||
|
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), querys.getString(SysEnum.EXAMPLE.getValue()));
|
||||||
|
}
|
||||||
|
} else {//没有值直接拼接
|
||||||
|
if(map.get(querys.getString(SysEnum.PARAMETERNAME.getValue())) == null){
|
||||||
|
map.put(querys.getString(SysEnum.PARAMETERNAME.getValue()), "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
StringBuffer returnStr = new StringBuffer();
|
||||||
|
if(map != null && map.size() > 0){
|
||||||
|
for (String key : map.keySet()) {
|
||||||
|
if("".equals(returnStr)){
|
||||||
|
returnStr.append(key).append("=").append(map.get(key));
|
||||||
|
}else {
|
||||||
|
returnStr.append("&").append(key).append("=").append(map.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returnStr.toString();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param loginData
|
||||||
|
* @param example
|
||||||
|
* @return java.lang.String
|
||||||
|
* @Author lvleigang
|
||||||
|
* @Description 根据jsonArray 获取jsonobject中的值
|
||||||
|
* @Date 11:47 上午 2023/8/31
|
||||||
|
**/
|
||||||
|
private String getObjectValue(JSONObject loginData, JSONArray example) {
|
||||||
|
String values = "";
|
||||||
|
if (example != null && example.size() > 0) {
|
||||||
|
for (int i = 0; i < example.size(); i++) {
|
||||||
|
if (loginData.getString(example.getString(i)) != null && !"".equals(loginData.getString(example.getString(i)))) {
|
||||||
|
if (i == (example.size() - 1)) {
|
||||||
|
values = loginData.getString(example.getString(i));
|
||||||
|
} else {
|
||||||
|
loginData = JSONObject.parseObject(loginData.getString(example.getString(i)));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
private String getBodys(SysApplicationApiEntity loginApi,String sendDatastr, JSONObject loginData) {
|
||||||
|
JSONObject sendData = new JSONObject();
|
||||||
|
if(sendDatastr != null ){
|
||||||
|
sendData = JSONObject.parseObject(sendDatastr);
|
||||||
|
}
|
||||||
|
if(loginData == null){
|
||||||
|
loginData = new JSONObject();
|
||||||
|
}
|
||||||
|
if (loginApi.getBodyIn() != null && !"".equals(loginApi.getBodyIn())) {
|
||||||
|
if (JSONUtil.isTypeJSONArray(loginApi.getBodyIn())) {
|
||||||
|
JSONArray headerArray = JSON.parseArray(loginApi.getBodyIn());
|
||||||
|
for (int i = 0; i < headerArray.size(); i++) {
|
||||||
|
//获取到第一个数据
|
||||||
|
JSONObject querys = headerArray.getJSONObject(i);
|
||||||
|
if (SysEnum.AUTHPORT.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//认证类型
|
||||||
|
String query = querys.getString(SysEnum.EXAMPLE.getValue());
|
||||||
|
if (query != null && !"".equals(query)) {
|
||||||
|
JSONArray example = JSONArray.parseArray(query);
|
||||||
|
String logValue = getObjectValue(loginData, example);
|
||||||
|
sendData.put(querys.getString(SysEnum.PARAMETERNAME.getValue()),logValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sendData.toString();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param querys 设置的字段属性
|
||||||
|
* @param sendData 发送数据
|
||||||
|
* @param loginData 认证信息
|
||||||
|
* @return java.lang.Object
|
||||||
|
* @Author lvleigang
|
||||||
|
* @Description 设置值
|
||||||
|
* @Date 4:14 下午 2023/8/31
|
||||||
|
**/
|
||||||
|
private Object getUpdata(JSONObject querys, JSONObject sendData, JSONObject loginData) {
|
||||||
|
if (SysEnum.AUTHPORT.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//认证类型 可以直接设置值
|
||||||
|
String query = querys.getString(SysEnum.EXAMPLE.getValue());
|
||||||
|
if (query != null && !"".equals(query)) {
|
||||||
|
JSONArray example = JSONArray.parseArray(query);
|
||||||
|
String logValue = getObjectValue(loginData, example);
|
||||||
|
return logValue;
|
||||||
|
}
|
||||||
|
} else if (SysEnum.FUNDAMENTAL.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//基本类型
|
||||||
|
if (sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())) != null
|
||||||
|
&& !"".equals(sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())))) {//先判断入参是否有值
|
||||||
|
return sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue()));
|
||||||
|
} else if (querys.getString(SysEnum.EXAMPLE.getValue()) != null && !"".equals(querys.getString(SysEnum.EXAMPLE.getValue()))) {//入参没有值用实例值,如果没有不添加
|
||||||
|
return querys.getString(SysEnum.EXAMPLE.getValue());
|
||||||
|
} else {//没有值直接拼接
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
} else if (SysEnum.COMPLEX.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//复杂类型
|
||||||
|
if (sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())) != null
|
||||||
|
&& !"".equals(sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())))) {//先判断入参是否有值
|
||||||
|
//获取子级
|
||||||
|
String childers = querys.getString(SysEnum.CHILDREN.getValue());
|
||||||
|
if (childers != null && !"".equals(childers)) {
|
||||||
|
JSONArray childersObj = JSONArray.parseArray(childers);
|
||||||
|
if (childersObj != null && childersObj.size() > 0) {
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
for (int i = 0; i < childersObj.size(); i++) {
|
||||||
|
JSONObject a = childersObj.getJSONObject(i);
|
||||||
|
obj.put(a.getString(SysEnum.PARAMETERNAME.getValue()), getUpdata(a, sendData.getJSONObject(querys.getString(SysEnum.PARAMETERNAME.getValue())), loginData));
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
} else {//入参没有值用实例值,如果没有不添加
|
||||||
|
//获取子级
|
||||||
|
String childers = querys.getString(SysEnum.CHILDREN.getValue());
|
||||||
|
if (childers != null && !"".equals(childers)) {
|
||||||
|
JSONArray childersObj = JSONArray.parseArray(childers);
|
||||||
|
if (childersObj != null && childersObj.size() > 0) {
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
for (int i = 0; i < childersObj.size(); i++) {
|
||||||
|
JSONObject a = childersObj.getJSONObject(i);
|
||||||
|
obj.put(a.getString(SysEnum.PARAMETERNAME.getValue()), getUpdata(a, new JSONObject(), loginData));
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
} else { //没有值直接拼接
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
} else { //没有值直接拼接
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (SysEnum.FUNDAMENTALLIST.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//基本列表
|
||||||
|
if (sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())) != null
|
||||||
|
&& !"".equals(sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())))) {//先判断入参是否有值
|
||||||
|
JSONArray jsonArray = JSONArray.parseArray(sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())));
|
||||||
|
return jsonArray;
|
||||||
|
} else if (querys.getString(SysEnum.EXAMPLE.getValue()) != null && !"".equals(querys.getString(SysEnum.EXAMPLE.getValue()))) {//入参没有值用实例值,如果没有不添加
|
||||||
|
if ("String".equals(querys.getString(SysEnum.CONCRETETYPE.getValue()))) {
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
jsonArray.add(querys.getString(SysEnum.EXAMPLE.getValue()));
|
||||||
|
return jsonArray;
|
||||||
|
} else if ("Int".equals(querys.getString(SysEnum.CONCRETETYPE.getValue()))) {
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
jsonArray.add(querys.getIntValue(SysEnum.EXAMPLE.getValue()));
|
||||||
|
return jsonArray;
|
||||||
|
} else if ("Long".equals(querys.getString(SysEnum.CONCRETETYPE.getValue()))) {
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
jsonArray.add(querys.getLongValue(SysEnum.EXAMPLE.getValue()));
|
||||||
|
return jsonArray;
|
||||||
|
} else if ("Float".equals(querys.getString(SysEnum.CONCRETETYPE.getValue()))) {
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
jsonArray.add(querys.getFloatValue(SysEnum.EXAMPLE.getValue()));
|
||||||
|
return jsonArray;
|
||||||
|
} else if ("Double".equals(querys.getString(SysEnum.CONCRETETYPE.getValue()))) {
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
jsonArray.add(querys.getDoubleValue(SysEnum.EXAMPLE.getValue()));
|
||||||
|
return jsonArray;
|
||||||
|
} else if ("Boolean".equals(querys.getString(SysEnum.CONCRETETYPE.getValue()))) {
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
jsonArray.add(querys.getBooleanValue(SysEnum.EXAMPLE.getValue()));
|
||||||
|
return jsonArray;
|
||||||
|
} else {
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
jsonArray.add(querys.getString(SysEnum.EXAMPLE.getValue()));
|
||||||
|
return jsonArray;
|
||||||
|
}
|
||||||
|
} else {//没有值直接拼接
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
return jsonArray;
|
||||||
|
}
|
||||||
|
} else if (SysEnum.COMPLEXLIST.getValue().equals(querys.getString(SysEnum.PARAMETERTYPE.getValue()))) {//复杂列表
|
||||||
|
if (sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())) != null
|
||||||
|
&& !"".equals(sendData.getString(querys.getString(SysEnum.PARAMETERNAME.getValue())))) {//先判断入参是否有值
|
||||||
|
//获取入参的数据
|
||||||
|
//循环入参
|
||||||
|
//循环api配置的参数
|
||||||
|
//设置api的参数
|
||||||
|
//返回数据
|
||||||
|
JSONArray sendArray = sendData.getJSONArray(querys.getString(SysEnum.PARAMETERNAME.getValue()));
|
||||||
|
if(sendArray == null || sendArray.size() == 0){
|
||||||
|
return new JSONArray();
|
||||||
|
}
|
||||||
|
String childers = querys.getString(SysEnum.CHILDREN.getValue());
|
||||||
|
if(childers == null || "".equals(childers)){
|
||||||
|
return new JSONArray();
|
||||||
|
}
|
||||||
|
JSONArray childersObj = JSONArray.parseArray(childers);
|
||||||
|
if(childersObj == null || childersObj.size() == 0){
|
||||||
|
return new JSONArray();
|
||||||
|
}
|
||||||
|
JSONArray obj = new JSONArray();
|
||||||
|
for (int i = 0; i < sendArray.size(); i++) {
|
||||||
|
JSONObject sl = new JSONObject();
|
||||||
|
for (int a = 0; a < childersObj.size(); a++) {
|
||||||
|
JSONObject b = childersObj.getJSONObject(a);
|
||||||
|
//入参没有只能取实例,实例只会有一个
|
||||||
|
sl.put(b.getString(SysEnum.PARAMETERNAME.getValue()), getUpdata(b, sendArray.getJSONObject(i), loginData));
|
||||||
|
}
|
||||||
|
obj.add(sl);
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
} else {//入参没有值用实例值,如果没有不添加
|
||||||
|
String childers = querys.getString(SysEnum.CHILDREN.getValue());
|
||||||
|
if (childers != null && !"".equals(childers)) {
|
||||||
|
JSONArray childersObj = JSONArray.parseArray(childers);
|
||||||
|
if (childersObj != null && childersObj.size() > 0) {
|
||||||
|
JSONArray obj = new JSONArray();
|
||||||
|
JSONObject sl = new JSONObject();
|
||||||
|
for (int i = 0; i < childersObj.size(); i++) {
|
||||||
|
JSONObject a = childersObj.getJSONObject(i);
|
||||||
|
//入参没有只能取实例,实例只会有一个
|
||||||
|
sl.put(a.getString(SysEnum.PARAMETERNAME.getValue()), getUpdata(a, new JSONObject(), loginData));
|
||||||
|
}
|
||||||
|
obj.add(sl);
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
JSONArray obj = new JSONArray();
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JsonResultEntity sendData(SysApplicationApiEntity applicationApiEntity, Map<String, String> headers, String bodys, String querys) {
|
private JsonResultEntity sendData(SysApplicationApiEntity applicationApiEntity, Map<String, String> headers, String bodys, String querys) {
|
||||||
|
@ -1880,6 +2209,29 @@ public class MdmServiceImpl implements IMdmService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void saveMdmModuleSendLogEntity(String dataType,String remark,String dbname,String formmain_id, String target_app, String target_api, String source_data, String option_type) {
|
||||||
|
MdmModuleSendLogEntity mdmModuleSendLogEntity = new MdmModuleSendLogEntity();
|
||||||
|
mdmModuleSendLogEntity.setTableName(dbname+"_send_log");
|
||||||
|
mdmModuleSendLogEntity.setCreate();
|
||||||
|
mdmModuleSendLogEntity.setId(UUIDUtils.getUUID());
|
||||||
|
mdmModuleSendLogEntity.setSts("Y");
|
||||||
|
mdmModuleSendLogEntity.setCreate_user_id("1");
|
||||||
|
mdmModuleSendLogEntity.setModify_user_id("1");
|
||||||
|
mdmModuleSendLogEntity.setCreate_time(new Date());
|
||||||
|
mdmModuleSendLogEntity.setModify_time(new Date());
|
||||||
|
mdmModuleSendLogEntity.setOrg_id("0");
|
||||||
|
mdmModuleSendLogEntity.setCompanyId("0");
|
||||||
|
mdmModuleSendLogEntity.setFormmainId(formmain_id);
|
||||||
|
mdmModuleSendLogEntity.setTargetApp(target_app);
|
||||||
|
mdmModuleSendLogEntity.setTargetApi(target_api);
|
||||||
|
mdmModuleSendLogEntity.setSourceData(source_data);
|
||||||
|
mdmModuleSendLogEntity.setOptionType(option_type);
|
||||||
|
mdmModuleSendLogEntity.setDataType(dataType);
|
||||||
|
mdmModuleSendLogEntity.setRemark(remark);
|
||||||
|
mdmModuleSendLogDao.save(mdmModuleSendLogEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mdmCode
|
* @param mdmCode
|
||||||
* @param saveData
|
* @param saveData
|
||||||
|
|
|
@ -2,10 +2,15 @@ package com.hzya.frame.sysnew.application.api.entity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.hzya.frame.sys.sysenum.SysEnum;
|
||||||
import com.hzya.frame.web.entity.BaseEntity;
|
import com.hzya.frame.web.entity.BaseEntity;
|
||||||
/**
|
/**
|
||||||
* 应用api(SysApplicationApi)实体类
|
* 应用api(SysApplicationApi)实体类
|
||||||
|
@ -307,37 +312,9 @@ public class SysApplicationApiEntity extends BaseEntity {
|
||||||
this.appUrl = appUrl;
|
this.appUrl = appUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<JSONObject> getHeaderInValue() {
|
|
||||||
List<JSONObject> jsonObjects = new ArrayList<>();
|
|
||||||
if(headerIn != null && !"".equals(headerIn)){
|
|
||||||
JSONArray headers = JSONArray.parseArray(headerIn);
|
|
||||||
if(headers != null && headers.size() > 0){
|
|
||||||
for (int i = 0; i < headers.size(); i++) {
|
|
||||||
JSONObject object = new JSONObject();
|
|
||||||
object.put(headers.getJSONObject(i).getString("parameterName"),headers.getJSONObject(i).getString("example"));
|
|
||||||
jsonObjects.add(object);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return jsonObjects;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getQueryInValue() {
|
|
||||||
StringBuffer jsonObjects = new StringBuffer();
|
|
||||||
if(queryIn != null && !"".equals(queryIn)){
|
|
||||||
JSONArray querys = JSONArray.parseArray(queryIn);
|
|
||||||
if(querys != null && querys.size() > 0){
|
|
||||||
for (int i = 0; i < querys.size(); i++) {
|
|
||||||
if(i != 0){
|
|
||||||
jsonObjects.append("&");
|
|
||||||
}
|
|
||||||
jsonObjects.append(querys.getJSONObject(i).getString("parameterName"));
|
|
||||||
jsonObjects.append("=");
|
|
||||||
jsonObjects.append(querys.getJSONObject(i).getString("example"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return jsonObjects.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1770,6 +1770,7 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
|
||||||
logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||||
sysExtensionApiEntity = (SysExtensionApiEntity) m.invoke(object, sysExtensionApiEntity);
|
sysExtensionApiEntity = (SysExtensionApiEntity) m.invoke(object, sysExtensionApiEntity);
|
||||||
logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||||
|
break;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("invokeException{}", e.getMessage());
|
logger.error("invokeException{}", e.getMessage());
|
||||||
return BaseResult.getFailureMessageEntity("内部方法执行错误,请联系管理员");
|
return BaseResult.getFailureMessageEntity("内部方法执行错误,请联系管理员");
|
||||||
|
|
|
@ -22,5 +22,5 @@ public interface IGroovyIntegrationService {
|
||||||
* @param jsonObject 请求参数对象
|
* @param jsonObject 请求参数对象
|
||||||
* @return com.hzya.frame.web.entity.JsonResultEntity
|
* @return com.hzya.frame.web.entity.JsonResultEntity
|
||||||
**/
|
**/
|
||||||
SysExtensionApiEntity groovyScriptExecution(JSONObject jsonObject);
|
Object groovyScriptExecution(JSONObject jsonObject);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,39 +25,84 @@ public class GroovyIntegrationServiceImpl implements IGroovyIntegrationService {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SysExtensionApiEntity groovyScriptExecution(JSONObject jsonObject) {
|
public Object groovyScriptExecution(JSONObject jsonObject) {
|
||||||
Object object = GroovyUtil.execute(jsonObject);
|
Object object = GroovyUtil.execute(jsonObject);
|
||||||
return new SysExtensionApiEntity();
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
java.lang.String str = "{\"project_org\":\"\",\"modify_time\":\"2024-06-17 16:52:34\",\"project_duty_dept\":null,\"project_name\":\"凯伍德组织档案\",\"document_rule_num\":1,\"add_status\":\"0\",\"delete_status\":\"1\",\"project_dutier\":\"\",\"id\":\"fb12734c8267488b96833633e68a7abc\",\"data_status\":\"F\",\"modify_user_id\":\"c796fd9ba4c9f5ff3cc2fa41a040e443\",\"sorts\":1,\"project_memo\":\"\",\"document_rule\":\"XM-2024-06-17-00001\",\"create_user_id\":\"c796fd9ba4c9f5ff3cc2fa41a040e443\",\"create_time\":\"2024-06-17 16:42:18\",\"company_id\":null,\"project_sh_name\":\"\",\"project_code\":\"01004\",\"project_currtype\":\"\",\"update_status\":\"0\",\"sts\":\"Y\",\"org_id\":\"0\",\"project_parentpro\":\"\",\"project_bill_type\":\"\"}";
|
java.lang.String str = "{\"data\":{\"pk_group\":\"00\",\"enablestate\":\"2\",\"code\":\"20240621001\",\"modify_time\":1718935555000,\"document_rule_num\":2,\"mdm_customer_bank\":[],\"add_status\":\"0\",\"custprop\":\"0\",\"delete_status\":\"1\",\"custstate\":\"1\",\"id\":\"d3d20ea680dc4bffaa7e5bf84764d62a\",\"data_status\":\"Y\",\"modify_user_id\":\"1\",\"sorts\":24,\"document_rule\":\"KH-2024-06-21-00002\",\"create_user_id\":\"1\",\"create_time\":1718935555000,\"company_id\":\"Y\",\"pk_country\":\"CN\",\"update_status\":\"1\",\"sts\":\"Y\",\"pk_custclass\":\"K01\",\"org_id\":\"Y\",\"name\":\"测试下发客户\",\"taxpayerid\":\"087982419238904359\"},\"query\":\"[]\",\"header\":\"[{\\\"parameterType\\\":\\\"fundamental\\\",\\\"length\\\":\\\"500\\\",\\\"index\\\":0,\\\"concreteType\\\":\\\"String\\\",\\\"description\\\":\\\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA87rrNR\\\",\\\"id\\\":\\\"421b73f0-5562-4bfe-b770-c8aca8878bfd\\\",\\\"parameterName\\\":\\\"pubKey\\\",\\\"required\\\":true,\\\"example\\\":\\\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA87rrNREgMNeOEOwlvM2iqqEfshDadRHziDSB2PbRnoMqSv1nGr3XBlZuseNj5HmxDEkLhOdfyw0yjzoz3wK7XhFpeN4Iyf7NT7hps5jAQMEpnul9Qwmj5qUr/eK5SaO9H8n7sh9BvCdrX9oRUh+U2/ceA3O+y/MUHk5DRvSadc8FhpqbOaNBbAzPnyYAwpVUPvaJ90jcGN1ZG99HR1GEzC+Cn9s6vgt7dYL6ysMs36bSP47xraDSxpfr0CLwa6JV/9KjLIeqL1ZaMtK0CJ1zJGCBA6O6kgxeE9Ul7q2lSS6mPAEJ78izaTYsrjhLpKT+eTtFBOLFbiCrbLp8tVE5kwIDAQAB\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"length\\\":\\\"100\\\",\\\"index\\\":1,\\\"concreteType\\\":\\\"String\\\",\\\"description\\\":\\\"OA\\\",\\\"id\\\":\\\"5659424d-261d-43ed-9fff-657bd15c7a64\\\",\\\"parameterName\\\":\\\"client_id\\\",\\\"required\\\":true,\\\"example\\\":\\\"OA\\\"},{\\\"parameterType\\\":\\\"authport\\\",\\\"length\\\":\\\"100\\\",\\\"index\\\":2,\\\"concreteType\\\":\\\"String\\\",\\\"id\\\":\\\"d2c4477e-a0bb-4daa-97b4-3cf0b8445001\\\",\\\"parameterName\\\":\\\"access_token\\\",\\\"required\\\":true,\\\"example\\\":[\\\"attribute\\\",\\\"data\\\",\\\"access_token\\\"]}]\",\"body\":\"[{\\\"index\\\":0,\\\"id\\\":\\\"5ac44a3b-c0d5-4ae9-aec6-af6c4c8f59cc\\\",\\\"parameterName\\\":\\\"body\\\",\\\"first\\\":true}]\"}";
|
||||||
|
java.lang.String str1 = "com.alibaba.fastjson.JSONObject returnObject = new com.alibaba.fastjson.JSONObject();\n" +
|
||||||
|
" com.alibaba.fastjson.JSONObject bodys = new com.alibaba.fastjson.JSONObject();\n" +
|
||||||
|
"\n" +
|
||||||
|
" com.alibaba.fastjson.JSONObject reqData = com.alibaba.fastjson.JSON.parseObject(jsonStr);\n" +
|
||||||
|
" com.alibaba.fastjson.JSONObject data = reqData.getJSONObject(\"data\");\n" +
|
||||||
|
" com.alibaba.fastjson.JSONObject ufinterfaceObject = new com.alibaba.fastjson.JSONObject();\n" +
|
||||||
|
" ufinterfaceObject.put(\"billtype\", \"customer\");\n" +
|
||||||
|
" ufinterfaceObject.put(\"isexchange\", \"Y\");\n" +
|
||||||
|
" ufinterfaceObject.put(\"replace\", \"Y\");\n" +
|
||||||
|
" ufinterfaceObject.put(\"sender\", \"OA\");\n" +
|
||||||
|
" ufinterfaceObject.put(\"account\", \"01\");\n" +
|
||||||
|
" ufinterfaceObject.put(\"groupcode\", \"00\");\n" +
|
||||||
|
" com.alibaba.fastjson.JSONObject billObject = new com.alibaba.fastjson.JSONObject();\n" +
|
||||||
|
" com.alibaba.fastjson.JSONObject billheadObject = new com.alibaba.fastjson.JSONObject();\n" +
|
||||||
|
" billheadObject.put(\"code\", data.get(\"code\"));\n" +
|
||||||
|
" billheadObject.put(\"custprop\", data.get(\"custprop\"));\n" +
|
||||||
|
" billheadObject.put(\"custstate\", data.get(\"custstate\"));\n" +
|
||||||
|
" billheadObject.put(\"pk_custclass\", data.get(\"pk_custclass\"));\n" +
|
||||||
|
" billheadObject.put(\"pk_country\", data.get(\"pk_country\"));\n" +
|
||||||
|
" billheadObject.put(\"pk_timezone\", \"P0800\");\n" +
|
||||||
|
" billheadObject.put(\"pk_format\", \"ZH-CN\");\n" +
|
||||||
|
" billheadObject.put(\"enablestate\", data.get(\"enablestate\"));\n" +
|
||||||
|
" billheadObject.put(\"name\", data.get(\"name\"));\n" +
|
||||||
|
" billheadObject.put(\"pk_group\", data.get(\"pk_group\"));\n" +
|
||||||
|
" billheadObject.put(\"pk_org\", data.get(\"pk_org\"));\n" +
|
||||||
|
" billheadObject.put(\"taxpayerid\", data.get(\"taxpayerid\"));\n" +
|
||||||
|
" billObject.put(\"billhead\", billheadObject);\n" +
|
||||||
|
" ufinterfaceObject.put(\"bill\", billObject);\n" +
|
||||||
|
" bodys.put(\"ufinterface\", ufinterfaceObject);\n" +
|
||||||
|
" returnObject.put(\"bodys\",bodys.toJSONString());\n" +
|
||||||
|
" return returnObject.toJSONString();".trim();
|
||||||
|
String newString =str1.replaceAll("\\s+", "");
|
||||||
A88772 s = new A88772();
|
A88772 s = new A88772();
|
||||||
s .execute(str);
|
s.execute(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static class A88772 {
|
static class A88772 {
|
||||||
String execute(String jsonStr) {
|
String execute(String jsonStr) {
|
||||||
com.alibaba.fastjson.JSONObject reqData = com.alibaba.fastjson.JSON.parseObject(jsonStr);
|
|
||||||
com.alibaba.fastjson.JSONObject returnObject = new com.alibaba.fastjson.JSONObject();
|
com.alibaba.fastjson.JSONObject returnObject = new com.alibaba.fastjson.JSONObject();
|
||||||
|
com.alibaba.fastjson.JSONObject bodys = new com.alibaba.fastjson.JSONObject();
|
||||||
|
|
||||||
|
com.alibaba.fastjson.JSONObject reqData = com.alibaba.fastjson.JSON.parseObject(jsonStr);
|
||||||
|
com.alibaba.fastjson.JSONObject data = reqData.getJSONObject("data");
|
||||||
com.alibaba.fastjson.JSONObject ufinterfaceObject = new com.alibaba.fastjson.JSONObject();
|
com.alibaba.fastjson.JSONObject ufinterfaceObject = new com.alibaba.fastjson.JSONObject();
|
||||||
ufinterfaceObject.put("billtype", "supplier"); ufinterfaceObject.put("isexchange", "Y");
|
ufinterfaceObject.put("billtype", "customer");
|
||||||
ufinterfaceObject.put("replace", "Y"); ufinterfaceObject.put("sender", "OA");
|
ufinterfaceObject.put("isexchange", "Y");
|
||||||
ufinterfaceObject.put("account", "01"); ufinterfaceObject.put("groupcode", "00");
|
ufinterfaceObject.put("replace", "Y");
|
||||||
|
ufinterfaceObject.put("sender", "OA");
|
||||||
|
ufinterfaceObject.put("account", "01");
|
||||||
|
ufinterfaceObject.put("groupcode", "00");
|
||||||
com.alibaba.fastjson.JSONObject billObject = new com.alibaba.fastjson.JSONObject();
|
com.alibaba.fastjson.JSONObject billObject = new com.alibaba.fastjson.JSONObject();
|
||||||
com.alibaba.fastjson.JSONObject billheadObject = new com.alibaba.fastjson.JSONObject();
|
com.alibaba.fastjson.JSONObject billheadObject = new com.alibaba.fastjson.JSONObject();
|
||||||
billheadObject.put("code", reqData.get("project_code")); billheadObject.put("supprop", "0");
|
billheadObject.put("code", data.get("code"));
|
||||||
billheadObject.put("custstate", "1"); billheadObject.put("pk_supplierclass", "S01");
|
billheadObject.put("custprop", data.get("custprop"));
|
||||||
billheadObject.put("pk_country", "CN"); billheadObject.put("pk_timezone", "P0800");
|
billheadObject.put("custstate", data.get("custstate"));
|
||||||
billheadObject.put("pk_format", "ZH-CN"); billheadObject.put("enablestate", "2");
|
billheadObject.put("pk_custclass", data.get("pk_custclass"));
|
||||||
billheadObject.put("name", reqData.get("project_sh_name")); billheadObject.put("pk_group", "00");
|
billheadObject.put("pk_country", data.get("pk_country"));
|
||||||
billheadObject.put("pk_org", "003"); billheadObject.put("taxpayerid", "087981489021135119");
|
billheadObject.put("pk_timezone", "P0800");
|
||||||
returnObject.put("ufinterface",ufinterfaceObject); billObject.put("billhead", billheadObject); returnObject.put("bill",billObject);
|
billheadObject.put("pk_format", "ZH-CN");
|
||||||
System.out.println( returnObject.toJSONString());
|
billheadObject.put("enablestate", data.get("enablestate"));
|
||||||
|
billheadObject.put("name", data.get("name"));
|
||||||
|
billheadObject.put("pk_group", data.get("pk_group"));
|
||||||
|
billheadObject.put("pk_org", data.get("pk_org"));
|
||||||
|
billheadObject.put("taxpayerid", data.get("taxpayerid"));
|
||||||
|
billObject.put("billhead", billheadObject);
|
||||||
|
ufinterfaceObject.put("bill", billObject);
|
||||||
|
bodys.put("ufinterface", ufinterfaceObject);
|
||||||
|
returnObject.put("bodys",bodys.toJSONString());
|
||||||
return returnObject.toJSONString();
|
return returnObject.toJSONString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue