feat : 심사자 심사 반영

dev
minuk926 3 years ago
parent cad34d48bb
commit 1ddc6c695e

@ -9,6 +9,8 @@ import com.xit.core.annotation.Secured;
import com.xit.core.annotation.SecurityPolicy;
import com.xit.core.api.IRestResponse;
import com.xit.core.api.RestResponse;
import com.xit.core.util.AssertUtils;
import com.xit.core.util.Checks;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
@ -113,5 +115,32 @@ public class ParkingController {
//---------------------------------------------------------------------------------
// 심사자
//---------------------------------------------------------------------------------
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "심사자별 주정차 의견진술 심의목록 조회" , description = "심사자별 주정차 의견진술 심의목록 조회")
@GetMapping(value = "/judge", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> findByUserJudges() {
return RestResponse.of(service.findByUserJudges());
}
@Secured(policy = SecurityPolicy.TOKEN)
@Operation(summary = "주정차 의견진술 심의 결과 저장" , description = "주정차 의견진술 심의 결과 저장")
@Parameters({
@Parameter(in = ParameterIn.QUERY, name = "msuCode", description = "심사코드", required = true, example = " "),
@Parameter(in = ParameterIn.QUERY, name = "msuResult", description = "심사결과코드", required = true, example = "1"),
@Parameter(in = ParameterIn.QUERY, name = "msuReason", description = "심사사유", required = true, example = " ")
})
@PostMapping(value="/judge", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<? extends IRestResponse> saveJudgeResult(
@Valid
@RequestBody
@Parameter(hidden = true)
final JudgeListDto dto) {
AssertUtils.isTrue(!Checks.isEmpty(dto), "필수 조건이 입력되지 않았습니다.");
AssertUtils.isTrue(!Checks.isEmpty(dto.getMsuCode()), "심사코드 값은 필수입니다(PK)");
AssertUtils.isTrue(!Checks.isEmpty(dto.getMsuResult()), "심사결과는 필수입니다(1-수용,2-미수용)");
AssertUtils.isTrue(!Checks.isEmpty(dto.getMsuReason()), "심의사유는 필수입니다");
service.saveJudgeResult(dto);
return RestResponse.of(HttpStatus.OK);
}
}

@ -3,10 +3,20 @@ package com.xit.biz.ctgy.repository;
import com.xit.biz.ctgy.entity.MinSimsaUser680;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.time.LocalDate;
public interface IParkingJudgeUserRepository extends JpaRepository<MinSimsaUser680, Long> {
@Modifying
int deleteByMsuMaincode(Long maincode);
@Modifying
@Query(value = "UPDATE #{#entityName} m SET m.msuReason = :msuReason, m.msuResult = :msuResult, m.msuIndate = :msuIndate WHERE m.msuCode = :msuCode")
int updateMsuResonAndMsuResultByMsuCode(@Param("msuCode")Long msuCode,
@Param("msuResult")String msuResult,
@Param("msuReason")String msuReason,
@Param("msuIndate") LocalDate msuIndate);
}

@ -14,6 +14,10 @@ public interface IParkingRepositoryCustom {
List<ParkingTargetDto> findParkingJudgeTargets(final ParkingTargetDto dto);
//Page<MinSimsaReviewGroupDto> findMinSimsa680s2(Pageable pageable);
//---------------------------------------------------------------------------------
// 심사자
//---------------------------------------------------------------------------------
List<JudgeListDto> findByUserJudges();
}

@ -10,6 +10,7 @@ import com.xit.biz.ctgy.CtgyConstants;
import com.xit.biz.ctgy.dto.JudgeListDto;
import com.xit.biz.ctgy.dto.ParkingTargetDto;
import com.xit.biz.ctgy.entity.MinSimsa680;
import com.xit.core.oauth2.utils.HeaderUtil;
import com.xit.core.util.Checks;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
@ -151,14 +152,47 @@ public class IParkingRepositoryImpl implements IParkingRepositoryCustom {
return rslt;
}
// private BooleanExpression startDateGt(LocalDate sDate){
// if(sDate == null) return null;
// return minSimsa680.msSdate.gt(sDate);
// }
//
// private BooleanExpression endDateGt(LocalDate eDate){
// if(eDate == null) return null;
// return minSimsa680.msEdate.gt(eDate);
// }
//---------------------------------------------------------------------------------
// 심사자
//---------------------------------------------------------------------------------
@Override
public List<JudgeListDto> findByUserJudges() {
BooleanBuilder builder = new BooleanBuilder();
builder.and(minSimsaUser680.msuUserid.eq(HeaderUtil.getUserId()));
//TODO : 테스트를 위행 임시로 코멘트 처리
//builder.and(minSimsa680.msResult.eq(CtgyConstants.Judge.RESULT_JUDGE_PRE.getCode()));
return queryFactory
.select(Projections.fields(
JudgeListDto.class,
minSimsa680.msMaincode,
minSimsa680.msSeq,
minSimsa680.msCarnum,
minSimsa680.msResult,
minSimsa680.msYear,
minSimsa680.msChasu,
minSimsa680.msSdate,
minSimsa680.msStartsi,
minSimsa680.msEdate,
minSimsa680.msCdate,
minSimsa680.msClosesi,
minSimsaUser680.msuCode,
minSimsaUser680.msuResult,
minSimsaUser680.msuReason,
tf680Main.mmWdate.as("msWdate")
//tf680Recall.scPos
))
.from(minSimsa680)
.join(minSimsaUser680)
.on(minSimsa680.msMaincode.eq(minSimsaUser680.msuMaincode))
.join(tf680Recall)
.on(minSimsa680.msMaincode.eq(tf680Recall.rcCode))
.join(tf680Main)
.on(tf680Recall.rcMaincode.eq(tf680Main.mmCode))
.where(builder)
.orderBy(minSimsa680.msSdate.asc(), minSimsa680.msEdate.asc(), minSimsa680.msSeq.asc())
.fetch();
}
}

