일계부 데이터 Excel 일괄 업로드 기능 추가
관리자 > 임가현황
This commit is contained in:
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 로 저장되었습니다 ✅");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,5 +10,6 @@ import lombok.Setter;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class CheckHouseholdNum {
|
||||
private Boolean isDuplicated; // 사용여부
|
||||
private Boolean isDuplicated; // 사용여부
|
||||
private Long householdSeq; // 가구일련번호
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,6 +17,7 @@ class ExcelUploadCreateHouseholdController {
|
||||
|
||||
private final ExcelUploadCreateHouseholdPortIn excelUploadCreateHouseholdPortIn;
|
||||
|
||||
// 임가현황 > 엑셀 업로드
|
||||
@PostMapping(path = "/api/household/excelUpload")
|
||||
ResponseEntity<?> operate(@RequestParam("file") MultipartFile file ) throws IOException {
|
||||
try {
|
||||
@@ -29,4 +30,18 @@ class ExcelUploadCreateHouseholdController {
|
||||
.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 {
|
||||
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;
|
||||
|
||||
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 {
|
||||
private final ExcelUploadCreateHouseholdPortOut portOut;
|
||||
|
||||
@Override
|
||||
public ExcelUploadResultVO operate(MultipartFile file) throws IOException {
|
||||
return portOut.operate(file);
|
||||
}
|
||||
@Override
|
||||
public ExcelUploadResultVO operate(MultipartFile file) throws IOException {
|
||||
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.application.domain.GetHouseholdStatusCmd;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
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.RequestParam;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.stream.IntStream;
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class GetHouseholdStatusUIController {
|
||||
@@ -45,7 +48,12 @@ class GetHouseholdStatusUIController {
|
||||
// 임가 상세 정보
|
||||
model.addAttribute("householdInfo",
|
||||
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}";
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
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 org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@@ -8,4 +9,5 @@ public interface UpdateMonthlyInputStatusMapper {
|
||||
void updateForestProductStatus(UpdateForestProductStatusCmd cmd);
|
||||
void updateBankInputStatus(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;
|
||||
|
||||
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;
|
||||
|
||||
@Mapper
|
||||
public interface SaveBankAutoTransferExpenseMapper {
|
||||
void createBankAutoTransferExpense(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 startDay;
|
||||
private String endDay;
|
||||
private Boolean ocrErrorResult;
|
||||
}
|
||||
|
||||
@@ -30,4 +30,5 @@ public class GetDailyIncomeRecords {
|
||||
private String attachmentURL;
|
||||
private String startDay;
|
||||
private String endDay;
|
||||
private Boolean ocrErrorResult;
|
||||
}
|
||||
|
||||
@@ -42,4 +42,33 @@ public class RemoveDailyDao implements RemoveDailyPortOut {
|
||||
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 {
|
||||
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 {
|
||||
void operate(RemoveDailyCmd command);
|
||||
void operateStatus(RemoveDailyCmd command);
|
||||
}
|
||||
|
||||
@@ -20,4 +20,13 @@ public class RemoveDailyService implements RemoveDailyPortIn {
|
||||
|
||||
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;
|
||||
|
||||
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.ports.SaveDailyExpensePortOut;
|
||||
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 RemoveDailyMapper removeDailyMapper;
|
||||
|
||||
@Override
|
||||
public GetDailyExpenseDto detail(GetDailyExpenseCmd command) {
|
||||
|
||||
@@ -27,9 +30,12 @@ public class SaveDailyExpenseDao implements SaveDailyExpensePortOut {
|
||||
@Override
|
||||
public void create(GetDailyExpenseCmd findCmd, SaveDailyExpenseCmd command) {
|
||||
Integer existCount = dailyExpenseMapper.getRecordExistCount(findCmd);
|
||||
if (existCount == 0) {
|
||||
dailyExpenseMapper.createDailyExpense(command);
|
||||
|
||||
if (existCount == 0 ) {
|
||||
if(findCmd.getId()== null || findCmd.getId() == 0 ) {
|
||||
dailyExpenseMapper.createDailyExpense(command);
|
||||
} else {
|
||||
dailyExpenseMapper.updateDailyExpenseOnlyId(command);
|
||||
}
|
||||
safeLogger.debug("[CreateDailyExpense] command={}", command);
|
||||
} else {
|
||||
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.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.SaveDailyExpenseExcelCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
@@ -36,4 +37,12 @@ public interface SaveDailyExpenseMapper {
|
||||
* @param 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;
|
||||
|
||||
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.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.validator.SaveDailyExpenseValidator;
|
||||
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.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.web.model.CreateDailyRecordReqVO;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -15,6 +24,9 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/api/household/daily/expense")
|
||||
@@ -23,6 +35,11 @@ public class SaveDailyExpenseController {
|
||||
private final SaveDailyExpensePortIn dailyExpensePortIn;
|
||||
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());
|
||||
|
||||
|
||||
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.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyId(dailyRecord.getId());
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -81,4 +114,34 @@ public class SaveDailyExpenseController {
|
||||
|
||||
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 jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@@ -48,4 +49,15 @@ public class SaveDailyExpenseReqVO extends DailyExpenseUIReqVO {
|
||||
* 현물평가액
|
||||
*/
|
||||
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) {
|
||||
SaveDailyExpenseReqVO vo = (SaveDailyExpenseReqVO) target;
|
||||
|
||||
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"수량을 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getQuantity() != null && vo.getQuantity() <= 0) {
|
||||
errors.rejectValue(
|
||||
"quantity", CommonConstants.VALID_CODE_INVALID_ZERO,
|
||||
"수량은 0 이상 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 선택해 주세요.");
|
||||
}
|
||||
|
||||
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||
errors.rejectValue(
|
||||
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 입력해 주세요.");
|
||||
}
|
||||
// if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||
// errors.rejectValue(
|
||||
// "quantity", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
// "수량을 입력해 주세요.");
|
||||
// }
|
||||
//
|
||||
// if (vo.getQuantity() != null && vo.getQuantity() <= 0) {
|
||||
// errors.rejectValue(
|
||||
// "quantity", CommonConstants.VALID_CODE_INVALID_ZERO,
|
||||
// "수량은 0 이상 입력해 주세요.");
|
||||
// }
|
||||
//
|
||||
// if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
||||
// errors.rejectValue(
|
||||
// "unitCode", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
// "단위를 선택해 주세요.");
|
||||
// }
|
||||
//
|
||||
// if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||
// errors.rejectValue(
|
||||
// "unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
// "단위를 입력해 주세요.");
|
||||
// }
|
||||
|
||||
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
|
||||
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.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.SaveDailyForestryExcelCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
@@ -36,4 +37,11 @@ public interface SaveDailyForestryMapper {
|
||||
* @param 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
|
||||
public void create(GetDailyIncomeCmd findCmd, SaveDailyIncomeCmd command) {
|
||||
Integer existCount = dailyIncomeMapper.getRecordExistCount(findCmd);
|
||||
if (existCount == 0) {
|
||||
dailyIncomeMapper.createDailyIncome(command);
|
||||
if (existCount == 0 ) {
|
||||
if(findCmd.getId()== null || findCmd.getId() == 0 ) {
|
||||
dailyIncomeMapper.createDailyIncome(command);
|
||||
} else {
|
||||
dailyIncomeMapper.updateDailyIncomeOnlyId(command);
|
||||
}
|
||||
|
||||
safeLogger.debug("[CreateDailyIncome] command={}", command);
|
||||
} 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.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.SaveDailyIncomeExcelCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
@@ -36,4 +37,12 @@ public interface SaveDailyIncomeMapper {
|
||||
* @param 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;
|
||||
|
||||
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.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.validator.SaveDailyIncomeValidator;
|
||||
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.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.web.model.CreateDailyRecordReqVO;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -15,6 +24,9 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/api/household/daily/income")
|
||||
@@ -23,6 +35,10 @@ public class SaveDailyIncomeController {
|
||||
private final SaveDailyIncomePortIn dailyIncomePortIn;
|
||||
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());
|
||||
|
||||
|
||||
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.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyId(dailyRecord.getId());
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -81,4 +111,36 @@ public class SaveDailyIncomeController {
|
||||
|
||||
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 jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@@ -52,4 +53,15 @@ public class SaveDailyIncomeReqVO extends DailyIncomeUIReqVO {
|
||||
* 현물평가액
|
||||
*/
|
||||
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) {
|
||||
SaveDailyIncomeReqVO vo = (SaveDailyIncomeReqVO) target;
|
||||
|
||||
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"수량을 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getQuantity() != null && vo.getQuantity() <= 0) {
|
||||
errors.rejectValue(
|
||||
"quantity", CommonConstants.VALID_CODE_INVALID_ZERO,
|
||||
"수량은 0 이상 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 선택해 주세요.");
|
||||
}
|
||||
|
||||
if ("code.record.unit.self".equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||
errors.rejectValue(
|
||||
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 입력해 주세요.");
|
||||
}
|
||||
// if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||
// errors.rejectValue(
|
||||
// "quantity", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
// "수량을 입력해 주세요.");
|
||||
// }
|
||||
//
|
||||
// if (vo.getQuantity() != null && vo.getQuantity() <= 0) {
|
||||
// errors.rejectValue(
|
||||
// "quantity", CommonConstants.VALID_CODE_INVALID_ZERO,
|
||||
// "수량은 0 이상 입력해 주세요.");
|
||||
// }
|
||||
//
|
||||
// if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
||||
// errors.rejectValue(
|
||||
// "unitCode", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
// "단위를 선택해 주세요.");
|
||||
// }
|
||||
//
|
||||
// if ("code.record.unit.self".equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||
// errors.rejectValue(
|
||||
// "unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
// "단위를 입력해 주세요.");
|
||||
// }
|
||||
|
||||
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
|
||||
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.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.SaveDailyPowerExcelCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
@@ -36,4 +37,11 @@ public interface SaveDailyPowerMapper {
|
||||
* @param 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.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.SaveDailyWorkExcelCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
@@ -36,4 +37,11 @@ public interface SaveDailyWorkMapper {
|
||||
* @param 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;
|
||||
|
||||
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;
|
||||
|
||||
@Mapper
|
||||
@@ -8,4 +9,5 @@ public interface SaveForestProductMapper {
|
||||
String getForestProductStatus(Long monthlyInputStatusId);
|
||||
void createForestProduct(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;
|
||||
}
|
||||
@@ -3,10 +3,11 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper
|
||||
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 COUNT(*) > 0 AS is_duplicated
|
||||
FROM household
|
||||
WHERE household_num = #{householdNum};
|
||||
</select>
|
||||
<select id="checkHouseholdNum"
|
||||
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>
|
||||
@@ -47,7 +47,8 @@
|
||||
uf.id AS file_id,
|
||||
uf.name AS file_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">
|
||||
, EXTRACT(DAY FROM CAST(dr.start_date as date)) as start_day
|
||||
, EXTRACT(DAY FROM CAST(dr.end_date as date)) as end_day
|
||||
@@ -163,7 +164,8 @@
|
||||
uf.id AS file_id,
|
||||
uf.name AS file_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">
|
||||
, EXTRACT(DAY FROM CAST(dr.start_date as date)) as start_day
|
||||
, EXTRACT(DAY FROM CAST(dr.end_date as date)) as end_day
|
||||
|
||||
@@ -6,67 +6,109 @@
|
||||
<select id="getDailyRecordsStatus"
|
||||
resultType="app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordsStatus.ports.application.domain.GetDailyRecordsStatus">
|
||||
/* getDailyRecordsStatus : 일계부 등록 현황 리스트 조회 */
|
||||
WITH data_counts AS (
|
||||
SELECT
|
||||
dr.id,
|
||||
COUNT(DISTINCT di.id) AS income_cnt,
|
||||
COUNT(DISTINCT dw.id) AS work_cnt,
|
||||
COUNT(DISTINCT de.id) AS expense_cnt,
|
||||
COUNT(DISTINCT dp.id) AS power_cnt,
|
||||
COUNT(DISTINCT dfs.id) AS forestry_cnt,
|
||||
COUNT(distinct dfm.id) AS farming_cnt
|
||||
FROM daily_record dr
|
||||
LEFT JOIN daily_income di ON di.daily_record_seq = dr.id AND di.is_deleted = false
|
||||
LEFT JOIN daily_work dw ON dw.daily_record_seq = dr.id AND dw.is_deleted = false
|
||||
LEFT JOIN daily_expense de ON de.daily_record_seq = dr.id AND de.is_deleted = false
|
||||
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
|
||||
LEFT JOIN daily_farming dfm on dfm.daily_record_seq = dr.id and dfm.is_deleted = false
|
||||
WHERE dr.household_seq = #{householdSeq}
|
||||
AND dr.record_month = #{recordMonth}
|
||||
AND dr.is_deleted = false
|
||||
GROUP BY dr.id
|
||||
),
|
||||
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 /* recordMonth 의 말일 */
|
||||
)
|
||||
WITH
|
||||
-- 각 일자별 항목별 개수를 미리 계산
|
||||
income AS (
|
||||
SELECT daily_record_seq, COUNT(*) AS income_cnt
|
||||
FROM daily_income
|
||||
WHERE is_deleted = false
|
||||
GROUP BY daily_record_seq
|
||||
),
|
||||
work AS (
|
||||
SELECT daily_record_seq, COUNT(*) AS work_cnt
|
||||
FROM daily_work
|
||||
WHERE is_deleted = false
|
||||
GROUP BY daily_record_seq
|
||||
),
|
||||
expense AS (
|
||||
SELECT daily_record_seq, COUNT(*) AS expense_cnt
|
||||
FROM daily_expense
|
||||
WHERE is_deleted = false
|
||||
GROUP BY daily_record_seq
|
||||
),
|
||||
power AS (
|
||||
SELECT daily_record_seq, COUNT(*) AS power_cnt
|
||||
FROM daily_power
|
||||
WHERE is_deleted = false
|
||||
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
|
||||
dr.id AS id,
|
||||
ddg.group_no AS day_group_no,
|
||||
/* 해당 월의 말일을 기준으로 종료일을 제한하여 일자 그룹 표시 */
|
||||
ddg.start_day ||
|
||||
CASE
|
||||
WHEN ddg.start_day = LEAST(ddg.end_day, mc.month_last_day)
|
||||
THEN ''
|
||||
ELSE '-' || LEAST(ddg.end_day, mc.month_last_day)
|
||||
END AS day_group,
|
||||
CASE
|
||||
WHEN mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE) THEN 'WAITING' /* 대기 */
|
||||
WHEN dr.all_status IN ('DONE', 'TODAY_NONE') THEN 'DONE' /* 작성완료 */
|
||||
WHEN dr.all_status = 'WAITING' THEN 'INCOMPLETE' /* 미완료 */
|
||||
ELSE 'EMPTY' /* 미작성 */
|
||||
END AS all_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.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.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.forestry_status, dc.forestry_cnt) AS forestry_status,
|
||||
fn_get_farming_status(
|
||||
ddg.start_day,
|
||||
dr.record_month,
|
||||
mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE),
|
||||
dr.farming_status,
|
||||
dc.farming_cnt
|
||||
) AS farming_status
|
||||
dr.id AS id,
|
||||
ddg.group_no AS day_group_no,
|
||||
-- 일자 범위 표시
|
||||
ddg.start_day ||
|
||||
CASE
|
||||
WHEN ddg.start_day = LEAST(ddg.end_day, mc.month_last_day)
|
||||
THEN ''
|
||||
ELSE '-' || LEAST(ddg.end_day, mc.month_last_day)
|
||||
END AS day_group,
|
||||
-- 전체 상태
|
||||
CASE
|
||||
WHEN mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE) THEN 'WAITING'
|
||||
WHEN dr.all_status IN ('DONE', 'TODAY_NONE') THEN 'DONE'
|
||||
WHEN dr.all_status = 'WAITING' THEN 'INCOMPLETE'
|
||||
ELSE 'EMPTY'
|
||||
END AS all_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.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.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.forestry_status, dc.forestry_cnt) AS forestry_status,
|
||||
fn_get_farming_status(
|
||||
ddg.start_day,
|
||||
dr.record_month,
|
||||
mc.is_current_month AND ddg.start_day > EXTRACT(DAY FROM CURRENT_DATE),
|
||||
dr.farming_status,
|
||||
dc.farming_cnt
|
||||
) AS farming_status
|
||||
FROM daily_day_group ddg
|
||||
CROSS JOIN month_check mc
|
||||
LEFT JOIN daily_record dr ON ddg.group_no = dr.day_group_no
|
||||
AND dr.household_seq = #{householdSeq}
|
||||
AND dr.record_month = #{recordMonth}
|
||||
AND dr.is_deleted = false
|
||||
LEFT JOIN data_counts dc ON dc.id = dr.id
|
||||
CROSS JOIN month_check mc
|
||||
LEFT JOIN daily_record dr
|
||||
ON ddg.group_no = dr.day_group_no
|
||||
AND dr.household_seq = #{householdSeq}
|
||||
AND dr.record_month = #{recordMonth}
|
||||
AND dr.is_deleted = false
|
||||
LEFT JOIN data_counts dc ON dc.id = dr.id
|
||||
WHERE ddg.start_day <= mc.month_last_day
|
||||
ORDER BY ddg.start_day
|
||||
</select>
|
||||
|
||||
@@ -57,4 +57,44 @@
|
||||
<include refid="common.fields.UpdateBaseSet"/>
|
||||
WHERE id = #{bankAutoTransferId}
|
||||
</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>
|
||||
@@ -92,4 +92,60 @@
|
||||
<include refid="common.fields.UpdateBaseSet"/>
|
||||
WHERE id = #{forestProductId}
|
||||
</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>
|
||||
@@ -29,4 +29,10 @@
|
||||
WHERE is_deleted = false
|
||||
AND id = #{id}
|
||||
</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>
|
||||
@@ -50,9 +50,43 @@
|
||||
, unit_self = #{unitSelf}
|
||||
, price = #{price}
|
||||
, estimated_value = #{estimatedValue}
|
||||
, ocr_error_result = false
|
||||
where is_deleted = false
|
||||
and daily_record_seq = #{dailyRecordSeq}
|
||||
and id = #{id}
|
||||
</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>
|
||||
|
||||
@@ -53,4 +53,20 @@
|
||||
and id = #{id}
|
||||
</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>
|
||||
|
||||
@@ -51,9 +51,43 @@
|
||||
, unit_self = #{unitSelf}
|
||||
, price = #{price}
|
||||
, estimated_value = #{estimatedValue}
|
||||
, ocr_error_result = false
|
||||
where is_deleted = false
|
||||
and daily_record_seq = #{dailyRecordSeq}
|
||||
and id = #{id}
|
||||
</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>
|
||||
|
||||
@@ -46,4 +46,17 @@
|
||||
and id = #{id}
|
||||
</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>
|
||||
|
||||
@@ -68,4 +68,22 @@
|
||||
and id = #{id}
|
||||
</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>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
etUI.utils.ready(function() {
|
||||
console.log('document ready');
|
||||
|
||||
|
||||
etUI.initUI();
|
||||
})
|
||||
@@ -125,7 +125,7 @@ var ajaxUtil = {
|
||||
console.error('statusCode: 403');
|
||||
},
|
||||
422:function(rstData, status) {
|
||||
console.log(rstData);
|
||||
// console.log(rstData);
|
||||
// options type : 1. alert, 2. field
|
||||
if (options.handle422Type === 'alert') {
|
||||
if (typeof errorCallback !== 'undefined') {
|
||||
@@ -171,14 +171,14 @@ var ajaxUtil = {
|
||||
},
|
||||
success : function(rstData, status) {
|
||||
ajaxUtil._hideWaiting();
|
||||
console.log('succ', rstData)
|
||||
// console.log('succ', rstData)
|
||||
if (typeof successCallback !== 'undefined') {
|
||||
successCallback(rstData, status);
|
||||
}
|
||||
},
|
||||
error : function(rstData) {
|
||||
ajaxUtil._hideWaiting();
|
||||
console.log('error')
|
||||
// console.log('error')
|
||||
if (!(rstData.status == 500 || rstData.status == 422 || rstData.status == 400)) {
|
||||
if (typeof errorCallback !== 'undefined') {
|
||||
errorCallback(rstData.status, rstData);
|
||||
|
||||
@@ -241,7 +241,7 @@ uiUtil.uploadFile = (fileUploadType, input) => {
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success(res) {
|
||||
console.log(res);
|
||||
// console.log(res);
|
||||
|
||||
// 에러 메세지가 있었다면 초기화
|
||||
$(input).removeClass('is-invalid');
|
||||
|
||||
@@ -205,7 +205,7 @@
|
||||
checkDuplicate = response <= 0;
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("error : ", code);
|
||||
// console.log("error : ", code);
|
||||
if(code == 400) alert("아이디를 입력해주세요.");
|
||||
if(code == 422) alert(rstData.responseText);
|
||||
checkDuplicate = false;
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
});
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("error : ", code);
|
||||
console.log("error : ");
|
||||
},
|
||||
'get',
|
||||
'json'
|
||||
@@ -228,7 +228,7 @@
|
||||
|
||||
const selectedResearcher = researcherList.find(r => r.adminSeq == selectedAdminSeq);
|
||||
|
||||
console.log("선택된 조사원 : ", selectedResearcher);
|
||||
// console.log("선택된 조사원 : ", selectedResearcher);
|
||||
|
||||
// import 해준 html 에서 아래 함수를 선언해주면 selectedResearcher 값을 사용할 수 있음.
|
||||
getSelectedResearcher(selectedResearcher, () => {
|
||||
|
||||
@@ -360,7 +360,7 @@
|
||||
checkDuplicate = !response.isDuplicated;
|
||||
},
|
||||
function (code, rstData) { // 실패
|
||||
console.log("error : ", code);
|
||||
// console.log("error : ", code);
|
||||
if(code == 400) alert("임가번호를 입력해주세요.");
|
||||
},
|
||||
'get',
|
||||
@@ -386,12 +386,12 @@
|
||||
function(response) { // 성공
|
||||
alert("등록이 완료되었습니다.");
|
||||
location.href = '/households';
|
||||
console.log("code", response)
|
||||
// console.log("code", response)
|
||||
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("code", code)
|
||||
console.log("rstData", rstData)
|
||||
// console.log("code", code)
|
||||
// console.log("rstData", rstData)
|
||||
|
||||
if(code == 422) alert(rstData.responseText);
|
||||
if(code == 400) alert(rstData.responseJSON.message); //임가번호 중복체크
|
||||
|
||||
@@ -284,6 +284,9 @@
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<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();" >
|
||||
<span class="btn-txt">엑셀 업로드</span>
|
||||
</button>
|
||||
@@ -359,7 +362,7 @@
|
||||
'/api/households',
|
||||
dataOj,
|
||||
function(response) { // 성공
|
||||
console.log("response", response);
|
||||
// console.log("response", response);
|
||||
|
||||
$('#totalElements').text(response.totalElements);
|
||||
|
||||
@@ -424,7 +427,7 @@
|
||||
}));
|
||||
},
|
||||
function (code, rstData) { // 실패
|
||||
console.log("error : ", code);
|
||||
console.log("error : ");
|
||||
},
|
||||
'get',
|
||||
'json'
|
||||
|
||||
@@ -176,13 +176,13 @@
|
||||
`/api/household/bankAutoTransferIncome/${id}`,
|
||||
{},
|
||||
(response) => {
|
||||
console.log("은행자동이체(수입) 상세 응답값 : ", response);
|
||||
// console.log("은행자동이체(수입) 상세 응답값 : ", response);
|
||||
setBankIncomeFormData(response);
|
||||
|
||||
document.querySelector(".modal-bank-income").ui.open();
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("error : ", code);
|
||||
console.log("error : ");
|
||||
},
|
||||
'get',
|
||||
'json'
|
||||
@@ -254,7 +254,7 @@
|
||||
if (!f) return;
|
||||
|
||||
let dataOj = $(f).serializeObject();
|
||||
console.log("dataOj", dataOj);
|
||||
// console.log("dataOj", dataOj);
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/household/bank/income/save',
|
||||
|
||||
@@ -10,13 +10,19 @@
|
||||
<input type="hidden" name="id">
|
||||
<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="modal-dimm"></div>
|
||||
<div class="modal-frame">
|
||||
<div class="modal-container">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-tit">
|
||||
일계부 수입
|
||||
일계부 지출
|
||||
</h3>
|
||||
</div>
|
||||
<div class="modal-content">
|
||||
@@ -31,7 +37,28 @@
|
||||
<col width="25.3%" />
|
||||
</colgroup>
|
||||
<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>
|
||||
<th>외상 또는 카드 구입 여부</th>
|
||||
<td class="radio-group" colspan="4">
|
||||
@@ -159,10 +186,156 @@
|
||||
form.price.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;
|
||||
priceDisabledReset(form.price, form.estimatedValue);
|
||||
}
|
||||
|
||||
|
||||
// 일계부 상세 값 set
|
||||
const setDailyExpenseFormData = (data) => {
|
||||
const form = document.reqExpenseForm;
|
||||
@@ -199,6 +372,11 @@
|
||||
mf.groupNo.value = document.reqForm.groupNo.value;
|
||||
mf.dailyId.value = document.reqForm.dailyId.value;
|
||||
mf.id.value = (id === undefined) ? '' : id;
|
||||
// if(id === undefined){
|
||||
// mf.selectedGroupNo.value = null;
|
||||
// } else {
|
||||
mf.selectedGroupNo.value = document.reqForm.groupNo.value;
|
||||
// }
|
||||
|
||||
resetDailyExpenseForm();
|
||||
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
<input type="hidden" name="id">
|
||||
<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="modal-dimm"></div>
|
||||
<div class="modal-frame">
|
||||
@@ -31,7 +35,28 @@
|
||||
<col width="25.3%" />
|
||||
</colgroup>
|
||||
<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>
|
||||
<th>외상판매 여부</th>
|
||||
<td class="radio-group">
|
||||
@@ -172,6 +197,151 @@
|
||||
form.price.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;
|
||||
priceDisabledReset(form.price, form.estimatedValue);
|
||||
}
|
||||
@@ -213,6 +383,11 @@
|
||||
mf.groupNo.value = document.reqForm.groupNo.value;
|
||||
mf.dailyId.value = document.reqForm.dailyId.value;
|
||||
mf.id.value = (id === undefined) ? '' : id;
|
||||
// if(id === undefined){
|
||||
// mf.selectedGroupNo.value = null;
|
||||
// } else {
|
||||
mf.selectedGroupNo.value = document.reqForm.groupNo.value;
|
||||
// }
|
||||
|
||||
resetDailyIncomeForm();
|
||||
|
||||
|
||||
@@ -6,37 +6,76 @@
|
||||
<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="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="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 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>
|
||||
<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>
|
||||
</form>
|
||||
|
||||
<script th:inline="javascript">
|
||||
// 일계부 엑셀업로드 모달창 띄우기
|
||||
const showExcelDailyModal = () => {
|
||||
document.querySelector(".modal-excel-daily").ui.open();
|
||||
const fileInput = document.getElementById("householdFile");
|
||||
if (fileInput) {
|
||||
fileInput.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
// 임가방문정보 모달창 띄우기
|
||||
const showExcelHouseholdModal = () => {
|
||||
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>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -261,7 +261,7 @@
|
||||
`/api/forestProduct/${id}`,
|
||||
{},
|
||||
(response) => {
|
||||
console.log("임산물현황 상세 응답값 : ", response);
|
||||
// console.log("임산물현황 상세 응답값 : ", response);
|
||||
setForestProductFormData(response);
|
||||
|
||||
document.querySelector(".modal-forest-product").ui.open();
|
||||
|
||||
@@ -143,12 +143,12 @@
|
||||
`/api/visitInfo/${id}`,
|
||||
{},
|
||||
(response) => {
|
||||
console.log("임가방문정보 상세 응답값 : ", response);
|
||||
// console.log("임가방문정보 상세 응답값 : ", response);
|
||||
setVisitFormData(response);
|
||||
document.querySelector(".modal-visit-info").ui.open();
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("error : ", code);
|
||||
console.log("error : ");
|
||||
},
|
||||
'get',
|
||||
'json'
|
||||
@@ -184,7 +184,7 @@
|
||||
const f = document.reqVisitForm;
|
||||
let dataOj = $(f).serializeObject();
|
||||
|
||||
console.log("dataOj", dataOj);
|
||||
// console.log("dataOj", dataOj);
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/visitInfo/save',
|
||||
@@ -214,7 +214,7 @@
|
||||
|
||||
datepicker.core.init($el, {
|
||||
dateSelectCallback: function (selectedDate) {
|
||||
console.log('선택된 날짜:', selectedDate);
|
||||
// console.log('선택된 날짜:', selectedDate);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
recordMonth: f.recordMonth.value
|
||||
},
|
||||
(response) => { // 성공
|
||||
console.log("은행자동이체내역 조회 : ", response);
|
||||
// console.log("은행자동이체내역 조회 : ", response);
|
||||
gridBankIncomeTable(response.incomes);
|
||||
gridBankExpenseTable(response.expenses);
|
||||
},
|
||||
|
||||
@@ -373,7 +373,7 @@
|
||||
recordMonth: f.recordMonth.value
|
||||
},
|
||||
function(response) { // 성공
|
||||
console.log("일계부 현황 리스트 조회 : ", response);
|
||||
// console.log("일계부 현황 리스트 조회 : ", response);
|
||||
const listArea = $('.tab-content .daily-record-list');
|
||||
const detailArea = $('.tab-content .daily-record-detail');
|
||||
const tbody = listArea.find('tbody');
|
||||
@@ -445,7 +445,7 @@
|
||||
'/api/household/dailyRecordStatus',
|
||||
{ recordSeq: id, recordMonth: f.recordMonth.value },
|
||||
function(response) { // 성공
|
||||
console.log("일계부 등록 상세 데이터 : ", response);
|
||||
// console.log("일계부 등록 상세 데이터 : ", response);
|
||||
|
||||
// 금일 데이터 없음 체크
|
||||
$('#incomeStatus').attr('checked', response.status.incomeStatus === 'TODAY_NONE');
|
||||
@@ -472,7 +472,7 @@
|
||||
gridFarmingTable(response.status.farmingStatus, response.farmings);
|
||||
|
||||
if (groupNo === 1) {
|
||||
console.log(groupNo, response.monthlyCarryOver)
|
||||
// console.log(groupNo, response.monthlyCarryOver)
|
||||
if (response.monthlyCarryOver != null) {
|
||||
$('#carryOver').text(Number(response.monthlyCarryOver).toLocaleString() + '원');
|
||||
} else {
|
||||
@@ -514,6 +514,7 @@
|
||||
}
|
||||
|
||||
let tmpl = '';
|
||||
// console.log(data)
|
||||
$(data).each((idx, item) => {
|
||||
tmpl +=
|
||||
`
|
||||
@@ -527,14 +528,17 @@
|
||||
</td>
|
||||
<td>${item.isCredit ? "Y" : "N"}</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 class="align-right">${formatNumberWithComma(item.quantity)}</td><!-- 수량 -->
|
||||
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
|
||||
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
|
||||
<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>
|
||||
${item.updatedBy}<br>
|
||||
@@ -609,6 +613,8 @@
|
||||
}
|
||||
|
||||
let tmpl = '';
|
||||
|
||||
|
||||
$(data).each((idx, item) => {
|
||||
tmpl +=
|
||||
`
|
||||
@@ -621,14 +627,16 @@
|
||||
</div>
|
||||
</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 class="align-right">${ifNullHyphen(item.quantity)}</td><!-- 수량 -->
|
||||
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
|
||||
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
|
||||
<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>
|
||||
${item.updatedBy}<br>
|
||||
@@ -853,7 +861,7 @@
|
||||
const saveDaily = (el) => {
|
||||
const currentStep = $(el).data('step');
|
||||
const currentModalId = $(el).data('modalId');
|
||||
console.log('saveDaily', currentStep, currentModalId);
|
||||
// console.log('saveDaily', currentStep, currentModalId);
|
||||
|
||||
if (currentStep === 'INCOME') {
|
||||
showDailyIncomeModal();
|
||||
@@ -874,7 +882,7 @@
|
||||
const removeDaily = (el) => {
|
||||
const currentStep = $(el).data('step');
|
||||
const currentListId = $(el).data('listId');
|
||||
console.log('removeDaily', currentStep, currentListId);
|
||||
// console.log('removeDaily', currentStep, currentListId);
|
||||
|
||||
if ($('#'+currentListId).find('input[type="checkbox"]:checked').length === 0) {
|
||||
alert('삭제내용은 최소 1건은 선택해야 합니다.');
|
||||
@@ -892,7 +900,7 @@
|
||||
const obj = {};
|
||||
obj.selectedIds = selectedValues;
|
||||
obj.currentStep = currentStep;
|
||||
console.log(obj)
|
||||
// console.log(obj)
|
||||
|
||||
etUI.dialog.confirm({
|
||||
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>
|
||||
</div>
|
||||
</html>
|
||||
@@ -76,7 +76,7 @@
|
||||
recordMonth: f.recordMonth.value
|
||||
},
|
||||
(response) => { // 성공
|
||||
console.log("임산물 현황 리스트 조회 : ", response);
|
||||
// console.log("임산물 현황 리스트 조회 : ", response);
|
||||
|
||||
const tbody = $('.tab-content.forest-product tbody');
|
||||
tbody.empty();
|
||||
@@ -189,7 +189,7 @@
|
||||
|
||||
// 이번달 등록내용 없음 수정 처리
|
||||
const updateForestProductNone = (obj) => {
|
||||
console.log(obj);
|
||||
// console.log(obj);
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/household/forestProduct/nothing',
|
||||
JSON.stringify(obj),
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
recordMonth: f.recordMonth.value
|
||||
},
|
||||
(response) => { // 성공
|
||||
console.log("임가 방문정보 조회 : ", response);
|
||||
// console.log("임가 방문정보 조회 : ", response);
|
||||
const tbody = $('.tab-content.household-visit tbody');
|
||||
|
||||
tbody.empty();
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<tr>
|
||||
<th>임가번호</th>
|
||||
<td>
|
||||
<span th:text="${householdInfo.householdNum}">16750</span>
|
||||
<span th:text="${householdInfo.householdNum}" id="targetHouseHoldNum">16750</span>
|
||||
</td>
|
||||
<th>경영주</th>
|
||||
<td>
|
||||
@@ -133,7 +133,7 @@
|
||||
<button type="button" class="tab-label select-tab" data-tab-type="household-visit" data-tab-value="tab4">임가방문정보</button>
|
||||
|
||||
<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}"
|
||||
th:value="${m.value}"
|
||||
th:text="${m.label}"
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
let visitDatePicker;
|
||||
|
||||
document.getElementById('visitDate').addEventListener('change', function (e) {
|
||||
console.log("날짜 변경됨:", e.target.value);
|
||||
// console.log("날짜 변경됨:", e.target.value);
|
||||
});
|
||||
|
||||
const showHouseholdModal2 = (seq) => {
|
||||
|
||||
@@ -162,7 +162,6 @@
|
||||
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.log("왜지 ");
|
||||
|
||||
},
|
||||
'get',
|
||||
|
||||
@@ -432,7 +432,7 @@
|
||||
case 'down':
|
||||
$(siblingsWithoutMe).each(function (idx, item) {
|
||||
if (item.orderNo > curOrderNo) {
|
||||
console.log('nextNode is ', item);
|
||||
// console.log('nextNode is ', item);
|
||||
targetItem = item;
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user