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

ibizdev提交

上级 7a1a7183
import GridViewEngine from './grid-view-engine';
/**
* 视图引擎基础
*
* @export
* @class WFDynaExpGridViewEngine
* @extends {GridViewEngine}
*/
export default class WFDynaExpGridViewEngine extends GridViewEngine {
/**
* Creates an instance of WFDynaExpGridViewEngine.
* @memberof WFDynaExpGridViewEngine
*/
constructor() {
super();
}
/**
* 引擎加载
*
* @param {*} [opts={}]
* @memberof WFDynaExpGridViewEngine
*/
public load(opts: any = {},isnotify:boolean=false): void {
this.view.getWFStepModel().then((res:any) =>{
if(!this.view.isformDruipart){
super.load(opts);
}else{
if(isnotify){
super.load(opts);
}
}
})
}
}
\ No newline at end of file
......@@ -11,6 +11,7 @@ const mockDatas: Array<any> = [
mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfgroups\/[a-zA-Z0-9\-\;]+\/usertasks\/[a-zA-Z0-9\-\;]+\/ways$/)).reply((config: any) => {
console.groupCollapsed("实体:wfgroup 方法: getwflink");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -29,6 +30,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfgroups\/[a-zA-Z0-9\-\;]+\/use
mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfgroups\/process-definitions-nodes$/)).reply((config: any) => {
console.groupCollapsed("实体:wfgroup 方法: getwfstep");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -52,6 +54,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfgroups\/process-definitions-n
mock.onPost(new RegExp(/^\/wfgroups\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:wfgroup 方法: createBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -63,6 +66,7 @@ mock.onPost(new RegExp(/^\/wfgroups\/batch$/)).reply((config: any) => {
mock.onPut(new RegExp(/^\/wfgroups\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:wfgroup 方法: updateBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -74,6 +78,7 @@ mock.onPut(new RegExp(/^\/wfgroups\/batch$/)).reply((config: any) => {
mock.onDelete(new RegExp(/^\/wfgroups\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:wfgroup 方法: removeBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......
......@@ -11,6 +11,7 @@ const mockDatas: Array<any> = [
mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfmembers\/[a-zA-Z0-9\-\;]+\/usertasks\/[a-zA-Z0-9\-\;]+\/ways$/)).reply((config: any) => {
console.groupCollapsed("实体:wfmember 方法: getwflink");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -29,6 +30,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfmembers\/[a-zA-Z0-9\-\;]+\/us
mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfmembers\/process-definitions-nodes$/)).reply((config: any) => {
console.groupCollapsed("实体:wfmember 方法: getwfstep");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -52,6 +54,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfmembers\/process-definitions-
mock.onPost(new RegExp(/^\/wfmembers\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:wfmember 方法: createBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -63,6 +66,7 @@ mock.onPost(new RegExp(/^\/wfmembers\/batch$/)).reply((config: any) => {
mock.onPut(new RegExp(/^\/wfmembers\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:wfmember 方法: updateBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -74,6 +78,7 @@ mock.onPut(new RegExp(/^\/wfmembers\/batch$/)).reply((config: any) => {
mock.onDelete(new RegExp(/^\/wfmembers\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:wfmember 方法: removeBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......
......@@ -11,6 +11,7 @@ const mockDatas: Array<any> = [
mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfprocessdefinitions\/[a-zA-Z0-9\-\;]+\/usertasks\/[a-zA-Z0-9\-\;]+\/ways$/)).reply((config: any) => {
console.groupCollapsed("实体:wfprocessdefinition 方法: getwflink");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -29,6 +30,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfprocessdefinitions\/[a-zA-Z0-
mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfprocessdefinitions\/process-definitions-nodes$/)).reply((config: any) => {
console.groupCollapsed("实体:wfprocessdefinition 方法: getwfstep");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -52,6 +54,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfprocessdefinitions\/process-d
mock.onPost(new RegExp(/^\/wfprocessdefinitions\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:wfprocessdefinition 方法: createBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -63,6 +66,7 @@ mock.onPost(new RegExp(/^\/wfprocessdefinitions\/batch$/)).reply((config: any) =
mock.onPut(new RegExp(/^\/wfprocessdefinitions\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:wfprocessdefinition 方法: updateBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -74,6 +78,7 @@ mock.onPut(new RegExp(/^\/wfprocessdefinitions\/batch$/)).reply((config: any) =>
mock.onDelete(new RegExp(/^\/wfprocessdefinitions\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:wfprocessdefinition 方法: removeBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......
......@@ -11,6 +11,7 @@ const mockDatas: Array<any> = [
mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfsystems\/[a-zA-Z0-9\-\;]+\/usertasks\/[a-zA-Z0-9\-\;]+\/ways$/)).reply((config: any) => {
console.groupCollapsed("实体:wfsystem 方法: getwflink");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -29,6 +30,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfsystems\/[a-zA-Z0-9\-\;]+\/us
mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfsystems\/process-definitions-nodes$/)).reply((config: any) => {
console.groupCollapsed("实体:wfsystem 方法: getwfstep");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -52,6 +54,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfsystems\/process-definitions-
mock.onPost(new RegExp(/^\/wfsystems\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:wfsystem 方法: createBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -63,6 +66,7 @@ mock.onPost(new RegExp(/^\/wfsystems\/batch$/)).reply((config: any) => {
mock.onPut(new RegExp(/^\/wfsystems\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:wfsystem 方法: updateBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -74,6 +78,7 @@ mock.onPut(new RegExp(/^\/wfsystems\/batch$/)).reply((config: any) => {
mock.onDelete(new RegExp(/^\/wfsystems\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:wfsystem 方法: removeBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......
......@@ -11,6 +11,7 @@ const mockDatas: Array<any> = [
mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfusers\/[a-zA-Z0-9\-\;]+\/usertasks\/[a-zA-Z0-9\-\;]+\/ways$/)).reply((config: any) => {
console.groupCollapsed("实体:wfuser 方法: getwflink");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -29,6 +30,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfusers\/[a-zA-Z0-9\-\;]+\/user
mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfusers\/process-definitions-nodes$/)).reply((config: any) => {
console.groupCollapsed("实体:wfuser 方法: getwfstep");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -52,6 +54,7 @@ mock.onGet(new RegExp(/^\/wfcore\/ibzwf-app-web\/wfusers\/process-definitions-no
mock.onPost(new RegExp(/^\/wfusers\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:wfuser 方法: createBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -63,6 +66,7 @@ mock.onPost(new RegExp(/^\/wfusers\/batch$/)).reply((config: any) => {
mock.onPut(new RegExp(/^\/wfusers\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:wfuser 方法: updateBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......@@ -74,6 +78,7 @@ mock.onPut(new RegExp(/^\/wfusers\/batch$/)).reply((config: any) => {
mock.onDelete(new RegExp(/^\/wfusers\/batch$/)).reply((config: any) => {
console.groupCollapsed("实体:wfuser 方法: removeBatch");
console.table({url:config.url, method: config.method, data:config.data});
console.groupEnd();
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, {}];
......
......@@ -41,6 +41,15 @@ public class webSecurityConfig extends WebSecurityConfigurerAdapter {
@Value("${ibiz.auth.path:v7/login}")
private String loginPath;
@Value("${ibiz.file.uploadpath:ibizutil/upload}")
private String uploadpath;
@Value("${ibiz.file.downloadpath:ibizutil/download}")
private String downloadpath;
@Value("${ibiz.file.previewpath:ibizutil/preview}")
private String previewpath;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
......@@ -97,6 +106,10 @@ public class webSecurityConfig extends WebSecurityConfigurerAdapter {
).permitAll()
//放行登录请求
.antMatchers( HttpMethod.POST,"/"+loginPath).permitAll()
// 文件操作
.antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**").permitAll()
// 所有请求都需要认证
.anyRequest().authenticated()
// 防止iframe 造成跨域
......
......@@ -40,6 +40,15 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
@Value("${ibiz.auth.path:v7/login}")
private String loginPath;
@Value("${ibiz.file.uploadpath:ibizutil/upload}")
private String uploadpath;
@Value("${ibiz.file.downloadpath:ibizutil/download}")
private String downloadpath;
@Value("${ibiz.file.previewpath:ibizutil/preview}")
private String previewpath;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
......@@ -92,6 +101,10 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
).permitAll()
//放行登录请求
.antMatchers( HttpMethod.POST,"/"+loginPath).permitAll()
// 文件操作
.antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**").permitAll()
.anyRequest().authenticated()
// 防止iframe 造成跨域
.and().headers().frameOptions().disable();
......
......@@ -14,6 +14,8 @@ public class FileItem
{
private String id;
private String name;
private String fileid;
private String filename;
private long size;
private String ext;
}
......@@ -14,21 +14,20 @@ import java.io.*;
@Slf4j
@RestController
@RequestMapping("/")
public class FileController
{
@Autowired
private FileService fileService;
@PostMapping(value = "${ibiz.uploadpath.path:ibizutil/upload}")
@PostMapping(value = "${ibiz.file.uploadpath:ibizutil/upload}")
public ResponseEntity<FileItem> upload(@RequestParam("file") MultipartFile multipartFile){
return ResponseEntity.ok().body(fileService.saveFile(multipartFile));
}
private final String defaultdownloadpath="ibizutil/download/{id}";
protected String getDefaultdownloadpath(){
return defaultdownloadpath;
}
@GetMapping(value = "${ibiz.file.downloadpath:"+defaultdownloadpath+"}")
@ResponseStatus(HttpStatus.OK)
......
......@@ -3,6 +3,7 @@ package cn.ibizlab.util.service;
import cn.ibizlab.util.domain.FileItem;
import cn.ibizlab.util.errors.InternalServerErrorException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
......@@ -11,7 +12,6 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.UUID;
@Primary
@Slf4j
......@@ -21,26 +21,22 @@ public class SimpleFileService implements FileService {
@Value("${ibiz.filePath:/app/file/}")
private String fileRoot;
@Override
public FileItem saveFile(MultipartFile multipartFile) {
FileItem item=null;
// 获取文件名
String fileName = multipartFile.getOriginalFilename();
// 获取文件后缀
String extname="."+getExtensionName(fileName);
// 用uuid作为文件名,防止生成的临时文件重复
String fileid= UUID.randomUUID().toString();
String fileFullPath = this.fileRoot+"ibztuit"+File.separator+fileid+File.separator+fileName;
File file = new File(fileFullPath);
File parent = new File(file.getParent());
if(!parent.exists())
parent.mkdirs();
try {
FileCopyUtils.copy(multipartFile.getInputStream() , Files.newOutputStream(file.toPath()));
item=new FileItem(fileid,fileName, (int)multipartFile.getSize() ,extname);
String fileid= DigestUtils.md5Hex(multipartFile.getInputStream());
String fileFullPath = this.fileRoot+"ibizutil"+File.separator+fileid+File.separator+fileName;
File file = new File(fileFullPath);
File parent = new File(file.getParent());
if(!parent.exists())
parent.mkdirs();
FileCopyUtils.copy(multipartFile.getInputStream(),Files.newOutputStream(file.toPath()));
item=new FileItem(fileid,fileName,fileid,fileName,(int)multipartFile.getSize(),extname);
} catch (IOException e) {
throw new InternalServerErrorException("文件上传失败");
}
......@@ -49,7 +45,7 @@ public class SimpleFileService implements FileService {
@Override
public File getFile(String fileid) {
String dirpath = this.fileRoot+"ibztuit"+File.separator+fileid;
String dirpath = this.fileRoot+"ibizutil"+File.separator+fileid;
File parent = new File(dirpath);
if (parent.exists() && parent.isDirectory() && parent.listFiles().length > 0) {
return parent.listFiles()[0];
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册