@ -324,8 +324,7 @@ public class IResidentAndDisabledRepositoryImpl implements IResidentAndDisabledR
BooleanBuilder builder = new BooleanBuilder();
builder.and(minSimsa680Sc.msDatagb.eq(dto.getMsDatagb()));
builder.and(minSimsaUser680Sc.msuUserid.eq(HeaderUtil.getUserId()));
// TODO : 테스트를 위해 임시로 코멘트 처리
// 심의전
//TODO : 테스트를 위행 임시로 코멘트 처리
//builder.and(minSimsa680Sc.msResult.eq(CtgyConstants.Judge.RESULT_JUDGE_PRE.getCode()));
return queryFactory

@ -27,8 +27,11 @@ public interface IParkingService {
void removeParkingJudge(final ParkingTargetDto dto);
// Page<MinSimsaReviewGroupDto> findMinSimsa680s2(final MinSimsa680 minSimsa680, Pageable pageable);
//---------------------------------------------------------------------------------
// 심사자
//---------------------------------------------------------------------------------
List<JudgeListDto> findByUserJudges();
// MinSimsa680 saveParking(final MinSimsa680 toEntity);
void saveJudgeResult(JudgeListDto dto);
}

@ -19,6 +19,9 @@ import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -167,4 +170,21 @@ public class ParkingService implements IParkingService {
});
}
//---------------------------------------------------------------------------------
// 심사자
//---------------------------------------------------------------------------------
@Override
@Transactional(readOnly = true)
public List<JudgeListDto> findByUserJudges() {
return repository.findByUserJudges();
}
@Override
@Transactional
public void saveJudgeResult(JudgeListDto dto){
parkingJudgeUserRepository.updateMsuResonAndMsuResultByMsuCode(dto.getMsuCode(),
dto.getMsuResult(),
dto.getMsuReason(),
LocalDate.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))));
}
}

Loading…
Cancel
Save