|
|
|
@ -1,5 +1,7 @@ |
|
|
|
|
package org.jeecg.modules.demo.depfile.controller; |
|
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
|
import java.net.URL; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.List; |
|
|
|
@ -97,6 +99,10 @@ public class DepfileController extends JeecgController<Depfile, IDepfileService> |
|
|
|
|
depfile.setUserid(user.getId()); |
|
|
|
|
String depiid = depadminlxService.getdepid(user.getId()); |
|
|
|
|
depfile.setDepid(depiid); |
|
|
|
|
String extension = getFileExtensionFromUrl(depfile.getUpfile()); |
|
|
|
|
System.out.println(depfile.getUpfile()); |
|
|
|
|
System.out.println(depfile.getUpfile()); |
|
|
|
|
depfile.setFilehz(extension); |
|
|
|
|
depfileService.save(depfile); |
|
|
|
|
return Result.OK("添加成功!"); |
|
|
|
|
} |
|
|
|
@ -111,6 +117,10 @@ public class DepfileController extends JeecgController<Depfile, IDepfileService> |
|
|
|
|
@ApiOperation(value="单位技术研究资质情况-编辑", notes="单位技术研究资质情况-编辑") |
|
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
|
|
|
|
public Result<String> edit(@RequestBody Depfile depfile) { |
|
|
|
|
String extension = getFileExtensionFromUrl(depfile.getUpfile()); |
|
|
|
|
depfile.setFilehz(extension); |
|
|
|
|
System.out.println(depfile.getUpfile()); |
|
|
|
|
System.out.println(depfile.getUpfile()); |
|
|
|
|
depfileService.updateById(depfile); |
|
|
|
|
return Result.OK("编辑成功!"); |
|
|
|
|
} |
|
|
|
@ -181,6 +191,14 @@ public class DepfileController extends JeecgController<Depfile, IDepfileService> |
|
|
|
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
|
|
|
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
|
|
|
|
return super.importExcel(request, response, Depfile.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
public static String getFileExtensionFromUrl(String fileUrl) { |
|
|
|
|
|
|
|
|
|
File file = new File(fileUrl); |
|
|
|
|
String fileName = file.getName(); |
|
|
|
|
String extension = fileName.substring(fileName.lastIndexOf(".") + 1); |
|
|
|
|
return extension; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|