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

zhouweidong 发布系统代码 [ibz-wf,统一工作流]

上级 9ae8515e
...@@ -86,16 +86,165 @@ mock.onDelete(new RegExp(/^\/wfprocessnodes\/batch$/)).reply((config: any) => { ...@@ -86,16 +86,165 @@ mock.onDelete(new RegExp(/^\/wfprocessnodes\/batch$/)).reply((config: any) => {
return [status, {}]; return [status, {}];
}); });
// URI参数传递情况未实现
// URI参数传递情况未实现 // CheckKey
// URI参数传递情况未实现 mock.onPost(new RegExp(/^\/wfprocessnodes\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).reply((config: any) => {
// URI参数传递情况未实现 console.groupCollapsed("实体:wfprocessnode 方法: CheckKey");
// URI参数传递情况未实现 console.table({url:config.url, method: config.method, data:config.data});
// URI参数传递情况未实现 let status = MockAdapter.mockStatus(config);
// URI参数传递情况未实现 if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['usertaskid'];
const matchArray:any = new RegExp(/^\/wfprocessnodes\/([a-zA-Z0-9\-\;]{1,35})\/checkkey$/).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.usertaskid, tempValue.usertaskid));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['usertaskid'] == tempValue['usertaskid'] ){
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];
});
// Create
mock.onPost(new RegExp(/^\/wfprocessnodes\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:wfprocessnode 方法: Create");
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> = ['usertaskid'];
const matchArray:any = new RegExp(/^\/wfprocessnodes\/([a-zA-Z0-9\-\;]{1,35})$/).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]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(mockDatas[0]);
console.groupEnd();
console.groupEnd();
return [status, mockDatas[0]];
});
// GetDraft
mock.onGet(new RegExp(/^\/wfprocessnodes\/getdraft$/)).reply((config: any) => {
console.groupCollapsed("实体:wfprocessnode 方法: GetDraft");
console.table({url:config.url, method: config.method, data:config.data});
// GetDraft
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// Save
mock.onPost(new RegExp(/^\/wfprocessnodes\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).reply((config: any) => {
console.groupCollapsed("实体:wfprocessnode 方法: Save");
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> = ['usertaskid'];
const matchArray:any = new RegExp(/^\/wfprocessnodes\/([a-zA-Z0-9\-\;]{1,35})\/save$/).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.usertaskid, tempValue.usertaskid));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['usertaskid'] == tempValue['usertaskid'] ){
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];
});
// Update
mock.onPut(new RegExp(/^\/wfprocessnodes\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:wfprocessnode 方法: Update");
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> = ['usertaskid'];
const matchArray:any = new RegExp(/^\/wfprocessnodes\/([a-zA-Z0-9\-\;]{1,35})$/).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.usertaskid, tempValue.usertaskid));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['usertaskid'] == tempValue['usertaskid'] ){
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];
});
// FetchDefault // FetchDefault
mock.onGet(new RegExp(/^\/wfprocessnodes$/)).reply((config: any) => { mock.onGet(new RegExp(/^\/wfprocessnodes\/fetchdefault$/)).reply((config: any) => {
console.groupCollapsed("实体:wfprocessnode 方法: FetchDefault"); console.groupCollapsed("实体:wfprocessnode 方法: FetchDefault");
console.table({url:config.url, method: config.method, data:config.data}); console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config); let status = MockAdapter.mockStatus(config);
...@@ -110,7 +259,7 @@ mock.onGet(new RegExp(/^\/wfprocessnodes$/)).reply((config: any) => { ...@@ -110,7 +259,7 @@ mock.onGet(new RegExp(/^\/wfprocessnodes$/)).reply((config: any) => {
}); });
// FetchDefault // FetchDefault
mock.onGet(new RegExp(/^\/wfprocessnodes(\?[\w-./?%&=,]*)*$/)).reply((config: any) => { mock.onGet(new RegExp(/^\/wfprocessnodes\/fetchdefault(\?[\w-./?%&=,]*)*$/)).reply((config: any) => {
console.groupCollapsed("实体:wfprocessnode 方法: FetchDefault"); console.groupCollapsed("实体:wfprocessnode 方法: FetchDefault");
console.table({url:config.url, method: config.method, data:config.data}); console.table({url:config.url, method: config.method, data:config.data});
if(config.url.includes('page')){ if(config.url.includes('page')){
...@@ -173,3 +322,59 @@ mock.onGet(new RegExp(/^\/wfprocessnodes\/([a-zA-Z0-9\-\;]{1,35})\/select$/)).re ...@@ -173,3 +322,59 @@ mock.onGet(new RegExp(/^\/wfprocessnodes\/([a-zA-Z0-9\-\;]{1,35})\/select$/)).re
return [status, _items]; return [status, _items];
}); });
// Get
mock.onGet(new RegExp(/^\/wfprocessnodes\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:wfprocessnode 方法: Get");
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> = ['usertaskid'];
const matchArray:any = new RegExp(/^\/wfprocessnodes\/([a-zA-Z0-9\-\;]{1,35})$/).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.usertaskid, tempValue.usertaskid));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items?_items:{});
console.groupEnd();
console.groupEnd();
return [status, _items?_items:{}];
});
// Remove
mock.onDelete(new RegExp(/^\/wfprocessnodes\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:wfprocessnode 方法: Remove");
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> = ['usertaskid'];
const matchArray:any = new RegExp(/^\/wfprocessnodes\/([a-zA-Z0-9\-\;]{1,35})$/).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.usertaskid, tempValue.usertaskid));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items?_items:{});
console.groupEnd();
console.groupEnd();
return [status, _items?_items:{}];
});
...@@ -38,6 +38,123 @@ export default class WFProcessNodeServiceBase extends EntityService { ...@@ -38,6 +38,123 @@ export default class WFProcessNodeServiceBase extends EntityService {
// 实体接口 // 实体接口
/**
* CheckKey接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof WFProcessNodeServiceBase
*/
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = Http.getInstance().post(`/wfprocessnodes/${context.wfprocessnode}/checkkey`,data,isloading);
return res;
}
/**
* Create接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof WFProcessNodeServiceBase
*/
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
}
if(data.srffrontuf){
delete data.srffrontuf;
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/wfprocessnodes`,data,isloading);
return res;
}
/**
* Get接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof WFProcessNodeServiceBase
*/
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/wfprocessnodes/${context.wfprocessnode}`,isloading);
return res;
}
/**
* GetDraft接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof WFProcessNodeServiceBase
*/
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/wfprocessnodes/getdraft`,isloading);
res.data.wfprocessnode = data.wfprocessnode;
return res;
}
/**
* Remove接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof WFProcessNodeServiceBase
*/
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = Http.getInstance().delete(`/wfprocessnodes/${context.wfprocessnode}`,isloading);
return res;
}
/**
* Save接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof WFProcessNodeServiceBase
*/
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/wfprocessnodes/${context.wfprocessnode}/save`,data,isloading);
return res;
}
/**
* Update接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof WFProcessNodeServiceBase
*/
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/wfprocessnodes/${context.wfprocessnode}`,data,isloading);
return res;
}
/** /**
* FetchDefault接口方法 * FetchDefault接口方法
* *
...@@ -48,6 +165,9 @@ export default class WFProcessNodeServiceBase extends EntityService { ...@@ -48,6 +165,9 @@ export default class WFProcessNodeServiceBase extends EntityService {
* @memberof WFProcessNodeServiceBase * @memberof WFProcessNodeServiceBase
*/ */
public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let tempData:any = JSON.parse(JSON.stringify(data));
let res:any = Http.getInstance().get(`/wfprocessnodes/fetchdefault`,tempData,isloading);
return res;
} }
/** /**
......
...@@ -47,6 +47,108 @@ public class WFProcessNodeResource { ...@@ -47,6 +47,108 @@ public class WFProcessNodeResource {
@Lazy @Lazy
public WFProcessNodeMapping wfprocessnodeMapping; public WFProcessNodeMapping wfprocessnodeMapping;
@ApiOperation(value = "新建流程定义节点", tags = {"流程定义节点" }, notes = "新建流程定义节点")
@RequestMapping(method = RequestMethod.POST, value = "/wfprocessnodes")
public ResponseEntity<WFProcessNodeDTO> create(@Validated @RequestBody WFProcessNodeDTO wfprocessnodedto) {
WFProcessNode domain = wfprocessnodeMapping.toDomain(wfprocessnodedto);
wfprocessnodeService.create(domain);
WFProcessNodeDTO dto = wfprocessnodeMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "批量新建流程定义节点", tags = {"流程定义节点" }, notes = "批量新建流程定义节点")
@RequestMapping(method = RequestMethod.POST, value = "/wfprocessnodes/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFProcessNodeDTO> wfprocessnodedtos) {
wfprocessnodeService.createBatch(wfprocessnodeMapping.toDomain(wfprocessnodedtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "获取流程定义节点", tags = {"流程定义节点" }, notes = "获取流程定义节点")
@RequestMapping(method = RequestMethod.GET, value = "/wfprocessnodes/{wfprocessnode_id}")
public ResponseEntity<WFProcessNodeDTO> get(@PathVariable("wfprocessnode_id") String wfprocessnode_id) {
WFProcessNode domain = wfprocessnodeService.get(wfprocessnode_id);
WFProcessNodeDTO dto = wfprocessnodeMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "删除流程定义节点", tags = {"流程定义节点" }, notes = "删除流程定义节点")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfprocessnodes/{wfprocessnode_id}")
public ResponseEntity<Boolean> remove(@PathVariable("wfprocessnode_id") String wfprocessnode_id) {
return ResponseEntity.status(HttpStatus.OK).body(wfprocessnodeService.remove(wfprocessnode_id));
}
@ApiOperation(value = "批量删除流程定义节点", tags = {"流程定义节点" }, notes = "批量删除流程定义节点")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfprocessnodes/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
wfprocessnodeService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "更新流程定义节点", tags = {"流程定义节点" }, notes = "更新流程定义节点")
@RequestMapping(method = RequestMethod.PUT, value = "/wfprocessnodes/{wfprocessnode_id}")
public ResponseEntity<WFProcessNodeDTO> update(@PathVariable("wfprocessnode_id") String wfprocessnode_id, @RequestBody WFProcessNodeDTO wfprocessnodedto) {
WFProcessNode domain = wfprocessnodeMapping.toDomain(wfprocessnodedto);
domain .setUsertaskid(wfprocessnode_id);
wfprocessnodeService.update(domain );
WFProcessNodeDTO dto = wfprocessnodeMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "批量更新流程定义节点", tags = {"流程定义节点" }, notes = "批量更新流程定义节点")
@RequestMapping(method = RequestMethod.PUT, value = "/wfprocessnodes/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFProcessNodeDTO> wfprocessnodedtos) {
wfprocessnodeService.updateBatch(wfprocessnodeMapping.toDomain(wfprocessnodedtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "检查流程定义节点", tags = {"流程定义节点" }, notes = "检查流程定义节点")
@RequestMapping(method = RequestMethod.POST, value = "/wfprocessnodes/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody WFProcessNodeDTO wfprocessnodedto) {
return ResponseEntity.status(HttpStatus.OK).body(wfprocessnodeService.checkKey(wfprocessnodeMapping.toDomain(wfprocessnodedto)));
}
@ApiOperation(value = "获取流程定义节点草稿", tags = {"流程定义节点" }, notes = "获取流程定义节点草稿")
@RequestMapping(method = RequestMethod.GET, value = "/wfprocessnodes/getdraft")
public ResponseEntity<WFProcessNodeDTO> getDraft(WFProcessNodeDTO dto) {
WFProcessNode domain = wfprocessnodeMapping.toDomain(dto);
return ResponseEntity.status(HttpStatus.OK).body(wfprocessnodeMapping.toDto(wfprocessnodeService.getDraft(domain)));
}
@ApiOperation(value = "保存流程定义节点", tags = {"流程定义节点" }, notes = "保存流程定义节点")
@RequestMapping(method = RequestMethod.POST, value = "/wfprocessnodes/save")
public ResponseEntity<WFProcessNodeDTO> save(@RequestBody WFProcessNodeDTO wfprocessnodedto) {
WFProcessNode domain = wfprocessnodeMapping.toDomain(wfprocessnodedto);
wfprocessnodeService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(wfprocessnodeMapping.toDto(domain));
}
@ApiOperation(value = "批量保存流程定义节点", tags = {"流程定义节点" }, notes = "批量保存流程定义节点")
@RequestMapping(method = RequestMethod.POST, value = "/wfprocessnodes/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFProcessNodeDTO> wfprocessnodedtos) {
wfprocessnodeService.saveBatch(wfprocessnodeMapping.toDomain(wfprocessnodedtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "获取DEFAULT", tags = {"流程定义节点" } ,notes = "获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/wfprocessnodes/fetchdefault")
public ResponseEntity<List<WFProcessNodeDTO>> fetchDefault(WFProcessNodeSearchContext context) {
Page<WFProcessNode> domains = wfprocessnodeService.searchDefault(context) ;
List<WFProcessNodeDTO> list = wfprocessnodeMapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@ApiOperation(value = "查询DEFAULT", tags = {"流程定义节点" } ,notes = "查询DEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/wfprocessnodes/searchdefault")
public ResponseEntity<Page<WFProcessNodeDTO>> searchDefault(@RequestBody WFProcessNodeSearchContext context) {
Page<WFProcessNode> domains = wfprocessnodeService.searchDefault(context) ;
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(wfprocessnodeMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册