알람 기능 작업중.
parent
94a7a9c305
commit
698616fb80
|
|
@ -76,6 +76,7 @@ public class BaseController {
|
|||
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 = "";
|
||||
belongValue += searchCodeValue(loginUser.getOgCd(), codeMap.get("OG"));
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
package com.dbnt.faisp.config;
|
||||
|
||||
import com.dbnt.faisp.main.userInfo.model.UserInfo;
|
||||
import com.dbnt.faisp.main.userInfo.model.UserAlarm;
|
||||
import com.dbnt.faisp.main.userInfo.model.UserRequestLog;
|
||||
import com.dbnt.faisp.main.userInfo.service.UserInfoService;
|
||||
import com.dbnt.faisp.main.userInfo.service.UserAlarmService;
|
||||
import com.dbnt.faisp.main.userInfo.service.UserLogService;
|
||||
import com.dbnt.faisp.util.Utils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
|
@ -19,16 +18,26 @@ import javax.servlet.http.HttpServletResponse;
|
|||
@RequiredArgsConstructor
|
||||
public class FaispInterceptor implements HandlerInterceptor {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
private final UserLogService userLogService;
|
||||
private final UserAlarmService userAlarmService;
|
||||
|
||||
@Override
|
||||
public void afterCompletion(
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
Object handler,
|
||||
Exception ex
|
||||
) throws Exception {
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView mav) throws Exception {
|
||||
if (mav!=null){
|
||||
String xReq = request.getHeader("X-Requested-With");
|
||||
if(xReq == null || !xReq.equals("XMLHttpRequest")){
|
||||
// mav가 있으면서 ajax요청이 아닐 때 알람 조회.
|
||||
UserAlarm param = new UserAlarm();
|
||||
param.setUserSeq((Integer) request.getSession().getAttribute("userSeq"));
|
||||
param.setViewYn("N");
|
||||
param.setQueryInfo();
|
||||
mav.addObject("alarmList", userAlarmService.selectAlarmList(param));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||
//페이지 렌더링 후 실행.
|
||||
UserRequestLog log = new UserRequestLog();
|
||||
log.setContactIp(Utils.getClientIP(request));
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import org.springframework.security.web.access.AccessDeniedHandler;
|
|||
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
|
||||
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
||||
import org.springframework.security.web.authentication.logout.LogoutHandler;
|
||||
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
|
||||
import org.springframework.security.web.savedrequest.HttpSessionRequestCache;
|
||||
import org.springframework.security.web.savedrequest.SavedRequest;
|
||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||
|
|
|
|||
|
|
@ -13,4 +13,6 @@ public interface AuthMgtMapper {
|
|||
List<AccessConfig> selectAccessConfigList(Map<String, Object> params);
|
||||
|
||||
List<ApprovalConfig> selectApprovalConfigList(Map<String, Object> params);
|
||||
|
||||
List<Integer> selectApprvUserList(Map<String, Object> params);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,4 +39,12 @@ public class AuthMgtService {
|
|||
accessConfigRepository.saveAll(authMgt.getAccessConfigList());
|
||||
approvalConfigRepository.saveAll(authMgt.getApprovalConfigList());
|
||||
}
|
||||
|
||||
public List<Integer> selectApprvUserList(String wrtOrgan, Integer menuKey, String apprvAuth) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("ogCd", wrtOrgan);
|
||||
params.put("menuKey", menuKey);
|
||||
params.put("apprvAuth", apprvAuth);
|
||||
return authMgtMapper.selectApprvUserList(params);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,12 +12,17 @@ import com.dbnt.faisp.main.faRpt.repository.FaRptFileRepository;
|
|||
import com.dbnt.faisp.main.faRpt.repository.FaRptReadUserRepository;
|
||||
import com.dbnt.faisp.main.faRpt.repository.HashTagLinkFaRptRepository;
|
||||
import com.dbnt.faisp.main.hashTag.service.HashTagService;
|
||||
import com.dbnt.faisp.main.userInfo.model.UserAlarm;
|
||||
import com.dbnt.faisp.main.userInfo.service.UserAlarmService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -26,6 +31,7 @@ import java.util.UUID;
|
|||
@RequiredArgsConstructor
|
||||
public class FaRptService extends BaseService {
|
||||
private final HashTagService hashTagService;
|
||||
private final UserAlarmService userAlarmService;
|
||||
private final FaRptBoardRepository faRptBoardRepository;
|
||||
private final FaRptFileRepository faRptFileRepository;
|
||||
private final FaRptReadUserRepository faRptReadUserRepository;
|
||||
|
|
@ -82,9 +88,15 @@ public class FaRptService extends BaseService {
|
|||
|
||||
private void saveFaRptReadUser(Integer faRptKey, List<FaRptReadUser> readUserList) {
|
||||
faRptReadUserRepository.deleteByFaRptKey(faRptKey);
|
||||
List<UserAlarm> alarmList = new ArrayList<>();
|
||||
LocalDateTime dateTime = LocalDateTime.now();
|
||||
for(FaRptReadUser readUser: readUserList){
|
||||
readUser.setFaRptKey(faRptKey);
|
||||
UserAlarm alarm = userAlarmService.makeUserAlarm
|
||||
(dateTime, readUser.getUserSeq(), faRptKey, 1, "외사정보보고에 수신 문서가 있습니다.");
|
||||
alarmList.add(alarm);
|
||||
}
|
||||
userAlarmService.saveAlarmList(alarmList);
|
||||
faRptReadUserRepository.saveAll(readUserList);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.dbnt.faisp.main.fpiMgt.affair.model.*;
|
|||
import com.dbnt.faisp.main.fpiMgt.affair.repository.*;
|
||||
import com.dbnt.faisp.main.hashTag.service.HashTagService;
|
||||
import com.dbnt.faisp.main.userInfo.model.UserInfo;
|
||||
import com.dbnt.faisp.main.userInfo.service.UserAlarmService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -21,6 +22,7 @@ import java.util.UUID;
|
|||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AffairService extends BaseService { // 견문보고
|
||||
private final UserAlarmService userAlarmService;
|
||||
private final HashTagService hashTagService;
|
||||
private final AffairBoardRepository affairBoardRepository;
|
||||
private final AffairFileRepository affairFileRepository;
|
||||
|
|
@ -66,6 +68,11 @@ public class AffairService extends BaseService { // 견문보고
|
|||
rating.setAffairStatus(affair.getAffairStatus());
|
||||
affairRatingRepository.save(rating);
|
||||
|
||||
if(affair.getAffairStatus().equals("DST002")){
|
||||
//작성완료일 때 계장 결재 사용자에게 알림 발송.
|
||||
userAlarmService.sendAlarmToApprvUser(affairKey, affair.getWrtOrgan(), "APC003", 30, "견문보고에 결재대기 문서가 있습니다.");
|
||||
userAlarmService.sendAlarmToApprvUser(affairKey, affair.getWrtOrgan(), "APC004", 30, "견문보고에 결재대기 문서가 있습니다.");
|
||||
}
|
||||
return affairKey;
|
||||
}
|
||||
|
||||
|
|
@ -120,6 +127,16 @@ public class AffairService extends BaseService { // 견문보고
|
|||
savedRating.setSectionApprv(rating.getSectionApprv());
|
||||
savedRating.setSectionEtc(rating.getSectionEtc());
|
||||
savedRating.setAffairStatus(rating.getSectionApprv());
|
||||
switch (rating.getSectionApprv()){
|
||||
case "DST004":
|
||||
userAlarmService.sendAlarmToApprvUser(savedRating.getAffairKey(), savedRating.getRatingOrgan(), "APC001", 30, "견문보고에 결재대기 문서가 있습니다.");
|
||||
userAlarmService.sendAlarmToApprvUser(savedRating.getAffairKey(), savedRating.getRatingOrgan(), "APC002", 30, "견문보고에 결재대기 문서가 있습니다.");
|
||||
break;
|
||||
case "DST003":
|
||||
AffairBoard affairBoard = affairBoardRepository.findById(rating.getAffairKey()).orElse(new AffairBoard());
|
||||
userAlarmService.sendAlarmToWrtUser(savedRating.getAffairKey(), affairBoard.getWrtUserSeq(), 30, affairBoard.getTitle()+" 문서가 반려되었습니다.");
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
savedRating.setHeadNm(loginUser.getUserNm());
|
||||
savedRating.setHeadApprvDt(LocalDateTime.now());
|
||||
|
|
@ -136,6 +153,20 @@ public class AffairService extends BaseService { // 견문보고
|
|||
upRating.setAffairKey(savedRating.getAffairKey());
|
||||
upRating.setAffairStatus("DST002");
|
||||
affairRatingRepository.save(upRating);
|
||||
|
||||
// 상보시 상위관서 계장 결재권한 사용자에게 알림 생성
|
||||
userAlarmService.sendAlarmToApprvUser(savedRating.getAffairKey(), upOrgan, "APC003", 30, "견문보고에 결재대기 문서가 있습니다.");
|
||||
userAlarmService.sendAlarmToApprvUser(savedRating.getAffairKey(), upOrgan, "APC004", 30, "견문보고에 결재대기 문서가 있습니다.");
|
||||
}
|
||||
|
||||
AffairBoard affairBoard = affairBoardRepository.findById(rating.getAffairKey()).orElse(new AffairBoard());
|
||||
switch (rating.getHeadApprv()){
|
||||
case "DST006":
|
||||
userAlarmService.sendAlarmToWrtUser(savedRating.getAffairKey(), affairBoard.getWrtUserSeq(), 30, affairBoard.getTitle()+" 문서가 승인되었습니다.");
|
||||
break;
|
||||
case "DST005":
|
||||
userAlarmService.sendAlarmToWrtUser(savedRating.getAffairKey(), affairBoard.getWrtUserSeq(), 30, affairBoard.getTitle()+" 문서가 반려되었습니다.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
affairRatingRepository.save(savedRating);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.dbnt.faisp.main.fpiMgt.affairPlan.service;
|
|||
|
||||
import com.dbnt.faisp.config.BaseService;
|
||||
import com.dbnt.faisp.config.FileInfo;
|
||||
import com.dbnt.faisp.main.authMgt.service.AuthMgtService;
|
||||
import com.dbnt.faisp.main.fpiMgt.affairPlan.mapper.PlanMapper;
|
||||
import com.dbnt.faisp.main.fpiMgt.affairPlan.model.PlanApprv;
|
||||
import com.dbnt.faisp.main.fpiMgt.affairPlan.model.PlanBoard;
|
||||
|
|
@ -12,18 +13,23 @@ import com.dbnt.faisp.main.fpiMgt.affairPlan.repository.PlanApprvRepository;
|
|||
import com.dbnt.faisp.main.fpiMgt.affairPlan.repository.PlanBoardRepository;
|
||||
import com.dbnt.faisp.main.fpiMgt.affairPlan.repository.PlanFileRepository;
|
||||
import com.dbnt.faisp.main.fpiMgt.affairPlan.repository.PlanMainInfoRepository;
|
||||
import com.dbnt.faisp.main.userInfo.model.UserAlarm;
|
||||
import com.dbnt.faisp.main.userInfo.service.UserAlarmService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PlanService extends BaseService { // 월간계획
|
||||
private final UserAlarmService userAlarmService;
|
||||
private final PlanBoardRepository planBoardRepository;
|
||||
private final PlanFileRepository planFileRepository;
|
||||
private final PlanMainInfoRepository planMainInfoRepository;
|
||||
|
|
@ -51,7 +57,7 @@ public class PlanService extends BaseService { // 월간계획
|
|||
@Transactional
|
||||
public Integer savePlanBoard(PlanBoard planBoard, List<String> planInfos, List<String> detailPlanInfos, List<Integer> deleteFileSeq) {
|
||||
Integer planKey = planBoardRepository.save(planBoard).getPlanKey();
|
||||
Integer infoSeq = savePlanMainInfos(planKey,0, "S", planInfos);//요약 summery
|
||||
Integer infoSeq = savePlanMainInfos(planKey,0, "S", planInfos);//요약 summary
|
||||
savePlanMainInfos(planKey, infoSeq, "D", detailPlanInfos);//상세 detail
|
||||
if(deleteFileSeq != null && deleteFileSeq.size()>0){
|
||||
deletePlanFile(planKey, deleteFileSeq);
|
||||
|
|
@ -59,9 +65,45 @@ public class PlanService extends BaseService { // 월간계획
|
|||
if(planBoard.getMultipartFileList()!=null){
|
||||
saveUploadFiles(planKey, planBoard.getMultipartFileList());
|
||||
}
|
||||
if(planBoard.getPlanState().equals("DST002")){
|
||||
//작성완료일 때 계장 결재 사용자에게 알림 발송.
|
||||
userAlarmService.sendAlarmToApprvUser(planKey, planBoard.getWrtOrgan(), "APC003", 29, "월간계획에 결재대기 문서가 있습니다.");
|
||||
userAlarmService.sendAlarmToApprvUser(planKey, planBoard.getWrtOrgan(), "APC004", 29, "월간계획에 결재대기 문서가 있습니다.");
|
||||
}
|
||||
return planKey;
|
||||
}
|
||||
|
||||
public FileInfo selectPlanFile(Integer planKey, Integer fileSeq) {
|
||||
return planFileRepository.findById(new PlanFile.PlanFileId(planKey, fileSeq)).orElse(null);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Integer planStateChange(PlanApprv apprv) {
|
||||
PlanBoard savedPlan = planBoardRepository.findById(apprv.getPlanKey()).orElse(null);
|
||||
savedPlan.setPlanState(apprv.getState());
|
||||
PlanApprv lastApprv = planApprvRepository.findTopByPlanKeyOrderByApprvSeqDesc(apprv.getPlanKey()).orElse(null);
|
||||
apprv.setApprvSeq(lastApprv==null?1:lastApprv.getApprvSeq()+1);
|
||||
planApprvRepository.save(apprv);
|
||||
|
||||
switch (apprv.getState()){
|
||||
case "DST004":
|
||||
// 계장승인시 부장 결재권자에게 알림 발송.
|
||||
userAlarmService.sendAlarmToApprvUser(savedPlan.getPlanKey(), savedPlan.getWrtOrgan(), "APC001", 29, "월간계획에 결재대기 문서가 있습니다.");
|
||||
userAlarmService.sendAlarmToApprvUser(savedPlan.getPlanKey(), savedPlan.getWrtOrgan(), "APC002", 29, "월간계획에 결재대기 문서가 있습니다.");
|
||||
break;
|
||||
case "DST003":
|
||||
case "DST005":
|
||||
// 반려시 작성자에게 반려 알림 발송
|
||||
userAlarmService.sendAlarmToWrtUser(savedPlan.getPlanKey(), savedPlan.getWrtUserSeq(), 29, savedPlan.getContentTitle()+" 문서가 반려되었습니다.");
|
||||
break;
|
||||
case "DST006":
|
||||
// 부장승인시 작성자에게 승인 알림 발송
|
||||
userAlarmService.sendAlarmToWrtUser(savedPlan.getPlanKey(), savedPlan.getWrtUserSeq(), 29, savedPlan.getContentTitle()+" 문서가 승인되었습니다.");
|
||||
break;
|
||||
}
|
||||
return apprv.getApprvSeq();
|
||||
}
|
||||
|
||||
private Integer savePlanMainInfos(Integer planKey, Integer planSeq, String infoType, List<String> infoList){
|
||||
for(String info: infoList){
|
||||
PlanMainInfo planMainInfo = new PlanMainInfo();
|
||||
|
|
@ -105,18 +147,4 @@ public class PlanService extends BaseService { // 월간계획
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public FileInfo selectPlanFile(Integer planKey, Integer fileSeq) {
|
||||
return planFileRepository.findById(new PlanFile.PlanFileId(planKey, fileSeq)).orElse(null);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Integer planStateChange(PlanApprv apprv) {
|
||||
PlanBoard savedPlan = planBoardRepository.findById(apprv.getPlanKey()).orElse(null);
|
||||
savedPlan.setPlanState(apprv.getState());
|
||||
PlanApprv lastApprv = planApprvRepository.findTopByPlanKeyOrderByApprvSeqDesc(apprv.getPlanKey()).orElse(null);
|
||||
apprv.setApprvSeq(lastApprv==null?1:lastApprv.getApprvSeq()+1);
|
||||
planApprvRepository.save(apprv);
|
||||
return apprv.getApprvSeq();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import com.dbnt.faisp.config.FileInfo;
|
|||
import com.dbnt.faisp.main.fpiMgt.affairResult.mapper.ResultMapper;
|
||||
import com.dbnt.faisp.main.fpiMgt.affairResult.model.*;
|
||||
import com.dbnt.faisp.main.fpiMgt.affairResult.repository.*;
|
||||
import com.dbnt.faisp.main.userInfo.model.UserAlarm;
|
||||
import com.dbnt.faisp.main.userInfo.service.UserAlarmService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -18,6 +20,7 @@ import java.util.UUID;
|
|||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ResultService extends BaseService { // 월간계획
|
||||
private final UserAlarmService userAlarmService;
|
||||
private final ClearInfoRepository clearInfoRepository;
|
||||
private final ResultApprvRepository resultApprvRepository;
|
||||
private final ResultBoardRepository resultBoardRepository;
|
||||
|
|
@ -65,6 +68,11 @@ public class ResultService extends BaseService { // 월간계획
|
|||
if (resultBoard.getAffairList() != null){
|
||||
saveResultToAffair(resultKey, resultBoard.getAffairList());
|
||||
}
|
||||
if(resultBoard.getResultState().equals("DST002")){
|
||||
//작성완료일 때 계장 결재 사용자에게 알림 발송.
|
||||
userAlarmService.sendAlarmToApprvUser(resultKey, resultBoard.getWrtOrgan(), "APC003", 31, "청산보고서에 결재대기 문서가 있습니다.");
|
||||
userAlarmService.sendAlarmToApprvUser(resultKey, resultBoard.getWrtOrgan(), "APC004", 31, "청산보고서에 결재대기 문서가 있습니다.");
|
||||
}
|
||||
return resultKey;
|
||||
}
|
||||
|
||||
|
|
@ -79,6 +87,23 @@ public class ResultService extends BaseService { // 월간계획
|
|||
ResultApprv lastApprv = resultApprvRepository.findTopByResultKeyOrderByApprvSeqDesc(apprv.getResultKey()).orElse(null);
|
||||
apprv.setApprvSeq(lastApprv==null?1:lastApprv.getApprvSeq()+1);
|
||||
resultApprvRepository.save(apprv);
|
||||
|
||||
switch (apprv.getState()){
|
||||
case "DST004":
|
||||
// 계장승인시 부장 결재권자에게 알림 발송.
|
||||
userAlarmService.sendAlarmToApprvUser(savedResult.getResultKey(), savedResult.getWrtOrgan(), "APC001", 31, "청산보고서에 결재대기 문서가 있습니다.");
|
||||
userAlarmService.sendAlarmToApprvUser(savedResult.getResultKey(), savedResult.getWrtOrgan(), "APC002", 31, "청산보고서에 결재대기 문서가 있습니다.");
|
||||
break;
|
||||
case "DST003":
|
||||
case "DST005":
|
||||
// 반려시 작성자에게 반려 알림 발송
|
||||
userAlarmService.sendAlarmToWrtUser(savedResult.getResultKey(), savedResult.getWrtUserSeq(), 31, savedResult.getResultTitle()+" 문서가 반려되었습니다.");
|
||||
break;
|
||||
case "DST006":
|
||||
// 부장승인시 작성자에게 승인 알림 발송
|
||||
userAlarmService.sendAlarmToWrtUser(savedResult.getResultKey(), savedResult.getWrtUserSeq(), 31, savedResult.getResultTitle()+" 문서가 승인되었습니다.");
|
||||
break;
|
||||
}
|
||||
return apprv.getApprvSeq();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import com.dbnt.faisp.main.fpiMgt.sri.model.SriReadUser;
|
|||
import com.dbnt.faisp.main.fpiMgt.sri.repository.SriFileRepository;
|
||||
import com.dbnt.faisp.main.fpiMgt.sri.repository.SriReadUserRepository;
|
||||
import com.dbnt.faisp.main.fpiMgt.sri.repository.SriRepository;
|
||||
import com.dbnt.faisp.main.userInfo.model.UserAlarm;
|
||||
import com.dbnt.faisp.main.userInfo.service.UserAlarmService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
|
@ -17,6 +19,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -24,7 +28,8 @@ import java.util.UUID;
|
|||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SriService extends BaseService {
|
||||
|
||||
|
||||
private final UserAlarmService userAlarmService;
|
||||
private final SriRepository sriRepository;
|
||||
private final SriReadUserRepository sriReadUserRepository;
|
||||
private final SriFileRepository sriFileRepository;
|
||||
|
|
@ -82,10 +87,16 @@ public class SriService extends BaseService {
|
|||
|
||||
private void saveSriReadUser(Integer faSriKey, List<SriReadUser> readUserList) {
|
||||
sriReadUserRepository.deleteByFaSriKey(faSriKey);
|
||||
List<UserAlarm> alarmList = new ArrayList<>();
|
||||
LocalDateTime dateTime = LocalDateTime.now();
|
||||
for(SriReadUser readUser: readUserList){
|
||||
readUser.setFaSriKey(faSriKey);
|
||||
UserAlarm alarm = userAlarmService.makeUserAlarm
|
||||
(dateTime, readUser.getUserSeq(), faSriKey, 40, "SRI에 수신 문서가 있습니다.");
|
||||
alarmList.add(alarm);
|
||||
}
|
||||
sriReadUserRepository.saveAll(readUserList);
|
||||
userAlarmService.saveAlarmList(alarmList);
|
||||
sriReadUserRepository.saveAll(readUserList);
|
||||
}
|
||||
|
||||
private void saveUploadFiles(Integer faSriKey, List<MultipartFile> multipartFileList) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ import com.dbnt.faisp.kwms.service.KwmsService;
|
|||
import com.dbnt.faisp.main.authMgt.service.AuthMgtService;
|
||||
import com.dbnt.faisp.main.codeMgt.service.CodeMgtService;
|
||||
import com.dbnt.faisp.main.userInfo.model.*;
|
||||
import com.dbnt.faisp.main.userInfo.model.PersonnelStatus;
|
||||
import com.dbnt.faisp.main.userInfo.model.UserCareer;
|
||||
import com.dbnt.faisp.main.userInfo.model.UserEdu;
|
||||
import com.dbnt.faisp.main.userInfo.service.PoliceService;
|
||||
import com.dbnt.faisp.main.userInfo.service.UserInfoService;
|
||||
import com.dbnt.faisp.util.Utils;
|
||||
|
|
@ -286,7 +289,7 @@ public class PoliceController {
|
|||
}
|
||||
|
||||
@GetMapping("/eduEditModal")
|
||||
public ModelAndView eduEditModal(@AuthenticationPrincipal UserInfo loginUser,UserEdu userEdu){
|
||||
public ModelAndView eduEditModal(@AuthenticationPrincipal UserInfo loginUser, UserEdu userEdu){
|
||||
ModelAndView mav = new ModelAndView("police/education/eduEditModal");
|
||||
|
||||
//메뉴권한 확인
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
package com.dbnt.faisp.main.userInfo.mapper;
|
||||
|
||||
import com.dbnt.faisp.main.userInfo.model.*;
|
||||
import com.dbnt.faisp.main.userInfo.model.UserInoutLog;
|
||||
import com.dbnt.faisp.main.userInfo.model.UserRequestLog;
|
||||
import com.dbnt.faisp.main.userInfo.model.PersonnelStatus;
|
||||
import com.dbnt.faisp.main.userInfo.model.UserEdu;
|
||||
import com.dbnt.faisp.util.ParamMap;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
|
@ -40,4 +44,7 @@ public interface UserInfoMapper {
|
|||
List<UserInoutLog> selectInoutLogList(UserInoutLog inoutLog);
|
||||
|
||||
Integer selectInoutLogListCnt(UserInoutLog inoutLog);
|
||||
|
||||
List<UserAlarm> selectAlarmList(UserAlarm userAlarm);
|
||||
Integer selectAlarmListCnt(UserAlarm userAlarm);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
package com.dbnt.faisp.main.userInfo.model;
|
||||
|
||||
import com.dbnt.faisp.config.BaseModel;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "user_alarm")
|
||||
@IdClass(UserAlarm.UserAlarmId.class)
|
||||
public class UserAlarm extends BaseModel {
|
||||
@Id
|
||||
@Column(name = "alarm_key")
|
||||
private String alarmKey;
|
||||
@Id
|
||||
@Column(name = "user_seq")
|
||||
private Integer userSeq;
|
||||
@Column(name = "menu_key")
|
||||
private Integer menuKey;
|
||||
@Column(name = "ref_doc_key")
|
||||
private Integer refDocKey;
|
||||
@Column(name = "alarm_msg")
|
||||
private String alarmMsg;
|
||||
@Column(name = "view_yn")
|
||||
private String viewYn;
|
||||
@Column(name = "wrt_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime wrtDt;
|
||||
|
||||
@Embeddable
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class UserAlarmId implements Serializable {
|
||||
private String alarmKey;
|
||||
private Integer userSeq;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.dbnt.faisp.main.userInfo.repository;
|
||||
|
||||
import com.dbnt.faisp.main.userInfo.model.UserAlarm;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface UserAlarmRepository extends JpaRepository<UserAlarm, UserAlarm.UserAlarmId> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
package com.dbnt.faisp.main.userInfo.service;
|
||||
|
||||
import com.dbnt.faisp.main.authMgt.service.AuthMgtService;
|
||||
import com.dbnt.faisp.main.userInfo.mapper.UserInfoMapper;
|
||||
import com.dbnt.faisp.main.userInfo.model.UserAlarm;
|
||||
import com.dbnt.faisp.main.userInfo.repository.UserAlarmRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserAlarmService {
|
||||
private final AuthMgtService authMgtService;
|
||||
private final UserAlarmRepository userAlarmRepository;
|
||||
private final UserInfoMapper userInfoMapper;
|
||||
|
||||
@Transactional
|
||||
public void saveAlarmList(List<UserAlarm> alarmList) {
|
||||
userAlarmRepository.saveAll(alarmList);
|
||||
}
|
||||
|
||||
public UserAlarm makeUserAlarm(LocalDateTime dateTime, Integer userSeq,
|
||||
Integer refDocKey, Integer menuKey, String alarmMsg){
|
||||
UserAlarm alarm = new UserAlarm();
|
||||
alarm.setAlarmKey(dateTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")));
|
||||
alarm.setUserSeq(userSeq);
|
||||
alarm.setRefDocKey(refDocKey);
|
||||
alarm.setMenuKey(menuKey);
|
||||
alarm.setAlarmMsg(alarmMsg);
|
||||
alarm.setViewYn("N");
|
||||
alarm.setWrtDt(dateTime);
|
||||
return alarm;
|
||||
}
|
||||
|
||||
public List<UserAlarm> selectAlarmList(UserAlarm userAlarm) {
|
||||
return userInfoMapper.selectAlarmList(userAlarm);
|
||||
}
|
||||
public Integer selectAlarmListCnt(UserAlarm userAlarm) {
|
||||
return userInfoMapper.selectAlarmListCnt(userAlarm);
|
||||
}
|
||||
|
||||
public void sendAlarmToApprvUser(Integer planKey, String wrtOrgan, String apprvAuth, Integer menuKey, String msg){
|
||||
List<Integer> apprvUserList = authMgtService.selectApprvUserList(wrtOrgan, menuKey, apprvAuth);
|
||||
List<UserAlarm> alarmList = new ArrayList<>();
|
||||
LocalDateTime dateTime = LocalDateTime.now();
|
||||
for(Integer userSeq: apprvUserList){
|
||||
UserAlarm alarm = makeUserAlarm
|
||||
(dateTime, userSeq, planKey, menuKey, msg);
|
||||
alarmList.add(alarm);
|
||||
}
|
||||
saveAlarmList(alarmList);
|
||||
}
|
||||
public void sendAlarmToWrtUser(Integer planKey, Integer userSeq, Integer menuKey, String msg){
|
||||
List<UserAlarm> alarmList = new ArrayList<>();
|
||||
UserAlarm alarm = makeUserAlarm
|
||||
(LocalDateTime.now(), userSeq, planKey, menuKey, msg);
|
||||
alarmList.add(alarm);
|
||||
saveAlarmList(alarmList);
|
||||
}
|
||||
}
|
||||
|
|
@ -36,4 +36,13 @@
|
|||
</if>
|
||||
order by cat1_cd, cat2_cd, cat3_cd
|
||||
</select>
|
||||
|
||||
<select id="selectApprvUserList" resultType="int" parameterType="hashMap">
|
||||
select a.user_seq
|
||||
from user_info a
|
||||
inner join approval_config b on a.user_seq = b.user_seq
|
||||
where a.og_cd = #{ogCd}
|
||||
and b.menu_key = #{menuKey}
|
||||
and b.approval_auth = #{apprvAuth}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -387,4 +387,33 @@
|
|||
from user_inout_log
|
||||
<include refid="selectInoutLogListWhere"></include>
|
||||
</select>
|
||||
|
||||
<sql id="selectAlarmListWhere">
|
||||
<where>
|
||||
<if test='userSeq != null and userSeq != 0'>
|
||||
and a.user_seq = #{userSeq}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
<select id="selectAlarmList" resultType="UserAlarm" parameterType="UserAlarm">
|
||||
select a.alarm_key ,
|
||||
a.user_seq ,
|
||||
a.menu_key ,
|
||||
b.menu_url ,
|
||||
a.ref_doc_key ,
|
||||
a.alarm_msg ,
|
||||
a.view_yn ,
|
||||
a.wrt_dt
|
||||
from user_alarm a
|
||||
inner join menu_mgt b on a.menu_key = b.menu_key
|
||||
<include refid="selectAlarmListWhere"></include>
|
||||
order by wrt_dt desc
|
||||
limit #{rowCnt} offset #{firstIndex}
|
||||
</select>
|
||||
<select id="selectAlarmListCnt" resultType="int" parameterType="UserAlarm">
|
||||
select count(*)
|
||||
from user_alarm a
|
||||
inner join menu_mgt b on a.menu_key = b.menu_key
|
||||
<include refid="selectAlarmListWhere"></include>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<table class="table table-hover">
|
||||
<table class="table table-bordered table-hover">
|
||||
<thead>
|
||||
<tr class="table-secondary">
|
||||
<th></th>
|
||||
|
|
@ -90,7 +90,7 @@
|
|||
<th>열람수</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody class="table-group-divider">
|
||||
<tr class="faRptTr" th:each="faRpt:${faRptList}">
|
||||
<input type="hidden" class="faRptKey" th:value="${faRpt.faRptKey}">
|
||||
<td><input type="checkbox" class="trChkBox"></td>
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
</div>
|
||||
<div class="col-auto my-auto">
|
||||
<ul class="nav nav-pills" sec:authorize="isAuthenticated()">
|
||||
<li class="nav-item"><a href="#" class="nav-link link-dark"><i class="bi bi-bell-fill"></i></a></li>
|
||||
<li class="nav-item"><a href="#" class="nav-link" th:classappend="${#lists.isEmpty(alarmList)?'link-dark':'link-danger'}"><i class="bi bi-bell-fill"></i></a></li>
|
||||
<li class="nav-item dropdown">
|
||||
<a href="#" class="nav-link dropdown-toggle text-black" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<th:block th:each="commonCode:${session.commonCode.get('JT')}">
|
||||
|
|
|
|||
Loading…
Reference in New Issue