郑根木 2 anni fa
parent
commit
5a717340b4
11 ha cambiato i file con 69 aggiunte e 287 eliminazioni
  1. +65
    -26
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/common/SwEnum.java
  2. +0
    -43
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/config/DesignConfig.java
  3. +0
    -60
      smtweb-framework/sw-framework-core/src/main/resources/config/app-config.yaml
  4. +0
    -111
      smtweb-framework/sw-framework-core/src/main/resources/config/demo.json
  5. +0
    -14
      smtweb-framework/sw-framework-core/src/main/resources/config/design_db.yaml
  6. +0
    -16
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/DbConfigService.java
  7. +0
    -4
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/model/AspDbCardService.java
  8. +0
    -4
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/model/AspModelCardService.java
  9. +3
    -4
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/model/AspModelConfigService.java
  10. +0
    -4
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/model/AspModelExportService.java
  11. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/task/service/BpmTaskCardService.java

+ 65
- 26
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/common/SwEnum.java Vedi File

@@ -12,7 +12,7 @@ public interface SwEnum {
* Created by Akmm at 2022/2/9 10:01
* 字段业务类别
*/
class FieldType extends IntEnum{
class FieldType extends IntEnum {
public static FieldType instance = new FieldType();

public static IntEnumBean ID = instance.addEnum(1, "主键");
@@ -28,33 +28,72 @@ public interface SwEnum {
}

/**
* 字段编辑类型
*/
class EditorType extends StrEnum {
public static EditorType instance = new EditorType();

public static StrEnumBean INPUT = instance.addEnum("input", "文本");
public static StrEnumBean TEXT = instance.addEnum("text", "长文本");
public static StrEnumBean NUMBER = instance.addEnum("num", "数字");
public static StrEnumBean DATE = instance.addEnum("date", "日期");
public static StrEnumBean TIME = instance.addEnum("time", "时间");
public static StrEnumBean DATETIME = instance.addEnum("datetime", "日期时间");
public static StrEnumBean COMBO = instance.addEnum("combo", "下拉");
public static StrEnumBean TREE = instance.addEnum("tree", "树型");

}

/**
* 数据字段类型Bean
*/
class DataTypeBean extends AbstractEnum.StrEnumBean {
public String sqlType;
public int dataLength;
public String javaType;
public String defaultValue;
public String editor;

public DataTypeBean(String value, String name, String sqlType, int dataLength, String javaType, String defaultValue, String editor) {
super(value, name);
this.sqlType = sqlType;
this.dataLength = dataLength;
this.javaType = javaType;
this.defaultValue = defaultValue;
this.editor = editor;
}
}

/**
* 数据类型定义,参见design_db.yaml配置
*/
@Data
class DataType {
/*{type: "id", name: "ID", sql-type: "bigint", java-type: "long", widget: "fz-field-long", defaultValue: "0"}
- {type: "code", name: "编码", sql-type: "varchar", java-type: "string", data-length: 32, widget: "fz-field-string", defaultValue: ""}
- {type: "name", name: "名字", sql-type: "varchar", java-type: "string", data-length: 100, widget: "fz-field-string", defaultValue: ""}
- {type: "remark", name: "备注", sql-type: "varchar", data-length: 255, java-type: "string", widget: "fz-field-string", defaultValue: ""}
- {type: "text", name: "大文本", sql-type: "text", java-type: "string", widget: "fz-field-string", defaultValue: ""}
- {type: "currency", name: "货币", sql-type: "bigint", java-type: "long", widget: "fz-field-long", defaultValue: "0"}
- {type: "datetime", name: "时间日期", sql-type: "bigint", java-type: "long", widget: "fz-field-datetime", defaultValue: "0"}
- {type: "date", name: "日期", sql-type: "int", java-type: "int", widget: "fz-field-date", defaultValue: "0"}
- {type: "time", name: "时间", sql-type: "int", java-type: "int", widget: "fz-field-time", defaultValue: "0"}
- {type: "int", name: "整型", sql-type: "int", java-type: "int", widget: "fz-field-int", defaultValue: "0"}
- {type: "smallint", name: "短整型", sql-type: "smallint", java-type: "short", widget: "fz-field-int", defaultValue: "0"}
- {type: "bool", name: "布尔型", sql-type: "tinyint", java-type: "boolean", widget: "fz-field-bool", defaultValue: "0"}*/
public static final String TYPE_STR = "varchar";
public static final String TYPE_BOOL = "bool";
public static final String TYPE_DATETIME = "datetime";
public static final String TYPE_DATE = "date";

private String type;
private String name;
private String sqlType;
private int dataLength;
private String javaType;
private String defaultValue;
class DataType extends AbstractEnum<String, DataTypeBean> {
public final static String TYPE_BOOL = "bool";
public final static String TYPE_DATE = "date";
public final static String TYPE_DATETIME = "datetime";

public static DataType instance = new DataType();
public static DataTypeBean ID = instance.addEnum("id", "ID", "bigint", 0, "long", "", EditorType.INPUT.value);
public static DataTypeBean CODE = instance.addEnum("code", "编码", "varchar", 32, "string", "", EditorType.INPUT.value);
public static DataTypeBean NAME = instance.addEnum("name", "名称", "varchar", 100, "string", "", EditorType.INPUT.value);
public static DataTypeBean REMARK = instance.addEnum("remark", "备注", "varchar", 255, "string", "", EditorType.INPUT.value);
public static DataTypeBean TEXT = instance.addEnum("text", "大文本", "text", 0, "string", "", EditorType.TEXT.value);
public static DataTypeBean INT = instance.addEnum("int", "整型", "int", 0, "int", "0", EditorType.NUMBER.value);
public static DataTypeBean SHORT = instance.addEnum("short", "短整型", "smallint", 0, "short", "0", EditorType.NUMBER.value);
public static DataTypeBean BOOL = instance.addEnum("bool", "布尔型", "tinyint", 0, "boolean", "0", EditorType.COMBO.value);
public static DataTypeBean CURRENCY = instance.addEnum("currency", "金额型", "bigint", 0, "long", "0", EditorType.NUMBER.value);
public static DataTypeBean DATE = instance.addEnum("date", "日期型", "bigint", 0, "long", "0", EditorType.DATE.value);
public static DataTypeBean TIME = instance.addEnum("time", "时间型", "bigint", 0, "long", "0", EditorType.TIME.value);
public static DataTypeBean DATETIME = instance.addEnum("datetime", "时间型", "bigint", 0, "long", "0", EditorType.DATETIME.value);

@Override
protected DataTypeBean buildBean(String value, String name) {
return null;
}

public DataTypeBean addEnum(String value, String name, String sqlType, int dataLength, String javaType, String defaultValue, String editor) {
return new DataTypeBean(value, name, sqlType, dataLength, javaType, defaultValue, editor);
}
}

/**


+ 0
- 43
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/config/DesignConfig.java Vedi File

@@ -1,43 +0,0 @@
package cc.smtweb.framework.core.db.config;

import cc.smtweb.framework.core.common.SwEnum;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
//通过@PropertySource注解指定要读取的yaml配置文件,默认读取src\main\resources\application.yml配置
@PropertySource(value = "classpath:config/design_db.yaml", factory = YamlPropertyLoaderFactory.class)
@ConfigurationProperties(prefix = "design")
public class DesignConfig {
private List<SwEnum.DataType> dataTypes;

private Map<String, SwEnum.DataType> mapType = null;

private void adjustMap() {
if (mapType == null) {
synchronized (DesignConfig.class) {
if (mapType == null) {
Map<String, SwEnum.DataType> map = new HashMap<>();
for (SwEnum.DataType type : dataTypes) {
map.put(type.getType(), type);
}
mapType = map;
}
}
}
}

public SwEnum.DataType getDataType(String type) {
adjustMap();
return mapType.get(type);
}

public List<SwEnum.DataType> getDataTypes() {
return dataTypes;
}
}

+ 0
- 60
smtweb-framework/sw-framework-core/src/main/resources/config/app-config.yaml Vedi File

@@ -1,60 +0,0 @@
smtweb:
machine-id: 1
file:
local-path: /data/files/smart/
host: http://127.0.0.1
url: ${smtweb.file.host}:${server.port}${server.servlet.context-path}/${smtweb.file.local-path}
db:
default:
rule:
prefix: _smt_
replace: smt_
server:
port: 8888
servlet:
context-path: /
logging:
level:
root: INFO
cc.smtweb: DEBUG
spring:
# 设置服务名
application:
name: smtweb_core
main:
allow-bean-definition-overriding: true
mvc:
static-path-pattern: /static/**
redis:
host: 127.0.0.1
port: 6379
password:
database: 0
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/sw_user?useUnicode=true&characterEncoding=utf-8&useTimezone=true&serverTimezone=CTT&allowMultiQueries=true&useSSL=false
username: root
password: 1681860
servlet:
multipart:
max-file-size: 104857600000
max-request-size: 10485760000000
profiles:
include: role
cache:
type: caffeine
cache-names:
- core
caffeine:
spec: maximumSize=1024,expireAfterWrite=2h
park:
secret:
key: null
# key: cmVmb3JtZXJyZWZvcm1lcg==
swagger:
name: smtweb-core
version: 2.0
enabled: true




+ 0
- 111
smtweb-framework/sw-framework-core/src/main/resources/config/demo.json Vedi File

@@ -1,111 +0,0 @@
{
"fields": [
{
"name": "mc_id",
"fieldType": "1",
"dataType": "ID",
"null": "1",
"default": "-1",
"title": "ID"
},
{
"name": "mc_parent_id",
"fieldType": "4",
"dataType": "ID",
"null": "1",
"default": "-1",
"title": "ID",
"link": "2"
},
{
"name": "mc_prj_id",
"fieldType": "",
"dataType": "ID",
"null": "1",
"default": "-1",
"title": "ID",
"link": "1"
},
{
"name": "mc_code",
"fieldType": "2",
"dataType": "CODE",
"null": "0",
"default": "",
"title": "编码",
"link": "",
"editor": ""
},
{
"name": "mc_name",
"fieldType": "3",
"dataType": "NAME",
"null": "0",
"default": "",
"title": "编码",
"link": "",
"editor": ""
},
{
"name": "mc_create_uid",
"fieldType": "7",
"dataType": "ID",
"null": "1",
"default": "-1",
"title": "创建人",
"link": "",
"editor": ""
},
{
"name": "mc_update_uid",
"fieldType": "9",
"dataType": "ID",
"null": "1",
"default": "-1",
"title": "最后更新人",
"link": "",
"editor": ""
},
{
"name": "mc_create_at",
"fieldType": "8",
"dataType": "DATETIME",
"null": "1",
"default": "-1",
"title": "创建时间",
"link": "",
"editor": ""
},
{
"name": "mc_update_at",
"fieldType": "10",
"dataType": "DATETIME",
"null": "1",
"default": "-1",
"title": "最后更新时间",
"link": "",
"editor": ""
}
],
"indexes": [
{
"name": "pk",
"fields": "mc_id",
"type": "P"
}
],
"caches": [
{
"name": "pr",
"title": "按树型",
"fields": "mc_parent_id",
"type": "L"
},
{
"name": "prj",
"title": "按项目",
"fields": "mc_prj_id,mc_parent_id",
"type": "L"
}
]
}

+ 0
- 14
smtweb-framework/sw-framework-core/src/main/resources/config/design_db.yaml Vedi File

@@ -1,14 +0,0 @@
design:
data-type:
- {type: "id", name: "ID", sql-type: "bigint", java-type: "long", widget: "fz-field-long", defaultValue: "0"}
- {type: "code", name: "编码", sql-type: "varchar", java-type: "string", data-length: 32, widget: "fz-field-string", defaultValue: ""}
- {type: "name", name: "名字", sql-type: "varchar", java-type: "string", data-length: 100, widget: "fz-field-string", defaultValue: ""}
- {type: "remark", name: "备注", sql-type: "varchar", data-length: 255, java-type: "string", widget: "fz-field-string", defaultValue: ""}
- {type: "text", name: "大文本", sql-type: "text", java-type: "string", widget: "fz-field-string", defaultValue: ""}
- {type: "currency", name: "货币", sql-type: "bigint", java-type: "long", widget: "fz-field-long", defaultValue: "0"}
- {type: "datetime", name: "时间日期", sql-type: "bigint", java-type: "long", widget: "fz-field-datetime", defaultValue: "0"}
- {type: "date", name: "日期", sql-type: "int", java-type: "int", widget: "fz-field-date", defaultValue: "0"}
- {type: "time", name: "时间", sql-type: "int", java-type: "int", widget: "fz-field-time", defaultValue: "0"}
- {type: "int", name: "整型", sql-type: "int", java-type: "int", widget: "fz-field-int", defaultValue: "0"}
- {type: "smallint", name: "短整型", sql-type: "smallint", java-type: "short", widget: "fz-field-int", defaultValue: "0"}
- {type: "bool", name: "布尔型", sql-type: "tinyint", java-type: "boolean", widget: "fz-field-bool", defaultValue: "0"}

+ 0
- 16
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/DbConfigService.java Vedi File

@@ -1,16 +0,0 @@
package cc.smtweb.system.bpm.web.design.db;

import cc.smtweb.framework.core.R;
import cc.smtweb.framework.core.annotation.SwParam;
import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.db.config.DesignConfig;

@SwService
public class DbConfigService {
@SwParam
private DesignConfig designConfig;

public R dataType() {
return R.success(designConfig.getDataTypes());
}
}

+ 0
- 4
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/model/AspDbCardService.java Vedi File

@@ -7,7 +7,6 @@ import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.cache.ModelDatabaseCache;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.config.DesignConfig;
import cc.smtweb.framework.core.db.sqlbuilder.InsertSqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.UpdateSqlBuilder;
@@ -28,9 +27,6 @@ public class AspDbCardService {
private ModelTableCache bpmTableCache;

@SwParam
private DesignConfig designConfig;

@SwParam
protected DatasetConfigDao datasetConfigDao;

// @ApiOperation(value = "读取数据模型数据")


+ 0
- 4
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/model/AspModelCardService.java Vedi File

@@ -5,7 +5,6 @@ import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.annotation.SwParam;
import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.config.DesignConfig;
import cc.smtweb.framework.core.db.sqlbuilder.InsertSqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.SqlBuilder;
import cc.smtweb.framework.core.db.sqlbuilder.UpdateSqlBuilder;
@@ -43,9 +42,6 @@ public class AspModelCardService {
private BpmPageCache bpmPageCache;

@SwParam
private DesignConfig designConfig;

@SwParam
protected DatasetConfigDao datasetConfigDao;

// @ApiOperation(value = "读取数据模型数据")


+ 3
- 4
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/model/AspModelConfigService.java Vedi File

@@ -4,7 +4,7 @@ import cc.smtweb.framework.core.R;
import cc.smtweb.framework.core.SwMap;
import cc.smtweb.framework.core.annotation.SwParam;
import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.db.config.DesignConfig;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.system.bpm.spring.BpmConfigBean;
import cc.smtweb.system.bpm.util.YamlUtil;
import lombok.extern.slf4j.Slf4j;
@@ -16,15 +16,14 @@ import java.util.Map;

@Slf4j
@SwService
@Deprecated
public class AspModelConfigService {
@SwParam
private DesignConfig designConfig;

@SwParam
private BpmConfigBean bpmConfigBean;

public R load() {
R result = R.success().put("dataType", designConfig.getDataTypes());
R result = R.success().put("dataType", SwEnum.DataType.instance.values());
String configUiPath = bpmConfigBean.getConfigUiPath();

if (StringUtils.isNotBlank(configUiPath)) {


+ 0
- 4
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/model/AspModelExportService.java Vedi File

@@ -3,7 +3,6 @@ package cc.smtweb.system.bpm.web.design.model;
import cc.smtweb.framework.core.annotation.SwParam;
import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.config.DesignConfig;
import cc.smtweb.framework.core.db.jdbc.IdGenerator;
import cc.smtweb.system.bpm.spring.cache.BpmFlowCache;
import cc.smtweb.system.bpm.spring.cache.BpmPageCache;
@@ -22,9 +21,6 @@ public class AspModelExportService {
@SwParam
private IdGenerator idGenerator;

@SwParam
private DesignConfig designConfig;

/*// @ApiOperation(value = "读取数据模型数据")
public R mysql(@SwBody SwMap body, UserSession us) {
String sql = "select model_id, model_parent_id, model_mc_id, model_site_id, model_key, model_name, model_status, model_content, model_type, model_version, model_create_uid, model_update_uid, model_create_time, model_last_time from sw_bpm.asp_model" +


+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/task/service/BpmTaskCardService.java Vedi File

@@ -104,8 +104,8 @@ public class BpmTaskCardService extends AbstractTaskCardService {
case SwEnum.DataType.TYPE_BOOL:
uiField.put("component", "fy-checkbox");
break;
case SwEnum.DataType.TYPE_DATETIME:
case SwEnum.DataType.TYPE_DATE:
case SwEnum.DataType.TYPE_DATETIME:
uiField.put("component", "fy-datetime");
break;
default:


Caricamento…
Annulla
Salva