260615_02_ENH: kon 관련 매퍼 추가
This commit is contained in:
@@ -2,6 +2,7 @@ package com.kri.gwcf.review.back.controller;
|
|||||||
|
|
||||||
import com.kri.common.feature.datetime.DateTimeUtil;
|
import com.kri.common.feature.datetime.DateTimeUtil;
|
||||||
import com.kri.common.feature.web.RequestUserContext;
|
import com.kri.common.feature.web.RequestUserContext;
|
||||||
|
import com.kri.gwcf.review.back.service.AssignService;
|
||||||
import com.kri.gwcf.review.back.service.common.SystemEventLogService;
|
import com.kri.gwcf.review.back.service.common.SystemEventLogService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@@ -18,13 +19,14 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@Tag(name = "Assign", description = "배정 API")
|
@Tag(name = "Assign", description = "배정 API")
|
||||||
public class AssignController {
|
public class AssignController {
|
||||||
|
|
||||||
|
private final AssignService assignService;
|
||||||
private final SystemEventLogService systemEventLogService;
|
private final SystemEventLogService systemEventLogService;
|
||||||
|
|
||||||
@Operation(summary = "참여 동의")
|
@Operation(summary = "참여 동의")
|
||||||
@PostMapping("/confirm/{userId}")
|
@PostMapping("/confirm/{userId}")
|
||||||
public boolean assignConfirm(@PathVariable String userId, RequestUserContext ctx) {
|
public boolean assignConfirm(@PathVariable String userId, RequestUserContext ctx) {
|
||||||
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
final LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||||
|
//TODO: 기능 구현 필요
|
||||||
systemEventLogService.writeAssignConfirmLog(userId, now, ctx.getClientIp());
|
systemEventLogService.writeAssignConfirmLog(userId, now, ctx.getClientIp());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.kri.gwcf.review.back.dto.kon;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Schema(description = "KON 공연 신청 수")
|
||||||
|
public class PerformanceApplyCountDto {
|
||||||
|
|
||||||
|
@Schema(description = "공연 ID")
|
||||||
|
private String performanceId;
|
||||||
|
|
||||||
|
@Schema(description = "신청 수")
|
||||||
|
private Long applyCnt;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.kri.gwcf.review.back.persistence.mapper.kon;
|
||||||
|
|
||||||
|
import com.kri.gwcf.review.back.dto.kon.PerformanceApplyCountDto;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface KonMapper {
|
||||||
|
|
||||||
|
List<PerformanceApplyCountDto> findPerformanceApplyCount(
|
||||||
|
@Param("surveyType") String surveyType
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ import com.kri.gwcf.review.back.dto.common.CodeDto;
|
|||||||
import com.kri.gwcf.review.back.dto.excel.ExcelErrorDto;
|
import com.kri.gwcf.review.back.dto.excel.ExcelErrorDto;
|
||||||
import com.kri.gwcf.review.back.dto.excel.ExcelUploadResultDto;
|
import com.kri.gwcf.review.back.dto.excel.ExcelUploadResultDto;
|
||||||
import com.kri.gwcf.review.back.dto.excel.PerformanceUploadDto;
|
import com.kri.gwcf.review.back.dto.excel.PerformanceUploadDto;
|
||||||
|
import com.kri.gwcf.review.back.dto.kon.PerformanceApplyCountDto;
|
||||||
import com.kri.gwcf.review.back.dto.performance.PerformanceCompactDto;
|
import com.kri.gwcf.review.back.dto.performance.PerformanceCompactDto;
|
||||||
import com.kri.gwcf.review.back.dto.performance.PerformanceFullDto;
|
import com.kri.gwcf.review.back.dto.performance.PerformanceFullDto;
|
||||||
import com.kri.gwcf.review.back.dto.performance.PerformanceMonitoringScheduleDto;
|
import com.kri.gwcf.review.back.dto.performance.PerformanceMonitoringScheduleDto;
|
||||||
@@ -22,6 +23,7 @@ import com.kri.gwcf.review.back.persistence.entity.TPerformanceDetailEntity;
|
|||||||
import com.kri.gwcf.review.back.persistence.entity.TPerformanceEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceEntity;
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TPerformanceMonitoringScheduleEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceMonitoringScheduleEntity;
|
||||||
import com.kri.gwcf.review.back.persistence.entity.TPerformanceStaffEntity;
|
import com.kri.gwcf.review.back.persistence.entity.TPerformanceStaffEntity;
|
||||||
|
import com.kri.gwcf.review.back.persistence.mapper.kon.KonMapper;
|
||||||
import com.kri.gwcf.review.back.persistence.repository.PerformanceDetailRepository;
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceDetailRepository;
|
||||||
import com.kri.gwcf.review.back.persistence.repository.PerformanceMonitoringScheduleRepository;
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceMonitoringScheduleRepository;
|
||||||
import com.kri.gwcf.review.back.persistence.repository.PerformanceRepository;
|
import com.kri.gwcf.review.back.persistence.repository.PerformanceRepository;
|
||||||
@@ -38,6 +40,7 @@ import java.util.Objects;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -46,6 +49,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class PerformanceService {
|
public class PerformanceService {
|
||||||
|
|
||||||
|
private final KonMapper konMapper;
|
||||||
private final PerformanceRepository performanceRepository;
|
private final PerformanceRepository performanceRepository;
|
||||||
private final PerformanceDetailRepository performanceDetailRepository;
|
private final PerformanceDetailRepository performanceDetailRepository;
|
||||||
private final PerformanceStaffRepository performanceStaffRepository;
|
private final PerformanceStaffRepository performanceStaffRepository;
|
||||||
@@ -55,6 +59,9 @@ public class PerformanceService {
|
|||||||
private final ReviewService reviewService;
|
private final ReviewService reviewService;
|
||||||
private final VisitService visitService;
|
private final VisitService visitService;
|
||||||
|
|
||||||
|
@Value("${kon.survey-type:LIST}")
|
||||||
|
private String surveyType;
|
||||||
|
|
||||||
public PerformanceFullDto getPerformance(Integer performanceId) {
|
public PerformanceFullDto getPerformance(Integer performanceId) {
|
||||||
TPerformanceEntity performance = getPerformanceEntity(performanceId);
|
TPerformanceEntity performance = getPerformanceEntity(performanceId);
|
||||||
return toFullDto(performance);
|
return toFullDto(performance);
|
||||||
@@ -200,6 +207,11 @@ public class PerformanceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true, transactionManager = "konTransactionManager")
|
||||||
|
public List<PerformanceApplyCountDto> findPerformanceApplyCount() {
|
||||||
|
return konMapper.findPerformanceApplyCount(surveyType);
|
||||||
|
}
|
||||||
|
|
||||||
private PerformanceFullDto toFullDto(TPerformanceEntity performance) {
|
private PerformanceFullDto toFullDto(TPerformanceEntity performance) {
|
||||||
Integer performanceId = performance.getId();
|
Integer performanceId = performance.getId();
|
||||||
|
|
||||||
|
|||||||
@@ -4,4 +4,7 @@ spring:
|
|||||||
url: jdbc:mysql://db-md87m.vpc-cdb.ntruss.com:3306/test_gwcf_review?characterEncoding=UTF-8&rewriteBatchedStatements=true
|
url: jdbc:mysql://db-md87m.vpc-cdb.ntruss.com:3306/test_gwcf_review?characterEncoding=UTF-8&rewriteBatchedStatements=true
|
||||||
username: prjct_gwcf
|
username: prjct_gwcf
|
||||||
password: gwcf#260608
|
password: gwcf#260608
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
|
||||||
|
kon:
|
||||||
|
survey-type: TEST
|
||||||
|
|||||||
@@ -22,4 +22,7 @@ logging:
|
|||||||
org.hibernate.SQL: DEBUG
|
org.hibernate.SQL: DEBUG
|
||||||
#org.hibernate.orm.jdbc.bind: TRACE
|
#org.hibernate.orm.jdbc.bind: TRACE
|
||||||
#org.hibernate.orm.jdbc.extract: TRACE
|
#org.hibernate.orm.jdbc.extract: TRACE
|
||||||
org.hibernate.engine.jdbc.batch.internal: DEBUG
|
org.hibernate.engine.jdbc.batch.internal: DEBUG
|
||||||
|
|
||||||
|
kon:
|
||||||
|
survey-type: TEST
|
||||||
|
|||||||
@@ -4,4 +4,7 @@ spring:
|
|||||||
url: jdbc:mysql://db-md87m.vpc-cdb.ntruss.com:3306/prjct_gwcf_review?characterEncoding=UTF-8&rewriteBatchedStatements=true
|
url: jdbc:mysql://db-md87m.vpc-cdb.ntruss.com:3306/prjct_gwcf_review?characterEncoding=UTF-8&rewriteBatchedStatements=true
|
||||||
username: prjct_gwcf
|
username: prjct_gwcf
|
||||||
password: gwcf#260608
|
password: gwcf#260608
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
|
||||||
|
kon:
|
||||||
|
survey-type: LIST
|
||||||
|
|||||||
26
src/main/resources/mybatis/mapper/kon/KonMapper.xml
Normal file
26
src/main/resources/mybatis/mapper/kon/KonMapper.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"https://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.kri.gwcf.review.back.persistence.mapper.kon.KonMapper">
|
||||||
|
|
||||||
|
<select id="findPerformanceApplyCount" resultType="PerformanceApplyCountDto">
|
||||||
|
SELECT performance_id, COUNT(1) AS apply_cnt
|
||||||
|
FROM (
|
||||||
|
SELECT DISTINCT
|
||||||
|
JSON_VALUE(DJ.[VALUE], '$.SC') AS IDKEY,
|
||||||
|
DV.[value] AS performance_id
|
||||||
|
FROM [DATA] DA WITH(NOLOCK)
|
||||||
|
CROSS APPLY OPENJSON([DATJSON]) DJ
|
||||||
|
CROSS APPLY OPENJSON(DJ.[value]) DV
|
||||||
|
WHERE PKEY = '2605013_B'
|
||||||
|
AND [Status] = 10
|
||||||
|
AND JSON_VALUE(DJ.[VALUE], '$.SC') IS NOT NULL
|
||||||
|
AND DV.[KEY] LIKE 'Q1%'
|
||||||
|
AND [SURVEY_TYPE] = #{surveyType}
|
||||||
|
) A
|
||||||
|
GROUP BY performance_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user