단속사진 순서 변경 기능 추가

main
이범준 10 months ago
parent c905a5bf6c
commit a554f0bf74

@ -8,8 +8,11 @@ import java.io.StringWriter;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -39,9 +42,16 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import cokr.xit.base.file.FileInfo;
import cokr.xit.base.file.FileInfo.Relation;
import cokr.xit.base.file.dao.FileMapper; import cokr.xit.base.file.dao.FileMapper;
import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.file.service.FileQuery;
import cokr.xit.base.file.service.bean.FileBean; import cokr.xit.base.file.service.bean.FileBean;
import cokr.xit.base.file.web.FileInfoFactory;
import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.crdn.dao.CrdnInfoMapper;
import cokr.xit.fims.crdn.service.CrdnService;
import cokr.xit.fims.sprt.Sprt;
import cokr.xit.fims.sprt.service.bean.MediaBean; import cokr.xit.fims.sprt.service.bean.MediaBean;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
@ -50,15 +60,26 @@ public class FileController extends cokr.xit.base.file.web.FileController {
@Resource(name = "fileMapper") @Resource(name = "fileMapper")
private FileMapper fileMapper; private FileMapper fileMapper;
@Resource(name = "crdnInfoMapper")
private CrdnInfoMapper crdnInfoMapper;
@Resource(name="fileBean") @Resource(name="fileBean")
private FileBean fileBean; private FileBean fileBean;
@Resource(name="mediaBean") @Resource(name="mediaBean")
private MediaBean mediaBean; private MediaBean mediaBean;
@Resource(name="crdnService")
private CrdnService crdnService;
@Override @Override
public ModelAndView getFileList(FileQuery req) { public ModelAndView getFileList(FileQuery req) {
ModelAndView mav = new ModelAndView("jsonView"); ModelAndView mav = new ModelAndView("jsonView");
String infoType = ifEmpty(req.getInfoType(), () -> "");
boolean singleKey = (req.getInfoKeys() != null && req.getInfoKeys().length == 1);
//파일 목록
List<DataObject> fileInfoList = fileService().getFileList(req); List<DataObject> fileInfoList = fileService().getFileList(req);
for(DataObject fileInfo : fileInfoList) { for(DataObject fileInfo : fileInfoList) {
List<DataObject> mosaicInfos = mediaBean.getMosaicList(fileInfo.string("FILE_ID")); List<DataObject> mosaicInfos = mediaBean.getMosaicList(fileInfo.string("FILE_ID"));
@ -80,10 +101,181 @@ public class FileController extends cokr.xit.base.file.web.FileController {
} }
} }
mav = setCollectionInfo(mav,fileInfoList,"file"); mav = setCollectionInfo(mav, fileInfoList, "file");
//민원 동영상파일 첨부 여부
String cvlcptVideoExistYn = "N";
if(infoType.equals(Crdn.INF_TYPE) && singleKey) {
DataObject dataObject = crdnInfoMapper.selectCrdnInfo(req.getInfoKeys()[0]);
String linkTblNm = dataObject.string("LINK_TBL_NM");
if(!linkTblNm.equals("")) { //민원연계자료
FileQuery cvlcptFileQuery = new FileQuery();
if(linkTblNm.equals("TB_ESB_INTERFACE")) {
cvlcptFileQuery.setInfoType("010");
} else if(linkTblNm.equals("TB_SAEOL")) {
cvlcptFileQuery.setInfoType("020");
} else {
throw new RuntimeException("파일 조회 중 오류가 발생하였습니다.");
}
cvlcptFileQuery.setInfoKeys(dataObject.string("LINK_ID"));
List<DataObject> linkFileList = fileBean.getFileList(cvlcptFileQuery);
if(linkFileList != null && !linkFileList.isEmpty()) {
for(int i=0; i < linkFileList.size(); i++) {
String mimeType = linkFileList.get(i).string("MIME_TYPE");
if(Arrays.asList(Sprt.VIDEO_MIME_TYPE).contains(mimeType)) {
cvlcptVideoExistYn = "Y";
}
}
}
}
}
mav.addObject("cvlcptVideoExistYn", cvlcptVideoExistYn);
return mav; return mav;
} }
@PostMapping(name= "단속 사진 추가", value = "/insertCrdnImageFile.do")
public ModelAndView insertCrdnImageFile(String crdnId, int atchFileCnt, MultipartFile[] newFileList) {
boolean saved = false;
String retMessage = "[F] ";
if(newFileList == null || newFileList.length == 0 || newFileList[0] == null || newFileList[0].isEmpty()) {
throw new RuntimeException("파일 업로드 오류");
}
Relation relation = new Relation().setInfoType(Crdn.INF_TYPE).setInfoKey(crdnId);
List<FileInfo> newFileInfoList = new FileInfoFactory().makeFileInfos(relation, newFileList);
List<Map<String, Object>> processList = new ArrayList<>();
int newFileSort = 999;
for(FileInfo newFileInfo : newFileInfoList) {
newFileInfo.setSortOrder(newFileSort++);
processList.add(Map.of("process", "insert", "obj", newFileInfo));
}
Crdn crdn = new Crdn();
crdn.setCrdnId(crdnId);
crdn.setAtchFileCnt(atchFileCnt);
retMessage = crdnService.changeCrdnImageFile(crdn, processList);
if (retMessage.contains("[S]")) {
saved = true;
} else {
saved = false;
}
return new ModelAndView("jsonView")
.addObject("saved", saved)
.addObject("retMessage", retMessage);
}
@PostMapping(name= "단속 사진 수정", value = "/updateCrdnImageFile.do")
public ModelAndView updateCrdnImageFile(String crdnId, int atchFileCnt,
String beforeKey, int beforeOrder, MultipartFile modifyFile) {
boolean saved = false;
String retMessage = "[F] ";
if(modifyFile == null || modifyFile.isEmpty()) {
throw new RuntimeException("파일 업로드 오류");
}
Relation relation = new Relation().setInfoType(Crdn.INF_TYPE).setInfoKey(crdnId);
FileInfo modifyFileInfo = new FileInfoFactory().make(relation, modifyFile);
modifyFileInfo.setSortOrder(beforeOrder);
List<Map<String, Object>> processList = new ArrayList<>();
processList.add(Map.of("process", "delete", "key", beforeKey));
processList.add(Map.of("process", "insert", "obj", modifyFileInfo));
Crdn crdn = new Crdn();
crdn.setCrdnId(crdnId);
crdn.setAtchFileCnt(atchFileCnt);
retMessage = crdnService.changeCrdnImageFile(crdn, processList);
if (retMessage.contains("[S]")) {
saved = true;
} else {
saved = false;
}
return new ModelAndView("jsonView")
.addObject("saved", saved)
.addObject("retMessage", retMessage);
}
@PostMapping(name= "단속 사진 삭제", value = "/deleteCrdnImageFile.do")
public ModelAndView deleteCrdnImageFile(String crdnId, int atchFileCnt, String[] deleteKeys) {
boolean saved = false;
String retMessage = "[F] ";
if(deleteKeys == null || deleteKeys.length == 0 || deleteKeys[0] == null || deleteKeys[0].isEmpty()) {
throw new RuntimeException("파일 삭제 오류");
}
List<Map<String, Object>> processList = new ArrayList<>();
for(String deleteKey : deleteKeys) {
processList.add(Map.of("process", "delete", "key", deleteKey));
}
Crdn crdn = new Crdn();
crdn.setCrdnId(crdnId);
crdn.setAtchFileCnt(atchFileCnt);
retMessage = crdnService.changeCrdnImageFile(crdn, processList);
if (retMessage.contains("[S]")) {
saved = true;
} else {
saved = false;
}
return new ModelAndView("jsonView")
.addObject("saved", saved)
.addObject("retMessage", retMessage);
}
@PostMapping(name= "단속 사진 순서 변경", value = "/changeOrderCrdnImageFile.do")
public ModelAndView changeOrderCrdnImageFile(String crdnId, int atchFileCnt, String[] orderedKeys) {
boolean saved = false;
String retMessage = "[F] ";
if(orderedKeys == null || orderedKeys.length == 0 || orderedKeys[0] == null || orderedKeys[0].isEmpty()) {
throw new RuntimeException("파일 순서 변경 오류");
}
List<Map<String, Object>> processList = new ArrayList<>();
for(String orderedKey : orderedKeys) {
processList.add(Map.of("process", "order", "key", orderedKey));
}
Crdn crdn = new Crdn();
crdn.setCrdnId(crdnId);
crdn.setAtchFileCnt(atchFileCnt);
retMessage = crdnService.changeCrdnImageFile(crdn, processList);
if (retMessage.contains("[S]")) {
saved = true;
} else {
saved = false;
}
return new ModelAndView("jsonView")
.addObject("saved", saved)
.addObject("retMessage", retMessage);
}
/** . /** .
* @return * @return
* @throws Exception * @throws Exception
@ -199,6 +391,7 @@ public class FileController extends cokr.xit.base.file.web.FileController {
} }
} }
@PostMapping(name = "처리 전 파일업로드", value = "/uploadBeforeProcess.do") @PostMapping(name = "처리 전 파일업로드", value = "/uploadBeforeProcess.do")
public ModelAndView uploadBeforeProcess(MultipartFile[] uploadFiles) { public ModelAndView uploadBeforeProcess(MultipartFile[] uploadFiles) {
ModelAndView mav = new ModelAndView("jsonView"); ModelAndView mav = new ModelAndView("jsonView");

@ -79,4 +79,6 @@ public interface CrdnService {
*/ */
boolean removeEquipmentLinkFile(String workPath, String fileName); boolean removeEquipmentLinkFile(String workPath, String fileName);
String changeCrdnImageFile(Crdn crdn, List<Map<String, Object>> processList);
} }

