parent
180f894d48
commit
2d899495a6
10 changed files with 80 additions and 37 deletions
@ -0,0 +1 @@ |
||||
package com.lq.api; |
@ -1,4 +1,4 @@ |
||||
package com.lq.wap.vo; |
||||
package com.lq.api.vo; |
||||
|
||||
public class UeditorVo { |
||||
|
@ -0,0 +1,46 @@ |
||||
package com.lq.api.web; |
||||
|
||||
import com.lq.code.entity.AjaxResult; |
||||
import com.lq.code.util.FileUtil; |
||||
import com.lq.entity.SysFile; |
||||
import org.springframework.beans.factory.annotation.Value; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
import org.springframework.web.bind.annotation.ResponseBody; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
import java.io.File; |
||||
import java.text.SimpleDateFormat; |
||||
import java.util.Date; |
||||
@Controller |
||||
@RequestMapping("/file") |
||||
public class SysFileController { |
||||
|
||||
|
||||
@Value("${file.upload}") |
||||
private String FILE_LOAD_PATH; |
||||
|
||||
|
||||
@RequestMapping("/upload") |
||||
@ResponseBody |
||||
public Object upload(@RequestParam("files")MultipartFile[] files){ |
||||
AjaxResult ajaxResult = new AjaxResult(); |
||||
ajaxResult.setMsg("上传成功"); |
||||
Date nowTime = new Date(); |
||||
SimpleDateFormat sdf =new SimpleDateFormat("yyyyMMdd"); |
||||
File fileDir = new File(FILE_LOAD_PATH+sdf.format(nowTime)); |
||||
if (!fileDir.exists()){ |
||||
fileDir.mkdirs(); |
||||
} |
||||
for (MultipartFile multipartFile:files){ |
||||
SysFile sysFile = new SysFile(); |
||||
sysFile.setCreateTime(nowTime); |
||||
String fileType = FileUtil.getFileType(multipartFile.getName()); |
||||
sysFile.setFileType(fileType); |
||||
sysFile.setFileName(multipartFile.getName()); |
||||
|
||||
} |
||||
return ajaxResult; |
||||
} |
||||
} |
@ -1,4 +0,0 @@ |
||||
/** |
||||
* Created by qi_liang on 2018/5/10. |
||||
*/ |
||||
package com.lq.wap; |
@ -1,18 +0,0 @@ |
||||
package com.lq.wap.web; |
||||
|
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
||||
/** |
||||
* Created by qi_liang on 2018/5/10. |
||||
*/ |
||||
@Controller |
||||
@RequestMapping("/wap") |
||||
public class WapIndexController { |
||||
|
||||
@RequestMapping("/index") |
||||
public String index(){ |
||||
|
||||
return "/wap/index"; |
||||
} |
||||
} |
Loading…
Reference in new issue