Compare commits

...

6 Commits

Author SHA1 Message Date
xiang2lin 070090b3a7 增加app_id字段
账户详情接口
2025-05-26 16:36:07 +08:00
xiang2lin da1820e368 增加app_id字段
账户详情接口
2025-05-26 16:35:47 +08:00
xiang2lin 011f3e2a84 流程步骤配置 2025-05-23 14:16:54 +08:00
xiang2lin 17887cc8db 连接器 2025-05-18 13:50:00 +08:00
xiang2lin 0124e5898f 增加nifi_api_id字段 2025-05-16 14:50:19 +08:00
xiang2lin c9f3e36482 应用账户 2025-05-16 14:49:56 +08:00
19 changed files with 845 additions and 59 deletions

View File

@ -22,4 +22,11 @@ public interface ISysDictionaryshopNewService {
* @return
*/
SysDictionaryshopNew getDictionaryshopByValue(String tabName, String columnName, String columnValue);
/**
* 查询列表
* @param object
* @return
*/
JsonResultEntity queryDictionaryList(JSONObject object);
}

View File

@ -1,5 +1,6 @@
package com.hzya.frame.sys.dictionaryshopNew.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.web.entity.BaseResult;
import org.springframework.stereotype.Service;
import com.hzya.frame.serviceUtil.ServiceUtil;
@ -11,7 +12,7 @@ import org.slf4j.LoggerFactory;
import com.hzya.frame.web.entity.JsonResultEntity;
import javax.annotation.Resource;
import java.util.List;
/**
@ -49,4 +50,17 @@ public class SysDictionaryshopNewServiceImpl extends ServiceUtil implements ISy
sysDictionaryshopNew.setColumnValue(columnValue);
return sysdictionaryshopnewMapper.entity_get_by_value(sysDictionaryshopNew);
}
/**
* 查询列表
*
* @param object
* @return
*/
@Override
public JsonResultEntity queryDictionaryList(JSONObject object) {
SysDictionaryshopNew dictionary = getData("jsonStr", object, SysDictionaryshopNew.class);
List<SysDictionaryshopNew> dictionaryList = sysdictionaryshopnewMapper.entity_list_base(dictionary);
return BaseResult.getSuccessMessageEntity("查询列表成功", dictionaryList);
}
}

View File

