diff --git a/build.gradle b/build.gradle index 0fbb8c6..0238089 100644 --- a/build.gradle +++ b/build.gradle @@ -83,6 +83,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-jdbc' + implementation 'com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.3' // spring-boot 2.3 까지는 사용 불가 - spring-boot-starter-web에 포함되어 있다 // hibernate-validator:5.2.4.Final 사용 diff --git a/src/main/java/com/xit/biz/ctgy/dto/JudgeResultDto.java b/src/main/java/com/xit/biz/ctgy/dto/JudgeResultDto.java index afa1982..4737f28 100644 --- a/src/main/java/com/xit/biz/ctgy/dto/JudgeResultDto.java +++ b/src/main/java/com/xit/biz/ctgy/dto/JudgeResultDto.java @@ -30,7 +30,7 @@ public class JudgeResultDto { @Schema(required = false, title = "결과코드", example = " ", description = "Input Description...") private String msResult; - List judgeResultUserDtoList; + List judgeResultUsers; // @Schema(required = true, title = "차수", example = " ", description = "Input Description...") // private Long msChasu; diff --git a/src/main/java/com/xit/biz/ctgy/dto/JudgeResultUserDto.java b/src/main/java/com/xit/biz/ctgy/dto/JudgeResultUserDto.java index eb8c5b8..5fc7312 100644 --- a/src/main/java/com/xit/biz/ctgy/dto/JudgeResultUserDto.java +++ b/src/main/java/com/xit/biz/ctgy/dto/JudgeResultUserDto.java @@ -8,6 +8,7 @@ import lombok.NoArgsConstructor; import lombok.Setter; import org.apache.ibatis.type.Alias; +import javax.persistence.Column; import java.time.LocalDate; @Schema(name = "JudgeResultUserDto", description = "심사결과사용자") @@ -17,13 +18,21 @@ import java.time.LocalDate; @NoArgsConstructor public class JudgeResultUserDto { + @Schema(required = true, title = "민원심사사용자매핑코드", example = " ", description = "Input Description...") + private Long msuCode; + @Schema(required = true, title = "민원코드", example = " ", description = "민원코드") private Long msuMaincode; + @Schema(required = true, title = "민원심사사용자코드", example = " ", description = "Input Description...") + private String msuUserid; + @Schema(required = false, title = "결과코드", example = " ", description = "Input Description...") private String msuResult; + @Schema(required = true, title = "팀코드", example = " ", description = "Input Description...") + private String msuTeam; + @Schema(required = false, title = "단속시간", example = " ", description = "Input Description...") private String name; - } diff --git a/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java b/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java index 485e360..bd2977a 100644 --- a/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java +++ b/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java @@ -61,6 +61,7 @@ public interface IResidentAndDisabledService { * @return Map */ Map findJudgeResults(final JudgeListDto dto); + Map findJudgeResults2(final JudgeListDto dto); /** * 거주자 / 장애인 심의대상 목록 조회 diff --git a/src/main/java/com/xit/biz/ctgy/service/impl/ResidentAndDisabledService.java b/src/main/java/com/xit/biz/ctgy/service/impl/ResidentAndDisabledService.java index da583f2..29b106b 100644 --- a/src/main/java/com/xit/biz/ctgy/service/impl/ResidentAndDisabledService.java +++ b/src/main/java/com/xit/biz/ctgy/service/impl/ResidentAndDisabledService.java @@ -240,6 +240,57 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { return resultMap; } + @Override + @Transactional(readOnly = true) + public Map findJudgeResults2(JudgeListDto dto) { + Map resultMap = new HashMap<>(); + + // team && 팀별 부과현황 조회 : 팀이 선택되지 않은 경우 모두 +// Map teamMap = residentAndDisabledMapper.selectTotJudgeResultGroupByTeamAndChasu(dto); +// if (Checks.isEmpty(teamMap)) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND); +// List> totJudgeUserList = residentAndDisabledMapper.selectTotJudgeResultGroupByUser(dto); +// totJudgeUserList.add(teamMap); + + List> teamList = residentAndDisabledMapper.selectJudgeTeamGroupByChasuAndTeamList(dto); + if (Checks.isEmpty(teamList) || teamList.size() == 0) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND); + + // 차수별 심사자별 심사결과 합산 + dto.setMsuTeam(String.valueOf(teamList.get(0).get("msuTeam"))); + List> totJudgeUserList = residentAndDisabledMapper.selectTotJudgeResultGroupByUser(dto); + totJudgeUserList.add(teamList.get(0)); + + // 심사대상 차량 목록 + List> judgeCarList = residentAndDisabledMapper.selectJudgeResultGroupByCarnum(dto); + + // 차량별 심사자 심사결과 목록 + Map paramMap = new HashMap<>(); + paramMap.put("msDatagb", dto.getMsDatagb()); + paramMap.put("msChasu", dto.getMsChasu()); + paramMap.put("msSdate", dto.getMsSdate()); + paramMap.put("msEdate", dto.getMsEdate()); + paramMap.put("msuTeam", dto.getMsuTeam()); + + paramMap.put("seqList", judgeCarList.stream().map(m -> m.get("msSeq")).collect(Collectors.toList())); + paramMap.put("carnumList", judgeCarList.stream().map(m -> m.get("msCarnum")).collect(Collectors.toList())); + List> jurgeUserList = residentAndDisabledMapper.selectJudgeResultList(paramMap); + +// List> resultList = judgeCarList.stream().peek((m) -> { +// paramMap.put("msSeq", m.get("msSeq")); +// paramMap.put("msCarnum", m.get("msCarnum")); +// m.put("simsa", residentAndDisabledMapper.selectJudgeResultList(paramMap)); +// }).collect(Collectors.toList()); + + + resultMap.put("teamList", teamList); + // 차수별 심사자별 심사결과 합산 + resultMap.put("totJudgeUserData", totJudgeUserList); + // 심사대상 차량 목록 + resultMap.put("judgeCarData", judgeCarList); + // 차량별 심사자 심사결과 목록 + resultMap.put("judgeUserData", jurgeUserList); + return resultMap; + } + /** * 심사자료 삭제 * 1. 삭제 대상 조회 : min_simsa680_sc 테이블 : ms_datagb, ms_chasu, ms_sdate, ms_edate 조건으로 ms_maincode 삭제 대상 조회 diff --git a/src/main/java/com/xit/core/config/support/JasyptConfig.java b/src/main/java/com/xit/core/config/support/JasyptConfig.java new file mode 100644 index 0000000..2ae0571 --- /dev/null +++ b/src/main/java/com/xit/core/config/support/JasyptConfig.java @@ -0,0 +1,29 @@ +package com.xit.core.config.support; + +import org.jasypt.encryption.StringEncryptor; +import org.jasypt.encryption.pbe.PooledPBEStringEncryptor; +import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class JasyptConfig { + + @Bean(name = "jasyptStringEncryptor") + public StringEncryptor stringEncryptor() { + + String key = "xit_jasypt_key"; + PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor(); + SimpleStringPBEConfig config = new SimpleStringPBEConfig(); + config.setPassword(key); // 암호화할 때 사용하는 키 + config.setAlgorithm("PBEWithMD5AndDES"); // 암호화 알고리즘 + config.setKeyObtentionIterations("1000"); // 반복할 해싱 회수 + config.setPoolSize("1"); // 인스턴스 pool + config.setProviderName("SunJCE"); + config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator"); // salt 생성 클래스 + config.setStringOutputType("base64"); //인코딩 방식 + + encryptor.setConfig(config); + return encryptor; + } +} \ No newline at end of file diff --git a/src/main/java/com/xit/core/init/XitFrameworkApplicationCommandLineRunner.java b/src/main/java/com/xit/core/init/XitFrameworkApplicationCommandLineRunner.java index 31622ef..8192586 100644 --- a/src/main/java/com/xit/core/init/XitFrameworkApplicationCommandLineRunner.java +++ b/src/main/java/com/xit/core/init/XitFrameworkApplicationCommandLineRunner.java @@ -1,6 +1,7 @@ package com.xit.core.init; import lombok.extern.slf4j.Slf4j; +import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; import org.springframework.boot.CommandLineRunner; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.DelegatingPasswordEncoder; @@ -22,10 +23,27 @@ public class XitFrameworkApplicationCommandLineRunner implements CommandLineRunn log.info("XitFrameworkApplicationCommandLineRunner Args: " + Arrays.toString(args)); log.info("====================================================================================="); - System.out.println(new BCryptPasswordEncoder().encode("gnadmin")); + //System.out.println(new BCryptPasswordEncoder().encode("gnadmin")); //System.out.println(new SCryptPasswordEncoder().encode("gnadmin")); //System.out.println(new DelegatingPasswordEncoder().encode("gnadmin", "")); - System.out.println(new Pbkdf2PasswordEncoder().encode("gnadmin")); + //System.out.println(new Pbkdf2PasswordEncoder().encode("gnadmin")); + String url = "jdbc:oracle:thin:@211.119.124.118:1521:bustms"; + String username = "traffic"; + String password = "xhdgkq0"; + + System.out.println(jasyptEncoding(url)); + System.out.println(jasyptEncoding(username)); + System.out.println(jasyptEncoding(password)); + } + + + private String jasyptEncoding(String value) { + + String key = "xit_jasypt_key"; + StandardPBEStringEncryptor pbeEnc = new StandardPBEStringEncryptor(); + pbeEnc.setAlgorithm("PBEWithMD5AndDES"); + pbeEnc.setPassword(key); + return pbeEnc.encrypt(value); } } diff --git a/src/main/resources/config/application-dev.yml b/src/main/resources/config/application-dev.yml index 15e695f..db0fc99 100644 --- a/src/main/resources/config/application-dev.yml +++ b/src/main/resources/config/application-dev.yml @@ -18,16 +18,19 @@ spring: # ================================================================================================================== datasource: driver-class-name: oracle.jdbc.OracleDriver - url: jdbc:oracle:thin:@211.119.124.118:1521:bustms - username: traffic - password: xhdgkq0 +# url: jdbc:oracle:thin:@211.119.124.118:1521:bustms +# username: traffic +# password: xhdgkq0 + url: ENC(Du4NMmmioRvKPEusb8MiTTvNaXVoTItupOvD6qDhkeJv8vJKgdQuYR1pfx6EiejdZxw42ihrilk=) + username: ENC(MtR2JPkVe/qAf4+4ov5Oaw==) + password: ENC(6DJ2lcMsftlVjv1Ddc4d2w==) hikari: driver-class-name: ${spring.datasource.driver-class-name} jdbc-url: ${spring.datasource.url} password: ${spring.datasource.password} username: ${spring.datasource.username} read-only: false - + # ================================================================================================================== # JPA setting # ================================================================================================================== diff --git a/src/main/resources/config/application.yml b/src/main/resources/config/application.yml index 7c98541..810bf96 100644 --- a/src/main/resources/config/application.yml +++ b/src/main/resources/config/application.yml @@ -127,6 +127,10 @@ spring: devtools: livereload: enabled: true + + jasypt: + encryptor: + bean: jasyptStringEncryptor # ================================================================================================================== # spring-doc setting diff --git a/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml b/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml index dbb4f41..951ad85 100644 --- a/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml +++ b/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml @@ -46,7 +46,13 @@ @@ -96,8 +102,8 @@ , min_userinfo MU WHERE MS.ms_maincode = MSU.msu_maincode AND MS.ms_chasu = #{msChasu} - AND MS.ms_sdate >= #{msSdate} - AND MS.ms_edate <= #{msEdate} + AND MS.ms_sdate = #{msSdate} + AND MS.ms_edate = #{msEdate} AND MSU.msu_userid = MU.userid AND MSU.msu_team = #{msuTeam} @@ -115,12 +121,13 @@ , min_simsa_user680 MSU WHERE MS.ms_maincode = MSU.msu_maincode AND MS.ms_chasu = #{msChasu} - AND MS.ms_sdate >= #{msSdate} - AND MS.ms_edate <= #{msEdate} + AND MS.ms_sdate = #{msSdate} + AND MS.ms_edate = #{msEdate} AND MSU.msu_team = #{msuTeam} GROUP BY MS.ms_maincode, MS.ms_seq, MS.ms_carnum + ORDER BY MS.ms_maincode, MS.ms_seq, MS.ms_carnum