|
@@ -16,9 +16,9 @@ import com.boman.domain.SysDictData;
|
|
|
import com.boman.domain.constant.*;
|
|
|
import com.boman.gen.api.RemoteGenTableColumnService;
|
|
|
import com.boman.gen.api.RemoteGenTableService;
|
|
|
-import com.boman.gen.controller.MyController;
|
|
|
-import com.boman.gen.domain.GenTable;
|
|
|
-import com.boman.gen.domain.GenTableColumn;
|
|
|
+//import com.boman.gen.controller.MyController;
|
|
|
+import com.boman.domain.GenTable;
|
|
|
+import com.boman.domain.GenTableColumn;
|
|
|
import com.boman.system.api.RemoteDictDataService;
|
|
|
import com.boman.system.api.domain.SysFile;
|
|
|
import com.boman.web.core.domain.*;
|
|
@@ -67,7 +67,7 @@ public class TableServiceCmdService {
|
|
|
@Resource
|
|
|
private IBaseUpdateService updateService;
|
|
|
@Resource
|
|
|
- private RestTemplate restTemplate;
|
|
|
+ private RestTemplate restTemplate;
|
|
|
@Resource
|
|
|
private RemoteDictDataService remoteDictDataService;
|
|
|
@Resource
|
|
@@ -220,15 +220,15 @@ public class TableServiceCmdService {
|
|
|
// 处理blob
|
|
|
handlerBlobWithJSONObject(genTable.getIsContainsBlob(), result);
|
|
|
// 处理日期、外键、字典值
|
|
|
- handler(result = filter(result, ObjectUtils::isNotEmpty), columns);
|
|
|
+ handler(result = filter(result, ObjectUtils::isNotEmpty), columns);
|
|
|
// 定制接口
|
|
|
- result = isCustomized(dto.getTable(),result,"trigger_retrieve");
|
|
|
+ result = isCustomized(dto.getTable(), result, "trigger_retrieve");
|
|
|
|
|
|
rows.put(PAGE_ROWS, result);
|
|
|
return AjaxResult.success(rows);
|
|
|
}
|
|
|
|
|
|
- private void handler(List<JSONObject> result, List<GenTableColumn> columns){
|
|
|
+ private void handler(List<JSONObject> result, List<GenTableColumn> columns) {
|
|
|
// 处理时间
|
|
|
handlerDate(result, columns);
|
|
|
// 处理字典值
|
|
@@ -259,7 +259,7 @@ public class TableServiceCmdService {
|
|
|
for (JSONObject json : result) {
|
|
|
if (json.containsKey(selfColumnName.toUpperCase()) || json.containsKey(selfColumnName.toLowerCase())) {
|
|
|
Map<String, String> fkInfoMap = column.getFkInfo();
|
|
|
- String fkTableName = fkInfoMap.get(FK_TABLE_NAME);
|
|
|
+ String fkTableName = fkInfoMap.get(FK_TABLE_NAME);
|
|
|
String fkColumnName = fkInfoMap.get(FK_COLUMN_NAME);
|
|
|
String dkColumnName = fkInfoMap.get(DK_COLUMN_NAME);
|
|
|
Object primaryTableFkValue = json.get(selfColumnName);
|
|
@@ -341,7 +341,8 @@ public class TableServiceCmdService {
|
|
|
for (GenTableColumn column : columns) {
|
|
|
if (jsonObject.containsKey(column.getColumnName())) {
|
|
|
String value = jsonObject.getString(column.getColumnName());
|
|
|
- List<SysFile> fileList = JSON.parseObject(value, new TypeReference<List<SysFile>>(){}.getType());
|
|
|
+ List<SysFile> fileList = JSON.parseObject(value, new TypeReference<List<SysFile>>() {
|
|
|
+ }.getType());
|
|
|
jsonObject.put(column.getColumnName(), fileList);
|
|
|
}
|
|
|
}
|
|
@@ -412,7 +413,7 @@ public class TableServiceCmdService {
|
|
|
handlerDate(Collections.singletonList(json), Collections.singletonList(column));
|
|
|
handlerForeignKey(Collections.singletonList(json), Collections.singletonList(column));
|
|
|
if (GenConstants.HTML_IMAGE_UPLOAD.equalsIgnoreCase(column.getHtmlType())
|
|
|
- || GenConstants.HTML_FILE_UPLOAD.equalsIgnoreCase(column.getHtmlType()) ) {
|
|
|
+ || GenConstants.HTML_FILE_UPLOAD.equalsIgnoreCase(column.getHtmlType())) {
|
|
|
handlerAnnex(Collections.singletonList(json), Collections.singletonList(column));
|
|
|
}
|
|
|
|
|
@@ -496,18 +497,18 @@ public class TableServiceCmdService {
|
|
|
// genTable.getMenuRole() 暂时数据库没有数据,
|
|
|
jsonObject.put(FormDataConstant.BUTTON_LIST, Strings.nullToEmpty(genTable.getMenuRole()));
|
|
|
|
|
|
- jsonObject.put(ViewConst.VIEW_TYPE, Strings.nullToEmpty(genTable.getTplCategory()));
|
|
|
+ jsonObject.put(ViewConst.VIEW_TYPE, Strings.nullToEmpty(genTable.getTplCategory()));
|
|
|
return AjaxResult.success(jsonObject);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 功能描述: 获取表单查询字段
|
|
|
* 注意: 都是从redis中拿的,如果数据库和redis不一致,则需刷新一下redis
|
|
|
- * 刷新的入口为 {@link MyController#loadTable(com.boman.gen.domain.GenTable)}
|
|
|
- *
|
|
|
- * eg:{
|
|
|
- * "table": "sys_config"
|
|
|
- * }
|
|
|
+ * 刷新的入口为 {@link MyController#loadTable(GenTable)}
|
|
|
+ * <p>
|
|
|
+ * eg:{
|
|
|
+ * "table": "sys_config"
|
|
|
+ * }
|
|
|
*
|
|
|
* @param condition condition
|
|
|
* @return com.boman.common.core.web.domain.AjaxResult
|
|
@@ -545,10 +546,11 @@ public class TableServiceCmdService {
|
|
|
|
|
|
/**
|
|
|
* 根据表对象获取要显示的表头信息
|
|
|
+ *
|
|
|
* @param genTable
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<GenTableColumn> getTableHeadList(GenTable genTable){
|
|
|
+ public List<GenTableColumn> getTableHeadList(GenTable genTable) {
|
|
|
List<GenTableColumn> columns = genTable.getColumns();
|
|
|
// 表头
|
|
|
return filterData(columns, 4, MaskConstant.LIST_VISIBLE::equals);
|
|
@@ -647,18 +649,19 @@ public class TableServiceCmdService {
|
|
|
/**
|
|
|
* 是否定制
|
|
|
* 判断是否需要转发到定制接口
|
|
|
+ *
|
|
|
* @param tableName 表明
|
|
|
- * @param result 结果
|
|
|
- * @param action 动作
|
|
|
+ * @param result 结果
|
|
|
+ * @param action 动作
|
|
|
* @return 结果
|
|
|
*/
|
|
|
public List<JSONObject> isCustomized(String tableName, List<JSONObject> result, String action) {
|
|
|
requireNonNull(tableName);
|
|
|
requireNonNull(action);
|
|
|
- if (result != null && result.size() > 0){
|
|
|
+ if (result != null && result.size() > 0) {
|
|
|
//获取到服务名称
|
|
|
String triggerName = getTriggerName(tableName, action);
|
|
|
- if(triggerName != null){
|
|
|
+ if (triggerName != null) {
|
|
|
//组织请求 acos + RestTemplate
|
|
|
return restTemplate.postForObject("http://" + triggerName, result, List.class);
|
|
|
}
|
|
@@ -668,22 +671,23 @@ public class TableServiceCmdService {
|
|
|
|
|
|
/**
|
|
|
* 判断是什么action
|
|
|
+ *
|
|
|
* @param tableName 表明
|
|
|
- * @param action 动作
|
|
|
+ * @param action 动作
|
|
|
* @return
|
|
|
*/
|
|
|
- private String getTriggerName(String tableName, String action){
|
|
|
+ private String getTriggerName(String tableName, String action) {
|
|
|
GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, tableName);
|
|
|
requireNonNull(genTable);
|
|
|
- if (action.equals(TriggerActionConstant.ACTION_CREATE)){
|
|
|
+ if (action.equals(TriggerActionConstant.ACTION_CREATE)) {
|
|
|
return genTable.getTriggerCreate();
|
|
|
- }else if (action.equals(TriggerActionConstant.ACTION_RETRIEVE)){
|
|
|
+ } else if (action.equals(TriggerActionConstant.ACTION_RETRIEVE)) {
|
|
|
return genTable.getTriggerRetrieve();
|
|
|
- }else if (action.equals(TriggerActionConstant.ACTION_UPDATE)){
|
|
|
+ } else if (action.equals(TriggerActionConstant.ACTION_UPDATE)) {
|
|
|
return genTable.getTriggerUpdate();
|
|
|
- }else if (action.equals(TriggerActionConstant.ACTION_DELETE)){
|
|
|
+ } else if (action.equals(TriggerActionConstant.ACTION_DELETE)) {
|
|
|
return genTable.getTriggerDelete();
|
|
|
- }else if (action.equals(TriggerActionConstant.ACTION_SUBMIT)){
|
|
|
+ } else if (action.equals(TriggerActionConstant.ACTION_SUBMIT)) {
|
|
|
return genTable.getTriggerSubmit();
|
|
|
}
|
|
|
return null;
|
|
@@ -694,7 +698,7 @@ public class TableServiceCmdService {
|
|
|
*
|
|
|
* @param redisKeyPrefix 前缀
|
|
|
* @param tableName 表名
|
|
|
- * @return com.boman.gen.domain.GenTable
|
|
|
+ * @return com.boman.domain.GenTable
|
|
|
*/
|
|
|
public GenTable getTableFromRedisByTableName(String redisKeyPrefix, String tableName) {
|
|
|
tableName = tableName.trim().toLowerCase();
|
|
@@ -770,7 +774,7 @@ public class TableServiceCmdService {
|
|
|
return remoteGenTableColumnService.listColumnsByTableId(table.getTableId());
|
|
|
}
|
|
|
|
|
|
- public List<SysDictData> listSysDictDataByType(String dictType){
|
|
|
+ public List<SysDictData> listSysDictDataByType(String dictType) {
|
|
|
List<SysDictData> sysDictData = null;
|
|
|
try {
|
|
|
sysDictData = remoteDictDataService.listByType(dictType);
|