Merge branch 'dev' into deploy-dev-admin

This commit is contained in:
kangsunlee
2025-07-21 13:31:59 +09:00
21 changed files with 188 additions and 51 deletions

View File

@@ -6,11 +6,9 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableCaching
@EnableScheduling
@ComponentScan(basePackages = "app.module")
public class AdminApplication extends SpringBootServletInitializer {

View File

@@ -3,7 +3,9 @@ package app.module.admin.config.application.batch;
import app.module.admin.usecase.batchLog.ports.BatchLogPortIn;
import app.module.admin.usecase.batchLog.ports.application.domain.BatchLogType;
import app.module.core.config.application.logging.SafeLogger;
import java.net.UnknownHostException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -21,16 +23,24 @@ public class BatchLogRunner {
return;
}
String hostName;
try {
hostName = java.net.InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
hostName = "UNKNOWN";
safeLogger.warn("호스트 이름 조회 실패", e);
}
// 실행 로그 insert (RUNNING)
Long logId = batchLogPortIn.create(batchType);
Long logId = batchLogPortIn.create(batchType, hostName);
try {
action.run();
// 성공 처리
batchLogPortIn.update(logId, "SUCCESS", null);
batchLogPortIn.update(logId, hostName,"SUCCESS", null);
} catch (Exception e) {
// 실패 처리
batchLogPortIn.update(logId, "FAIL", e.getMessage());
batchLogPortIn.update(logId, hostName,"FAIL", e.getMessage());
safeLogger.error("[{}] 배치 실패: {}", batchType.name(), e.getMessage(), e);
}
}

View File

@@ -0,0 +1,21 @@
package app.module.admin.config.application.bean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
@Configuration
@EnableScheduling
public class SchedulingConfig {
@Bean
public ThreadPoolTaskScheduler taskScheduler() {
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
scheduler.setPoolSize(5);
scheduler.setThreadNamePrefix("scheduled-task-");
scheduler.setWaitForTasksToCompleteOnShutdown(true);
scheduler.setAwaitTerminationSeconds(60);
return scheduler;
}
}

View File

