|
|
|
|
@ -141,12 +141,12 @@ public class Crdn05Controller extends ApplicationController {
|
|
|
|
|
*/
|
|
|
|
|
@Task
|
|
|
|
|
@RequestMapping(name="단속자료 파일 등록 화면", value=METHOD_URL.getFileRegistrationScreen)
|
|
|
|
|
public ModelAndView getFileRegistrationScreen(HttpServletRequest hReq) {
|
|
|
|
|
public ModelAndView getFileRegistrationScreen(HttpServletRequest hreq) {
|
|
|
|
|
Map<String, List<CommonCode>> commonCodes = getCodesOf("FIM054");
|
|
|
|
|
|
|
|
|
|
return new ModelAndView("fims/crdn/crdn05020-info")
|
|
|
|
|
.addObject("pageName", "crdn05020")
|
|
|
|
|
.addObject("taskSeCd", hReq.getParameter("taskSeCd"))
|
|
|
|
|
.addObject("taskSeCd", hreq.getParameter("taskSeCd"))
|
|
|
|
|
.addObject("FIM054List", commonCodes.get("FIM054"))
|
|
|
|
|
.addObject("TaskListForSgg", stngBean.filterTaskSectionCodeForSgg(commonCodes.get("FIM054")));
|
|
|
|
|
}
|
|
|
|
|
@ -157,9 +157,9 @@ public class Crdn05Controller extends ApplicationController {
|
|
|
|
|
*/
|
|
|
|
|
@Task
|
|
|
|
|
@RequestMapping(name="단속연계파일 가져오기(FTP)", value=METHOD_URL.importFileFromServer)
|
|
|
|
|
public ModelAndView importFileFromServer(HttpServletRequest hReq) {
|
|
|
|
|
public ModelAndView importFileFromServer(HttpServletRequest hreq) {
|
|
|
|
|
FimsUser currentUser = (FimsUser) currentUser().getUser();
|
|
|
|
|
List<LayoutDescriptor> layoutDescriptors = crdnStngService.getLinkFileLayoutMetadata(currentUser.getOrgID(), hReq.getParameter("taskSeCd"), currentUser().getInstitute(), currentUser.getDeptCode());
|
|
|
|
|
List<LayoutDescriptor> layoutDescriptors = crdnStngService.getLinkFileLayoutMetadata(currentUser.getOrgID(), hreq.getParameter("taskSeCd"), currentUser().getInstitute(), currentUser.getDeptCode());
|
|
|
|
|
ModelAndView mav = new ModelAndView("jsonView");
|
|
|
|
|
for(int i=0; i < layoutDescriptors.size(); i++) {
|
|
|
|
|
LayoutDescriptor layoutDescriptor = layoutDescriptors.get(i);
|
|
|
|
|
@ -198,11 +198,11 @@ public class Crdn05Controller extends ApplicationController {
|
|
|
|
|
*/
|
|
|
|
|
@Task
|
|
|
|
|
@RequestMapping(name="단속연계파일 가져오기(파일업로드)", value=METHOD_URL.importFileFromClient)
|
|
|
|
|
public ModelAndView importFileFromClient(HttpServletRequest hReq, MultipartFile[] uploadFiles) {
|
|
|
|
|
public ModelAndView importFileFromClient(HttpServletRequest hreq, MultipartFile[] uploadFiles) {
|
|
|
|
|
UserInfo currentUser = currentUser();
|
|
|
|
|
List<LayoutDescriptor> layoutDescriptors = crdnStngService.getLinkFileLayoutMetadata(
|
|
|
|
|
currentUser.getOrgID(),
|
|
|
|
|
hReq.getParameter("taskSeCd"),
|
|
|
|
|
hreq.getParameter("taskSeCd"),
|
|
|
|
|
currentUser.getInstitute(),
|
|
|
|
|
currentUser.getDeptCode()
|
|
|
|
|
);
|
|
|
|
|
@ -217,9 +217,9 @@ public class Crdn05Controller extends ApplicationController {
|
|
|
|
|
|
|
|
|
|
ModelAndView mav = new ModelAndView("jsonView");
|
|
|
|
|
try {
|
|
|
|
|
for(int j=0; j < uploadFiles.length; j++) {
|
|
|
|
|
File newFile = new File(workPath+File.separator+uploadFiles[j].getOriginalFilename());
|
|
|
|
|
uploadFiles[j].transferTo(newFile);
|
|
|
|
|
for (MultipartFile upload: uploadFiles) {
|
|
|
|
|
File newFile = new File(workPath+File.separator+upload.getOriginalFilename());
|
|
|
|
|
upload.transferTo(newFile);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return mav.addObject("saved", false);
|
|
|
|
|
@ -236,11 +236,11 @@ public class Crdn05Controller extends ApplicationController {
|
|
|
|
|
*/
|
|
|
|
|
@Task
|
|
|
|
|
@RequestMapping(name="장비업체 단속파일 목록 조회", value=METHOD_URL.getEquipmentFileInfoList)
|
|
|
|
|
public ModelAndView getEquipmentFileInfoList(HttpServletRequest hReq) {
|
|
|
|
|
public ModelAndView getEquipmentFileInfoList(HttpServletRequest hreq) {
|
|
|
|
|
UserInfo currentUser = currentUser();
|
|
|
|
|
List<LayoutDescriptor> layoutDescriptors = crdnStngService.getLinkFileLayoutMetadata(
|
|
|
|
|
currentUser.getOrgID(),
|
|
|
|
|
hReq.getParameter("taskSeCd"),
|
|
|
|
|
hreq.getParameter("taskSeCd"),
|
|
|
|
|
currentUser.getInstitute(),
|
|
|
|
|
currentUser.getDeptCode()
|
|
|
|
|
);
|
|
|
|
|
@ -250,9 +250,8 @@ public class Crdn05Controller extends ApplicationController {
|
|
|
|
|
int nextTempGroupSeq = 1;
|
|
|
|
|
List<DataObject> allParsedDataList = new ArrayList<DataObject>();
|
|
|
|
|
TaskProcessor taskProcessor = TaskProcessor.get();
|
|
|
|
|
Map<String, List<CommonCode>> codeInfo = getCodesOf("FIM007","FIM004","FIM005","FIM006","FIM005","FIM061");
|
|
|
|
|
for(int i = 0; i < layoutDescriptors.size(); i++) {
|
|
|
|
|
LayoutDescriptor layoutDescriptor = layoutDescriptors.get(i);
|
|
|
|
|
Map<String, List<CommonCode>> codeInfo = getCodesOf("FIM004","FIM005","FIM006","FIM007","FIM061");
|
|
|
|
|
for(LayoutDescriptor layoutDescriptor: layoutDescriptors) {
|
|
|
|
|
String workPath = layoutDescriptor.getLinkFileLocation();
|
|
|
|
|
ensureDir(workPath);
|
|
|
|
|
|
|
|
|
|
@ -284,7 +283,7 @@ public class Crdn05Controller extends ApplicationController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**단속 연계 파일을 삭제한다.
|
|
|
|
|
* @param hReq 삭제 요청
|
|
|
|
|
* @param hreq 삭제 요청
|
|
|
|
|
* @return jsonView
|
|
|
|
|
* <pre><code> {
|
|
|
|
|
* "saved": 등록되었으면 true, 그렇지 않으면 false
|
|
|
|
|
@ -292,11 +291,11 @@ public class Crdn05Controller extends ApplicationController {
|
|
|
|
|
*/
|
|
|
|
|
@Task
|
|
|
|
|
@RequestMapping(name="장비업체 단속파일 삭제", value=METHOD_URL.removeLinkFile)
|
|
|
|
|
public ModelAndView removeLinkFile(HttpServletRequest hReq) {
|
|
|
|
|
LayoutDescriptor info = crdnEqpmntBean.getLinkFileLayoutMetadata(hReq.getParameter("fileLayoutId"));
|
|
|
|
|
public ModelAndView removeLinkFile(HttpServletRequest hreq) {
|
|
|
|
|
LayoutDescriptor info = crdnEqpmntBean.getLinkFileLayoutMetadata(hreq.getParameter("fileLayoutId"));
|
|
|
|
|
|
|
|
|
|
String workPath = info.getLinkFileLocation();
|
|
|
|
|
String fileName = hReq.getParameter("fileName");
|
|
|
|
|
String fileName = hreq.getParameter("fileName");
|
|
|
|
|
String rtnMsg = crdnService.removeEquipmentLinkFile(workPath, fileName);
|
|
|
|
|
|
|
|
|
|
return new ModelAndView("jsonView")
|
|
|
|
|
@ -339,6 +338,58 @@ public class Crdn05Controller extends ApplicationController {
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(name="장비업체 단속파일로 단속자료 생성", value="/020/upload.do")
|
|
|
|
|
public ModelAndView createCrdnFromLinkFile(HttpServletRequest hreq, MultipartFile[] uploadFiles) {
|
|
|
|
|
UserInfo currentUser = currentUser();
|
|
|
|
|
String sggCd = currentUser.getOrgID(),
|
|
|
|
|
taskSeCd = hreq.getParameter("taskSeCd"),
|
|
|
|
|
instCd = currentUser.getInstitute(),
|
|
|
|
|
deptCode = currentUser.getDeptCode();
|
|
|
|
|
|
|
|
|
|
List<LayoutDescriptor> descriptors = crdnStngService.getLinkFileLayoutMetadata(sggCd, taskSeCd, instCd, deptCode);
|
|
|
|
|
if (isEmpty(descriptors))
|
|
|
|
|
throw new RuntimeException("연계파일 레이아웃 정보 조회에 실패하였습니다.");
|
|
|
|
|
|
|
|
|
|
int nextTempGroupSeq = 1;
|
|
|
|
|
TaskProcessor taskProcessor = TaskProcessor.get();
|
|
|
|
|
HashMap<String, String> processInfo = new HashMap<>();
|
|
|
|
|
processInfo.put("institute", currentUser().getInstitute());
|
|
|
|
|
processInfo.put("taskSeCd", taskSeCd);
|
|
|
|
|
Map<String, LayoutParser> parsers = Map.of(
|
|
|
|
|
"TXT", new AttachedTxtParser(),
|
|
|
|
|
"JPG", new OnlyImageParser(),
|
|
|
|
|
"BIN", new SingleFileParser()
|
|
|
|
|
);
|
|
|
|
|
Map<String, List<CommonCode>> codeInfo = getCodesOf("FIM004","FIM005","FIM006","FIM007","FIM061");
|
|
|
|
|
|
|
|
|
|
List<DataObject> allParsedDataList = new ArrayList<DataObject>();
|
|
|
|
|
for (LayoutDescriptor descriptor: descriptors) {
|
|
|
|
|
String workPath = crdnEqpmntBean.getLinkFileLayoutMetadata(descriptor.getFileLayoutId()).getLinkFileLocation();
|
|
|
|
|
processInfo.put("workPath", workPath);
|
|
|
|
|
LayoutParser parser = parsers.get(descriptor.getFileGroup());
|
|
|
|
|
parser.setTaskProcessor(taskProcessor);
|
|
|
|
|
parser.setTempGroupSeq(nextTempGroupSeq);
|
|
|
|
|
parser.addCommonCode(codeInfo);
|
|
|
|
|
parser.setDescriptor(descriptor);
|
|
|
|
|
|
|
|
|
|
allParsedDataList.addAll(parser.parse(workPath, List.of(uploadFiles)));
|
|
|
|
|
nextTempGroupSeq = parser.getTempGroupSeq();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HashMap<String, Object> resultMap = importService.createCrdnByEquipmentLinkFile(processInfo, allParsedDataList);
|
|
|
|
|
boolean saved = (boolean) resultMap.get("saved");
|
|
|
|
|
|
|
|
|
|
ModelAndView mav = new ModelAndView("jsonView")
|
|
|
|
|
.addObject("saved", saved);
|
|
|
|
|
if (!isEmpty(resultMap.get("alertMessage")))
|
|
|
|
|
mav.addObject("alertMessage", resultMap.get("alertMessage"));
|
|
|
|
|
|
|
|
|
|
if (!saved)
|
|
|
|
|
mav.addObject("failReason", ifEmpty(resultMap.get("failReason"), () -> "알 수 없는 오류"));
|
|
|
|
|
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**단속자료 수기 등록 팝업화면을 반환한다.
|
|
|
|
|
* @param
|
|
|
|
|
* @return fims/crdn/crdn05030-info
|
|
|
|
|
|