主数据下发,重新发送

This commit is contained in:
lvleigang 2024-06-18 16:29:47 +08:00
parent 651c5d04b0
commit db50cf0c1a
20 changed files with 626 additions and 21 deletions

View File

@ -0,0 +1,422 @@
package com.hzya.frame.plugin.mdmDistribute.plugin;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.mdm.mdmModule.dao.IMdmModuleDao;
import com.hzya.frame.mdm.mdmModule.entity.MdmModuleEntity;
import com.hzya.frame.mdm.mdmModuleDb.entity.MdmModuleDbEntity;
import com.hzya.frame.mdm.mdmModuleDbFileds.entity.MdmModuleDbFiledsEntity;
import com.hzya.frame.mdm.mdmModuleDbFiledsRule.dao.IMdmModuleDbFiledsRuleDao;
import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity;
import com.hzya.frame.mdm.mdmModuleDistribute.dao.IMdmModuleDistributeDao;
import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity;
import com.hzya.frame.mdm.service.IMdmServiceCache;
import com.hzya.frame.sysnew.application.api.dao.ISysApplicationApiDao;
import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity;
import com.hzya.frame.sysnew.application.dao.ISysApplicationDao;
import com.hzya.frame.sysnew.application.entity.SysApplicationEntity;
import com.hzya.frame.sysnew.application.script.dao.ISysApplicationScriptDao;
import com.hzya.frame.sysnew.application.script.entity.SysApplicationScriptEntity;
import com.hzya.frame.sysnew.grovy.service.IGroovyIntegrationService;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.dao.IIntegrationTaskLivingDetailsDao;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
import com.hzya.frame.sysnew.messageManageLog.entity.SysMessageManageLogEntity;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.http.HttpEntity;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import javax.annotation.Resource;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 主数据模版(MdmModule)表服务接口
*
* @author makejava
* @since 2024-06-18 10:33:32
*/
public class MdmModulePluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(MdmModulePluginInitializer.class);
@Resource
private IIntegrationTaskLivingDetailsDao integrationTaskLivingDetailsDao;
@Resource
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
@Resource
private ISysApplicationApiDao sysApplicationApiDao;
@Resource
private ISysApplicationDao sysApplicationDao;
@Resource
private ISysApplicationScriptDao sysApplicationScriptDao;
@Resource
private IMdmModuleDistributeDao mdmModuleDistributeDao;
@Resource
private IGroovyIntegrationService groovyIntegrationService;
@Resource
private IMdmModuleDbFiledsRuleDao mdmModuleDbFiledsRuleDao;
@Resource
private IMdmModuleDao mdmModuleDao;
@Resource
private IMdmServiceCache mdmServiceCache;
@Value("${ax.url}")
private String url ;
//多线程请求加锁 HttpRequest 构造方法是静态的
private final Object lock = new Object();
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
}
@Override
public void destroy() {
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
}
@Override
public String getPluginId() {
return "MdmModulePlugin";
}
@Override
public String getPluginName() {
return "MdmModulePlugin插件";
}
@Override
public String getPluginLabel() {
return "MdmModulePlugin";
}
@Override
public String getPluginType() {
return "1";
}
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) {
try{
//重试方法
if (null != requestJson) {
//如果这个id不为空说明是重试的
String id = requestJson.getString("integration_task_living_details_id");
if (StrUtil.isNotEmpty(id)) {
//查询日志表
IntegrationTaskLivingDetailsEntity taskDetailEntity = taskLivingDetailsService.get(id);
if (null != taskDetailEntity && JSONUtil.isTypeJSON(taskDetailEntity.getRootAppPk())){
//拿到这张表的源系统ID
JSONObject jsonObject = JSONObject.parseObject(taskDetailEntity.getRootAppPk());
Long mdmCode = jsonObject.getLong("mdmCode");//主数据编码
String documentRule = jsonObject.getString("documentRule");//行数据的单据规则编码
String distributeId = jsonObject.getString("distributeId");//发送表id
String type = jsonObject.getString("type");//发送类型1新增2修改3删除
if(mdmCode == null || documentRule == null || distributeId == null || type == null
|| "".equals(mdmCode) || "".equals(documentRule) || "".equals(distributeId) || "".equals(type)){
taskDetailEntity.setResult("系统保存参数错误");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("系统保存参数错误");
}
String apiId = null;
String scriptId = null;
//查找对应数据组装数据发送
//获取主数据信息
MdmModuleEntity mdmModuleEntity = mdmServiceCache.getMdmModuleEntity(mdmCode);
if(mdmModuleEntity == null || mdmModuleEntity.getId() == null ){
taskDetailEntity.setResult("主数据不存在");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("主数据不存在");
}
//获取主数据db
MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
mdmModuleDbEntity.setMdmId(mdmModuleEntity.getId());
List<MdmModuleDbEntity> mdmModuleDbEntities = mdmServiceCache.queryMdmModuleDb(mdmModuleDbEntity);
if(mdmModuleDbEntities == null || mdmModuleDbEntities.size() == 0){
taskDetailEntity.setResult("主数据数据源不存在");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("主数据数据源不存在");
}
//获取分发表
//获取分发的接口
MdmModuleDistributeEntity mdmModuleDistributeEntity = mdmModuleDistributeDao.get(distributeId);
if(mdmModuleDistributeEntity == null || mdmModuleDistributeEntity.getId() == null ){
taskDetailEntity.setResult("分发不存在");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("分发不存在");
}
// 启用停用 0停用
if("0".equals(mdmModuleDistributeEntity.getEnabledState())){
taskDetailEntity.setResult("分发已停用");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("分发已停用");
}
// 启用停用 0停用
//if("1".equals(mdmModuleDistributeEntity.getEnabledType())){
// taskDetailEntity.setResult("分发为手动下发");
// taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
// return BaseResult.getFailureMessageEntity("分发为手动下发");
//}
//1新增2修改3删除
if("1".equals(type)){
apiId = mdmModuleDistributeEntity.getAddApi();
scriptId = mdmModuleDistributeEntity.getAddScript();
}else if("2".equals(type)){
apiId = mdmModuleDistributeEntity.getUpdateApi();
scriptId = mdmModuleDistributeEntity.getUpdateScript();
}else if("3".equals(type)){
apiId = mdmModuleDistributeEntity.getDeleteApi();
scriptId = mdmModuleDistributeEntity.getDeleteScript();
}
if(apiId == null || "".equals(apiId)){
taskDetailEntity.setResult("分发接口未选择,请先选择");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("分发接口未选择,请先选择");
}
SysApplicationScriptEntity scriptEntity = null;
if(scriptId != null && !"".equals(scriptId)){
scriptEntity = sysApplicationScriptDao.get(scriptId);
if(scriptEntity == null || scriptEntity.getId() == null ){
taskDetailEntity.setResult("分发接口脚本不存在");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("分发接口脚本不存在");
}
}
SysApplicationApiEntity apiEntity = sysApplicationApiDao.get(apiId);
if(apiEntity == null || apiEntity.getId() == null ){
taskDetailEntity.setResult("分发接口不存在");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("分发接口不存在");
}
SysApplicationEntity sysApplicationEntity = sysApplicationDao.get(apiEntity.getAppId());
if(sysApplicationEntity == null || sysApplicationEntity.getId() == null ){
taskDetailEntity.setResult("应用不存在");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("应用不存在");
}
//获取主数据db字段以及字段的规则
MdmModuleDbFiledsEntity queryFild = new MdmModuleDbFiledsEntity();
queryFild.setMdmId(mdmModuleEntity.getId());
List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities = mdmServiceCache.queryMdmModuleDbFileds(queryFild);
MdmModuleDbFiledsRuleEntity queryFildRule = new MdmModuleDbFiledsRuleEntity();
queryFildRule.setMdmId(mdmModuleEntity.getId());
queryFildRule.setRuleCode("service");
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule);
//获取主数据db对应的实体表的数据
JSONObject object = new JSONObject();
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
if("1".equals(mdmModuleDbEntities.get(i).getDbType())){
Map<String,String> map = new HashMap<>();
map.put("tableName",mdmModuleDbEntities.get(i).getDbName());
map.put("documentRule",documentRule);
object = mdmModuleDao.queryMdmST(map);
if(object.getString("id") == null || "".equals(object.getString("id")) ){
taskDetailEntity.setResult("当前数据不存在");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("当前数据不存在");
}
//查看主表是否有字段是关联的
if(mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0){
for (int i1 = 0; i1 < mdmModuleDbFiledsRuleEntities.size(); i1++) {
if(mdmModuleDbFiledsRuleEntities.get(i1).getDbId().equals(mdmModuleDbEntities.get(i).getId())){
if(mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0){
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
if(mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())){
Map<String,String> mapDetail = new HashMap<>();
mapDetail.put("tableName",mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
mapDetail.put("id",object.getString(mdmModuleDbFiledsEntities.get(i2).getEnName()));
JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
object.put(mdmModuleDbFiledsEntities.get(i2).getEnName(),objectDetail);
}
}
}
}
}
}
}
}
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
if("2".equals(mdmModuleDbEntities.get(i).getDbType())){
Map<String,String> map = new HashMap<>();
map.put("tableName",mdmModuleDbEntities.get(i).getDbName());
map.put("formmainId",object.getString("id"));
List<JSONObject> detail = mdmModuleDao.queryMdmSTDetail(map);
//查看主表是否有字段是关联的
if(detail != null && detail.size() > 0){
if(mdmModuleDbFiledsRuleEntities != null && mdmModuleDbFiledsRuleEntities.size() > 0){
for (int i1 = 0; i1 < mdmModuleDbFiledsRuleEntities.size(); i1++) {
if(mdmModuleDbFiledsRuleEntities.get(i1).getDbId().equals(mdmModuleDbEntities.get(i).getId())){
if(mdmModuleDbFiledsEntities != null && mdmModuleDbFiledsEntities.size() > 0){
for (int i2 = 0; i2 < mdmModuleDbFiledsEntities.size(); i2++) {
if(mdmModuleDbFiledsRuleEntities.get(i1).getFiledId().equals(mdmModuleDbFiledsEntities.get(i2).getId())){
for (int i3 = 0; i3 < detail.size(); i3++) {
Map<String,String> mapDetail = new HashMap<>();
mapDetail.put("tableName",mdmModuleDbFiledsRuleEntities.get(i1).getRuleValue());
mapDetail.put("id",detail.get(i3).getString(mdmModuleDbFiledsEntities.get(i2).getEnName()));
JSONObject objectDetail = mdmModuleDao.queryMdmST(mapDetail);
detail.get(i3).put(mdmModuleDbFiledsEntities.get(i2).getEnName(),objectDetail);
}
}
}
}
}
}
}
}
object.put(mdmModuleDbEntities.get(i).getDbName(),detail);
}
}
//执行脚本
JSONObject groovy = new JSONObject();
JSONObject parameterJson = new JSONObject();
parameterJson.put("header",apiEntity.getHeaderInValue());
//parameterJson.put("body",apiEntity.getBodyIn());
parameterJson.put("data",object);
if(scriptEntity != null && scriptEntity.getId() != null ){
groovy.put("code",scriptEntity.getScriptCode());
groovy.put("className",scriptEntity.getClassName());
groovy.put("name",scriptEntity.getScriptName());
groovy.put("methodStr",scriptEntity.getScriptData());
groovy.put("parameterJson",parameterJson);
try {
JsonResultEntity jsonResultEntity = groovyIntegrationService.groovyScriptExecution(groovy);
if(!jsonResultEntity.isFlag()){
taskDetailEntity.setResult("分发脚本转换错误");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("分发脚本转换错误");
}
JSONObject returnGroovy = JSONObject.parseObject(jsonResultEntity.getAttribute().toString());
}catch (Exception e){
taskDetailEntity.setResult("分发脚本转换错误");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("分发脚本转换错误");
}
}
Map<String, String> headers = new HashMap<>();
headers.put("publicKey","ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj");
headers.put("secretKey","fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=");
headers.put("appId",sysApplicationEntity.getAppId().toString());
headers.put("apiCode",apiEntity.getApiCode().toString());
//组装数据发送
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,object.toJSONString());
if(jsonResultEntity.isFlag()){
taskDetailEntity.setResult("发送成功");
taskLivingDetailsService.saveLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("发送成功");
}else {
taskDetailEntity.setResult("发送错误");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("发送错误");
}
}
}else {
//执行正常逻辑
}
}
logger.info("执行成功");
return BaseResult.getSuccessMessageEntity("执行成功");
} catch (Exception e) {
logger.error("执行失败{}",e.getMessage());
}
return BaseResult.getSuccessMessageEntity("执行成功");
}
private JsonResultEntity sendData(SysApplicationApiEntity applicationApiEntity, Map<String, String> headers ,String bodys ) {
StringBuffer urls = new StringBuffer(url);
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
// HttpClient
CloseableHttpClient closeableHttpClient = httpClientBuilder.disableCookieManagement().build();
HttpPost post = new HttpPost(urls.toString());
CloseableHttpResponse response = null;
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(Integer.valueOf(applicationApiEntity.getTimeoutPeriod())).build();
post.setConfig(requestConfig);//设置请求参数超时时间
if (headers != null && headers.size() > 0) {
for (String key : headers.keySet()) {
post.setHeader(key, headers.get(key));
}
}
StringBuilder body = new StringBuilder();
boolean flag = true;
try {
if (bodys != null && !"".equals(bodys)) {
ByteArrayEntity entity = new ByteArrayEntity(bodys.getBytes("UTF-8"));
entity.setContentType("application/json");
post.setEntity(entity);
}
response = closeableHttpClient.execute(post);
HttpEntity entity = response.getEntity();
synchronized (lock) {
body.append(EntityUtils.toString(entity,"UTF-8"));
}
flag = true;
logger.info("返回结果:" + body);
} catch (Exception e) {
logger.error("请求错误:" + e.getMessage());
body.append(e.getMessage());
flag = false;
} finally {
try {
// 关闭响应对象
if (response != null) {
response.close();
}
// 关闭响应对象
if (closeableHttpClient != null) {
closeableHttpClient.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
if (flag) {
if (JSONUtil.isTypeJSON(body.toString())) {
JsonResultEntity jsonResultEntity = JSONObject.parseObject(body.toString(),JsonResultEntity.class);
if(jsonResultEntity.isFlag()){
return BaseResult.getSuccessMessageEntity("转发成功", body);
}else {
return BaseResult.getFailureMessageEntity("转发失败", body);
}
}else {
return BaseResult.getFailureMessageEntity("转发失败", body);
}
} else {
return BaseResult.getFailureMessageEntity("转发失败", body);
}
}
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<id>MdmModulePlugin</id>
<name>MdmModulePlugin插件</name>
<category>90000001</category>
</plugin>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans default-autowire="byName">
<bean name="mdmModuleInitializer" class="com.hzya.frame.plugin.mdmDistribute.plugin.MdmModulePluginInitializer" />
</beans>

View File

@ -2,6 +2,7 @@ package com.hzya.frame;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.plugin.mdmDistribute.plugin.MdmModulePluginInitializer;
import com.hzya.frame.plugin.seeyonExt.plugin.SeeyonExtPluginInitializer; import com.hzya.frame.plugin.seeyonExt.plugin.SeeyonExtPluginInitializer;
import com.hzya.frame.util.AESUtil; import com.hzya.frame.util.AESUtil;
import org.junit.Test; import org.junit.Test;
@ -23,6 +24,8 @@ public class temButtom {
@Resource @Resource
SeeyonExtPluginInitializer seeyonExtPluginInitializer; SeeyonExtPluginInitializer seeyonExtPluginInitializer;
@Resource
MdmModulePluginInitializer mdmModulePluginInitializer;
@Test @Test
public void seeyonExtTest(){ public void seeyonExtTest(){
JSONObject jsonStr = new JSONObject(); JSONObject jsonStr = new JSONObject();
@ -36,6 +39,17 @@ public class temButtom {
} }
} }
@Test
public void mdm(){
JSONObject jsonStr = new JSONObject();
jsonStr.put("integration_task_living_details_id","123123123123");
try {
mdmModulePluginInitializer.executeBusiness(jsonStr);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Test @Test
public void test01() { public void test01() {
String a = AESUtil.encrypt("hzya@1314"); String a = AESUtil.encrypt("hzya@1314");

View File

@ -1,5 +1,6 @@
package com.hzya.frame.mdm.mdmModule.dao; package com.hzya.frame.mdm.mdmModule.dao;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.mdm.entity.MdmDataDto; import com.hzya.frame.mdm.entity.MdmDataDto;
import com.hzya.frame.mdm.entity.MdmDto; import com.hzya.frame.mdm.entity.MdmDto;
import com.hzya.frame.mdm.entity.MdmQuery; import com.hzya.frame.mdm.entity.MdmQuery;
@ -47,5 +48,9 @@ public interface IMdmModuleDao extends IBaseDao<MdmModuleEntity, String> {
Integer deleteTable(Map<String, Object> maps); Integer deleteTable(Map<String, Object> maps);
JSONObject queryMdmST(Map<String, String> maps);
List<JSONObject> queryMdmSTDetail(Map<String, String> maps);
} }

View File

@ -1,5 +1,6 @@
package com.hzya.frame.mdm.mdmModule.dao.impl; package com.hzya.frame.mdm.mdmModule.dao.impl;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.mdm.entity.MdmDataDto; import com.hzya.frame.mdm.entity.MdmDataDto;
import com.hzya.frame.mdm.entity.MdmDto; import com.hzya.frame.mdm.entity.MdmDto;
import com.hzya.frame.mdm.entity.MdmQuery; import com.hzya.frame.mdm.entity.MdmQuery;
@ -125,6 +126,9 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
Integer o = (Integer) super.delete(getSqlIdPrifx() + "deleteTable", maps); Integer o = (Integer) super.delete(getSqlIdPrifx() + "deleteTable", maps);
return o; return o;
} }
@Override @Override
public Integer alterTable(Map<String, Object> maps) { public Integer alterTable(Map<String, Object> maps) {
Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "alterTable", maps); Integer o = (Integer) super.selectOne(getSqlIdPrifx() + "alterTable", maps);
@ -142,5 +146,18 @@ public class MdmModuleDaoImpl extends MybatisGenericDao<MdmModuleEntity, String>
return o; return o;
} }
@Override
public JSONObject queryMdmST(Map<String, String> maps) {
JSONObject o = (JSONObject) super.selectOne(getSqlIdPrifx() + "queryMdmST", maps);
return o;
}
@Override
public List<JSONObject> queryMdmSTDetail(Map<String, String> maps) {
List<JSONObject> o = (List<JSONObject>) super.selectList(getSqlIdPrifx() + "queryMdmSTDetail", maps);
return o;
}
} }

View File

@ -792,5 +792,23 @@ where id = #{id}
<select id="queryMainCount" resultType="Integer" parameterType="com.hzya.frame.mdm.entity.MdmQuery"> <select id="queryMainCount" resultType="Integer" parameterType="com.hzya.frame.mdm.entity.MdmQuery">
select count(1) from ${tableName} where sts='Y' select count(1) from ${tableName} where sts='Y'
</select> </select>
<!-- 分页查询列表 采用like格式 -->
<select id="queryMdmST" resultType="com.alibaba.fastjson.JSONObject"
parameterType="java.util.HashMap">
select * from ${tableName}
<trim prefix="where" prefixOverrides="and">
<if test="documentRule != null and documentRule !='' ">and document_rule = #{documentRule}</if>
<if test="id != null and id !='' ">and id = #{id}</if>
and sts = 'Y'
</trim>
</select>
<!-- 分页查询列表 采用like格式 -->
<select id="queryMdmSTDetail" resultType="com.alibaba.fastjson.JSONObject"
parameterType="java.util.HashMap">
select * from ${tableName} where sts='Y' and formmain_id = #{formmainId}
</select>
</mapper> </mapper>

View File

@ -495,6 +495,16 @@ public class MdmModuleServiceImpl extends BaseService<MdmModuleEntity, String> i
//新增 设置日志表 //新增 设置日志表
setMdmField(mdmModuleDbEntity1, mdmModuleDbFiledsEntities); setMdmField(mdmModuleDbEntity1, mdmModuleDbFiledsEntities);
} }
for (int i = 0; i < mdmModuleDbEntities.size(); i++) {
//查看表是否存在
MdmModuleDbEntity mdmModuleDbEntity = new MdmModuleDbEntity();
mdmModuleDbEntity.setDbName(mdmModuleDbEntities.get(i).getDbName());
mdmModuleDbEntity.setSts("Y");
int a = mdmModuleDbDao.getCount(mdmModuleDbEntity);
if(a > 0){
return BaseResult.getFailureMessageEntity("表已存在,请修改");
}
}
mdmServiceCache.saveOrUpdateMdmModuleDb(entity.getMdmId(), mdmModuleDbEntities); mdmServiceCache.saveOrUpdateMdmModuleDb(entity.getMdmId(), mdmModuleDbEntities);
mdmServiceCache.saveOrUpdateMdmModuleDbFileds(entity.getMdmId(), mdmModuleDbFiledsEntities); mdmServiceCache.saveOrUpdateMdmModuleDbFileds(entity.getMdmId(), mdmModuleDbFiledsEntities);

