diff --git a/list.txt b/list.txt index 0ca4ee02..f617ac19 100644 --- a/list.txt +++ b/list.txt @@ -1,65 +1,2 @@ #src\main\resources\egovframework\egovProps\globals.properties -#TEMP_HEADER -src\main\java\geoinfo\com\WebConfirm.java -src\main\resources\egovframework\sqlmap\mapper\main\Login_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\map\MapControl_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\map\MapLeft_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\regi\common.xml -src\main\resources\egovframework\sqlmap\mapper\regi\header.xml -src\main\resources\egovframework\sqlmap\mapper\regi\holeCoord.xml -src\main\resources\egovframework\sqlmap\mapper\regi\layerInfo_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\regi\listReg.xml -src\main\resources\egovframework\sqlmap\mapper\regi\map.xml -src\main\resources\egovframework\sqlmap\mapper\regi\projectList.xml -src\main\resources\egovframework\sqlmap\mapper\regi\regi.xml -src\main\resources\egovframework\sqlmap\mapper\regi\rock.xml -src\main\resources\egovframework\sqlmap\mapper\regi\sand_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\regi\selectClass2019_SQL.xml -#TEMP_PROJECT_INFO -src\main\java\geoinfo\com\WebConfirm.java -src\main\java\geoinfo\regi\surface\SurfaceController.java -src\main\resources\egovframework\sqlmap\mapper\main\Home_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\main\Login_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\map\MapLeft_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\regi\common.xml -src\main\resources\egovframework\sqlmap\mapper\regi\complete_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\regi\complete.xml -src\main\resources\egovframework\sqlmap\mapper\regi\header.xml -src\main\resources\egovframework\sqlmap\mapper\regi\holeCoord.xml -src\main\resources\egovframework\sqlmap\mapper\regi\info_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\regi\listReg.xml -src\main\resources\egovframework\sqlmap\mapper\regi\manageList.xml -src\main\resources\egovframework\sqlmap\mapper\regi\manageList2019.xml -src\main\resources\egovframework\sqlmap\mapper\regi\map.xml -src\main\resources\egovframework\sqlmap\mapper\regi\projectList.xml -src\main\resources\egovframework\sqlmap\mapper\regi\regi.xml -src\main\resources\egovframework\sqlmap\mapper\regi\rock.xml -src\main\resources\egovframework\sqlmap\mapper\regi\sand_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\regi\selectClass_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\regi\selectClass2019_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\regi\surface_SQL.xml -src\main\webapp\WEB-INF\views\web\input\surface\refraction_survey_json_data.jsp -src\main\webapp\WEB-INF\views\web\input\surface\refraction_survey_sub_json_data.jsp -src\main\webapp\WEB-INF\views\web\input\surface\resistivity_survey_jsondata.jsp -src\main\webapp\WEB-INF\views\web\input\surface\resistivity_survey_sub_jsondata.jsp -#TBL_HEADER -src\main\java\geoinfo\com\WebConfirm.java -src\main\resources\egovframework\sqlmap\mapper\com\Jusangdo_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\main\Home_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\map\MapControl_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\map\MapCoordSearch_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\map\MapInformation_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\map\MapLeft_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\map\MapProjectSearch_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\regi\regi.xml -#TBL_PROJECT_INFO -src\main\java\geoinfo\com\WebConfirm.java -src\main\resources\egovframework\sqlmap\mapper\main\Home_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\main\Login_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\map\MapControl_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\map\MapCoordSearch_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\map\MapInformation_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\map\MapLeft_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\map\MapMain_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\map\MapProjectSearch_SQL.xml -src\main\resources\egovframework\sqlmap\mapper\regi\manageList2019.xml \ No newline at end of file +src\main\webapp\WEB-INF\views\body\join\join.jsp \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6650e5f3..7b9f2d5a 100644 --- a/pom.xml +++ b/pom.xml @@ -441,6 +441,12 @@ json-simple 1.1.1 + + + io.jsonwebtoken + jjwt + 0.9.1 + diff --git a/src/main/java/geoinfo/main/login/LoginController.java b/src/main/java/geoinfo/main/login/LoginController.java index 7dfc9306..d2d01e3e 100644 --- a/src/main/java/geoinfo/main/login/LoginController.java +++ b/src/main/java/geoinfo/main/login/LoginController.java @@ -5,6 +5,7 @@ import java.io.FileNotFoundException; import java.io.PrintWriter; import java.net.InetAddress; import java.net.MalformedURLException; +import java.security.Key; import java.security.MessageDigest; import java.security.SecureRandom; import java.text.DecimalFormat; @@ -26,6 +27,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.annotation.Resource; +import javax.crypto.spec.SecretKeySpec; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; @@ -62,6 +64,9 @@ import geoinfo.map.mapControl.service.MapControlService; import geoinfo.util.MobileCertificationUtil; import geoinfo.util.ScriptUtil; import ictway.comm.web.WebUtil; +import io.jsonwebtoken.JwtBuilder; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; import sun.misc.BASE64Decoder; @Controller @@ -80,6 +85,9 @@ public class LoginController { private static boolean loginFlag = true; private static MultiValueMap users = new MultiValueMap(); + final String SECRET_KEY = EgovProperties.getProperty("JWT.secret_key").trim(); + final String ACCESS_EXPIRED = EgovProperties.getProperty("JWT.access_expired").trim(); + private static List sessionList = new ArrayList<>(); public static List getSessionList() { @@ -593,6 +601,59 @@ public class LoginController { return mv; } + + + public String createJWT(String id, String issuer, String subject, long ttlMillis) { + + //The JWT signature algorithm we will be using to sign the token + SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256; + + long nowMillis = System.currentTimeMillis(); + Date now = new Date(nowMillis); + + //We will sign our JWT with our ApiKey secret + byte[] apiKeySecretBytes = DatatypeConverter.parseBase64Binary(SECRET_KEY); + Key signingKey = new SecretKeySpec(apiKeySecretBytes, signatureAlgorithm.getJcaName()); + + //Let's set the JWT Claims + JwtBuilder builder = Jwts.builder().setId(id) + .setIssuedAt(now) + .setSubject(subject) + .setIssuer(issuer) + .signWith(signatureAlgorithm, signingKey); + + //if it has been specified, let's add the expiration + if (ttlMillis > 0) { + long expMillis = nowMillis + ttlMillis; + Date exp = new Date(expMillis); + builder.setExpiration(exp); + } + + //Builds the JWT and serializes it to a compact, URL-safe string + return builder.compact(); + } + + public void myTest(HttpServletRequest request, HttpServletResponse response, String id) { + + if( request == null ) { + return; + } + + if( id == null ) { + id = ""; + } + + // The default token expires in 1,800,000 milliseconds, which is equal to 30 minutes. + String createJWT = createJWT(id, "testthkim", "title...", Long.valueOf(ACCESS_EXPIRED == null ? "1800000" : ACCESS_EXPIRED)); + + System.out.println( + "\n--------------------------------------------------------------\n" + + request.getRequestURI() + " " + "myTest" + + "\n--------------------------------------------------------------\n" + + "createJWT:[" + createJWT + "]\n" + + "\n--------------------------------------------------------------\n" + ); + } // 로그인 @RequestMapping(value = "/login.do", method = RequestMethod.POST) @@ -1019,6 +1080,8 @@ public class LoginController { mv.addObject("url", url); loginFlag = true; + + myTest(request, response, userid); return mv; } diff --git a/src/main/java/geoinfo/regi/sampleInfo/SampleInfoController.java b/src/main/java/geoinfo/regi/sampleInfo/SampleInfoController.java index d100db1d..74f02929 100644 --- a/src/main/java/geoinfo/regi/sampleInfo/SampleInfoController.java +++ b/src/main/java/geoinfo/regi/sampleInfo/SampleInfoController.java @@ -21,6 +21,7 @@ import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; +import org.apache.commons.lang.StringUtils; import org.jfree.util.Log; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -36,6 +37,9 @@ import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; +import egovframework.com.cmm.service.EgovProperties; +import egovframework.rte.psl.dataaccess.util.EgovMap; + @Controller public class SampleInfoController { @@ -311,7 +315,8 @@ public class SampleInfoController { ); } - wUtil.deleteSandInfo(oPROJECT_CODE,oHOLE_CODE,request,params,sampleService); + //wUtil.deleteSandInfo(oPROJECT_CODE,oHOLE_CODE,request,params,sampleService); + ictwayDeleteSandInfo(oPROJECT_CODE,oHOLE_CODE,request,params); } //commit @@ -345,6 +350,94 @@ public class SampleInfoController { return "/web/input/sampleInfoDb"; } + + public boolean ictwayDeleteSandInfo(String PROJECT_CODE, String HOLE_CODE, HttpServletRequest request, HashMap params) throws Exception { + String savePath = request.getSession().getServletContext().getRealPath("/") + EgovProperties.getProperty("Geoinfo.WebFilePath") + "CH/" + PROJECT_CODE + "/" + HOLE_CODE + "/"; + + if ((!"".equals(PROJECT_CODE)) && (!"".equals(HOLE_CODE))) + { + params.put("PROJECT_CODE", PROJECT_CODE); + params.put("HOLE_CODE", HOLE_CODE); + ArrayList result = sampleService.selectTempClassification(params); + + for (int i = 0; i < result.size(); i++) { + EgovMap resultMap = (EgovMap)result.get(i); + if (!"".equals(StringUtils.defaultString((String)resultMap.get("graphImage")))) { + ictwayDeleteFile(savePath + "SAND_CLASSIFICATION", StringUtils.defaultString((String)resultMap.get("GRAPH_IMAGE"))); + } + } + + sampleService.deleteTempClassification(params); + + ArrayList result2 = sampleService.selectTempConsolidationUsual(params); + for (int i = 0; i < result2.size(); i++) { + EgovMap resultMap2 = (EgovMap)result2.get(i); + if (!"".equals(StringUtils.defaultString((String)resultMap2.get("graphImage")))) { + ictwayDeleteFile(savePath + "SAND_CONSOLIDATION", StringUtils.defaultString((String)resultMap2.get("graphImage"))); + } + } + + sampleService.deleteTempConsolidation(params); + + sampleService.deleteTempConsolidationUsual(params); + + ArrayList resultCbr = sampleService.selectTempCbrCompac(params); + for (int i = 0; i < resultCbr.size(); i++) { + EgovMap cbrMap = (EgovMap)resultCbr.get(i); + if (!"".equals(StringUtils.defaultString((String)cbrMap.get("graphImage1")))) { + ictwayDeleteFile(savePath + "SAND_CBR", StringUtils.defaultString((String)cbrMap.get("graphImage1"))); + } + if (!"".equals(StringUtils.defaultString((String)cbrMap.get("graphImage2")))) { + ictwayDeleteFile(savePath + "SAND_CBR", StringUtils.defaultString((String)cbrMap.get("graphImage2"))); + } + } + + sampleService.deleteTempCbrCompac(params); + + ArrayList resultUnconfined = sampleService.selectTempUnconfinedUsual(params); + for (int i = 0; i < resultUnconfined.size(); i++) { + EgovMap unconMap = (EgovMap)resultUnconfined.get(i); + if (!"".equals(StringUtils.defaultString((String)unconMap.get("graphImage")))) { + ictwayDeleteFile(savePath + "SAND_UNCONFINED", StringUtils.defaultString((String)unconMap.get("graphImage"))); + } + } + + sampleService.deleteTempUnconfinedUsual(params); + + ArrayList resultTriaxial = sampleService.selectTempTriaxialUsual(params); + for (int i = 0; i < resultTriaxial.size(); i++) { + EgovMap triaxialMap = (EgovMap)resultTriaxial.get(i); + if (!"".equals(StringUtils.defaultString((String)triaxialMap.get("graphImage1")))) { + ictwayDeleteFile(savePath + "SAND_TRIAXIAL", StringUtils.defaultString((String)triaxialMap.get("graphImage1"))); + } + if (!"".equals(StringUtils.defaultString((String)triaxialMap.get("graphImage2")))) { + ictwayDeleteFile(savePath + "SAND_TRIAXIAL", StringUtils.defaultString((String)triaxialMap.get("graphImage2"))); + } + } + + sampleService.deleteTempTriaxialCu(params); + + sampleService.deleteTempTriaxialUu(params); + + sampleService.deleteTempTriaxialUsual(params); + } + + return true; + } + + public void ictwayDeleteFile(String savePath, String fileName) + { + try + { + java.io.File deleteFile = new java.io.File(savePath + "/" + fileName); + + if (deleteFile.exists()) + deleteFile.delete(); + } + catch (Exception e) { + System.out.println("e.getMessage() : " + e.getMessage()); + } + } } diff --git a/src/main/java/geoinfo/regi/sampleInfo/service/impl/SampleInfoServiceImpl.java b/src/main/java/geoinfo/regi/sampleInfo/service/impl/SampleInfoServiceImpl.java index fddf9788..9d929b26 100644 --- a/src/main/java/geoinfo/regi/sampleInfo/service/impl/SampleInfoServiceImpl.java +++ b/src/main/java/geoinfo/regi/sampleInfo/service/impl/SampleInfoServiceImpl.java @@ -24,7 +24,7 @@ public class SampleInfoServiceImpl implements SampleInfoService { @Override public int deleteSampleInfo(HashMap params) throws Exception{ - return sampleInfoMapper.deleteSampleInfo(params); + return sampleInfoMapper.deleteSampleInfo(params); } @Override diff --git a/src/main/resources/egovframework/sqlmap/mapper/regi/header.xml b/src/main/resources/egovframework/sqlmap/mapper/regi/header.xml index dc9535d1..88cd99da 100644 --- a/src/main/resources/egovframework/sqlmap/mapper/regi/header.xml +++ b/src/main/resources/egovframework/sqlmap/mapper/regi/header.xml @@ -309,9 +309,9 @@ DELETE FROM TEMP_HEADER WHERE USE_YN != 'N' AND PROJECT_CODE =#{PROJECT_CODE} AN diff --git a/src/main/resources/egovframework/sqlmap/mapper/regi/sampleInfo.xml b/src/main/resources/egovframework/sqlmap/mapper/regi/sampleInfo.xml index 0e831d2a..1e4c9f5d 100644 --- a/src/main/resources/egovframework/sqlmap/mapper/regi/sampleInfo.xml +++ b/src/main/resources/egovframework/sqlmap/mapper/regi/sampleInfo.xml @@ -13,9 +13,9 @@ ]]> - + @@ -72,16 +72,16 @@ ]]> - - - + + +