/**
   * 부서업무 정보를 수정한다.
   *
   * @param DeptJob
   * @return String
   * @param deptJob
   */
  @RequestMapping("/cop/smt/djm/updateDeptJob.do")
  public String updateDeptJob(
      final MultipartHttpServletRequest multiRequest,
      Map commandMap,
      @ModelAttribute("deptJobVO") DeptJobVO deptJobVO,
      BindingResult bindingResult,
      ModelMap model)
      throws Exception {
    LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
    Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();

    beanValidator.validate(deptJobVO, bindingResult);
    if (bindingResult.hasErrors()) {
      DeptJob deptJob = deptJobService.selectDeptJob(deptJobVO);
      model.addAttribute("deptJob", deptJob);
      return "egovframework/com/cop/smt/djm/EgovDeptJobUpdt";
    }

    if (isAuthenticated) {
      /* *****************************************************************
           	// 첨부파일 관련 ID 생성 start....
      ****************************************************************** */
      String _atchFileId = deptJobVO.getAtchFileId();

      final Map<String, MultipartFile> files = multiRequest.getFileMap();

      if (!files.isEmpty()) {
        String atchFileAt =
            commandMap.get("atchFileAt") == null ? "" : (String) commandMap.get("atchFileAt");
        if ("N".equals(atchFileAt)) {
          List<FileVO> _result = fileUtil.parseFileInf(files, "DSCH_", 0, _atchFileId, "");
          _atchFileId = fileMngService.insertFileInfs(_result);

          // 첨부파일 ID 셋팅
          deptJobVO.setAtchFileId(_atchFileId); // 첨부파일 ID

        } else {
          FileVO fvo = new FileVO();
          fvo.setAtchFileId(_atchFileId);
          int _cnt = fileMngService.getMaxFileSN(fvo);
          List<FileVO> _result = fileUtil.parseFileInf(files, "DSCH_", _cnt, _atchFileId, "");
          fileMngService.updateFileInfs(_result);
        }
      }

      deptJobVO.setLastUpdusrId(user.getUniqId());
      deptJobService.updateDeptJob(deptJobVO);
    }

    return "forward:/cop/smt/djm/selectDeptJobList.do";
  }
  /**
   * 부서업무 정보를 삭제한다.
   *
   * @param DeptJob
   * @return String
   * @param deptJob
   */
  @RequestMapping("/cop/smt/djm/deleteDeptJob.do")
  public String deleteDeptJob(@ModelAttribute("deptJobVO") DeptJob deptJob, ModelMap model)
      throws Exception {
    // 0. Spring Security 사용자권한 처리
    Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
    if (!isAuthenticated) {
      model.addAttribute("message", egovMessageSource.getMessage("fail.common.login"));
      return "egovframework/com/uat/uia/EgovLoginUsr";
    }

    // 첨부파일 삭제를 위한 ID 생성 start....
    String _atchFileId = deptJob.getAtchFileId();

    // 첨부파일을 삭제하기 위한  Vo
    FileVO fvo = new FileVO();
    fvo.setAtchFileId(_atchFileId);

    fileMngService.deleteAllFileInf(fvo);
    // 첨부파일 삭제 End.............

    deptJobService.deleteDeptJob(deptJob);
    return "forward:/cop/smt/djm/selectDeptJobList.do";
  }