Merge branch 'master' of http://118.219.150.34:50501/DBNT/FAISP
commit
caac765231
|
|
@ -33,6 +33,9 @@ dependencies {
|
||||||
implementation 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16'
|
implementation 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16'
|
||||||
runtimeOnly 'org.postgresql:postgresql:42.3.6'
|
runtimeOnly 'org.postgresql:postgresql:42.3.6'
|
||||||
implementation 'com.oracle.database.jdbc:ojdbc8:21.7.0.0'
|
implementation 'com.oracle.database.jdbc:ojdbc8:21.7.0.0'
|
||||||
|
|
||||||
|
// json
|
||||||
|
implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
|
||||||
|
|
||||||
|
|
||||||
//엑셀다운
|
//엑셀다운
|
||||||
|
|
|
||||||
|
|
@ -12,63 +12,62 @@ import com.dbnt.faisp.util.Utils;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import org.json.simple.JSONArray;
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.util.FileCopyUtils;
|
import org.springframework.util.FileCopyUtils;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class EditorController {
|
public class EditorController {
|
||||||
|
|
||||||
private final CodeMgtService codeMgtService;
|
@Value("${site.domain}")
|
||||||
private final OrganConfigService organConfigService;
|
protected String siteDomain;
|
||||||
private final MenuMgtService menuMgtService;
|
|
||||||
private final UserInfoService userInfoService;
|
|
||||||
|
|
||||||
SimpleDateFormat sDate = new SimpleDateFormat("yyyyMM");
|
|
||||||
// 현재년월
|
|
||||||
String year = sDate.format(new Date()) + "/";
|
|
||||||
|
|
||||||
@Value("${file.dir}")
|
@Value("${file.dir}")
|
||||||
protected String fileDir;
|
protected String fileDir;
|
||||||
|
|
||||||
@Value("${file.dir.editor}")
|
@Value("${file.dir.editor}")
|
||||||
protected String editorPath;
|
protected String editorPath;
|
||||||
|
|
||||||
@Autowired
|
@Value("${editor.img.view}")
|
||||||
private Environment env;
|
protected String imgView;
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/Crosseditor/uploadImg")
|
@PostMapping("/Crosseditor/uploadImg")
|
||||||
@ResponseBody
|
public @ResponseBody JSONObject uploadImg(Model model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
|
||||||
public ParamMap uploadImg(Model model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
|
|
||||||
ParamMap result = new ParamMap();
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
JSONObject data = new JSONObject();
|
||||||
|
JSONArray req_array = new JSONArray();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request;
|
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request;
|
||||||
MultipartFile mFile = multipartRequest.getFile("imageFile");
|
MultipartFile mFile = multipartRequest.getFile("imageFile");
|
||||||
if(!"".equals(mFile.getOriginalFilename())){
|
if(!"".equals(mFile.getOriginalFilename())){
|
||||||
|
|
||||||
long attach_file_Size = mFile.getSize();
|
|
||||||
String attach_file_Name = mFile.getOriginalFilename();
|
String attach_file_Name = mFile.getOriginalFilename();
|
||||||
String attach_save_Name = Utils.generationSaveName();
|
String attach_save_Name = Utils.generationSaveName();
|
||||||
|
String imageKind = request.getParameter("imageKind");
|
||||||
|
String editorFrame = request.getParameter("editorFrame");
|
||||||
|
|
||||||
//파일 타입
|
//파일 타입
|
||||||
String extNm = "." + attach_file_Name.substring( attach_file_Name.lastIndexOf( "." ) + 1, attach_file_Name.length());
|
String extNm = "." + attach_file_Name.substring( attach_file_Name.lastIndexOf( "." ) + 1, attach_file_Name.length());
|
||||||
|
|
@ -93,70 +92,35 @@ public class EditorController {
|
||||||
System.out.println("Directory already exists");
|
System.out.println("Directory already exists");
|
||||||
}
|
}
|
||||||
|
|
||||||
File file = new File(fileDir+File.separator+editorPath, attach_save_Name + extNm);
|
File file = new File(fileDir+File.separator+editorPath, attach_save_Name + extNm);
|
||||||
|
|
||||||
FileCopyUtils.copy(mFile.getBytes(), file);
|
FileCopyUtils.copy(mFile.getBytes(), file);
|
||||||
String webPath = "http://localhost:8080/file/editorFileDisplay?fileNm=" + attach_save_Name + extNm;
|
|
||||||
|
String webPath = siteDomain+ imgView + attach_save_Name + extNm;
|
||||||
result.set("result", "success");
|
|
||||||
List<ParamMap> addmsg = new ArrayList<>();
|
jsonObject.put("result","success");
|
||||||
ParamMap imgInfo = new ParamMap();
|
data.put("imageURL",webPath);
|
||||||
imgInfo.set("imageURL", webPath);
|
data.put("imageKind", imageKind);
|
||||||
imgInfo.set("imageTitle", "");
|
data.put("editorFrame", editorFrame);
|
||||||
imgInfo.set("imageAlt", "");
|
req_array.add(data);
|
||||||
imgInfo.set("imageWidth", "");
|
jsonObject.put("addmsg", req_array);
|
||||||
imgInfo.set("imageWidthUnit", "px");
|
|
||||||
imgInfo.set("imageHeight", "");
|
|
||||||
imgInfo.set("imageHeightUnit", "");
|
|
||||||
imgInfo.set("imageSize", attach_file_Size);
|
|
||||||
imgInfo.set("imageMarginLeft", "");
|
|
||||||
imgInfo.set("imageMarginLeftUnit", "px");
|
|
||||||
imgInfo.set("imageMarginRight", "");
|
|
||||||
imgInfo.set("imageMarginRightUnit", "px");
|
|
||||||
imgInfo.set("imageMarginTop", "");
|
|
||||||
imgInfo.set("imageMarginTopUnit", "px");
|
|
||||||
imgInfo.set("imageMarginBottom", "");
|
|
||||||
imgInfo.set("imageMarginBottomUnit", "px");
|
|
||||||
imgInfo.set("imageAlign", "imageAlign");
|
|
||||||
imgInfo.set("imageId", "");
|
|
||||||
imgInfo.set("imageClass", "");
|
|
||||||
imgInfo.set("imageBorder", 0);
|
|
||||||
imgInfo.set("imageKind", "image");
|
|
||||||
imgInfo.set("imageOrgPath", attach_save_Name + extNm+"|"+webPath);
|
|
||||||
imgInfo.set("imageOrgWidth", 1893);
|
|
||||||
imgInfo.set("imageOrgHeight", 857);
|
|
||||||
imgInfo.set("editorFrame", "NamoSE_editorframe_crosseditor4");
|
|
||||||
addmsg.add(imgInfo);
|
|
||||||
result.set("addmsg", addmsg);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
result.set("uploaded", 0);
|
|
||||||
ParamMap error = new ParamMap();
|
ParamMap error = new ParamMap();
|
||||||
error.set("message", "Check File Extentions.");
|
error.set("message", "Check File Extentions.");
|
||||||
result.set("error", error);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result.set("uploaded", 0);
|
|
||||||
ParamMap error = new ParamMap();
|
ParamMap error = new ParamMap();
|
||||||
error.set("message", "Check File Extentions.");
|
error.set("message", "Check File Extentions.");
|
||||||
result.set("error", error);
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
result.set("uploaded", 0);
|
|
||||||
ParamMap error = new ParamMap();
|
ParamMap error = new ParamMap();
|
||||||
error.set("message", "Check File Extentions.");
|
error.set("message", "Check File Extentions.");
|
||||||
result.set("error", error);
|
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
|
return jsonObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getCurrentProfile() {
|
|
||||||
String[] profiles = env.getActiveProfiles();
|
|
||||||
|
|
||||||
if( profiles.length == 0 ) profiles = env.getDefaultProfiles();
|
|
||||||
|
|
||||||
return profiles[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ spring.servlet.multipart.location=C:\\faispUploadFiles
|
||||||
spring.servlet.multipart.max-file-size=200MB
|
spring.servlet.multipart.max-file-size=200MB
|
||||||
spring.servlet.multipart.max-request-size=500MB
|
spring.servlet.multipart.max-request-size=500MB
|
||||||
|
|
||||||
|
site.domain=http://localhost:8080
|
||||||
|
|
||||||
#file
|
#file
|
||||||
file.dir=C:\\faispUploadFiles
|
file.dir=C:\\faispUploadFiles
|
||||||
file.dir.vulnerable=/vulnerable
|
file.dir.vulnerable=/vulnerable
|
||||||
|
|
@ -15,6 +17,8 @@ file.dir.sailor=sailor
|
||||||
file.dir.affair=affair
|
file.dir.affair=affair
|
||||||
file.dir.editor=editor
|
file.dir.editor=editor
|
||||||
|
|
||||||
|
editor.img.view=/file/editorFileDisplay?fileNm=
|
||||||
|
|
||||||
|
|
||||||
#thymeleaf
|
#thymeleaf
|
||||||
spring.thymeleaf.prefix=classpath:templates/
|
spring.thymeleaf.prefix=classpath:templates/
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ spring.servlet.multipart.location=/uploadFiles
|
||||||
spring.servlet.multipart.max-file-size=200MB
|
spring.servlet.multipart.max-file-size=200MB
|
||||||
spring.servlet.multipart.max-request-size=500MB
|
spring.servlet.multipart.max-request-size=500MB
|
||||||
|
|
||||||
|
site.domain=http://118.219.150.34:50580
|
||||||
|
|
||||||
#file
|
#file
|
||||||
file.dir=/uploadFiles
|
file.dir=/uploadFiles
|
||||||
file.dir.vulnerable=/vulnerable
|
file.dir.vulnerable=/vulnerable
|
||||||
|
|
@ -14,6 +16,8 @@ file.dir.sailor=sailor
|
||||||
file.dir.affair=affair
|
file.dir.affair=affair
|
||||||
file.dir.editor=editor
|
file.dir.editor=editor
|
||||||
|
|
||||||
|
editor.img.view=/file/editorFileDisplay?fileNm=
|
||||||
|
|
||||||
#thymeleaf
|
#thymeleaf
|
||||||
spring.thymeleaf.prefix=classpath:templates/
|
spring.thymeleaf.prefix=classpath:templates/
|
||||||
spring.thymeleaf.check-template-location=true
|
spring.thymeleaf.check-template-location=true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue