|
@@ -17,9 +17,11 @@ import org.apache.commons.io.IOUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
+import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
@@ -57,6 +59,12 @@ public class OrgApi {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
OrgService orgService;
|
|
OrgService orgService;
|
|
|
|
+
|
|
|
|
+ @Value("${staticResource.rootPath}")
|
|
|
|
+ private String rootPath;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
@ApiOperation(value = "查询机构分页带查询", notes = "分页带查询")
|
|
@ApiOperation(value = "查询机构分页带查询", notes = "分页带查询")
|
|
@GetMapping("/all/{curPage}/{pageSize}")
|
|
@GetMapping("/all/{curPage}/{pageSize}")
|
|
@@ -278,7 +286,9 @@ public class OrgApi {
|
|
public ResponseEntity importLogo(@PathVariable Long id, HttpServletRequest request,
|
|
public ResponseEntity importLogo(@PathVariable Long id, HttpServletRequest request,
|
|
@RequestParam CommonsMultipartFile file) {
|
|
@RequestParam CommonsMultipartFile file) {
|
|
try {
|
|
try {
|
|
- FileUtils.copyInputStreamToFile(file.getInputStream(), new File("D:/Temp/fuck.jpg"));
|
|
|
|
|
|
+ String filePath = rootPath + "/logo/" + id + ".jpg";
|
|
|
|
+ FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
|
|
|
|
+ jdbcTemplate.update("update ecs_core_org t set t.logo=? where t.id=?", filePath, id);
|
|
return new ResponseEntity("", HttpStatus.OK);
|
|
return new ResponseEntity("", HttpStatus.OK);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
|
|
return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
|