From f35652a5dafb40fe4d70aa051cb7faef1eefc7c0 Mon Sep 17 00:00:00 2001 From: thkim Date: Wed, 23 Oct 2024 14:53:25 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=A7=91=ED=95=A9=EA=B5=90=EC=9C=A1=20?= =?UTF-8?q?=EC=9E=91=EC=97=85=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/HomeTrainingServiceImpl.java | 60 ++++++++++++++++--- .../training/home/HomeTrainingMapper.xml | 6 +- src/main/webapp/WEB-INF/views/home/index.jsp | 4 +- .../homeEducationApplicationInquiry.jsp | 6 +- src/main/webapp/com/css/common.v2.0.css | 3 +- src/main/webapp/com/css/common.v2.0.css.map | 2 +- src/main/webapp/com/css/sass/common.v2.0.scss | 3 +- 7 files changed, 64 insertions(+), 20 deletions(-) diff --git a/src/main/java/geoinfo/training/home/service/impl/HomeTrainingServiceImpl.java b/src/main/java/geoinfo/training/home/service/impl/HomeTrainingServiceImpl.java index 16fbad0f..0c96a7b2 100644 --- a/src/main/java/geoinfo/training/home/service/impl/HomeTrainingServiceImpl.java +++ b/src/main/java/geoinfo/training/home/service/impl/HomeTrainingServiceImpl.java @@ -95,6 +95,40 @@ public class HomeTrainingServiceImpl implements HomeTrainingService { } + private boolean isValid(HashMap params) throws Exception { + + String reqName = MyUtil.getStringFromObject( params.get("reqName") ); + if( reqName == null || reqName.isEmpty()) { + throw new Exception( "신청자를 입력하십시오." ); + } + + String companyName = MyUtil.getStringFromObject( params.get("companyName") ); + if( companyName == null || companyName.isEmpty()) { + throw new Exception( "소속기관 입력하십시오." ); + } + + String reqDept = MyUtil.getStringFromObject( params.get("reqDept") ); + if( reqDept == null || reqDept.isEmpty()) { + throw new Exception( "부서를 입력하십시오." ); + } + + String reqPosition = MyUtil.getStringFromObject( params.get("reqPosition") ); + if( reqPosition == null || reqPosition.isEmpty()) { + throw new Exception( "직급을 입력하십시오." ); + } + + String reqTel = MyUtil.getStringFromObject( params.get("reqTel") ); + if( reqTel == null || reqTel.isEmpty()) { + throw new Exception( "연락처를 입력하십시오." ); + } + + String reqEmail = MyUtil.getStringFromObject( params.get("reqEmail") ); + if( reqEmail == null || reqEmail.isEmpty()) { + throw new Exception( "이메일을 입력하십시오." ); + } + + return true; + } @Override public HashMap attendHomeTraining(HttpServletRequest request, HttpServletResponse response, HashMap params) throws Exception { @@ -109,11 +143,7 @@ public class HomeTrainingServiceImpl implements HomeTrainingService { String userId = (String)request.getSession().getAttribute("USERID"); params.put("userId", userId); - - String reqPosition = MyUtil.getStringFromObject( params.get("reqPosition") ); - if( reqPosition == null ) { - throw new Exception( "직급을 입력하십시오." ); - } + isValid(params); try { //신청 여부를 판단하여 stateCode를 T로 변환한다. A:신청중,D:삭제,C:취소,T:참석 @@ -146,6 +176,8 @@ public class HomeTrainingServiceImpl implements HomeTrainingService { String userId = (String)request.getSession().getAttribute("USERID"); params.put("userId", userId); + isValid(params); + Long whtId = null; try { List list = homeTrainingMapper.getWebHomeTrainingReqByWhtRegIdAndUserId(params); @@ -181,11 +213,21 @@ public class HomeTrainingServiceImpl implements HomeTrainingService { String userId = (String)request.getSession().getAttribute("USERID"); params.put("userId", userId); + Long whtId = null; try { - long webHomeTrainingReqCount = homeTrainingMapper.getWebHomeTrainingReqCountByWhtRegIdAndUserId(params); - if( webHomeTrainingReqCount == 0 ) { - throw new Exception( "교육 참석 취소 대상이 존재하지 않습니다." ); - } + List list = homeTrainingMapper.getWebHomeTrainingReqByWhtRegIdAndUserId(params); + if( list.size() == 0 ) { + throw new Exception( "취소할 교육이 존재하지 않습니다." ); + } + for( EgovMap item : list ) { + TIMESTAMP oracleTimestamp = (TIMESTAMP) item.get("crtDt"); + item.put("crtDt", new Timestamp(oracleTimestamp.timestampValue().getTime())); // oracle.sql.TIMESTAMP -> java.sql.Timestamp 변환 + + + whtId = Long.valueOf( ((BigDecimal)item.get("whtId")).longValue() ); + + } + params.put("whtId", whtId.intValue()); homeTrainingMapper.callSpCancelHomeTrainingReq(params); return params; } catch (SQLException e) { diff --git a/src/main/resources/egovframework/sqlmap/mapper/training/home/HomeTrainingMapper.xml b/src/main/resources/egovframework/sqlmap/mapper/training/home/HomeTrainingMapper.xml index 02fe0d0b..535127c3 100644 --- a/src/main/resources/egovframework/sqlmap/mapper/training/home/HomeTrainingMapper.xml +++ b/src/main/resources/egovframework/sqlmap/mapper/training/home/HomeTrainingMapper.xml @@ -44,7 +44,7 @@ @@ -52,7 +52,7 @@ @@ -89,7 +89,7 @@