2022-12-22 01:55:19 +00:00
|
|
|
package com.dbnt.faisp.config;
|
|
|
|
|
|
2023-02-27 09:59:19 +00:00
|
|
|
import com.dbnt.faisp.main.authMgt.service.AuthMgtService;
|
2022-12-22 01:55:19 +00:00
|
|
|
import com.dbnt.faisp.main.codeMgt.model.CodeMgt;
|
2022-12-28 06:30:07 +00:00
|
|
|
import com.dbnt.faisp.main.faRpt.model.FaRptBoard;
|
2023-04-18 09:45:56 +00:00
|
|
|
import com.dbnt.faisp.main.faRpt.model.Sri;
|
2022-12-28 06:30:07 +00:00
|
|
|
import com.dbnt.faisp.main.faRpt.service.FaRptService;
|
2023-04-18 09:45:56 +00:00
|
|
|
import com.dbnt.faisp.main.faRpt.service.SriService;
|
2022-12-28 06:30:07 +00:00
|
|
|
import com.dbnt.faisp.main.fpiMgt.affair.model.AffairBoard;
|
2023-02-27 09:59:19 +00:00
|
|
|
import com.dbnt.faisp.main.fpiMgt.affair.model.DashboardAffair;
|
2022-12-28 06:30:07 +00:00
|
|
|
import com.dbnt.faisp.main.fpiMgt.affair.service.AffairService;
|
2022-12-22 01:55:19 +00:00
|
|
|
import com.dbnt.faisp.main.menuMgt.service.MenuMgtService;
|
|
|
|
|
import com.dbnt.faisp.main.organMgt.service.OrganConfigService;
|
2022-12-28 06:30:07 +00:00
|
|
|
import com.dbnt.faisp.main.publicBoard.model.PublicBoard;
|
|
|
|
|
import com.dbnt.faisp.main.publicBoard.service.PublicBoardService;
|
2023-01-28 04:33:49 +00:00
|
|
|
import com.dbnt.faisp.main.userInfo.model.UserAlarm;
|
2022-12-22 01:55:19 +00:00
|
|
|
import com.dbnt.faisp.main.userInfo.model.UserInfo;
|
|
|
|
|
import com.dbnt.faisp.main.codeMgt.service.CodeMgtService;
|
|
|
|
|
|
2023-01-28 04:33:49 +00:00
|
|
|
import com.dbnt.faisp.main.userInfo.service.UserAlarmService;
|
2022-12-22 01:55:19 +00:00
|
|
|
import com.dbnt.faisp.main.userInfo.service.UserInfoService;
|
2023-04-18 09:45:56 +00:00
|
|
|
import com.dbnt.faisp.main.userInfo.service.UserLogService;
|
2023-03-16 09:52:42 +00:00
|
|
|
import com.dbnt.faisp.util.Utils;
|
2022-12-22 01:55:19 +00:00
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
public class BaseController {
|
|
|
|
|
|
|
|
|
|
private final CodeMgtService codeMgtService;
|
|
|
|
|
private final OrganConfigService organConfigService;
|
|
|
|
|
private final MenuMgtService menuMgtService;
|
2022-12-28 06:30:07 +00:00
|
|
|
private final PublicBoardService publicBoardService;
|
|
|
|
|
private final FaRptService faRptService;
|
2023-04-18 09:45:56 +00:00
|
|
|
private final SriService sriService;
|
2022-12-28 06:30:07 +00:00
|
|
|
private final AffairService affairService;
|
2023-01-28 04:33:49 +00:00
|
|
|
private final UserAlarmService userAlarmService;
|
2023-02-27 09:59:19 +00:00
|
|
|
private final AuthMgtService authMgtService;
|
2023-04-18 09:45:56 +00:00
|
|
|
private final UserLogService userLogService;
|
2022-12-22 01:55:19 +00:00
|
|
|
|
|
|
|
|
@GetMapping("/")
|
|
|
|
|
public ModelAndView loginCheck(@AuthenticationPrincipal UserInfo loginUser) {
|
|
|
|
|
ModelAndView mav = null;
|
|
|
|
|
if(loginUser == null){
|
2023-04-05 04:50:00 +00:00
|
|
|
mav = new ModelAndView("redirect:/login");
|
2022-12-22 01:55:19 +00:00
|
|
|
}else{
|
|
|
|
|
mav = new ModelAndView("redirect:/dashboard");
|
|
|
|
|
}
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/login")
|
|
|
|
|
public ModelAndView goLogin() {
|
2023-04-05 02:27:21 +00:00
|
|
|
ModelAndView mav = new ModelAndView("login/login2");
|
2022-12-22 01:55:19 +00:00
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/login-error")
|
|
|
|
|
public ModelAndView loginError() {
|
2023-04-05 02:27:21 +00:00
|
|
|
ModelAndView mav = new ModelAndView("login/login2");
|
2022-12-22 01:55:19 +00:00
|
|
|
mav.addObject("loginError", true);
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/denied")
|
|
|
|
|
public ModelAndView doDenied() {
|
|
|
|
|
ModelAndView mav = new ModelAndView("login/denied");
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/dashboard")
|
2023-02-27 03:00:05 +00:00
|
|
|
public ModelAndView dashboard(@AuthenticationPrincipal UserInfo loginUser, HttpSession session) {
|
2022-12-22 01:55:19 +00:00
|
|
|
ModelAndView mav = new ModelAndView("login/dashboard");
|
2023-02-27 03:00:05 +00:00
|
|
|
|
|
|
|
|
setSession(loginUser, session);
|
|
|
|
|
|
2023-04-18 09:45:56 +00:00
|
|
|
mav.addObject("lastLoginDt", userLogService.selectLastLoginDt((String) session.getAttribute("belongValue")));
|
|
|
|
|
|
|
|
|
|
DashboardAffair affair = new DashboardAffair();
|
|
|
|
|
affair.setUserSeq(loginUser.getUserSeq());
|
|
|
|
|
affair.setOgCd(loginUser.getOgCd());
|
|
|
|
|
mav.addObject("apprvStayList", affairService.selectApprvStayList(affair));
|
|
|
|
|
|
2023-01-28 04:33:49 +00:00
|
|
|
UserAlarm alarm = new UserAlarm();
|
|
|
|
|
alarm.setUserSeq(loginUser.getUserSeq());
|
|
|
|
|
alarm.setViewYn("N");
|
2023-04-18 09:45:56 +00:00
|
|
|
alarm.setRowCnt(9);
|
2023-01-30 08:44:23 +00:00
|
|
|
mav.addObject("dashboardAlarmList", userAlarmService.selectAlarmList(alarm));
|
2023-01-28 04:33:49 +00:00
|
|
|
|
2022-12-28 06:30:07 +00:00
|
|
|
FaRptBoard faRpt = new FaRptBoard();
|
|
|
|
|
faRpt.setActiveTab("receive");
|
2023-04-18 09:45:56 +00:00
|
|
|
faRpt.setRowCnt(9);
|
2022-12-28 06:30:07 +00:00
|
|
|
faRpt.setStatus("DST007");
|
|
|
|
|
faRpt.setReceiveUserSeq(loginUser.getUserSeq());
|
|
|
|
|
mav.addObject("faRptList", faRptService.selectFaRptList(faRpt));
|
2023-04-18 09:45:56 +00:00
|
|
|
Sri sri = new Sri();
|
|
|
|
|
sri.setActiveTab("receive");
|
|
|
|
|
sri.setRowCnt(9);
|
|
|
|
|
sri.setStatus("DST007");
|
|
|
|
|
sri.setReceiveUserSeq(loginUser.getUserSeq());
|
|
|
|
|
mav.addObject("sriList", sriService.selectSriList(sri));
|
|
|
|
|
|
|
|
|
|
PublicBoard params = new PublicBoard();
|
|
|
|
|
params.setPublicType("PLB001");
|
|
|
|
|
params.setRowCnt(12);
|
|
|
|
|
params.setDownOrganCdList(loginUser.getDownOrganCdList());
|
|
|
|
|
params.setUpOrganCdList(loginUser.getUpOrganCdList());
|
|
|
|
|
mav.addObject("noticeList", publicBoardService.selectContentList(params));
|
|
|
|
|
params.setPublicType("PLB003");
|
|
|
|
|
params.setRowCnt(6);
|
|
|
|
|
mav.addObject("referenceList", publicBoardService.selectContentList(params));
|
2023-02-27 09:59:19 +00:00
|
|
|
|
2022-12-22 01:55:19 +00:00
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/selectBoxOptions")
|
|
|
|
|
public ModelAndView codeMgtPage(String categoryCd, String selectedCd) {
|
|
|
|
|
ModelAndView mav = new ModelAndView("common/selectBox/options");
|
|
|
|
|
mav.addObject("codeList", codeMgtService.selectCodeMgtList(categoryCd));
|
|
|
|
|
mav.addObject("selectedCd", selectedCd);
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/resetSession")
|
|
|
|
|
public ModelAndView resetSession(@AuthenticationPrincipal UserInfo loginUser, HttpServletRequest request){
|
|
|
|
|
setSession(loginUser, request.getSession());
|
|
|
|
|
return new ModelAndView("redirect:/dashboard");
|
|
|
|
|
}
|
2023-04-19 03:01:10 +00:00
|
|
|
@GetMapping("/apprvStayDocRedirect")
|
|
|
|
|
public ModelAndView apprvStayDocRedirect (DashboardAffair doc){
|
|
|
|
|
ModelAndView mav = new ModelAndView();
|
|
|
|
|
String url = menuMgtService.selectMenuUrl(doc.getBoard());
|
|
|
|
|
if(url.contains("?")){
|
|
|
|
|
url+="&refDocKey="+doc.getKey();
|
|
|
|
|
}else{
|
|
|
|
|
url+="?refDocKey="+doc.getKey();
|
|
|
|
|
}
|
|
|
|
|
mav.setViewName("redirect:"+url);
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
2022-12-22 01:55:19 +00:00
|
|
|
|
|
|
|
|
public void setSession(@AuthenticationPrincipal UserInfo loginUser, HttpSession session){
|
2023-02-08 09:19:52 +00:00
|
|
|
loginUser.setDownOrganCdList(organConfigService.selectDownOrganList(loginUser.getOgCd()));
|
|
|
|
|
loginUser.setUpOrganCdList(organConfigService.selectUpOrganList(loginUser.getOgCd()));
|
2022-12-22 01:55:19 +00:00
|
|
|
session.setAttribute("menuList", menuMgtService.selectAccessMenuListWhereUserSeq(loginUser.getUserSeq()));
|
|
|
|
|
Map<String, List<CodeMgt>> codeMap = codeMgtService.getCommonCode();
|
|
|
|
|
session.setAttribute("commonCode", codeMap);
|
|
|
|
|
session.setAttribute("userSeq", loginUser.getUserSeq());
|
|
|
|
|
session.setAttribute("userOrgan", loginUser.getOgCd());
|
|
|
|
|
String belongValue = "";
|
2023-03-16 09:52:42 +00:00
|
|
|
belongValue += Utils.searchCodeValue(loginUser.getOgCd(), codeMap.get("OG"));
|
|
|
|
|
belongValue += Utils.searchCodeValue(loginUser.getOfcCd(), codeMap.get(loginUser.getOgCd()));
|
|
|
|
|
belongValue += Utils.searchCodeValue(loginUser.getTitleCd(), codeMap.get("JT"));
|
2022-12-22 01:55:19 +00:00
|
|
|
belongValue += loginUser.getUserNm()+"("+loginUser.getUserId()+")";
|
|
|
|
|
session.setAttribute("belongValue", belongValue);
|
|
|
|
|
}
|
2023-03-16 09:52:42 +00:00
|
|
|
|
2022-12-22 01:55:19 +00:00
|
|
|
}
|