이지우 - 관리자 분쟁조정서식 수정에도 이노릭스 적용

This commit is contained in:
JIWOO 2024-11-08 18:51:16 +09:00
parent 0e7a02d55b
commit aa3506f868
5 changed files with 128 additions and 51 deletions

View File

@ -18,6 +18,7 @@ import seed.com.gtm.seedfile.SeedFileService;
import seed.com.gtm.util.Criteria;
import seed.com.gtm.util.PageMaker;
import seed.common.service.InnorixFileService;
import seed.utils.FairnetUtils;
@Controller
@RequestMapping("/gtm/case")
@ -61,23 +62,12 @@ public class CaseBoardController {
String innorixFileListStr = (String) paramMap.get("innorixFileListVO");
if(!"".equals(innorixFileListStr)) {
try {
paramMap.put("innorixDataIdx", paramMap.get("dataIdx"));
innorixFileService.innorixExtraFileInsert(innorixFileListStr, paramMap);
}catch(Exception e) {
System.out.println("이노릭스에러");
e.printStackTrace();
}
}
/* if(!"".equals(innorixFileListVO)) {
ObjectMapper objectMapper = new ObjectMapper();
try {
List<InnorixFileVO> innorixFileList = objectMapper.readValue(innorixFileListVO, new TypeReference<List<InnorixFileVO>>() {});
innorixFileService.innorixExtraFileInsert(innorixFileList, paramMap);
}catch (Exception e) {
e.printStackTrace();
}
}
*/
map.put("message", "common.message.reg");
map.put("url", "/gtm/case/board/"+boardIdx+"/list.do");
@ -163,6 +153,16 @@ public class CaseBoardController {
model.addAttribute("fileList", fileList);
model.addAttribute("fileListSize", fileList.size());
//이노릭스 수정화면 파일 넘겨주기
String innorixFileListInfoStr = "";
try {
innorixFileListInfoStr = FairnetUtils.innorixFileListInfo(fileList);
}catch(Exception e){
System.out.println("이노릭스 에러");
}
model.addAttribute("innorixFileListInfoStr", innorixFileListInfoStr);
return "/seed/_extra/gtm/board/edit";
}
@ -183,24 +183,21 @@ public class CaseBoardController {
"&fileFuncType=" + paramMap.get("fileFuncType")
);
//이노릭스 대용량 업로드
String innorixFileListStr = (String) paramMap.get("innorixFileListVO");
if(!"".equals(innorixFileListStr)) {
try {
String bbsNoStr = (String)paramMap.get("bbsNo");
int innorixDataIdx = Integer.parseInt(bbsNoStr);
paramMap.put("innorixDataIdx", innorixDataIdx);
innorixFileService.innorixExtraFileInsert(innorixFileListStr, paramMap);
}catch(Exception e) {
System.out.println("이노릭스에러");
}
}
return "/_common/jsp/message";
}
//게시글 등록 innorix 적용
@RequestMapping(value="/board/{boardIdx}/writeWithInnorix.do", method=RequestMethod.POST)
public String formWriteWithInnorix(HttpServletRequest request ,HttpSession session, @RequestParam Map<String,Object> paramMap, Map<String, Object> map, @PathVariable(value="boardIdx") String boardIdx){
paramMap.put("memberName", session.getAttribute("memberName"));
paramMap.put("memberId", session.getAttribute("memberId"));
paramMap.put("boardIdx", boardIdx);
service.boardInsert(paramMap);
//현제 등록된 게시글의 시퀀스 불러와 맵에 저장
paramMap.put("dataIdx", paramMap.get("seq"));
/*fileService.fileInsert(paramMap, request, session);*/
map.put("message", "common.message.reg");
map.put("url", "/gtm/case/board/"+boardIdx+"/list.do");
return "/_common/jsp/message";
}
}

View File

