diff --git a/src/main/java/com/xit/biz/ctgy/CtgyConstants.java b/src/main/java/com/xit/biz/ctgy/CtgyConstants.java index 05a0880..fbd0f53 100644 --- a/src/main/java/com/xit/biz/ctgy/CtgyConstants.java +++ b/src/main/java/com/xit/biz/ctgy/CtgyConstants.java @@ -20,8 +20,8 @@ public class CtgyConstants { // 심의결과코드 RESULT_JUDGE_PRE("0", "심의전"), - RESULT_JUDGE_IMPOSE("0", "부과"), - RESULT_JUDGE_NON_IMPOSE("0", "미부과"), + RESULT_JUDGE_IMPOSE("1", "부과"), + RESULT_JUDGE_NON_IMPOSE("2", "미부과"), // 데이타구분 DATAGB_RESIDENT("1", "거주자"), DATAGB_DISABLED("2", "장애인") diff --git a/src/main/java/com/xit/biz/ctgy/controller/ResidentAndDisabledController.java b/src/main/java/com/xit/biz/ctgy/controller/ResidentAndDisabledController.java index 77d5950..ddbddcf 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/ResidentAndDisabledController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/ResidentAndDisabledController.java @@ -2,6 +2,7 @@ package com.xit.biz.ctgy.controller; import com.xit.biz.ctgy.dto.GnRecallScDto; import com.xit.biz.ctgy.dto.JudgeListDto; +import com.xit.biz.ctgy.dto.JudgeStdDto; import com.xit.biz.ctgy.dto.JudgeTargetDto; import com.xit.biz.ctgy.dto.struct.GnRecallScMapstruct; import com.xit.biz.ctgy.service.IResidentAndDisabledService; @@ -164,18 +165,17 @@ public class ResidentAndDisabledController { return RestResponse.of(service.findJudgeResults(dto)); } - @Secured(policy = SecurityPolicy.TOKEN) - @Operation(summary = "거주자/장애인 의견진술 심의 자료 삭제" , description = "거주자/장애인 의견진술 심의 자료 삭제") - @PostMapping(value="/admin/remove", produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity removeJudge( + //@Secured(policy = SecurityPolicy.TOKEN) + @Operation(summary = "관리자 심사기준 적용 심사 처리" , description = "관리자 심사기준 적용 심사 처리") + @PostMapping(value="/admin/judge", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity saveJudgeStds( @Valid @RequestBody - final JudgeListDto dto) { - service.removeJudge(dto); + final JudgeStdDto dto) { + service.saveJudgeStds(dto); return RestResponse.of(HttpStatus.OK); } - //--------------------------------------------------------------------------------- // 심사자 //--------------------------------------------------------------------------------- diff --git a/src/main/java/com/xit/biz/ctgy/dto/JudgeStdDto.java b/src/main/java/com/xit/biz/ctgy/dto/JudgeStdDto.java new file mode 100644 index 0000000..d9528cc --- /dev/null +++ b/src/main/java/com/xit/biz/ctgy/dto/JudgeStdDto.java @@ -0,0 +1,43 @@ +package com.xit.biz.ctgy.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.validation.constraints.Size; +import java.util.List; +import java.util.Map; + +@Schema(name = "JudgeStdDto", description = "심사기준적용DTO") +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class JudgeStdDto { + + @Schema(required = true, title = "데이타구분", example = " ", description = "데이타구분") + private String dataGb; + + @Schema(required = true, title = "심사기준(명수)", example = "", description = "4") + private int judgeStdCnt; + + @Schema(required = true, title = "심사대상키목록", example = "", description = "") + private List> judgeDataKeys; + //private List> judgeDataKeys; + + static class JudgeDataKey { + @Schema(title = "민원코드", example = " ", description = "민원코드") + private Long msMaincode; + @Schema(title = "접수번호", example = " ", description = "접수번호") + private String msSeq; + } +} + +//class JudgeDataKey { +// @Schema(title = "민원코드", example = " ", description = "민원코드") +// private Long msMaincode; +// @Schema(title = "접수번호", example = " ", description = "접수번호") +// private String msSeq; +//} diff --git a/src/main/java/com/xit/biz/ctgy/repository/IJudgeRepository.java b/src/main/java/com/xit/biz/ctgy/repository/IJudgeRepository.java index 0de4b8e..70180e0 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IJudgeRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IJudgeRepository.java @@ -14,4 +14,8 @@ public interface IJudgeRepository extends JpaRepository { @Query(value = "SELECT e.msMaincode FROM #{#entityName} e WHERE e.msDatagb = :msDatagb AND e.msChasu = :msChasu AND e.msSdate >= :msSdate AND e.msEdate <= :msEdate") List findAllMsMaincode(@Param("msDatagb") String msDatagb, @Param("msChasu") Long msChasu, @Param("msSdate") LocalDate msSdate, @Param("msEdate")LocalDate msEdate); + + @Modifying + @Query(value = "UPDATE #{#entityName} m SET m.msResult = :msResult WHERE m.msMaincode = :msMaincode AND m.msSeq = :msSeq") + int updateMsResult(@Param("msMaincode") final Long msMaincode, @Param("msSeq") final String msSeq, @Param("msResult") final String msResult); } diff --git a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java b/src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java index 4d75a02..7808b98 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java @@ -2,6 +2,7 @@ package com.xit.biz.ctgy.repository; import com.xit.biz.ctgy.entity.MinSimsa680; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; @@ -13,4 +14,7 @@ public interface IParkingRepository extends JpaRepository, IP @Query(value = "SELECT e.msMaincode FROM #{#entityName} e WHERE e.msChasu = :msChasu AND e.msSdate >= :msSdate AND e.msEdate <= :msEdate") List findAllMsMaincode(@Param("msChasu") Long msChasu, @Param("msSdate")LocalDate msSdate, @Param("msEdate")LocalDate msEdate); + @Modifying + @Query(value = "UPDATE #{#entityName} m SET m.msResult = :msResult WHERE m.msMaincode = :msMaincode AND m.msSeq = :msSeq") + int updateMsResult(@Param("msMaincode") final Long msMaincode, @Param("msSeq") final String msSeq, @Param("msResult") final String msResult); } diff --git a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryCustom.java b/src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryCustom.java index 312ac5f..7e261be 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryCustom.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryCustom.java @@ -14,6 +14,8 @@ public interface IParkingRepositoryCustom { List findParkingJudgeTargets(final ParkingTargetDto dto); + int getJudgeStdCnt(final Long msMaincode); + //--------------------------------------------------------------------------------- // 심사자 //--------------------------------------------------------------------------------- diff --git a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryImpl.java b/src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryImpl.java index d922753..b525076 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryImpl.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryImpl.java @@ -21,7 +21,9 @@ import java.util.List; import static com.xit.biz.cmm.entity.QCmmCodeS.cmmCodeS; import static com.xit.biz.ctgy.entity.QMinSimsa680.minSimsa680; +import static com.xit.biz.ctgy.entity.QMinSimsa680Sc.minSimsa680Sc; import static com.xit.biz.ctgy.entity.QMinSimsaUser680.minSimsaUser680; +import static com.xit.biz.ctgy.entity.QMinSimsaUser680Sc.minSimsaUser680Sc; import static com.xit.biz.ctgy.entity.QMinUserinfo.minUserinfo; import static com.xit.biz.ctgy.entity.QTf680Main.tf680Main; import static com.xit.biz.ctgy.entity.QTf680Recall.tf680Recall; @@ -152,6 +154,18 @@ public class IParkingRepositoryImpl implements IParkingRepositoryCustom { return rslt; } + @Override + public int getJudgeStdCnt(final Long msMaincode){ + return queryFactory.select(minSimsaUser680.msuCode) + .from(minSimsaUser680) + .where( + minSimsaUser680.msuMaincode.eq(msMaincode), + minSimsaUser680.msuResult.eq(CtgyConstants.Judge.RESULT_JUDGE_IMPOSE.getCode()) + ) + .fetch() + .size(); + } + //--------------------------------------------------------------------------------- // 심사자 //--------------------------------------------------------------------------------- diff --git a/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryCustom.java b/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryCustom.java index ef445b8..e036b7a 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryCustom.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryCustom.java @@ -56,6 +56,8 @@ public interface IResidentAndDisabledRepositoryCustom { */ List findJudgeTargets(final JudgeTargetDto dto); + int getJudgeStdCnt(final Long msMaincode); + //--------------------------------------------------------------------------------- // 심사자 //--------------------------------------------------------------------------------- diff --git a/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryImpl.java b/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryImpl.java index d1e2f55..f2aa2d0 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryImpl.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryImpl.java @@ -259,6 +259,18 @@ public class IResidentAndDisabledRepositoryImpl implements IResidentAndDisabledR return queryResidentJudgeTargets(dto.getScDatagb(), stateCond, dto.getScTransfer(), dto.getScSeq1(), dto.getScSeq2()); } + @Override + public int getJudgeStdCnt(final Long msMaincode){ + return queryFactory.select(minSimsaUser680Sc.msuCode) + .from(minSimsaUser680Sc) + .where( + minSimsaUser680Sc.msuMaincode.eq(msMaincode), + minSimsaUser680Sc.msuResult.eq(CtgyConstants.Judge.RESULT_JUDGE_IMPOSE.getCode()) + ) + .fetch() + .size(); + } + private List queryResidentJudgeTargets(String dataGb, String state, String transfer, Long seq1, Long seq2){ return queryFactory .select(Projections.fields(JudgeTargetDto.class, 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 bff4dcb..485e360 100644 --- a/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java +++ b/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java @@ -2,6 +2,7 @@ package com.xit.biz.ctgy.service; import com.xit.biz.ctgy.dto.GnRecallScDto; import com.xit.biz.ctgy.dto.JudgeListDto; +import com.xit.biz.ctgy.dto.JudgeStdDto; import com.xit.biz.ctgy.dto.JudgeTargetDto; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -76,6 +77,7 @@ public interface IResidentAndDisabledService { void removeJudge(final JudgeListDto dto); + void saveJudgeStds(final JudgeStdDto 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 39e812a..da583f2 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 @@ -4,14 +4,12 @@ import com.xit.biz.cmm.service.ICmmFileService; import com.xit.biz.ctgy.CtgyConstants; import com.xit.biz.ctgy.dto.GnRecallScDto; import com.xit.biz.ctgy.dto.JudgeListDto; +import com.xit.biz.ctgy.dto.JudgeStdDto; import com.xit.biz.ctgy.dto.JudgeTargetDto; import com.xit.biz.ctgy.dto.struct.GnRecallScMapstruct; import com.xit.biz.ctgy.entity.*; import com.xit.biz.ctgy.mapper.IResidentAndDisabledMapper; -import com.xit.biz.ctgy.repository.IJudgeRepository; -import com.xit.biz.ctgy.repository.IJudgeUserRepository; -import com.xit.biz.ctgy.repository.IMinUserRepository; -import com.xit.biz.ctgy.repository.IResidentAndDisabledRepository; +import com.xit.biz.ctgy.repository.*; import com.xit.biz.ctgy.service.IResidentAndDisabledService; import com.xit.core.constant.ErrorCode; import com.xit.core.exception.CustomBaseException; @@ -62,6 +60,8 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { private final IJudgeRepository judgeRepository; private final IResidentAndDisabledMapper residentAndDisabledMapper; + private final IParkingRepository parkingRepository; + private final ICmmFileService fileService; private final EntityManager entityManager; @@ -263,6 +263,35 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { }); } + @Override + @Transactional + public void saveJudgeStds(final JudgeStdDto dto) { + int stdCnt = dto.getJudgeStdCnt(); + + dto.getJudgeDataKeys().forEach(map -> { + int cnt = 0; + Long msMaincode = Long.valueOf(map.get("msMaincode").toString()); + String msSeq = map.get("msSeq").toString(); + + // 미부과 + String msResult = CtgyConstants.Judge.RESULT_JUDGE_NON_IMPOSE.getCode(); + // 주정차 심사 + if (Checks.isEmpty(dto.getDataGb())) { + cnt = parkingRepository.getJudgeStdCnt(msMaincode); + if(cnt >= stdCnt) msResult = CtgyConstants.Judge.RESULT_JUDGE_IMPOSE.getCode(); + + parkingRepository.updateMsResult(msMaincode, msSeq, msResult); + + // 거주자 장애인 심사 + } else { + cnt = gnReacallRepository.getJudgeStdCnt(msMaincode); + if(cnt >= stdCnt) msResult = CtgyConstants.Judge.RESULT_JUDGE_IMPOSE.getCode(); + + judgeRepository.updateMsResult(msMaincode, msSeq, msResult); + } + }); + } + private void setFileInfoAndFileUpload(GnRecallScDto dto, MultipartFile[] mfs, String setMethodName) { String makePath = fileService.uploadFiles(mfs, rootPath, CtgyConstants.Judge.DATAGB_RESIDENT.getCode().equals(dto.getScDatagb())? uploadPath[0] : uploadPath[1]); //makePath = makePath + File.separator; diff --git a/src/main/resources/config/conf.yml b/src/main/resources/config/conf.yml index 2cb251b..2f77382 100644 --- a/src/main/resources/config/conf.yml +++ b/src/main/resources/config/conf.yml @@ -12,7 +12,7 @@ xit: # api response logging 여부 api: reponse: - logging: false + logging: true file: cmm: