2022-09-11 06:30:20 +00:00
|
|
|
package com.dbnt.faisp.fpiMgt;
|
2022-09-05 09:02:09 +00:00
|
|
|
|
2022-09-11 06:30:20 +00:00
|
|
|
import com.dbnt.faisp.fpiMgt.monthPlan.service.MonthPlanService;
|
2022-09-05 09:02:09 +00:00
|
|
|
import com.dbnt.faisp.fpiMgt.monthPlan.model.BoardPlan;
|
|
|
|
|
import com.dbnt.faisp.userInfo.model.UserInfo;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
2022-09-06 09:10:03 +00:00
|
|
|
import org.springframework.web.bind.annotation.*;
|
2022-09-13 06:41:19 +00:00
|
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
2022-09-05 09:02:09 +00:00
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
2022-09-06 09:10:03 +00:00
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
2022-09-05 09:02:09 +00:00
|
|
|
@RestController
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
@RequestMapping("/fpiMgt")
|
|
|
|
|
public class FpiMgtController { // 외사경찰견문관리
|
|
|
|
|
private final MonthPlanService monthPlanService;
|
|
|
|
|
|
|
|
|
|
@GetMapping("/monthPlanPage")
|
|
|
|
|
public ModelAndView monthPlanPage(@AuthenticationPrincipal UserInfo loginUser, BoardPlan boardPlan){
|
|
|
|
|
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/monthPlan/monthPlan");
|
|
|
|
|
mav.addObject("loginUser", loginUser);
|
2022-09-08 05:28:20 +00:00
|
|
|
boardPlan.setWrtNm(loginUser.getUserNm());
|
2022-09-05 09:02:09 +00:00
|
|
|
boardPlan.setQueryInfo();
|
2022-09-08 05:28:20 +00:00
|
|
|
mav.addObject("planList", monthPlanService.selectBoardPlanList(boardPlan));
|
|
|
|
|
boardPlan.setContentCnt(monthPlanService.selectBoardPlanListCnt(boardPlan));
|
2022-09-05 09:02:09 +00:00
|
|
|
boardPlan.setPaginationInfo();
|
|
|
|
|
mav.addObject("searchParams", boardPlan);
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
2022-09-06 09:10:03 +00:00
|
|
|
|
|
|
|
|
@GetMapping("/planEditModal")
|
|
|
|
|
public ModelAndView planEditModal(@AuthenticationPrincipal UserInfo loginUser, BoardPlan boardPlan){
|
|
|
|
|
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/monthPlan/planEditModal");
|
|
|
|
|
if(boardPlan.getPlanKey()!=null){
|
|
|
|
|
boardPlan = monthPlanService.selectBoardPlan(boardPlan.getPlanKey());
|
|
|
|
|
}else{
|
|
|
|
|
boardPlan.setWrtOrgan(loginUser.getOgCd());
|
|
|
|
|
boardPlan.setWrtNm(loginUser.getUserNm());
|
|
|
|
|
boardPlan.setWrtDt(LocalDateTime.now());
|
|
|
|
|
}
|
|
|
|
|
mav.addObject("plan", boardPlan);
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-11 06:30:20 +00:00
|
|
|
@GetMapping("/planViewModal")
|
|
|
|
|
public ModelAndView planViewModal(BoardPlan boardPlan){
|
|
|
|
|
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/monthPlan/planViewModal");
|
|
|
|
|
boardPlan = monthPlanService.selectBoardPlan(boardPlan.getPlanKey());
|
|
|
|
|
mav.addObject("plan", boardPlan);
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-06 09:10:03 +00:00
|
|
|
@PostMapping("/savePlan")
|
|
|
|
|
public Integer savePlan(BoardPlan boardPlan,
|
|
|
|
|
@RequestParam(value = "planInfos", required = false) List<String> planInfos,
|
2022-09-13 06:41:19 +00:00
|
|
|
@RequestParam(value = "detailPlanInfos", required = false)List<String> detailPlanInfos,
|
|
|
|
|
MultipartHttpServletRequest request,
|
|
|
|
|
@RequestParam(value = "fileSeq", required = false) List<Integer> deleteFileSeq){
|
|
|
|
|
boardPlan.setMultipartFileList(request.getMultiFileMap().get("uploadFiles"));
|
|
|
|
|
return monthPlanService.saveBoardPlan(boardPlan, planInfos, detailPlanInfos, deleteFileSeq);
|
2022-09-06 09:10:03 +00:00
|
|
|
}
|
2022-09-05 09:02:09 +00:00
|
|
|
}
|