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

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

上级 194136ef
......@@ -233,16 +233,16 @@ mock.onPost(new RegExp(/^\/dabuilds\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).repl
return [status, data];
});
// ExportZip
mock.onPost(new RegExp(/^\/dabuilds\/?([a-zA-Z0-9\-\;]{0,35})\/exportzip$/)).reply((config: any) => {
console.groupCollapsed("实体:dabuild 方法: ExportZip");
// ExportFile
mock.onPost(new RegExp(/^\/dabuilds\/?([a-zA-Z0-9\-\;]{0,35})\/exportfile$/)).reply((config: any) => {
console.groupCollapsed("实体:dabuild 方法: ExportFile");
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> = ['build_id'];
const matchArray:any = new RegExp(/^\/dabuilds\/([a-zA-Z0-9\-\;]{1,35})\/exportzip$/).exec(config.url);
const matchArray:any = new RegExp(/^\/dabuilds\/([a-zA-Z0-9\-\;]{1,35})\/exportfile$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
......
......@@ -309,6 +309,44 @@ mock.onPost(new RegExp(/^\/metamodels\/?([a-zA-Z0-9\-\;]{0,35})\/exportfile$/)).
return [status, data];
});
// ImportFile
mock.onPost(new RegExp(/^\/metamodels\/?([a-zA-Z0-9\-\;]{0,35})\/importfile$/)).reply((config: any) => {
console.groupCollapsed("实体:metamodel 方法: ImportFile");
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> = ['id'];
const matchArray:any = new RegExp(/^\/metamodels\/([a-zA-Z0-9\-\;]{1,35})\/importfile$/).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.id, tempValue.id));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['id'] == tempValue['id'] ){
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];
});
// Save
mock.onPost(new RegExp(/^\/metamodels\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).reply((config: any) => {
console.groupCollapsed("实体:metamodel 方法: Save");
......
......@@ -156,7 +156,7 @@ export default class DABuildServiceBase extends EntityService {
}
/**
* ExportZip接口方法
* ExportFile接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -164,13 +164,13 @@ export default class DABuildServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof DABuildServiceBase
*/
public async ExportZip(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = Http.getInstance().post(`/dabuilds/${context.dabuild}/exportzip`,data,isloading);
public async ExportFile(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = Http.getInstance().post(`/dabuilds/${context.dabuild}/exportfile`,data,isloading);
return res;
}
/**
* ExportZipBatch接口方法
* ExportFileBatch接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -178,9 +178,9 @@ export default class DABuildServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof DABuildServiceBase
*/
public async ExportZipBatch(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
public async ExportFileBatch(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let tempData:any = JSON.parse(JSON.stringify(data));
return await Http.getInstance().post(`/dabuild/exportzipbatch`,tempData,isloading);
return await Http.getInstance().post(`/dabuild/exportfilebatch`,tempData,isloading);
}
/**
......
......@@ -209,6 +209,34 @@ export default class MetaModelServiceBase extends EntityService {
return await Http.getInstance().post(`/metamodel/exportfilebatch`,tempData,isloading);
}
/**
* ImportFile接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MetaModelServiceBase
*/
public async ImportFile(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = Http.getInstance().post(`/metamodels/${context.metamodel}/importfile`,data,isloading);
return res;
}
/**
* ImportFileBatch接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MetaModelServiceBase
*/
public async ImportFileBatch(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let tempData:any = JSON.parse(JSON.stringify(data));
return await Http.getInstance().post(`/metamodel/importfilebatch`,tempData,isloading);
}
/**
* Save接口方法
*
......
......@@ -161,6 +161,9 @@ export default class MetaModelUIServiceBase extends UIService {
const openIndexViewTab = (data: any) => {
const routePath = actionContext.$viewTool.buildUpRoutePath(actionContext.$route, context, deResParameters, parameters, _args, data);
actionContext.$router.push(routePath);
if (this.MetaModel_importAfter && this.MetaModel_importAfter instanceof Function) {
this.MetaModel_importAfter([data],context,params, $event, xData,actionContext);
}
return null;
}
openIndexViewTab(data);
......@@ -247,6 +250,22 @@ export default class MetaModelUIServiceBase extends UIService {
backend();
}
/**
* 模型导入
*
* @param {any[]} args 当前数据
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
* @returns {Promise<any>}
*/
public async MetaModel_importAfter(args: any[],context:any = {}, params:any = {}, $event?: any, xData?: any,actionContext?: any,srfParentDeName?:string){
actionContext.$Notice.error({ title: '错误', desc: '不支持单项数据' });
}
/**
* 获取指定数据的重定向页面
......
......@@ -34,8 +34,8 @@ public interface IDABuildService extends IService<DABuild> {
DABuild get(String key);
DABuild getDraft(DABuild et);
boolean checkKey(DABuild et);
DABuild exportZip(DABuild et);
boolean exportZipBatch(List<DABuild> etList);
DABuild exportFile(DABuild et);
boolean exportFileBatch(List<DABuild> etList);
DABuild run(DABuild et);
boolean runBatch(List<DABuild> etList);
boolean save(DABuild et);
......
......@@ -138,16 +138,16 @@ public class DABuildServiceImpl extends ServiceImpl<DABuildMapper, DABuild> impl
}
@Override
@Transactional
public DABuild exportZip(DABuild et) {
public DABuild exportFile(DABuild et) {
//自定义代码
return et;
}
@Override
@Transactional
public boolean exportZipBatch(List<DABuild> etList) {
public boolean exportFileBatch(List<DABuild> etList) {
for(DABuild et : etList) {
exportZip(et);
exportFile(et);
}
return true;
}
......
......@@ -22,14 +22,14 @@ public class DABuildExService extends DABuildServiceImpl {
}
/**
* [ExportZip:导出Zip] 行为扩展:导出模型的Zip
* [ExportFile:导出文件] 行为扩展:导出模型的文件
* @param et
* @return
*/
@Override
@Transactional
public DABuild exportZip(DABuild et) {
return super.exportZip(et);
public DABuild exportFile(DABuild et) {
return super.exportFile(et);
}
/**
* [Run:运行] 行为扩展
......
......@@ -41,5 +41,15 @@ public class MetaModelExService extends MetaModelServiceImpl {
public MetaModel exportFile(MetaModel et) {
return super.exportFile(et);
}
/**
* [ImportFile:导入文件] 行为扩展:传入一个文件,将该文件转化成对象,根据对象执行表更新操作
* @param et
* @return
*/
@Override
@Transactional
public MetaModel importFile(MetaModel et) {
return super.importFile(et);
}
}
......@@ -41,6 +41,8 @@ public interface IMetaModelService extends IService<MetaModel> {
boolean checkKey(MetaModel et);
MetaModel exportFile(MetaModel et);
boolean exportFileBatch(List<MetaModel> etList);
MetaModel importFile(MetaModel et);
boolean importFileBatch(List<MetaModel> etList);
boolean save(MetaModel et);
@CacheEvict(value = "metamodel",allEntries = true)
void saveBatch(List<MetaModel> list);
......
......@@ -173,6 +173,22 @@ public class MetaModelServiceImpl extends ServiceImpl<MetaModelMapper, MetaModel
return true;
}
@Override
@Transactional
public MetaModel importFile(MetaModel et) {
//自定义代码
return et;
}
@Override
@Transactional
public boolean importFileBatch(List<MetaModel> etList) {
for(MetaModel et : etList) {
importFile(et);
}
return true;
}
@Override
@Transactional
public boolean save(MetaModel et) {
......
......@@ -4,7 +4,7 @@
<!--输出实体[DA_BUILD]数据结构 -->
<changeSet author="root" id="tab-da_build-69-1">
<changeSet author="root" id="tab-da_build-70-1">
<createTable tableName="IBZDABUILD">
<column name="BUILDID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_DA_BUILD_BUILDID"/>
......@@ -328,7 +328,7 @@
<!--输出实体[META_MODEL]数据结构 -->
<changeSet author="root" id="tab-meta_model-37-12">
<changeSet author="root" id="tab-meta_model-42-12">
<createTable tableName="IBZMODEL">
<column name="MODELID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_META_MODEL_MODELID"/>
......
......@@ -8,7 +8,7 @@
"delogicname":"分析",
"sysmoudle":{"id":"ANALYSIS","name":"analysis"},
"dedataset":[{"id":"Default" , "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":"ExportZip" , "name":"导出Zip" , "type":"USERCUSTOM" },{"id":"Run" , "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":"ExportFile" , "name":"导出文件" , "type":"USERCUSTOM" },{"id":"Run" , "name":"运行" , "type":"USERCUSTOM" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" }],
"datascope":[{"id":"all","name":"全部数据"}]
}
, {
......@@ -120,7 +120,7 @@
"delogicname":"模型",
"sysmoudle":{"id":"LITE","name":"lite"},
"dedataset":[{"id":"Default" , "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":"Change" , "name":"change" , "type":"USERCUSTOM" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"ExportFile" , "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":"Change" , "name":"change" , "type":"USERCUSTOM" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"ExportFile" , "name":"导出文件" , "type":"USERCUSTOM" },{"id":"ImportFile" , "name":"导入文件" , "type":"USERCUSTOM" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" }],
"datascope":[{"id":"all","name":"全部数据"}]
}
, {
......
......@@ -120,21 +120,21 @@ public class DABuildResource {
return ResponseEntity.status(HttpStatus.OK).body(dabuildService.checkKey(dabuildMapping.toDomain(dabuilddto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdst-DABuild-ExportZip-all')")
@ApiOperation(value = "导出Zip", tags = {"分析" }, notes = "导出Zip")
@RequestMapping(method = RequestMethod.POST, value = "/dabuilds/{dabuild_id}/exportzip")
public ResponseEntity<DABuildDTO> exportZip(@PathVariable("dabuild_id") String dabuild_id, @RequestBody DABuildDTO dabuilddto) {
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdst-DABuild-ExportFile-all')")
@ApiOperation(value = "导出文件", tags = {"分析" }, notes = "导出文件")
@RequestMapping(method = RequestMethod.POST, value = "/dabuilds/{dabuild_id}/exportfile")
public ResponseEntity<DABuildDTO> exportFile(@PathVariable("dabuild_id") String dabuild_id, @RequestBody DABuildDTO dabuilddto) {
DABuild domain = dabuildMapping.toDomain(dabuilddto);
domain.setBuildId(dabuild_id);
domain = dabuildService.exportZip(domain);
domain = dabuildService.exportFile(domain);
dabuilddto = dabuildMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dabuilddto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdst-DABuild-ExportZip-all')")
@ApiOperation(value = "批量处理[导出Zip]", tags = {"分析" }, notes = "批量处理[导出Zip]")
@RequestMapping(method = RequestMethod.POST, value = "/dabuilds/{dabuild_id}/exportzipbatch")
public ResponseEntity<Boolean> exportZipBatch(@RequestBody List<DABuildDTO> dabuilddtos) {
return ResponseEntity.status(HttpStatus.OK).body(dabuildService.exportZipBatch(dabuildMapping.toDomain(dabuilddtos)));
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdst-DABuild-ExportFile-all')")
@ApiOperation(value = "批量处理[导出文件]", tags = {"分析" }, notes = "批量处理[导出文件]")
@RequestMapping(method = RequestMethod.POST, value = "/dabuilds/{dabuild_id}/exportfilebatch")
public ResponseEntity<Boolean> exportFileBatch(@RequestBody List<DABuildDTO> dabuilddtos) {
return ResponseEntity.status(HttpStatus.OK).body(dabuildService.exportFileBatch(dabuildMapping.toDomain(dabuilddtos)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdst-DABuild-Run-all')")
......
......@@ -155,6 +155,23 @@ public class MetaModelResource {
return ResponseEntity.status(HttpStatus.OK).body(metamodelService.exportFileBatch(metamodelMapping.toDomain(metamodeldtos)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdst-MetaModel-ImportFile-all')")
@ApiOperation(value = "导入文件", tags = {"模型" }, notes = "导入文件")
@RequestMapping(method = RequestMethod.POST, value = "/metamodels/{metamodel_id}/importfile")
public ResponseEntity<MetaModelDTO> importFile(@PathVariable("metamodel_id") String metamodel_id, @RequestBody MetaModelDTO metamodeldto) {
MetaModel domain = metamodelMapping.toDomain(metamodeldto);
domain.setId(metamodel_id);
domain = metamodelService.importFile(domain);
metamodeldto = metamodelMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(metamodeldto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdst-MetaModel-ImportFile-all')")
@ApiOperation(value = "批量处理[导入文件]", tags = {"模型" }, notes = "批量处理[导入文件]")
@RequestMapping(method = RequestMethod.POST, value = "/metamodels/{metamodel_id}/importfilebatch")
public ResponseEntity<Boolean> importFileBatch(@RequestBody List<MetaModelDTO> metamodeldtos) {
return ResponseEntity.status(HttpStatus.OK).body(metamodelService.importFileBatch(metamodelMapping.toDomain(metamodeldtos)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdst-MetaModel-Save-all')")
@ApiOperation(value = "保存模型", tags = {"模型" }, notes = "保存模型")
@RequestMapping(method = RequestMethod.POST, value = "/metamodels/save")
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册