|
|
@@ -16,10 +16,7 @@ import com.cloud.sa.flow.commom.common.utils.StConvert;
|
|
|
import com.cloud.sa.flow.commom.common.utils.StString;
|
|
|
import com.cloud.sa.flow.commom.domain.common.RedisKeys;
|
|
|
import com.cloud.sa.flow.commom.domain.common.StGlobalConstant;
|
|
|
-import com.cloud.sa.flow.commom.domain.entity.StCommonComment;
|
|
|
-import com.cloud.sa.flow.commom.domain.entity.StFlowExceptional;
|
|
|
-import com.cloud.sa.flow.commom.domain.entity.StPrint;
|
|
|
-import com.cloud.sa.flow.commom.domain.entity.StPrintHistory;
|
|
|
+import com.cloud.sa.flow.commom.domain.entity.*;
|
|
|
import com.cloud.sa.flow.commom.domain.entity.setting.StEventAdditive;
|
|
|
import com.cloud.sa.flow.commom.domain.entity.setting.StEventMain;
|
|
|
import com.cloud.sa.flow.commom.domain.entity.setting.StQueryMain;
|
|
|
@@ -75,7 +72,13 @@ public class StSettingService {
|
|
|
@Value("${server.port}")
|
|
|
private String port;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ StFormTemplateMapper stFormTemplateMapper;
|
|
|
|
|
|
+ public StResult getScriptByFlowCode(String flowCode) {
|
|
|
+ List<String> scriptByFlowCode = stFormTemplateMapper.getScriptKeyByFlowCode(flowCode);
|
|
|
+ return StResult.success(scriptByFlowCode);
|
|
|
+ }
|
|
|
//region 数据查询
|
|
|
public synchronized void istQueryMain(StQueryMain queryMain) {
|
|
|
//TODO 插入后,要预制columns,目前先让手动写
|
|
|
@@ -109,8 +112,9 @@ public class StSettingService {
|
|
|
|
|
|
private List<Map<String, String>> getQuerySData(StQueryMain singleQueryMain, String query, String queryMapField) {
|
|
|
if ("1".equals(singleQueryMain.getQueryType())) {
|
|
|
+ //如果是接口的
|
|
|
try {
|
|
|
- String url = "http://localhost:" + port + singleQueryMain.getQuerySql();
|
|
|
+ String url = StString.getLocalHost(port) + singleQueryMain.getQuerySql();
|
|
|
if (StString.isNotEmpty(queryMapField)) {
|
|
|
JSONArray jsonArray = JSONArray.parseArray(queryMapField);
|
|
|
for (Object item : jsonArray) {
|
|
|
@@ -166,6 +170,7 @@ public class StSettingService {
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
} else {
|
|
|
+ //如果是sql的
|
|
|
String sql = sqlGenerator.getQueryConcatSql(singleQueryMain.getQuerySql().replaceAll("\\s+$", "").replaceAll(";+$", ""), query);
|
|
|
//将所有连续的空白字符替换为一个空格
|
|
|
sql = sql.replaceAll("\\s{2,}", " ");
|
|
|
@@ -232,12 +237,24 @@ public class StSettingService {
|
|
|
});
|
|
|
return queryMainDTOS;
|
|
|
}
|
|
|
+
|
|
|
+ public StResult getQueryServiceRelated(String queryId) {
|
|
|
+ List<Map<String, String>> queryDataList = commonMapper.getQueryDataList("" +
|
|
|
+ "select flow_code flowCode,flow_name flowName from st_flow_menu where flow_code in (\n" +
|
|
|
+ "select flow_code from st_form_template where content like '%\"queryService\":" + queryId + ",%'\n" +
|
|
|
+ "union \n" +
|
|
|
+ "select flow_code from st_form_template where content like '%\"queryService\": " + queryId + ",%')");
|
|
|
+ return StResult.success(queryDataList);
|
|
|
+ }
|
|
|
+
|
|
|
public StQueryMainDTO getQueryMainSingleForMapping(Integer queryId) {
|
|
|
StQueryMain singleQueryMain = settingMapper.getSingleQueryMain(queryId);
|
|
|
singleQueryMain.initList();
|
|
|
StQueryMainDTO queryMainDTO = StConvert.copy(singleQueryMain, StQueryMainDTO.class);
|
|
|
return queryMainDTO;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
//endregion
|
|
|
|
|
|
/**
|