View File

@ -1,11 +1,9 @@
package com.hzya.frame.mdm.mdmModuleDbFileds.entity; package com.hzya.frame.mdm.mdmModuleDbFileds.entity;
import java.util.Date;
import java.util.List; import java.util.List;
import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity; import com.hzya.frame.mdm.mdmModuleDbFiledsRule.entity.MdmModuleDbFiledsRuleEntity;
import com.hzya.frame.web.entity.BaseEntity; import com.hzya.frame.web.entity.BaseEntity;
import org.apache.poi.ss.formula.functions.T;
/** /**
* 模版数据库字段表(MdmModuleDbFileds)实体类 * 模版数据库字段表(MdmModuleDbFileds)实体类

View File

@ -7,7 +7,7 @@ import com.hzya.frame.basedao.dao.IBaseDao;
* 主数据功能应用分发表(mdm_module_distribute: table)表数据库访问层 * 主数据功能应用分发表(mdm_module_distribute: table)表数据库访问层
* *
* @author makejava * @author makejava
* @since 2024-06-17 11:05:32 * @since 2024-06-18 11:39:46
*/ */
public interface IMdmModuleDistributeDao extends IBaseDao<MdmModuleDistributeEntity, String> { public interface IMdmModuleDistributeDao extends IBaseDao<MdmModuleDistributeEntity, String> {

View File

@ -8,7 +8,7 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao;
* 主数据功能应用分发表(MdmModuleDistribute)表数据库访问层 * 主数据功能应用分发表(MdmModuleDistribute)表数据库访问层
* *
* @author makejava * @author makejava
* @since 2024-06-17 11:05:32 * @since 2024-06-18 11:39:46
*/ */
@Repository(value = "MdmModuleDistributeDaoImpl") @Repository(value = "MdmModuleDistributeDaoImpl")
public class MdmModuleDistributeDaoImpl extends MybatisGenericDao<MdmModuleDistributeEntity, String> implements IMdmModuleDistributeDao{ public class MdmModuleDistributeDaoImpl extends MybatisGenericDao<MdmModuleDistributeEntity, String> implements IMdmModuleDistributeDao{

View File

@ -9,7 +9,7 @@ import com.hzya.frame.web.entity.BaseEntity;
* 主数据功能应用分发表(MdmModuleDistribute)实体类 * 主数据功能应用分发表(MdmModuleDistribute)实体类
* *
* @author makejava * @author makejava
* @since 2024-06-17 11:05:33 * @since 2024-06-18 11:39:46
*/ */
public class MdmModuleDistributeEntity extends BaseEntity { public class MdmModuleDistributeEntity extends BaseEntity {
@ -17,6 +17,8 @@ public class MdmModuleDistributeEntity extends BaseEntity {
private String mdmId; private String mdmId;
/** 应用id */ /** 应用id */
private String appId; private String appId;
/** 触发类型 0、手动1、自动 */
private String enabledType;
/** 修改接口 */ /** 修改接口 */
private String updateApi; private String updateApi;
/** 修改插件 */ /** 修改插件 */
@ -35,8 +37,9 @@ public class MdmModuleDistributeEntity extends BaseEntity {
private String dbId; private String dbId;
/** 公司id */ /** 公司id */
private String companyId; private String companyId;
/** 公司id */
private List<MdmModuleDistributeDetailEntity> mdmModuleDistributeDetailEntities;
private List<MdmModuleDistributeDetailEntity> mdmModuleDistributeDetailEntities;
public String getMdmId() { public String getMdmId() {
return mdmId; return mdmId;
@ -54,6 +57,14 @@ public class MdmModuleDistributeEntity extends BaseEntity {
this.appId = appId; this.appId = appId;
} }
public String getEnabledType() {
return enabledType;
}
public void setEnabledType(String enabledType) {
this.enabledType = enabledType;
}
public String getUpdateApi() { public String getUpdateApi() {
return updateApi; return updateApi;
} }

View File

@ -6,6 +6,7 @@
<result property="id" column="id" jdbcType="VARCHAR"/> <result property="id" column="id" jdbcType="VARCHAR"/>
<result property="mdmId" column="mdm_id" jdbcType="VARCHAR"/> <result property="mdmId" column="mdm_id" jdbcType="VARCHAR"/>
<result property="appId" column="app_id" jdbcType="VARCHAR"/> <result property="appId" column="app_id" jdbcType="VARCHAR"/>
<result property="enabledType" column="enabled_type" jdbcType="VARCHAR"/>
<result property="updateApi" column="update_api" jdbcType="VARCHAR"/> <result property="updateApi" column="update_api" jdbcType="VARCHAR"/>
<result property="updateScript" column="update_script" jdbcType="VARCHAR"/> <result property="updateScript" column="update_script" jdbcType="VARCHAR"/>
<result property="addApi" column="add_api" jdbcType="VARCHAR"/> <result property="addApi" column="add_api" jdbcType="VARCHAR"/>
@ -28,6 +29,7 @@
id id
,mdm_id ,mdm_id
,app_id ,app_id
,enabled_type
,update_api ,update_api
,update_script ,update_script
,add_api ,add_api
@ -45,6 +47,13 @@
,org_id ,org_id
,company_id ,company_id
</sql> </sql>
<!--通过ID获取数据 -->
<select id="entity_get" resultMap="get-MdmModuleDistributeEntity-result">
select
<include refid="MdmModuleDistributeEntity_Base_Column_List" />
from mdm_module_distribute where id = #{ id } and sts='Y'
</select>
<!-- 查询 采用==查询 --> <!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-MdmModuleDistributeEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity"> <select id="entity_list_base" resultMap="get-MdmModuleDistributeEntity-result" parameterType = "com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity">
select select
@ -54,6 +63,7 @@
<if test="id != null and id != ''"> and id = #{id} </if> <if test="id != null and id != ''"> and id = #{id} </if>
<if test="mdmId != null and mdmId != ''"> and mdm_id = #{mdmId} </if> <if test="mdmId != null and mdmId != ''"> and mdm_id = #{mdmId} </if>
<if test="appId != null and appId != ''"> and app_id = #{appId} </if> <if test="appId != null and appId != ''"> and app_id = #{appId} </if>
<if test="enabledType != null and enabledType != ''"> and enabled_type = #{enabledType} </if>
<if test="updateApi != null and updateApi != ''"> and update_api = #{updateApi} </if> <if test="updateApi != null and updateApi != ''"> and update_api = #{updateApi} </if>
<if test="updateScript != null and updateScript != ''"> and update_script = #{updateScript} </if> <if test="updateScript != null and updateScript != ''"> and update_script = #{updateScript} </if>
<if test="addApi != null and addApi != ''"> and add_api = #{addApi} </if> <if test="addApi != null and addApi != ''"> and add_api = #{addApi} </if>
@ -83,6 +93,7 @@
<if test="id != null and id != ''"> and id = #{id} </if> <if test="id != null and id != ''"> and id = #{id} </if>
<if test="mdmId != null and mdmId != ''"> and mdm_id = #{mdmId} </if> <if test="mdmId != null and mdmId != ''"> and mdm_id = #{mdmId} </if>
<if test="appId != null and appId != ''"> and app_id = #{appId} </if> <if test="appId != null and appId != ''"> and app_id = #{appId} </if>
<if test="enabledType != null and enabledType != ''"> and enabled_type = #{enabledType} </if>
<if test="updateApi != null and updateApi != ''"> and update_api = #{updateApi} </if> <if test="updateApi != null and updateApi != ''"> and update_api = #{updateApi} </if>
<if test="updateScript != null and updateScript != ''"> and update_script = #{updateScript} </if> <if test="updateScript != null and updateScript != ''"> and update_script = #{updateScript} </if>
<if test="addApi != null and addApi != ''"> and add_api = #{addApi} </if> <if test="addApi != null and addApi != ''"> and add_api = #{addApi} </if>
@ -114,6 +125,7 @@
<if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if> <if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
<if test="mdmId != null and mdmId != ''"> and mdm_id like concat('%',#{mdmId},'%') </if> <if test="mdmId != null and mdmId != ''"> and mdm_id like concat('%',#{mdmId},'%') </if>
<if test="appId != null and appId != ''"> and app_id like concat('%',#{appId},'%') </if> <if test="appId != null and appId != ''"> and app_id like concat('%',#{appId},'%') </if>
<if test="enabledType != null and enabledType != ''"> and enabled_type like concat('%',#{enabledType},'%') </if>
<if test="updateApi != null and updateApi != ''"> and update_api like concat('%',#{updateApi},'%') </if> <if test="updateApi != null and updateApi != ''"> and update_api like concat('%',#{updateApi},'%') </if>
<if test="updateScript != null and updateScript != ''"> and update_script like concat('%',#{updateScript},'%') </if> <if test="updateScript != null and updateScript != ''"> and update_script like concat('%',#{updateScript},'%') </if>
<if test="addApi != null and addApi != ''"> and add_api like concat('%',#{addApi},'%') </if> <if test="addApi != null and addApi != ''"> and add_api like concat('%',#{addApi},'%') </if>
@ -145,6 +157,7 @@
<if test="id != null and id != ''"> or id = #{id} </if> <if test="id != null and id != ''"> or id = #{id} </if>
<if test="mdmId != null and mdmId != ''"> or mdm_id = #{mdmId} </if> <if test="mdmId != null and mdmId != ''"> or mdm_id = #{mdmId} </if>
<if test="appId != null and appId != ''"> or app_id = #{appId} </if> <if test="appId != null and appId != ''"> or app_id = #{appId} </if>
<if test="enabledType != null and enabledType != ''"> or enabled_type = #{enabledType} </if>
<if test="updateApi != null and updateApi != ''"> or update_api = #{updateApi} </if> <if test="updateApi != null and updateApi != ''"> or update_api = #{updateApi} </if>
<if test="updateScript != null and updateScript != ''"> or update_script = #{updateScript} </if> <if test="updateScript != null and updateScript != ''"> or update_script = #{updateScript} </if>
<if test="addApi != null and addApi != ''"> or add_api = #{addApi} </if> <if test="addApi != null and addApi != ''"> or add_api = #{addApi} </if>
@ -168,12 +181,13 @@
</select> </select>
<!--新增所有列--> <!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity" > <insert id="entity_insert" parameterType = "com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity" keyProperty="id" useGeneratedKeys="true">
insert into mdm_module_distribute( insert into mdm_module_distribute(
<trim suffix="" suffixOverrides=","> <trim suffix="" suffixOverrides=",">
<if test="id != null and id != ''"> id , </if> <if test="id != null and id != ''"> id , </if>
<if test="mdmId != null and mdmId != ''"> mdm_id , </if> <if test="mdmId != null and mdmId != ''"> mdm_id , </if>
<if test="appId != null and appId != ''"> app_id , </if> <if test="appId != null and appId != ''"> app_id , </if>
<if test="enabledType != null and enabledType != ''"> enabled_type , </if>
<if test="updateApi != null and updateApi != ''"> update_api , </if> <if test="updateApi != null and updateApi != ''"> update_api , </if>
<if test="updateScript != null and updateScript != ''"> update_script , </if> <if test="updateScript != null and updateScript != ''"> update_script , </if>
<if test="addApi != null and addApi != ''"> add_api , </if> <if test="addApi != null and addApi != ''"> add_api , </if>
@ -190,6 +204,7 @@
<if test="sts != null and sts != ''"> sts , </if> <if test="sts != null and sts != ''"> sts , </if>
<if test="org_id != null and org_id != ''"> org_id , </if> <if test="org_id != null and org_id != ''"> org_id , </if>
<if test="companyId != null and companyId != ''"> company_id , </if> <if test="companyId != null and companyId != ''"> company_id , </if>
<if test="sorts == null ">sorts,</if>
<if test="sts == null ">sts,</if> <if test="sts == null ">sts,</if>
</trim> </trim>
)values( )values(
@ -197,6 +212,7 @@
<if test="id != null and id != ''"> #{id} ,</if> <if test="id != null and id != ''"> #{id} ,</if>
<if test="mdmId != null and mdmId != ''"> #{mdmId} ,</if> <if test="mdmId != null and mdmId != ''"> #{mdmId} ,</if>
<if test="appId != null and appId != ''"> #{appId} ,</if> <if test="appId != null and appId != ''"> #{appId} ,</if>
<if test="enabledType != null and enabledType != ''"> #{enabledType} ,</if>
<if test="updateApi != null and updateApi != ''"> #{updateApi} ,</if> <if test="updateApi != null and updateApi != ''"> #{updateApi} ,</if>
<if test="updateScript != null and updateScript != ''"> #{updateScript} ,</if> <if test="updateScript != null and updateScript != ''"> #{updateScript} ,</if>
<if test="addApi != null and addApi != ''"> #{addApi} ,</if> <if test="addApi != null and addApi != ''"> #{addApi} ,</if>
@ -213,28 +229,30 @@
<if test="sts != null and sts != ''"> #{sts} ,</if> <if test="sts != null and sts != ''"> #{sts} ,</if>
<if test="org_id != null and org_id != ''"> #{org_id} ,</if> <if test="org_id != null and org_id != ''"> #{org_id} ,</if>
<if test="companyId != null and companyId != ''"> #{companyId} ,</if> <if test="companyId != null and companyId != ''"> #{companyId} ,</if>
<if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from mdm_module_distribute a WHERE a.sts = 'Y' ),</if>
<if test="sts == null ">'Y',</if> <if test="sts == null ">'Y',</if>
</trim> </trim>
) )
</insert> </insert>
<!-- 批量新增 --> <!-- 批量新增 -->
<insert id="entityInsertBatch" > <insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
insert into mdm_module_distribute(mdm_id, app_id, update_api, update_script, add_api, add_script, delete_api, delete_script, enabled_state, db_id, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts) insert into mdm_module_distribute(mdm_id, app_id, enabled_type, update_api, update_script, add_api, add_script, delete_api, delete_script, enabled_state, db_id, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id, sts)
values values
<foreach collection="entities" item="entity" separator=","> <foreach collection="entities" item="entity" separator=",">
(#{entity.mdmId},#{entity.appId},#{entity.updateApi},#{entity.updateScript},#{entity.addApi},#{entity.addScript},#{entity.deleteApi},#{entity.deleteScript},#{entity.enabledState},#{entity.dbId},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y') (#{entity.mdmId},#{entity.appId},#{entity.enabledType},#{entity.updateApi},#{entity.updateScript},#{entity.addApi},#{entity.addScript},#{entity.deleteApi},#{entity.deleteScript},#{entity.enabledState},#{entity.dbId},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}, 'Y')
</foreach> </foreach>
</insert> </insert>
<!-- 批量新增或者修改--> <!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" > <insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into mdm_module_distribute(mdm_id, app_id, update_api, update_script, add_api, add_script, delete_api, delete_script, enabled_state, db_id, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id) insert into mdm_module_distribute(mdm_id, app_id, enabled_type, update_api, update_script, add_api, add_script, delete_api, delete_script, enabled_state, db_id, create_user_id, create_time, modify_user_id, modify_time, sts, org_id, company_id)
values values
<foreach collection="entities" item="entity" separator=","> <foreach collection="entities" item="entity" separator=",">
(#{entity.mdmId},#{entity.appId},#{entity.updateApi},#{entity.updateScript},#{entity.addApi},#{entity.addScript},#{entity.deleteApi},#{entity.deleteScript},#{entity.enabledState},#{entity.dbId},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId}) (#{entity.mdmId},#{entity.appId},#{entity.enabledType},#{entity.updateApi},#{entity.updateScript},#{entity.addApi},#{entity.addScript},#{entity.deleteApi},#{entity.deleteScript},#{entity.enabledState},#{entity.dbId},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},#{entity.companyId})
</foreach> </foreach>
on duplicate key update on duplicate key update
mdm_id = values(mdm_id), mdm_id = values(mdm_id),
app_id = values(app_id), app_id = values(app_id),
enabled_type = values(enabled_type),
update_api = values(update_api), update_api = values(update_api),
update_script = values(update_script), update_script = values(update_script),
add_api = values(add_api), add_api = values(add_api),
@ -256,6 +274,7 @@ update mdm_module_distribute set
<trim suffix="" suffixOverrides=","> <trim suffix="" suffixOverrides=",">
<if test="mdmId != null and mdmId != ''"> mdm_id = #{mdmId},</if> <if test="mdmId != null and mdmId != ''"> mdm_id = #{mdmId},</if>
<if test="appId != null and appId != ''"> app_id = #{appId},</if> <if test="appId != null and appId != ''"> app_id = #{appId},</if>
<if test="enabledType != null and enabledType != ''"> enabled_type = #{enabledType},</if>
<if test="updateApi != null and updateApi != ''"> update_api = #{updateApi},</if> <if test="updateApi != null and updateApi != ''"> update_api = #{updateApi},</if>
<if test="updateScript != null and updateScript != ''"> update_script = #{updateScript},</if> <if test="updateScript != null and updateScript != ''"> update_script = #{updateScript},</if>
<if test="addApi != null and addApi != ''"> add_api = #{addApi},</if> <if test="addApi != null and addApi != ''"> add_api = #{addApi},</if>
@ -286,6 +305,7 @@ update mdm_module_distribute set sts= 'N' ,modify_time = #{modify_time},modify_
<if test="id != null and id != ''"> and id = #{id} </if> <if test="id != null and id != ''"> and id = #{id} </if>
<if test="mdmId != null and mdmId != ''"> and mdm_id = #{mdmId} </if> <if test="mdmId != null and mdmId != ''"> and mdm_id = #{mdmId} </if>
<if test="appId != null and appId != ''"> and app_id = #{appId} </if> <if test="appId != null and appId != ''"> and app_id = #{appId} </if>
<if test="enabledType != null and enabledType != ''"> and enabled_type = #{enabledType} </if>
<if test="updateApi != null and updateApi != ''"> and update_api = #{updateApi} </if> <if test="updateApi != null and updateApi != ''"> and update_api = #{updateApi} </if>
<if test="updateScript != null and updateScript != ''"> and update_script = #{updateScript} </if> <if test="updateScript != null and updateScript != ''"> and update_script = #{updateScript} </if>
<if test="addApi != null and addApi != ''"> and add_api = #{addApi} </if> <if test="addApi != null and addApi != ''"> and add_api = #{addApi} </if>

View File

@ -6,7 +6,7 @@ import com.hzya.frame.basedao.service.IBaseService;
* 主数据功能应用分发表(MdmModuleDistribute)表服务接口 * 主数据功能应用分发表(MdmModuleDistribute)表服务接口
* *
* @author makejava * @author makejava
* @since 2024-06-17 11:05:33 * @since 2024-06-18 11:39:46
*/ */
public interface IMdmModuleDistributeService extends IBaseService<MdmModuleDistributeEntity, String>{ public interface IMdmModuleDistributeService extends IBaseService<MdmModuleDistributeEntity, String>{
} }

View File

@ -11,7 +11,7 @@ import com.hzya.frame.basedao.service.impl.BaseService;
* 主数据功能应用分发表(MdmModuleDistribute)表服务实现类 * 主数据功能应用分发表(MdmModuleDistribute)表服务实现类
* *
* @author makejava * @author makejava
* @since 2024-06-17 11:05:33 * @since 2024-06-18 11:39:46
*/ */
@Service(value = "mdmModuleDistributeService") @Service(value = "mdmModuleDistributeService")
public class MdmModuleDistributeServiceImpl extends BaseService<MdmModuleDistributeEntity, String> implements IMdmModuleDistributeService { public class MdmModuleDistributeServiceImpl extends BaseService<MdmModuleDistributeEntity, String> implements IMdmModuleDistributeService {

View File

@ -1,6 +1,11 @@
package com.hzya.frame.sysnew.application.api.entity; package com.hzya.frame.sysnew.application.api.entity;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.web.entity.BaseEntity; import com.hzya.frame.web.entity.BaseEntity;
/** /**
* 应用api(SysApplicationApi)实体类 * 应用api(SysApplicationApi)实体类
@ -291,5 +296,38 @@ public class SysApplicationApiEntity extends BaseEntity {
public void setReturnSuccessValue(String returnSuccessValue) { public void setReturnSuccessValue(String returnSuccessValue) {
this.returnSuccessValue = returnSuccessValue; this.returnSuccessValue = returnSuccessValue;
} }
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();
}
} }

View File

@ -59,7 +59,8 @@ public class SysApplicationDto {
private String systemAddress; private String systemAddress;
//api接口参数表 //api接口参数表
private List<SysApplicationApiParaEntity> apiParas; private List<SysApplicationApiParaEntity> apiParas;
/** 系统类型 1、致远OA 2、用友U8C 3、用友BIP */
private String appType;
//数据源 //数据源
private SysApplicationDatabaseEntity databaseEntity; private SysApplicationDatabaseEntity databaseEntity;
private Integer pageNum; private Integer pageNum;
@ -262,5 +263,13 @@ public class SysApplicationDto {
public void setSystemAddress(String systemAddress) { public void setSystemAddress(String systemAddress) {
this.systemAddress = systemAddress; this.systemAddress = systemAddress;
} }
public String getAppType() {
return appType;
}
public void setAppType(String appType) {
this.appType = appType;
}
} }

View File

@ -43,6 +43,8 @@ public class SysApplicationEntity extends BaseEntity {
/** 数据源是否启用1、开启 2、关闭 */ /** 数据源是否启用1、开启 2、关闭 */
private String dbStatus; private String dbStatus;
/** 系统类型 1、致远OA 2、用友U8C 3、用友BIP */
private String appType;
/** appid */ /** appid */
private Integer appId; private Integer appId;
/** ip白名单 */ /** ip白名单 */
@ -191,5 +193,13 @@ public class SysApplicationEntity extends BaseEntity {
public void setSystemAddress(String systemAddress) { public void setSystemAddress(String systemAddress) {
this.systemAddress = systemAddress; this.systemAddress = systemAddress;
} }
public String getAppType() {
return appType;
}
public void setAppType(String appType) {
this.appType = appType;
}
} }

View File

@ -22,6 +22,7 @@
<result property="interfaceAddress" column="interface_address" jdbcType="VARCHAR"/> <result property="interfaceAddress" column="interface_address" jdbcType="VARCHAR"/>
<result property="interfaceStatus" column="interface_status" jdbcType="VARCHAR"/> <result property="interfaceStatus" column="interface_status" jdbcType="VARCHAR"/>
<result property="dbStatus" column="db_status" jdbcType="VARCHAR"/> <result property="dbStatus" column="db_status" jdbcType="VARCHAR"/>
<result property="appType" column="app_type" jdbcType="VARCHAR"/>
<result property="sorts" column="sorts" jdbcType="INTEGER"/> <result property="sorts" column="sorts" jdbcType="INTEGER"/>
<result property="org_id" column="org_id" jdbcType="VARCHAR"/> <result property="org_id" column="org_id" jdbcType="VARCHAR"/>
<result property="sts" column="sts" jdbcType="VARCHAR"/> <result property="sts" column="sts" jdbcType="VARCHAR"/>
@ -51,7 +52,8 @@
,interface_address ,interface_address
,interface_status ,interface_status
,db_status ,db_status
,sorts ,app_type
,sorts
,org_id ,org_id
,sts ,sts
,create_time ,create_time
@ -90,6 +92,7 @@
<if test="interfaceAddress != null and interfaceAddress != ''"> and interface_address = #{interfaceAddress} </if> <if test="interfaceAddress != null and interfaceAddress != ''"> and interface_address = #{interfaceAddress} </if>
<if test="interfaceStatus != null and interfaceStatus != ''"> and interface_status = #{interfaceStatus} </if> <if test="interfaceStatus != null and interfaceStatus != ''"> and interface_status = #{interfaceStatus} </if>
<if test="dbStatus != null and dbStatus != ''"> and db_status = #{dbStatus} </if> <if test="dbStatus != null and dbStatus != ''"> and db_status = #{dbStatus} </if>
<if test="appType != null and appType != ''"> and app_type = #{appType} </if>
<if test="sorts != null"> and sorts = #{sorts} </if> <if test="sorts != null"> and sorts = #{sorts} </if>
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if> <if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if> <if test="sts != null and sts != ''"> and sts = #{sts} </if>
@ -126,6 +129,7 @@
<if test="interfaceAddress != null and interfaceAddress != ''"> and interface_address = #{interfaceAddress} </if> <if test="interfaceAddress != null and interfaceAddress != ''"> and interface_address = #{interfaceAddress} </if>
<if test="interfaceStatus != null and interfaceStatus != ''"> and interface_status = #{interfaceStatus} </if> <if test="interfaceStatus != null and interfaceStatus != ''"> and interface_status = #{interfaceStatus} </if>
<if test="dbStatus != null and dbStatus != ''"> and db_status = #{dbStatus} </if> <if test="dbStatus != null and dbStatus != ''"> and db_status = #{dbStatus} </if>
<if test="appType != null and appType != ''"> and app_type = #{appType} </if>
<if test="sorts != null"> and sorts = #{sorts} </if> <if test="sorts != null"> and sorts = #{sorts} </if>
<if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if> <if test="org_id != null and org_id != ''"> and org_id = #{org_id} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if> <if test="sts != null and sts != ''"> and sts = #{sts} </if>
@ -164,6 +168,7 @@
<if test="interfaceAddress != null and interfaceAddress != ''"> and interface_address like concat('%',#{interfaceAddress},'%') </if> <if test="interfaceAddress != null and interfaceAddress != ''"> and interface_address like concat('%',#{interfaceAddress},'%') </if>
<if test="interfaceStatus != null and interfaceStatus != ''"> and interface_status like concat('%',#{interfaceStatus},'%') </if> <if test="interfaceStatus != null and interfaceStatus != ''"> and interface_status like concat('%',#{interfaceStatus},'%') </if>
<if test="dbStatus != null and dbStatus != ''"> and db_status like concat('%',#{dbStatus},'%') </if> <if test="dbStatus != null and dbStatus != ''"> and db_status like concat('%',#{dbStatus},'%') </if>
<if test="appType != null and appType != ''"> and app_type like concat('%',#{appType},'%') </if>
<if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if> <if test="sorts != null"> and sorts like concat('%',#{sorts},'%') </if>
<if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if> <if test="org_id != null and org_id != ''"> and org_id like concat('%',#{org_id},'%') </if>
<if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if> <if test="sts != null and sts != ''"> and sts like concat('%',#{sts},'%') </if>
@ -202,6 +207,7 @@
<if test="interfaceAddress != null and interfaceAddress != ''"> or interface_address = #{interfaceAddress} </if> <if test="interfaceAddress != null and interfaceAddress != ''"> or interface_address = #{interfaceAddress} </if>
<if test="interfaceStatus != null and interfaceStatus != ''"> or interface_status = #{interfaceStatus} </if> <if test="interfaceStatus != null and interfaceStatus != ''"> or interface_status = #{interfaceStatus} </if>
<if test="dbStatus != null and dbStatus != ''"> or db_status = #{dbStatus} </if> <if test="dbStatus != null and dbStatus != ''"> or db_status = #{dbStatus} </if>
<if test="appType != null and appType != ''"> or app_type = #{appType} </if>
<if test="sorts != null"> or sorts = #{sorts} </if> <if test="sorts != null"> or sorts = #{sorts} </if>
<if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if> <if test="org_id != null and org_id != ''"> or org_id = #{org_id} </if>
<if test="sts != null and sts != ''"> or sts = #{sts} </if> <if test="sts != null and sts != ''"> or sts = #{sts} </if>
@ -239,6 +245,7 @@
<if test="interfaceAddress != null and interfaceAddress != ''"> interface_address , </if> <if test="interfaceAddress != null and interfaceAddress != ''"> interface_address , </if>
<if test="interfaceStatus != null and interfaceStatus != ''"> interface_status , </if> <if test="interfaceStatus != null and interfaceStatus != ''"> interface_status , </if>
<if test="dbStatus != null and dbStatus != ''"> db_status , </if> <if test="dbStatus != null and dbStatus != ''"> db_status , </if>
<if test="appType != null and appType != ''"> app_type , </if>
<if test="sorts != null"> sorts , </if> <if test="sorts != null"> sorts , </if>
<if test="org_id != null and org_id != ''"> org_id , </if> <if test="org_id != null and org_id != ''"> org_id , </if>
<if test="sts != null and sts != ''"> sts , </if> <if test="sts != null and sts != ''"> sts , </if>
@ -271,6 +278,7 @@
<if test="interfaceAddress != null and interfaceAddress != ''"> #{interfaceAddress} ,</if> <if test="interfaceAddress != null and interfaceAddress != ''"> #{interfaceAddress} ,</if>
<if test="interfaceStatus != null and interfaceStatus != ''"> #{interfaceStatus} ,</if> <if test="interfaceStatus != null and interfaceStatus != ''"> #{interfaceStatus} ,</if>
<if test="dbStatus != null and dbStatus != ''"> #{dbStatus} ,</if> <if test="dbStatus != null and dbStatus != ''"> #{dbStatus} ,</if>
<if test="appType != null and appType != ''"> #{appType} ,</if>
<if test="sorts != null"> #{sorts} ,</if> <if test="sorts != null"> #{sorts} ,</if>
<if test="org_id != null and org_id != ''"> #{org_id} ,</if> <if test="org_id != null and org_id != ''"> #{org_id} ,</if>
<if test="sts != null and sts != ''"> #{sts} ,</if> <if test="sts != null and sts != ''"> #{sts} ,</if>
@ -285,18 +293,18 @@
</insert> </insert>
<!-- 批量新增 --> <!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true"> <insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
insert into sys_application(app_logo, app_status, name, version_number, app_id, system_address, access_mode, affiliation_field, manufacturer, app_introduction, client_path, web_path, program_path, public_key, secret_key, interface_address, interface_status, db_status, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id, sts) insert into sys_application(app_logo, app_status, name, version_number, app_id, system_address, access_mode, affiliation_field, manufacturer, app_introduction, client_path, web_path, program_path, public_key, secret_key, interface_address, interface_status, db_status,app_type, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id, sts)
values values
<foreach collection="entities" item="entity" separator=","> <foreach collection="entities" item="entity" separator=",">
(#{entity.appLogo},#{entity.appStatus},#{entity.name},#{entity.versionNumber},#{entity.appId},#{entity.systemAddress},#{entity.accessMode},#{entity.affiliationField},#{entity.manufacturer},#{entity.appIntroduction},#{entity.clientPath},#{entity.webPath},#{entity.programPath},#{entity.publicKey},#{entity.secretKey},#{entity.interfaceAddress},#{entity.interfaceStatus},#{entity.dbStatus},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}, 'Y') (#{entity.appLogo},#{entity.appStatus},#{entity.name},#{entity.versionNumber},#{entity.appId},#{entity.systemAddress},#{entity.accessMode},#{entity.affiliationField},#{entity.manufacturer},#{entity.appIntroduction},#{entity.clientPath},#{entity.webPath},#{entity.programPath},#{entity.publicKey},#{entity.secretKey},#{entity.interfaceAddress},#{entity.interfaceStatus},#{entity.dbStatus},#{entity.appType},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}, 'Y')
</foreach> </foreach>
</insert> </insert>
<!-- 批量新增或者修改--> <!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true"> <insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into sys_application(app_logo, app_status, name, version_number,app_id,system_address, access_mode, affiliation_field, manufacturer, app_introduction, client_path, web_path, program_path, public_key, secret_key, interface_address, interface_status, db_status, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id) insert into sys_application(app_logo, app_status, name, version_number,app_id,system_address, access_mode, affiliation_field, manufacturer, app_introduction, client_path, web_path, program_path, public_key, secret_key, interface_address, interface_status, db_status,app_type, sorts, org_id, sts, create_time, create_user_id, modify_time, modify_user_id)
values values
<foreach collection="entities" item="entity" separator=","> <foreach collection="entities" item="entity" separator=",">
(#{entity.appLogo},#{entity.appStatus},#{entity.name},#{entity.versionNumber},#{entity.appId},#{entity.systemAddress},#{entity.accessMode},#{entity.affiliationField},#{entity.manufacturer},#{entity.appIntroduction},#{entity.clientPath},#{entity.webPath},#{entity.programPath},#{entity.publicKey},#{entity.secretKey},#{entity.interfaceAddress},#{entity.interfaceStatus},#{entity.dbStatus},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id}) (#{entity.appLogo},#{entity.appStatus},#{entity.name},#{entity.versionNumber},#{entity.appId},#{entity.systemAddress},#{entity.accessMode},#{entity.affiliationField},#{entity.manufacturer},#{entity.appIntroduction},#{entity.clientPath},#{entity.webPath},#{entity.programPath},#{entity.publicKey},#{entity.secretKey},#{entity.interfaceAddress},#{entity.interfaceStatus},#{entity.dbStatus},#{entity.appType},#{entity.sorts},#{entity.org_id},#{entity.sts},#{entity.create_time},#{entity.create_user_id},#{entity.modify_time},#{entity.modify_user_id})
</foreach> </foreach>
on duplicate key update on duplicate key update
app_logo = values(app_logo), app_logo = values(app_logo),
@ -317,6 +325,7 @@
interface_address = values(interface_address), interface_address = values(interface_address),
interface_status = values(interface_status), interface_status = values(interface_status),
db_status = values(db_status), db_status = values(db_status),
app_type = values(app_type),
sorts = values(sorts), sorts = values(sorts),
org_id = values(org_id), org_id = values(org_id),
sts = values(sts), sts = values(sts),
@ -346,6 +355,7 @@ update sys_application set
<if test="interfaceAddress != null and interfaceAddress != ''"> interface_address = #{interfaceAddress},</if> <if test="interfaceAddress != null and interfaceAddress != ''"> interface_address = #{interfaceAddress},</if>
<if test="interfaceStatus != null and interfaceStatus != ''"> interface_status = #{interfaceStatus},</if> <if test="interfaceStatus != null and interfaceStatus != ''"> interface_status = #{interfaceStatus},</if>
<if test="dbStatus != null and dbStatus != ''"> db_status = #{dbStatus},</if> <if test="dbStatus != null and dbStatus != ''"> db_status = #{dbStatus},</if>
<if test="appType != null and appType != ''"> app_type = #{appType},</if>
<if test="sorts != null"> sorts = #{sorts},</if> <if test="sorts != null"> sorts = #{sorts},</if>
<if test="org_id != null and org_id != ''"> org_id = #{org_id},</if> <if test="org_id != null and org_id != ''"> org_id = #{org_id},</if>
<if test="sts != null and sts != ''"> sts = #{sts},</if> <if test="sts != null and sts != ''"> sts = #{sts},</if>
@ -384,6 +394,7 @@ update sys_application set sts= 'N' ,modify_time = #{modify_time},modify_user_i
<if test="interfaceAddress != null and interfaceAddress != ''"> and interface_address = #{interfaceAddress} </if> <if test="interfaceAddress != null and interfaceAddress != ''"> and interface_address = #{interfaceAddress} </if>
<if test="interfaceStatus != null and interfaceStatus != ''"> and interface_status = #{interfaceStatus} </if> <if test="interfaceStatus != null and interfaceStatus != ''"> and interface_status = #{interfaceStatus} </if>
<if test="dbStatus != null and dbStatus != ''"> and db_status = #{dbStatus} </if> <if test="dbStatus != null and dbStatus != ''"> and db_status = #{dbStatus} </if>
<if test="appType != null and appType != ''"> and app_type = #{appType} </if>
<if test="sorts != null"> and sorts = #{sorts} </if> <if test="sorts != null"> and sorts = #{sorts} </if>
<if test="sts != null and sts != ''"> and sts = #{sts} </if> <if test="sts != null and sts != ''"> and sts = #{sts} </if>
and sts='Y' and sts='Y'
@ -411,6 +422,7 @@ update sys_application set sts= 'N' ,modify_time = #{modify_time},modify_user_i
,a.app_introduction as appIntroduction ,a.app_introduction as appIntroduction
,a.interface_status as interfaceStatus ,a.interface_status as interfaceStatus
,a.db_status as dbStatus ,a.db_status as dbStatus
,a.app_type as appType
from sys_application a from sys_application a
<trim prefix="where" prefixOverrides="and"> <trim prefix="where" prefixOverrides="and">
<if test="affiliationField != null and affiliationField != ''"> and a.affiliation_field = #{affiliationField} </if> <if test="affiliationField != null and affiliationField != ''"> and a.affiliation_field = #{affiliationField} </if>

View File

@ -37,6 +37,8 @@ public class SysApplicationVo {
/** 应用是否启用1、启用 2、停用 */ /** 应用是否启用1、启用 2、停用 */
private String appStatus; private String appStatus;
/** 系统类型 1、致远OA 2、用友U8C 3、用友BIP */
private String appType;
public String getId() { public String getId() {
return id; return id;
} }
@ -148,5 +150,13 @@ public class SysApplicationVo {
public void setSystemAddress(String systemAddress) { public void setSystemAddress(String systemAddress) {
this.systemAddress = systemAddress; this.systemAddress = systemAddress;
} }
public String getAppType() {
return appType;
}
public void setAppType(String appType) {
this.appType = appType;
}
} }