提交 47dd6b9a 编写于 作者: ibizdev's avatar ibizdev

zhouweidong 发布系统代码 [ibz-lite,应用]

上级 38195632
...@@ -233,6 +233,44 @@ mock.onPost(new RegExp(/^\/metadynamicmodels\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey ...@@ -233,6 +233,44 @@ mock.onPost(new RegExp(/^\/metadynamicmodels\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey
return [status, data]; return [status, data];
}); });
// Init
mock.onPost(new RegExp(/^\/metadynamicmodels\/?([a-zA-Z0-9\-\;]{0,35})\/init$/)).reply((config: any) => {
console.groupCollapsed("实体:metadynamicmodel 方法: Init");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['configid'];
const matchArray:any = new RegExp(/^\/metadynamicmodels\/([a-zA-Z0-9\-\;]{1,35})\/init$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.configid, tempValue.configid));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['configid'] == tempValue['configid'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(data);
console.groupEnd();
console.groupEnd();
return [status, data];
});
// Publish // Publish
mock.onPost(new RegExp(/^\/metadynamicmodels\/?([a-zA-Z0-9\-\;]{0,35})\/publish$/)).reply((config: any) => { mock.onPost(new RegExp(/^\/metadynamicmodels\/?([a-zA-Z0-9\-\;]{0,35})\/publish$/)).reply((config: any) => {
console.groupCollapsed("实体:metadynamicmodel 方法: Publish"); console.groupCollapsed("实体:metadynamicmodel 方法: Publish");
......
...@@ -154,6 +154,34 @@ export default class MetaDynamicModelServiceBase extends EntityService { ...@@ -154,6 +154,34 @@ export default class MetaDynamicModelServiceBase extends EntityService {
return res; return res;
} }
/**
* Init接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MetaDynamicModelServiceBase
*/
public async Init(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = Http.getInstance().post(`/metadynamicmodels/${context.metadynamicmodel}/init`,data,isloading);
return res;
}
/**
* InitBatch接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MetaDynamicModelServiceBase
*/
public async InitBatch(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let tempData:any = JSON.parse(JSON.stringify(data));
return await Http.getInstance().post(`/metadynamicmodels/initbatch`,tempData,isloading);
}
/** /**
* Publish接口方法 * Publish接口方法
* *
......
...@@ -34,6 +34,8 @@ public interface IMetaDynamicModelService extends IService<MetaDynamicModel> { ...@@ -34,6 +34,8 @@ public interface IMetaDynamicModelService extends IService<MetaDynamicModel> {
MetaDynamicModel get(String key); MetaDynamicModel get(String key);
MetaDynamicModel getDraft(MetaDynamicModel et); MetaDynamicModel getDraft(MetaDynamicModel et);
boolean checkKey(MetaDynamicModel et); boolean checkKey(MetaDynamicModel et);
MetaDynamicModel init(MetaDynamicModel et);
boolean initBatch(List<MetaDynamicModel> etList);
MetaDynamicModel publish(MetaDynamicModel et); MetaDynamicModel publish(MetaDynamicModel et);
boolean publishBatch(List<MetaDynamicModel> etList); boolean publishBatch(List<MetaDynamicModel> etList);
boolean save(MetaDynamicModel et); boolean save(MetaDynamicModel et);
......
...@@ -123,6 +123,22 @@ public class MetaDynamicModelServiceImpl extends ServiceImpl<MetaDynamicModelMap ...@@ -123,6 +123,22 @@ public class MetaDynamicModelServiceImpl extends ServiceImpl<MetaDynamicModelMap
public boolean checkKey(MetaDynamicModel et) { public boolean checkKey(MetaDynamicModel et) {
return (!ObjectUtils.isEmpty(et.getConfigid())) && (!Objects.isNull(this.getById(et.getConfigid()))); return (!ObjectUtils.isEmpty(et.getConfigid())) && (!Objects.isNull(this.getById(et.getConfigid())));
} }
@Override
@Transactional
public MetaDynamicModel init(MetaDynamicModel et) {
//自定义代码
return et;
}
@Override
@Transactional
public boolean initBatch(List<MetaDynamicModel> etList) {
for(MetaDynamicModel et : etList) {
init(et);
}
return true;
}
@Override @Override
@Transactional @Transactional
public MetaDynamicModel publish(MetaDynamicModel et) { public MetaDynamicModel publish(MetaDynamicModel et) {
......
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
<!--输出实体[META_DYNAMICMODEL]数据结构 --> <!--输出实体[META_DYNAMICMODEL]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-meta_dynamicmodel-105-12"> <changeSet author="a_A_5d9d78509" id="tab-meta_dynamicmodel-117-12">
<createTable tableName="IBZDYNAMICMODEL"> <createTable tableName="IBZDYNAMICMODEL">
<column name="DYNAINSTID" remarks="" type="VARCHAR(100)"> <column name="DYNAINSTID" remarks="" type="VARCHAR(100)">
</column> </column>
...@@ -448,10 +448,10 @@ ...@@ -448,10 +448,10 @@
<!--输出实体[DST_VIEW]外键关系 --> <!--输出实体[DST_VIEW]外键关系 -->
<!--输出实体[META_DATASET]外键关系 --> <!--输出实体[META_DATASET]外键关系 -->
<!--输出实体[META_DYNAMICMODEL]外键关系 --> <!--输出实体[META_DYNAMICMODEL]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-meta_dynamicmodel-105-18"> <changeSet author="a_A_5d9d78509" id="fk-meta_dynamicmodel-117-18">
<addForeignKeyConstraint baseColumnNames="SYSTEMID" baseTableName="IBZDYNAMICMODEL" constraintName="DER1N_META_DYNAMICMODEL_DST_SY" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="PSSYSTEMID" referencedTableName="IBZPSSYSTEM" validate="true"/> <addForeignKeyConstraint baseColumnNames="SYSTEMID" baseTableName="IBZDYNAMICMODEL" constraintName="DER1N_META_DYNAMICMODEL_DST_SY" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="PSSYSTEMID" referencedTableName="IBZPSSYSTEM" validate="true"/>
</changeSet> </changeSet>
<changeSet author="a_A_5d9d78509" id="fk-meta_dynamicmodel-105-19"> <changeSet author="a_A_5d9d78509" id="fk-meta_dynamicmodel-117-19">
<addForeignKeyConstraint baseColumnNames="PDYNAINSTID" baseTableName="IBZDYNAMICMODEL" constraintName="DER1N_META_DYNAMICMODEL_META_D" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="CONFIGID" referencedTableName="IBZDYNAMICMODEL" validate="true"/> <addForeignKeyConstraint baseColumnNames="PDYNAINSTID" baseTableName="IBZDYNAMICMODEL" constraintName="DER1N_META_DYNAMICMODEL_META_D" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="CONFIGID" referencedTableName="IBZDYNAMICMODEL" validate="true"/>
</changeSet> </changeSet>
<!--输出实体[META_ENTITY]外键关系 --> <!--输出实体[META_ENTITY]外键关系 -->
......
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
"delogicname":"动态模型", "delogicname":"动态模型",
"sysmoudle":{"id":"LITE","name":"lite"}, "sysmoudle":{"id":"LITE","name":"lite"},
"dedataset":[{"id":"Default" , "name":"数据集"},{"id":"DynaInst" , "name":"主实例数据查询"}], "dedataset":[{"id":"Default" , "name":"数据集"},{"id":"DynaInst" , "name":"主实例数据查询"}],
"deaction":[{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Publish" , "name":"发布模型" , "type":"USERCUSTOM" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" }], "deaction":[{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Init" , "name":"初始化副本实例" , "type":"USERCUSTOM" },{"id":"Publish" , "name":"发布模型" , "type":"USERCUSTOM" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" }],
"datascope":[{"id":"all","name":"全部数据"}] "datascope":[{"id":"all","name":"全部数据"}]
} }
, { , {
......
...@@ -121,6 +121,25 @@ public class MetaDynamicModelResource { ...@@ -121,6 +121,25 @@ public class MetaDynamicModelResource {
return ResponseEntity.status(HttpStatus.OK).body(metadynamicmodelService.checkKey(metadynamicmodelMapping.toDomain(metadynamicmodeldto))); return ResponseEntity.status(HttpStatus.OK).body(metadynamicmodelService.checkKey(metadynamicmodelMapping.toDomain(metadynamicmodeldto)));
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaDynamicModel-Init-all')")
@ApiOperation(value = "初始化副本实例", tags = {"动态模型" }, notes = "初始化副本实例")
@RequestMapping(method = RequestMethod.POST, value = "/metadynamicmodels/{metadynamicmodel_id}/init")
public ResponseEntity<MetaDynamicModelDTO> init(@PathVariable("metadynamicmodel_id") String metadynamicmodel_id, @RequestBody MetaDynamicModelDTO metadynamicmodeldto) {
MetaDynamicModel domain = metadynamicmodelMapping.toDomain(metadynamicmodeldto);
domain.setConfigid(metadynamicmodel_id);
domain = metadynamicmodelService.init(domain);
metadynamicmodeldto = metadynamicmodelMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(metadynamicmodeldto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaDynamicModel-Init-all')")
@ApiOperation(value = "批量处理[初始化副本实例]", tags = {"动态模型" }, notes = "批量处理[初始化副本实例]")
@RequestMapping(method = RequestMethod.POST, value = "/metadynamicmodels/initbatch")
public ResponseEntity<Boolean> initBatch(@RequestBody List<MetaDynamicModelDTO> metadynamicmodeldtos) {
List<MetaDynamicModel> domains = metadynamicmodelMapping.toDomain(metadynamicmodeldtos);
boolean result = metadynamicmodelService.initBatch(domains);
return ResponseEntity.status(HttpStatus.OK).body(result);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaDynamicModel-Publish-all')") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzlite-MetaDynamicModel-Publish-all')")
@ApiOperation(value = "发布模型", tags = {"动态模型" }, notes = "发布模型") @ApiOperation(value = "发布模型", tags = {"动态模型" }, notes = "发布模型")
@RequestMapping(method = RequestMethod.POST, value = "/metadynamicmodels/{metadynamicmodel_id}/publish") @RequestMapping(method = RequestMethod.POST, value = "/metadynamicmodels/{metadynamicmodel_id}/publish")
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册