@@ -19,14 +19,19 @@ class BatchLogDao implements BatchLogPortOut {
}
@Override
public Long create(BatchLogType type) {
BatchLogCmd cmd = new BatchLogCmd(null, type.name(), "RUNNING", LocalDateTime.now());
public Long create(BatchLogType type, String hostName) {
BatchLogCmd cmd = new BatchLogCmd(null, type.name(), "RUNNING", LocalDateTime.now(), hostName);
mapper.create(cmd);
return cmd.getId();
}
@Override
public void update(Long id, String status, String errorMessage) {
mapper.update(id, status, errorMessage);
public void createError(BatchLogType type, String hostName, String status, String errorMessage) {
mapper.createError(type.name(), hostName, status, errorMessage);
}
@Override
public void update(Long id, String hostName, String status, String errorMessage) {
mapper.update(id, hostName, status, errorMessage);
}
}

View File

@@ -7,5 +7,6 @@ import org.apache.ibatis.annotations.Mapper;
public interface BatchLogMapper {
boolean exists(String type);
Long create(BatchLogCmd cmd);
void update(Long id, String status, String errorMessage);
Long createError(String type, String hostName, String status, String errorMessage);
void update(Long id, String hostName, String status, String errorMessage);
}

View File

@@ -4,6 +4,7 @@ import app.module.admin.usecase.batchLog.ports.application.domain.BatchLogType;
public interface BatchLogPortIn {
boolean exists(BatchLogType type);
Long create(BatchLogType type);
void update(Long id, String status, String errorMessage);
Long create(BatchLogType type, String hostName);
void createError(BatchLogType type, String hostName, String status, String errorMessage);
void update(Long id, String hostName, String status, String errorMessage);
}

View File

@@ -4,6 +4,7 @@ import app.module.admin.usecase.batchLog.ports.application.domain.BatchLogType;
public interface BatchLogPortOut {
boolean exists(BatchLogType type);
Long create(BatchLogType type);
void update(Long id, String status, String errorMessage);
Long create(BatchLogType type, String hostName);
void createError(BatchLogType type, String hostName, String status, String errorMessage);
void update(Long id, String hostName, String status, String errorMessage);
}

View File

@@ -17,12 +17,17 @@ class BatchLogService implements BatchLogPortIn {
}
@Override
public Long create(BatchLogType type) {
return portOut.create(type);
public Long create(BatchLogType type, String hostName) {
return portOut.create(type, hostName);
}
@Override
public void update(Long id, String status, String errorMessage) {
portOut.update(id, status, errorMessage);
public void createError(BatchLogType type, String hostName, String status, String errorMessage) {
portOut.createError(type, hostName, status, errorMessage);
}
@Override
public void update(Long id, String hostName, String status, String errorMessage) {
portOut.update(id, hostName, status, errorMessage);
}
}

View File

@@ -16,4 +16,5 @@ public class BatchLogCmd {
private String type;
private String status;
private LocalDateTime startAt;
private String hostName;
}

View File

@@ -10,4 +10,5 @@ public interface CreateHouseholdMapper {
Integer createHousehold(CreateHouseholdOutCmd outCmd);
void createHouseholdHasRole(CreateHouseholdHasRoleCmd cmd);
void createResearcherHasHousehold(CreateResearcherHasHouseholdCmd cmd);
void createHouseholdMonthlyInputStatus();
}

View File

@@ -131,6 +131,8 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
}
}
workbook.close();
createHouseholdMapper.createHouseholdMonthlyInputStatus();
return new ExcelUploadResultVO(sheet.getLastRowNum()-1 , success, errorList);
}
@@ -149,6 +151,20 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
if (cell == null) return null;
return switch (cell.getCellType()) {
case NUMERIC -> (int) cell.getNumericCellValue();
case STRING -> {
try {
yield Integer.parseInt(cell.getStringCellValue().trim());
} catch (NumberFormatException e) {
yield null;
}
}
case FORMULA -> {
try {
yield (int) cell.getNumericCellValue();
} catch (Exception e) {
yield null;
}
}
default -> null;
};
}
@@ -195,7 +211,9 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
private Boolean getIsPanel(Cell cell){
if (cell == null) return null;
String[] isPanel = cell.getStringCellValue().trim().split("\\.");
return "1".equals(isPanel[0]) || "유지".equals(isPanel[1]);
if(isPanel.length == 1 ) return "1".equals(isPanel[0]) || "유지".equals(isPanel[0]);
if(isPanel.length == 2 ) return "1".equals(isPanel[0]) || "유지".equals(isPanel[1]);
return false;
}
private Long getResearcherSeq(Cell cell){

View File

@@ -1,5 +1,7 @@
package app.module.admin.usecase.schedule.autoSchedules.adapters.web;
import app.module.admin.usecase.batchLog.ports.BatchLogPortIn;
import app.module.admin.usecase.batchLog.ports.application.domain.BatchLogType;
import app.module.admin.usecase.schedule.autoSchedules.ports.AutoSchedulesPortIn;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
@@ -10,9 +12,20 @@ import org.springframework.stereotype.Component;
public class AutoSchedulesController {
private final AutoSchedulesPortIn portIn;
private final BatchLogPortIn batchLogPortIn;
private final java.util.Set<String> runningTasks = java.util.concurrent.ConcurrentHashMap.newKeySet();
public AutoSchedulesController(AutoSchedulesPortIn portIn) {
public AutoSchedulesController(AutoSchedulesPortIn portIn, BatchLogPortIn batchLogPortIn) {
this.portIn = portIn;
this.batchLogPortIn = batchLogPortIn;
}
private boolean isAlreadyRunning(String lockKey) {
return !runningTasks.add(lockKey);
}
private void releaseLock(String lockKey) {
runningTasks.remove(lockKey);
}
/**
@@ -20,18 +33,30 @@ public class AutoSchedulesController {
* 매 월 1일 0초 마다 실행되는 스케줄러
*/
//@Scheduled(cron = "0 0 0 1 * *")
@Scheduled(cron = "1 0 0 19,20 * *")
@Scheduled(cron = "0 0 * * * *")
public void fetchMonthlyStatus() {
String lockKey = "fetchMonthlyStatus_" + java.time.LocalDate.now();
try {
String host = java.net.InetAddress.getLocalHost().getHostName();
// 중복 실행 방지를 위한 간단한 체크
if (isAlreadyRunning(lockKey)) {
log.warn("fetchMonthlyStatus가 이미 실행 중입니다. 중복 실행을 건너뜁니다.");
batchLogPortIn.createError(BatchLogType.MONTHLY_STATUS, host, "WARNING", "fetchMonthlyStatus가 이미 실행 중입니다. 중복 실행을 건너뜁니다.");
return;
}
log.info("스케줄 실행 : fetchMonthlyStatus / {} / {} / {} / {}", host, this, + System.identityHashCode(this), Thread.currentThread().getName());
portIn.operate();
} catch (Exception e) {
log.error(e.getMessage(), e);
} finally {
log.info("스케줄 종료 : fetchMonthlyStatus / {}", lockKey);
releaseLock(lockKey);
}
}
@@ -41,16 +66,28 @@ public class AutoSchedulesController {
*/
@Scheduled(cron = "0 0 17 * * ?")
public void fetchSmsAutoSend() {
String lockKey = "fetchSmsAutoSend" + java.time.LocalDate.now();
try {
String host = java.net.InetAddress.getLocalHost().getHostName();
// 중복 실행 방지를 위한 간단한 체크
if (isAlreadyRunning(lockKey)) {
log.warn("fetchSmsAutoSend 이미 실행 중입니다. 중복 실행을 건너뜁니다.");
batchLogPortIn.createError(BatchLogType.AUTO_SMS, host, "WARNING", "fetchSmsAutoSend 이미 실행 중입니다. 중복 실행을 건너뜁니다.");
return;
}
log.info("스케줄 실행 : fetchSmsAutoSend / {} / {} / {} / {}", host, this, + System.identityHashCode(this), Thread.currentThread().getName());
portIn.sendAutoSms();
} catch (Exception e) {
log.error(e.getMessage(), e);
} finally {
log.info("스케줄 종료 : fetchSmsAutoSend / {}", lockKey);
releaseLock(lockKey);
}
}
@@ -59,18 +96,30 @@ public class AutoSchedulesController {
* 매월 16일 0시 0초에 실행되는 스케줄러
*/
// @Scheduled(cron = "0 0 0 16 * *")
@Scheduled(cron = "0 0 0 19,20 * *")
@Scheduled(cron = "0 0 * * * *")
public void fetchMonthlyCarryOver() {
String lockKey = "fetchMonthlyCarryOver_" + java.time.LocalDate.now();
try {
String host = java.net.InetAddress.getLocalHost().getHostName();
// 중복 실행 방지를 위한 간단한 체크
if (isAlreadyRunning(lockKey)) {
log.warn("fetchMonthlyCarryOver가 이미 실행 중입니다. 중복 실행을 건너뜁니다.");
batchLogPortIn.createError(BatchLogType.CARRYOVER, host, "WARNING", "fetchMonthlyCarryOver가 이미 실행 중입니다. 중복 실행을 건너뜁니다.");
return;
}
log.info("스케줄 실행 : fetchMonthlyCarryOver / {} / {} / {} / {}", host, this, + System.identityHashCode(this), Thread.currentThread().getName());
portIn.monthlyCarryOver();
} catch (Exception e) {
log.error(e.getMessage(), e);
} finally {
log.info("스케줄 종료 : fetchMonthlyCarryOver / {}", lockKey);
releaseLock(lockKey);
}
}
}

View File

@@ -23,9 +23,9 @@ spring:
password: ENC(uBHyXdI39UzPNvYNHDGfjmMMuhN83xoP8F3wDq/S9DxizhFwbMeEqa36oZ205CBg)
mms:
driver-class-name: org.postgresql.Driver
jdbc-url: jdbc:postgresql://15.165.180.203:5432/ko_research_hyunjoo
username: hyunjoo
password: hyunjoo1@#4
jdbc-url: ENC(TZ7H8DIFZDbsNp3PRWbz3bkJbjsx3580ljmELMJInASgpiEH66Lb8adpjt5WGXoIdZbHetlgtEFo8F+U8XUa9fjYWNOpiZ+D99XoXJUOP3s=)
username: ENC(cNXntROGOeM115QfLlVhhBz8+qY70eTWwmwLM+7AMslWmfWTq9ZPl4pVnDopJauM)
password: ENC(kUIzqWTu0+bqjYH4Jq9TFOOh3UwY+XVvA2OlT4VXJvxWCas66UNdGRmWDQKri5fI)
maximum-pool-size: 2
minimum-idle: 1

View File

@@ -19,8 +19,18 @@
SELECT nextval('batch_log_seq')
</selectKey>
INSERT INTO batch_log (id, type, status, start_at, created_at)
VALUES (#{id}, #{type}, #{status}, #{startAt}, now())
INSERT INTO batch_log (id, type, status, start_at, created_at, created_host)
VALUES (#{id}, #{type}, #{status}, #{startAt}, now(), #{hostName})
</insert>
<!-- 에러 로그 insert -->
<insert id="createError">
<selectKey keyProperty="id" resultType="long" order="BEFORE">
SELECT nextval('batch_log_seq')
</selectKey>
INSERT INTO batch_log (id, type, status, error_message, start_at, created_at, created_host)
VALUES (#{id}, #{type}, #{status}, #{errorMessage}, now(), now(), #{hostName})
</insert>
<!-- 상태 업데이트 -->
@@ -28,7 +38,8 @@
UPDATE batch_log
SET status = #{status},
error_message = #{errorMessage},
end_at = now()
end_at = now(),
created_host = #{hostName}
WHERE id = #{id}
</update>
</mapper>

View File

@@ -6,7 +6,7 @@
<select id="selectTotalPercentage">
SELECT
COUNT(DISTINCT h.seq) as total_household_count,
COALESCE(ROUND(AVG(cr.completion_rate), 1), 0) AS daily_percent,
COALESCE(ROUND(AVG(cr.current_completion_rate), 1), 0) AS daily_percent,
COUNT(DISTINCT CASE WHEN hv.id IS NOT NULL THEN hv.household_seq END) AS total_visit_count,
COALESCE(ROUND(COUNT(DISTINCT CASE WHEN hv.id IS NOT NULL THEN hv.household_seq end) * 100::numeric / NULLIF(COUNT(DISTINCT h.seq), 0), 1) , 0 ) as visit_percent,
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS total_gift_sent_count,
@@ -27,7 +27,7 @@
<select id="selectTotalPercentageResearcher">
SELECT
COUNT(DISTINCT rhh.household_seq) as total_household_count,
COALESCE(ROUND(AVG(cr.completion_rate), 1), 0) AS daily_percent,
COALESCE(ROUND(AVG(cr.current_completion_rate), 1), 0) AS daily_percent,
COUNT(DISTINCT CASE WHEN hv.id IS NOT NULL THEN hv.household_seq END) AS total_visit_count,
COALESCE(ROUND(COUNT(DISTINCT CASE WHEN hv.id IS NOT NULL THEN hv.household_seq end) * 100::numeric / NULLIF(COUNT(DISTINCT rhh.household_seq), 0), 1),0) as visit_percent,
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS total_gift_sent_count,
@@ -51,7 +51,7 @@
COALESCE(u.code_text, '전체') AS region_name,
COUNT(DISTINCT a.seq) AS researcher_count,
COUNT(DISTINCT rhh.household_seq) AS total_household_count,
COALESCE(ROUND(AVG(v.completion_rate), 1), 0) AS daily_percent,
COALESCE(ROUND(AVG(v.current_completion_rate), 1), 0) AS daily_percent,
COUNT(DISTINCT CASE WHEN hv.id IS NOT NULL THEN hv.household_seq END) AS total_visit_count,
COALESCE(ROUND(COUNT(DISTINCT CASE WHEN hv.id IS NOT NULL THEN hv.household_seq end) * 100::numeric / NULLIF(COUNT(DISTINCT rhh.household_seq),0), 1),0) as visit_percent,
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS total_gift_sent_count,
@@ -91,7 +91,7 @@
NULLIF(a.name,'-') AS researcher_name,
u.code_text AS region_main_code_name,
COUNT(DISTINCT h.seq) AS total_household_count,
COALESCE(ROUND(AVG(cr.completion_rate), 1), 0) AS daily_percent,
COALESCE(ROUND(AVG(cr.current_completion_rate), 1), 0) AS daily_percent,
COUNT(DISTINCT CASE WHEN hv.id IS NOT NULL THEN hv.household_seq END) AS total_visit_count,
COALESCE(ROUND(COUNT(DISTINCT CASE WHEN hv.id IS NOT NULL THEN hv.household_seq END) * 100::numeric / NULLIF(COUNT(DISTINCT h.seq), 0), 1),0) AS visit_percent,
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS total_gift_sent_count,
@@ -121,7 +121,7 @@
COUNT(DISTINCT a.seq) AS researcher_count,
COUNT(DISTINCT rhh.household_seq) AS household_count,
CASE
WHEN COALESCE(AVG(v.completion_rate), 0) > 0 THEN ROUND(COALESCE(AVG(v.completion_rate), 0), 1)
WHEN COALESCE(AVG(v.current_completion_rate), 0) > 0 THEN ROUND(COALESCE(AVG(v.current_completion_rate), 0), 1)
ELSE 0
END AS avg_completion_rate,
COUNT(DISTINCT CASE WHEN hv.id IS NOT NULL THEN hv.household_seq END) AS visit_count,
@@ -160,7 +160,7 @@
'전체' AS region_name,
COUNT(DISTINCT a.seq),
COUNT(DISTINCT rhh.household_seq),
COALESCE(ROUND(AVG(v.completion_rate), 1), 0),
COALESCE(ROUND(AVG(v.current_completion_rate), 1), 0),
COUNT(DISTINCT CASE WHEN hv.id IS NOT NULL THEN hv.household_seq END),
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END),
-1 as order_no
@@ -202,7 +202,7 @@
parent_uicode.code_text AS region_name,
COUNT(DISTINCT rhh.household_seq) AS household_count,
CASE
WHEN AVG(v.completion_rate) > 0 THEN ROUND(AVG(v.completion_rate), 1)
WHEN AVG(v.current_completion_rate) > 0 THEN ROUND(AVG(v.current_completion_rate), 1)
ELSE 0
END AS avg_completion_rate,
COUNT(DISTINCT hv_visit.household_seq) AS visit_count,
@@ -242,7 +242,7 @@
'전체' AS region_detail_name,
'전체' AS region_name,
COUNT(DISTINCT rhh.household_seq) AS household_count,
COALESCE(ROUND(AVG(v.completion_rate), 1), 0),
COALESCE(ROUND(AVG(v.current_completion_rate), 1), 0),
COUNT(DISTINCT hv_visit.household_seq),
COUNT(DISTINCT hv_gift.household_seq),
-1 AS region_order,

View File

@@ -93,4 +93,8 @@
<include refid="common.fields.CreateUpdateBaseValues"/>
)
</insert>
<select id="createHouseholdMonthlyInputStatus">
select fn_monthly_input_status()
</select>
</mapper>

View File

@@ -74,6 +74,7 @@
ajaxUtil._hideWaiting(); // 로딩바 hide
alert("총 "+res.total+"건 중에 "+res.success+"건 등록되었습니다.");
document.querySelector(".modal-excel-household").ui.close();
},
statusCode: {
422: (res) => {

View File

@@ -401,6 +401,7 @@ CREATE TABLE batch_log (
end_at TIMESTAMP,
error_message VARCHAR(2000),
created_at TIMESTAMP DEFAULT now(),
created_host VARCHAR(100),
CONSTRAINT batch_log_pkey PRIMARY KEY (id)
);
@@ -412,6 +413,7 @@ COMMENT ON COLUMN batch_log.start_at IS '배치 시작 시간';
COMMENT ON COLUMN batch_log.end_at IS '배치 종료 시간';
COMMENT ON COLUMN batch_log.error_message IS '에러 메시지 (실패한 경우)';
COMMENT ON COLUMN batch_log.created_at IS '생성일';
COMMENT ON COLUMN batch_log.created_host IS '생성HOST';
@@ -564,7 +566,7 @@ AS SELECT daily_record.household_seq,
-- ============================================
-- DROP VIEW public.v_household_monthly_target_days;
CREATE OR REPLACE VIEW public.v_household_monthly_target_days
AS WITH param_matrix AS (
as WITH param_matrix AS (
SELECT h.seq AS household_seq,
r.record_month,
EXTRACT(day FROM date_trunc('month'::text, to_date(r.record_month::text, 'YYYYMM'::text)::timestamp with time zone) + '1 mon -1 days'::interval)::integer AS last_day
@@ -575,7 +577,8 @@ AS WITH param_matrix AS (
)
SELECT p.household_seq,
p.record_month,
count(*) AS total_day_groups
count(*) AS total_day_groups,
case when to_char(CURRENT_DATE,'YYYYMM')::text = p.record_month then sum(case when to_char(CURRENT_DATE,'dd')::integer >= g.start_day then 1 else 0 end)else count(*) end as current_day_groups
FROM param_matrix p
JOIN daily_day_group g ON g.start_day <= p.last_day
GROUP BY p.household_seq, p.record_month;
@@ -675,14 +678,16 @@ AS WITH ranked_visits AS (
-- ============================================
-- DROP VIEW public.v_monthly_completion_rate;
CREATE OR REPLACE VIEW public.v_monthly_completion_rate
AS SELECT d.household_seq,
as SELECT d.household_seq,
d.record_month,
COALESCE(c.completed_day_groups, 0::bigint) AS completed_day_groups,
d.total_day_groups,
round(COALESCE(c.completed_day_groups, 0::bigint)::numeric * 100::numeric / NULLIF(d.total_day_groups, 0)::numeric, 3) AS completion_rate
FROM v_household_monthly_target_days d
round(COALESCE(c.completed_day_groups, 0::bigint)::numeric * 100::numeric / NULLIF(d.total_day_groups, 0)::numeric, 3) AS completion_rate,
d.current_day_groups,
round(COALESCE(c.completed_day_groups, 0::bigint)::numeric * 100::numeric / NULLIF(d.current_day_groups, 0)::numeric, 3) AS current_completion_rate
FROM v_household_monthly_target_days d
LEFT JOIN v_household_monthly_completed_days c ON d.household_seq = c.household_seq AND d.record_month::text = c.record_month::text
ORDER BY d.household_seq, d.record_month;
ORDER BY d.household_seq, d.record_month;
-- ============================================

View File

@@ -35,7 +35,7 @@ public class DailyForestryService implements DailyForestryPortIn {
@Override
public List<DailyForestryDto> list(DailyForestryUIReqVO reqVO) {
return this.getRefineList(reqVO, false);
return this.getRefineList(reqVO, true);
}
@Override

View File

@@ -13,7 +13,8 @@
<ul class="product-col-list">
<li th:each="item : ${list.content}"
th:classappend="${item.forestProductStatus != MonthStatus.NONE} ? ' complete'">
th:class="|${item?.forestProductStatus == MonthStatus.REGISTERED ? 'complete' :
item?.forestProductStatus == MonthStatus.NOTHING ? 'complete-nodata' : ''}|">
<a th:href="@{/info/monthly/create/{id}(id=${item.id})}">
<p class="list-tit" th:text="${item.koreanMonth}"></p>
<span class="tag" th:text="${item.forestProductStatus.desc}"></span>

View File

@@ -49,7 +49,7 @@
<div id="tel1Id" class="component-select bottom-sheet"
th:data-props-default="${userInfo.tel1}" data-props-type="bottomSheet">
<input type="hidden" name="tel1" th:field="*{tel1}" data-type="select">
<input type="hidden" id="tel1" name="tel1" th:value="${userInfo.tel1}" data-type="select">
<button type="button" class="select-box">
<span class="select-txt"></span>
</button>
@@ -345,7 +345,7 @@
ENV.module.confirmPopup = document.querySelector(".confirmPopup").ui;
const $selectTel = document.querySelector('#tel1Id');
ENV.select.selectTel = new etUI.components.SelectBox();
ENV.select.selectTel = $selectTel.ui;
ENV.select.selectTel.core.init($selectTel, {
selectItemCallback({selectValue, dataValue}){
document.querySelector('#tel1').value = dataValue;
@@ -375,10 +375,14 @@
const errors = [];
if (!form.ownerName.value) errors.push({field: 'ownerName', message: '이름을 입력해 주세요.'});
if (!form.ownerAge.value) errors.push({field: 'ownerAge', message: '연령을 입력해 주세요.'});
if (form.ownerAge.value < 0 || form.ownerAge.value > 120) errors.push({field: 'ownerAge', message: '연령은 0세이상 120세 이하이어야 합니다.'});
if (form.ownerAge.value < 0 || form.ownerAge.value > 120) errors.push({field: 'ownerAge', message: '연령은 0세이상 120세 이하이어야 합니다.'});
if (form.tel1.value || form.tel2.value || form.tel3.value) {
if (!form.tel1.value || !form.tel2.value || !form.tel3.value) {
errors.push({ field: 'tel1', message: '가구 연락처를 모두 입력해 주세요.' });
if (!form.tel1.value || !form.tel2.value) {
errors.push({ field: 'tel2', message: '가구 연락처를 모두 입력해 주세요.' });
} else {
errors.push({ field: 'tel3', message: '가구 연락처를 모두 입력해 주세요.' });
}
} else {
const telRegex = /^(0[2-7][0-9]?)$/; // 지역번호 (예: 02, 031, 032 등)
if (!telRegex.test(form.tel1.value)) errors.push({ field: 'tel1', message: '가구 연락처를 입력해주세요' }); // 유효한 지역번호를 선택해 주세요.