@ -27,7 +27,7 @@ public class InnorixFileServiceImpl extends EgovAbstractServiceImpl implements I
List<InnorixFileVO> innorixFileList = objectMapper.readValue(innorixFileListStr, new TypeReference<List<InnorixFileVO>>() {});
for(InnorixFileVO innorixFileVO : innorixFileList) {
innorixFileVO.setDataIdx((Integer) paramMap.get("dataIdx"));
innorixFileVO.setDataIdx((Integer) paramMap.get("innorixDataIdx"));
innorixFileVO.setFileFuncType((String)paramMap.get("fileFuncType"));
String fileName = innorixFileVO.getClientFileName();

View File

@ -75,6 +75,8 @@ public class InnorixFileVO extends ComDefaultVO implements Serializable {
private String fileType;
private String printFileName;
public List<InnorixFileVO> getInnorixFileListVO() {
return innorixFileListVO;
@ -208,6 +210,12 @@ public class InnorixFileVO extends ComDefaultVO implements Serializable {
public void setFileType(String fileType) {
this.fileType = fileType;
}
public String getPrintFileName() {
return printFileName;
}
public void setPrintFileName(String printFileName) {
this.printFileName = printFileName;
}

View File

@ -1,15 +1,18 @@
package seed.utils;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.ui.ModelMap;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ibm.icu.text.SimpleDateFormat;
import com.sci.v2.ipin.secu.SciSecuManager;
import com.sci.v2.ipin.secu.hmac.SciHmac;
@ -386,4 +389,24 @@ public class FairnetUtils {
* 핸드폰 인증 */
}
/*첨부파일 목록의 정보를 이노릭스 화면에서 사용하기 위한 정보로 리턴*/
public static String innorixFileListInfo(List<Map<String, Object>> fileList) throws Exception {
List<Map<String, Object>> innorixFileListInfo = new ArrayList<>();
for (Map<String, Object> file : fileList) {
Map<String, Object> innorixFileInfo = new HashMap<>();
innorixFileInfo.put("printFileName", file.get("EXTRA_FILE_NAME"));
innorixFileInfo.put("fileSize", file.get("EXTRA_FILE_SIZE"));
innorixFileInfo.put("dataIdx", file.get("EXTRA_FILE_IDX"));
innorixFileInfo.put("downloadUrl", "notUse"); //해당 없으면 목록이 안나와 임시로 사용
innorixFileListInfo.add(innorixFileInfo);
}
ObjectMapper objectMapper = new ObjectMapper();
String innorixFileListInfoStr = objectMapper.writeValueAsString(innorixFileListInfo);
return innorixFileListInfoStr;
}
}

View File

@ -104,7 +104,8 @@
</div>
<div class="btn_wrap right">
<button type="submit" class="btn btn_text btn_46 blue_fill">저장</button>
<button type="submit" class="btn btn_text btn_46 blue_fill" style="display:none;">저장</button>
<button type="button" class="btn btn_text btn_46 blue_fill" onclick="innorixUpload();">저장</button>
<button type="button" onclick="javascript:goList()" class="btn btn_text btn_46 gray_fill">목록</button>
</div>
</fieldset>
@ -198,9 +199,6 @@
directory = result;
});
fileList = '${fileList}'
fileList = JSON.stringify(fileList);
/* innorix-3
이노릭스 업로드 컨트롤 생성
@ -215,32 +213,83 @@
allowExtension : ["txt","jpeg","jpg","png","gif","bmp","mp3","mp4","hwp","doc","docx","xls","xlsx","ppt","pptx","pdf","zip","alz"]
});
var downFileArr =${innorixFileListInfoStr};
/* innorix-5
이노릭스 업로드 완료 후
콜백 함수로 파일 정보 전달
*/
control.on('uploadComplete', function (p) {
console.log('uploadComplete : ', p);
fn_callBackInnorix(p.files); // 파일 정보 DB isnert function
});
// 파일전송 컨트롤 로딩 완료
control.on('loadComplete', function (p) {
alert("1234");
// 다운로드 목록
downFileArr =
[{
printFileName: "INNORIX WP 브로셔.pdf",
fileSize: 1433885,
},
{
printFileName: "INNORIX WP Brochure.pdf",
fileSize: 1433885,
},
{
printFileName: "INNORIX WP パンフレット.pdf",
fileSize: 1433885,
}];
resetFileArr = downFileArr; // 다운로드 정보 초기화 정보 생성
resetFileArr = resetFileArr.slice(0); // 배열 깊은 복사
control.presetDownloadFiles(resetFileArr); // 다운로드 파일 추가
});
// 파일 삭제 이벤트
control.on('removeFiles', function (p) {
fn_deleteCallBackInnorix(p[0].dataIdx)
/* if (removeFlag == true) {
// 삭제된 파일정보 배열에 담기
for (var i = 0; i < p.length; i++ ) {
var fileObj = new Object();
if (p[i].transferType == "download")
{
fileObj.downloadUrl = p[i].downloadUrl;
fileObj.printFileName = p[i].printFileName;
fileObj.fileSize = p[i].fileSize;
delFileArr.push(fileObj);
deleteArr(downFileArr, "printFileName", p[i].printFileName);
}
}
}
removeFlag = true; */
});
});
/* innorix-4
이노릭스 업로드 시작
첨부파일이 있을 시 업로드 후 게시글 수정
첨부파일이 없을 시 바로 게시글 수정
*/
function innorixUpload(){
if(control.getUploadFiles().length > 0){
var postObj = new Object();
postObj.directory = directory;
control.setPostData(postObj);
control.upload(); // 업로드 시작
}else{
$("button[type='submit']").click();
}
}
/* innorix-6
게시글 등록 처리
첨부파일 정보 DB 등록 및 게시글 등록 처리
*/
function fn_callBackInnorix(data){
$("input[name='innorixFileListVO']").val(JSON.stringify(data));
$("button[type='submit']").click();
}
function fn_deleteCallBackInnorix(dataIdx){
var deleteFileData = $("#deleteFileDataId").val();
if(deleteFileData != ""){
deleteFileData = deleteFileData+","+dataIdx
}else{
deleteFileData = dataIdx
}
$("#deleteFileDataId").val(deleteFileData);
}
function goList(){
$("#paramFrm").submit();
}