Compare commits
23 Commits
885b97f4bf
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| d6088428cd | |||
| cb16325cca | |||
| f500993ac1 | |||
|
|
85a7a1be6d | ||
|
|
669d1bb0c1 | ||
|
|
0d2f1868fe | ||
|
|
c3555a5f69 | ||
|
|
b04a4ce4f9 | ||
|
|
c6de18850b | ||
|
|
3bb1e244b9 | ||
|
|
91991d85e7 | ||
|
|
d26df41a1b | ||
|
|
d1e529b5b1 | ||
|
|
5adbff0226 | ||
|
|
997f38bf9c | ||
|
|
60b2e8b5c8 | ||
|
|
1b615ddfe5 | ||
|
|
3f74c60266 | ||
|
|
4e8bfcc215 | ||
|
|
18cc8fd146 | ||
|
|
2a51bd0b41 | ||
|
|
d7299d4f5b | ||
|
|
d9a372a3ab |
46
README.md
46
README.md
@@ -184,7 +184,53 @@ spring:
|
|||||||
username: ENC(...)
|
username: ENC(...)
|
||||||
password: ENC(...)
|
password: ENC(...)
|
||||||
```
|
```
|
||||||
|
작성_1 : pom.xml에 의존성추가
|
||||||
|
```pom
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.ulisesbocchio</groupId>
|
||||||
|
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||||
|
<version>3.0.5</version>
|
||||||
|
</dependency>
|
||||||
|
```
|
||||||
|
|
||||||
|
작성_2 : 클래스 생성 후 실행
|
||||||
|
```java
|
||||||
|
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
|
||||||
|
|
||||||
|
public class EncryptTest {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
|
||||||
|
encryptor.setPassword("내Jasypt비번"); // jasypt.encryptor.password 값과 동일
|
||||||
|
encryptor.setAlgorithm("PBEWITHHMACSHA512ANDAES_256"); // 설정에 맞춤
|
||||||
|
|
||||||
|
String plainText = "dbUserPassword"; // 평문
|
||||||
|
String encrypted = encryptor.encrypt(plainText);
|
||||||
|
|
||||||
|
System.out.println("ENC(" + encrypted + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
작성_3 : 암호화 문자열 생성
|
||||||
|
```scss
|
||||||
|
ENC(mF3Z0fgCagFruOk/F2Z2PYzXhwGedE1secfYDgci+ke9z8xFEZ/GWbgXA4XeSq5D...)
|
||||||
|
```
|
||||||
|
작성_4 : 복호화
|
||||||
|
```java
|
||||||
|
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
|
||||||
|
|
||||||
|
public class DecryptTest {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
|
||||||
|
encryptor.setPassword("내Jasypt비번");
|
||||||
|
encryptor.setAlgorithm("PBEWITHHMACSHA512ANDAES_256");
|
||||||
|
|
||||||
|
String encrypted = "mF3Z0fgCagFruOk/..."; // ENC(...) 안쪽
|
||||||
|
String decrypted = encryptor.decrypt(encrypted);
|
||||||
|
|
||||||
|
System.out.println("복호화 결과 = " + decrypted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🗃️ DB 구성
|
## 🗃️ DB 구성
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<name>admin</name>
|
<name>admin</name>
|
||||||
<description>Admin project</description>
|
<description>Admin project</description>
|
||||||
<packaging>${packaging.type}</packaging>
|
<packaging>war</packaging>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
95
admin/src/main/java/app/module/admin/BulkUrlShortener.java
Normal file
95
admin/src/main/java/app/module/admin/BulkUrlShortener.java
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
package app.module.admin;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.net.http.*;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.*;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
public class BulkUrlShortener {
|
||||||
|
|
||||||
|
private static final String ISGD_API = "https://is.gd/create.php?format=json&url=";
|
||||||
|
private static final ObjectMapper MAPPER = new ObjectMapper();
|
||||||
|
private static final HttpClient CLIENT = HttpClient.newBuilder()
|
||||||
|
.connectTimeout(Duration.ofSeconds(10))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
|
||||||
|
// 🔹 단축할 URL 목록 (여기만 교체!)
|
||||||
|
// 🔹 대상 SID 목록
|
||||||
|
List<Integer> sidList = Arrays.asList(
|
||||||
|
80303, 80308, 80309, 80310, 80312, 80313, 80314,
|
||||||
|
80316, 80317, 80318, 80319, 80322, 80323, 80324, 80325,
|
||||||
|
80327, 80328, 80329, 80330, 80331, 80332, 80333, 80334,
|
||||||
|
80336, 80337, 80338, 80339, 80340, 80343, 80344, 80346,
|
||||||
|
80347, 80348, 80349, 80350, 80351, 80352
|
||||||
|
);
|
||||||
|
|
||||||
|
List<String> urls = new ArrayList<>();
|
||||||
|
for (Integer sid : sidList) {
|
||||||
|
urls.add("https://kon.kric.com/project/2509018_B/INDEX.asp?SID=" + sid);
|
||||||
|
}
|
||||||
|
// for (int i = 80001; i <= 81575; i++) {
|
||||||
|
// urls.add("https://kon.kric.com/project/2509018_B/INDEX.asp?SID=" + i);
|
||||||
|
// }
|
||||||
|
|
||||||
|
Map<String, String> results = new LinkedHashMap<>();
|
||||||
|
int delayMillis = 400; // 0.4초 간격 (안전한 호출 속도)
|
||||||
|
int success = 0;
|
||||||
|
|
||||||
|
System.out.println("총 " + urls.size() + "개의 URL 단축을 시작합니다...\n");
|
||||||
|
|
||||||
|
for (int i = 0; i < urls.size(); i++) {
|
||||||
|
String longUrl = urls.get(i);
|
||||||
|
try {
|
||||||
|
String shortUrl = shorten(longUrl);
|
||||||
|
results.put(longUrl, shortUrl);
|
||||||
|
success++;
|
||||||
|
System.out.printf("[%4d/%4d] %s -> %s%n", success, urls.size(), longUrl, shortUrl);
|
||||||
|
} catch (Exception e) {
|
||||||
|
results.put(longUrl, "ERROR");
|
||||||
|
System.err.printf("[ERROR] %s : %s%n", longUrl, e.getMessage());
|
||||||
|
}
|
||||||
|
Thread.sleep(delayMillis);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("\n✅ 작업 완료: " + success + "개 단축 완료");
|
||||||
|
saveCsv(results);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String shorten(String longUrl) throws IOException, InterruptedException {
|
||||||
|
String encoded = URLEncoder.encode(longUrl, StandardCharsets.UTF_8);
|
||||||
|
String apiUrl = ISGD_API + encoded;
|
||||||
|
|
||||||
|
HttpRequest req = HttpRequest.newBuilder()
|
||||||
|
.uri(URI.create(apiUrl))
|
||||||
|
.timeout(Duration.ofSeconds(10))
|
||||||
|
.header("User-Agent", "Java-Bulk-Shortener/1.0")
|
||||||
|
.GET()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
HttpResponse<String> resp = CLIENT.send(req, HttpResponse.BodyHandlers.ofString());
|
||||||
|
if (resp.statusCode() != 200) throw new IOException("HTTP " + resp.statusCode());
|
||||||
|
|
||||||
|
Map<String, Object> map = MAPPER.readValue(resp.body(), Map.class);
|
||||||
|
if (map.get("shorturl") == null) throw new IOException("API error: " + map);
|
||||||
|
return map.get("shorturl").toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void saveCsv(Map<String, String> results) throws IOException {
|
||||||
|
try (PrintWriter pw = new PrintWriter("short_urls.csv", StandardCharsets.UTF_8)) {
|
||||||
|
pw.println("original_url,short_url");
|
||||||
|
for (var e : results.entrySet()) {
|
||||||
|
pw.printf("\"%s\",\"%s\"%n", e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("결과가 short_urls.csv 로 저장되었습니다 ✅");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
package app.module.admin.config.application.security;
|
package app.module.admin.config.application.security;
|
||||||
|
|
||||||
import app.module.core.config.application.enums.AppType;
|
|
||||||
import app.module.core.config.application.enums.OperationLogType;
|
|
||||||
import app.module.core.config.application.util.CommonUtil;
|
import app.module.core.config.application.util.CommonUtil;
|
||||||
import app.module.core.config.application.util.MessageUtil;
|
import app.module.core.config.application.util.MessageUtil;
|
||||||
import app.module.core.usecase.admin.status.ports.AdminUpdateAccountLockPortIn;
|
import app.module.core.usecase.admin.status.ports.AdminUpdateAccountLockPortIn;
|
||||||
|
|||||||
@@ -28,53 +28,50 @@ public class ChartDao implements ChartPortOut {
|
|||||||
private final UICodeListMapper uiCodeListMapper;
|
private final UICodeListMapper uiCodeListMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChartDto selectTotalPercentage(String usageType) {
|
public ChartDto selectTotalPercentage(String usageType, String recordMonth) {
|
||||||
TotalPercentageReqVO reqVO = new TotalPercentageReqVO();
|
TotalPercentageReqVO reqVO = new TotalPercentageReqVO();
|
||||||
|
|
||||||
reqVO.setUsageType(usageType);
|
reqVO.setUsageType(usageType);
|
||||||
|
reqVO.setRecordMonth(recordMonth);
|
||||||
|
|
||||||
LocalDate today = LocalDate.now();
|
String year = recordMonth.substring(0, 4);
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
|
String month = recordMonth.substring(4, 6);
|
||||||
String formattedDate = today.format(formatter);
|
String recordMonthText = year + "년 " + month + "월 현황";
|
||||||
reqVO.setRecordMonth(formattedDate);
|
|
||||||
DateTimeFormatter formatterText = DateTimeFormatter.ofPattern("yyyy년 MM월 현황");
|
|
||||||
String recordMonthText = today.format(formatterText);
|
|
||||||
|
|
||||||
if("ROLE_ADMIN".equals(AdminUtil.getLoginUserRole())) {
|
if ("ROLE_ADMIN".equals(AdminUtil.getLoginUserRole())) {
|
||||||
// 관리자 일경우
|
// 관리자 일경우
|
||||||
return new ChartDto(
|
return new ChartDto(recordMonthText,
|
||||||
recordMonthText,
|
chartMapper.selectTotalPercentage(reqVO, activeProfiles),
|
||||||
chartMapper.selectTotalPercentage(reqVO,activeProfiles),
|
chartMapper.selectLocalRegionPercentage(reqVO, activeProfiles),
|
||||||
chartMapper.selectLocalRegionPercentage(reqVO,activeProfiles),
|
chartMapper.selectLocalRegionResearcherPercentage(reqVO, activeProfiles),
|
||||||
chartMapper.selectLocalRegionResearcherPercentage(reqVO,activeProfiles),
|
uiCodeListMapper.findByParentId("code.region.main", AdminUtil.getLoginUserRole(),
|
||||||
uiCodeListMapper.findByParentId("code.region.main",AdminUtil.getLoginUserRole(),activeProfiles));
|
activeProfiles));
|
||||||
|
|
||||||
} else if("ROLE_LOCAL_INSPECTOR".equals(AdminUtil.getLoginUserRole())) {
|
} else if ("ROLE_LOCAL_INSPECTOR".equals(AdminUtil.getLoginUserRole())) {
|
||||||
// 지방 실사 일경우 실사 지역으로만
|
// 지방 실사 일경우 실사 지역으로만
|
||||||
reqVO.setRegionMainCode(AdminUtil.getLoginUserRegionMainCode());
|
reqVO.setRegionMainCode(AdminUtil.getLoginUserRegionMainCode());
|
||||||
|
|
||||||
return new ChartDto(
|
return new ChartDto(recordMonthText,
|
||||||
recordMonthText,
|
chartMapper.selectTotalPercentage(reqVO, activeProfiles),
|
||||||
chartMapper.selectTotalPercentage(reqVO,activeProfiles),
|
chartMapper.selectLocalRegionPercentage(reqVO, activeProfiles),
|
||||||
chartMapper.selectLocalRegionPercentage(reqVO,activeProfiles),
|
chartMapper.selectLocalRegionResearcherPercentage(reqVO, activeProfiles), null);
|
||||||
chartMapper.selectLocalRegionResearcherPercentage(reqVO,activeProfiles),
|
} else if ("ROLE_LOCAL_INSPECTOR".equals(AdminUtil.getLoginUserRole())) {
|
||||||
null);
|
|
||||||
} else if("ROLE_LOCAL_INSPECTOR".equals(AdminUtil.getLoginUserRole())) {
|
|
||||||
// 조사원 일경우
|
// 조사원 일경우
|
||||||
reqVO.setAdminSeq(AdminUtil.getLoginUserSeq());
|
reqVO.setAdminSeq(AdminUtil.getLoginUserSeq());
|
||||||
return new ChartDto(recordMonthText, chartMapper.selectTotalPercentageResearcher(reqVO,activeProfiles), null,null,null);
|
return new ChartDto(recordMonthText,
|
||||||
|
chartMapper.selectTotalPercentageResearcher(reqVO, activeProfiles), null, null,
|
||||||
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ChartDto(null,null,null,null,null);
|
return new ChartDto(null, null, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LocalRegionResearcherPercentDto> selectRegionMainCodePercentage(String usageType, String regionMainCode) {
|
public List<LocalRegionResearcherPercentDto> selectRegionMainCodePercentage(String usageType, String regionMainCode, String recordMonth) {
|
||||||
LocalDate today = LocalDate.now();
|
if ("ROLE_ADMIN".equals(AdminUtil.getLoginUserRole())) {
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
|
return chartMapper.selectLocalRegionResearcherPercentage(
|
||||||
String formattedDate = today.format(formatter);
|
new TotalPercentageReqVO(usageType, regionMainCode, recordMonth), activeProfiles);
|
||||||
if("ROLE_ADMIN".equals(AdminUtil.getLoginUserRole())) {
|
} else {
|
||||||
return chartMapper.selectLocalRegionResearcherPercentage(new TotalPercentageReqVO(usageType,regionMainCode,formattedDate),activeProfiles);
|
|
||||||
}else{
|
|
||||||
throw new NoMatchingURIException("잘못된 접근");
|
throw new NoMatchingURIException("잘못된 접근");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,10 @@ import lombok.Data;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class RegionDetailExcelDto {
|
public class RegionDetailExcelDto {
|
||||||
|
private String regionMainName;
|
||||||
private String regionDetailName;
|
private String regionDetailName;
|
||||||
private String regionName;
|
|
||||||
private String householdCount;
|
private String householdCount;
|
||||||
private String avgCompletionRate;
|
private String avgCompletionRate;
|
||||||
private String visitCount;
|
private String visitCount;
|
||||||
private String giftSentCount;
|
private String giftSentCount;
|
||||||
private String regionOrder;
|
|
||||||
private String regionDetailOrder;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,18 @@
|
|||||||
package app.module.admin.usecase.dashboard.chart.adapters.web;
|
package app.module.admin.usecase.dashboard.chart.adapters.web;
|
||||||
|
|
||||||
import app.module.admin.config.application.util.DateUiUtil;
|
|
||||||
import app.module.admin.config.application.util.ExcelWriterUtil;
|
import app.module.admin.config.application.util.ExcelWriterUtil;
|
||||||
import app.module.admin.config.application.util.model.ExcelSheetDto;
|
import app.module.admin.config.application.util.model.ExcelSheetDto;
|
||||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.DashboardExcelDto;
|
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.DashboardExcelDto;
|
||||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.RegionDetailExcelDto;
|
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.RegionDetailExcelDto;
|
||||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.RegionMainExcelDto;
|
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.RegionMainExcelDto;
|
||||||
import app.module.admin.usecase.dashboard.chart.ports.ChartPortIn;
|
import app.module.admin.usecase.dashboard.chart.ports.ChartPortIn;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -20,14 +26,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@@ -37,20 +35,24 @@ class ChartApiController {
|
|||||||
private final ChartPortIn chartPortIn;
|
private final ChartPortIn chartPortIn;
|
||||||
|
|
||||||
@GetMapping(path = "/total")
|
@GetMapping(path = "/total")
|
||||||
ResponseEntity<?> selectTotalPercentage(@RequestParam("usageType") String usageType) {
|
ResponseEntity<?> selectTotalPercentage(@RequestParam("usageType") String usageType,
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(chartPortIn.selectTotalPercentage(usageType));
|
@RequestParam("recordMonth") String recordMonth) {
|
||||||
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
|
.body(chartPortIn.selectTotalPercentage(usageType, recordMonth));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(path = "/researcher")
|
@GetMapping(path = "/researcher")
|
||||||
ResponseEntity<?> selectRegionMainCodePercentage(@RequestParam("usageType") String usageType,@RequestParam("regionMainCode") String regionMainCode) {
|
ResponseEntity<?> selectRegionMainCodePercentage(@RequestParam("usageType") String usageType,
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(chartPortIn.selectRegionMainCodePercentage(usageType,regionMainCode));
|
@RequestParam("regionMainCode") String regionMainCode,
|
||||||
|
@RequestParam("recordMonth") String recordMonth) {
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(
|
||||||
|
chartPortIn.selectRegionMainCodePercentage(usageType, regionMainCode, recordMonth));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(path = "/excel")
|
@GetMapping(path = "/excel")
|
||||||
ResponseEntity<byte[]> exportDashboardExcel() {
|
ResponseEntity<byte[]> exportDashboardExcel(@RequestParam("recordMonth") String recordMonth) {
|
||||||
|
|
||||||
DashboardExcelDto dashboardExcel = chartPortIn.selectDashboard(
|
DashboardExcelDto dashboardExcel = chartPortIn.selectDashboard(recordMonth);
|
||||||
DateUiUtil.getCurrentMonthValue());
|
|
||||||
|
|
||||||
List<List<String>> rows1 = new ArrayList<>();
|
List<List<String>> rows1 = new ArrayList<>();
|
||||||
for (RegionMainExcelDto item : dashboardExcel.getRegionMain()) {
|
for (RegionMainExcelDto item : dashboardExcel.getRegionMain()) {
|
||||||
@@ -58,7 +60,7 @@ class ChartApiController {
|
|||||||
StringUtils.defaultString(item.getRegionName()),
|
StringUtils.defaultString(item.getRegionName()),
|
||||||
StringUtils.defaultString(item.getResearcherCount()),
|
StringUtils.defaultString(item.getResearcherCount()),
|
||||||
StringUtils.defaultString(item.getHouseholdCount()),
|
StringUtils.defaultString(item.getHouseholdCount()),
|
||||||
StringUtils.defaultString(item.getAvgCompletionRate()) + "%",
|
StringUtils.defaultString(item.getAvgCompletionRate()),
|
||||||
StringUtils.defaultString(item.getVisitCount()),
|
StringUtils.defaultString(item.getVisitCount()),
|
||||||
StringUtils.defaultString(item.getGiftSentCount())
|
StringUtils.defaultString(item.getGiftSentCount())
|
||||||
));
|
));
|
||||||
@@ -67,7 +69,7 @@ class ChartApiController {
|
|||||||
// 시트 1: 실사
|
// 시트 1: 실사
|
||||||
ExcelSheetDto sheet1 = new ExcelSheetDto(
|
ExcelSheetDto sheet1 = new ExcelSheetDto(
|
||||||
"실사",
|
"실사",
|
||||||
List.of("실사", "할당 조사원 수", "할당 임가 수", "일계부 진행률", "현장 방문 수", "답례품 전달 임가 수"),
|
List.of("실사", "할당 조사원 수", "할당 임가 수", "당월 일계부 현황(%)", "현장 방문 수", "답례품 전달 임가 수"),
|
||||||
rows1,
|
rows1,
|
||||||
null,
|
null,
|
||||||
Map.of(0, IndexedColors.LIGHT_YELLOW)
|
Map.of(0, IndexedColors.LIGHT_YELLOW)
|
||||||
@@ -76,9 +78,10 @@ class ChartApiController {
|
|||||||
List<List<String>> rows2 = new ArrayList<>();
|
List<List<String>> rows2 = new ArrayList<>();
|
||||||
for (RegionDetailExcelDto item : dashboardExcel.getRegionDetail()) {
|
for (RegionDetailExcelDto item : dashboardExcel.getRegionDetail()) {
|
||||||
rows2.add(List.of(
|
rows2.add(List.of(
|
||||||
|
StringUtils.defaultString(item.getRegionMainName()),
|
||||||
StringUtils.defaultString(item.getRegionDetailName()),
|
StringUtils.defaultString(item.getRegionDetailName()),
|
||||||
StringUtils.defaultString(item.getHouseholdCount()),
|
StringUtils.defaultString(item.getHouseholdCount()),
|
||||||
StringUtils.defaultString(item.getAvgCompletionRate()) + "%",
|
StringUtils.defaultString(item.getAvgCompletionRate()),
|
||||||
StringUtils.defaultString(item.getVisitCount()),
|
StringUtils.defaultString(item.getVisitCount()),
|
||||||
StringUtils.defaultString(item.getGiftSentCount())
|
StringUtils.defaultString(item.getGiftSentCount())
|
||||||
));
|
));
|
||||||
@@ -87,7 +90,7 @@ class ChartApiController {
|
|||||||
// 시트 2: 세부지역
|
// 시트 2: 세부지역
|
||||||
ExcelSheetDto sheet2 = new ExcelSheetDto(
|
ExcelSheetDto sheet2 = new ExcelSheetDto(
|
||||||
"세부지역",
|
"세부지역",
|
||||||
List.of("세부지역", "할당 임가 수", "일계부 진행률", "현장 방문 수", "답례품 전달 임가 수"),
|
List.of("실사", "세부지역", "할당 임가 수", "당월 일계부 현황(%)", "현장 방문 수", "답례품 전달 임가 수"),
|
||||||
rows2,
|
rows2,
|
||||||
null,
|
null,
|
||||||
Map.of(0, IndexedColors.LIGHT_YELLOW)
|
Map.of(0, IndexedColors.LIGHT_YELLOW)
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface ChartPortIn {
|
public interface ChartPortIn {
|
||||||
|
|
||||||
ChartDto selectTotalPercentage(String usageType);
|
ChartDto selectTotalPercentage(String usageType, String recordMonth);
|
||||||
List<LocalRegionResearcherPercentDto> selectRegionMainCodePercentage(String usageType,String regionMainCode);
|
List<LocalRegionResearcherPercentDto> selectRegionMainCodePercentage(String usageType,String regionMainCode, String recordMonth);
|
||||||
DashboardExcelDto selectDashboard(String recordMonth);
|
DashboardExcelDto selectDashboard(String recordMonth);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface ChartPortOut {
|
public interface ChartPortOut {
|
||||||
|
|
||||||
ChartDto selectTotalPercentage(String usageType);
|
ChartDto selectTotalPercentage(String usageType, String recordMonth);
|
||||||
List<LocalRegionResearcherPercentDto> selectRegionMainCodePercentage(String usageType,String regionMainCode);
|
List<LocalRegionResearcherPercentDto> selectRegionMainCodePercentage(String usageType,String regionMainCode, String recordMonth);
|
||||||
DashboardExcelDto selectDashboard(String recordMonth);
|
DashboardExcelDto selectDashboard(String recordMonth);
|
||||||
}
|
}
|
||||||
@@ -16,13 +16,14 @@ class ChartService implements ChartPortIn {
|
|||||||
private final ChartPortOut portOut;
|
private final ChartPortOut portOut;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChartDto selectTotalPercentage(String usageType){
|
public ChartDto selectTotalPercentage(String usageType, String recordMonth){
|
||||||
return portOut.selectTotalPercentage(usageType);
|
return portOut.selectTotalPercentage(usageType, recordMonth);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LocalRegionResearcherPercentDto> selectRegionMainCodePercentage(String usageType,String regionMainCode) {
|
public List<LocalRegionResearcherPercentDto> selectRegionMainCodePercentage(String usageType,
|
||||||
return portOut.selectRegionMainCodePercentage(usageType,regionMainCode);
|
String regionMainCode, String recordMonth) {
|
||||||
|
return portOut.selectRegionMainCodePercentage(usageType, regionMainCode, recordMonth);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package app.module.admin.usecase.home.adapters.web;
|
package app.module.admin.usecase.home.adapters.web;
|
||||||
|
|
||||||
|
import app.module.admin.config.application.util.DateUiUtil;
|
||||||
import app.module.admin.usecase.dashboard.getSmsAutoStatus.ports.GetSmsAutoStatusPortIn;
|
import app.module.admin.usecase.dashboard.getSmsAutoStatus.ports.GetSmsAutoStatusPortIn;
|
||||||
import app.module.admin.usecase.dashboard.getSmsAutoStatus.ports.application.domain.GetSmsAutoStatus;
|
import app.module.admin.usecase.dashboard.getSmsAutoStatus.ports.application.domain.GetSmsAutoStatus;
|
||||||
import app.module.core.usecase.admin.view.ports.AdminViewPortIn;
|
import app.module.core.usecase.admin.view.ports.AdminViewPortIn;
|
||||||
@@ -32,6 +33,8 @@ public class HomeController {
|
|||||||
GetSmsAutoStatus smsAutoStatus = getSmsAutoStatusPortIn.operate().orElse(null);
|
GetSmsAutoStatus smsAutoStatus = getSmsAutoStatusPortIn.operate().orElse(null);
|
||||||
|
|
||||||
model.addAttribute("smsActive", smsAutoStatus != null && smsAutoStatus.getActive());
|
model.addAttribute("smsActive", smsAutoStatus != null && smsAutoStatus.getActive());
|
||||||
|
model.addAttribute("monthList", DateUiUtil.getRecentMonths(13));
|
||||||
|
model.addAttribute("currentMonth", DateUiUtil.getCurrentMonthValue());
|
||||||
|
|
||||||
return "home";
|
return "home";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,5 @@ import java.util.Optional;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface CheckHouseholdNumMapper {
|
public interface CheckHouseholdNumMapper {
|
||||||
Optional<CheckHouseholdNum> checkHouseholdNum(CheckHouseholdNumCmd cmd);
|
Optional<CheckHouseholdNum> checkHouseholdNum(CheckHouseholdNumCmd cmd);
|
||||||
|
Optional<CheckHouseholdNum> checkHouseholdNumExcel(CheckHouseholdNumCmd cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,6 @@ import lombok.Setter;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public class CheckHouseholdNum {
|
public class CheckHouseholdNum {
|
||||||
private Boolean isDuplicated; // 사용여부
|
private Boolean isDuplicated; // 사용여부
|
||||||
|
private Long householdSeq; // 가구일련번호
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ class GetHouseholdsExcelController {
|
|||||||
getHouseholdsStatusPortIn.operate(pageable,
|
getHouseholdsStatusPortIn.operate(pageable,
|
||||||
new GetHouseholdsStatusCmd(
|
new GetHouseholdsStatusCmd(
|
||||||
reqVO.getRecordMonth(),
|
reqVO.getRecordMonth(),
|
||||||
|
reqVO.getHouseholdNum(),
|
||||||
reqVO.getOwnerField(),
|
reqVO.getOwnerField(),
|
||||||
reqVO.getOwnerValue(),
|
reqVO.getOwnerValue(),
|
||||||
reqVO.getRegionMainCode(),
|
reqVO.getRegionMainCode(),
|
||||||
@@ -154,7 +155,7 @@ class GetHouseholdsExcelController {
|
|||||||
StringUtils.defaultString(item.getIndustryDetail()),
|
StringUtils.defaultString(item.getIndustryDetail()),
|
||||||
StringUtils.defaultString(item.getResearcherName()),
|
StringUtils.defaultString(item.getResearcherName()),
|
||||||
StringUtils.defaultString(item.getResearcherPhone()),
|
StringUtils.defaultString(item.getResearcherPhone()),
|
||||||
StringUtils.defaultString(item.getCompletionRate()) + "%",
|
StringUtils.defaultString(item.getCompletionRate()),
|
||||||
StringUtils.defaultString(item.getFirstVisitDate()),
|
StringUtils.defaultString(item.getFirstVisitDate()),
|
||||||
StringUtils.defaultString(item.getSecondVisitDate()),
|
StringUtils.defaultString(item.getSecondVisitDate()),
|
||||||
StringUtils.defaultString(item.getGiftSend()),
|
StringUtils.defaultString(item.getGiftSend()),
|
||||||
@@ -180,7 +181,7 @@ class GetHouseholdsExcelController {
|
|||||||
"규모/세부품목",
|
"규모/세부품목",
|
||||||
"조사원",
|
"조사원",
|
||||||
"조사원 연락처",
|
"조사원 연락처",
|
||||||
"당월 일계부 현황",
|
"당월 일계부 현황(%)",
|
||||||
"당월 1차 임가방문",
|
"당월 1차 임가방문",
|
||||||
"당월 2차 임가방문",
|
"당월 2차 임가방문",
|
||||||
"답례품 전달",
|
"답례품 전달",
|
||||||
@@ -496,6 +497,7 @@ class GetHouseholdsExcelController {
|
|||||||
StringUtils.defaultString(item.getWorkName()),
|
StringUtils.defaultString(item.getWorkName()),
|
||||||
StringUtils.defaultString(item.getWorkMark()),
|
StringUtils.defaultString(item.getWorkMark()),
|
||||||
StringUtils.defaultString(item.getWorkLandArea()),
|
StringUtils.defaultString(item.getWorkLandArea()),
|
||||||
|
StringUtils.defaultString(item.getAreaMark()),
|
||||||
StringUtils.defaultString(item.getAreaUnitName()),
|
StringUtils.defaultString(item.getAreaUnitName()),
|
||||||
StringUtils.defaultString(item.getHarvestQuantity()),
|
StringUtils.defaultString(item.getHarvestQuantity()),
|
||||||
StringUtils.defaultString(item.getHarvestUnitName()),
|
StringUtils.defaultString(item.getHarvestUnitName()),
|
||||||
@@ -523,6 +525,7 @@ class GetHouseholdsExcelController {
|
|||||||
"작업명",
|
"작업명",
|
||||||
"작업 부호",
|
"작업 부호",
|
||||||
"작업면적",
|
"작업면적",
|
||||||
|
"면적 부호",
|
||||||
"단위",
|
"단위",
|
||||||
"수확량",
|
"수확량",
|
||||||
"단위",
|
"단위",
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ import lombok.Setter;
|
|||||||
public class GetHouseholdsExcelReqVO {
|
public class GetHouseholdsExcelReqVO {
|
||||||
// 연월
|
// 연월
|
||||||
private String recordMonth;
|
private String recordMonth;
|
||||||
|
// 임가번호
|
||||||
|
private String householdNum;
|
||||||
// 경영주 검색 필드 (전체, 경영주명, 전화번호)
|
// 경영주 검색 필드 (전체, 경영주명, 전화번호)
|
||||||
private String ownerField;
|
private String ownerField;
|
||||||
// 경영주 검색어
|
// 경영주 검색어
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public class GetDailyWork {
|
|||||||
private String workName;
|
private String workName;
|
||||||
private String workMark;
|
private String workMark;
|
||||||
private String workLandArea;
|
private String workLandArea;
|
||||||
|
private String areaMark;
|
||||||
private String areaUnitName;
|
private String areaUnitName;
|
||||||
private String harvestQuantity;
|
private String harvestQuantity;
|
||||||
private String harvestUnitName;
|
private String harvestUnitName;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -17,6 +17,7 @@ class ExcelUploadCreateHouseholdController {
|
|||||||
|
|
||||||
private final ExcelUploadCreateHouseholdPortIn excelUploadCreateHouseholdPortIn;
|
private final ExcelUploadCreateHouseholdPortIn excelUploadCreateHouseholdPortIn;
|
||||||
|
|
||||||
|
// 임가현황 > 엑셀 업로드
|
||||||
@PostMapping(path = "/api/household/excelUpload")
|
@PostMapping(path = "/api/household/excelUpload")
|
||||||
ResponseEntity<?> operate(@RequestParam("file") MultipartFile file ) throws IOException {
|
ResponseEntity<?> operate(@RequestParam("file") MultipartFile file ) throws IOException {
|
||||||
try {
|
try {
|
||||||
@@ -29,4 +30,18 @@ class ExcelUploadCreateHouseholdController {
|
|||||||
.body("잘못된 데이터 형식입니다: " + e.getMessage());
|
.body("잘못된 데이터 형식입니다: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 임가현황 > 엑셀 업로드(일계부)
|
||||||
|
@PostMapping(path = "/api/household/dailyExcelUpload")
|
||||||
|
ResponseEntity<?> dailyExcelUpload(@RequestParam("file") MultipartFile file ) throws IOException {
|
||||||
|
try {
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(excelUploadCreateHouseholdPortIn.dailyExcelUpload(file));
|
||||||
|
} catch (IOException e) {
|
||||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
|
.body("엑셀 파일 처리 중 오류가 발생했습니다: " + e.getMessage());
|
||||||
|
} catch (Exception e) {
|
||||||
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
|
||||||
|
.body(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -7,4 +7,5 @@ import java.io.IOException;
|
|||||||
|
|
||||||
public interface ExcelUploadCreateHouseholdPortIn {
|
public interface ExcelUploadCreateHouseholdPortIn {
|
||||||
ExcelUploadResultVO operate(MultipartFile file) throws IOException;
|
ExcelUploadResultVO operate(MultipartFile file) throws IOException;
|
||||||
|
ExcelUploadResultVO dailyExcelUpload(MultipartFile file) throws IOException;
|
||||||
}
|
}
|
||||||
@@ -6,5 +6,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public interface ExcelUploadCreateHouseholdPortOut {
|
public interface ExcelUploadCreateHouseholdPortOut {
|
||||||
ExcelUploadResultVO operate(MultipartFile file) throws IOException;
|
ExcelUploadResultVO operate(MultipartFile file) throws IOException;
|
||||||
|
ExcelUploadResultVO dailyExcelUpload(MultipartFile file) throws IOException;
|
||||||
}
|
}
|
||||||
@@ -14,8 +14,13 @@ import java.io.IOException;
|
|||||||
class ExcelUploadCreateHouseholdService implements ExcelUploadCreateHouseholdPortIn {
|
class ExcelUploadCreateHouseholdService implements ExcelUploadCreateHouseholdPortIn {
|
||||||
private final ExcelUploadCreateHouseholdPortOut portOut;
|
private final ExcelUploadCreateHouseholdPortOut portOut;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ExcelUploadResultVO operate(MultipartFile file) throws IOException {
|
public ExcelUploadResultVO operate(MultipartFile file) throws IOException {
|
||||||
return portOut.operate(file);
|
return portOut.operate(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExcelUploadResultVO dailyExcelUpload(MultipartFile file) throws IOException {
|
||||||
|
return portOut.dailyExcelUpload(file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ import app.module.admin.config.application.util.DateUiUtil;
|
|||||||
import app.module.admin.usecase.household.getHouseholdStatus.ports.GetHouseholdStatusPortIn;
|
import app.module.admin.usecase.household.getHouseholdStatus.ports.GetHouseholdStatusPortIn;
|
||||||
import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatusCmd;
|
import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatusCmd;
|
||||||
import app.module.admin.usecase.household.getHouseholdStatusUI.adapters.web.model.GetHouseholdStatusUIReqVO;
|
import app.module.admin.usecase.household.getHouseholdStatusUI.adapters.web.model.GetHouseholdStatusUIReqVO;
|
||||||
|
import app.module.core.config.constants.DailyRecordConstants;
|
||||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@@ -14,6 +15,8 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
@Controller
|
@Controller
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
class GetHouseholdStatusUIController {
|
class GetHouseholdStatusUIController {
|
||||||
@@ -45,7 +48,12 @@ class GetHouseholdStatusUIController {
|
|||||||
// 임가 상세 정보
|
// 임가 상세 정보
|
||||||
model.addAttribute("householdInfo",
|
model.addAttribute("householdInfo",
|
||||||
getHouseholdStatusPortIn.operate(new GetHouseholdStatusCmd(seq)).orElse(null));
|
getHouseholdStatusPortIn.operate(new GetHouseholdStatusCmd(seq)).orElse(null));
|
||||||
|
//입력 수정 가능 년도
|
||||||
|
int currentYear = LocalDate.now().getYear();
|
||||||
|
model.addAttribute("targetYear", IntStream.rangeClosed(DailyRecordConstants.START_YEAR, currentYear).boxed().toList());
|
||||||
|
model.addAttribute("startYear", DailyRecordConstants.START_YEAR);
|
||||||
|
model.addAttribute("startMonth", DailyRecordConstants.START_MONTH_OF_START_YEAR);
|
||||||
|
model.addAttribute("currentDate", LocalDate.now());
|
||||||
return "households/{seq}";
|
return "households/{seq}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,6 +26,7 @@ class GetHouseholdsStatusController {
|
|||||||
getHouseholdsStatusPortIn.operate(pageable,
|
getHouseholdsStatusPortIn.operate(pageable,
|
||||||
new GetHouseholdsStatusCmd(
|
new GetHouseholdsStatusCmd(
|
||||||
reqVO.getRecordMonth(),
|
reqVO.getRecordMonth(),
|
||||||
|
reqVO.getHouseholdNum(),
|
||||||
reqVO.getOwnerField(),
|
reqVO.getOwnerField(),
|
||||||
reqVO.getOwnerValue(),
|
reqVO.getOwnerValue(),
|
||||||
reqVO.getRegionMainCode(),
|
reqVO.getRegionMainCode(),
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import lombok.Setter;
|
|||||||
public class GetHouseholdsStatusReqVO {
|
public class GetHouseholdsStatusReqVO {
|
||||||
// 연월
|
// 연월
|
||||||
private String recordMonth;
|
private String recordMonth;
|
||||||
|
// 임가번호
|
||||||
|
private String householdNum;
|
||||||
// 경영주 검색 필드 (전체, 경영주명, 전화번호)
|
// 경영주 검색 필드 (전체, 경영주명, 전화번호)
|
||||||
private String ownerField;
|
private String ownerField;
|
||||||
// 경영주 검색어
|
// 경영주 검색어
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import lombok.Setter;
|
|||||||
public class GetHouseholdsStatusCmd {
|
public class GetHouseholdsStatusCmd {
|
||||||
// 연월
|
// 연월
|
||||||
private String recordMonth;
|
private String recordMonth;
|
||||||
|
// 임가번호
|
||||||
|
private String householdNum;
|
||||||
// 경영주 검색 필드 (전체, 경영주명, 전화번호)
|
// 경영주 검색 필드 (전체, 경영주명, 전화번호)
|
||||||
private String ownerField;
|
private String ownerField;
|
||||||
// 경영주 검색어
|
// 경영주 검색어
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public class GetHouseholdsUIReqVO {
|
|||||||
private String sort;
|
private String sort;
|
||||||
private Integer size;
|
private Integer size;
|
||||||
private String recordMonth;
|
private String recordMonth;
|
||||||
|
private String householdNum;
|
||||||
private String ownerField;
|
private String ownerField;
|
||||||
private String ownerValue;
|
private String ownerValue;
|
||||||
private String regionMainCode;
|
private String regionMainCode;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.adapters.persistence;
|
package app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.application.domain.SaveExcelUploadLogCmd;
|
||||||
import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.application.domain.UpdateForestProductStatusCmd;
|
import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.application.domain.UpdateForestProductStatusCmd;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@@ -8,4 +9,5 @@ public interface UpdateMonthlyInputStatusMapper {
|
|||||||
void updateForestProductStatus(UpdateForestProductStatusCmd cmd);
|
void updateForestProductStatus(UpdateForestProductStatusCmd cmd);
|
||||||
void updateBankInputStatus(UpdateForestProductStatusCmd cmd);
|
void updateBankInputStatus(UpdateForestProductStatusCmd cmd);
|
||||||
void updateBankOutputStatus(UpdateForestProductStatusCmd cmd);
|
void updateBankOutputStatus(UpdateForestProductStatusCmd cmd);
|
||||||
|
void createExcelUploadLog(SaveExcelUploadLogCmd cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.application.domain;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SaveExcelUploadLogCmd extends AuditCommand {
|
||||||
|
private String fileName;
|
||||||
|
private String month;
|
||||||
|
private String errorMessage;
|
||||||
|
private String errorDetail;
|
||||||
|
private String createdBy;
|
||||||
|
}
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.adapters.persistence;
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.adapters.persistence;
|
||||||
|
|
||||||
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports.application.domain.SaveBankAutoTransferExpenseOutCmd;
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports.application.domain.SaveBankAutoTransferExpenseOutCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports.application.domain.SaveBankAutoTransferExpenseOutExcelCmd;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SaveBankAutoTransferExpenseMapper {
|
public interface SaveBankAutoTransferExpenseMapper {
|
||||||
void createBankAutoTransferExpense(SaveBankAutoTransferExpenseOutCmd cmd);
|
void createBankAutoTransferExpense(SaveBankAutoTransferExpenseOutCmd cmd);
|
||||||
void updateBankAutoTransferExpense(SaveBankAutoTransferExpenseOutCmd cmd);
|
void updateBankAutoTransferExpense(SaveBankAutoTransferExpenseOutCmd cmd);
|
||||||
|
void createBankAutoTransferExpenseExcel(SaveBankAutoTransferExpenseOutExcelCmd cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.bankAutoTransfer.saveBankAutoTransferExpense.ports.application.domain;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SaveBankAutoTransferExpenseOutExcelCmd extends AuditCommand {
|
||||||
|
private Long bankAutoTransferId;
|
||||||
|
private Long householdSeq;
|
||||||
|
private String recordMonth;
|
||||||
|
private String expenseCode;
|
||||||
|
private String transferCategoryCode;
|
||||||
|
private String transferCategory;
|
||||||
|
private String sourcePurpose;
|
||||||
|
private String count;
|
||||||
|
private String unitCode;
|
||||||
|
private String unit;
|
||||||
|
private Long price;
|
||||||
|
private String transferType;
|
||||||
|
private String category;
|
||||||
|
private Long monthlyInputStatusId;
|
||||||
|
private String bankAutoTransferOutputStatus;
|
||||||
|
private String cropCode;
|
||||||
|
}
|
||||||
@@ -27,4 +27,5 @@ public class GetDailyExpenseRecords {
|
|||||||
private String attachmentURL;
|
private String attachmentURL;
|
||||||
private String startDay;
|
private String startDay;
|
||||||
private String endDay;
|
private String endDay;
|
||||||
|
private Boolean ocrErrorResult;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,4 +30,5 @@ public class GetDailyIncomeRecords {
|
|||||||
private String attachmentURL;
|
private String attachmentURL;
|
||||||
private String startDay;
|
private String startDay;
|
||||||
private String endDay;
|
private String endDay;
|
||||||
|
private Boolean ocrErrorResult;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,4 +42,33 @@ public class RemoveDailyDao implements RemoveDailyPortOut {
|
|||||||
safeLogger.error("[RemoveDaily] Current step is null. cmd: {}", command);
|
safeLogger.error("[RemoveDaily] Current step is null. cmd: {}", command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@UpdateCommand
|
||||||
|
@Override
|
||||||
|
public void operateStatus(RemoveDailyCmd command) {
|
||||||
|
if (command.getCurrentStep() != null) {
|
||||||
|
safeLogger.error("[RemoveDaily] cmd: {}", command);
|
||||||
|
|
||||||
|
if (DailySort.INCOME.equals(command.getCurrentStep())) {
|
||||||
|
mapper.removeDailyIncome(command);
|
||||||
|
// mapper.removeDailyIncomeReceipt(command);
|
||||||
|
} else if (DailySort.WORK.equals(command.getCurrentStep())) {
|
||||||
|
mapper.removeDailyWork(command);
|
||||||
|
} else if (DailySort.EXPENSE.equals(command.getCurrentStep())) {
|
||||||
|
mapper.removeDailyExpense(command);
|
||||||
|
// mapper.removeDailyExpenseReceipt(command);
|
||||||
|
} else if (DailySort.POWER.equals(command.getCurrentStep())) {
|
||||||
|
mapper.removeDailyPower(command);
|
||||||
|
} else if (DailySort.FORESTRY.equals(command.getCurrentStep())) {
|
||||||
|
mapper.removeDailyForestry(command);
|
||||||
|
} else if (DailySort.FARMING.equals(command.getCurrentStep())) {
|
||||||
|
mapper.removeDailyFarming(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
safeLogger.error("[RemoveDaily] Current step is null. cmd: {}", command);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.adapters.w
|
|||||||
|
|
||||||
public interface RemoveDailyPortIn {
|
public interface RemoveDailyPortIn {
|
||||||
void operate(RemoveDailyReqVO reqVO);
|
void operate(RemoveDailyReqVO reqVO);
|
||||||
|
void operateStatus(RemoveDailyReqVO reqVO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.appl
|
|||||||
|
|
||||||
public interface RemoveDailyPortOut {
|
public interface RemoveDailyPortOut {
|
||||||
void operate(RemoveDailyCmd command);
|
void operate(RemoveDailyCmd command);
|
||||||
|
void operateStatus(RemoveDailyCmd command);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,4 +20,13 @@ public class RemoveDailyService implements RemoveDailyPortIn {
|
|||||||
|
|
||||||
portOut.operate(command);
|
portOut.operate(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operateStatus(RemoveDailyReqVO reqVO) {
|
||||||
|
RemoveDailyCmd command = new RemoveDailyCmd(
|
||||||
|
reqVO.getSelectedIds(),
|
||||||
|
reqVO.getCurrentStep());
|
||||||
|
|
||||||
|
portOut.operateStatus(command);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence;
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.adapters.persistence.RemoveDailyMapper;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence.modal.GetDailyExpenseDto;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence.modal.GetDailyExpenseDto;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.SaveDailyExpensePortOut;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.SaveDailyExpensePortOut;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain.GetDailyExpenseCmd;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain.GetDailyExpenseCmd;
|
||||||
@@ -17,6 +18,8 @@ public class SaveDailyExpenseDao implements SaveDailyExpensePortOut {
|
|||||||
|
|
||||||
private final SaveDailyExpenseMapper dailyExpenseMapper;
|
private final SaveDailyExpenseMapper dailyExpenseMapper;
|
||||||
|
|
||||||
|
private final RemoveDailyMapper removeDailyMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GetDailyExpenseDto detail(GetDailyExpenseCmd command) {
|
public GetDailyExpenseDto detail(GetDailyExpenseCmd command) {
|
||||||
|
|
||||||
@@ -27,9 +30,12 @@ public class SaveDailyExpenseDao implements SaveDailyExpensePortOut {
|
|||||||
@Override
|
@Override
|
||||||
public void create(GetDailyExpenseCmd findCmd, SaveDailyExpenseCmd command) {
|
public void create(GetDailyExpenseCmd findCmd, SaveDailyExpenseCmd command) {
|
||||||
Integer existCount = dailyExpenseMapper.getRecordExistCount(findCmd);
|
Integer existCount = dailyExpenseMapper.getRecordExistCount(findCmd);
|
||||||
if (existCount == 0) {
|
if (existCount == 0 ) {
|
||||||
dailyExpenseMapper.createDailyExpense(command);
|
if(findCmd.getId()== null || findCmd.getId() == 0 ) {
|
||||||
|
dailyExpenseMapper.createDailyExpense(command);
|
||||||
|
} else {
|
||||||
|
dailyExpenseMapper.updateDailyExpenseOnlyId(command);
|
||||||
|
}
|
||||||
safeLogger.debug("[CreateDailyExpense] command={}", command);
|
safeLogger.debug("[CreateDailyExpense] command={}", command);
|
||||||
} else {
|
} else {
|
||||||
dailyExpenseMapper.updateDailyExpense(command);
|
dailyExpenseMapper.updateDailyExpense(command);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adap
|
|||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence.modal.GetDailyExpenseDto;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence.modal.GetDailyExpenseDto;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain.GetDailyExpenseCmd;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain.GetDailyExpenseCmd;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain.SaveDailyExpenseCmd;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain.SaveDailyExpenseCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain.SaveDailyExpenseExcelCmd;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@@ -36,4 +37,12 @@ public interface SaveDailyExpenseMapper {
|
|||||||
* @param command 수정 데이터
|
* @param command 수정 데이터
|
||||||
*/
|
*/
|
||||||
void updateDailyExpense(SaveDailyExpenseCmd command);
|
void updateDailyExpense(SaveDailyExpenseCmd command);
|
||||||
|
void updateDailyExpenseOnlyId(SaveDailyExpenseCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 등록_Excel
|
||||||
|
*
|
||||||
|
* @param command 등록 데이터
|
||||||
|
*/
|
||||||
|
void createDailyExpenseExcel(SaveDailyExpenseExcelCmd command);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,21 @@
|
|||||||
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web;
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.adapters.web.modal.RemoveDailyReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.RemoveDailyPortIn;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence.modal.GetDailyExpenseDto;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence.modal.GetDailyExpenseDto;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web.model.DailyExpenseUIReqVO;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web.model.DailyExpenseUIReqVO;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web.model.SaveDailyExpenseReqVO;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web.model.SaveDailyExpenseReqVO;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web.validator.SaveDailyExpenseValidator;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web.validator.SaveDailyExpenseValidator;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.SaveDailyExpensePortIn;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.SaveDailyExpensePortIn;
|
||||||
|
import app.module.core.config.application.enums.DailySort;
|
||||||
|
import app.module.core.config.application.enums.DailyStatus;
|
||||||
|
import app.module.core.config.application.enums.DailyTargetStatus;
|
||||||
import app.module.core.config.application.exception.NoRecordDataException;
|
import app.module.core.config.application.exception.NoRecordDataException;
|
||||||
|
import app.module.core.config.application.util.DailyUtil;
|
||||||
|
import app.module.core.usecase.daily.dayGroup.adapters.persistence.model.DailyDayGroupDto;
|
||||||
|
import app.module.core.usecase.daily.dayGroup.ports.DailyDayGroupPortIn;
|
||||||
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
|
import app.module.core.usecase.daily.record.adapters.web.model.CreateDailyRecordReqVO;
|
||||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -15,6 +24,9 @@ import org.springframework.http.ResponseEntity;
|
|||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RequestMapping(path = "/api/household/daily/expense")
|
@RequestMapping(path = "/api/household/daily/expense")
|
||||||
@@ -23,6 +35,11 @@ public class SaveDailyExpenseController {
|
|||||||
private final SaveDailyExpensePortIn dailyExpensePortIn;
|
private final SaveDailyExpensePortIn dailyExpensePortIn;
|
||||||
private final SaveDailyExpenseValidator dailyExpenseValidator;
|
private final SaveDailyExpenseValidator dailyExpenseValidator;
|
||||||
|
|
||||||
|
|
||||||
|
private final DailyDayGroupPortIn dailyDayGroupPortIn;
|
||||||
|
private final RemoveDailyPortIn removeDailyPortIn;
|
||||||
|
private final DailyUtil dailyUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 일계부 지출 조회
|
* 일계부 지출 조회
|
||||||
*
|
*
|
||||||
@@ -59,12 +76,28 @@ public class SaveDailyExpenseController {
|
|||||||
|
|
||||||
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(formVO.getDailyId());
|
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(formVO.getDailyId());
|
||||||
|
|
||||||
|
|
||||||
|
String monthPadded = formVO.getTargetMonth().length() == 1 ? "0" + formVO.getTargetMonth() : formVO.getTargetMonth();
|
||||||
|
String formRecordMonth = formVO.getTargetYear() + monthPadded;
|
||||||
|
|
||||||
|
if( !( formRecordMonth.equals(dailyRecord.getRecordMonth()) && formVO.getTargetDayGroup().equals(dailyRecord.getGroupNo()) ) ){
|
||||||
|
DailyDayGroupDto dailyDayGroupDto = dailyDayGroupPortIn.detailbyGroupNo(formVO.getTargetDayGroup());
|
||||||
|
dailyRecord = getOtherDailyRecord(formRecordMonth, dailyDayGroupDto, dailyRecord.getHouseholdSeq());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||||
formVO.setDailyId(dailyRecord.getId());
|
formVO.setDailyId(dailyRecord.getId());
|
||||||
|
|
||||||
dailyExpensePortIn.create(formVO);
|
dailyExpensePortIn.create(formVO);
|
||||||
|
|
||||||
|
if (!dailyRecord.getExpenseStatus().equals(DailyTargetStatus.TARGET)) {
|
||||||
|
dailyRecordPortIn.updateByStatus(dailyRecord.getRecordMonth(), dailyRecord.getGroupNo(), dailyRecord.getHouseholdSeq(), "EXPENSE", DailyTargetStatus.TARGET.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,4 +114,34 @@ public class SaveDailyExpenseController {
|
|||||||
|
|
||||||
return dailyRecord;
|
return dailyRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private DailyRecordDto getOtherDailyRecord(String searchMonth, DailyDayGroupDto dailyDayGroupDto, Long householdSeq) {
|
||||||
|
|
||||||
|
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(searchMonth, dailyDayGroupDto.getGroupNo(), householdSeq);
|
||||||
|
|
||||||
|
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||||
|
CreateDailyRecordReqVO createDailyRecordReqVO = new CreateDailyRecordReqVO();
|
||||||
|
createDailyRecordReqVO.setTodayNone("N");
|
||||||
|
createDailyRecordReqVO.setAllStatus(DailyStatus.DONE);
|
||||||
|
|
||||||
|
createDailyRecordReqVO.setExpenseStatus(DailyTargetStatus.TARGET);
|
||||||
|
createDailyRecordReqVO.setFarmingStatus(DailyTargetStatus.TODAY_NONE);
|
||||||
|
createDailyRecordReqVO.setRecordMonth(searchMonth);
|
||||||
|
createDailyRecordReqVO.setDayGroupNo(dailyDayGroupDto.getGroupNo());
|
||||||
|
|
||||||
|
createDailyRecordReqVO.setStartDate(dailyUtil.getDayToLocalDate(searchMonth, dailyDayGroupDto.getStartDay()));
|
||||||
|
createDailyRecordReqVO.setEndDate(dailyUtil.getDayToLocalDate(searchMonth, dailyDayGroupDto.getEndDay()));
|
||||||
|
|
||||||
|
|
||||||
|
createDailyRecordReqVO.setHouseholdSeq(householdSeq);
|
||||||
|
|
||||||
|
dailyRecordPortIn.create(createDailyRecordReqVO);
|
||||||
|
|
||||||
|
dailyRecord = dailyRecordPortIn.detail(searchMonth, dailyDayGroupDto.getGroupNo(), householdSeq);
|
||||||
|
|
||||||
|
}
|
||||||
|
return dailyRecord;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adap
|
|||||||
import app.module.core.config.application.enums.DailyInputType;
|
import app.module.core.config.application.enums.DailyInputType;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.NonNull;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
@@ -48,4 +49,15 @@ public class SaveDailyExpenseReqVO extends DailyExpenseUIReqVO {
|
|||||||
* 현물평가액
|
* 현물평가액
|
||||||
*/
|
*/
|
||||||
private Long estimatedValue;
|
private Long estimatedValue;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private String targetYear;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private String targetMonth;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private Integer targetDayGroup;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,29 +21,29 @@ public class SaveDailyExpenseValidator implements Validator {
|
|||||||
public void validate(Object target, Errors errors) {
|
public void validate(Object target, Errors errors) {
|
||||||
SaveDailyExpenseReqVO vo = (SaveDailyExpenseReqVO) target;
|
SaveDailyExpenseReqVO vo = (SaveDailyExpenseReqVO) target;
|
||||||
|
|
||||||
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
// if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||||
errors.rejectValue(
|
// errors.rejectValue(
|
||||||
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
|
// "quantity", CommonConstants.VALID_CODE_NOTBLANK,
|
||||||
"수량을 입력해 주세요.");
|
// "수량을 입력해 주세요.");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (vo.getQuantity() != null && vo.getQuantity() <= 0) {
|
// if (vo.getQuantity() != null && vo.getQuantity() <= 0) {
|
||||||
errors.rejectValue(
|
// errors.rejectValue(
|
||||||
"quantity", CommonConstants.VALID_CODE_INVALID_ZERO,
|
// "quantity", CommonConstants.VALID_CODE_INVALID_ZERO,
|
||||||
"수량은 0 이상 입력해 주세요.");
|
// "수량은 0 이상 입력해 주세요.");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
// if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
||||||
errors.rejectValue(
|
// errors.rejectValue(
|
||||||
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
|
// "unitCode", CommonConstants.VALID_CODE_NOTBLANK,
|
||||||
"단위를 선택해 주세요.");
|
// "단위를 선택해 주세요.");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
// if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||||
errors.rejectValue(
|
// errors.rejectValue(
|
||||||
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
// "unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
||||||
"단위를 입력해 주세요.");
|
// "단위를 입력해 주세요.");
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
|
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
|
||||||
errors.rejectValue(
|
errors.rejectValue(
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import app.module.core.config.application.enums.DailyInputType;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class SaveDailyExpenseExcelCmd extends AuditCommand {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
private DailyInputType inputType;
|
||||||
|
/**
|
||||||
|
* 유형
|
||||||
|
*/
|
||||||
|
private String category;
|
||||||
|
/**
|
||||||
|
* 수입 부호
|
||||||
|
*/
|
||||||
|
private String incomeMark;
|
||||||
|
private Boolean credit;
|
||||||
|
private String expenseKind;
|
||||||
|
private String sourcePurpose;
|
||||||
|
private Double quantity;
|
||||||
|
private String unitCode;
|
||||||
|
private String unitSelf;
|
||||||
|
private Long price;
|
||||||
|
private Long estimatedValue;
|
||||||
|
private String expenseMark;
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ada
|
|||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.persistence.modal.GetDailyForestryDto;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.persistence.modal.GetDailyForestryDto;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application.domain.GetDailyForestryCmd;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application.domain.GetDailyForestryCmd;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application.domain.SaveDailyForestryCmd;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application.domain.SaveDailyForestryCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application.domain.SaveDailyForestryExcelCmd;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@@ -36,4 +37,11 @@ public interface SaveDailyForestryMapper {
|
|||||||
* @param command 수정 데이터
|
* @param command 수정 데이터
|
||||||
*/
|
*/
|
||||||
void updateDailyForestry(SaveDailyForestryCmd command);
|
void updateDailyForestry(SaveDailyForestryCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 임업생산 등록_Excel
|
||||||
|
*
|
||||||
|
* @param command 등록 데이터
|
||||||
|
*/
|
||||||
|
void createDailyForestryExcel(SaveDailyForestryExcelCmd command);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application.domain;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class SaveDailyForestryExcelCmd extends AuditCommand {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
private String incomeMark;
|
||||||
|
private String expenseMark;
|
||||||
|
private String productName;
|
||||||
|
private String usage;
|
||||||
|
private Double quantity;
|
||||||
|
private String unitCode;
|
||||||
|
private String unitSelf;
|
||||||
|
private Long estimatedValue;
|
||||||
|
}
|
||||||
@@ -27,8 +27,12 @@ public class SaveDailyIncomeDao implements SaveDailyIncomePortOut {
|
|||||||
@Override
|
@Override
|
||||||
public void create(GetDailyIncomeCmd findCmd, SaveDailyIncomeCmd command) {
|
public void create(GetDailyIncomeCmd findCmd, SaveDailyIncomeCmd command) {
|
||||||
Integer existCount = dailyIncomeMapper.getRecordExistCount(findCmd);
|
Integer existCount = dailyIncomeMapper.getRecordExistCount(findCmd);
|
||||||
if (existCount == 0) {
|
if (existCount == 0 ) {
|
||||||
dailyIncomeMapper.createDailyIncome(command);
|
if(findCmd.getId()== null || findCmd.getId() == 0 ) {
|
||||||
|
dailyIncomeMapper.createDailyIncome(command);
|
||||||
|
} else {
|
||||||
|
dailyIncomeMapper.updateDailyIncomeOnlyId(command);
|
||||||
|
}
|
||||||
|
|
||||||
safeLogger.debug("[CreateDailyIncome] command={}", command);
|
safeLogger.debug("[CreateDailyIncome] command={}", command);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapt
|
|||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapters.persistence.modal.GetDailyIncomeDto;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapters.persistence.modal.GetDailyIncomeDto;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.ports.application.domain.GetDailyIncomeCmd;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.ports.application.domain.GetDailyIncomeCmd;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.ports.application.domain.SaveDailyIncomeCmd;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.ports.application.domain.SaveDailyIncomeCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.ports.application.domain.SaveDailyIncomeExcelCmd;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@@ -36,4 +37,12 @@ public interface SaveDailyIncomeMapper {
|
|||||||
* @param command 수정 데이터
|
* @param command 수정 데이터
|
||||||
*/
|
*/
|
||||||
void updateDailyIncome(SaveDailyIncomeCmd command);
|
void updateDailyIncome(SaveDailyIncomeCmd command);
|
||||||
|
void updateDailyIncomeOnlyId(SaveDailyIncomeCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 수입 등록_Excel
|
||||||
|
*
|
||||||
|
* @param command 등록 데이터
|
||||||
|
*/
|
||||||
|
void createDailyIncomeExcel(SaveDailyIncomeExcelCmd command);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,21 @@
|
|||||||
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapters.web;
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapters.web;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.adapters.web.modal.RemoveDailyReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.RemoveDailyPortIn;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapters.persistence.modal.GetDailyIncomeDto;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapters.persistence.modal.GetDailyIncomeDto;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapters.web.model.DailyIncomeUIReqVO;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapters.web.model.DailyIncomeUIReqVO;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapters.web.model.SaveDailyIncomeReqVO;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapters.web.model.SaveDailyIncomeReqVO;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapters.web.validator.SaveDailyIncomeValidator;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapters.web.validator.SaveDailyIncomeValidator;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.ports.SaveDailyIncomePortIn;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.ports.SaveDailyIncomePortIn;
|
||||||
|
import app.module.core.config.application.enums.DailySort;
|
||||||
|
import app.module.core.config.application.enums.DailyStatus;
|
||||||
|
import app.module.core.config.application.enums.DailyTargetStatus;
|
||||||
import app.module.core.config.application.exception.NoRecordDataException;
|
import app.module.core.config.application.exception.NoRecordDataException;
|
||||||
|
import app.module.core.config.application.util.DailyUtil;
|
||||||
|
import app.module.core.usecase.daily.dayGroup.adapters.persistence.model.DailyDayGroupDto;
|
||||||
|
import app.module.core.usecase.daily.dayGroup.ports.DailyDayGroupPortIn;
|
||||||
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
|
import app.module.core.usecase.daily.record.adapters.web.model.CreateDailyRecordReqVO;
|
||||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -15,6 +24,9 @@ import org.springframework.http.ResponseEntity;
|
|||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RequestMapping(path = "/api/household/daily/income")
|
@RequestMapping(path = "/api/household/daily/income")
|
||||||
@@ -23,6 +35,10 @@ public class SaveDailyIncomeController {
|
|||||||
private final SaveDailyIncomePortIn dailyIncomePortIn;
|
private final SaveDailyIncomePortIn dailyIncomePortIn;
|
||||||
private final SaveDailyIncomeValidator dailyIncomeValidator;
|
private final SaveDailyIncomeValidator dailyIncomeValidator;
|
||||||
|
|
||||||
|
private final DailyDayGroupPortIn dailyDayGroupPortIn;
|
||||||
|
private final RemoveDailyPortIn removeDailyPortIn;
|
||||||
|
private final DailyUtil dailyUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 일계부 수입 조회
|
* 일계부 수입 조회
|
||||||
*
|
*
|
||||||
@@ -59,12 +75,26 @@ public class SaveDailyIncomeController {
|
|||||||
|
|
||||||
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(formVO.getDailyId());
|
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(formVO.getDailyId());
|
||||||
|
|
||||||
|
|
||||||
|
String monthPadded = formVO.getTargetMonth().length() == 1 ? "0" + formVO.getTargetMonth() : formVO.getTargetMonth();
|
||||||
|
String formRecordMonth = formVO.getTargetYear() + monthPadded;
|
||||||
|
|
||||||
|
if( !( formRecordMonth.equals(dailyRecord.getRecordMonth()) && formVO.getTargetDayGroup().equals(dailyRecord.getGroupNo()) ) ){
|
||||||
|
DailyDayGroupDto dailyDayGroupDto = dailyDayGroupPortIn.detailbyGroupNo(formVO.getTargetDayGroup());
|
||||||
|
dailyRecord = getOtherDailyRecord(formRecordMonth, dailyDayGroupDto, dailyRecord.getHouseholdSeq());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||||
formVO.setDailyId(dailyRecord.getId());
|
formVO.setDailyId(dailyRecord.getId());
|
||||||
|
|
||||||
dailyIncomePortIn.create(formVO);
|
dailyIncomePortIn.create(formVO);
|
||||||
|
|
||||||
|
if(!dailyRecord.getIncomeStatus().equals(DailyTargetStatus.TARGET)) {
|
||||||
|
dailyRecordPortIn.updateByStatus(dailyRecord.getRecordMonth(), dailyRecord.getGroupNo(), dailyRecord.getHouseholdSeq(), "INCOME", DailyTargetStatus.TARGET.name());
|
||||||
|
}
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,4 +111,36 @@ public class SaveDailyIncomeController {
|
|||||||
|
|
||||||
return dailyRecord;
|
return dailyRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DailyRecordDto getOtherDailyRecord(String searchMonth, DailyDayGroupDto dailyDayGroupDto, Long householdSeq) {
|
||||||
|
|
||||||
|
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(searchMonth, dailyDayGroupDto.getGroupNo(), householdSeq);
|
||||||
|
|
||||||
|
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||||
|
CreateDailyRecordReqVO createDailyRecordReqVO = new CreateDailyRecordReqVO();
|
||||||
|
createDailyRecordReqVO.setTodayNone("N");
|
||||||
|
createDailyRecordReqVO.setAllStatus(DailyStatus.DONE);
|
||||||
|
createDailyRecordReqVO.setIncomeStatus(DailyTargetStatus.TARGET);
|
||||||
|
createDailyRecordReqVO.setFarmingStatus(DailyTargetStatus.TODAY_NONE);
|
||||||
|
createDailyRecordReqVO.setRecordMonth(searchMonth);
|
||||||
|
createDailyRecordReqVO.setDayGroupNo(dailyDayGroupDto.getGroupNo());
|
||||||
|
|
||||||
|
createDailyRecordReqVO.setStartDate(dailyUtil.getDayToLocalDate(searchMonth, dailyDayGroupDto.getStartDay()));
|
||||||
|
createDailyRecordReqVO.setEndDate(dailyUtil.getDayToLocalDate(searchMonth, dailyDayGroupDto.getEndDay()));
|
||||||
|
|
||||||
|
|
||||||
|
createDailyRecordReqVO.setHouseholdSeq(householdSeq);
|
||||||
|
|
||||||
|
dailyRecordPortIn.create(createDailyRecordReqVO);
|
||||||
|
|
||||||
|
dailyRecord = dailyRecordPortIn.detail(searchMonth, dailyDayGroupDto.getGroupNo(), householdSeq);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return dailyRecord;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapt
|
|||||||
import app.module.core.config.application.enums.DailyInputType;
|
import app.module.core.config.application.enums.DailyInputType;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.NonNull;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
@@ -52,4 +53,15 @@ public class SaveDailyIncomeReqVO extends DailyIncomeUIReqVO {
|
|||||||
* 현물평가액
|
* 현물평가액
|
||||||
*/
|
*/
|
||||||
private Long estimatedValue;
|
private Long estimatedValue;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private String targetYear;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private String targetMonth;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private Integer targetDayGroup;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,29 +21,29 @@ public class SaveDailyIncomeValidator implements Validator {
|
|||||||
public void validate(Object target, Errors errors) {
|
public void validate(Object target, Errors errors) {
|
||||||
SaveDailyIncomeReqVO vo = (SaveDailyIncomeReqVO) target;
|
SaveDailyIncomeReqVO vo = (SaveDailyIncomeReqVO) target;
|
||||||
|
|
||||||
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
// if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||||
errors.rejectValue(
|
// errors.rejectValue(
|
||||||
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
|
// "quantity", CommonConstants.VALID_CODE_NOTBLANK,
|
||||||
"수량을 입력해 주세요.");
|
// "수량을 입력해 주세요.");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (vo.getQuantity() != null && vo.getQuantity() <= 0) {
|
// if (vo.getQuantity() != null && vo.getQuantity() <= 0) {
|
||||||
errors.rejectValue(
|
// errors.rejectValue(
|
||||||
"quantity", CommonConstants.VALID_CODE_INVALID_ZERO,
|
// "quantity", CommonConstants.VALID_CODE_INVALID_ZERO,
|
||||||
"수량은 0 이상 입력해 주세요.");
|
// "수량은 0 이상 입력해 주세요.");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
// if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
||||||
errors.rejectValue(
|
// errors.rejectValue(
|
||||||
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
|
// "unitCode", CommonConstants.VALID_CODE_NOTBLANK,
|
||||||
"단위를 선택해 주세요.");
|
// "단위를 선택해 주세요.");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if ("code.record.unit.self".equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
// if ("code.record.unit.self".equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||||
errors.rejectValue(
|
// errors.rejectValue(
|
||||||
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
// "unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
||||||
"단위를 입력해 주세요.");
|
// "단위를 입력해 주세요.");
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
|
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
|
||||||
errors.rejectValue(
|
errors.rejectValue(
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.ports.application.domain;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import app.module.core.config.application.enums.DailyInputType;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class SaveDailyIncomeExcelCmd extends AuditCommand {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
private DailyInputType inputType;
|
||||||
|
/**
|
||||||
|
* 유형
|
||||||
|
*/
|
||||||
|
private String category;
|
||||||
|
/**
|
||||||
|
* 지출 부호
|
||||||
|
*/
|
||||||
|
private String expenseMark;
|
||||||
|
private Boolean credit;
|
||||||
|
private String cropCode;
|
||||||
|
private String incomeKind;
|
||||||
|
private String sourcePurpose;
|
||||||
|
private Double quantity;
|
||||||
|
private String unitCode;
|
||||||
|
private String unitSelf;
|
||||||
|
private Long price;
|
||||||
|
private Long estimatedValue;
|
||||||
|
private String incomeMark;
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapte
|
|||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence.modal.GetDailyPowerDto;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence.modal.GetDailyPowerDto;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.GetDailyPowerCmd;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.GetDailyPowerCmd;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.SaveDailyPowerCmd;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.SaveDailyPowerCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.SaveDailyPowerExcelCmd;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@@ -36,4 +37,11 @@ public interface SaveDailyPowerMapper {
|
|||||||
* @param command 수정 데이터
|
* @param command 수정 데이터
|
||||||
*/
|
*/
|
||||||
void updateDailyPower(SaveDailyPowerCmd command);
|
void updateDailyPower(SaveDailyPowerCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 동력 사용시간 등록_Excel
|
||||||
|
*
|
||||||
|
* @param command 등록 데이터
|
||||||
|
*/
|
||||||
|
void createDailyPowerExcel(SaveDailyPowerExcelCmd command);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class SaveDailyPowerExcelCmd extends AuditCommand {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
private String equipmentName;
|
||||||
|
private String equipmentMark;
|
||||||
|
private Double ownedHours;
|
||||||
|
private Double leasedHours;
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapter
|
|||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.persistence.modal.GetDailyWorkDto;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.persistence.modal.GetDailyWorkDto;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.application.domain.GetDailyWorkCmd;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.application.domain.GetDailyWorkCmd;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.application.domain.SaveDailyWorkCmd;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.application.domain.SaveDailyWorkCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.application.domain.SaveDailyWorkExcelCmd;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@@ -36,4 +37,11 @@ public interface SaveDailyWorkMapper {
|
|||||||
* @param command 수정 데이터
|
* @param command 수정 데이터
|
||||||
*/
|
*/
|
||||||
void updateDailyWork(SaveDailyWorkCmd command);
|
void updateDailyWork(SaveDailyWorkCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 노동투입 등록_Excel
|
||||||
|
*
|
||||||
|
* @param command 등록 데이터
|
||||||
|
*/
|
||||||
|
void createDailyWorkExcel(SaveDailyWorkExcelCmd command);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.application.domain;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class SaveDailyWorkExcelCmd extends AuditCommand {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
private String itemName;
|
||||||
|
private String itemMark;
|
||||||
|
private String workName;
|
||||||
|
private String workMark;
|
||||||
|
private Double workLandArea;
|
||||||
|
private String areaUnitCode;
|
||||||
|
private String areaUnitSelf;
|
||||||
|
private Double harvestQuantity;
|
||||||
|
private String harvestUnitCode;
|
||||||
|
private String harvestUnitSelf;
|
||||||
|
private Double ownerTime;
|
||||||
|
private Double spouseTime;
|
||||||
|
private Double familyMHours;
|
||||||
|
private Double familyFHours;
|
||||||
|
private Double hiredMHours;
|
||||||
|
private Double hiredFHours;
|
||||||
|
private Double sharedMHours;
|
||||||
|
private Double sharedFHours;
|
||||||
|
private Double volunteerMHours;
|
||||||
|
private Double volunteerFHours;
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.persistence;
|
package app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.persistence;
|
||||||
|
|
||||||
import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports.application.domain.SaveForestProductCmd;
|
import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports.application.domain.SaveForestProductCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports.application.domain.SaveForestProductExcelCmd;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@@ -8,4 +9,5 @@ public interface SaveForestProductMapper {
|
|||||||
String getForestProductStatus(Long monthlyInputStatusId);
|
String getForestProductStatus(Long monthlyInputStatusId);
|
||||||
void createForestProduct(SaveForestProductCmd cmd);
|
void createForestProduct(SaveForestProductCmd cmd);
|
||||||
void updateForestProduct(SaveForestProductCmd cmd);
|
void updateForestProduct(SaveForestProductCmd cmd);
|
||||||
|
void createForestProductExcel(SaveForestProductExcelCmd cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports.application.domain;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class SaveForestProductExcelCmd extends AuditCommand {
|
||||||
|
private Long forestProductId;
|
||||||
|
private Long householdSeq;
|
||||||
|
private Long monthlyInputStatusId;
|
||||||
|
private String recordMonth;
|
||||||
|
private String streetNum;
|
||||||
|
private String landType;
|
||||||
|
private String town;
|
||||||
|
private String cropName;
|
||||||
|
private String cropCode;
|
||||||
|
private String landArea;
|
||||||
|
private String availableArea;
|
||||||
|
private String mainYield;
|
||||||
|
private String mainYieldUnitCode;
|
||||||
|
private String mainYieldUnit;
|
||||||
|
private String mainSaleAmount;
|
||||||
|
private String mainSaleUnitCode;
|
||||||
|
private String mainSaleUnit;
|
||||||
|
private String subYield;
|
||||||
|
private String subYieldUnitCode;
|
||||||
|
private String subYieldUnit;
|
||||||
|
private String subSaleAmount;
|
||||||
|
private String subSaleUnitCode;
|
||||||
|
private String subSaleUnit;
|
||||||
|
}
|
||||||
@@ -116,18 +116,29 @@
|
|||||||
<select id="selectRegionMainExcel"
|
<select id="selectRegionMainExcel"
|
||||||
resultType="app.module.admin.usecase.dashboard.chart.adapters.persistence.model.RegionMainExcelDto">
|
resultType="app.module.admin.usecase.dashboard.chart.adapters.persistence.model.RegionMainExcelDto">
|
||||||
/* selectRegionMainExcel : 대시보드 엑셀다운로드 (실사) */
|
/* selectRegionMainExcel : 대시보드 엑셀다운로드 (실사) */
|
||||||
|
WITH filtered_uicode AS (
|
||||||
|
SELECT *
|
||||||
|
FROM uicode
|
||||||
|
WHERE parent_id = 'code.region.main'
|
||||||
|
AND is_deleted = false
|
||||||
|
<if test="'prod'.equals(activeProfiles)">
|
||||||
|
AND in_use = true
|
||||||
|
</if>
|
||||||
|
)
|
||||||
|
-- 전체 합계
|
||||||
SELECT
|
SELECT
|
||||||
u.code_text AS region_name,
|
'전체' AS region_name,
|
||||||
COUNT(DISTINCT a.seq) AS researcher_count,
|
COUNT(DISTINCT ahr.admin_seq) AS researcher_count,
|
||||||
COUNT(DISTINCT rhh.household_seq) AS household_count,
|
COUNT(DISTINCT h.seq) AS household_count,
|
||||||
CASE
|
CASE
|
||||||
WHEN COALESCE(AVG(v.current_completion_rate), 0) > 0 THEN ROUND(COALESCE(AVG(v.current_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
|
ELSE 0
|
||||||
END AS avg_completion_rate,
|
END AS avg_completion_rate,
|
||||||
COUNT(DISTINCT CASE WHEN hv.id IS NOT NULL THEN hv.household_seq END) AS visit_count,
|
COUNT(DISTINCT CASE WHEN hv.id IS NOT NULL THEN hv.household_seq END) AS visit_count,
|
||||||
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS gift_sent_count,
|
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS gift_sent_count,
|
||||||
u.order_no
|
-1 AS sort_order
|
||||||
FROM uicode u
|
FROM filtered_uicode u
|
||||||
LEFT JOIN admin a
|
LEFT JOIN admin a
|
||||||
ON a.region_main_code = u.id
|
ON a.region_main_code = u.id
|
||||||
AND a.is_deleted = false
|
AND a.is_deleted = false
|
||||||
@@ -139,7 +150,7 @@
|
|||||||
ON rhh.admin_seq = a.seq
|
ON rhh.admin_seq = a.seq
|
||||||
AND rhh.is_deleted = false
|
AND rhh.is_deleted = false
|
||||||
LEFT JOIN household h
|
LEFT JOIN household h
|
||||||
ON h.seq = rhh.household_seq
|
ON u.id = h.region_main_code
|
||||||
AND h.is_deleted = false
|
AND h.is_deleted = false
|
||||||
AND h.is_panel = true
|
AND h.is_panel = true
|
||||||
LEFT JOIN household_visit hv
|
LEFT JOIN household_visit hv
|
||||||
@@ -149,22 +160,22 @@
|
|||||||
LEFT JOIN v_monthly_completion_rate v
|
LEFT JOIN v_monthly_completion_rate v
|
||||||
ON v.household_seq = h.seq
|
ON v.household_seq = h.seq
|
||||||
AND v.record_month = #{recordMonth}
|
AND v.record_month = #{recordMonth}
|
||||||
WHERE u.parent_id = 'code.region.main' and u.is_deleted = false
|
WHERE u.parent_id = 'code.region.main' AND u.is_deleted = false
|
||||||
<if test="'prod'.equals(activeProfiles)">
|
|
||||||
and u.in_use = true
|
|
||||||
</if>
|
|
||||||
GROUP BY u.code_text, u.order_no
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
-- 전체 합계 행
|
-- 지역별 집계
|
||||||
SELECT
|
SELECT
|
||||||
'전체' AS region_name,
|
u.code_text AS region_name,
|
||||||
COUNT(DISTINCT a.seq),
|
COUNT(DISTINCT ahr.admin_seq) AS researcher_count,
|
||||||
COUNT(DISTINCT rhh.household_seq),
|
COUNT(DISTINCT h.seq) AS household_count,
|
||||||
COALESCE(ROUND(AVG(v.current_completion_rate), 1), 0),
|
CASE
|
||||||
COUNT(DISTINCT CASE WHEN hv.id IS NOT NULL THEN hv.household_seq END),
|
WHEN COALESCE(AVG(v.current_completion_rate), 0) > 0
|
||||||
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END),
|
THEN ROUND(COALESCE(AVG(v.current_completion_rate), 0), 1)
|
||||||
-1 as order_no
|
ELSE 0
|
||||||
FROM uicode u
|
END AS avg_completion_rate,
|
||||||
|
COUNT(DISTINCT CASE WHEN hv.id IS NOT NULL THEN hv.household_seq END) AS visit_count,
|
||||||
|
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS gift_sent_count,
|
||||||
|
u.order_no AS sort_order
|
||||||
|
FROM filtered_uicode u
|
||||||
LEFT JOIN admin a
|
LEFT JOIN admin a
|
||||||
ON a.region_main_code = u.id
|
ON a.region_main_code = u.id
|
||||||
AND a.is_deleted = false
|
AND a.is_deleted = false
|
||||||
@@ -176,7 +187,7 @@
|
|||||||
ON rhh.admin_seq = a.seq
|
ON rhh.admin_seq = a.seq
|
||||||
AND rhh.is_deleted = false
|
AND rhh.is_deleted = false
|
||||||
LEFT JOIN household h
|
LEFT JOIN household h
|
||||||
ON h.seq = rhh.household_seq
|
ON u.id = h.region_main_code
|
||||||
AND h.is_deleted = false
|
AND h.is_deleted = false
|
||||||
AND h.is_panel = true
|
AND h.is_panel = true
|
||||||
LEFT JOIN household_visit hv
|
LEFT JOIN household_visit hv
|
||||||
@@ -186,86 +197,107 @@
|
|||||||
LEFT JOIN v_monthly_completion_rate v
|
LEFT JOIN v_monthly_completion_rate v
|
||||||
ON v.household_seq = h.seq
|
ON v.household_seq = h.seq
|
||||||
AND v.record_month = #{recordMonth}
|
AND v.record_month = #{recordMonth}
|
||||||
WHERE u.parent_id = 'code.region.main' and u.is_deleted = false
|
WHERE u.parent_id = 'code.region.main' AND u.is_deleted = false
|
||||||
<if test="'prod'.equals(activeProfiles)">
|
GROUP BY u.id, u.code_text, u.order_no
|
||||||
and u.in_use = true
|
ORDER BY sort_order
|
||||||
</if>
|
|
||||||
ORDER BY order_no
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectRegionDetailExcel"
|
<select id="selectRegionDetailExcel"
|
||||||
resultType="app.module.admin.usecase.dashboard.chart.adapters.persistence.model.RegionDetailExcelDto">
|
resultType="app.module.admin.usecase.dashboard.chart.adapters.persistence.model.RegionDetailExcelDto">
|
||||||
/* selectRegionDetailExcel : 대시보드 엑셀다운로드 (세부지역) */
|
/* selectRegionDetailExcel : 대시보드 엑셀다운로드 (세부지역) */
|
||||||
-- 세부 지역별 데이터
|
-- 세부 지역별 데이터
|
||||||
SELECT
|
WITH detail_region AS (
|
||||||
detail_uicode.code_text AS region_detail_name,
|
SELECT *
|
||||||
parent_uicode.code_text AS region_name,
|
FROM uicode
|
||||||
COUNT(DISTINCT rhh.household_seq) AS household_count,
|
WHERE id LIKE 'code.region.detail.%'
|
||||||
|
AND is_deleted = false
|
||||||
|
),
|
||||||
|
sub_region AS (
|
||||||
|
SELECT *
|
||||||
|
FROM uicode
|
||||||
|
WHERE parent_id = 'code.region.sub'
|
||||||
|
AND is_deleted = false
|
||||||
|
),
|
||||||
|
main_region AS (
|
||||||
|
SELECT *
|
||||||
|
FROM uicode
|
||||||
|
WHERE parent_id = 'code.region.main'
|
||||||
|
AND is_deleted = false
|
||||||
|
),
|
||||||
|
-- 지역별 통계 + 전체합계
|
||||||
|
region_stats AS (
|
||||||
|
SELECT
|
||||||
|
COALESCE(main.code_text, '-') AS region_main_name,
|
||||||
|
COALESCE(detail.code_text, '-') AS region_detail_name,
|
||||||
|
COUNT(DISTINCT h.seq) AS household_count,
|
||||||
CASE
|
CASE
|
||||||
WHEN AVG(v.current_completion_rate) > 0 THEN ROUND(AVG(v.current_completion_rate), 1)
|
WHEN COALESCE(AVG(v.current_completion_rate), 0) > 0
|
||||||
ELSE 0
|
THEN ROUND(COALESCE(AVG(v.current_completion_rate), 0), 1)
|
||||||
END AS avg_completion_rate,
|
ELSE 0
|
||||||
COUNT(DISTINCT hv_visit.household_seq) AS visit_count,
|
END AS avg_completion_rate,
|
||||||
COUNT(DISTINCT hv_gift.household_seq) AS gift_sent_count,
|
COUNT(DISTINCT CASE WHEN hv.id IS NOT NULL THEN hv.household_seq END) AS visit_count,
|
||||||
parent_uicode.order_no AS region_order,
|
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS gift_sent_count,
|
||||||
detail_uicode.order_no AS region_detail_order
|
COALESCE(main.order_no, 9999) AS main_order,
|
||||||
FROM uicode detail_uicode
|
COALESCE(sub.order_no, 9999) AS sub_order,
|
||||||
LEFT JOIN uicode parent_uicode ON parent_uicode.id = detail_uicode.parent_id
|
COALESCE(detail.order_no, 9999) AS detail_order
|
||||||
LEFT JOIN household h
|
FROM detail_region detail
|
||||||
ON h.region_detail_code = detail_uicode.id
|
INNER JOIN household h
|
||||||
AND h.is_deleted = false
|
ON h.region_detail_code = detail.id
|
||||||
AND h.is_panel = true
|
AND h.is_deleted = false
|
||||||
LEFT JOIN researcher_has_household rhh
|
AND h.is_panel = true
|
||||||
ON rhh.household_seq = h.seq
|
LEFT JOIN main_region main
|
||||||
AND rhh.is_deleted = false
|
ON main.id = h.region_main_code
|
||||||
LEFT JOIN v_monthly_completion_rate v
|
LEFT JOIN sub_region sub
|
||||||
ON v.household_seq = h.seq
|
ON sub.id = h.region_sub_code
|
||||||
AND v.record_month = #{recordMonth}
|
LEFT JOIN household_visit hv
|
||||||
LEFT JOIN household_visit hv_visit
|
ON hv.household_seq = h.seq
|
||||||
ON hv_visit.household_seq = h.seq
|
AND hv.is_deleted = false
|
||||||
AND hv_visit.is_deleted = false
|
AND TO_CHAR(hv.visit_date, 'YYYYMM') = #{recordMonth}
|
||||||
AND TO_CHAR(hv_visit.visit_date, 'YYYYMM') = #{recordMonth}
|
LEFT JOIN v_monthly_completion_rate v
|
||||||
LEFT JOIN household_visit hv_gift
|
ON v.household_seq = h.seq
|
||||||
ON hv_gift.household_seq = h.seq
|
AND v.record_month = #{recordMonth}
|
||||||
AND hv_gift.is_deleted = false
|
<if test="'prod'.equals(activeProfiles)">
|
||||||
AND hv_gift.is_gift_sent = true
|
WHERE main.in_use IS DISTINCT FROM false
|
||||||
AND TO_CHAR(hv_gift.visit_date, 'YYYYMM') = #{recordMonth}
|
</if>
|
||||||
WHERE detail_uicode.id LIKE 'code.region.detail.%'
|
GROUP BY
|
||||||
GROUP BY
|
main.code_text, main.order_no,
|
||||||
detail_uicode.code_text,
|
sub.order_no,
|
||||||
parent_uicode.code_text,
|
detail.code_text, detail.order_no
|
||||||
parent_uicode.order_no,
|
UNION ALL
|
||||||
detail_uicode.order_no
|
SELECT
|
||||||
UNION ALL
|
'전체' AS region_main_name,
|
||||||
-- 전체 합계 행
|
|
||||||
SELECT
|
|
||||||
'전체' AS region_detail_name,
|
'전체' AS region_detail_name,
|
||||||
'전체' AS region_name,
|
COUNT(DISTINCT h.seq),
|
||||||
COUNT(DISTINCT rhh.household_seq) AS household_count,
|
CASE
|
||||||
COALESCE(ROUND(AVG(v.current_completion_rate), 1), 0),
|
WHEN COALESCE(AVG(v.current_completion_rate), 0) > 0
|
||||||
COUNT(DISTINCT hv_visit.household_seq),
|
THEN ROUND(COALESCE(AVG(v.current_completion_rate), 0), 1)
|
||||||
COUNT(DISTINCT hv_gift.household_seq),
|
ELSE 0
|
||||||
-1 AS region_order,
|
END,
|
||||||
-1 AS region_detail_order
|
COUNT(DISTINCT CASE WHEN hv.id IS NOT NULL THEN hv.household_seq END),
|
||||||
FROM household h
|
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END),
|
||||||
LEFT JOIN researcher_has_household rhh
|
-1 AS main_order, -- 전체합계가 맨 위로 오도록
|
||||||
ON rhh.household_seq = h.seq
|
-1 AS sub_order,
|
||||||
AND rhh.is_deleted = false
|
-1 AS detail_order
|
||||||
LEFT JOIN v_monthly_completion_rate v
|
FROM household h
|
||||||
ON v.household_seq = h.seq
|
LEFT JOIN main_region main
|
||||||
AND v.record_month = #{recordMonth}
|
ON main.id = h.region_main_code
|
||||||
LEFT JOIN household_visit hv_visit
|
LEFT JOIN sub_region sub
|
||||||
ON hv_visit.household_seq = h.seq
|
ON sub.id = h.region_sub_code
|
||||||
AND hv_visit.is_deleted = false
|
LEFT JOIN household_visit hv
|
||||||
AND TO_CHAR(hv_visit.visit_date, 'YYYYMM') = #{recordMonth}
|
ON hv.household_seq = h.seq
|
||||||
LEFT JOIN household_visit hv_gift
|
AND hv.is_deleted = false
|
||||||
ON hv_gift.household_seq = h.seq
|
AND TO_CHAR(hv.visit_date, 'YYYYMM') = #{recordMonth}
|
||||||
AND hv_gift.is_deleted = false
|
LEFT JOIN v_monthly_completion_rate v
|
||||||
AND hv_gift.is_gift_sent = true
|
ON v.household_seq = h.seq
|
||||||
AND TO_CHAR(hv_gift.visit_date, 'YYYYMM') = #{recordMonth}
|
AND v.record_month = #{recordMonth}
|
||||||
WHERE h.is_deleted = false AND h.is_panel = true
|
WHERE h.is_deleted = false
|
||||||
order by
|
AND h.is_panel = true
|
||||||
region_order ASC,
|
<if test="'prod'.equals(activeProfiles)">
|
||||||
region_detail_order ASC
|
AND main.in_use IS DISTINCT FROM false
|
||||||
|
</if>
|
||||||
|
)
|
||||||
|
SELECT *
|
||||||
|
FROM region_stats
|
||||||
|
ORDER BY main_order, sub_order, detail_order
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -3,10 +3,19 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
<mapper
|
<mapper
|
||||||
namespace="app.module.admin.usecase.household.checkHouseholdNum.adapters.persistence.CheckHouseholdNumMapper">
|
namespace="app.module.admin.usecase.household.checkHouseholdNum.adapters.persistence.CheckHouseholdNumMapper">
|
||||||
<select id="checkHouseholdNum"
|
|
||||||
resultType="app.module.admin.usecase.household.checkHouseholdNum.ports.application.domain.CheckHouseholdNum">
|
<select id="checkHouseholdNum"
|
||||||
SELECT COUNT(*) > 0 AS is_duplicated
|
resultType="app.module.admin.usecase.household.checkHouseholdNum.ports.application.domain.CheckHouseholdNum">
|
||||||
FROM household
|
SELECT COUNT(*) > 0 AS is_duplicated,MAX(household_num) AS householdSeq
|
||||||
WHERE household_num = #{householdNum};
|
FROM household
|
||||||
</select>
|
WHERE household_num = #{householdNum}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkHouseholdNumExcel"
|
||||||
|
resultType="app.module.admin.usecase.household.checkHouseholdNum.ports.application.domain.CheckHouseholdNum">
|
||||||
|
SELECT COUNT(*) > 0 AS is_duplicated, seq AS householdSeq
|
||||||
|
FROM household
|
||||||
|
WHERE household_num = #{householdNum}
|
||||||
|
GROUP BY SEQ
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -47,7 +47,8 @@
|
|||||||
uf.id AS file_id,
|
uf.id AS file_id,
|
||||||
uf.name AS file_name,
|
uf.name AS file_name,
|
||||||
uf.origin_name AS file_origin_name,
|
uf.origin_name AS file_origin_name,
|
||||||
uf.path AS file_path
|
uf.path AS file_path,
|
||||||
|
di.ocr_error_result AS ocrErrorResult
|
||||||
<if test="searchMonth == true">
|
<if test="searchMonth == true">
|
||||||
, EXTRACT(DAY FROM CAST(dr.start_date as date)) as start_day
|
, EXTRACT(DAY FROM CAST(dr.start_date as date)) as start_day
|
||||||
, EXTRACT(DAY FROM CAST(dr.end_date as date)) as end_day
|
, EXTRACT(DAY FROM CAST(dr.end_date as date)) as end_day
|
||||||
@@ -163,7 +164,8 @@
|
|||||||
uf.id AS file_id,
|
uf.id AS file_id,
|
||||||
uf.name AS file_name,
|
uf.name AS file_name,
|
||||||
uf.origin_name AS file_origin_name,
|
uf.origin_name AS file_origin_name,
|
||||||
uf.path AS file_path
|
uf.path AS file_path,
|
||||||
|
de.ocr_error_result AS ocrErrorResult
|
||||||
<if test="searchMonth == true">
|
<if test="searchMonth == true">
|
||||||
, EXTRACT(DAY FROM CAST(dr.start_date as date)) as start_day
|
, EXTRACT(DAY FROM CAST(dr.start_date as date)) as start_day
|
||||||
, EXTRACT(DAY FROM CAST(dr.end_date as date)) as end_day
|
, EXTRACT(DAY FROM CAST(dr.end_date as date)) as end_day
|
||||||
|
|||||||
@@ -6,67 +6,109 @@
|
|||||||
<select id="getDailyRecordsStatus"
|
<select id="getDailyRecordsStatus"
|
||||||
resultType="app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordsStatus.ports.application.domain.GetDailyRecordsStatus">
|
resultType="app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordsStatus.ports.application.domain.GetDailyRecordsStatus">
|
||||||
/* getDailyRecordsStatus : 일계부 등록 현황 리스트 조회 */
|
/* getDailyRecordsStatus : 일계부 등록 현황 리스트 조회 */
|
||||||
WITH data_counts AS (
|
WITH
|
||||||
SELECT
|
-- 각 일자별 항목별 개수를 미리 계산
|
||||||
dr.id,
|
income AS (
|
||||||
COUNT(DISTINCT di.id) AS income_cnt,
|
SELECT daily_record_seq, COUNT(*) AS income_cnt
|
||||||
COUNT(DISTINCT dw.id) AS work_cnt,
|
FROM daily_income
|
||||||
COUNT(DISTINCT de.id) AS expense_cnt,
|
WHERE is_deleted = false
|
||||||
COUNT(DISTINCT dp.id) AS power_cnt,
|
GROUP BY daily_record_seq
|
||||||
COUNT(DISTINCT dfs.id) AS forestry_cnt,
|
),
|
||||||
COUNT(distinct dfm.id) AS farming_cnt
|
work AS (
|
||||||
FROM daily_record dr
|
SELECT daily_record_seq, COUNT(*) AS work_cnt
|
||||||
LEFT JOIN daily_income di ON di.daily_record_seq = dr.id AND di.is_deleted = false
|
FROM daily_work
|
||||||
LEFT JOIN daily_work dw ON dw.daily_record_seq = dr.id AND dw.is_deleted = false
|
WHERE is_deleted = false
|
||||||
LEFT JOIN daily_expense de ON de.daily_record_seq = dr.id AND de.is_deleted = false
|
GROUP BY daily_record_seq
|
||||||
LEFT JOIN daily_power dp ON dp.daily_record_seq = dr.id AND dp.is_deleted = false
|
),
|
||||||
LEFT JOIN daily_forestry dfs ON dfs.daily_record_seq = dr.id AND dfs.is_deleted = false
|
expense AS (
|
||||||
LEFT JOIN daily_farming dfm on dfm.daily_record_seq = dr.id and dfm.is_deleted = false
|
SELECT daily_record_seq, COUNT(*) AS expense_cnt
|
||||||
WHERE dr.household_seq = #{householdSeq}
|
FROM daily_expense
|
||||||
AND dr.record_month = #{recordMonth}
|
WHERE is_deleted = false
|
||||||
AND dr.is_deleted = false
|
GROUP BY daily_record_seq
|
||||||
GROUP BY dr.id
|
),
|
||||||
),
|
power AS (
|
||||||
month_check AS (
|
SELECT daily_record_seq, COUNT(*) AS power_cnt
|
||||||
SELECT
|
FROM daily_power
|
||||||
#{recordMonth} = TO_CHAR(CURRENT_DATE, 'YYYYMM') AS is_current_month,
|
WHERE is_deleted = false
|
||||||
EXTRACT(DAY FROM (TO_DATE(#{recordMonth}, 'YYYYMM') + INTERVAL '1 MONTH - 1 day')) AS month_last_day /* recordMonth 의 말일 */
|
GROUP BY daily_record_seq
|
||||||
)
|
),
|
||||||
|
forestry AS (
|
||||||
|
SELECT daily_record_seq, COUNT(*) AS forestry_cnt
|
||||||
|
FROM daily_forestry
|
||||||
|
WHERE is_deleted = false
|
||||||
|
GROUP BY daily_record_seq
|
||||||
|
),
|
||||||
|
farming AS (
|
||||||
|
SELECT daily_record_seq, COUNT(*) AS farming_cnt
|
||||||
|
FROM daily_farming
|
||||||
|
WHERE is_deleted = false
|
||||||
|
GROUP BY daily_record_seq
|
||||||
|
),
|
||||||
|
-- record 테이블에 각 항목별 count를 결합
|
||||||
|
data_counts AS (
|
||||||
|
SELECT
|
||||||
|
dr.id,
|
||||||
|
COALESCE(income.income_cnt, 0) AS income_cnt,
|
||||||
|
COALESCE(work.work_cnt, 0) AS work_cnt,
|
||||||
|
COALESCE(expense.expense_cnt, 0) AS expense_cnt,
|
||||||
|
COALESCE(power.power_cnt, 0) AS power_cnt,
|
||||||
|
COALESCE(forestry.forestry_cnt, 0) AS forestry_cnt,
|
||||||
|
COALESCE(farming.farming_cnt, 0) AS farming_cnt
|
||||||
|
FROM daily_record dr
|
||||||
|
LEFT JOIN income ON income.daily_record_seq = dr.id
|
||||||
|
LEFT JOIN work ON work.daily_record_seq = dr.id
|
||||||
|
LEFT JOIN expense ON expense.daily_record_seq = dr.id
|
||||||
|
LEFT JOIN power ON power.daily_record_seq = dr.id
|
||||||
|
LEFT JOIN forestry ON forestry.daily_record_seq = dr.id
|
||||||
|
LEFT JOIN farming ON farming.daily_record_seq = dr.id
|
||||||
|
WHERE dr.household_seq = #{householdSeq}
|
||||||
|
AND dr.record_month = #{recordMonth}
|
||||||
|
AND dr.is_deleted = false
|
||||||
|
),
|
||||||
|
-- 현재 월 여부와 말일 계산
|
||||||
|
month_check AS (
|
||||||
|
SELECT
|
||||||
|
(#{recordMonth} = TO_CHAR(CURRENT_DATE, 'YYYYMM')) AS is_current_month,
|
||||||
|
EXTRACT(DAY FROM (TO_DATE(#{recordMonth}, 'YYYYMM') + INTERVAL '1 MONTH - 1 day')) AS month_last_day
|
||||||
|
)
|
||||||
SELECT
|
SELECT
|
||||||
dr.id AS id,
|
dr.id AS id,
|
||||||
ddg.group_no AS day_group_no,
|
ddg.group_no AS day_group_no,
|
||||||
/* 해당 월의 말일을 기준으로 종료일을 제한하여 일자 그룹 표시 */
|
-- 일자 범위 표시
|
||||||
ddg.start_day ||
|
ddg.start_day ||
|
||||||
CASE
|
CASE
|
||||||
WHEN ddg.start_day = LEAST(ddg.end_day, mc.month_last_day)
|
WHEN ddg.start_day = LEAST(ddg.end_day, mc.month_last_day)
|
||||||
THEN ''
|
THEN ''
|
||||||
ELSE '-' || LEAST(ddg.end_day, mc.month_last_day)
|
ELSE '-' || LEAST(ddg.end_day, mc.month_last_day)
|
||||||
END AS day_group,
|
END AS day_group,
|
||||||
CASE
|
-- 전체 상태
|
||||||
WHEN mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE) THEN 'WAITING' /* 대기 */
|
CASE
|
||||||
WHEN dr.all_status IN ('DONE', 'TODAY_NONE') THEN 'DONE' /* 작성완료 */
|
WHEN mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE) THEN 'WAITING'
|
||||||
WHEN dr.all_status = 'WAITING' THEN 'INCOMPLETE' /* 미완료 */
|
WHEN dr.all_status IN ('DONE', 'TODAY_NONE') THEN 'DONE'
|
||||||
ELSE 'EMPTY' /* 미작성 */
|
WHEN dr.all_status = 'WAITING' THEN 'INCOMPLETE'
|
||||||
END AS all_status,
|
ELSE 'EMPTY'
|
||||||
fn_get_status(mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE), dr.income_status, dc.income_cnt) AS income_status,
|
END AS all_status,
|
||||||
fn_get_status(mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE), dr.work_status, dc.work_cnt) AS work_status,
|
-- 세부 상태
|
||||||
fn_get_status(mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE), dr.expense_status, dc.expense_cnt) AS expense_status,
|
fn_get_status(mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE), dr.income_status, dc.income_cnt) AS income_status,
|
||||||
fn_get_status(mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE), dr.power_status, dc.power_cnt) AS power_status,
|
fn_get_status(mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE), dr.work_status, dc.work_cnt) AS work_status,
|
||||||
fn_get_status(mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE), dr.forestry_status, dc.forestry_cnt) AS forestry_status,
|
fn_get_status(mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE), dr.expense_status, dc.expense_cnt) AS expense_status,
|
||||||
fn_get_farming_status(
|
fn_get_status(mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE), dr.power_status, dc.power_cnt) AS power_status,
|
||||||
ddg.start_day,
|
fn_get_status(mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE), dr.forestry_status, dc.forestry_cnt) AS forestry_status,
|
||||||
dr.record_month,
|
fn_get_farming_status(
|
||||||
mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE),
|
ddg.start_day,
|
||||||
dr.farming_status,
|
dr.record_month,
|
||||||
dc.farming_cnt
|
mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE),
|
||||||
) AS farming_status
|
dr.farming_status,
|
||||||
|
dc.farming_cnt
|
||||||
|
) AS farming_status
|
||||||
FROM daily_day_group ddg
|
FROM daily_day_group ddg
|
||||||
CROSS JOIN month_check mc
|
CROSS JOIN month_check mc
|
||||||
LEFT JOIN daily_record dr ON ddg.group_no = dr.day_group_no
|
LEFT JOIN daily_record dr
|
||||||
AND dr.household_seq = #{householdSeq}
|
ON ddg.group_no = dr.day_group_no
|
||||||
AND dr.record_month = #{recordMonth}
|
AND dr.household_seq = #{householdSeq}
|
||||||
AND dr.is_deleted = false
|
AND dr.record_month = #{recordMonth}
|
||||||
LEFT JOIN data_counts dc ON dc.id = dr.id
|
AND dr.is_deleted = false
|
||||||
|
LEFT JOIN data_counts dc ON dc.id = dr.id
|
||||||
WHERE ddg.start_day <= mc.month_last_day
|
WHERE ddg.start_day <= mc.month_last_day
|
||||||
ORDER BY ddg.start_day
|
ORDER BY ddg.start_day
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -90,6 +90,11 @@
|
|||||||
<where>
|
<where>
|
||||||
1=1
|
1=1
|
||||||
|
|
||||||
|
<if test="cmd.householdNum != null and cmd.householdNum != ''">
|
||||||
|
/* 임가번호 검색 */
|
||||||
|
AND hvr.householdNum ILIKE '%' || #{cmd.householdNum} || '%'
|
||||||
|
</if>
|
||||||
|
|
||||||
<if test="cmd.ownerValue != null and cmd.ownerValue != ''">
|
<if test="cmd.ownerValue != null and cmd.ownerValue != ''">
|
||||||
/* 경영주 검색 */
|
/* 경영주 검색 */
|
||||||
<choose>
|
<choose>
|
||||||
|
|||||||
@@ -57,4 +57,44 @@
|
|||||||
<include refid="common.fields.UpdateBaseSet"/>
|
<include refid="common.fields.UpdateBaseSet"/>
|
||||||
WHERE id = #{bankAutoTransferId}
|
WHERE id = #{bankAutoTransferId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<insert id="createBankAutoTransferExpenseExcel">
|
||||||
|
/* createBankAutoTransferExpenseExcel : 은행자동이체(지출) 등록 */
|
||||||
|
INSERT INTO bank_auto_transfer
|
||||||
|
(
|
||||||
|
household_seq,
|
||||||
|
crop_code,
|
||||||
|
month,
|
||||||
|
expense_code,
|
||||||
|
transfer_category_code,
|
||||||
|
transfer_category,
|
||||||
|
source_purpose,
|
||||||
|
count,
|
||||||
|
unit_code,
|
||||||
|
unit,
|
||||||
|
price,
|
||||||
|
transfer_type,
|
||||||
|
monthly_input_status_id,
|
||||||
|
category,
|
||||||
|
<include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
#{householdSeq},
|
||||||
|
#{cropCode},
|
||||||
|
#{recordMonth},
|
||||||
|
#{expenseCode},
|
||||||
|
#{transferCategoryCode},
|
||||||
|
#{transferCategory},
|
||||||
|
#{sourcePurpose},
|
||||||
|
#{count},
|
||||||
|
#{unitCode},
|
||||||
|
#{unit},
|
||||||
|
#{price},
|
||||||
|
#{transferType},
|
||||||
|
#{monthlyInputStatusId},
|
||||||
|
#{category},
|
||||||
|
<include refid="common.fields.CreateUpdateBaseValues"/>
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -92,4 +92,60 @@
|
|||||||
<include refid="common.fields.UpdateBaseSet"/>
|
<include refid="common.fields.UpdateBaseSet"/>
|
||||||
WHERE id = #{forestProductId}
|
WHERE id = #{forestProductId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<insert id="createForestProductExcel">
|
||||||
|
/* createForestProduct : 임산물 현황 등록 */
|
||||||
|
INSERT INTO forest_product
|
||||||
|
(
|
||||||
|
household_seq,
|
||||||
|
month,
|
||||||
|
street_num,
|
||||||
|
land_type,
|
||||||
|
town,
|
||||||
|
crop_name,
|
||||||
|
crop_code,
|
||||||
|
land_area,
|
||||||
|
available_area,
|
||||||
|
main_yield,
|
||||||
|
main_yield_unit_code,
|
||||||
|
main_yield_unit,
|
||||||
|
main_sale_amount,
|
||||||
|
main_sale_unit_code,
|
||||||
|
main_sale_unit,
|
||||||
|
sub_yield,
|
||||||
|
sub_yield_unit_code,
|
||||||
|
sub_yield_unit,
|
||||||
|
sub_sale_amount,
|
||||||
|
sub_sale_unit_code,
|
||||||
|
sub_sale_unit,
|
||||||
|
monthly_input_status_id,
|
||||||
|
<include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
#{householdSeq},
|
||||||
|
#{recordMonth},
|
||||||
|
#{streetNum},
|
||||||
|
#{landType},
|
||||||
|
#{town},
|
||||||
|
#{cropName},
|
||||||
|
#{cropCode},
|
||||||
|
#{landArea},
|
||||||
|
#{availableArea},
|
||||||
|
#{mainYield},
|
||||||
|
#{mainYieldUnitCode},
|
||||||
|
#{mainYieldUnit},
|
||||||
|
#{mainSaleAmount},
|
||||||
|
#{mainSaleUnitCode},
|
||||||
|
#{mainSaleUnit},
|
||||||
|
#{subYield},
|
||||||
|
#{subYieldUnitCode},
|
||||||
|
#{subYieldUnit},
|
||||||
|
#{subSaleAmount},
|
||||||
|
#{subSaleUnitCode},
|
||||||
|
#{subSaleUnit},
|
||||||
|
#{monthlyInputStatusId},
|
||||||
|
<include refid="common.fields.CreateUpdateBaseValues"/>
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -29,4 +29,10 @@
|
|||||||
WHERE is_deleted = false
|
WHERE is_deleted = false
|
||||||
AND id = #{id}
|
AND id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<insert id="createExcelUploadLog">
|
||||||
|
INSERT INTO excel_uploade_log (file_name, month, error_message, error_detail,created_at, created_by)
|
||||||
|
VALUES (#{fileName}, #{month}, #{errorMessage}, #{errorDetail}, now(), #{createdBy})
|
||||||
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -50,9 +50,43 @@
|
|||||||
, unit_self = #{unitSelf}
|
, unit_self = #{unitSelf}
|
||||||
, price = #{price}
|
, price = #{price}
|
||||||
, estimated_value = #{estimatedValue}
|
, estimated_value = #{estimatedValue}
|
||||||
|
, ocr_error_result = false
|
||||||
where is_deleted = false
|
where is_deleted = false
|
||||||
and daily_record_seq = #{dailyRecordSeq}
|
and daily_record_seq = #{dailyRecordSeq}
|
||||||
and id = #{id}
|
and id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updateDailyExpenseOnlyId">
|
||||||
|
update daily_expense set <include refid="common.fields.UpdateBaseSet"/>
|
||||||
|
, is_credit = #{credit}
|
||||||
|
, income_mark = #{incomeMark}
|
||||||
|
, expense_kind = #{expenseKind}
|
||||||
|
, source_purpose = #{sourcePurpose}
|
||||||
|
, quantity = #{quantity}
|
||||||
|
, unit_code = #{unitCode}
|
||||||
|
, unit_self = #{unitSelf}
|
||||||
|
, price = #{price}
|
||||||
|
, estimated_value = #{estimatedValue}
|
||||||
|
, ocr_error_result = false
|
||||||
|
, daily_record_seq = #{dailyRecordSeq}
|
||||||
|
where is_deleted = false
|
||||||
|
and id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="createDailyExpenseExcel" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into daily_expense (
|
||||||
|
daily_record_seq, input_type, category, income_mark, expense_mark
|
||||||
|
, is_credit, expense_kind, source_purpose
|
||||||
|
, quantity, unit_code, unit_self, price, estimated_value
|
||||||
|
, is_deleted
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||||
|
) values (
|
||||||
|
#{dailyRecordSeq}, #{inputType}, #{category}, #{incomeMark}, #{expenseMark}
|
||||||
|
, #{credit}, #{expenseKind}, #{sourcePurpose}
|
||||||
|
, #{quantity}, #{unitCode}, #{unitSelf}, #{price}, #{estimatedValue}
|
||||||
|
, false
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -53,4 +53,20 @@
|
|||||||
and id = #{id}
|
and id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<insert id="createDailyForestryExcel" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into daily_forestry (
|
||||||
|
daily_record_seq, income_mark, expense_mark
|
||||||
|
, product_name, usage
|
||||||
|
, quantity, unit_code, unit_self, estimated_value
|
||||||
|
, is_deleted
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||||
|
) values (
|
||||||
|
#{dailyRecordSeq}, #{incomeMark}, #{expenseMark}
|
||||||
|
, #{productName}, #{usage}
|
||||||
|
, #{quantity}, #{unitCode}, #{unitSelf}, #{estimatedValue}
|
||||||
|
, false
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -51,9 +51,43 @@
|
|||||||
, unit_self = #{unitSelf}
|
, unit_self = #{unitSelf}
|
||||||
, price = #{price}
|
, price = #{price}
|
||||||
, estimated_value = #{estimatedValue}
|
, estimated_value = #{estimatedValue}
|
||||||
|
, ocr_error_result = false
|
||||||
where is_deleted = false
|
where is_deleted = false
|
||||||
and daily_record_seq = #{dailyRecordSeq}
|
and daily_record_seq = #{dailyRecordSeq}
|
||||||
and id = #{id}
|
and id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updateDailyIncomeOnlyId">
|
||||||
|
update daily_income set <include refid="common.fields.UpdateBaseSet"/>
|
||||||
|
, is_credit = #{credit}
|
||||||
|
, expense_mark = #{expenseMark}
|
||||||
|
, crop_code = #{cropCode}
|
||||||
|
, income_kind = #{incomeKind}
|
||||||
|
, source_purpose = #{sourcePurpose}
|
||||||
|
, quantity = #{quantity}
|
||||||
|
, unit_code = #{unitCode}
|
||||||
|
, unit_self = #{unitSelf}
|
||||||
|
, price = #{price}
|
||||||
|
, estimated_value = #{estimatedValue}
|
||||||
|
, ocr_error_result = false
|
||||||
|
, daily_record_seq = #{dailyRecordSeq}
|
||||||
|
where is_deleted = false
|
||||||
|
and id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="createDailyIncomeExcel" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into daily_income (
|
||||||
|
daily_record_seq, input_type, category, income_mark, expense_mark
|
||||||
|
, is_credit, crop_code, income_kind, source_purpose
|
||||||
|
, quantity, unit_code, unit_self, price, estimated_value
|
||||||
|
, is_deleted
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||||
|
) values (
|
||||||
|
#{dailyRecordSeq}, #{inputType}, #{category}, #{incomeMark}, #{expenseMark}
|
||||||
|
, #{credit}, #{cropCode}, #{incomeKind}, #{sourcePurpose}
|
||||||
|
, #{quantity}, #{unitCode}, #{unitSelf}, #{price}, #{estimatedValue}
|
||||||
|
, false
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -46,4 +46,17 @@
|
|||||||
and id = #{id}
|
and id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<insert id="createDailyPowerExcel" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into daily_power (
|
||||||
|
daily_record_seq
|
||||||
|
, equipment_name, equipment_mark,owned_hours, leased_hours
|
||||||
|
, is_deleted
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||||
|
) values (
|
||||||
|
#{dailyRecordSeq}
|
||||||
|
, #{equipmentName}, #{equipmentMark}, #{ownedHours}, #{leasedHours}
|
||||||
|
, false
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -68,4 +68,22 @@
|
|||||||
and id = #{id}
|
and id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<insert id="createDailyWorkExcel" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into daily_work (
|
||||||
|
daily_record_seq
|
||||||
|
, item_name, item_mark, work_name, work_mark
|
||||||
|
, work_land_area, area_unit_code, area_unit_self, harvest_quantity, harvest_unit_code, harvest_unit_self
|
||||||
|
, owner_time, spouse_time, family_m_hours, family_f_hours, hired_m_hours, hired_f_hours, shared_m_hours, shared_f_hours, volunteer_m_hours, volunteer_f_hours
|
||||||
|
, is_deleted
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||||
|
) values (
|
||||||
|
#{dailyRecordSeq}
|
||||||
|
, #{itemName}, #{itemMark},#{workName}, #{workMark}
|
||||||
|
, #{workLandArea}, #{areaUnitCode}, #{areaUnitSelf}, #{harvestQuantity}, #{harvestUnitCode}, #{harvestUnitSelf}
|
||||||
|
, #{ownerTime}, #{spouseTime}, #{familyMHours}, #{familyFHours}, #{hiredMHours}, #{hiredFHours}, #{sharedMHours}, #{sharedFHours}, #{volunteerMHours}, #{volunteerFHours}
|
||||||
|
, false
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -312,6 +312,7 @@
|
|||||||
dw.work_name ,
|
dw.work_name ,
|
||||||
dw.work_mark ,
|
dw.work_mark ,
|
||||||
dw.work_land_area ,
|
dw.work_land_area ,
|
||||||
|
dw.area_mark ,
|
||||||
case when dw.area_unit_code = 'code.record.area.self' then dw.area_unit_self
|
case when dw.area_unit_code = 'code.record.area.self' then dw.area_unit_self
|
||||||
else unit_code.code_value end as area_unit_name,
|
else unit_code.code_value end as area_unit_name,
|
||||||
dw.harvest_quantity ,
|
dw.harvest_quantity ,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
etUI.utils.ready(function() {
|
etUI.utils.ready(function() {
|
||||||
console.log('document ready');
|
|
||||||
|
|
||||||
etUI.initUI();
|
etUI.initUI();
|
||||||
})
|
})
|
||||||
File diff suppressed because one or more lines are too long
@@ -125,7 +125,7 @@ var ajaxUtil = {
|
|||||||
console.error('statusCode: 403');
|
console.error('statusCode: 403');
|
||||||
},
|
},
|
||||||
422:function(rstData, status) {
|
422:function(rstData, status) {
|
||||||
console.log(rstData);
|
// console.log(rstData);
|
||||||
// options type : 1. alert, 2. field
|
// options type : 1. alert, 2. field
|
||||||
if (options.handle422Type === 'alert') {
|
if (options.handle422Type === 'alert') {
|
||||||
if (typeof errorCallback !== 'undefined') {
|
if (typeof errorCallback !== 'undefined') {
|
||||||
@@ -171,14 +171,14 @@ var ajaxUtil = {
|
|||||||
},
|
},
|
||||||
success : function(rstData, status) {
|
success : function(rstData, status) {
|
||||||
ajaxUtil._hideWaiting();
|
ajaxUtil._hideWaiting();
|
||||||
console.log('succ', rstData)
|
// console.log('succ', rstData)
|
||||||
if (typeof successCallback !== 'undefined') {
|
if (typeof successCallback !== 'undefined') {
|
||||||
successCallback(rstData, status);
|
successCallback(rstData, status);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error : function(rstData) {
|
error : function(rstData) {
|
||||||
ajaxUtil._hideWaiting();
|
ajaxUtil._hideWaiting();
|
||||||
console.log('error')
|
// console.log('error')
|
||||||
if (!(rstData.status == 500 || rstData.status == 422 || rstData.status == 400)) {
|
if (!(rstData.status == 500 || rstData.status == 422 || rstData.status == 400)) {
|
||||||
if (typeof errorCallback !== 'undefined') {
|
if (typeof errorCallback !== 'undefined') {
|
||||||
errorCallback(rstData.status, rstData);
|
errorCallback(rstData.status, rstData);
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ uiUtil.uploadFile = (fileUploadType, input) => {
|
|||||||
$("meta[name='_csrf']").attr("content"));
|
$("meta[name='_csrf']").attr("content"));
|
||||||
},
|
},
|
||||||
success(res) {
|
success(res) {
|
||||||
console.log(res);
|
// console.log(res);
|
||||||
|
|
||||||
// 에러 메세지가 있었다면 초기화
|
// 에러 메세지가 있었다면 초기화
|
||||||
$(input).removeClass('is-invalid');
|
$(input).removeClass('is-invalid');
|
||||||
|
|||||||
@@ -205,7 +205,7 @@
|
|||||||
checkDuplicate = response <= 0;
|
checkDuplicate = response <= 0;
|
||||||
},
|
},
|
||||||
function (code, rstData) {
|
function (code, rstData) {
|
||||||
console.log("error : ", code);
|
// console.log("error : ", code);
|
||||||
if(code == 400) alert("아이디를 입력해주세요.");
|
if(code == 400) alert("아이디를 입력해주세요.");
|
||||||
if(code == 422) alert(rstData.responseText);
|
if(code == 422) alert(rstData.responseText);
|
||||||
checkDuplicate = false;
|
checkDuplicate = false;
|
||||||
|
|||||||
@@ -138,7 +138,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
function (code, rstData) {
|
function (code, rstData) {
|
||||||
console.log("error : ", code);
|
console.log("error : ");
|
||||||
},
|
},
|
||||||
'get',
|
'get',
|
||||||
'json'
|
'json'
|
||||||
@@ -228,7 +228,7 @@
|
|||||||
|
|
||||||
const selectedResearcher = researcherList.find(r => r.adminSeq == selectedAdminSeq);
|
const selectedResearcher = researcherList.find(r => r.adminSeq == selectedAdminSeq);
|
||||||
|
|
||||||
console.log("선택된 조사원 : ", selectedResearcher);
|
// console.log("선택된 조사원 : ", selectedResearcher);
|
||||||
|
|
||||||
// import 해준 html 에서 아래 함수를 선언해주면 selectedResearcher 값을 사용할 수 있음.
|
// import 해준 html 에서 아래 함수를 선언해주면 selectedResearcher 값을 사용할 수 있음.
|
||||||
getSelectedResearcher(selectedResearcher, () => {
|
getSelectedResearcher(selectedResearcher, () => {
|
||||||
|
|||||||
@@ -19,6 +19,15 @@
|
|||||||
<option value="PAPER">지류</option>
|
<option value="PAPER">지류</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" id="recordMonth" name="recordMonth" required>
|
||||||
|
<option th:each="month : ${monthList}"
|
||||||
|
th:value="${month.value}"
|
||||||
|
th:text="${month.label}"
|
||||||
|
th:selected="${month.value == currentMonth}">
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -414,6 +423,10 @@
|
|||||||
$('#regionMainCode').change(function() {
|
$('#regionMainCode').change(function() {
|
||||||
getResearcherArea();
|
getResearcherArea();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#recordMonth').change(function() {
|
||||||
|
getTotalPercentage();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
@@ -459,7 +472,9 @@
|
|||||||
|
|
||||||
// 엑셀 다운로드
|
// 엑셀 다운로드
|
||||||
const goExcel = () => {
|
const goExcel = () => {
|
||||||
excelDownload('/api/dashboard/chart/excel', null);
|
const f = document.reqForm;
|
||||||
|
const data = $(f).serializeObject();
|
||||||
|
excelDownload('/api/dashboard/chart/excel', data);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -360,7 +360,7 @@
|
|||||||
checkDuplicate = !response.isDuplicated;
|
checkDuplicate = !response.isDuplicated;
|
||||||
},
|
},
|
||||||
function (code, rstData) { // 실패
|
function (code, rstData) { // 실패
|
||||||
console.log("error : ", code);
|
// console.log("error : ", code);
|
||||||
if(code == 400) alert("임가번호를 입력해주세요.");
|
if(code == 400) alert("임가번호를 입력해주세요.");
|
||||||
},
|
},
|
||||||
'get',
|
'get',
|
||||||
@@ -386,12 +386,12 @@
|
|||||||
function(response) { // 성공
|
function(response) { // 성공
|
||||||
alert("등록이 완료되었습니다.");
|
alert("등록이 완료되었습니다.");
|
||||||
location.href = '/households';
|
location.href = '/households';
|
||||||
console.log("code", response)
|
// console.log("code", response)
|
||||||
|
|
||||||
},
|
},
|
||||||
function (code, rstData) {
|
function (code, rstData) {
|
||||||
console.log("code", code)
|
// console.log("code", code)
|
||||||
console.log("rstData", rstData)
|
// console.log("rstData", rstData)
|
||||||
|
|
||||||
if(code == 422) alert(rstData.responseText);
|
if(code == 422) alert(rstData.responseText);
|
||||||
if(code == 400) alert(rstData.responseJSON.message); //임가번호 중복체크
|
if(code == 400) alert(rstData.responseJSON.message); //임가번호 중복체크
|
||||||
|
|||||||
@@ -31,6 +31,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 임가번호 -->
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-label">
|
||||||
|
<p class="label-txt">
|
||||||
|
임가번호
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="householdNum" name="householdNum" th:field="*{householdNum}" placeholder="임가번호 입력">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 경영주 -->
|
<!-- 경영주 -->
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-label">
|
<div class="input-label">
|
||||||
@@ -268,6 +284,9 @@
|
|||||||
<div class="component-btns bottom-btn-group">
|
<div class="component-btns bottom-btn-group">
|
||||||
<div class="btns-row align-right">
|
<div class="btns-row align-right">
|
||||||
<!-- 관리자만 노출 -->
|
<!-- 관리자만 노출 -->
|
||||||
|
<button type="button" class="btn" th:if="${userRole == 'ROLE_ADMIN'}" onclick="showExcelDailyModal();" >
|
||||||
|
<span class="btn-txt">엑셀 업로드(일계부)</span>
|
||||||
|
</button>
|
||||||
<button type="button" class="btn" th:if="${userRole == 'ROLE_ADMIN'}" onclick="showExcelHouseholdModal();" >
|
<button type="button" class="btn" th:if="${userRole == 'ROLE_ADMIN'}" onclick="showExcelHouseholdModal();" >
|
||||||
<span class="btn-txt">엑셀 업로드</span>
|
<span class="btn-txt">엑셀 업로드</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -343,7 +362,7 @@
|
|||||||
'/api/households',
|
'/api/households',
|
||||||
dataOj,
|
dataOj,
|
||||||
function(response) { // 성공
|
function(response) { // 성공
|
||||||
console.log("response", response);
|
// console.log("response", response);
|
||||||
|
|
||||||
$('#totalElements').text(response.totalElements);
|
$('#totalElements').text(response.totalElements);
|
||||||
|
|
||||||
@@ -408,7 +427,7 @@
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
function (code, rstData) { // 실패
|
function (code, rstData) { // 실패
|
||||||
console.log("error : ", code);
|
console.log("error : ");
|
||||||
},
|
},
|
||||||
'get',
|
'get',
|
||||||
'json'
|
'json'
|
||||||
|
|||||||
@@ -176,13 +176,13 @@
|
|||||||
`/api/household/bankAutoTransferIncome/${id}`,
|
`/api/household/bankAutoTransferIncome/${id}`,
|
||||||
{},
|
{},
|
||||||
(response) => {
|
(response) => {
|
||||||
console.log("은행자동이체(수입) 상세 응답값 : ", response);
|
// console.log("은행자동이체(수입) 상세 응답값 : ", response);
|
||||||
setBankIncomeFormData(response);
|
setBankIncomeFormData(response);
|
||||||
|
|
||||||
document.querySelector(".modal-bank-income").ui.open();
|
document.querySelector(".modal-bank-income").ui.open();
|
||||||
},
|
},
|
||||||
function (code, rstData) {
|
function (code, rstData) {
|
||||||
console.log("error : ", code);
|
console.log("error : ");
|
||||||
},
|
},
|
||||||
'get',
|
'get',
|
||||||
'json'
|
'json'
|
||||||
@@ -254,7 +254,7 @@
|
|||||||
if (!f) return;
|
if (!f) return;
|
||||||
|
|
||||||
let dataOj = $(f).serializeObject();
|
let dataOj = $(f).serializeObject();
|
||||||
console.log("dataOj", dataOj);
|
// console.log("dataOj", dataOj);
|
||||||
|
|
||||||
ajaxUtil._ajaxMethod(
|
ajaxUtil._ajaxMethod(
|
||||||
'/api/household/bank/income/save',
|
'/api/household/bank/income/save',
|
||||||
|
|||||||
@@ -10,13 +10,19 @@
|
|||||||
<input type="hidden" name="id">
|
<input type="hidden" name="id">
|
||||||
<input type="hidden" name="dailyId">
|
<input type="hidden" name="dailyId">
|
||||||
|
|
||||||
|
<input type="hidden" name="startYear" th:value="${startYear}"/>
|
||||||
|
<input type="hidden" name="startMonth" th:value="${startMonth}"/>
|
||||||
|
<input type="hidden" name="currentDate" th:value="${currentDate}"/>
|
||||||
|
<input type="hidden" name="selectedGroupNo" value=""/>
|
||||||
|
|
||||||
|
|
||||||
<div class="component-modal mypage-wrap modal01 modal-daily-expense" data-props-dimm-click="true" data-state="close">
|
<div class="component-modal mypage-wrap modal01 modal-daily-expense" data-props-dimm-click="true" data-state="close">
|
||||||
<div class="modal-dimm"></div>
|
<div class="modal-dimm"></div>
|
||||||
<div class="modal-frame">
|
<div class="modal-frame">
|
||||||
<div class="modal-container">
|
<div class="modal-container">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h3 class="modal-tit">
|
<h3 class="modal-tit">
|
||||||
일계부 수입
|
일계부 지출
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@@ -31,7 +37,28 @@
|
|||||||
<col width="25.3%" />
|
<col width="25.3%" />
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th>등록일</th>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" name="targetYear" required>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" name="targetMonth" required>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" name="targetDayGroup" required>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>외상 또는 카드 구입 여부</th>
|
<th>외상 또는 카드 구입 여부</th>
|
||||||
<td class="radio-group" colspan="4">
|
<td class="radio-group" colspan="4">
|
||||||
@@ -159,10 +186,156 @@
|
|||||||
form.price.value = '';
|
form.price.value = '';
|
||||||
form.estimatedValue.value = '';
|
form.estimatedValue.value = '';
|
||||||
|
|
||||||
|
const currentDateStr = form.currentDate ? form.currentDate.value : ''; // "2025-08-09"
|
||||||
|
const selectedGroupNo = form.selectedGroupNo ? form.selectedGroupNo.value : ''; // "2025-08-09"
|
||||||
|
const startYear = form.startYear ? parseInt(form.startYear.value, 10) : 2024;
|
||||||
|
const startMonth = form.startMonth ? parseInt(form.startMonth.value, 10) : 8;
|
||||||
|
|
||||||
|
// 오늘 Y/M/D 파싱
|
||||||
|
const ymd = /^(\d{4})-(\d{2})-(\d{2})$/.exec(currentDateStr);
|
||||||
|
const cur = ymd ? { y: +ymd[1], m: +ymd[2], d: +ymd[3] } : { y: null, m: null, d: null };
|
||||||
|
if (!cur.y || !cur.m || !cur.d) return;
|
||||||
|
|
||||||
|
// selectedGroupNo가 있으면 초기 연/월은 #recordMonthStr(value: "yyyyMM")에서 취득
|
||||||
|
let baseY = cur.y, baseM = cur.m;
|
||||||
|
if (selectedGroupNo) {
|
||||||
|
const rmSel = document.getElementById('recordMonthStr');
|
||||||
|
const rmVal = rmSel?.value || '';
|
||||||
|
const rm = /^(\d{4})(\d{2})$/.exec(rmVal);
|
||||||
|
if (rm) { baseY = +rm[1]; baseM = +rm[2]; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 연/월 셀렉트 요소
|
||||||
|
const yearSel = form.targetYear;
|
||||||
|
const monthSel = form.targetMonth;
|
||||||
|
const daySel = form.targetDayGroup;
|
||||||
|
|
||||||
|
// 일자 그룹 정의(1~17)
|
||||||
|
const DAY_GROUPS = [
|
||||||
|
{ groupNo: 1, startDay: 1, endDay: 2 },
|
||||||
|
{ groupNo: 2, startDay: 3, endDay: 4 },
|
||||||
|
{ groupNo: 3, startDay: 5, endDay: 6 },
|
||||||
|
{ groupNo: 4, startDay: 7, endDay: 7 },
|
||||||
|
{ groupNo: 5, startDay: 8, endDay: 9 },
|
||||||
|
{ groupNo: 6, startDay: 10, endDay: 11 },
|
||||||
|
{ groupNo: 7, startDay: 12, endDay: 13 },
|
||||||
|
{ groupNo: 8, startDay: 14, endDay: 14 },
|
||||||
|
{ groupNo: 9, startDay: 15, endDay: 16 },
|
||||||
|
{ groupNo: 10, startDay: 17, endDay: 18 },
|
||||||
|
{ groupNo: 11, startDay: 19, endDay: 20 },
|
||||||
|
{ groupNo: 12, startDay: 21, endDay: 21 },
|
||||||
|
{ groupNo: 13, startDay: 22, endDay: 23 },
|
||||||
|
{ groupNo: 14, startDay: 24, endDay: 25 },
|
||||||
|
{ groupNo: 15, startDay: 26, endDay: 27 },
|
||||||
|
{ groupNo: 16, startDay: 28, endDay: 29 },
|
||||||
|
{ groupNo: 17, startDay: 30, endDay: 31 },
|
||||||
|
];
|
||||||
|
const daysInMonth = (y, m) => new Date(y, m, 0).getDate();
|
||||||
|
const findGroupNoByDay = (day) => {
|
||||||
|
const g = DAY_GROUPS.find(g => day >= g.startDay && day <= g.endDay);
|
||||||
|
return g ? g.groupNo : null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 연도 옵션: startYear ~ currentDate.year
|
||||||
|
function fillYears(preselectYear) {
|
||||||
|
if (!yearSel) return;
|
||||||
|
yearSel.innerHTML = '';
|
||||||
|
for (let y = startYear; y <= cur.y; y++) {
|
||||||
|
const opt = document.createElement('option');
|
||||||
|
opt.value = String(y);
|
||||||
|
opt.textContent = `${y}년`;
|
||||||
|
yearSel.appendChild(opt);
|
||||||
|
}
|
||||||
|
// 선택: selectedGroupNo 있으면 baseY, 없으면 cur.y
|
||||||
|
const pickY = (typeof preselectYear === 'number') ? preselectYear : cur.y;
|
||||||
|
yearSel.value = String(pickY);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 월 옵션: (startYear → startMonth~12), (cur.y → 1~cur.m), (그 외 과거연도 → 1~12)
|
||||||
|
function fillMonths(year, preselectMonth) {
|
||||||
|
if (!monthSel) return;
|
||||||
|
monthSel.innerHTML = '';
|
||||||
|
let from = 1, to = 12;
|
||||||
|
if (year === startYear) from = startMonth;
|
||||||
|
if (year === cur.y) to = cur.m;
|
||||||
|
|
||||||
|
for (let m = from; m <= to; m++) {
|
||||||
|
const opt = document.createElement('option');
|
||||||
|
opt.value = String(m);
|
||||||
|
opt.textContent = `${m}월`;
|
||||||
|
monthSel.appendChild(opt);
|
||||||
|
}
|
||||||
|
// 선택: selectedGroupNo 있으면 baseM, 없으면 cur.m (범위 밖이면 첫 항목)
|
||||||
|
const candidate = (typeof preselectMonth === 'number') ? preselectMonth : cur.m;
|
||||||
|
monthSel.value = (candidate >= from && candidate <= to)
|
||||||
|
? String(candidate)
|
||||||
|
: (monthSel.options[0]?.value || '');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 일자그룹 옵션: 존재 & 미래 제외
|
||||||
|
function fillDayGroups(year, month, preselectGroupNo) {
|
||||||
|
if (!daySel) return;
|
||||||
|
daySel.innerHTML = '';
|
||||||
|
|
||||||
|
// "선택하세요" 옵션 추가
|
||||||
|
const placeholder = document.createElement('option');
|
||||||
|
placeholder.value = '';
|
||||||
|
placeholder.textContent = '선택하세요';
|
||||||
|
daySel.appendChild(placeholder);
|
||||||
|
|
||||||
|
const dim = daysInMonth(year, month);
|
||||||
|
const isCurYM = (year === cur.y && month === cur.m);
|
||||||
|
const maxDay = isCurYM ? cur.d : dim;
|
||||||
|
|
||||||
|
const candidates = DAY_GROUPS
|
||||||
|
.filter(g => g.endDay <= dim)
|
||||||
|
.filter(g => g.startDay <= maxDay);
|
||||||
|
|
||||||
|
candidates.forEach(g => {
|
||||||
|
const opt = document.createElement('option');
|
||||||
|
opt.value = String(g.groupNo);
|
||||||
|
opt.textContent = (g.startDay === g.endDay) ? `${g.startDay}일` : `${g.startDay}~${g.endDay}일`;
|
||||||
|
daySel.appendChild(opt);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 선택 우선순위: 전달된 groupNo가 리스트에 있으면 → 그것, 아니면 첫 항목
|
||||||
|
let pick = preselectGroupNo ? String(preselectGroupNo) : '';
|
||||||
|
if (pick && ![...daySel.options].some(o => o.value === pick)) pick = '';
|
||||||
|
if (!pick) pick = daySel.options[0]?.value || '';
|
||||||
|
if (pick) daySel.value = pick;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----- 초기 세팅 -----
|
||||||
|
// 1) 연도/월 옵션은 currentDate 기준으로 생성
|
||||||
|
fillYears(selectedGroupNo ? baseY : undefined);
|
||||||
|
fillMonths(parseInt(yearSel.value, 10), selectedGroupNo ? baseM : undefined);
|
||||||
|
|
||||||
|
// 2) 일자그룹 선택값 계산
|
||||||
|
const initGroupNo = selectedGroupNo
|
||||||
|
? parseInt(selectedGroupNo, 10)
|
||||||
|
: findGroupNoByDay(cur.d);
|
||||||
|
|
||||||
|
fillDayGroups(parseInt(yearSel.value, 10), parseInt(monthSel.value, 10), initGroupNo);
|
||||||
|
|
||||||
|
// ----- 이벤트 -----
|
||||||
|
yearSel?.addEventListener('change', function () {
|
||||||
|
const y = parseInt(this.value, 10);
|
||||||
|
// selectedGroupNo가 있으면 월 선택은 baseM 유지 시도(범위 밖이면 첫 항목)
|
||||||
|
fillMonths(y, selectedGroupNo ? baseM : undefined);
|
||||||
|
// 일그룹: selectedGroupNo 우선(존재하지 않으면 폴백)
|
||||||
|
fillDayGroups(y, parseInt(monthSel.value, 10), selectedGroupNo ? parseInt(selectedGroupNo, 10) : undefined);
|
||||||
|
});
|
||||||
|
|
||||||
|
monthSel?.addEventListener('change', function () {
|
||||||
|
const y = parseInt(yearSel.value, 10);
|
||||||
|
fillDayGroups(y, parseInt(this.value, 10), selectedGroupNo ? parseInt(selectedGroupNo, 10) : undefined);
|
||||||
|
});
|
||||||
|
|
||||||
document.getElementById('isCredit_N').checked = true;
|
document.getElementById('isCredit_N').checked = true;
|
||||||
priceDisabledReset(form.price, form.estimatedValue);
|
priceDisabledReset(form.price, form.estimatedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 일계부 상세 값 set
|
// 일계부 상세 값 set
|
||||||
const setDailyExpenseFormData = (data) => {
|
const setDailyExpenseFormData = (data) => {
|
||||||
const form = document.reqExpenseForm;
|
const form = document.reqExpenseForm;
|
||||||
@@ -199,6 +372,11 @@
|
|||||||
mf.groupNo.value = document.reqForm.groupNo.value;
|
mf.groupNo.value = document.reqForm.groupNo.value;
|
||||||
mf.dailyId.value = document.reqForm.dailyId.value;
|
mf.dailyId.value = document.reqForm.dailyId.value;
|
||||||
mf.id.value = (id === undefined) ? '' : id;
|
mf.id.value = (id === undefined) ? '' : id;
|
||||||
|
// if(id === undefined){
|
||||||
|
// mf.selectedGroupNo.value = null;
|
||||||
|
// } else {
|
||||||
|
mf.selectedGroupNo.value = document.reqForm.groupNo.value;
|
||||||
|
// }
|
||||||
|
|
||||||
resetDailyExpenseForm();
|
resetDailyExpenseForm();
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,10 @@
|
|||||||
<input type="hidden" name="id">
|
<input type="hidden" name="id">
|
||||||
<input type="hidden" name="dailyId">
|
<input type="hidden" name="dailyId">
|
||||||
|
|
||||||
|
<input type="hidden" name="startYear" th:value="${startYear}"/>
|
||||||
|
<input type="hidden" name="startMonth" th:value="${startMonth}"/>
|
||||||
|
<input type="hidden" name="currentDate" th:value="${currentDate}"/>
|
||||||
|
<input type="hidden" name="selectedGroupNo" value=""/>
|
||||||
<div class="component-modal mypage-wrap modal01 modal-daily-income" data-props-dimm-click="true" data-state="close">
|
<div class="component-modal mypage-wrap modal01 modal-daily-income" data-props-dimm-click="true" data-state="close">
|
||||||
<div class="modal-dimm"></div>
|
<div class="modal-dimm"></div>
|
||||||
<div class="modal-frame">
|
<div class="modal-frame">
|
||||||
@@ -31,7 +35,28 @@
|
|||||||
<col width="25.3%" />
|
<col width="25.3%" />
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th>등록일</th>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" name="targetYear" required>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" name="targetMonth" required>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" name="targetDayGroup" required>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>외상판매 여부</th>
|
<th>외상판매 여부</th>
|
||||||
<td class="radio-group">
|
<td class="radio-group">
|
||||||
@@ -172,6 +197,151 @@
|
|||||||
form.price.value = '';
|
form.price.value = '';
|
||||||
form.estimatedValue.value = '';
|
form.estimatedValue.value = '';
|
||||||
|
|
||||||
|
const currentDateStr = form.currentDate ? form.currentDate.value : ''; // "2025-08-09"
|
||||||
|
const selectedGroupNo = form.selectedGroupNo ? form.selectedGroupNo.value : ''; // "2025-08-09"
|
||||||
|
const startYear = form.startYear ? parseInt(form.startYear.value, 10) : 2024;
|
||||||
|
const startMonth = form.startMonth ? parseInt(form.startMonth.value, 10) : 8;
|
||||||
|
|
||||||
|
// 오늘 Y/M/D 파싱
|
||||||
|
const ymd = /^(\d{4})-(\d{2})-(\d{2})$/.exec(currentDateStr);
|
||||||
|
const cur = ymd ? { y: +ymd[1], m: +ymd[2], d: +ymd[3] } : { y: null, m: null, d: null };
|
||||||
|
if (!cur.y || !cur.m || !cur.d) return;
|
||||||
|
|
||||||
|
// selectedGroupNo가 있으면 초기 연/월은 #recordMonthStr(value: "yyyyMM")에서 취득
|
||||||
|
let baseY = cur.y, baseM = cur.m;
|
||||||
|
if (selectedGroupNo) {
|
||||||
|
const rmSel = document.getElementById('recordMonthStr');
|
||||||
|
const rmVal = rmSel?.value || '';
|
||||||
|
const rm = /^(\d{4})(\d{2})$/.exec(rmVal);
|
||||||
|
if (rm) { baseY = +rm[1]; baseM = +rm[2]; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 연/월 셀렉트 요소
|
||||||
|
const yearSel = form.targetYear;
|
||||||
|
const monthSel = form.targetMonth;
|
||||||
|
const daySel = form.targetDayGroup;
|
||||||
|
|
||||||
|
// 일자 그룹 정의(1~17)
|
||||||
|
const DAY_GROUPS = [
|
||||||
|
{ groupNo: 1, startDay: 1, endDay: 2 },
|
||||||
|
{ groupNo: 2, startDay: 3, endDay: 4 },
|
||||||
|
{ groupNo: 3, startDay: 5, endDay: 6 },
|
||||||
|
{ groupNo: 4, startDay: 7, endDay: 7 },
|
||||||
|
{ groupNo: 5, startDay: 8, endDay: 9 },
|
||||||
|
{ groupNo: 6, startDay: 10, endDay: 11 },
|
||||||
|
{ groupNo: 7, startDay: 12, endDay: 13 },
|
||||||
|
{ groupNo: 8, startDay: 14, endDay: 14 },
|
||||||
|
{ groupNo: 9, startDay: 15, endDay: 16 },
|
||||||
|
{ groupNo: 10, startDay: 17, endDay: 18 },
|
||||||
|
{ groupNo: 11, startDay: 19, endDay: 20 },
|
||||||
|
{ groupNo: 12, startDay: 21, endDay: 21 },
|
||||||
|
{ groupNo: 13, startDay: 22, endDay: 23 },
|
||||||
|
{ groupNo: 14, startDay: 24, endDay: 25 },
|
||||||
|
{ groupNo: 15, startDay: 26, endDay: 27 },
|
||||||
|
{ groupNo: 16, startDay: 28, endDay: 29 },
|
||||||
|
{ groupNo: 17, startDay: 30, endDay: 31 },
|
||||||
|
];
|
||||||
|
const daysInMonth = (y, m) => new Date(y, m, 0).getDate();
|
||||||
|
const findGroupNoByDay = (day) => {
|
||||||
|
const g = DAY_GROUPS.find(g => day >= g.startDay && day <= g.endDay);
|
||||||
|
return g ? g.groupNo : null;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 연도 옵션: startYear ~ currentDate.year
|
||||||
|
function fillYears(preselectYear) {
|
||||||
|
if (!yearSel) return;
|
||||||
|
yearSel.innerHTML = '';
|
||||||
|
for (let y = startYear; y <= cur.y; y++) {
|
||||||
|
const opt = document.createElement('option');
|
||||||
|
opt.value = String(y);
|
||||||
|
opt.textContent = `${y}년`;
|
||||||
|
yearSel.appendChild(opt);
|
||||||
|
}
|
||||||
|
// 선택: selectedGroupNo 있으면 baseY, 없으면 cur.y
|
||||||
|
const pickY = (typeof preselectYear === 'number') ? preselectYear : cur.y;
|
||||||
|
yearSel.value = String(pickY);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 월 옵션: (startYear → startMonth~12), (cur.y → 1~cur.m), (그 외 과거연도 → 1~12)
|
||||||
|
function fillMonths(year, preselectMonth) {
|
||||||
|
if (!monthSel) return;
|
||||||
|
monthSel.innerHTML = '';
|
||||||
|
let from = 1, to = 12;
|
||||||
|
if (year === startYear) from = startMonth;
|
||||||
|
if (year === cur.y) to = cur.m;
|
||||||
|
|
||||||
|
for (let m = from; m <= to; m++) {
|
||||||
|
const opt = document.createElement('option');
|
||||||
|
opt.value = String(m);
|
||||||
|
opt.textContent = `${m}월`;
|
||||||
|
monthSel.appendChild(opt);
|
||||||
|
}
|
||||||
|
// 선택: selectedGroupNo 있으면 baseM, 없으면 cur.m (범위 밖이면 첫 항목)
|
||||||
|
const candidate = (typeof preselectMonth === 'number') ? preselectMonth : cur.m;
|
||||||
|
monthSel.value = (candidate >= from && candidate <= to)
|
||||||
|
? String(candidate)
|
||||||
|
: (monthSel.options[0]?.value || '');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 일자그룹 옵션: 존재 & 미래 제외
|
||||||
|
function fillDayGroups(year, month, preselectGroupNo) {
|
||||||
|
if (!daySel) return;
|
||||||
|
daySel.innerHTML = '';
|
||||||
|
|
||||||
|
// "선택하세요" 옵션 추가
|
||||||
|
const placeholder = document.createElement('option');
|
||||||
|
placeholder.value = '';
|
||||||
|
placeholder.textContent = '선택하세요';
|
||||||
|
daySel.appendChild(placeholder);
|
||||||
|
|
||||||
|
const dim = daysInMonth(year, month);
|
||||||
|
const isCurYM = (year === cur.y && month === cur.m);
|
||||||
|
const maxDay = isCurYM ? cur.d : dim;
|
||||||
|
|
||||||
|
const candidates = DAY_GROUPS
|
||||||
|
.filter(g => g.endDay <= dim)
|
||||||
|
.filter(g => g.startDay <= maxDay);
|
||||||
|
|
||||||
|
candidates.forEach(g => {
|
||||||
|
const opt = document.createElement('option');
|
||||||
|
opt.value = String(g.groupNo);
|
||||||
|
opt.textContent = (g.startDay === g.endDay) ? `${g.startDay}일` : `${g.startDay}~${g.endDay}일`;
|
||||||
|
daySel.appendChild(opt);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 선택 우선순위: 전달된 groupNo가 리스트에 있으면 → 그것, 아니면 첫 항목
|
||||||
|
let pick = preselectGroupNo ? String(preselectGroupNo) : '';
|
||||||
|
if (pick && ![...daySel.options].some(o => o.value === pick)) pick = '';
|
||||||
|
if (!pick) pick = daySel.options[0]?.value || '';
|
||||||
|
if (pick) daySel.value = pick;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----- 초기 세팅 -----
|
||||||
|
// 1) 연도/월 옵션은 currentDate 기준으로 생성
|
||||||
|
fillYears(selectedGroupNo ? baseY : undefined);
|
||||||
|
fillMonths(parseInt(yearSel.value, 10), selectedGroupNo ? baseM : undefined);
|
||||||
|
|
||||||
|
// 2) 일자그룹 선택값 계산
|
||||||
|
const initGroupNo = selectedGroupNo
|
||||||
|
? parseInt(selectedGroupNo, 10)
|
||||||
|
: findGroupNoByDay(cur.d);
|
||||||
|
|
||||||
|
fillDayGroups(parseInt(yearSel.value, 10), parseInt(monthSel.value, 10), initGroupNo);
|
||||||
|
|
||||||
|
// ----- 이벤트 -----
|
||||||
|
yearSel?.addEventListener('change', function () {
|
||||||
|
const y = parseInt(this.value, 10);
|
||||||
|
// selectedGroupNo가 있으면 월 선택은 baseM 유지 시도(범위 밖이면 첫 항목)
|
||||||
|
fillMonths(y, selectedGroupNo ? baseM : undefined);
|
||||||
|
// 일그룹: selectedGroupNo 우선(존재하지 않으면 폴백)
|
||||||
|
fillDayGroups(y, parseInt(monthSel.value, 10), selectedGroupNo ? parseInt(selectedGroupNo, 10) : undefined);
|
||||||
|
});
|
||||||
|
|
||||||
|
monthSel?.addEventListener('change', function () {
|
||||||
|
const y = parseInt(yearSel.value, 10);
|
||||||
|
fillDayGroups(y, parseInt(this.value, 10), selectedGroupNo ? parseInt(selectedGroupNo, 10) : undefined);
|
||||||
|
});
|
||||||
|
|
||||||
document.getElementById('isCredit_N').checked = true;
|
document.getElementById('isCredit_N').checked = true;
|
||||||
priceDisabledReset(form.price, form.estimatedValue);
|
priceDisabledReset(form.price, form.estimatedValue);
|
||||||
}
|
}
|
||||||
@@ -213,6 +383,11 @@
|
|||||||
mf.groupNo.value = document.reqForm.groupNo.value;
|
mf.groupNo.value = document.reqForm.groupNo.value;
|
||||||
mf.dailyId.value = document.reqForm.dailyId.value;
|
mf.dailyId.value = document.reqForm.dailyId.value;
|
||||||
mf.id.value = (id === undefined) ? '' : id;
|
mf.id.value = (id === undefined) ? '' : id;
|
||||||
|
// if(id === undefined){
|
||||||
|
// mf.selectedGroupNo.value = null;
|
||||||
|
// } else {
|
||||||
|
mf.selectedGroupNo.value = document.reqForm.groupNo.value;
|
||||||
|
// }
|
||||||
|
|
||||||
resetDailyIncomeForm();
|
resetDailyIncomeForm();
|
||||||
|
|
||||||
|
|||||||
@@ -6,37 +6,76 @@
|
|||||||
<form autocomplete="off" method="get" name="reqHouseholdExcelForm">
|
<form autocomplete="off" method="get" name="reqHouseholdExcelForm">
|
||||||
|
|
||||||
<div class="component-modal mypage-wrap modal01 modal-excel-household" data-props-dimm-click="true" data-state="close">
|
<div class="component-modal mypage-wrap modal01 modal-excel-household" data-props-dimm-click="true" data-state="close">
|
||||||
<div class="modal-dimm"></div>
|
<div class="modal-dimm"></div>
|
||||||
<div class="modal-frame">
|
<div class="modal-frame">
|
||||||
<div class="modal-container type-small">
|
<div class="modal-container type-small">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h3 class="modal-tit">
|
<h3 class="modal-tit">
|
||||||
임가 등록 엑셀업로드
|
임가 등록 엑셀업로드
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-content-inner">
|
|
||||||
<label for="householdFile" class="input-file-btn">
|
|
||||||
<input type="file" name="file" id="householdFile" accept=".xlsx, .xls">
|
|
||||||
</label>
|
|
||||||
<div class="component-btns bottom-btn-group">
|
|
||||||
<div class="btns-row align-right">
|
|
||||||
<button type="button" class="btn btn-primary" onclick="ExcelUploadHousehold();">
|
|
||||||
<span class="btn-txt">등록</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="modal-content">
|
||||||
|
<div class="modal-content-inner">
|
||||||
|
<label for="householdFile" class="input-file-btn">
|
||||||
|
<input type="file" name="file" id="householdFile" accept=".xlsx, .xls">
|
||||||
|
</label>
|
||||||
|
<div class="component-btns bottom-btn-group">
|
||||||
|
<div class="btns-row align-right">
|
||||||
|
<button type="button" class="btn btn-primary" onclick="ExcelUploadHousehold();">
|
||||||
|
<span class="btn-txt">등록</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<button type="button" class="modal-close"></button>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" class="modal-close"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="component-modal mypage-wrap modal01 modal-excel-daily" data-props-dimm-click="true" data-state="close">
|
||||||
|
<div class="modal-dimm"></div>
|
||||||
|
<div class="modal-frame">
|
||||||
|
<div class="modal-container type-small">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3 class="modal-tit">
|
||||||
|
일계부 등록 엑셀업로드
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-content-inner">
|
||||||
|
<label for="dailyFile" class="input-file-btn">
|
||||||
|
<input type="file" name="file" id="dailyFile" accept=".xlsx, .xls">
|
||||||
|
</label>
|
||||||
|
<div class="component-btns bottom-btn-group">
|
||||||
|
<div class="btns-row align-right">
|
||||||
|
<button type="button" class="btn btn-primary" onclick="ExcelUploadDaily();">
|
||||||
|
<span class="btn-txt">등록</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" class="modal-close"></button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
|
// 일계부 엑셀업로드 모달창 띄우기
|
||||||
|
const showExcelDailyModal = () => {
|
||||||
|
document.querySelector(".modal-excel-daily").ui.open();
|
||||||
|
const fileInput = document.getElementById("householdFile");
|
||||||
|
if (fileInput) {
|
||||||
|
fileInput.value = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 임가방문정보 모달창 띄우기
|
// 임가방문정보 모달창 띄우기
|
||||||
const showExcelHouseholdModal = () => {
|
const showExcelHouseholdModal = () => {
|
||||||
document.querySelector(".modal-excel-household").ui.open();
|
document.querySelector(".modal-excel-household").ui.open();
|
||||||
@@ -93,6 +132,51 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 일계부정보 등록
|
||||||
|
const ExcelUploadDaily = () => {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
const fileInput = document.getElementById('dailyFile');
|
||||||
|
if (fileInput.files.length === 0) {
|
||||||
|
alert('업로드할 엑셀 파일을 선택해주세요.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 로딩바 show
|
||||||
|
ajaxUtil._showWaiting();
|
||||||
|
|
||||||
|
let formData = new FormData();
|
||||||
|
formData.append('file', fileInput.files[0]);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
method: 'POST',
|
||||||
|
url: '/api/household/dailyExcelUpload',
|
||||||
|
data: formData,
|
||||||
|
contentType: false, // * 중요 *
|
||||||
|
processData: false, // * 중요 *
|
||||||
|
enctype: 'multipart/form-data', // * 중요 *
|
||||||
|
beforeSend: function (xhr) {
|
||||||
|
xhr.setRequestHeader(
|
||||||
|
$("meta[name='_csrf_header']").attr("content"),
|
||||||
|
$("meta[name='_csrf']").attr("content"));
|
||||||
|
},
|
||||||
|
success(res) {
|
||||||
|
ajaxUtil._hideWaiting(); // 로딩바 hide
|
||||||
|
alert("일계부 데이터 엑셀 업로드를 완료(실패 "+res.success+"건) 하였습니다.");
|
||||||
|
document.querySelector(".modal-excel-household").ui.close();
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
ajaxUtil._hideWaiting();
|
||||||
|
let message = "엑셀 업로드 중 오류가 발생하였습니다.";
|
||||||
|
if (xhr.responseText) {
|
||||||
|
message = xhr.responseText;
|
||||||
|
}
|
||||||
|
alert(message);
|
||||||
|
document.querySelector(".modal-excel-household").ui.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -261,7 +261,7 @@
|
|||||||
`/api/forestProduct/${id}`,
|
`/api/forestProduct/${id}`,
|
||||||
{},
|
{},
|
||||||
(response) => {
|
(response) => {
|
||||||
console.log("임산물현황 상세 응답값 : ", response);
|
// console.log("임산물현황 상세 응답값 : ", response);
|
||||||
setForestProductFormData(response);
|
setForestProductFormData(response);
|
||||||
|
|
||||||
document.querySelector(".modal-forest-product").ui.open();
|
document.querySelector(".modal-forest-product").ui.open();
|
||||||
|
|||||||
@@ -143,12 +143,12 @@
|
|||||||
`/api/visitInfo/${id}`,
|
`/api/visitInfo/${id}`,
|
||||||
{},
|
{},
|
||||||
(response) => {
|
(response) => {
|
||||||
console.log("임가방문정보 상세 응답값 : ", response);
|
// console.log("임가방문정보 상세 응답값 : ", response);
|
||||||
setVisitFormData(response);
|
setVisitFormData(response);
|
||||||
document.querySelector(".modal-visit-info").ui.open();
|
document.querySelector(".modal-visit-info").ui.open();
|
||||||
},
|
},
|
||||||
function (code, rstData) {
|
function (code, rstData) {
|
||||||
console.log("error : ", code);
|
console.log("error : ");
|
||||||
},
|
},
|
||||||
'get',
|
'get',
|
||||||
'json'
|
'json'
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
const f = document.reqVisitForm;
|
const f = document.reqVisitForm;
|
||||||
let dataOj = $(f).serializeObject();
|
let dataOj = $(f).serializeObject();
|
||||||
|
|
||||||
console.log("dataOj", dataOj);
|
// console.log("dataOj", dataOj);
|
||||||
|
|
||||||
ajaxUtil._ajaxMethod(
|
ajaxUtil._ajaxMethod(
|
||||||
'/api/visitInfo/save',
|
'/api/visitInfo/save',
|
||||||
@@ -214,7 +214,7 @@
|
|||||||
|
|
||||||
datepicker.core.init($el, {
|
datepicker.core.init($el, {
|
||||||
dateSelectCallback: function (selectedDate) {
|
dateSelectCallback: function (selectedDate) {
|
||||||
console.log('선택된 날짜:', selectedDate);
|
// console.log('선택된 날짜:', selectedDate);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@
|
|||||||
recordMonth: f.recordMonth.value
|
recordMonth: f.recordMonth.value
|
||||||
},
|
},
|
||||||
(response) => { // 성공
|
(response) => { // 성공
|
||||||
console.log("은행자동이체내역 조회 : ", response);
|
// console.log("은행자동이체내역 조회 : ", response);
|
||||||
gridBankIncomeTable(response.incomes);
|
gridBankIncomeTable(response.incomes);
|
||||||
gridBankExpenseTable(response.expenses);
|
gridBankExpenseTable(response.expenses);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -373,7 +373,7 @@
|
|||||||
recordMonth: f.recordMonth.value
|
recordMonth: f.recordMonth.value
|
||||||
},
|
},
|
||||||
function(response) { // 성공
|
function(response) { // 성공
|
||||||
console.log("일계부 현황 리스트 조회 : ", response);
|
// console.log("일계부 현황 리스트 조회 : ", response);
|
||||||
const listArea = $('.tab-content .daily-record-list');
|
const listArea = $('.tab-content .daily-record-list');
|
||||||
const detailArea = $('.tab-content .daily-record-detail');
|
const detailArea = $('.tab-content .daily-record-detail');
|
||||||
const tbody = listArea.find('tbody');
|
const tbody = listArea.find('tbody');
|
||||||
@@ -445,7 +445,7 @@
|
|||||||
'/api/household/dailyRecordStatus',
|
'/api/household/dailyRecordStatus',
|
||||||
{ recordSeq: id, recordMonth: f.recordMonth.value },
|
{ recordSeq: id, recordMonth: f.recordMonth.value },
|
||||||
function(response) { // 성공
|
function(response) { // 성공
|
||||||
console.log("일계부 등록 상세 데이터 : ", response);
|
// console.log("일계부 등록 상세 데이터 : ", response);
|
||||||
|
|
||||||
// 금일 데이터 없음 체크
|
// 금일 데이터 없음 체크
|
||||||
$('#incomeStatus').attr('checked', response.status.incomeStatus === 'TODAY_NONE');
|
$('#incomeStatus').attr('checked', response.status.incomeStatus === 'TODAY_NONE');
|
||||||
@@ -472,7 +472,7 @@
|
|||||||
gridFarmingTable(response.status.farmingStatus, response.farmings);
|
gridFarmingTable(response.status.farmingStatus, response.farmings);
|
||||||
|
|
||||||
if (groupNo === 1) {
|
if (groupNo === 1) {
|
||||||
console.log(groupNo, response.monthlyCarryOver)
|
// console.log(groupNo, response.monthlyCarryOver)
|
||||||
if (response.monthlyCarryOver != null) {
|
if (response.monthlyCarryOver != null) {
|
||||||
$('#carryOver').text(Number(response.monthlyCarryOver).toLocaleString() + '원');
|
$('#carryOver').text(Number(response.monthlyCarryOver).toLocaleString() + '원');
|
||||||
} else {
|
} else {
|
||||||
@@ -514,6 +514,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let tmpl = '';
|
let tmpl = '';
|
||||||
|
// console.log(data)
|
||||||
$(data).each((idx, item) => {
|
$(data).each((idx, item) => {
|
||||||
tmpl +=
|
tmpl +=
|
||||||
`
|
`
|
||||||
@@ -527,14 +528,17 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>${item.isCredit ? "Y" : "N"}</td> <!-- 외상판매 -->
|
<td>${item.isCredit ? "Y" : "N"}</td> <!-- 외상판매 -->
|
||||||
<td>${ifNullHyphen(item.cropText)}</td><!-- 재배형태 -->
|
<td>${ifNullHyphen(item.cropText)}</td><!-- 재배형태 -->
|
||||||
<td class="underline"><a href="javascript:void(0);" onclick="showDailyIncomeModal(${item.id});">${ifNullHyphen(item.incomeKind)}</a></td> <!-- 수입의 종류 -->
|
<td class="underline">
|
||||||
|
<a href="javascript:void(0);" onclick="showDailyIncomeModal(${item.id});">${ifNullHyphen(item.incomeKind)}</a>
|
||||||
|
${item.ocrErrorResult ? '<br><span style="color:red">(확인필요)</span>' : ''}
|
||||||
|
</td> <!-- 수입의 종류 -->
|
||||||
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 수입원 -->
|
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 수입원 -->
|
||||||
<td class="align-right">${formatNumberWithComma(item.quantity)}</td><!-- 수량 -->
|
<td class="align-right">${formatNumberWithComma(item.quantity)}</td><!-- 수량 -->
|
||||||
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||||
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
|
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
|
||||||
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
|
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
|
||||||
<td class="align-center">
|
<td class="align-center">
|
||||||
${item.fileId ? `<a href="${item.attachmentURL}" download>다운로드</a>` : '-'}
|
${item.fileId ? `<a href="javascript:void(0);" onclick="downloadFile('${item.attachmentURL}','수입','${ifNullHyphen(item.incomeKind)}','${idx+1}')" download>다운로드</a>` : '-'}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
${item.updatedBy}<br>
|
${item.updatedBy}<br>
|
||||||
@@ -609,6 +613,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let tmpl = '';
|
let tmpl = '';
|
||||||
|
|
||||||
|
|
||||||
$(data).each((idx, item) => {
|
$(data).each((idx, item) => {
|
||||||
tmpl +=
|
tmpl +=
|
||||||
`
|
`
|
||||||
@@ -621,14 +627,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>${item.isCredit ? "Y" : "N"}</td> <!-- 외상 또는 카드구입 -->
|
<td>${item.isCredit ? "Y" : "N"}</td> <!-- 외상 또는 카드구입 -->
|
||||||
<td class="underline"><a href="javascript:void(0);" onclick="showDailyExpenseModal(${item.id});">${ifNullHyphen(item.expenseKind)}</a></td> <!-- 지출의 종류 -->
|
<td class="underline"><a href="javascript:void(0);" onclick="showDailyExpenseModal(${item.id});">${ifNullHyphen(item.expenseKind)}</a>
|
||||||
|
${item.ocrErrorResult ? '<br><span style="color:red">(확인필요)</span>' : ''}
|
||||||
|
</td> <!-- 지출의 종류 -->
|
||||||
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 용도 -->
|
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 용도 -->
|
||||||
<td class="align-right">${ifNullHyphen(item.quantity)}</td><!-- 수량 -->
|
<td class="align-right">${ifNullHyphen(item.quantity)}</td><!-- 수량 -->
|
||||||
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||||
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
|
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
|
||||||
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
|
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
|
||||||
<td class="align-center">
|
<td class="align-center">
|
||||||
${item.fileId ? `<a href="${item.attachmentURL}" download>다운로드</a>` : '-'}
|
${item.fileId ? `<a href="javascript:void(0);" onclick="downloadFile('${item.attachmentURL}','지출','${ifNullHyphen(item.expenseKind)}','${idx+1}')" download>다운로드</a>` : '-'}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
${item.updatedBy}<br>
|
${item.updatedBy}<br>
|
||||||
@@ -853,7 +861,7 @@
|
|||||||
const saveDaily = (el) => {
|
const saveDaily = (el) => {
|
||||||
const currentStep = $(el).data('step');
|
const currentStep = $(el).data('step');
|
||||||
const currentModalId = $(el).data('modalId');
|
const currentModalId = $(el).data('modalId');
|
||||||
console.log('saveDaily', currentStep, currentModalId);
|
// console.log('saveDaily', currentStep, currentModalId);
|
||||||
|
|
||||||
if (currentStep === 'INCOME') {
|
if (currentStep === 'INCOME') {
|
||||||
showDailyIncomeModal();
|
showDailyIncomeModal();
|
||||||
@@ -874,7 +882,7 @@
|
|||||||
const removeDaily = (el) => {
|
const removeDaily = (el) => {
|
||||||
const currentStep = $(el).data('step');
|
const currentStep = $(el).data('step');
|
||||||
const currentListId = $(el).data('listId');
|
const currentListId = $(el).data('listId');
|
||||||
console.log('removeDaily', currentStep, currentListId);
|
// console.log('removeDaily', currentStep, currentListId);
|
||||||
|
|
||||||
if ($('#'+currentListId).find('input[type="checkbox"]:checked').length === 0) {
|
if ($('#'+currentListId).find('input[type="checkbox"]:checked').length === 0) {
|
||||||
alert('삭제내용은 최소 1건은 선택해야 합니다.');
|
alert('삭제내용은 최소 1건은 선택해야 합니다.');
|
||||||
@@ -892,7 +900,7 @@
|
|||||||
const obj = {};
|
const obj = {};
|
||||||
obj.selectedIds = selectedValues;
|
obj.selectedIds = selectedValues;
|
||||||
obj.currentStep = currentStep;
|
obj.currentStep = currentStep;
|
||||||
console.log(obj)
|
// console.log(obj)
|
||||||
|
|
||||||
etUI.dialog.confirm({
|
etUI.dialog.confirm({
|
||||||
title: '삭제 안내',
|
title: '삭제 안내',
|
||||||
@@ -910,6 +918,22 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const downloadFile = (url,type, title, num) => {
|
||||||
|
const houseHoldNum = document.getElementById("targetHouseHoldNum").innerText;
|
||||||
|
const yearMonth = document.getElementById("recordMonthStr").value;
|
||||||
|
let text = document.querySelector("h3._selectedGroupNo").innerText;
|
||||||
|
let day = text.match(/\d+/)[0].padStart(2, "0");
|
||||||
|
const changeFileName = houseHoldNum+"_"+yearMonth+""+day+"_"+type+"_"+title.replace(/\s+/g, "")+"_"+num.padStart(3, "0");
|
||||||
|
|
||||||
|
const urlReplace = `${url}?rename=${encodeURIComponent(changeFileName)}`;
|
||||||
|
|
||||||
|
const a = document.createElement("a");
|
||||||
|
a.href = urlReplace;
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
a.remove();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
</html>
|
</html>
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
recordMonth: f.recordMonth.value
|
recordMonth: f.recordMonth.value
|
||||||
},
|
},
|
||||||
(response) => { // 성공
|
(response) => { // 성공
|
||||||
console.log("임산물 현황 리스트 조회 : ", response);
|
// console.log("임산물 현황 리스트 조회 : ", response);
|
||||||
|
|
||||||
const tbody = $('.tab-content.forest-product tbody');
|
const tbody = $('.tab-content.forest-product tbody');
|
||||||
tbody.empty();
|
tbody.empty();
|
||||||
@@ -189,7 +189,7 @@
|
|||||||
|
|
||||||
// 이번달 등록내용 없음 수정 처리
|
// 이번달 등록내용 없음 수정 처리
|
||||||
const updateForestProductNone = (obj) => {
|
const updateForestProductNone = (obj) => {
|
||||||
console.log(obj);
|
// console.log(obj);
|
||||||
ajaxUtil._ajaxMethod(
|
ajaxUtil._ajaxMethod(
|
||||||
'/api/household/forestProduct/nothing',
|
'/api/household/forestProduct/nothing',
|
||||||
JSON.stringify(obj),
|
JSON.stringify(obj),
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
recordMonth: f.recordMonth.value
|
recordMonth: f.recordMonth.value
|
||||||
},
|
},
|
||||||
(response) => { // 성공
|
(response) => { // 성공
|
||||||
console.log("임가 방문정보 조회 : ", response);
|
// console.log("임가 방문정보 조회 : ", response);
|
||||||
const tbody = $('.tab-content.household-visit tbody');
|
const tbody = $('.tab-content.household-visit tbody');
|
||||||
|
|
||||||
tbody.empty();
|
tbody.empty();
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>임가번호</th>
|
<th>임가번호</th>
|
||||||
<td>
|
<td>
|
||||||
<span th:text="${householdInfo.householdNum}">16750</span>
|
<span th:text="${householdInfo.householdNum}" id="targetHouseHoldNum">16750</span>
|
||||||
</td>
|
</td>
|
||||||
<th>경영주</th>
|
<th>경영주</th>
|
||||||
<td>
|
<td>
|
||||||
@@ -133,7 +133,7 @@
|
|||||||
<button type="button" class="tab-label select-tab" data-tab-type="household-visit" data-tab-value="tab4">임가방문정보</button>
|
<button type="button" class="tab-label select-tab" data-tab-type="household-visit" data-tab-value="tab4">임가방문정보</button>
|
||||||
|
|
||||||
<div class="component-select select-date">
|
<div class="component-select select-date">
|
||||||
<select class="select-list" name="recordMonth" required onchange="onRecordMonthChange();">
|
<select class="select-list" name="recordMonth" id="recordMonthStr" required onchange="onRecordMonthChange();">
|
||||||
<option th:each="m : ${monthList}"
|
<option th:each="m : ${monthList}"
|
||||||
th:value="${m.value}"
|
th:value="${m.value}"
|
||||||
th:text="${m.label}"
|
th:text="${m.label}"
|
||||||
|
|||||||
@@ -106,7 +106,7 @@
|
|||||||
let visitDatePicker;
|
let visitDatePicker;
|
||||||
|
|
||||||
document.getElementById('visitDate').addEventListener('change', function (e) {
|
document.getElementById('visitDate').addEventListener('change', function (e) {
|
||||||
console.log("날짜 변경됨:", e.target.value);
|
// console.log("날짜 변경됨:", e.target.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
const showHouseholdModal2 = (seq) => {
|
const showHouseholdModal2 = (seq) => {
|
||||||
|
|||||||
@@ -162,7 +162,6 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
function (code, rstData) {
|
function (code, rstData) {
|
||||||
console.log("왜지 ");
|
|
||||||
|
|
||||||
},
|
},
|
||||||
'get',
|
'get',
|
||||||
|
|||||||
@@ -432,7 +432,7 @@
|
|||||||
case 'down':
|
case 'down':
|
||||||
$(siblingsWithoutMe).each(function (idx, item) {
|
$(siblingsWithoutMe).each(function (idx, item) {
|
||||||
if (item.orderNo > curOrderNo) {
|
if (item.orderNo > curOrderNo) {
|
||||||
console.log('nextNode is ', item);
|
// console.log('nextNode is ', item);
|
||||||
targetItem = item;
|
targetItem = item;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,4 +126,41 @@ public class CommonUtil {
|
|||||||
flashMessages.add(msg);
|
flashMessages.add(msg);
|
||||||
session.setAttribute("flashAlertMessages", flashMessages);
|
session.setAttribute("flashAlertMessages", flashMessages);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String normalizePath(String path) {
|
||||||
|
if (path == null || path.trim().isEmpty()) {
|
||||||
|
log.warn("normalizePath: Input path is null or empty, returning default path");
|
||||||
|
String defaultPath = System.getProperty("user.home") + File.separator + "Downloads";
|
||||||
|
return Paths.get(defaultPath).toAbsolutePath().normalize().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Paths.get을 사용하여 경로 정규화
|
||||||
|
Path normalizedPath = Paths.get(path).toAbsolutePath().normalize();
|
||||||
|
String result = normalizedPath.toString();
|
||||||
|
log.debug("Normalized path: {}", result);
|
||||||
|
return result;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Error normalizing path: {}", path, e);
|
||||||
|
throw new IllegalArgumentException("Failed to normalize path: " + path, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void createDirectories(File directory) {
|
||||||
|
if (directory == null) {
|
||||||
|
throw new IllegalArgumentException("Directory cannot be null");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (!directory.exists()) {
|
||||||
|
boolean created = directory.mkdirs();
|
||||||
|
log.info("Directory created: {} (Success: {})", directory.getAbsolutePath(), created);
|
||||||
|
}
|
||||||
|
if (!directory.canWrite()) {
|
||||||
|
throw new IOException("No write permission for directory: " + directory.getAbsolutePath());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Failed to create directory: {}", directory.getAbsolutePath(), e);
|
||||||
|
throw new RuntimeException("Failed to create directory", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,12 +14,16 @@ import java.util.Date;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class DailyUtil {
|
public class DailyUtil {
|
||||||
|
|
||||||
|
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* int -> localdate
|
* int -> localdate
|
||||||
* @param month 월(yyyyMM)
|
* @param month 월(yyyyMM)
|
||||||
@@ -179,4 +183,39 @@ public class DailyUtil {
|
|||||||
returnValue.put("expenseMark", expenseMark);
|
returnValue.put("expenseMark", expenseMark);
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dateStr 문자열을 기준으로 수정 가능 여부 반환
|
||||||
|
* @param dateStr 수정 대상 월 (예: "2025-04-03")
|
||||||
|
* @return true = 수정 가능, false = 수정 불가
|
||||||
|
*/
|
||||||
|
public boolean isEditable(String dateStr) {
|
||||||
|
try {
|
||||||
|
LocalDate date = LocalDate.parse(dateStr, DATE_FORMATTER);
|
||||||
|
|
||||||
|
// 대상 월
|
||||||
|
YearMonth targetMonth = YearMonth.from(date);
|
||||||
|
|
||||||
|
// 마감일 계산
|
||||||
|
LocalDate limitDate;
|
||||||
|
if (DailyRecordConstants.MODIFY_LIMIT_DAY == 31) {
|
||||||
|
limitDate = targetMonth
|
||||||
|
.plusMonths(DailyRecordConstants.MODIFY_LIMIT_MONTH)
|
||||||
|
.atEndOfMonth();
|
||||||
|
} else {
|
||||||
|
limitDate = targetMonth
|
||||||
|
.plusMonths(DailyRecordConstants.MODIFY_LIMIT_MONTH)
|
||||||
|
.atDay(DailyRecordConstants.MODIFY_LIMIT_DAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
|
||||||
|
// 오늘이 마감일 이후면 수정 불가
|
||||||
|
return !today.isAfter(limitDate);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false; // 형식 오류나 파싱 실패 → 수정 불가
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,13 +40,12 @@ public final class DailyRecordConstants {
|
|||||||
* [정책] 해당월 15일까지는 이전달 데이터 등록 가능
|
* [정책] 해당월 15일까지는 이전달 데이터 등록 가능
|
||||||
* 이전 달을 의미하는 상수
|
* 이전 달을 의미하는 상수
|
||||||
*/
|
*/
|
||||||
public static final int REGISTER_LIMIT_MONTH = 3;
|
public static final int REGISTER_LIMIT_MONTH = 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 일계부 등록 가능 일
|
* 일계부 등록 가능 일
|
||||||
* [정책] 해당월 15일까지는 이전달 데이터 등록 가능
|
* [정책] 해당월 15일까지는 이전달 데이터 등록 가능
|
||||||
* 날짜 기준 정책
|
* 날짜 기준 정책
|
||||||
* 임시로 31일로 설정해둠 15일로 변경해야됨.
|
|
||||||
*/
|
*/
|
||||||
public static final int REGISTER_LIMIT_DAY = 31;
|
public static final int REGISTER_LIMIT_DAY = 31;
|
||||||
|
|
||||||
@@ -55,14 +54,20 @@ public final class DailyRecordConstants {
|
|||||||
* [정책] 해당월 15일까지는 이전달 데이터 수정 가능
|
* [정책] 해당월 15일까지는 이전달 데이터 수정 가능
|
||||||
* 이전 달을 의미하는 상수
|
* 이전 달을 의미하는 상수
|
||||||
*/
|
*/
|
||||||
public static final int MODIFY_LIMIT_MONTH = 3;
|
public static final int MODIFY_LIMIT_MONTH = 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 일계부 수정 가능 일
|
* 일계부 수정 가능 일
|
||||||
* [정책] 해당월 15일까지는 이전달 데이터 수정 가능
|
* [정책] 해당월 15일까지는 이전달 데이터 수정 가능
|
||||||
* 날짜 기준 정책
|
* 날짜 기준 정책
|
||||||
* 임시로 31일로 설정해둠 15일로 변경해야됨.
|
|
||||||
*/
|
*/
|
||||||
public static final int MODIFY_LIMIT_DAY = 31;
|
public static final int MODIFY_LIMIT_DAY = 31;
|
||||||
|
/**
|
||||||
|
* admin 년도 시작일
|
||||||
|
*/
|
||||||
|
public static final int START_YEAR = 2024;
|
||||||
|
/**
|
||||||
|
* 첫 시작년도의 시작 월
|
||||||
|
*/
|
||||||
|
public static final int START_MONTH_OF_START_YEAR = 8;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package app.module.core.usecase.daily.dayGroup.adapters.persistence;
|
||||||
|
|
||||||
|
|
||||||
|
import app.module.core.config.application.util.DailyUtil;
|
||||||
|
import app.module.core.usecase.daily.dayGroup.adapters.persistence.model.DailyDayGroupDto;
|
||||||
|
import app.module.core.usecase.daily.dayGroup.ports.DailyDayGroupPortOut;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DailyDayGroupDao implements DailyDayGroupPortOut {
|
||||||
|
private final DailyDayGroupMapper dailyRecordMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DailyDayGroupDto detail(String searchDay) {
|
||||||
|
return dailyRecordMapper.getDailyDayGroup(searchDay);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public DailyDayGroupDto detailbyGroupNo(Integer groupNo) {
|
||||||
|
return dailyRecordMapper.getDailyDayGroupByGroupNo(groupNo);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package app.module.core.usecase.daily.dayGroup.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.core.usecase.daily.dayGroup.adapters.persistence.model.DailyDayGroupDto;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface DailyDayGroupMapper {
|
||||||
|
|
||||||
|
DailyDayGroupDto getDailyDayGroup(String searchDay);
|
||||||
|
DailyDayGroupDto getDailyDayGroupByGroupNo(Integer groupNo);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package app.module.core.usecase.daily.dayGroup.adapters.persistence.model;
|
||||||
|
|
||||||
|
import app.module.core.config.application.enums.DailySort;
|
||||||
|
import app.module.core.config.application.enums.DailyStatus;
|
||||||
|
import app.module.core.config.application.enums.DailyTargetStatus;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Data
|
||||||
|
public class DailyDayGroupDto {
|
||||||
|
|
||||||
|
private Integer groupNo;
|
||||||
|
private Integer startDay;
|
||||||
|
private Integer endDay;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package app.module.core.usecase.daily.dayGroup.ports;
|
||||||
|
|
||||||
|
import app.module.core.usecase.daily.dayGroup.adapters.persistence.model.DailyDayGroupDto;
|
||||||
|
|
||||||
|
public interface DailyDayGroupPortIn {
|
||||||
|
DailyDayGroupDto detail(String searchDay);
|
||||||
|
DailyDayGroupDto detailbyGroupNo(Integer groupNo);
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user