@ -33,6 +33,7 @@ import cokr.xit.fims.crdn.dao.CrdnTeamMapper;
import cokr.xit.fims.crdn.dao.CrdnUpdtMapper; import cokr.xit.fims.crdn.dao.CrdnUpdtMapper;
import cokr.xit.fims.excl.LevyExcl; import cokr.xit.fims.excl.LevyExcl;
import cokr.xit.fims.excl.service.bean.LevyExclBean; import cokr.xit.fims.excl.service.bean.LevyExclBean;
import cokr.xit.fims.sprt.dao.TotalInfoMapper;
import cokr.xit.foundation.AbstractComponent; import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.UserInfo; import cokr.xit.foundation.UserInfo;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
@ -70,6 +71,8 @@ public class CrdnBean extends AbstractComponent {
@Resource(name = "crdnTeamMapper") @Resource(name = "crdnTeamMapper")
private CrdnTeamMapper crdnTeamMapper; private CrdnTeamMapper crdnTeamMapper;
@Resource(name = "totalInfoMapper")
private TotalInfoMapper totalInfoMapper;
public boolean create(Map<String, Object> nonQueryRequest, Crdn crdn, List<FileInfo> fileInfoList) { public boolean create(Map<String, Object> nonQueryRequest, Crdn crdn, List<FileInfo> fileInfoList) {
if(fileInfoList != null && !fileInfoList.isEmpty()) { if(fileInfoList != null && !fileInfoList.isEmpty()) {

@ -10,6 +10,7 @@ import javax.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import cokr.xit.base.file.FileInfo; import cokr.xit.base.file.FileInfo;
import cokr.xit.base.file.service.FileQuery;
import cokr.xit.base.file.service.bean.FileBean; import cokr.xit.base.file.service.bean.FileBean;
import cokr.xit.fims.cmmn.service.bean.CrdnPayerHstryBean; import cokr.xit.fims.cmmn.service.bean.CrdnPayerHstryBean;
import cokr.xit.fims.cmmn.service.bean.CrdnSttsHstryBean; import cokr.xit.fims.cmmn.service.bean.CrdnSttsHstryBean;
@ -25,6 +26,8 @@ import cokr.xit.fims.crdn.service.CrdnService;
import cokr.xit.fims.cvlc.dao.CrdnCvlcptMapper; import cokr.xit.fims.cvlc.dao.CrdnCvlcptMapper;
import cokr.xit.fims.cvlc.service.bean.CrdnCvlcptMainBean; import cokr.xit.fims.cvlc.service.bean.CrdnCvlcptMainBean;
import cokr.xit.fims.excl.service.bean.LevyExclBean; import cokr.xit.fims.excl.service.bean.LevyExclBean;
import cokr.xit.fims.sprt.dao.TotalInfoMapper;
import cokr.xit.fims.sprt.service.bean.MediaBean;
import cokr.xit.foundation.component.AbstractServiceBean; import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
@ -49,9 +52,15 @@ public class CrdnServiceBean extends AbstractServiceBean implements CrdnService
@Resource(name="globalStngMapper") @Resource(name="globalStngMapper")
protected GlobalStngMapper globalStngMapper; protected GlobalStngMapper globalStngMapper;
@Resource(name="totalInfoMapper")
private TotalInfoMapper totalInfoMapper;
@Resource(name="fileBean") @Resource(name="fileBean")
private FileBean fileBean; private FileBean fileBean;
@Resource(name="mediaBean")
private MediaBean mediaBean;
@Resource(name="importBean") @Resource(name="importBean")
private ImportBean importBean; private ImportBean importBean;
@ -245,4 +254,60 @@ public class CrdnServiceBean extends AbstractServiceBean implements CrdnService
public boolean removeEquipmentLinkFile(String workPath, String fileName) { public boolean removeEquipmentLinkFile(String workPath, String fileName) {
return crdnBean.removeEquipmentLinkFile(workPath, fileName); return crdnBean.removeEquipmentLinkFile(workPath, fileName);
} }
@Override
public String changeCrdnImageFile(Crdn crdn, List<Map<String, Object>> processList) {
int createdCount = 0;
int deletedCount = 0;
boolean orderChange = false;
// 변수 선언
boolean rtnScs = false; // DB 처리 결과
String rtnMsg = "[F] "; // 처리 결과 메시지
int order = 0;
for(Map<String, Object> process : processList) {
if(process.get("process").equals("insert")) {
createdCount += fileBean.create(List.of((FileInfo)process.get("obj")));
}
if(process.get("process").equals("delete")) {
deletedCount += fileBean.deleteByIDs((String)process.get("key"));
}
if(process.get("process").equals("order")) {
mediaBean.reorder((String)process.get("key"), order++);
orderChange = true;
}
}
if(!orderChange) {
// 단속 ID로 파일(TB_FILE) 정보 조회
List<DataObject> infoFileList = fileBean.getFileList(new FileQuery().setInfoType(Crdn.INF_TYPE)
.setInfoKeys(crdn.getCrdnId())
.setOrderBy("SRT_ORD,FILE_ID"));
if (infoFileList != null && infoFileList.size() > 0) {
String[] fileIDs = new String[infoFileList.size()];
for (int iLoop = 0; iLoop < infoFileList.size(); iLoop++) {
fileIDs[iLoop] = infoFileList.get(iLoop).string("FILE_ID");
}
fileBean.reorder(fileIDs); // 첨부파일 재 정렬
}
}
crdn.setAtchFileCnt(crdn.getAtchFileCnt() + createdCount - deletedCount);
rtnScs = totalInfoMapper.updateCrdnAtchFileCnt(crdn);
if (!rtnScs) {
throw new RuntimeException("단속 첨부 파일 갯수 수정에 실패하였습니다.");
}
rtnMsg = "[S] 작업이 정상 처리 되었습니다.";
return rtnMsg;
}
} }

@ -3,7 +3,6 @@ package cokr.xit.fims.cvlc.service;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import cokr.xit.base.file.FileInfo;
import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.cvlc.CrdnCvlcpt; import cokr.xit.fims.cvlc.CrdnCvlcpt;
@ -51,10 +50,10 @@ public interface CrdnCvlcptService {
boolean sendBackCivilComplaintInfo(String crdnId); boolean sendBackCivilComplaintInfo(String crdnId);
/** . /** .
* @param nonQueryRequest , crdnCvlcpt , crdn , newFileInfoList * @param nonQueryRequest , crdnCvlcpt , crdn
* @return * @return
*/ */
boolean updateCvlcptProcessSection(Map<String, Object> nonQueryRequest, CrdnCvlcpt crdnCvlcpt, Crdn crdn, List<FileInfo> newFileInfoList); boolean updateCvlcptProcessSection(Map<String, Object> nonQueryRequest, CrdnCvlcpt crdnCvlcpt, Crdn crdn);
/** . /** .
* @param crdnId ID * @param crdnId ID

@ -16,7 +16,6 @@ import javax.annotation.Resource;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import cokr.xit.base.file.FileInfo;
import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.file.service.FileQuery;
import cokr.xit.base.file.service.bean.FileBean; import cokr.xit.base.file.service.bean.FileBean;
import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.cmmn.CmmnUtil;
@ -40,6 +39,7 @@ import cokr.xit.fims.cvlc.service.CrdnCvlcptService;
import cokr.xit.fims.excl.dao.LevyExclMapper; import cokr.xit.fims.excl.dao.LevyExclMapper;
import cokr.xit.fims.excl.service.bean.LevyExclBean; import cokr.xit.fims.excl.service.bean.LevyExclBean;
import cokr.xit.fims.sprt.Sprt; import cokr.xit.fims.sprt.Sprt;
import cokr.xit.fims.sprt.service.bean.MediaBean;
import cokr.xit.foundation.component.AbstractServiceBean; import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
import cokr.xit.interfaces.disabledparking.service.bean.DisabledParkingBean; import cokr.xit.interfaces.disabledparking.service.bean.DisabledParkingBean;
@ -54,6 +54,9 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv
@Resource(name="fileBean") @Resource(name="fileBean")
private FileBean fileBean; private FileBean fileBean;
@Resource(name="mediaBean")
private MediaBean mediaBean;
@Resource(name = "disabledParkingBean") @Resource(name = "disabledParkingBean")
private DisabledParkingBean disabledParkingBean; private DisabledParkingBean disabledParkingBean;
@ -271,13 +274,13 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv
FileQuery fileQuery = new FileQuery(); FileQuery fileQuery = new FileQuery();
fileQuery.setInfoType(Crdn.INF_TYPE); fileQuery.setInfoType(Crdn.INF_TYPE);
fileQuery.setInfoKeys(query.getCrdnId()); fileQuery.setInfoKeys(query.getCrdnId());
List<DataObject> fileList = fileBean.getFileList(fileQuery); List<DataObject> fileList = mediaBean.getFileAndMosaic(fileQuery);
if(fileList != null && !fileList.isEmpty()) { if(fileList != null && !fileList.isEmpty()) {
dataObject.set("fileList", fileList); dataObject.set("fileList", fileList);
} }
//동영상 존재 여부 확인 //동영상 존재 여부 확인
dataObject.set("videoExist", "N"); dataObject.set("VIDEO_EXIST_YN", "N");
String linkTblNm = dataObject.string("LINK_TBL_NM"); String linkTblNm = dataObject.string("LINK_TBL_NM");
if(!linkTblNm.equals("")) { if(!linkTblNm.equals("")) {
@ -295,7 +298,7 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv
for(int i=0; i < linkFileList.size(); i++) { for(int i=0; i < linkFileList.size(); i++) {
String mimeType = linkFileList.get(i).string("MIME_TYPE"); String mimeType = linkFileList.get(i).string("MIME_TYPE");
if(Arrays.asList(Sprt.VIDEO_MIME_TYPE).contains(mimeType)) { if(Arrays.asList(Sprt.VIDEO_MIME_TYPE).contains(mimeType)) {
dataObject.set("videoExist", "Y"); dataObject.set("VIDEO_EXIST_YN", "Y");
} }
} }
} }
@ -341,13 +344,13 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv
} }
@Override @Override
public boolean updateCvlcptProcessSection(Map<String, Object> nonQueryRequest, CrdnCvlcpt crdnCvlcpt, Crdn crdn, List<FileInfo> newFileInfoList) { public boolean updateCvlcptProcessSection(Map<String, Object> nonQueryRequest, CrdnCvlcpt crdnCvlcpt, Crdn crdn) {
boolean saved = false; boolean saved = false;
DataObject crdnInfo = crdnInfoMapper.selectCrdnInfo(crdn.getCrdnId()); DataObject crdnInfo = crdnInfoMapper.selectCrdnInfo(crdn.getCrdnId());
String acceptType = (String)ifEmpty(nonQueryRequest.get("acceptType"), ""); String acceptType = (String)ifEmpty(nonQueryRequest.get("acceptType"), "");
saved = crdnCvlcptSubBean.updateSubInfo(nonQueryRequest, crdn, newFileInfoList); saved = crdnCvlcptSubBean.updateSubInfo(nonQueryRequest, crdn);
if(!saved) { if(!saved) {
throw new RuntimeException("민원자료 저장 중 오류가 발생하였습니다."); throw new RuntimeException("민원자료 저장 중 오류가 발생하였습니다.");
} }

@ -152,37 +152,22 @@ public class CrdnCvlcptSubBean extends AbstractComponent {
} }
/** , . /** , .
* @param nonQueryRequest , crdn , newFileInfoList * @param nonQueryRequest , crdn
* @return * @return
* <ul><li> true</li> * <ul><li> true</li>
* <li> false</li> * <li> false</li>
* </ul> * </ul>
*/ */
public boolean updateSubInfo(Map<String, Object> nonQueryRequest, Crdn crdn, public boolean updateSubInfo(Map<String, Object> nonQueryRequest, Crdn crdn) {
List<FileInfo> newFileInfoList) {
boolean saved = false; boolean saved = false;
DataObject crdnInfo = crdnInfoMapper.selectCrdnInfo(crdn.getCrdnId()); DataObject crdnInfo = crdnInfoMapper.selectCrdnInfo(crdn.getCrdnId());
String acceptType = (String)ifEmpty(nonQueryRequest.get("acceptType"), ""); String acceptType = (String)ifEmpty(nonQueryRequest.get("acceptType"), "");
//첨수파일 수 변경
int fileInsertCnt = 0;
int fileDeleteCnt = 0;
if(newFileInfoList != null && !newFileInfoList.isEmpty()) {
fileInsertCnt = newFileInfoList.size();
}
String[] deleteFileKeyList = (String[])ifEmpty(nonQueryRequest.get("deleteFileKeyList"), new String[] {});
if(deleteFileKeyList.length > 0) {
fileDeleteCnt = deleteFileKeyList.length;
}
int changeFileCnt = (fileInsertCnt - fileDeleteCnt);
nonQueryRequest.put("changeFileCnt", changeFileCnt);
//금액 변경 //금액 변경
if(crdnInfo.string("TASK_SE_CD").equals("PVS") && "Y".equals(crdnInfo.string("OVTIME_PRTTN_YN"))) { if(crdnInfo.string("TASK_SE_CD").equals("PVS") && "Y".equals(crdnInfo.string("OVTIME_PRTTN_YN"))) {
nonQueryRequest.put("changeAmountYn","N"); nonQueryRequest.put("changeAmountYn","N");
@ -282,20 +267,6 @@ public class CrdnCvlcptSubBean extends AbstractComponent {
} }
} }
//파일 처리
if(newFileInfoList != null && !newFileInfoList.isEmpty()) {
int fileInsertEffected = fileBean.create(newFileInfoList);
if(fileInsertCnt != fileInsertEffected) {
throw new RuntimeException("단속민원답변 수정 중 파일 등록에 실패하였습니다.");
}
}
if(deleteFileKeyList.length > 0) {
int fileDeleteEffected = fileBean.remove((String[])nonQueryRequest.get("deleteFileKeyList"));
if(fileDeleteCnt != fileDeleteEffected) {
throw new RuntimeException("단속민원답변 수정 중 파일 삭제에 실패하였습니다.");
}
}
return true; return true;
} }

@ -4,21 +4,16 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Stream;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.CellStyle;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.base.code.CommonCode; import cokr.xit.base.code.CommonCode;
import cokr.xit.base.file.FileInfo;
import cokr.xit.base.file.FileInfo.Relation;
import cokr.xit.base.file.web.FileInfoFactory;
import cokr.xit.base.file.xls.XLSWriter; import cokr.xit.base.file.xls.XLSWriter;
import cokr.xit.base.file.xls.XLSWriter.CellDef; import cokr.xit.base.file.xls.XLSWriter.CellDef;
import cokr.xit.base.file.xls.XLSWriter.Styler; import cokr.xit.base.file.xls.XLSWriter.Styler;
@ -46,15 +41,15 @@ public class Cvlc01Controller extends ApplicationController {
public class METHOD_URL { public class METHOD_URL {
public static final String public static final String
civilComplaintReceiptDataMain = "/010/main.do", civilComplaintReceiptDataMain = "/010/main.do",
getCivilComplaintReceiptDataList = "/010/list.do", getCivilComplaintReceiptDataList = "/010/list.do",
removeCivilComplaint = "/010/remove.do", removeCivilComplaint = "/010/remove.do",
getCivilComplaintReceiptInitialDataInfo = "/020/info.do", getCivilComplaintReceiptInitialDataInfo = "/020/info.do",
saveCivilComplaintProcessSection = "/020/update.do", saveCivilComplaintProcessSection = "/020/update.do",
copyCivilComplaintInfo = "/020/create.do", copyCivilComplaintInfo = "/020/create.do",
sendBackCivilComplaintInfo = "/020/remove.do", sendBackCivilComplaintInfo = "/020/remove.do",
getCivilComplaintOriginalInfo = "/050/info.do", getCivilComplaintOriginalInfo = "/050/info.do",
makeFileFromHwpFormat = "/050/makeFileFromHwpFormat.do" makeFileFromHwpFormat = "/050/makeFileFromHwpFormat.do"
; ;
} }
@ -263,14 +258,14 @@ public class Cvlc01Controller extends ApplicationController {
} }
/** . /** .
* @param hReq , crdnCvlcpt , crdn , newFileList, modifyFileList * @param hReq , crdnCvlcpt , crdn
* @return jsonView * @return jsonView
* <pre><code> { * <pre><code> {
* "affected": * "affected":
* "saved": true, false * "saved": true, false
* }</code></pre> * }</code></pre>
*/ */
public ModelAndView saveCivilComplaintProcessSection(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn, MultipartFile[] newFileList, MultipartFile[] modifyFileList) { public ModelAndView saveCivilComplaintProcessSection(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn) {
ManagedUser currentUser = userMapper.getUser(currentUser().getAccount(), currentUser().getInstitute()); ManagedUser currentUser = userMapper.getUser(currentUser().getAccount(), currentUser().getInstitute());
String deptCd = currentUser.getDeptCode(); String deptCd = currentUser.getDeptCode();
@ -280,36 +275,7 @@ public class Cvlc01Controller extends ApplicationController {
boolean saved = false; boolean saved = false;
String[] deleteFileKeyList = hReq.getParameterValues("deleteFileKeyList");
String[] modifyFileKeyList = hReq.getParameterValues("modifyFileKeyList");
List<FileInfo> newFileInfoList = new ArrayList<FileInfo>();
if(newFileList != null || modifyFileList != null) {
Relation relation = new Relation();
relation.setInfoType(crdn.INF_TYPE);
relation.setInfoKey(crdn.getCrdnId());
if(newFileList != null) {
newFileInfoList = new FileInfoFactory().makeFileInfos(relation, newFileList);
}
if(modifyFileList != null) {
newFileInfoList.addAll(new FileInfoFactory().makeFileInfos(relation, modifyFileList));
if(deleteFileKeyList == null) {
deleteFileKeyList = modifyFileKeyList;
} else {
String[] arr1 = deleteFileKeyList;
String[] arr2 = modifyFileKeyList;
String[] sumArr = Stream.of(arr1, arr2).flatMap(Stream::of).toArray(String[]::new);
deleteFileKeyList = (sumArr);
}
}
}
Map<String, Object> nonQueryRequest = new HashMap<String, Object>(); Map<String, Object> nonQueryRequest = new HashMap<String, Object>();
nonQueryRequest.put("deleteFileKeyList", deleteFileKeyList);
String acceptYn = hReq.getParameter("acceptYn"); String acceptYn = hReq.getParameter("acceptYn");
if(ifEmpty(acceptYn, () -> "").equals("Y")) { if(ifEmpty(acceptYn, () -> "").equals("Y")) {
nonQueryRequest.put("acceptType", "accept"); nonQueryRequest.put("acceptType", "accept");
@ -321,7 +287,7 @@ public class Cvlc01Controller extends ApplicationController {
} }
} }
saved = crdnCvlcptService.updateCvlcptProcessSection(nonQueryRequest, crdnCvlcpt, crdn, newFileInfoList); saved = crdnCvlcptService.updateCvlcptProcessSection(nonQueryRequest, crdnCvlcpt, crdn);
return new ModelAndView("jsonView") return new ModelAndView("jsonView")

@ -1,6 +1,7 @@
package cokr.xit.fims.sprt.dao; package cokr.xit.fims.sprt.dao;
import java.util.List; import java.util.List;
import java.util.Map;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper; import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
@ -15,4 +16,7 @@ public interface MediaMapper {
*/ */
List<DataObject> selectMosaicList(String fileId); List<DataObject> selectMosaicList(String fileId);
int reorder(Map<String, Object> params);
} }

@ -3,7 +3,9 @@ package cokr.xit.fims.sprt.service.bean;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@ -69,6 +71,33 @@ public class MediaBean extends AbstractComponent {
return fileInfo; return fileInfo;
} }
public List<DataObject> getFileAndMosaic(FileQuery fileQuery){
List<DataObject> fileList = fileBean.getFileList(fileQuery);
for(DataObject fileInfo : fileList) {
List<DataObject> mosaicInfos = this.getMosaicList(fileInfo.string("FILE_ID"));
if(mosaicInfos != null) {
String mosaic = "";
for(int i=0; i < mosaicInfos.size(); i++) {
DataObject mosaicInfo = mosaicInfos.get(i);
if(i != 0) {
mosaic += "|";
}
mosaic += mosaicInfo.string("X_AXS")
+ "," + mosaicInfo.string("Y_AXS")
+ "," + mosaicInfo.string("MOSC_LT")
+ "," + mosaicInfo.string("MOSC_HG");
}
fileInfo.set("MOSAIC", mosaic);
} else {
fileInfo.set("MOSAIC", "");
}
}
return fileList;
}
/** .<br /> /** .<br />
* @param fileId ID * @param fileId ID
* @return * @return
@ -112,4 +141,11 @@ public class MediaBean extends AbstractComponent {
return result; return result;
} }
public int reorder(String fileId, int i) {
Map<String, Object> params = new HashMap<>();
params.put("fileId", fileId);
params.put("srtOrd", i);
return mediaMapper.reorder(params);
}
} }

@ -13,8 +13,8 @@ import cokr.xit.fims.crdn.ExmptnVhcl;
import cokr.xit.fims.crdn.Team; import cokr.xit.fims.crdn.Team;
import cokr.xit.fims.cvlc.CrdnCvlcpt; import cokr.xit.fims.cvlc.CrdnCvlcpt;
import cokr.xit.fims.excl.CrdnReReg; import cokr.xit.fims.excl.CrdnReReg;
import cokr.xit.fims.excl.LevyExclQuery;
import cokr.xit.fims.excl.LevyExcl; import cokr.xit.fims.excl.LevyExcl;
import cokr.xit.fims.excl.LevyExclQuery;
import cokr.xit.fims.excl.OpnnSbmsn; import cokr.xit.fims.excl.OpnnSbmsn;
import cokr.xit.fims.levy.LevyQuery; import cokr.xit.fims.levy.LevyQuery;
import cokr.xit.fims.levy.Rduct; import cokr.xit.fims.levy.Rduct;
@ -53,8 +53,8 @@ public class BpvController {
@Override @Override
@RequestMapping(name="전용차로과태료업무 민원 정보 수정", value=METHOD_URL.saveCivilComplaintProcessSection) @RequestMapping(name="전용차로과태료업무 민원 정보 수정", value=METHOD_URL.saveCivilComplaintProcessSection)
public ModelAndView saveCivilComplaintProcessSection(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn, MultipartFile[] newFileList, MultipartFile[] modifyFileList) { public ModelAndView saveCivilComplaintProcessSection(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn) {
return super.saveCivilComplaintProcessSection(hReq, crdnCvlcpt, crdn, newFileList, modifyFileList); return super.saveCivilComplaintProcessSection(hReq, crdnCvlcpt, crdn);
} }
@Override @Override

@ -14,8 +14,8 @@ import cokr.xit.fims.epst.EpostGdcc;
import cokr.xit.fims.epst.EpostQuery; import cokr.xit.fims.epst.EpostQuery;
import cokr.xit.fims.epst.EpostRcptReg; import cokr.xit.fims.epst.EpostRcptReg;
import cokr.xit.fims.excl.CrdnReReg; import cokr.xit.fims.excl.CrdnReReg;
import cokr.xit.fims.excl.LevyExclQuery;
import cokr.xit.fims.excl.LevyExcl; import cokr.xit.fims.excl.LevyExcl;
import cokr.xit.fims.excl.LevyExclQuery;
import cokr.xit.fims.excl.OpnnSbmsn; import cokr.xit.fims.excl.OpnnSbmsn;
import cokr.xit.fims.levy.LevyQuery; import cokr.xit.fims.levy.LevyQuery;
import cokr.xit.fims.levy.Rduct; import cokr.xit.fims.levy.Rduct;
@ -63,8 +63,8 @@ public class DpvController {
@Override @Override
@RequestMapping(name="장애인과태료업무 민원 정보 수정", value=METHOD_URL.saveCivilComplaintProcessSection) @RequestMapping(name="장애인과태료업무 민원 정보 수정", value=METHOD_URL.saveCivilComplaintProcessSection)
public ModelAndView saveCivilComplaintProcessSection(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn, MultipartFile[] newFileList, MultipartFile[] modifyFileList) { public ModelAndView saveCivilComplaintProcessSection(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn) {
return super.saveCivilComplaintProcessSection(hReq, crdnCvlcpt, crdn, newFileList, modifyFileList); return super.saveCivilComplaintProcessSection(hReq, crdnCvlcpt, crdn);
} }
@Override @Override

@ -11,8 +11,8 @@ import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.cvlc.CrdnCvlcpt; import cokr.xit.fims.cvlc.CrdnCvlcpt;
import cokr.xit.fims.excl.CrdnReReg; import cokr.xit.fims.excl.CrdnReReg;
import cokr.xit.fims.excl.LevyExclQuery;
import cokr.xit.fims.excl.LevyExcl; import cokr.xit.fims.excl.LevyExcl;
import cokr.xit.fims.excl.LevyExclQuery;
import cokr.xit.fims.excl.OpnnSbmsn; import cokr.xit.fims.excl.OpnnSbmsn;
import cokr.xit.fims.levy.LevyQuery; import cokr.xit.fims.levy.LevyQuery;
import cokr.xit.fims.levy.Rduct; import cokr.xit.fims.levy.Rduct;
@ -51,8 +51,8 @@ public class EcaController {
@Override @Override
@RequestMapping(name="전기차과태료업무 민원 정보 수정", value=METHOD_URL.saveCivilComplaintProcessSection) @RequestMapping(name="전기차과태료업무 민원 정보 수정", value=METHOD_URL.saveCivilComplaintProcessSection)
public ModelAndView saveCivilComplaintProcessSection(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn, MultipartFile[] newFileList, MultipartFile[] modifyFileList) { public ModelAndView saveCivilComplaintProcessSection(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn) {
return super.saveCivilComplaintProcessSection(hReq, crdnCvlcpt, crdn, newFileList, modifyFileList); return super.saveCivilComplaintProcessSection(hReq, crdnCvlcpt, crdn);
} }
@Override @Override

@ -12,8 +12,8 @@ import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.Team; import cokr.xit.fims.crdn.Team;
import cokr.xit.fims.cvlc.CrdnCvlcpt; import cokr.xit.fims.cvlc.CrdnCvlcpt;
import cokr.xit.fims.excl.CrdnReReg; import cokr.xit.fims.excl.CrdnReReg;
import cokr.xit.fims.excl.LevyExclQuery;
import cokr.xit.fims.excl.LevyExcl; import cokr.xit.fims.excl.LevyExcl;
import cokr.xit.fims.excl.LevyExclQuery;
import cokr.xit.fims.excl.OpnnSbmsn; import cokr.xit.fims.excl.OpnnSbmsn;
import cokr.xit.fims.levy.LevyQuery; import cokr.xit.fims.levy.LevyQuery;
import cokr.xit.fims.levy.Rduct; import cokr.xit.fims.levy.Rduct;
@ -52,8 +52,8 @@ public class PvsController {
@Override @Override
@RequestMapping(name="주정차과태료업무 민원 정보 수정", value=METHOD_URL.saveCivilComplaintProcessSection) @RequestMapping(name="주정차과태료업무 민원 정보 수정", value=METHOD_URL.saveCivilComplaintProcessSection)
public ModelAndView saveCivilComplaintProcessSection(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn, MultipartFile[] newFileList, MultipartFile[] modifyFileList) { public ModelAndView saveCivilComplaintProcessSection(HttpServletRequest hReq, CrdnCvlcpt crdnCvlcpt, Crdn crdn) {
return super.saveCivilComplaintProcessSection(hReq, crdnCvlcpt, crdn, newFileList, modifyFileList); return super.saveCivilComplaintProcessSection(hReq, crdnCvlcpt, crdn);
} }
@Override @Override

@ -577,7 +577,6 @@ SELECT CC.CVLCPT_LINK_ID /* 민원 연계 ID */
UPDATE TB_CRDN UPDATE TB_CRDN
SET MDFCN_DT = <include refid="utility.now" /> /* 수정일시 */ SET MDFCN_DT = <include refid="utility.now" /> /* 수정일시 */
, MDFR = #{currentUser.id} /* 수정자 */ , MDFR = #{currentUser.id} /* 수정자 */
, ATCH_FILE_CNT = ATCH_FILE_CNT + (#{changeFileCnt})
, RTPYR_ID = #{crdn.rtpyrId} /* 납부자 ID */ , RTPYR_ID = #{crdn.rtpyrId} /* 납부자 ID */
, CRDN_YMD = #{crdn.crdnYmd} /* 단속 일자 */ , CRDN_YMD = #{crdn.crdnYmd} /* 단속 일자 */
, CRDN_TM = #{crdn.crdnTm} /* 단속 시각 */ , CRDN_TM = #{crdn.crdnTm} /* 단속 시각 */

@ -15,4 +15,11 @@ SELECT MOSC_ID
AND DEL_YN = 'N' AND DEL_YN = 'N'
</select> </select>
<update id="reorder" parameterType="map">
/* 이미지파일 순서 변경 (mediaMapper.reorder) */
UPDATE TB_FILE
SET SRT_ORD = #{srtOrd}
WHERE FILE_ID = #{fileId}
</update>
</mapper> </mapper>

@ -368,79 +368,14 @@
</form> </form>
</div> </div>
<div class="card" style="width:500px;min-width:500px;">
<form id="frmFile--${pageName}" method="post" enctype="multipart/form-data"> <jsp:include page="/WEB-INF/jsp/fims/photo-main.jsp" />
<input type="file" id="newFileList--${pageName}" name="newFileList"
multiple accept="image/*" hidden />
<input type="file" id="modifyFileList--${pageName}" name="modifyFileList"
multiple accept="image/*" hidden />
</form>
<div class="col-md-12 d-flex justify-content-between">
<div class="fs-4 fw-bold">등록된 사진</div>
<div>
<button type="button" id="btnEditPhoto--${pageName}" class="btn btn-primary">
선택 사진 편집
</button>
<button type="button" id="btnDeleteExistPhoto--${pageName}" class="btn btn-primary">
선택 사진 삭제
</button>
</div>
</div>
<div id="displayForExist--${pageName}"
style="overflow-y: scroll;min-height: 40px;max-height: 340px;border-style: solid;">
</div>
<form id="frmUploadSet--${pageName}" method="post" enctype="multipart/form-data">
<input type="file" id="inputUploadSet--${pageName}" name="inputUploadSet"
multiple accept="image/*" hidden />
</form>
<div class="col-md-12 d-flex justify-content-between">
<div class="fs-4 fw-bold">추가한 사진</div>
<div>
<button type="button" id="btnAddFile--${pageName}" class="btn btn-primary">
사진 추가
</button>
<button type="button" id="btnOpenVideoCapture--${pageName}" class="btn btn-primary">
동영상 캡쳐
</button>
<button type="button" id="btnCancelAddFile--${pageName}" class="btn btn-primary">
선택 사진 삭제
</button>
</div>
</div>
<div id="displayForNew--${pageName}"
style="overflow-y: scroll;min-height: 40px;max-height: 340px;border-style: solid;">
</div>
</div>
</div> </div>
<label for="" id="refreshEnd--${pageName}" class="parentGrid" hidden></label> <label for="" id="refreshEnd--${pageName}" class="parentGrid" hidden></label>
<template id="imgRadioTemplate--${pageName}">
<label class='mx-1'>
<div style='display:relative;'>
<input type="radio" name="{name}" class="form-check-input" value="{value}" checked="" />
<img src="{src}" width='200' height='200' style='display:absolute;'
data-crdn-photo-id="{crdnPhotoId}"
data-mosaic="{mosaic}"
onload='fn_photoMask($("#photoMask--top").is(":checked"),this);' />
</div>
</label>
</template>
<template id="imgCheckboxTemplate--${pageName}">
<label class='mx-1'>
<div style='display:relative;'>
<input type="checkbox" name="{name}" class="form-check-input" value="{value}" />
<img src="{src}" width='200' height='200' style='display:absolute;'
data-crdn-photo-id="{crdnPhotoId}"
data-mosaic="{mosaic}"
onload='fn_photoMask($("#photoMask--top").is(":checked"),this);' />
</div>
</label>
</template>
<script> <script>
/************************************************************************** /**************************************************************************
* Global Variable * Global Variable
**************************************************************************/ **************************************************************************/
@ -468,19 +403,11 @@ $(document).ready(function(){
$P.provided = pageObject.childReq.pop(); $P.provided = pageObject.childReq.pop();
} }
$P.existFileArr = [];
$P.captureFileArr = [];
$P.localUploadArr = [];
$P.numberPlateArr = [];
/************************************************************************** /**************************************************************************
* DatasetControl, Dataset, FormFields * DatasetControl, Dataset, FormFields
**************************************************************************/ **************************************************************************/
$P.formFields = new FimsFormFields("#frmEdit--${pageName}"); $P.formFields = new FimsFormFields("#frmEdit--${pageName}");
$P.uploadSet = uploadSupport("#inputUploadSet--${pageName}");
$P.crdnControl = new DatasetControl({ $P.crdnControl = new DatasetControl({
urls : { urls : {
load : "", load : "",
@ -500,35 +427,7 @@ $(document).ready(function(){
$P.crdnControl.save = (info, accept) => { $P.crdnControl.save = (info, accept) => {
if (!info) return; if (!info) return;
var formData = new FormData(document.getElementById("frmFile--${pageName}")); var formData = new FormData(document.getElementById("frmEdit--${pageName}"));
for(var key in info) {
var value = info[key];
formData.append(key,value);
}
formData.delete("newFileList");
formData.delete("modifyFileList");
if($P.localUploadArr.length > 0){
$P.localUploadArr.forEach(item => formData.append("newFileList",item));
}
if($P.numberPlateArr.length > 0){
$P.numberPlateArr.forEach(item => formData.append("newFileList",item));
}
if($P.captureFileArr.length > 0){
$P.captureFileArr.forEach(item => formData.append("newFileList",item));
}
if($P.existFileArr.length > 0){
for(var i=0; i < $P.existFileArr.length; i++){
if($P.existFileArr[i].status == "delete"){
formData.append("deleteFileKeyList", $P.existFileArr[i].FILE_ID);
} else if($P.existFileArr[i].status == "modified"){
formData.append("modifyFileKeyList", $P.existFileArr[i].FILE_ID);
formData.append("modifyFileList", $P.existFileArr[i]);
}
}
}
if(accept){ if(accept){
formData.append("acceptYn", "Y"); formData.append("acceptYn", "Y");
@ -550,17 +449,7 @@ $(document).ready(function(){
$P.formFields.set(item); $P.formFields.set(item);
} }
$P.uploadSet.onDatasetChange = () => {
var files = $P.uploadSet.getDataset();
files.forEach(function(item){
item.mosaic = "";
$P.localUploadArr.push(item);
});
$P.fnDisplay(false);
};
$P.uploadSet.onRemove = () => { };
$P.crdnControl.onSave = (resp) => { $P.crdnControl.onSave = (resp) => {
if (resp.saved) { if (resp.saved) {
@ -594,204 +483,8 @@ $(document).ready(function(){
/************************************************************************** /**************************************************************************
* pageObject.function * pageObject.function
**************************************************************************/ **************************************************************************/
$P.fnMakeImgForExistFile = (fileArr) => {
var tagsTextArr = [];
for(var index = 0, j = 0; index < fileArr.length; index++){
var item = fileArr[index];
if(item.status == "delete"){
continue;
}
var template = document.getElementById("imgRadioTemplate--${pageName}").innerHTML;
template = template.replace(/{name}/gi, "existPhoto");
template = template.replace(/{value}/gi, item.FILE_ID);
template = template.replace(/{src}/gi, item.URL);
if(index != 0){
template = template.replace("checked=\"\"", "");
}
template = template.replace(/{crdnPhotoId}/gi, "exist"+item.FILE_ID+"${pageName}");
template = template.replace(/{mosaic}/gi, item.MOSAIC);
tagsTextArr.push(template);
if(j % 2 == 1){
tagsTextArr.push("<br />");
}
j++;
}
return tagsTextArr.join("");
}
$P.fnMakeImgForNewFile = (fileArr) => {
var tagsTextArr = [];
for(var index = 0; index < fileArr.length; index++){
var item = fileArr[index];
var template = document.getElementById("imgCheckboxTemplate--${pageName}").innerHTML;
template = template.replace(/{name}/gi, "newPhoto");
template = template.replace(/{value}/gi, item.id);
template = template.replace(/{src}/gi, item.url);
template = template.replace(/{crdnPhotoId}/gi, "new"+item.id+"${pageName}");
template = template.replace(/{mosaic}/gi, item.mosaic);
tagsTextArr.push(template);
if(index % 2 == 1){
tagsTextArr.push("<br />");
}
}
return tagsTextArr.join("");
}
$P.fnDisplay = (isExist) => {
if(isExist){
var displayArea = document.querySelector("#displayForExist--${pageName}");
var tagsText = $P.fnMakeImgForExistFile($P.existFileArr);
if(tagsText == ""){
displayArea.innerHTML = "등록된 사진이 없습니다.";
$("#btnEditPhoto--cvlc01020-info").hide();
} else {
displayArea.innerHTML = tagsText;
$("#btnEditPhoto--cvlc01020-info").show();
}
} else {
var displayArea = document.querySelector("#displayForNew--${pageName}");
var concatArr = $P.localUploadArr.concat($P.numberPlateArr).concat($P.captureFileArr);
var tagsText = $P.fnMakeImgForNewFile(concatArr);
displayArea.innerHTML = tagsText;
}
};
$P.fnReset = () => {
var crdnId = $("#crdnId--${pageName}").val();
$P.fnGo(crdnId);
}
$P.fnAccept = () => {
if(!customValidate($("#frmEdit--${pageName} input"))) return;
var vhrno = document.getElementById("vhrno--${pageName}");
var rtpyrNm = document.getElementById("rtpyrNm--${pageName}");
if(vhrno.value == ""){
dialog.alert({
content:"수용 처리를 하기 위해선 차량번호가 입력되어야 합니다.",
init : function() { focusClose(); },
onClose:function(){vhrno.focus();}
});
return;
}
if(rtpyrNm.value == ""){
dialog.alert({
content:"수용 처리를 하기 위해선 소유주정보가 입력되어야 합니다.",
init : function() { focusClose(); },
onClose:function(){rtpyrNm.focus();}
});
return;
}
if(confirm("현재 단속 정보를 저장하시겠습니까?")){
$P.crdnControl.save($P.formFields.get(), true);
}
};
$P.fnSendBack = () => {
if(!confirm("반송 처리 하시겠습니까?")){
return;
}
var crdnId = $("#crdnId--${pageName}").val();
ajax.post({
url : $P.crdnControl.urls.remove,
data : { crdnId : crdnId },
success : resp => {
if(resp.saved){
var message = "민원회수 요청이 등록되었습니다.\n"
+"30~60분 사이에 서버에서 민원시스템으로 전송이 진행되니 이후에 민원시스템에서 확인하시기 바랍니다.";
dialog.alert({
content : message,
init : function() { focusClose(); }
});
var crdnId = $("#crdnId--${pageName}").val();
var cursorKey = "";
var nextKey = $P.provided.getNextKey(crdnId);
if(nextKey != ""){
cursorKey = nextKey;
} else {
var prevKey = $P.provided.getPrevKey(crdnId);
if(prevKey != ""){
cursorKey = prevKey;
}
}
$("#refreshEnd--${pageName}").attr("data-cursor-key", cursorKey);
$P.provided.refreshList();
}
}
});
}
$P.videoCallback = (snapshots) => {
snapshots.forEach(function(canvas, index, array){
canvas.toBlob(function(blob){
var identify = new Date().getTime()+ "-" + index;
var file = new File([blob], "capture-"+identify+".png", {type: "image/png"});
file.id = "file-" + identify;
file.url = (window.URL || window.webkitURL).createObjectURL(file);
file.mosaic = "";
$P.captureFileArr.push(file);
if(index === array.length - 1){
$P.fnDisplay(false);
}
});
});
}
$P.editPhotoCallback = (modifiedFile, originalFileInfo, isNumberPlate) => {
modifiedFile.id = "file-" + new Date().getTime() + "-" + "0";
modifiedFile.url = (window.URL || window.webkitURL).createObjectURL(modifiedFile);
if(isNumberPlate){
modifiedFile.mosaic = "";
$P.numberPlateArr.push(modifiedFile);
$P.fnDisplay(false);
} else {
$P.existFileArr.forEach(function(item,index){
if(item.FILE_ID == originalFileInfo.FILE_ID){
modifiedFile.URL = modifiedFile.url;
modifiedFile.FILE_ID = originalFileInfo.FILE_ID;
modifiedFile.status = "modified";
modifiedFile.MOSAIC = originalFileInfo.MOSAIC;
$P.existFileArr.splice(index, 1, modifiedFile);
};
});
$P.fnDisplay(true);
}
}
$P.openLevyExclPop = (levyExclSeCd) => { $P.openLevyExclPop = (levyExclSeCd) => {
if(levyExclSeCd == "2"){ if(levyExclSeCd == "2"){
@ -832,8 +525,7 @@ $(document).ready(function(){
} }
}); });
}; };
$P.exclSaveCallback = function(exclInfo){ $P.exclSaveCallback = function(exclInfo){
var mergeInfo = $P.formFields.get(); var mergeInfo = $P.formFields.get();
@ -879,26 +571,13 @@ $(document).ready(function(){
$("#countStauts--${pageName}").val(cs); $("#countStauts--${pageName}").val(cs);
$P.provided.selectRow(crdnId); $P.provided.selectRow(crdnId);
if(crdnInfo.videoExist == "N"){
$("#btnOpenVideoCapture--${pageName}").hide(); var existVideo = false;
} else { if(crdnInfo.VIDEO_EXIST_YN == "Y"){
$("#btnOpenVideoCapture--${pageName}").show(); existVideo = true;
} }
initPhotoMain("${pageName}", crdnInfo.fileList, existVideo);
$P.existFileArr = [];
if(crdnInfo.fileList){
crdnInfo.fileList.forEach(function(item){
item.status = "";
$P.existFileArr.push(item);
});
}
$P.fnDisplay(true);
$P.captureFileArr = [];
$P.localUploadArr = [];
$P.numberPlateArr = [];
$("#inputUploadSet--${pageName}")[0].value = "";
$P.fnDisplay(false);
} }
}); });
} }
@ -1050,7 +729,88 @@ $(document).ready(function(){
}); });
} }
$P.fnReset = () => {
var crdnId = $("#crdnId--${pageName}").val();
$P.fnGo(crdnId);
}
$P.fnAccept = () => {
if(!customValidate($("#frmEdit--${pageName} input"))) return;
var vhrno = document.getElementById("vhrno--${pageName}");
var rtpyrNm = document.getElementById("rtpyrNm--${pageName}");
if(vhrno.value == ""){
dialog.alert({
content:"수용 처리를 하기 위해선 차량번호가 입력되어야 합니다.",
init : function() { focusClose(); },
onClose:function(){vhrno.focus();}
});
return;
}
if(rtpyrNm.value == ""){
dialog.alert({
content:"수용 처리를 하기 위해선 소유주정보가 입력되어야 합니다.",
init : function() { focusClose(); },
onClose:function(){rtpyrNm.focus();}
});
return;
}
if(confirm("현재 단속 정보를 저장하시겠습니까?")){
$P.crdnControl.save($P.formFields.get(), true);
}
};
$P.fnSendBack = () => {
if(!confirm("반송 처리 하시겠습니까?")){
return;
}
var crdnId = $("#crdnId--${pageName}").val();
ajax.post({
url : $P.crdnControl.urls.remove,
data : { crdnId : crdnId },
success : resp => {
if(resp.saved){
var message = "민원회수 요청이 등록되었습니다.\n"
+"30~60분 사이에 서버에서 민원시스템으로 전송이 진행되니 이후에 민원시스템에서 확인하시기 바랍니다.";
dialog.alert({
content : message,
init : function() { focusClose(); }
});
var crdnId = $("#crdnId--${pageName}").val();
var cursorKey = "";
var nextKey = $P.provided.getNextKey(crdnId);
if(nextKey != ""){
cursorKey = nextKey;
} else {
var prevKey = $P.provided.getPrevKey(crdnId);
if(prevKey != ""){
cursorKey = prevKey;
}
}
$("#refreshEnd--${pageName}").attr("data-cursor-key", cursorKey);
$P.provided.refreshList();
}
}
});
}
/************************************************************************** /**************************************************************************
* 초기화(업무별 입력항목) * 초기화(업무별 입력항목)
**************************************************************************/ **************************************************************************/
@ -1080,69 +840,7 @@ $(document).ready(function(){
//납부자 등록, 수정 //납부자 등록, 수정
$("#btnPopPayer--${pageName}").on("click", () => $P.fnPopPayer()); $("#btnPopPayer--${pageName}").on("click", () => $P.fnPopPayer());
//파일처리 버튼
$("#btnAddFile--${pageName}").on('click', () => { $("#inputUploadSet--${pageName}").trigger("click"); });
$("#btnOpenVideoCapture--${pageName}").on('click', () => {
var crdnId = $("#crdnId--${pageName}").val();
window.open(wctx.url("/sprt/sprt03/010/main.do?openerPageName=${pageName}&crdnId="+crdnId)
,"newVideoCapture"
,"width=1800,height=950"
);
});
$("#btnEditPhoto--${pageName}").on('click', () => {
var checked = $("#displayForExist--${pageName}").find("[name='existPhoto']:checked");
if(checked.length < 1){
alert("선택된 사진이 없습니다.");
return;
}
var fileId = checked.val();
window.open(wctx.url("/sprt/sprt03/020/main.do?openerPageName=${pageName}&fileId="+fileId)
,"editPhoto"
,"width=1400,height=750"
);
});
$("#btnDeleteExistPhoto--${pageName}").on('click', () => {
var checked = $("#displayForExist--${pageName}").find("[name='existPhoto']:checked");
if(checked.length < 1){
alert("선택된 사진이 없습니다.");
return;
}
var target = checked[0].value;
$P.existFileArr.forEach(function(item){
if(item.FILE_ID == target){
item.status = "delete";
}
});
$P.fnDisplay(true);
});
$("#btnCancelAddFile--${pageName}").on('click', () => {
var checked = $("#displayForNew--${pageName}").find("[name='newPhoto']:checked");
if(checked.length < 1){
alert("선택된 사진이 없습니다.");
return;
}
var checkedArr = [];
for(var i=0; i < checked.length; i++){
checkedArr.push(checked[i].value);
}
$P.captureFileArr = $P.captureFileArr.filter(item => checkedArr.indexOf(item.id) == -1);
$P.localUploadArr = $P.localUploadArr.filter(item => checkedArr.indexOf(item.id) == -1);
$P.numberPlateArr = $P.numberPlateArr.filter(item => checkedArr.indexOf(item.id) == -1);
$P.fnDisplay(false);
});
//차적조회 //차적조회
$("#vhrno--${pageName}").on("keyup",function(e){ $("#vhrno--${pageName}").on("keyup",function(e){
@ -1315,21 +1013,17 @@ $(document).ready(function(){
var cs = $P.provided.getCountStatus($("#crdnId--${pageName}").val()); var cs = $P.provided.getCountStatus($("#crdnId--${pageName}").val());
$("#countStauts--${pageName}").val(cs); $("#countStauts--${pageName}").val(cs);
if(crdnInfo.videoExist == "N"){
$("#btnOpenVideoCapture--${pageName}").hide(); //사진영역 설정
} else { settingPhotoMain("${pageName}", "crdnId--${pageName}");
$("#btnOpenVideoCapture--${pageName}").show();
} //사진영역 초기화
var existVideo = false;
if(crdnInfo.fileList){ if(crdnInfo.VIDEO_EXIST_YN == "Y"){
crdnInfo.fileList.forEach(function(item){ existVideo = true;
item.status = "";
$P.existFileArr.push(item);
});
} }
initPhotoMain("${pageName}", crdnInfo.fileList, existVideo);
$P.fnDisplay(true);
}); });
</script> </script>

@ -0,0 +1,58 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<div class="card" style="width:550px;min-width:550px;">
<form id="frmFile--${pageName}" method="post" enctype="multipart/form-data">
<input type="file" id="newFileList--${pageName}" name="newFileList"
multiple accept="image/*" hidden />
<input type="file" id="modifyFile--${pageName}" name="modifyFile"
multiple accept="image/*" hidden />
</form>
<div class="fs-4 fw-bold d-block">등록된 사진</div>
<div class="col-md-12 d-flex justify-content-between">
<div class="my-1">
<button type="button" id="btnOpenVideoCapture--${pageName}" class="btn btn-primary">
동영상 캡쳐
</button>
<button type="button" id="btnAddFile--${pageName}" class="btn btn-primary">
사진 추가
</button>
<button type="button" id="btnEditPhoto--${pageName}" class="btn btn-primary">
선택 사진 편집
</button>
<button type="button" id="btnDeleteExistPhoto--${pageName}" class="btn btn-primary">
선택 사진 삭제
</button>
</div>
</div>
<div id="displayForExist--${pageName}"
style="border-style: solid;">
<ul id="dragAndDrop--${pageName}"
style="display:flex;flex-wrap:wrap;overflow-y: scroll;min-height: 40px;max-height: 650px;">
</ul>
</div>
<form id="frmUploadSet--${pageName}" method="post" enctype="multipart/form-data">
<input type="file" id="inputUploadSet--${pageName}" name="inputUploadSet"
multiple accept="image/*" hidden />
</form>
</div>
<template id="imgRadioTemplate--${pageName}">
<li style="display:flex">
<label class='mx-1'>
<div style='display:relative;'>
<input type="radio" name="{name}" class="form-check-input" value="{value}" checked="" />
<img src="{src}" width='200' height='200' style='display:absolute;'
data-crdn-photo-id="{crdnPhotoId}"
data-mosaic="{mosaic}"
onload='fn_photoMask($("#photoMask--top").is(":checked"),this);' />
</div>
</label>
</li>
</template>
<script>
LoadScript("photoMainJspScript","/resources/js/fims/photo-main.js");
</script>

@ -66,6 +66,30 @@
pageObject.childReq = []; pageObject.childReq = [];
pageObject.parentRes = []; pageObject.parentRes = [];
function LoadScript(scriptId, scriptPath){
if(document.getElementById(scriptId) == null){
$("body").append("<script id='"+scriptId+"' src='"+"<c:url value='' />"+scriptPath+"' />");
}
}
function FindObject(objectName, pageName){
if(pageName == undefined || pageName == null || pageName == ""){
return window[objectName];
} else {
return pageObject[pageName][objectName];
}
}
function RegistObject(objectName, def, pageName){
if(pageName == undefined || pageName == null || pageName == ""){
window[objectName] = def;
return window[objectName];
} else {
pageObject[pageName][objectName] = def;
return pageObject[pageName][objectName];
}
}
var ALL_TASK = {}; var ALL_TASK = {};
var MY_INFO = {}; var MY_INFO = {};
var PARAM_TASK = "${param.taskSeCd}"; var PARAM_TASK = "${param.taskSeCd}";

@ -0,0 +1,288 @@
function settingPhotoMain(pageName, crdnIdElementId){
var $P = pageObject[pageName];
$P.existFileArr = [];
$P.localUploadArr = [];
//드래그앤드롭
Sortable.create(document.getElementById("dragAndDrop--"+pageName), {
onEnd : function(evt){
if(evt.oldIndex != evt.newIndex){
$P.updateFileInfo("changeOrder");
}
}
});
//파일처리 버튼
//추가버튼
$("#btnAddFile--"+pageName).on('click', () => {
$("#inputUploadSet--"+pageName).trigger("click");
});
//동영상캡쳐버튼
$("#btnOpenVideoCapture--"+pageName).on('click', () => {
var crdnId = $("#"+crdnIdElementId).val();
window.open(wctx.url("/sprt/sprt03/010/main.do?openerPageName="+pageName+"&"+"crdnId="+crdnId)
,"newVideoCapture"
,"width=1800,height=950"
);
});
//편집버튼
$("#btnEditPhoto--"+pageName).on('click', () => {
var checked = $("#displayForExist--"+pageName).find("[name='existPhoto']:checked");
if(checked.length < 1){
alert("선택된 사진이 없습니다.");
return;
}
var fileId = checked.val();
window.open(wctx.url("/sprt/sprt03/020/main.do?openerPageName="+pageName+"&"+"fileId="+fileId)
,"editPhoto"
,"width=1400,height=750"
);
});
//삭제버튼
$("#btnDeleteExistPhoto--"+pageName).on('click', () => {
var checked = $("#displayForExist--"+pageName).find("[name='existPhoto']:checked");
if(checked.length < 1){
alert("선택된 사진이 없습니다.");
return;
}
var target = checked[0].value;
$P.existFileArr.forEach(function(item){
if(item.FILE_ID == target){
item.status = "delete";
}
});
$P.updateFileInfo("delete");
});
$P.uploadSet = uploadSupport("#inputUploadSet--"+pageName);
$P.uploadSet.onDatasetChange = () => {
var files = $P.uploadSet.getDataset();
if(files != null && files.length > 0){
files.forEach(function(item){
$P.localUploadArr.push(item);
});
$P.updateFileInfo("insert");
}
};
$P.uploadSet.onRemove = () => { };
//이미지 HTML태그 문자열 반환
$P.fnMakeImgForExistFile = (fileArr) => {
var tagsTextArr = [];
for(var index = 0, j = 0; index < fileArr.length; index++){
var item = fileArr[index];
if(item.status == "delete"){
continue;
}
var template = document.getElementById("imgRadioTemplate--" + pageName).innerHTML;
template = template.replace(/{name}/gi, "existPhoto");
template = template.replace(/{value}/gi, item.FILE_ID);
template = template.replace(/{src}/gi, item.URL);
if(index != 0){
template = template.replace("checked=\"\"", "");
}
template = template.replace(/{crdnPhotoId}/gi, "exist" + item.FILE_ID + pageName);
template = template.replace(/{mosaic}/gi, ifEmpty(item.MOSAIC,""));
tagsTextArr.push(template);
if(j % 2 == 1){
//tagsTextArr.push("<br />");
}
j++;
}
return tagsTextArr.join("");
}
//이미지 HTML 렌더링
$P.fnDisplay = () => {
var tagsText = $P.fnMakeImgForExistFile($P.existFileArr);
if(tagsText == ""){
document.querySelector("#dragAndDrop--"+pageName).innerHTML = "";
$("#btnEditPhoto--"+pageName).hide();
} else {
document.querySelector("#dragAndDrop--"+pageName).innerHTML = tagsText;
$("#btnEditPhoto--"+pageName).show();
}
};
//동영상캡쳐 콜백
$P.videoCallback = (snapshots) => {
snapshots.forEach(function(canvas, index, array){
canvas.toBlob(function(blob){
var identify = new Date().getTime()+ "-" + index;
var file = new File([blob], "capture-"+identify+".png", {type: "image/png"});
file.id = "file-" + identify;
file.url = (window.URL || window.webkitURL).createObjectURL(file);
file.mosaic = "";
$P.localUploadArr.push(file);
if(index === array.length - 1){
$P.updateFileInfo("insert");
}
});
});
}
//사진 편집 콜백
$P.editPhotoCallback = (modifiedFile, originalFileInfo, isNumberPlate) => {
modifiedFile.id = "file-" + new Date().getTime() + "-" + "0";
modifiedFile.url = (window.URL || window.webkitURL).createObjectURL(modifiedFile);
if(isNumberPlate){
modifiedFile.mosaic = "";
$P.localUploadArr.push(modifiedFile);
$P.updateFileInfo("insert");
} else {
$P.existFileArr.forEach(function(item,index){
if(item.FILE_ID == originalFileInfo.FILE_ID){
modifiedFile.URL = modifiedFile.url;
modifiedFile.FILE_ID = originalFileInfo.FILE_ID;
modifiedFile.SRT_ORD = originalFileInfo.SRT_ORD;
modifiedFile.status = "modified";
$P.existFileArr.splice(index, 1, modifiedFile);
};
});
$P.updateFileInfo("modifiy");
}
}
// 사진 저장
$P.updateFileInfo = (flag) => {
var formData = new FormData(document.getElementById("frmFile--"+pageName));
formData.append("crdnId", $("#"+crdnIdElementId).val());
formData.append("atchFileCnt", $P.existFileArr.length);
var fileProcessingURL = "";
if(flag == "insert"){
fileProcessingURL = wctx.url("file/insertCrdnImageFile.do");
formData.delete("newFileList");
if ($P.localUploadArr.length > 0) {
$P.localUploadArr.forEach(function(item){
formData.append("newFileList", item);
});
}
} else if(flag == "modifiy"){
fileProcessingURL = wctx.url("file/updateCrdnImageFile.do");
formData.delete("modifyFile");
if($P.existFileArr.length > 0) {
$P.existFileArr.forEach(function(item){
if(item.status == "modified"){
formData.append("beforeKey", item.FILE_ID);
formData.append("beforeOrder", item.SRT_ORD);
formData.append("modifyFile", item);
}
});
}
} else if(flag == "delete"){
fileProcessingURL = wctx.url("file/deleteCrdnImageFile.do");
if($P.existFileArr.length > 0) {
$P.existFileArr.forEach(function(item){
if(item.status == "delete"){
formData.append("deleteKeys", item.FILE_ID);
}
});
}
} else if(flag == "changeOrder"){
fileProcessingURL = wctx.url("file/changeOrderCrdnImageFile.do");
var inputs = $("#dragAndDrop--"+pageName).find("input[name='existPhoto']");
for(var i=0; i < inputs.length; i++){
formData.append("orderedKeys", inputs[i].value);
}
}
ajax.post({
url : fileProcessingURL,
data : formData, contentType : false, processData : false,
success : resp => {
if(resp.saved){
var crdnId = $("#"+crdnIdElementId).val();
ajax.post({
url : wctx.url("file/list.do"),
data : {
infoKeys : crdnId,
infoType : "100"
},
success : (resp) => {
var hasVideo = false;
if(resp.cvlcptVideoExistYn == "Y"){
hasVideo = true;
}
initPhotoMain(pageName, resp.fileList, hasVideo);
}
});
}
},
});
}
}
function initPhotoMain(pageName, fileList, existVideo){
var $P = pageObject[pageName];
//동영상캡쳐버튼
if(existVideo){
$("#btnOpenVideoCapture--"+pageName).show();
} else {
$("#btnOpenVideoCapture--"+pageName).hide();
}
$P.existFileArr = [];
if(fileList){
fileList.forEach(function(item){
item.status = "";
$P.existFileArr.push(item);
});
}
$P.localUploadArr = [];
$("#inputUploadSet--"+pageName)[0].value = "";
$P.fnDisplay();
}
Loading…
Cancel
Save