提交 3419cb43 编写于 作者: ibizdev's avatar ibizdev

ibiz4j 部署微服务接口

上级 b044cf87
......@@ -37,6 +37,11 @@
git clone -b master $para2 ibzdict/
export NODE_OPTIONS=--max-old-space-size=4096
cd ibzdict/
mvn clean package -Papi
cd ibzdict-provider/ibzdict-provider-api
mvn -Papi docker:build
mvn -Papi docker:push
docker -H $para1 stack deploy --compose-file=src/main/docker/ibzdict-provider-api.yaml ibzlab-rt --with-registry-auth
</command>
</hudson.tasks.Shell>
</builders>
......
......@@ -21,6 +21,9 @@
</dependency>
</dependencies>
<properties>
<docker.image.prefix>registry.cn-shanghai.aliyuncs.com/ibizsys</docker.image.prefix>
</properties>
<profiles>
......@@ -95,6 +98,23 @@
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<configuration>
<serverId>ibiz-dev</serverId>
<imageName>${docker.image.prefix}/${project.artifactId}:latest</imageName>
<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>../../</directory>
<include>${project.artifactId}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
</profile>
......
server:
port: 8080
port: 30004
#Log配置
logging:
level:
......
......@@ -134,6 +134,18 @@ public class DictCatalog extends EntityMP implements Serializable {
}
/**
* 复制当前对象数据到目标对象(粘贴重置)
* @param targetEntity 目标数据对象
* @param bIncEmpty 是否包括空值
* @param <T>
* @return
*/
@Override
public <T> T copyTo(T targetEntity, boolean bIncEmpty) {
this.reset("cid");
return super.copyTo(targetEntity,bIncEmpty);
}
}
......@@ -275,6 +275,18 @@ public class DictOption extends EntityMP implements Serializable {
return DigestUtils.md5DigestAsHex(String.format("%s||%s" ,this.getCatalogId(),this.getValue()).getBytes());
return null;
}
/**
* 复制当前对象数据到目标对象(粘贴重置)
* @param targetEntity 目标数据对象
* @param bIncEmpty 是否包括空值
* @param <T>
* @return
*/
@Override
public <T> T copyTo(T targetEntity, boolean bIncEmpty) {
this.reset("vkey");
return super.copyTo(targetEntity,bIncEmpty);
}
}
{
"systemid":"ibzdict",
"systemname":"ibzdict",
"entities":[
{
"entity_name":"DICT_CATALOG",
"logicname":"字典",
"code_name":"DictCatalog",
"table_name":"IBZDICTCATALOG",
"system_id":"ibzdict",
"system_name":"ibzdict",
"ds_id":null,
"ds_name":"",
"fields":[
{
"fieldname":"CID" ,
"codename":"Id",
"field_logic_name":"标识",
"entity_name":"DictCatalog",
"ref_field_name":"",
"relation_name":"",
"field_type":"String",
"dict":"",
"nullable":0,
"physical_field":1,
"data_type":"VARCHAR",
"data_length":100,
"data_preci":0,
"expression":"",
"predefined":"",
"key_field":1,
"major_field":0,
"union_key":""
},
{
"fieldname":"CCODE" ,
"codename":"Code",
"field_logic_name":"代码",
"entity_name":"DictCatalog",
"ref_field_name":"",
"relation_name":"",
"field_type":"String",
"dict":"",
"nullable":0,
"physical_field":1,
"data_type":"VARCHAR",
"data_length":100,
"data_preci":0,
"expression":"",
"predefined":"",
"key_field":0,
"major_field":0,
"union_key":""
},
{
"fieldname":"CNAME" ,
"codename":"Name",
"field_logic_name":"名称",
"entity_name":"DictCatalog",
"ref_field_name":"",
"relation_name":"",
"field_type":"String",
"dict":"",
"nullable":0,
"physical_field":1,
"data_type":"VARCHAR",
"data_length":100,
"data_preci":0,
"expression":"",
"predefined":"",
"key_field":0,
"major_field":1,
"union_key":""
},
{
"fieldname":"CGROUP" ,
"codename":"Group",
"field_logic_name":"分组",
"entity_name":"DictCatalog",
"ref_field_name":"",
"relation_name":"",
"field_type":"String",
"dict":"",
"nullable":1,
"physical_field":1,
"data_type":"VARCHAR",
"data_length":100,
"data_preci":0,
"expression":"",
"predefined":"",
"key_field":0,
"major_field":0,
"union_key":""
},
{
"fieldname":"MEMO" ,
"codename":"Memo",
"field_logic_name":"备注",
"entity_name":"DictCatalog",
"ref_field_name":"",
"relation_name":"",
"field_type":"String",
"dict":"",
"nullable":1,
"physical_field":1,
"data_type":"VARCHAR",
"data_length":255,
"data_preci":0,
"expression":"",
"predefined":"",
"key_field":0,
"major_field":0,
"union_key":""
},
{
"fieldname":"ENABLE" ,
"codename":"Enable",
"field_logic_name":"是否有效",
"entity_name":"DictCatalog",
"ref_field_name":"",
"relation_name":"",
"field_type":"Integer",
"dict":"",
"nullable":1,
"physical_field":1,
"data_type":"INT",
"data_length":null,
"data_preci":0,
"expression":"",
"predefined":"LOGICVALID",
"key_field":0,
"major_field":0,
"union_key":""
},
{
"fieldname":"UPDATEDATE" ,
"codename":"UpdateDate",
"field_logic_name":"最后修改时间",
"entity_name":"DictCatalog",
"ref_field_name":"",
"relation_name":"",
"field_type":"Timestamp",
"dict":"",
"nullable":1,
"physical_field":1,
"data_type":"DATETIME",
"data_length":null,
"data_preci":0,
"expression":"",
"predefined":"UPDATEDATE",
"key_field":0,
"major_field":0,
"union_key":""
}
],
"parentEntitys":[
{"name":"DER1N_DICT_OPTION_DICT_CATALOG_CID",
"relation_type":"DER1N",
"code_name":"Catalog",
"entity_name":"DictCatalog",
"ref_entity_name":"DictOption",
"nested_name":"",
"lookup":""
}
],
"subEntitys":[
]
}
,
{
"entity_name":"DICT_OPTION",
"logicname":"字典项",
"code_name":"DictOption",
"table_name":"IBZDICTOPTION",
"system_id":"ibzdict",
"system_name":"ibzdict",
"ds_id":null,
"ds_name":"",
"fields":[
{
"fieldname":"VKEY" ,
"codename":"Value_key",
"field_logic_name":"标识",
"entity_name":"DictOption",
"ref_field_name":"",
"relation_name":"",
"field_type":"String",
"dict":"",
"nullable":0,
"physical_field":1,
"data_type":"VARCHAR",
"data_length":100,
"data_preci":0,
"expression":"",
"predefined":"",
"key_field":1,
"major_field":0,
"union_key":""
},
{
"fieldname":"CID" ,
"codename":"Catalog_id",
"field_logic_name":"目录代码",
"entity_name":"DictOption",
"ref_field_name":"Id",
"relation_name":"DER1N_DICT_OPTION_DICT_CATALOG_CID",
"field_type":"String",
"dict":"",
"nullable":0,
"physical_field":1,
"data_type":"VARCHAR",
"data_length":100,
"data_preci":0,
"expression":"",
"predefined":"",
"key_field":0,
"major_field":0,
"union_key":"KEY1"
},
{
"fieldname":"CNAME" ,
"codename":"Catalog_name",
"field_logic_name":"目录",
"entity_name":"DictOption",
"ref_field_name":"Name",
"relation_name":"",
"field_type":"String",
"dict":"",
"nullable":0,
"physical_field":1,
"data_type":"VARCHAR",
"data_length":100,
"data_preci":0,
"expression":"",
"predefined":"",
"key_field":0,
"major_field":0,
"union_key":""
},
{
"fieldname":"VAL" ,
"codename":"Value",
"field_logic_name":"代码值",
"entity_name":"DictOption",
"ref_field_name":"",
"relation_name":"",
"field_type":"String",
"dict":"",
"nullable":0,
"physical_field":1,
"data_type":"VARCHAR",
"data_length":40,
"data_preci":0,
"expression":"",
"predefined":"",
"key_field":0,
"major_field":0,
"union_key":"KEY2"
},
{
"fieldname":"LABEL" ,
"codename":"Label",
"field_logic_name":"名称",
"entity_name":"DictOption",
"ref_field_name":"",
"relation_name":"",
"field_type":"String",
"dict":"",
"nullable":0,
"physical_field":1,
"data_type":"VARCHAR",
"data_length":100,
"data_preci":0,
"expression":"",
"predefined":"",
"key_field":0,
"major_field":1,
"union_key":""
},
{
"fieldname":"PVAL" ,
"codename":"Parent",
"field_logic_name":"父代码值",
"entity_name":"DictOption",
"ref_field_name":"",
"relation_name":"",
"field_type":"String",
"dict":"",
"nullable":1,
"physical_field":1,
"data_type":"VARCHAR",
"data_length":40,
"data_preci":0,
"expression":"",
"predefined":"",
"key_field":0,
"major_field":0,
"union_key":""
},
{
"fieldname":"VFILTER" ,
"codename":"Filter",
"field_logic_name":"过滤项",
"entity_name":"DictOption",
"ref_field_name":"",
"relation_name":"",
"field_type":"String",
"dict":"",
"nullable":1,
"physical_field":1,
"data_type":"VARCHAR",
"data_length":500,
"data_preci":0,
"expression":"",
"predefined":"",
"key_field":0,
"major_field":0,
"union_key":""
},
{
"fieldname":"CLS" ,
"codename":"Cls",
"field_logic_name":"栏目样式",
"entity_name":"DictOption",
"ref_field_name":"",
"relation_name":"",
"field_type":"String",
"dict":"",
"nullable":1,
"physical_field":1,
"data_type":"VARCHAR",
"data_length":500,
"data_preci":0,
"expression":"",
"predefined":"",
"key_field":0,
"major_field":0,
"union_key":""
},
{
"fieldname":"ICONCLS" ,
"codename":"Icon_class",
"field_logic_name":"图标",
"entity_name":"DictOption",
"ref_field_name":"",
"relation_name":"",
"field_type":"String",
"dict":"",
"nullable":1,
"physical_field":1,
"data_type":"VARCHAR",
"data_length":255,
"data_preci":0,
"expression":"",
"predefined":"",
"key_field":0,
"major_field":0,
"union_key":""
},
{
"fieldname":"DISABLED" ,
"codename":"Disabled",
"field_logic_name":"是否禁用",
"entity_name":"DictOption",
"ref_field_name":"",
"relation_name":"",
"field_type":"Integer",
"dict":"YesNo",
"nullable":1,
"physical_field":1,
"data_type":"INT",
"data_length":null,
"data_preci":0,
"expression":"",
"predefined":"",
"key_field":0,
"major_field":0,
"union_key":""
},
{
"fieldname":"EXPIRED" ,
"codename":"Expired",
"field_logic_name":"过期/失效",
"entity_name":"DictOption",
"ref_field_name":"",
"relation_name":"",
"field_type":"Integer",
"dict":"YesNo",
"nullable":1,
"physical_field":1,
"data_type":"INT",
"data_length":null,
"data_preci":0,
"expression":"",
"predefined":"",
"key_field":0,
"major_field":0,
"union_key":""
},
{
"fieldname":"SHOWORDER" ,
"codename":"Showorder",
"field_logic_name":"排序",
"entity_name":"DictOption",
"ref_field_name":"",
"relation_name":"",
"field_type":"Integer",
"dict":"",
"nullable":1,
"physical_field":1,
"data_type":"INT",
"data_length":null,
"data_preci":0,
"expression":"",
"predefined":"",
"key_field":0,
"major_field":0,
"union_key":""
},
{
"fieldname":"EXTENSION" ,
"codename":"Extension",
"field_logic_name":"扩展",
"entity_name":"DictOption",
"ref_field_name":"",
"relation_name":"",
"field_type":"String",
"dict":"",
"nullable":1,
"physical_field":1,
"data_type":"VARCHAR",
"data_length":1000,
"data_preci":0,
"expression":"",
"predefined":"",
"key_field":0,
"major_field":0,
"union_key":""
},
{
"fieldname":"UPDATEDATE" ,
"codename":"UpdateDate",
"field_logic_name":"最后修改时间",
"entity_name":"DictOption",
"ref_field_name":"",
"relation_name":"",
"field_type":"Timestamp",
"dict":"",
"nullable":1,
"physical_field":1,
"data_type":"DATETIME",
"data_length":null,
"data_preci":0,
"expression":"",
"predefined":"UPDATEDATE",
"key_field":0,
"major_field":0,
"union_key":""
}
],
"parentEntitys":[
],
"subEntitys":[
{"name":"DER1N_DICT_OPTION_DICT_CATALOG_CID",
"relation_type":"DER1N",
"code_name":"Catalog",
"entity_name":"DictCatalog",
"ref_entity_name":"DictOption",
"nested_name":"",
"lookup":""
}
]
}
]
}
......@@ -21,6 +21,9 @@
</dependency>
</dependencies>
<properties>
<docker.image.prefix>registry.cn-shanghai.aliyuncs.com/ibizsys</docker.image.prefix>
</properties>
<profiles>
<profile>
......@@ -54,6 +57,23 @@
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<configuration>
<serverId>ibiz-dev</serverId>
<imageName>${docker.image.prefix}/${project.artifactId}:latest</imageName>
<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>../../</directory>
<include>${project.artifactId}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
</profile>
......
......@@ -12,6 +12,6 @@ CMD echo "The application will start in ${IBIZ_SLEEP}s..." && \
sleep ${IBIZ_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzdict-provider-api.jar
EXPOSE 8081
EXPOSE 40004
ADD ibzdict-provider-api.jar /ibzdict-provider-api.jar
......@@ -3,9 +3,22 @@ services:
ibzdict-provider-api:
image: registry.cn-shanghai.aliyuncs.com/ibizsys/ibzdict-provider-api:latest
ports:
- "8081:8081"
- "40004:40004"
networks:
- agent_network
environment:
- SPRING_CLOUD_NACOS_DISCOVERY_IP=172.16.180.237
- SERVER_PORT=40004
- SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR=172.16.102.211:8848
- SPRING_REDIS_HOST=172.16.100.243
- SPRING_REDIS_PORT=6379
- SPRING_REDIS_DATABASE=0
- SPRING_DATASOURCE_USERNAME=a_A_5d9d78509
- SPRING_DATASOURCE_PASSWORD=@6dEfb3@
- SPRING_DATASOURCE_URL=jdbc:mysql://172.16.180.232:3306/a_A_5d9d78509?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&allowMultiQueries=true
- SPRING_DATASOURCE_DRIVER-CLASS-NAME=com.mysql.jdbc.Driver
- SPRING_DATASOURCE_DEFAULTSCHEMA=a_A_5d9d78509
- NACOS=172.16.102.211:8848
deploy:
resources:
limits:
......
package cn.ibizlab.util.client;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
@Component
public class IBZLiteFallback implements IBZLiteFeignClient {
@Override
public Boolean syncSysModel(JSONObject system) {
return null;
}
}
package cn.ibizlab.util.client;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
@FeignClient(value = "${ibiz.ref.service.lite:ibzlite-api}",contextId = "lite",fallback = IBZLiteFallback.class)
public interface IBZLiteFeignClient
{
/**
* 同步系统资模型到lite
* @param system 系统模型信息
* @return
*/
@PostMapping("/dstsystems/save")
Boolean syncSysModel(@RequestBody JSONObject system);
}
......@@ -9,7 +9,9 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.cglib.beans.BeanMap;
import org.springframework.data.annotation.Transient;
import org.springframework.util.AlternativeJdkIdGenerator;
import org.springframework.util.ObjectUtils;
import java.io.Serializable;
import java.lang.reflect.Field;
import org.springframework.util.StringUtils;
import java.util.*;
......@@ -96,4 +98,32 @@ public class EntityBase implements Serializable {
this.extensionparams.put(field.toLowerCase(),value);
}
/**
* 复制当前对象数据到目标对象
* @param targetEntity 目标数据对象
* @param bIncEmpty 是否包括空值
* @param <T>
* @return
*/
public <T> T copyTo(T targetEntity, boolean bIncEmpty){
if(targetEntity instanceof EntityBase){
EntityBase target= (EntityBase) targetEntity;
Hashtable<String, Field> sourceFields=DEFieldCacheMap.getFieldMap(this.getClass());
for(String field : sourceFields.keySet()){
Object value=this.get(field);
if( !ObjectUtils.isEmpty(value) || ObjectUtils.isEmpty(value) && getFocusNull().contains(field) && bIncEmpty ){
target.set(field,value);
}
}
}
return targetEntity;
}
/**
* 重置当前数据对象属性值
* @param field
*/
public void reset(String field){
}
}
\ No newline at end of file
package cn.ibizlab.util.domain;
import org.springframework.util.StringUtils;
public class EntityClient extends EntityBase {
@Override
......@@ -15,5 +17,14 @@ public class EntityClient extends EntityBase {
}
}
@Override
public void reset(String field) {
if(!StringUtils.isEmpty(field)){
String resetField=field.toLowerCase();
this.set(resetField,null);
this.getFocusNull().remove(resetField);
getExtensionparams().remove(resetField+"dirtyflag");
}
}
}
package cn.ibizlab.util.domain;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.springframework.util.StringUtils;
public class EntityMP extends EntityBase {
......@@ -24,5 +25,14 @@ public class EntityMP extends EntityBase {
this.getFocusNull().remove(field.toLowerCase());
}
@Override
public void reset(String field){
if(!StringUtils.isEmpty(field)){
String resetField=field.toLowerCase();
this.set(resetField,null);
getFocusNull().remove(resetField);
}
}
}
package cn.ibizlab.util.job;
import cn.ibizlab.util.client.IBZUAAFeignClient;
import cn.ibizlab.util.client.IBZLiteFeignClient;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONArray;
import lombok.extern.slf4j.Slf4j;
......@@ -36,6 +37,10 @@ public class PermissionSyncJob implements ApplicationRunner {
@Autowired
@Lazy
IBZLiteFeignClient liteFeignClient;
@Override
public void run(ApplicationArguments args) {
try {
......@@ -57,6 +62,24 @@ public class PermissionSyncJob implements ApplicationRunner {
log.error(String.format("向[UAA]同步系统资源失败,请检查[UAA]服务是否正常! [%s]",ex));
}
try {
InputStream sysModel= this.getClass().getResourceAsStream("/sysmodel/ibzdict.json"); //获取当前系统所有实体资源能力
String strSysModel = IOUtils.toString(sysModel,"UTF-8");
JSONObject system= new JSONObject();
system.put("pssystemid",systemId);
system.put("pssystemname",systemName);
system.put("sysstructure",JSONObject.parseObject(strSysModel));
system.put("md5check",DigestUtils.md5DigestAsHex(strSysModel.getBytes()));
if(liteFeignClient.syncSysModel(system)){
log.info("向[lite]同步系统模型成功");
}else{
log.error("向[lite]同步系统模型失败");
}
}
catch (Exception ex) {
log.error(String.format("向[lite]同步系统模型失败,请检查[lite]服务是否正常! [%s]",ex));
}
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ spring:
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
server-addr: 172.16.102.211:8848
enabled: true
eureka:
......
......@@ -7,7 +7,7 @@ spring:
caffeine:
spec: initialCapacity=5,maximumSize=500,expireAfterWrite=3600s
redis:
host: 127.0.0.1
host: 172.16.100.243
port: 6379
password:
database: 0
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册