@ -9,7 +9,13 @@ import com.hzya.frame.web.entity.BaseEntity;
* @since 2025-04-29 10:16:27
*/
public class SysFlowStepAccountEntity extends BaseEntity {
//流程id
private String flowId;
//流程步骤id
private String stepId;
//应用id
private String appId;
/** 账户名称 */
private String name;
/** ip地址 */
@ -122,5 +128,28 @@ public class SysFlowStepAccountEntity extends BaseEntity {
this.agentid = agentid;
}
public String getFlowId() {
return flowId;
}
public void setFlowId(String flowId) {
this.flowId = flowId;
}
public String getStepId() {
return stepId;
}
public void setStepId(String stepId) {
this.stepId = stepId;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
}

View File

@ -15,6 +15,9 @@
<result property="dbName" column="db_name" jdbcType="VARCHAR"/>
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
<result property="password" column="password" jdbcType="VARCHAR"/>
<result property="flowId" column="flow_id" jdbcType="VARCHAR"/>
<result property="stepId" column="step_id" jdbcType="VARCHAR"/>
<result property="appId" column="app_id" jdbcType="VARCHAR"/>
<result property="dbType" column="db_type" jdbcType="VARCHAR"/>
<result property="appKey" column="app_key" jdbcType="VARCHAR"/>
<result property="appSecret" column="app_secret" jdbcType="VARCHAR"/>
@ -35,7 +38,10 @@
,db_name
,user_name
,password
,db_type
,flow_id
,step_id
,app_id
,db_type
,app_key
,app_secret
,corpId
@ -59,6 +65,9 @@
<if test="dbName != null and dbName != ''"> and db_name = #{dbName} </if>
<if test="userName != null and userName != ''"> and user_name = #{userName} </if>
<if test="password != null and password != ''"> and password = #{password} </if>
<if test="flowId != null and flowId != ''"> and flow_id = #{flowId} </if>
<if test="stepId != null and stepId != ''"> and step_id = #{stepId} </if>
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
<if test="dbType != null and dbType != ''"> and db_type = #{dbType} </if>
<if test="appKey != null and appKey != ''"> and app_key = #{appKey} </if>
<if test="appSecret != null and appSecret != ''"> and app_secret = #{appSecret} </if>
@ -86,6 +95,9 @@
<if test="dbName != null and dbName != ''"> and db_name = #{dbName} </if>
<if test="userName != null and userName != ''"> and user_name = #{userName} </if>
<if test="password != null and password != ''"> and password = #{password} </if>
<if test="flowId != null and flowId != ''"> and flow_id = #{flowId} </if>
<if test="stepId != null and stepId != ''"> and step_id = #{stepId} </if>
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
<if test="dbType != null and dbType != ''"> and db_type = #{dbType} </if>
<if test="appKey != null and appKey != ''"> and app_key = #{appKey} </if>
<if test="appSecret != null and appSecret != ''"> and app_secret = #{appSecret} </if>
@ -115,6 +127,9 @@
<if test="dbName != null and dbName != ''"> and db_name like concat('%',#{dbName},'%') </if>
<if test="userName != null and userName != ''"> and user_name like concat('%',#{userName},'%') </if>
<if test="password != null and password != ''"> and password like concat('%',#{password},'%') </if>
<if test="flowId != null and flowId != ''"> and flow_id like concat('%',#{flowId},'%') </if>
<if test="stepId != null and stepId != ''"> and step_id like concat('%',#{stepId},'%') </if>
<if test="appId != null and appId != ''"> and app_id like concat('%',#{appId},'%') </if>
<if test="dbType != null and dbType != ''"> and db_type like concat('%',#{dbType},'%') </if>
<if test="appKey != null and appKey != ''"> and app_key like concat('%',#{appKey},'%') </if>
<if test="appSecret != null and appSecret != ''"> and app_secret like concat('%',#{appSecret},'%') </if>
@ -144,6 +159,9 @@
<if test="dbName != null and dbName != ''"> or db_name = #{dbName} </if>
<if test="userName != null and userName != ''"> or user_name = #{userName} </if>
<if test="password != null and password != ''"> or password = #{password} </if>
<if test="flowId != null and flowId != ''"> or flow_id = #{flowId} </if>
<if test="stepId != null and stepId != ''"> or step_id = #{stepId} </if>
<if test="appId != null and appId != ''"> or app_id = #{appId} </if>
<if test="dbType != null and dbType != ''"> or db_type = #{dbType} </if>
<if test="appKey != null and appKey != ''"> or app_key = #{appKey} </if>
<if test="appSecret != null and appSecret != ''"> or app_secret = #{appSecret} </if>
@ -171,6 +189,9 @@
<if test="dbName != null and dbName != ''"> db_name , </if>
<if test="userName != null and userName != ''"> user_name , </if>
<if test="password != null and password != ''"> password , </if>
<if test="flowId != null and flowId != ''"> flow_id , </if>
<if test="stepId != null and stepId != ''"> step_id , </if>
<if test="appId != null and appId != ''"> app_id , </if>
<if test="dbType != null and dbType != ''"> db_type , </if>
<if test="appKey != null and appKey != ''"> app_key , </if>
<if test="appSecret != null and appSecret != ''"> app_secret , </if>
@ -193,6 +214,9 @@
<if test="dbName != null and dbName != ''"> #{dbName} ,</if>
<if test="userName != null and userName != ''"> #{userName} ,</if>
<if test="password != null and password != ''"> #{password} ,</if>
<if test="flowId != null and flowId != ''"> #{flowId} ,</if>
<if test="stepId != null and stepId != ''"> #{stepId} ,</if>
<if test="appId != null and appId != ''"> #{appId} ,</if>
<if test="dbType != null and dbType != ''"> #{dbType} ,</if>
<if test="appKey != null and appKey != ''"> #{appKey} ,</if>
<if test="appSecret != null and appSecret != ''"> #{appSecret} ,</if>
@ -205,18 +229,18 @@
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
insert into sys_flow_step_account(create_user_id, create_time, modify_user_id, modify_time, sts, name, ip_address, port, db_name, user_name, password, db_type, app_key, app_secret, corpId, agentId, sts)
insert into sys_flow_step_account(create_user_id, create_time, modify_user_id, modify_time, sts, name, ip_address, port, db_name, user_name, password,flow_id,step_id,app_id, db_type, app_key, app_secret, corpId, agentId, sts)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.name},#{entity.ipAddress},#{entity.port},#{entity.dbName},#{entity.userName},#{entity.password},#{entity.dbType},#{entity.appKey},#{entity.appSecret},#{entity.corpid},#{entity.agentid}, 'Y')
(#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.name},#{entity.ipAddress},#{entity.port},#{entity.dbName},#{entity.userName},#{entity.password},#{entity.flowId},#{entity.stepId},#{entity.appId},#{entity.dbType},#{entity.appKey},#{entity.appSecret},#{entity.corpid},#{entity.agentid}, 'Y')
</foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into sys_flow_step_account(create_user_id, create_time, modify_user_id, modify_time, sts, name, ip_address, port, db_name, user_name, password, db_type, app_key, app_secret, corpId, agentId)
insert into sys_flow_step_account(create_user_id, create_time, modify_user_id, modify_time, sts, name, ip_address, port, db_name, user_name, password,flow_id,step_id,app_id, db_type, app_key, app_secret, corpId, agentId)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.name},#{entity.ipAddress},#{entity.port},#{entity.dbName},#{entity.userName},#{entity.password},#{entity.dbType},#{entity.appKey},#{entity.appSecret},#{entity.corpid},#{entity.agentid})
(#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.name},#{entity.ipAddress},#{entity.port},#{entity.dbName},#{entity.userName},#{entity.password},#{entity.flowId},#{entity.stepId},#{entity.appId},#{entity.dbType},#{entity.appKey},#{entity.appSecret},#{entity.corpid},#{entity.agentid})
</foreach>
on duplicate key update
create_user_id = values(create_user_id),
@ -230,6 +254,9 @@
db_name = values(db_name),
user_name = values(user_name),
password = values(password),
flow_id = values(flow_id),
step_id = values(step_id),
app_id = values(app_id),
db_type = values(db_type),
app_key = values(app_key),
app_secret = values(app_secret),
@ -250,6 +277,9 @@ update sys_flow_step_account set
<if test="dbName != null and dbName != ''"> db_name = #{dbName},</if>
<if test="userName != null and userName != ''"> user_name = #{userName},</if>
<if test="password != null and password != ''"> password = #{password},</if>
<if test="flowId != null and flowId != ''"> flow_id = #{flowId},</if>
<if test="stepId != null and stepId != ''"> step_id = #{stepId},</if>
<if test="appId != null and appId != ''"> app_id = #{appId},</if>
<if test="dbType != null and dbType != ''"> db_type = #{dbType},</if>
<if test="appKey != null and appKey != ''"> app_key = #{appKey},</if>
<if test="appSecret != null and appSecret != ''"> app_secret = #{appSecret},</if>
@ -275,6 +305,9 @@ update sys_flow_step_account set sts= 'N' ,modify_time = #{modify_time},modify_
<if test="dbName != null and dbName != ''"> and db_name = #{dbName} </if>
<if test="userName != null and userName != ''"> and user_name = #{userName} </if>
<if test="password != null and password != ''"> and password = #{password} </if>
<if test="flowId != null and flowId != ''"> and flow_id = #{flowId} </if>
<if test="stepId != null and stepId != ''"> and step_id = #{stepId} </if>
<if test="appId != null and appId != ''"> and app_id = #{appId} </if>
<if test="dbType != null and dbType != ''"> and db_type = #{dbType} </if>
<if test="appKey != null and appKey != ''"> and app_key = #{appKey} </if>
<if test="appSecret != null and appSecret != ''"> and app_secret = #{appSecret} </if>

View File

@ -35,6 +35,8 @@ public class SysFlowStepConfigEntity extends BaseEntity {
/** 动态sql语句 */
private String sqlStatement;
//步骤账户表id
private String stepAccountId;
public String getFlowId() {
return flowId;
@ -132,5 +134,12 @@ public class SysFlowStepConfigEntity extends BaseEntity {
this.sqlStatement = sqlStatement;
}
public String getStepAccountId() {
return stepAccountId;
}
public void setStepAccountId(String stepAccountId) {
this.stepAccountId = stepAccountId;
}
}

View File

@ -32,8 +32,10 @@ public class SysFlowStepEntity extends BaseEntity {
private String nifiApiId;
/** nifi应用排序模式;先进先出/先进后出 */
private String sortMode;
//定时任务 corn表达式
private String taskCorn;
//账户对象
private SysFlowStepAccountEntity account;
public Integer getStep() {
return step;
}
@ -121,5 +123,21 @@ public class SysFlowStepEntity extends BaseEntity {
public void setFlowId(String flowId) {
this.flowId = flowId;
}
public SysFlowStepAccountEntity getAccount() {
return account;
}
public void setAccount(SysFlowStepAccountEntity account) {
this.account = account;
}
public String getTaskCorn() {
return taskCorn;
}
public void setTaskCorn(String taskCorn) {
this.taskCorn = taskCorn;
}
}

View File

@ -17,29 +17,31 @@
<result property="actionType" column="action_type" jdbcType="VARCHAR"/>
<result property="appId" column="app_id" jdbcType="VARCHAR"/>
<result property="apiId" column="api_id" jdbcType="VARCHAR"/>
<result property="taskCorn" column="task_corn" jdbcType="VARCHAR"/>
<result property="nifiAppId" column="nifi_app_id" jdbcType="VARCHAR"/>
<result property="nifiApiId" column="nifi_api_id" jdbcType="VARCHAR"/>
<result property="sortMode" column="sort_mode" jdbcType="VARCHAR"/>
</resultMap>
<!-- 查询的字段-->
<sql id="SysFlowStepEntity_Base_Column_List">
id
,create_user_id
,create_time
,modify_user_id
,modify_time
,sts
,step
,step_type
,flowId
,description
,api_name
,action_type
,app_id
,api_id
,nifi_app_id
,nifi_api_id
,sort_mode
id,
create_user_id,
create_time,
modify_user_id,
modify_time,
sts,
step,
step_type,
flowId,
description,
api_name,
action_type,
app_id,
api_id,
taskCorn,
nifi_app_id,
nifi_api_id,
sort_mode
</sql>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-SysFlowStepEntity-result"
@ -182,6 +184,7 @@
<if test="actionType != null and actionType != ''">action_type ,</if>
<if test="appId != null and appId != ''">app_id ,</if>
<if test="apiId != null and apiId != ''">api_id ,</if>
<if test="taskCorn != null and taskCorn != ''">task_corn ,</if>
<if test="nifiAppId != null and nifiAppId != ''">nifi_app_id ,</if>
<if test="nifiApiId != null and nifiApiId != ''">nifi_api_id ,</if>
<if test="sortMode != null and sortMode != ''">sort_mode ,</if>
@ -204,6 +207,7 @@
<if test="actionType != null and actionType != ''">#{actionType} ,</if>
<if test="appId != null and appId != ''">#{appId} ,</if>
<if test="apiId != null and apiId != ''">#{apiId} ,</if>
<if test="taskCorn != null and taskCorn != ''">#{taskCorn} ,</if>
<if test="nifiAppId != null and nifiAppId != ''">#{nifiAppId} ,</if>
<if test="nifiApiId != null and nifiApiId != ''">#{nifiApiId} ,</if>
<if test="sortMode != null and sortMode != ''">#{sortMode} ,</if>
@ -267,6 +271,7 @@
<if test="actionType != null and actionType != ''">action_type = #{actionType},</if>
<if test="appId != null and appId != ''">app_id = #{appId},</if>
<if test="apiId != null and apiId != ''">api_id = #{apiId},</if>
<if test="taskCorn != null and taskCorn != ''">task_corn = #{taskCorn},</if>
<if test="nifiAppId != null and nifiAppId != ''">nifi_app_id = #{nifiAppId},</if>
<if test="nifiApiId != null and nifiApiId != ''">nifi_api_id = #{nifiApiId},</if>
<if test="sortMode != null and sortMode != ''">sort_mode = #{sortMode},</if>
@ -295,6 +300,7 @@
<if test="actionType != null and actionType != ''">and action_type = #{actionType}</if>
<if test="appId != null and appId != ''">and app_id = #{appId}</if>
<if test="apiId != null and apiId != ''">and api_id = #{apiId}</if>
<if test="taskCorn != null and taskCorn != ''">and task_corn = #{taskCorn}</if>
<if test="nifiAppId != null and nifiAppId != ''">and nifi_app_id = #{nifiAppId}</if>
<if test="nifiApiId != null and nifiApiId != ''">and nifi_api_id = #{nifiApiId}</if>
<if test="sortMode != null and sortMode != ''">and sort_mode = #{sortMode}</if>

View File

@ -1,7 +1,10 @@
package com.hzya.frame.sys.flow.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.sys.flow.entity.SysFlowStepAccountEntity;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.web.entity.JsonResultEntity;
/**
* 流程步骤账户表(SysFlowStepAccount)表服务接口
*
@ -9,4 +12,53 @@ import com.hzya.frame.basedao.service.IBaseService;
* @since 2025-04-29 10:16:28
*/
public interface ISysFlowStepAccountService extends IBaseService<SysFlowStepAccountEntity, String>{
/**
* 保存账户信息
* @param object
* @return
*/
JsonResultEntity saveAccount(JSONObject object);
/**
* 更新账户信息
* @param object
* @return
*/
JsonResultEntity updateAccount(JSONObject object);
/**
* 删除账户信息
* @param object
* @return
*/
JsonResultEntity deleteAccount(JSONObject object);
/**
* 查询账户详情
* @param object
* @return
*/
JsonResultEntity getAccount(JSONObject object);
/**
* 查询账户列表数据
* @param object
* @return
*/
JsonResultEntity queryAccountList(JSONObject object);
/**
* 查询账户分页数据
* @param object
* @return
*/
JsonResultEntity queryAccountPaged(JSONObject object);
/**
* 验证数据库账户
* @param object
* @return
*/
JsonResultEntity verifyDataBase(JSONObject object);
}

View File

@ -1,7 +1,10 @@
package com.hzya.frame.sys.flow.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.sys.flow.entity.SysFlowStepConfigEntity;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.web.entity.JsonResultEntity;
/**
* 映射信息主表(SysFlowStepConfig)表服务接口
*
@ -9,4 +12,11 @@ import com.hzya.frame.basedao.service.IBaseService;
* @since 2025-04-29 10:16:28
*/
public interface ISysFlowStepConfigService extends IBaseService<SysFlowStepConfigEntity, String>{
/**
* 测试sql
* @param object
* @return
*/
JsonResultEntity testSql(JSONObject object);
}

View File

@ -1,7 +1,10 @@
package com.hzya.frame.sys.flow.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.sys.flow.entity.SysFlowStepEntity;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.web.entity.JsonResultEntity;
/**
* 流程步骤信息(SysFlowStep)表服务接口
*
@ -9,4 +12,39 @@ import com.hzya.frame.basedao.service.IBaseService;
* @since 2025-04-29 10:16:27
*/
public interface ISysFlowStepService extends IBaseService<SysFlowStepEntity, String>{
/**
* 保存流程步骤
* @param object
* @return
*/
JsonResultEntity saveFlowStep(JSONObject object);
/**
* 更新流程步骤
* @param object
* @return
*/
JsonResultEntity updateFlowStep(JSONObject object);
/**
* 删除流程步骤
* @param object
* @return
*/
JsonResultEntity deleteFlowStep(JSONObject object);
/**
* 查询列表
* @param object
* @return
*/
JsonResultEntity queryList(JSONObject object);
/**
* 步骤详情
* @param object
* @return
*/
JsonResultEntity getFlowStep(JSONObject object);
}

View File

@ -53,7 +53,7 @@ public class SysFlowServiceImpl extends BaseService<SysFlowEntity, String> imple
return BaseResult.getFailureMessageEntity(e.getMessage());
}
sysFlowDao.save(flowEntity);
return BaseResult.getSuccessMessageEntity("保存成功");
return BaseResult.getSuccessMessageEntity("保存成功",flowEntity);
}
/**

View File

@ -1,12 +1,30 @@
package com.hzya.frame.sys.flow.service.impl;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.datasource.DataSourceUtilProperties;
import com.hzya.frame.serviceUtil.DsDataSourceUtil;
import com.hzya.frame.sys.flow.entity.SysFlowStepAccountEntity;
import com.hzya.frame.sys.flow.dao.ISysFlowStepAccountDao;
import com.hzya.frame.sys.flow.service.ISysFlowStepAccountService;
import org.springframework.stereotype.Service;
import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity;
import com.hzya.frame.sysnew.application.database.service.ISysApplicationDatabaseService;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import com.hzya.frame.web.exception.BaseSystemException;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import com.hzya.frame.basedao.service.impl.BaseService;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.List;
/**
* 流程步骤账户表(SysFlowStepAccount)表服务实现类
*
@ -15,12 +33,252 @@ import com.hzya.frame.basedao.service.impl.BaseService;
*/
@Service(value = "sysFlowStepAccountService")
public class SysFlowStepAccountServiceImpl extends BaseService<SysFlowStepAccountEntity, String> implements ISysFlowStepAccountService {
private ISysFlowStepAccountDao sysFlowStepAccountDao;
@Resource
private DsDataSourceUtil dsDataSourceUtil;
@Autowired
public void setSysFlowStepAccountDao(ISysFlowStepAccountDao dao) {
this.sysFlowStepAccountDao = dao;
this.dao = dao;
}
private ISysApplicationDatabaseService sysApplicationDatabaseService;
@Autowired
public void setSysFlowStepAccountDao(ISysFlowStepAccountDao dao) {
this.sysFlowStepAccountDao = dao;
this.dao = dao;
}
/**
* 保存账户信息
*
* @param object
* @return
*/
@Override
public JsonResultEntity saveAccount(JSONObject object) {
SysFlowStepAccountEntity entity = getData("jsonStr", object, SysFlowStepAccountEntity.class);
try {
checkParam(entity, "save");
//控制一下名字不能重复
List<SysFlowStepAccountEntity> queryList = queryByName(entity);
if (CollectionUtils.isNotEmpty(queryList) && queryList.size() > 0) {
return BaseResult.getFailureMessageEntity(entity.getName() + "重复");
}
sysFlowStepAccountDao.save(entity);
//保存数据源表测试sql的时候要用动态数据源动态数据源是从sys_application_database表查数据的
saveOrDataBase(entity);
} catch (Exception e) {
return BaseResult.getFailureMessageEntity(e.getMessage());
}
return BaseResult.getSuccessMessageEntity("新增成功");
}
/**
* 保存数据源表测试sql的时候要用动态数据源动态数据源是从sys_application_database表查数据的
*
* @param entity
*/
private void saveOrDataBase(SysFlowStepAccountEntity entity) throws Exception {
Assert.notNull(entity, "参数不能为空");
Assert.notEmpty(entity.getName(), "账户名称不能为空");
SysApplicationDatabaseEntity db = new SysApplicationDatabaseEntity();
db.setSourceCode(entity.getName() + "_flow");
List<SysApplicationDatabaseEntity> queryList = sysApplicationDatabaseService.query(db);
if (CollectionUtils.isNotEmpty(queryList)) {
for (SysApplicationDatabaseEntity sys : queryList) {
sysApplicationDatabaseService.logicRemove(sys);
}
}
SysApplicationDatabaseEntity databaseEntity = new SysApplicationDatabaseEntity();
databaseEntity.setAppId(entity.getAppId());
databaseEntity.setSourceCode(entity.getName() + "_flow");
databaseEntity.setSourceName(entity.getName());
databaseEntity.setSourceType(entity.getDbType());
databaseEntity.setSourceIp(entity.getIpAddress());
databaseEntity.setSourcePort(entity.getPort());
databaseEntity.setLoginName(entity.getUserName());
databaseEntity.setPassword(entity.getPassword());
databaseEntity.setDbName(entity.getDbName());
databaseEntity.setDbStatus("1");
sysApplicationDatabaseService.save(databaseEntity);
}
/**
* 更新账户信息
*
* @param object
* @return
*/
@Override
public JsonResultEntity updateAccount(JSONObject object) {
SysFlowStepAccountEntity entity = getData("jsonStr", object, SysFlowStepAccountEntity.class);
try {
checkParam(entity, "update");
//检查一下名字不能重复
List<SysFlowStepAccountEntity> queryList = queryByName(entity);
if (CollectionUtils.isNotEmpty(queryList) && queryList.size() > 0) {
for (SysFlowStepAccountEntity acc : queryList) {
if (!acc.getId().equals(entity.getId())) {
return BaseResult.getFailureMessageEntity(entity.getName() + "重复");
}
}
}
sysFlowStepAccountDao.update(entity);
//保存数据源表测试sql的时候要用动态数据源动态数据源是从sys_application_database表查数据的
saveOrDataBase(entity);
} catch (Exception e) {
return BaseResult.getFailureMessageEntity(e.getMessage());
}
return BaseResult.getSuccessMessageEntity("更新成功");
}
/**
* 删除账户信息
*
* @param object
* @return
*/
@Override
public JsonResultEntity deleteAccount(JSONObject object) {
SysFlowStepAccountEntity entity = getData("jsonStr", object, SysFlowStepAccountEntity.class);
try {
checkParam(entity, "delete");
} catch (Exception e) {
return BaseResult.getFailureMessageEntity(e.getMessage());
}
sysFlowStepAccountDao.logicRemove(entity);
return BaseResult.getSuccessMessageEntity("删除成功");
}
/**
* 查询账户详情
*
* @param object
* @return
*/
@Override
public JsonResultEntity getAccount(JSONObject object) {
SysFlowStepAccountEntity entity = getData("jsonStr", object, SysFlowStepAccountEntity.class);
try {
checkParam(entity, "get");
} catch (Exception e) {
return BaseResult.getFailureMessageEntity(e.getMessage());
}
SysFlowStepAccountEntity SysFlowStepAccountEntity = sysFlowStepAccountDao.get(entity.getId());
return BaseResult.getSuccessMessageEntity("查询账户详情成功", SysFlowStepAccountEntity);
}
/**
* 查询账户列表数据
*
* @param object
* @return
*/
@Override
public JsonResultEntity queryAccountList(JSONObject object) {
SysFlowStepAccountEntity entity = getData("jsonStr", object, SysFlowStepAccountEntity.class);
try {
checkParam(entity, "queryList");
} catch (Exception e) {
return BaseResult.getFailureMessageEntity(e.getMessage());
}
List<SysFlowStepAccountEntity> queryList = sysFlowStepAccountDao.query(entity);
return BaseResult.getSuccessMessageEntity("查询列表成功", queryList);
}
/**
* 查询账户分页数据
*
* @param object
* @return
*/
@Override
public JsonResultEntity queryAccountPaged(JSONObject object) {
SysFlowStepAccountEntity entity = getData("jsonStr", object, SysFlowStepAccountEntity.class);
try {
checkParam(entity, "queryPaged");
} catch (Exception e) {
return BaseResult.getFailureMessageEntity(e.getMessage());
}
return null;
}
//根据账户名称查询
private List<SysFlowStepAccountEntity> queryByName(SysFlowStepAccountEntity entity) {
if (StrUtil.isNotEmpty(entity.getName())) {
SysFlowStepAccountEntity account = new SysFlowStepAccountEntity();
account.setName(entity.getName());
List<SysFlowStepAccountEntity> queryList = sysFlowStepAccountDao.query(account);
return queryList;
}
return null;
}
/**
* 验证账户
*
* @param object
* @return
*/
@Override
public JsonResultEntity verifyDataBase(JSONObject object) {
SysFlowStepAccountEntity entity = getData("jsonStr", object, SysFlowStepAccountEntity.class);
try {
checkParam(entity, "verify");
String dbType = entity.getDbType();
String driveClass = "";
StringBuffer sourceUrl = new StringBuffer();
if (StrUtil.isNotEmpty(dbType)) {
if ("mysql".equals(dbType)) {
driveClass = DataSourceUtilProperties.MYSQLDRIVER_6;
sourceUrl.append("jdbc:mysql://").append(entity.getIpAddress()).append(":").append(entity.getPort()).append("/").append(entity.getDbName()).append("?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true");
} else if ("oracle".equals(dbType)) {
driveClass = DataSourceUtilProperties.ORACLEDRIVER;
sourceUrl.append("jdbc:oracle:thin:@").append(entity.getIpAddress()).append(":").append(entity.getPort()).append(":").append(entity.getDbName());
} else if ("sqlserver2000".equals(dbType)) {
driveClass = DataSourceUtilProperties.SQL2000DRIVER;
sourceUrl.append("jdbc:sqlserver://").append(entity.getIpAddress()).append(":").append(entity.getPort()).append(";DatabaseName=").append(entity.getDbName()).append(";encrypt=false;trustServerCertificate=true");
} else if ("sqlserver2005".equals(dbType)) {
driveClass = DataSourceUtilProperties.SQL2005DRIVER;
sourceUrl.append("jdbc:sqlserver://").append(entity.getIpAddress()).append(":").append(entity.getPort()).append(";DatabaseName=").append(entity.getDbName()).append(";encrypt=false;trustServerCertificate=true");
}
//测试连接
Class.forName(driveClass);
Connection connection = DriverManager.getConnection(sourceUrl.toString(), entity.getUserName(), entity.getPassword());// 相当于连接数据库
if (null != connection) {
return BaseResult.getSuccessMessageEntity("验证成功");
} else {
return BaseResult.getFailureMessageEntity("验证失败");
}
}
} catch (Exception e) {
return BaseResult.getFailureMessageEntity(e.getMessage());
}
return null;
}
//数据检查
private void checkParam(SysFlowStepAccountEntity entity, String type) {
Assert.notNull(entity, "参数不能为空");
if ("save".equals(type)) {
Assert.notEmpty(entity.getFlowId(), "flowId不能为空");
Assert.notEmpty(entity.getAppId(), "appId不能为空");
Assert.notEmpty(entity.getName(), "账户名称不能为空");
} else if ("update".equals(type)) {
Assert.notEmpty(entity.getId(), "id不能为空");
} else if ("delete".equals(type)) {
Assert.notEmpty(entity.getId(), "id不能为空");
} else if ("get".equals(type)) {
Assert.notEmpty(entity.getId(), "id不能为空");
} else if ("queryList".equals(type)) {
Assert.notEmpty(entity.getFlowId(), "flowId不能为空");
Assert.notEmpty(entity.getStepId(), "stepId不能为空");
Assert.notEmpty(entity.getAppId(), "appId不能为空");
} else if ("queryPaged".equals(type)) {
Assert.notNull(entity.getPageNum(), "pageNum不能为空");
Assert.notNull(entity.getPageSize(), "pageSize不能为空");
} else if ("verify".equals(type)) {
}
}
}

View File

@ -1,12 +1,27 @@
package com.hzya.frame.sys.flow.service.impl;
import cn.hutool.core.lang.Assert;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.sys.flow.entity.SysFlowStepAccountEntity;
import com.hzya.frame.sys.flow.entity.SysFlowStepConfigEntity;
import com.hzya.frame.sys.flow.dao.ISysFlowStepConfigDao;
import com.hzya.frame.sys.flow.service.ISysFlowStepAccountService;
import com.hzya.frame.sys.flow.service.ISysFlowStepConfigService;
import org.springframework.stereotype.Service;
import com.hzya.frame.sysnew.application.database.entity.SysApplicationDatabaseEntity;
import com.hzya.frame.sysnew.application.database.service.ISysApplicationDatabaseService;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import com.hzya.frame.web.exception.BaseSystemException;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import com.hzya.frame.basedao.service.impl.BaseService;
import java.util.List;
/**
* 映射信息主表(SysFlowStepConfig)表服务实现类
*
@ -15,12 +30,53 @@ import com.hzya.frame.basedao.service.impl.BaseService;
*/
@Service(value = "sysFlowStepConfigService")
public class SysFlowStepConfigServiceImpl extends BaseService<SysFlowStepConfigEntity, String> implements ISysFlowStepConfigService {
Logger logger = LoggerFactory.getLogger(ISysFlowStepConfigService.class);
private ISysFlowStepConfigDao sysFlowStepConfigDao;
@Autowired
private ISysFlowStepAccountService sysFlowStepAccountService;
@Autowired
private ISysApplicationDatabaseService sysApplicationDatabaseService;
@Autowired
public void setSysFlowStepConfigDao(ISysFlowStepConfigDao dao) {
this.sysFlowStepConfigDao = dao;
this.dao = dao;
}
/**
* 测试sql
*
* @param object
* @return
*/
@Override
public JsonResultEntity testSql(JSONObject object) {
SysFlowStepConfigEntity config = getData("jsonStr",object,SysFlowStepConfigEntity.class);
try {
checkParams(config,"type");
}catch (Exception e){
return BaseResult.getFailureMessageEntity(e.getMessage());
}
SysFlowStepAccountEntity accountEntity = sysFlowStepAccountService.get(config.getId());
Assert.notNull(accountEntity,"没有找到对应账户");
//查询数据源
SysApplicationDatabaseEntity database = new SysApplicationDatabaseEntity();
database.setSourceCode(accountEntity.getName()+"_flow");
List<SysApplicationDatabaseEntity> databaseList = sysApplicationDatabaseService.query(database);
if (CollectionUtils.isEmpty(databaseList)){
throw new BaseSystemException("没有找到数据源");
}
return null;
}
/**
* 验证数据
* @param entity
* @param type
*/
private void checkParams(SysFlowStepConfigEntity entity, String type) {
Assert.notNull(entity,"参数不能为空");
Assert.notEmpty(entity.getTableName(),"tabName不能为空");
Assert.notEmpty(entity.getStepAccountId(),"tabName不能为空");
}
}

View File

@ -1,12 +1,21 @@
package com.hzya.frame.sys.flow.service.impl;
import cn.hutool.core.lang.Assert;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.sys.flow.dao.ISysFlowStepAccountDao;
import com.hzya.frame.sys.flow.entity.SysFlowStepAccountEntity;
import com.hzya.frame.sys.flow.entity.SysFlowStepEntity;
import com.hzya.frame.sys.flow.dao.ISysFlowStepDao;
import com.hzya.frame.sys.flow.service.ISysFlowStepAccountService;
import com.hzya.frame.sys.flow.service.ISysFlowStepService;
import org.springframework.stereotype.Service;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import com.hzya.frame.basedao.service.impl.BaseService;
import java.util.List;
/**
* 流程步骤信息(SysFlowStep)表服务实现类
*
@ -15,12 +24,137 @@ import com.hzya.frame.basedao.service.impl.BaseService;
*/
@Service(value = "sysFlowStepService")
public class SysFlowStepServiceImpl extends BaseService<SysFlowStepEntity, String> implements ISysFlowStepService {
private ISysFlowStepDao sysFlowStepDao;
@Autowired
public void setSysFlowStepDao(ISysFlowStepDao dao) {
this.sysFlowStepDao = dao;
this.dao = dao;
}
private ISysFlowStepAccountService sysFlowStepAccountService;
@Autowired
public void setSysFlowStepDao(ISysFlowStepDao dao) {
this.sysFlowStepDao = dao;
this.dao = dao;
}
/**
* 保存流程步骤
*
* @param object
* @return
*/
@Override
public JsonResultEntity saveFlowStep(JSONObject object) {
SysFlowStepEntity sysFlowStep = getData("jsonStr", object, SysFlowStepEntity.class);
try {
checkParams(sysFlowStep, "save");
} catch (Exception e) {
return BaseResult.getFailureMessageEntity(e.getMessage());
}
sysFlowStepDao.save(sysFlowStep);
return BaseResult.getSuccessMessageEntity("保存成功", sysFlowStep);
}
/**
* 更新流程步骤
*
* @param object
* @return
*/
@Override
public JsonResultEntity updateFlowStep(JSONObject object) {
SysFlowStepEntity sysFlowStep = getData("jsonStr", object, SysFlowStepEntity.class);
try {
checkParams(sysFlowStep, "update");
} catch (Exception e) {
return BaseResult.getFailureMessageEntity(e.getMessage());
}
sysFlowStepDao.update(sysFlowStep);
//保存账户信息
if (null != sysFlowStep.getAccount()) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("jsonStr", JSONObject.toJSONString(sysFlowStep.getAccount()));
sysFlowStepAccountService.saveAccount(jsonObject);
}
return BaseResult.getSuccessMessageEntity("保存成功", sysFlowStep);
}
/**
* 删除流程步骤
*
* @param object
* @return
*/
@Override
public JsonResultEntity deleteFlowStep(JSONObject object) {
SysFlowStepEntity sysFlowStep = getData("jsonStr", object, SysFlowStepEntity.class);
try {
checkParams(sysFlowStep, "delete");
String id = sysFlowStep.getId();
SysFlowStepEntity step = sysFlowStepDao.get(id);
//删除流程步骤账户表
SysFlowStepAccountEntity stepAccount = new SysFlowStepAccountEntity();
stepAccount.setFlowId(step.getFlowId());
stepAccount.setStepId(id);
sysFlowStepAccountService.logicRemoveMultiCondition(stepAccount);
//删除流程步骤
sysFlowStepDao.logicRemove(step);
} catch (Exception e) {
return BaseResult.getFailureMessageEntity(e.getMessage());
}
return BaseResult.getSuccessMessageEntity("删除成功");
}
/**
* 查询列表
*
* @param object
* @return
*/
@Override
public JsonResultEntity queryList(JSONObject object) {
SysFlowStepEntity sysFlowStep = getData("jsonStr", object, SysFlowStepEntity.class);
try {
checkParams(sysFlowStep, "queryList");
} catch (Exception e) {
return BaseResult.getFailureMessageEntity(e.getMessage());
}
List<SysFlowStepEntity> list = sysFlowStepDao.query(sysFlowStep);
return BaseResult.getSuccessMessageEntity("查询数据成功", list);
}
/**
* 步骤详情
*
* @param object
* @return
*/
@Override
public JsonResultEntity getFlowStep(JSONObject object) {
SysFlowStepEntity sysFlowStep = getData("jsonStr", object, SysFlowStepEntity.class);
try {
checkParams(sysFlowStep, "get");
} catch (Exception e) {
return BaseResult.getFailureMessageEntity(e.getMessage());
}
SysFlowStepEntity entity = sysFlowStepDao.get(sysFlowStep.getId());
return BaseResult.getSuccessMessageEntity("查询详情成功", entity);
}
private void checkParams(SysFlowStepEntity entity, String type) {
Assert.notNull(entity, "参数不能为空");
if ("save".equals(type)) {
Assert.notEmpty(entity.getFlowId(), "flowId不能为空");
Assert.notNull(entity.getStep(), "步骤号不能为空");
Assert.notEmpty(entity.getStepType(), "stepType不能为空");
} else if ("update".equals(type)) {
Assert.notEmpty(entity.getAppId(), "appId不能为空");
Assert.notEmpty(entity.getNifiApiId(), "nifiApiId不能为空");
} else if ("delete".equals(type)) {
Assert.notEmpty(entity.getId(), "id不能为空");
}else if ("queryList".equals(type)){
Assert.notEmpty(entity.getFlowId(),"flowId不能为空");
}else if ("get".equals(type)){
Assert.notEmpty(entity.getId(),"id不能为空");
}
}
}

View File

@ -82,6 +82,9 @@ public class SysApplicationApiEntity extends BaseEntity {
/** 返回描述字段*/
private String returnMsg;
//对应nifi的apiid
private String nifiApiId;
public String getReturnMsg() {
return returnMsg;
}
@ -321,5 +324,13 @@ public class SysApplicationApiEntity extends BaseEntity {
public void setAppCode(Long appCode) {
this.appCode = appCode;
}
public String getNifiApiId() {
return nifiApiId;
}
public void setNifiApiId(String nifiApiId) {
this.nifiApiId = nifiApiId;
}
}

View File

@ -10,6 +10,7 @@
<result property="appCode" column="app_code"/>
<result property="apiPath" column="api_path" jdbcType="VARCHAR"/>
<result property="appId" column="app_id" jdbcType="VARCHAR"/>
<result property="nifiApiId" column="nifi_api_id" jdbcType="VARCHAR"/>
<result property="appName" column="app_name" jdbcType="VARCHAR"/>
<result property="appUrl" column="app_url" jdbcType="VARCHAR"/>
<result property="catalogueId" column="catalogue_id" jdbcType="VARCHAR"/>
@ -51,7 +52,8 @@
,api_code
,api_path
,app_id
,catalogue_id
,nifi_api_id
,catalogue_id
,api_name
,api_remark
,need_Login
@ -85,6 +87,7 @@
<sql id="SysApplicationApiEntity_join_sysApp_like_Column_Lis">
sys_application_api.id,
sys_application.app_id as app_code,
sys_application.nifi_api_id as nifi_api_id,
sys_application_api.api_code,
sys_application_api.api_name,
sys_application_api.api_remark,
@ -111,6 +114,7 @@
b.name as app_name,
b.interface_address as app_url,
a.app_id,
a.nifi_api_id,
a.catalogue_id,
c.name as catalogue_name,
a.api_name,
@ -162,6 +166,7 @@ WHERE
,api.api_code
,api.api_path
,api.app_id
,api.nifi_api_id
,api.catalogue_id
,api.api_name
,api.api_remark
@ -200,6 +205,7 @@ WHERE
<if test="apiCode != null ">and api.api_code = #{apiCode}</if>
<if test="apiPath != null and apiPath != ''">and api.api_path = #{apiPath}</if>
<if test="appId != null and appId != ''">and api.app_id = #{appId}</if>
<if test="nifiApiId != null and nifiApiId != ''">and api.nifi_api_id = #{nifiApiId}</if>
<if test="catalogueId != null and catalogueId != ''">and api.catalogue_id = #{catalogueId}</if>
<if test="apiName != null and apiName != ''">and api.api_name = #{apiName}</if>
<if test="apiRemark != null and apiRemark != ''">and api.api_remark = #{apiRemark}</if>
@ -251,6 +257,7 @@ WHERE
<if test="apiCode != null ">and api_code = #{apiCode}</if>
<if test="apiPath != null and apiPath != ''">and api_path = #{apiPath}</if>
<if test="appId != null and appId != ''">and app_id = #{appId}</if>
<if test="nifiApiId != null and nifiApiId != ''">and nifi_api_id = #{nifiApiId}</if>
<if test="catalogueId != null and catalogueId != ''">and catalogue_id = #{catalogueId}</if>
<if test="apiName != null and apiName != ''">and api_name = #{apiName}</if>
<if test="apiRemark != null and apiRemark != ''">and api_remark = #{apiRemark}</if>
@ -304,6 +311,7 @@ WHERE
<if test="apiCode != null ">and api_code like concat('%',#{apiCode},'%')</if>
<if test="apiPath != null and apiPath != ''">and api_path like concat('%',#{apiPath},'%')</if>
<if test="appId != null and appId != ''">and app_id like concat('%',#{appId},'%')</if>
<if test="nifiApiId != null and nifiApiId != ''">and nifi_api_id like concat('%',#{nifiApiId},'%')</if>
<if test="catalogueId != null and catalogueId != ''">and catalogue_id like concat('%',#{catalogueId},'%')
</if>
<if test="apiName != null and apiName != ''">and api_name like concat('%',#{apiName},'%')</if>
@ -372,6 +380,7 @@ WHERE
<if test="apiCode != null ">and sys_application_api.api_code like concat('%',#{apiCode},'%')</if>
<if test="apiPath != null and apiPath != ''">and sys_application_api.api_path like concat('%',#{apiPath},'%')</if>
<if test="appId != null and appId != ''">and sys_application_api.app_id like concat('%',#{appId},'%')</if>
<if test="nifiApiId != null and nifiApiId != ''">and sys_application_api.nifi_api_id like concat('%',#{nifiApiId},'%')</if>
<if test="catalogueId != null and catalogueId != ''">and sys_application_api.catalogue_id like concat('%',#{catalogueId},'%')
</if>
<if test="apiName != null and apiName != ''">and sys_application_api.api_name like concat('%',#{apiName},'%')</if>
@ -438,6 +447,7 @@ WHERE
<if test="apiCode != null ">or api_code = #{apiCode}</if>
<if test="apiPath != null and apiPath != ''">or api_path = #{apiPath}</if>
<if test="appId != null and appId != ''">or app_id = #{appId}</if>
<if test="nifiApiId != null and nifiApiId != ''">or nifi_api_id = #{nifiApiId}</if>
<if test="catalogueId != null and catalogueId != ''">or catalogue_id = #{catalogueId}</if>
<if test="apiName != null and apiName != ''">or api_name = #{apiName}</if>
<if test="apiRemark != null and apiRemark != ''">or api_remark = #{apiRemark}</if>
@ -490,6 +500,7 @@ WHERE
<if test="apiCode == null ">api_code ,</if>
<if test="apiPath != null and apiPath != ''">api_path ,</if>
<if test="appId != null and appId != ''">app_id ,</if>
<if test="nifiApiId != null and nifiApiId != ''">nifi_api_id ,</if>
<if test="catalogueId != null and catalogueId != ''">catalogue_id ,</if>
<if test="apiName != null and apiName != ''">api_name ,</if>
<if test="apiRemark != null and apiRemark != ''">api_remark ,</if>
@ -531,6 +542,7 @@ WHERE
</if>
<if test="apiPath != null and apiPath != ''">#{apiPath} ,</if>
<if test="appId != null and appId != ''">#{appId} ,</if>
<if test="nifiApiId != null and nifiApiId != ''">#{nifiApiId} ,</if>
<if test="catalogueId != null and catalogueId != ''">#{catalogueId} ,</if>
<if test="apiName != null and apiName != ''">#{apiName} ,</if>
<if test="apiRemark != null and apiRemark != ''">#{apiRemark} ,</if>
@ -567,31 +579,32 @@ WHERE
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" >
insert into sys_application_api(api_status,api_code,api_path, app_id, catalogue_id, api_name, api_remark,
insert into sys_application_api(api_status,api_code,api_path, app_id,nifi_api_id, catalogue_id, api_name, api_remark,
need_Login, authentication_port, parameter_passing_mode, destination_address, request_coding, request_method,
timeout_period, current_limiting, header_in, query_in, body_in_type, body_in, body_out, bean_name,return_msg,return_success_field,return_success_value, fun_name, extension_api, sorts, create_user_id,
create_time, modify_user_id, modify_time, sts, org_id, sts)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.apiStatus},#{entity.apiCode},#{entity.apiPath},#{entity.appId},#{entity.catalogueId},#{entity.apiName},#{entity.apiRemark},#{entity.needLogin},#{entity.authenticationPort},#{entity.parameterPassingMode},#{entity.destinationAddress},#{entity.requestCoding},#{entity.requestMethod},#{entity.timeoutPeriod},#{entity.currentLimiting},#{entity.headerIn},#{entity.queryIn},#{entity.bodyInType},#{entity.bodyIn},#{entity.bodyOut},#{entity.beanName},#{entity.returnMsg},#{entity.returnSuccessField},#{entity.returnSuccessValue},#{entity.funName},#{entity.extensionApi},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},
(#{entity.apiStatus},#{entity.apiCode},#{entity.apiPath},#{entity.appId},#{entity.nifiApiId},#{entity.catalogueId},#{entity.apiName},#{entity.apiRemark},#{entity.needLogin},#{entity.authenticationPort},#{entity.parameterPassingMode},#{entity.destinationAddress},#{entity.requestCoding},#{entity.requestMethod},#{entity.timeoutPeriod},#{entity.currentLimiting},#{entity.headerIn},#{entity.queryIn},#{entity.bodyInType},#{entity.bodyIn},#{entity.bodyOut},#{entity.beanName},#{entity.returnMsg},#{entity.returnSuccessField},#{entity.returnSuccessValue},#{entity.funName},#{entity.extensionApi},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id},
'Y')
</foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" >
insert into sys_application_api(api_status,api_code,api_path, app_id, catalogue_id, api_name, api_remark,
insert into sys_application_api(api_status,api_code,api_path, app_id,nifi_api_id, catalogue_id, api_name, api_remark,
need_Login, authentication_port, parameter_passing_mode, destination_address, request_coding, request_method,
timeout_period, current_limiting, header_in, query_in, body_in_type, body_in, body_out,bean_name,return_msg,return_success_field,return_success_value,fun_name,extension_api, sorts, create_user_id,
create_time, modify_user_id, modify_time, sts, org_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.apiStatus},#{entity.apiCode},#{entity.apiPath},#{entity.appId},#{entity.catalogueId},#{entity.apiName},#{entity.apiRemark},#{entity.needLogin},#{entity.authenticationPort},#{entity.parameterPassingMode},#{entity.destinationAddress},#{entity.requestCoding},#{entity.requestMethod},#{entity.timeoutPeriod},#{entity.currentLimiting},#{entity.headerIn},#{entity.queryIn},#{entity.bodyInType},#{entity.bodyIn},#{entity.bodyOut},#{entity.beanName},#{entity.returnMsg},#{entity.returnSuccessField},#{entity.returnSuccessValue},#{entity.funName},#{entity.extensionApi},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id})
(#{entity.apiStatus},#{entity.apiCode},#{entity.apiPath},#{entity.appId},#{entity.nifiApiId},#{entity.catalogueId},#{entity.apiName},#{entity.apiRemark},#{entity.needLogin},#{entity.authenticationPort},#{entity.parameterPassingMode},#{entity.destinationAddress},#{entity.requestCoding},#{entity.requestMethod},#{entity.timeoutPeriod},#{entity.currentLimiting},#{entity.headerIn},#{entity.queryIn},#{entity.bodyInType},#{entity.bodyIn},#{entity.bodyOut},#{entity.beanName},#{entity.returnMsg},#{entity.returnSuccessField},#{entity.returnSuccessValue},#{entity.funName},#{entity.extensionApi},#{entity.sorts},#{entity.create_user_id},#{entity.create_time},#{entity.modify_user_id},#{entity.modify_time},#{entity.sts},#{entity.org_id})
</foreach>
on duplicate key update
api_status = values(api_status),
api_code = values(api_code),
api_path = values(api_path),
app_id = values(app_id),
nifi_api_id = values(nifi_api_id),
catalogue_id = values(catalogue_id),
api_name = values(api_name),
api_remark = values(api_remark),
@ -630,6 +643,7 @@ WHERE
<if test="apiCode != null ">api_code = #{apiCode},</if>
<if test="apiPath != null and apiPath != ''">api_path = #{apiPath},</if>
<if test="appId != null and appId != ''">app_id = #{appId},</if>
<if test="nifiApiId != null and nifiApiId != ''">nifi_api_id = #{nifiApiId},</if>
<if test="catalogueId != null and catalogueId != ''">catalogue_id = #{catalogueId},</if>
<if test="apiName != null and apiName != ''">api_name = #{apiName},</if>
<if test="apiRemark != null and apiRemark != ''">api_remark = #{apiRemark},</if>
@ -683,6 +697,7 @@ where id = #{id}
<if test="apiCode != null ">and api_code = #{apiCode}</if>
<if test="apiPath != null and apiPath != ''">and api_path = #{apiPath}</if>
<if test="appId != null and appId != ''">and app_id = #{appId}</if>
<if test="nifiApiId != null and nifiApiId != ''">and nifi_api_id = #{nifiApiId}</if>
<if test="catalogueId != null and catalogueId != ''">and catalogue_id = #{catalogueId}</if>
<if test="apiName != null and apiName != ''">and api_name = #{apiName}</if>
<if test="apiRemark != null and apiRemark != ''">and api_remark = #{apiRemark}</if>
@ -919,6 +934,7 @@ where id = #{id}
select
id
,app_id
,nifi_api_id
,api_name
from sys_application_api
<trim prefix="where" prefixOverrides="and">
@ -927,6 +943,7 @@ where id = #{id}
<if test="apiCode != null ">and api_code = #{apiCode}</if>
<if test="apiPath != null and apiPath != ''">and api_path = #{apiPath}</if>
<if test="appId != null and appId != ''">and app_id = #{appId}</if>
<if test="nifiApiId != null and nifiApiId != ''">and nifi_api_id = #{nifiApiId}</if>
<if test="catalogueId != null and catalogueId != ''">and catalogue_id = #{catalogueId}</if>
<if test="apiName != null and apiName != ''">and api_name = #{apiName}</if>
<if test="apiRemark != null and apiRemark != ''">and api_remark = #{apiRemark}</if>

View File

@ -1,6 +1,8 @@
package com.hzya.frame.sysnew.application.appAcount.entity;
import java.util.Date;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.web.entity.BaseEntity;
/**
* 应用账户表(SysApplicationAccount)实体类
@ -132,6 +134,5 @@ public class SysApplicationAccountEntity extends BaseEntity {
public void setAgentid(String agentid) {
this.agentid = agentid;
}
}

View File

@ -33,7 +33,7 @@
,modify_time
,sts
,sorts
,appId
,app_id
,name
,ip_address
,port
@ -46,6 +46,14 @@
,corpId
,agentId
</sql>
<select id="entity_get" parameterType="com.hzya.frame.sysnew.application.appAcount.entity.SysApplicationAccountEntity" resultMap="get-SysApplicationAccountEntity-result">
select
<include refid="SysApplicationAccountEntity_Base_Column_List"/>
from sys_application_account
where id = #{id}
and sts = 'Y'
</select>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-SysApplicationAccountEntity-result"
parameterType="com.hzya.frame.sysnew.application.appAcount.entity.SysApplicationAccountEntity">
@ -199,6 +207,7 @@
<if test="appSecret != null and appSecret != ''">app_secret ,</if>
<if test="corpid != null and corpid != ''">corpId ,</if>
<if test="agentid != null and agentid != ''">agentId ,</if>
<if test="appId != null and appId != ''">app_id ,</if>
<if test="sorts == null ">sorts,</if>
<if test="sts == null ">sts,</if>
</trim>
@ -222,8 +231,10 @@
<if test="appSecret != null and appSecret != ''">#{appSecret} ,</if>
<if test="corpid != null and corpid != ''">#{corpid} ,</if>
<if test="agentid != null and agentid != ''">#{agentid} ,</if>
<if test="sorts == null ">COALESCE((select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_application_account a
WHERE a.sts = 'Y' )1),
<if test="appId != null and appId != ''">#{appId} ,</if>
<if test="sorts == null ">
COALESCE((select (max(IFNULL( a.sorts, 0 )) + 1) as sort from sys_application_account a WHERE
a.sts = 'Y' ),1),
</if>
<if test="sts == null ">'Y',</if>
</trim>
@ -284,6 +295,7 @@
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="password != null and password != ''">password = #{password},</if>
<if test="dbType != null and dbType != ''">db_type = #{dbType},</if>
<if test="appId != null and appId != ''">app_id = #{appId},</if>
<if test="appKey != null and appKey != ''">app_key = #{appKey},</if>
<if test="appSecret != null and appSecret != ''">app_secret = #{appSecret},</if>
<if test="corpid != null and corpid != ''">corpId = #{corpid},</if>
@ -318,6 +330,7 @@
<if test="appKey != null and appKey != ''">and app_key = #{appKey}</if>
<if test="appSecret != null and appSecret != ''">and app_secret = #{appSecret}</if>
<if test="corpid != null and corpid != ''">and corpId = #{corpid}</if>
<if test="appId != null and appId != ''">and app_id = #{appId}</if>
<if test="agentid != null and agentid != ''">and agentId = #{agentid}</if>
and sts='Y'
</trim>

View File

@ -1,15 +1,21 @@
package com.hzya.frame.sysnew.application.appAcount.service.impl;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.sysnew.application.appAcount.entity.SysApplicationAccountEntity;
import com.hzya.frame.sysnew.application.appAcount.dao.ISysApplicationAccountDao;
import com.hzya.frame.sysnew.application.appAcount.service.ISysApplicationAccountService;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import com.hzya.frame.basedao.service.impl.BaseService;
import java.util.List;
/**
* 应用账户表(SysApplicationAccount)表服务实现类
*
@ -41,6 +47,11 @@ public class SysApplicationAccountServiceImpl extends BaseService<SysApplication
}catch (Exception e){
return BaseResult.getFailureMessageEntity(e.getMessage());
}
//控制一下名字不能重复
List<SysApplicationAccountEntity> queryList = queryByName(entity);
if (CollectionUtils.isNotEmpty(queryList) && queryList.size() > 0){
return BaseResult.getFailureMessageEntity(entity.getName()+"重复");
}
sysApplicationAccountDao.save(entity);
return BaseResult.getSuccessMessageEntity("新增成功");
}
@ -53,7 +64,23 @@ public class SysApplicationAccountServiceImpl extends BaseService<SysApplication
*/
@Override
public JsonResultEntity updateAccount(JSONObject object) {
return null;
SysApplicationAccountEntity entity = getData("jsonStr", object, SysApplicationAccountEntity.class);
try {
checkParam(entity,"update");
}catch (Exception e){
return BaseResult.getFailureMessageEntity(e.getMessage());
}
//检查一下名字不能重复
List<SysApplicationAccountEntity> queryList = queryByName(entity);
if (CollectionUtils.isNotEmpty(queryList) && queryList.size() > 0){
for (SysApplicationAccountEntity acc : queryList) {
if (!acc.getId().equals(entity.getId())){
return BaseResult.getFailureMessageEntity(entity.getName()+"重复");
}
}
}
sysApplicationAccountDao.update(entity);
return BaseResult.getSuccessMessageEntity("更新成功");
}
/**
@ -64,7 +91,14 @@ public class SysApplicationAccountServiceImpl extends BaseService<SysApplication
*/
@Override
public JsonResultEntity deleteAccount(JSONObject object) {
return null;
SysApplicationAccountEntity entity = getData("jsonStr", object, SysApplicationAccountEntity.class);
try {
checkParam(entity,"delete");
}catch (Exception e){
return BaseResult.getFailureMessageEntity(e.getMessage());
}
sysApplicationAccountDao.logicRemove(entity);
return BaseResult.getSuccessMessageEntity("删除成功");
}
/**
@ -75,7 +109,14 @@ public class SysApplicationAccountServiceImpl extends BaseService<SysApplication
*/
@Override
public JsonResultEntity getAccount(JSONObject object) {
return null;
SysApplicationAccountEntity entity = getData("jsonStr", object, SysApplicationAccountEntity.class);
try {
checkParam(entity,"get");
}catch (Exception e){
return BaseResult.getFailureMessageEntity(e.getMessage());
}
SysApplicationAccountEntity sysApplicationAccountEntity = sysApplicationAccountDao.get(entity.getId());
return BaseResult.getSuccessMessageEntity("查询账户详情成功",sysApplicationAccountEntity);
}
/**
@ -86,7 +127,14 @@ public class SysApplicationAccountServiceImpl extends BaseService<SysApplication
*/
@Override
public JsonResultEntity queryAccountList(JSONObject object) {
return null;
SysApplicationAccountEntity entity = getData("jsonStr", object, SysApplicationAccountEntity.class);
try {
checkParam(entity,"queryList");
}catch (Exception e){
return BaseResult.getFailureMessageEntity(e.getMessage());
}
List<SysApplicationAccountEntity> queryList = sysApplicationAccountDao.query(entity);
return BaseResult.getSuccessMessageEntity("查询列表成功",queryList);
}
/**
@ -97,11 +145,43 @@ public class SysApplicationAccountServiceImpl extends BaseService<SysApplication
*/
@Override
public JsonResultEntity queryAccountPaged(JSONObject object) {
SysApplicationAccountEntity entity = getData("jsonStr", object, SysApplicationAccountEntity.class);
try {
checkParam(entity,"queryPaged");
}catch (Exception e){
return BaseResult.getFailureMessageEntity(e.getMessage());
}
return null;
}
//根据账户名称查询
private List<SysApplicationAccountEntity> queryByName(SysApplicationAccountEntity entity){
if (StrUtil.isNotEmpty(entity.getName())){
SysApplicationAccountEntity account = new SysApplicationAccountEntity();
account.setName(entity.getName());
List<SysApplicationAccountEntity> queryList = sysApplicationAccountDao.query(account);
return queryList;
}
return null;
}
//数据检查
private void checkParam(SysApplicationAccountEntity entity,String type){
Assert.notNull(entity,"参数不能为空");
if ("save".equals(type)){
Assert.notEmpty(entity.getAppId(),"appId不能为空");
Assert.notEmpty(entity.getName(),"账户名称不能为空");
}else if ("update".equals(type)){
Assert.notEmpty(entity.getId(),"id不能为空");
}else if ("delete".equals(type)){
Assert.notEmpty(entity.getId(),"id不能为空");
}else if ("get".equals(type)){
Assert.notEmpty(entity.getId(),"id不能为空");
}else if ("queryList".equals(type)){
Assert.notEmpty(entity.getAppId(),"appId不能为空");
}else if ("queryPaged".equals(type)){
Assert.notNull(entity.getPageNum(),"pageNum不能为空");
Assert.notNull(entity.getPageSize(),"pageSize不能为空");
}
}
}