diff --git a/src/main/java/com/xit/biz/ctgy/CtgyConstants.java b/src/main/java/com/xit/biz/ctgy/CtgyConstants.java new file mode 100644 index 0000000..2eab432 --- /dev/null +++ b/src/main/java/com/xit/biz/ctgy/CtgyConstants.java @@ -0,0 +1,78 @@ +package com.xit.biz.ctgy; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +public class CtgyConstants { + + + /** + * 민원 + */ + @Getter + @AllArgsConstructor + public enum Recall { + // 접수(전송) 상태 + RC_IR_TRANSFER_NONE("1", "미접수(미전송)"), + RC_IR_TRANSFER_ACCEPT("2", "접수(전송)"), + // 민원구분 + RC_GB_DECL("1", "의견진술"), + // 민원구분 : 이의신청 + RC_GB_OBJECTION("2", "이의신청"), + // 심의결과(0:심의전, 1:미부과, 2:재판독, 3:심의제외-OCR수납등록에서 생성, 5:부과, 7:자진취하, 8:법원이송, 9:경찰이첩) + RC_STATE_INIT("0", "심의전"), + + ; + + private final String code; + private final String desc; + } + + /** + * 메인 + */ + @Getter + @AllArgsConstructor + public enum Main { + // 과태료코드 + MM_DBGB_PARK("11", "주정차위반과태료"), + MM_DBGD_BUS("12", "버스전용차로취만과태료"), + // 민원구분 + RC_GB_DECL("1", "의견진술"), + RC_GB_OBJECTION("2", "이의신청"), + // 10:단속,11:부과,12:독촉,13:압류예정,21:압류,49:대납,51:자납,52:수시분수납,53:독촉분수납,54:압류예정분수납,55:압류해제수납,61:시효결손취소수납,62:불납결손취소수납,65:충당수납,71:서손,72:의견진술수용,73:이의신청수용,74:부과취소,75:자납고지부과등록,81:시효결손,82:불납결손,91:법원이송,92:경찰서이첩,98:면제차량,99:삭제자료) + MM_LSTATE_75("75", "자납고지부과등록"), + ; + + private final String code; + private final String desc; + } + + @Getter + @AllArgsConstructor + public enum UserInfo { + // 사용여부 + ISENABLED_NONE("0", "미사용"), + ISENABLED_USE("1", "사용"), + // 사용자구분 + ACCESSTYPE_ADMIN("001", "관리자"), + ACCESSTYPE_SIMSA("002", "심사자") + ; + + private final String code; + private final String desc; + } + + @Getter + @AllArgsConstructor + public enum SimsaUserInfo { + // 결과코드 + MSU_RESULT_NONE("0", "미사용"), + + ; + + private final String code; + private final String desc; + } + +} diff --git a/src/main/java/com/xit/biz/ctgy/dto/MinSimsaTargetDto.java b/src/main/java/com/xit/biz/ctgy/dto/MinSimsaTargetDto.java index 6c9a6d4..bfdb423 100644 --- a/src/main/java/com/xit/biz/ctgy/dto/MinSimsaTargetDto.java +++ b/src/main/java/com/xit/biz/ctgy/dto/MinSimsaTargetDto.java @@ -53,7 +53,6 @@ public class MinSimsaTargetDto { private String rcDate; @Schema(title = "심사시작일", example = "2022-03-23", description = "Input Description...") - //@DateTimeFormat(pattern="yyyy-MM-dd") @JsonFormat(pattern="yyyy-MM-dd") private LocalDate msSdate; @@ -61,12 +60,10 @@ public class MinSimsaTargetDto { private String msStartsi; @Schema(title = "심사종료일", example = "2022-03-24", description = "Input Description...") - //@DateTimeFormat(pattern="yyyy-MM-dd") @JsonFormat(pattern="yyyy-MM-dd") private LocalDate msEdate; @Schema(title = "심사마감일", example = "2022-03-25", description = "Input Description...") - //@DateTimeFormat(pattern="yyyy-MM-dd") @JsonFormat(pattern="yyyy-MM-dd") private LocalDate msCdate; @@ -82,6 +79,10 @@ public class MinSimsaTargetDto { @Schema(title = "전송상태-심사", example = "1", description = "전송상태-1:미전송(미심사), 2:전송(심사)") private String rcIrTransfer; + + //------------------------------------------------------------------ + // 심사대상 저장을 위한 속성 + //------------------------------------------------------------------ @Schema(title = "민원코드목록", example = " ", description = "민원코드목록") private List rcCodes; @@ -93,4 +94,7 @@ public class MinSimsaTargetDto { @Schema(title = "", example = "0", description = "결과코드") private Long msChasu; + + @Schema(title = "팀코드", example = "001", description = "팀코드") + private String msuTeam; } diff --git a/src/main/java/com/xit/biz/ctgy/entity/MinSimsa680.java b/src/main/java/com/xit/biz/ctgy/entity/MinSimsa680.java index 796e27f..5b6dd0c 100644 --- a/src/main/java/com/xit/biz/ctgy/entity/MinSimsa680.java +++ b/src/main/java/com/xit/biz/ctgy/entity/MinSimsa680.java @@ -2,10 +2,7 @@ package com.xit.biz.ctgy.entity; import com.xit.biz.cmm.entity.CmmUser; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.Generated; -import lombok.NoArgsConstructor; +import lombok.*; import javax.persistence.*; import java.io.Serializable; @@ -13,10 +10,12 @@ import java.util.HashSet; import java.util.Set; @Schema(name = "MinSimsa680", description = "민원심사") -@NoArgsConstructor -@Data -@Entity @Table(name = "min_simsa680", schema = "", catalog = "") +@Entity +@Getter +@NoArgsConstructor +@AllArgsConstructor +@Builder public class MinSimsa680 { //implements Serializable { //private static final long SerialVersionUID = 1L; diff --git a/src/main/java/com/xit/biz/ctgy/entity/MinSimsaUser680.java b/src/main/java/com/xit/biz/ctgy/entity/MinSimsaUser680.java index e0022eb..5653c3b 100644 --- a/src/main/java/com/xit/biz/ctgy/entity/MinSimsaUser680.java +++ b/src/main/java/com/xit/biz/ctgy/entity/MinSimsaUser680.java @@ -20,6 +20,7 @@ public class MinSimsaUser680 implements Serializable { private static final long SerialVersionUID = 1L; @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = " MIN_SIMSA_USER680_SEQ") @Schema(required = true, title = "민원심사사용자매핑코드", example = " ", description = "Input Description...") @Column(name = "msu_code", nullable = false, length = 10) private Long msuCode; diff --git a/src/main/java/com/xit/biz/ctgy/repository/IMinUserRepository.java b/src/main/java/com/xit/biz/ctgy/repository/IMinUserRepository.java index 8da0a65..233c83a 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IMinUserRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IMinUserRepository.java @@ -1,5 +1,6 @@ package com.xit.biz.ctgy.repository; +import com.xit.biz.ctgy.CtgyConstants; import com.xit.biz.ctgy.entity.MinUserinfo; import com.xit.core.oauth2.utils.SecurityUtil; import org.springframework.data.jpa.repository.JpaRepository; @@ -7,6 +8,7 @@ import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.transaction.annotation.Transactional; +import java.util.List; import java.util.Optional; public interface IMinUserRepository extends JpaRepository { @@ -20,4 +22,9 @@ public interface IMinUserRepository extends JpaRepository { String queryGetPasswd(@Param("userid") final String userid); MinUserinfo findMinUserinfoByUserid(final String userid); + + //------------------------------------------------------------------------- + // 주정차위반 심사대상 등록 - 등록 대상 심사자 조회 + //------------------------------------------------------------------------- + List findAllByTeamAndIsenableAndAccesstype(String msuTeam, CtgyConstants.UserInfo isenabledUse, CtgyConstants.UserInfo accesstypeSimsa); } \ No newline at end of file diff --git a/src/main/java/com/xit/biz/ctgy/repository/ITf680RecallRepository.java b/src/main/java/com/xit/biz/ctgy/repository/IRecallRepository.java similarity index 52% rename from src/main/java/com/xit/biz/ctgy/repository/ITf680RecallRepository.java rename to src/main/java/com/xit/biz/ctgy/repository/IRecallRepository.java index 5fe7ac5..6fa81b4 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/ITf680RecallRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IRecallRepository.java @@ -1,8 +1,7 @@ package com.xit.biz.ctgy.repository; -import com.xit.biz.ctgy.entity.MinInfoBoard680; import com.xit.biz.ctgy.entity.Tf680Recall; import org.springframework.data.jpa.repository.JpaRepository; -public interface ITf680RecallRepository extends JpaRepository { +public interface IRecallRepository extends JpaRepository { } diff --git a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java b/src/main/java/com/xit/biz/ctgy/repository/ISimsaRepository.java similarity index 90% rename from src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java rename to src/main/java/com/xit/biz/ctgy/repository/ISimsaRepository.java index 998c7ea..4c7da86 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/ISimsaRepository.java @@ -1,18 +1,14 @@ package com.xit.biz.ctgy.repository; -import com.xit.biz.ctgy.dto.MinSimsaTargetDto; import com.xit.biz.ctgy.entity.MinSimsa680; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import javax.annotation.Nonnull; -import java.sql.Date; import java.time.LocalDate; -import java.util.List; -import java.util.Map; -public interface IParkingRepository extends JpaRepository, IParkingRepositoryCustom { +public interface ISimsaRepository extends JpaRepository, ISimsaRepositoryCustom { @Query(value="insert into min_simsa680(" + "ms_maincode, " + diff --git a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryCustom.java b/src/main/java/com/xit/biz/ctgy/repository/ISimsaRepositoryCustom.java similarity index 87% rename from src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryCustom.java rename to src/main/java/com/xit/biz/ctgy/repository/ISimsaRepositoryCustom.java index 93c7f22..a6a0415 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryCustom.java +++ b/src/main/java/com/xit/biz/ctgy/repository/ISimsaRepositoryCustom.java @@ -6,11 +6,10 @@ import com.xit.biz.ctgy.dto.MinSimsaTargetDto; import com.xit.biz.ctgy.entity.MinSimsa680; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; -import org.springframework.data.jpa.repository.Query; import java.util.List; -public interface IParkingRepositoryCustom { +public interface ISimsaRepositoryCustom { Page findSimsas(final MinSimsa680GroupDto pMinSimsa680GroupDto, Pageable pageable); List findSimsaDetails(final MinSimsa680GroupDto minSimsa680GroupDto); diff --git a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryImpl.java b/src/main/java/com/xit/biz/ctgy/repository/ISimsaRepositoryImpl.java similarity index 95% rename from src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryImpl.java rename to src/main/java/com/xit/biz/ctgy/repository/ISimsaRepositoryImpl.java index 1eafeda..2b9c2be 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryImpl.java +++ b/src/main/java/com/xit/biz/ctgy/repository/ISimsaRepositoryImpl.java @@ -7,6 +7,7 @@ import com.querydsl.core.types.Projections; import com.querydsl.core.types.dsl.CaseBuilder; import com.querydsl.jpa.JPAExpressions; import com.querydsl.jpa.impl.JPAQueryFactory; +import com.xit.biz.ctgy.CtgyConstants; import com.xit.biz.ctgy.dto.MinSimsa680GroupDto; import com.xit.biz.ctgy.dto.MinSimsaReviewGroupDto; import com.xit.biz.ctgy.dto.MinSimsaTargetDto; @@ -27,7 +28,7 @@ import static com.xit.biz.ctgy.entity.QTf680Main.tf680Main; import static com.xit.biz.ctgy.entity.QTf680Recall.tf680Recall; @RequiredArgsConstructor -public class IParkingRepositoryImpl implements IParkingRepositoryCustom { +public class ISimsaRepositoryImpl implements ISimsaRepositoryCustom { private final JPAQueryFactory queryFactory; @@ -103,13 +104,13 @@ public class IParkingRepositoryImpl implements IParkingRepositoryCustom { BooleanBuilder builder = new BooleanBuilder(); // 과태료 코드 : 11-'주정차위반과태료 12-버스전용차로위반과태료 - builder.and(tf680Main.mmDbgb.eq("11")); + builder.and(tf680Main.mmDbgb.eq(CtgyConstants.Main.MM_DBGB_PARK.getCode())); // 10:단속,11:부과,12:독촉,13:압류예정,21:압류,49:대납,51:자납,52:수시분수납,53:독촉분수납,54:압류예정분수납,55:압류해제수납,61:시효결손취소수납,62:불납결손취소수납,65:충당수납,71:서손,72:의견진술수용,73:이의신청수용,74:부과취소,75:자납고지부과등록,81:시효결손,82:불납결손,91:법원이송,92:경찰서이첩,98:면제차량,99:삭제자료) - builder.and(tf680Main.mmLstate.ne(Long.valueOf(75))); + builder.and(tf680Main.mmLstate.ne(Long.valueOf(CtgyConstants.Main.MM_LSTATE_75.getCode()))); // 민원 구분 : 1-의견진술 2-이의신청 - builder.and(tf680Recall.rcGb.eq("1")); + builder.and(tf680Recall.rcGb.eq(CtgyConstants.Recall.RC_GB_DECL.getCode())); // 심의결과(0:심의전, 1:미부과, 2:재판독, 3:심의제외-OCR수납등록에서 생성, 5:부과, 7:자진취하, 8:법원이송, 9:경찰이첩) - builder.and(tf680Recall.rcState.eq("0")); + builder.and(tf680Recall.rcState.eq(CtgyConstants.Recall.RC_STATE_INIT.getCode())); builder.and(tf680Recall.rcIrTransfer.eq(dto.getRcIrTransfer())); builder.and(tf680Recall.rcSeq.gt(dto.getRcSeq1())); builder.and(tf680Recall.rcSeq.lt(dto.getRcSeq2())); diff --git a/src/main/java/com/xit/biz/ctgy/repository/ISimsaUserRepository.java b/src/main/java/com/xit/biz/ctgy/repository/ISimsaUserRepository.java new file mode 100644 index 0000000..0bb31e5 --- /dev/null +++ b/src/main/java/com/xit/biz/ctgy/repository/ISimsaUserRepository.java @@ -0,0 +1,7 @@ +package com.xit.biz.ctgy.repository; + +import com.xit.biz.ctgy.entity.MinSimsaUser680; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface ISimsaUserRepository extends JpaRepository { +} diff --git a/src/main/java/com/xit/biz/ctgy/service/impl/ParkingService.java b/src/main/java/com/xit/biz/ctgy/service/impl/ParkingService.java index 4333ca3..a89fd55 100644 --- a/src/main/java/com/xit/biz/ctgy/service/impl/ParkingService.java +++ b/src/main/java/com/xit/biz/ctgy/service/impl/ParkingService.java @@ -1,11 +1,18 @@ package com.xit.biz.ctgy.service.impl; +import com.xit.biz.ctgy.CtgyConstants; import com.xit.biz.ctgy.dto.MinSimsa680GroupDto; import com.xit.biz.ctgy.dto.MinSimsaReviewGroupDto; import com.xit.biz.ctgy.dto.MinSimsaTargetDto; import com.xit.biz.ctgy.entity.MinSimsa680; +import com.xit.biz.ctgy.entity.MinSimsaUser680; +import com.xit.biz.ctgy.entity.MinUserinfo; +import com.xit.biz.ctgy.entity.Tf680Recall; import com.xit.biz.ctgy.mapper.IParkingMapper; -import com.xit.biz.ctgy.repository.IParkingRepository; +import com.xit.biz.ctgy.repository.IMinUserRepository; +import com.xit.biz.ctgy.repository.ISimsaRepository; +import com.xit.biz.ctgy.repository.IRecallRepository; +import com.xit.biz.ctgy.repository.ISimsaUserRepository; import com.xit.biz.ctgy.service.IParkingService; import com.xit.core.support.jpa.JpaUtil; import lombok.RequiredArgsConstructor; @@ -13,12 +20,12 @@ import org.springframework.data.domain.Example; import org.springframework.data.domain.ExampleMatcher; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; -import org.springframework.data.jpa.repository.Modifying; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Nonnull; import java.util.List; +import java.util.stream.Collectors; import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains; @@ -26,7 +33,10 @@ import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatc @RequiredArgsConstructor public class ParkingService implements IParkingService { - private final IParkingRepository repository; + private final ISimsaRepository simsaRepository; + private final IRecallRepository recallRepository; + private final IMinUserRepository userRepository; + private final ISimsaUserRepository simsaUserRepository; private final IParkingMapper mapper; @Override @@ -37,7 +47,7 @@ public class ParkingService implements IParkingService { .withMatcher("ciTitle", contains()) .withMatcher("ciName", contains()); Example example = Example.of(entity, exampleMatcher); - Page page = repository.findAll(example, pageable); + Page page = simsaRepository.findAll(example, pageable); // List userList = page.getContent(); return page; } @@ -45,22 +55,23 @@ public class ParkingService implements IParkingService { @Override @Transactional(readOnly = true) public Page findSimsas(final MinSimsa680GroupDto minSimsa680GroupDto, Pageable pageable) { - return repository.findSimsas(minSimsa680GroupDto, pageable); + return simsaRepository.findSimsas(minSimsa680GroupDto, pageable); } @Override @Transactional(readOnly = true) public List findSimsaDetails(final MinSimsa680GroupDto minSimsa680GroupDto) { - return repository.findSimsaDetails(minSimsa680GroupDto); + return simsaRepository.findSimsaDetails(minSimsa680GroupDto); } @Override @Transactional(readOnly = true) public List findSimsaTargets(MinSimsaTargetDto dto) { - return repository.findSimsaTargets(dto); + return simsaRepository.findSimsaTargets(dto); } @Override + @Transactional public List saveParkingSimsaTargets(MinSimsaTargetDto dto) { boolean isFirst = true; @@ -73,21 +84,49 @@ public class ParkingService implements IParkingService { isFirst = false; } + // 심사대상 등록 mapper.insertSimsaTargetIntoSelect(dto); + // 등록된 심사대상 데이타 등록 상태 변경 : 미접수 -> 접수수 + Tf680Recall recallEntity = recallRepository.findById(dto.getRcCode()).orElseGet(Tf680Recall::new); + recallEntity.setRcIrTransfer(CtgyConstants.Recall.RC_IR_TRANSFER_ACCEPT.getCode()); + JpaUtil.saveIfNullId(recallEntity.getRcCode(), recallRepository, recallEntity); + + // 심사자 등록 + List userinfoList = userRepository.findAllByTeamAndIsenableAndAccesstype( + dto.getMsuTeam(), + CtgyConstants.UserInfo.ISENABLED_USE, + CtgyConstants.UserInfo.ACCESSTYPE_SIMSA); + + List simsaUserList = userinfoList.stream().map(u -> + MinSimsaUser680.builder() + .msuMaincode(rcCode) + .msuUserid(u.getUserid()) + .msuResult(CtgyConstants.SimsaUserInfo.MSU_RESULT_NONE.getCode()) + //.msuReason() + .msuTeam(dto.getMsuTeam()) + //.msuIndate() + .build() + ).collect(Collectors.toList()); + simsaUserRepository.saveAll(simsaUserList); + } - return repository.findSimsaTargets(dto); + + +// userinfoList.stream().forEach(user => simsaRepository.save(MinSimsa680)); +// simsaRepository.save + return simsaRepository.findSimsaTargets(dto); } @Override @Transactional(readOnly = true) public Page findMinSimsa680s2(MinSimsa680 minSimsa680, Pageable pageable) { - return repository.findMinSimsa680s2(pageable); + return simsaRepository.findMinSimsa680s2(pageable); } @Override public MinSimsa680 saveParkingSimsa(MinSimsa680 entity) { - return repository.saveAndFlush(entity); + return simsaRepository.saveAndFlush(entity); } } diff --git a/src/main/java/com/xit/core/support/jpa/JpaUtil.java b/src/main/java/com/xit/core/support/jpa/JpaUtil.java index 201f7e4..0e2b1dd 100644 --- a/src/main/java/com/xit/core/support/jpa/JpaUtil.java +++ b/src/main/java/com/xit/core/support/jpa/JpaUtil.java @@ -4,6 +4,7 @@ import com.xit.core.util.Checks; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; +import org.springframework.data.jpa.repository.JpaRepository; import java.util.Objects; @@ -24,4 +25,14 @@ public class JpaUtil { // if(Checks.isEmpty(sort)) return PageRequest.of(limit*(page-1), limit); // else return PageRequest.of(limit*(page-1), limit, Objects.requireNonNull(sort)); } + + @SuppressWarnings("rawtypes") + public static void saveIfNullId(Long id, JpaRepository repository, Object entity) { + if(id == null) repository.save(entity); + } + + @SuppressWarnings("rawtypes") + public static void saveIfNullId(String id, JpaRepository repository, Object entity) { + if(id == null) repository.save(entity); + } } 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 f41df20..4fe6e6f 100644 --- a/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml +++ b/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml @@ -41,4 +41,26 @@ join tf680_dong TD on TJ.mj_dong = TD.do_code + + + /* parking-mapper|insertSimsaTargetIntoSelect|julim */ + /* + insert + into min_simsa_user680( + msu_code, + msu_maincode, + msu_userid, + msu_result, + msu_reason, + msu_team, + msu_indate + ) select min_simsa680_seq.nextval, + TR.rc_code, + #{userid}, + #{msuResult}, + #{msuReason}, + #{msuTeam}, + #{msuIndate} +*/ + \ No newline at end of file