일계부 데이터 Excel 일괄 업로드 기능 추가
관리자 > 임가현황
This commit is contained in:
@@ -57,4 +57,6 @@ public class CreateDailyExpenseReqVO extends DailyUIReqVO {
|
||||
* 현물평가액
|
||||
*/
|
||||
private Long estimatedValue;
|
||||
|
||||
private Boolean ocrErrorResult;
|
||||
}
|
||||
|
||||
@@ -21,27 +21,27 @@ public class CreateDailyExpenseValidator implements Validator {
|
||||
public void validate(Object target, Errors errors) {
|
||||
CreateDailyExpenseReqVO vo = (CreateDailyExpenseReqVO) target;
|
||||
|
||||
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"수량을 입력해 주세요.");
|
||||
} else if(vo.getQuantity() != null && vo.getQuantity() <= 0){
|
||||
errors.rejectValue(
|
||||
"quantity", CommonConstants.VALID_CODE_NOTZERO,
|
||||
"입력값은 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,
|
||||
// "수량을 입력해 주세요.");
|
||||
// } else if(vo.getQuantity() != null && vo.getQuantity() <= 0){
|
||||
// errors.rejectValue(
|
||||
// "quantity", CommonConstants.VALID_CODE_NOTZERO,
|
||||
// "입력값은 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(
|
||||
|
||||
@@ -132,7 +132,9 @@ public class DailyExpenseService implements DailyExpensePortIn {
|
||||
formVO.getUnitCode(),
|
||||
formVO.getUnitSelf(),
|
||||
formVO.getPrice(),
|
||||
formVO.getEstimatedValue()));
|
||||
formVO.getEstimatedValue(),
|
||||
formVO.getOcrErrorResult()
|
||||
));
|
||||
|
||||
portOut.create(findCmd, command);
|
||||
formVO.setId(command.getId());
|
||||
|
||||
@@ -31,4 +31,6 @@ public class CreateDailyExpenseCmd extends FrontAuditCommand {
|
||||
private String unitSelf;
|
||||
private Long price;
|
||||
private Long estimatedValue;
|
||||
private Boolean ocrErrorResult = false;
|
||||
|
||||
}
|
||||
|
||||
@@ -60,4 +60,6 @@ public class CreateDailyIncomeReqVO extends DailyUIReqVO {
|
||||
* 현물평가액
|
||||
*/
|
||||
private Long estimatedValue;
|
||||
|
||||
private Boolean ocrErrorResult;
|
||||
}
|
||||
|
||||
@@ -21,27 +21,27 @@ public class CreateDailyIncomeValidator implements Validator {
|
||||
public void validate(Object target, Errors errors) {
|
||||
CreateDailyIncomeReqVO vo = (CreateDailyIncomeReqVO) target;
|
||||
|
||||
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"수량을 입력해 주세요.");
|
||||
} else if(vo.getQuantity() != null && vo.getQuantity() <= 0){
|
||||
errors.rejectValue(
|
||||
"quantity", CommonConstants.VALID_CODE_NOTZERO,
|
||||
"입력값은 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,
|
||||
// "수량을 입력해 주세요.");
|
||||
// } else if(vo.getQuantity() != null && vo.getQuantity() <= 0){
|
||||
// errors.rejectValue(
|
||||
// "quantity", CommonConstants.VALID_CODE_NOTZERO,
|
||||
// "입력값은 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(
|
||||
|
||||
@@ -136,7 +136,9 @@ public class DailyIncomeService implements DailyIncomePortIn {
|
||||
formVO.getUnitCode(),
|
||||
formVO.getUnitSelf(),
|
||||
formVO.getPrice(),
|
||||
formVO.getEstimatedValue()));
|
||||
formVO.getEstimatedValue(),
|
||||
formVO.getOcrErrorResult()
|
||||
));
|
||||
|
||||
|
||||
portOut.create(findCmd, command);
|
||||
|
||||
@@ -32,4 +32,5 @@ public class CreateDailyIncomeCmd extends FrontAuditCommand {
|
||||
private String unitSelf;
|
||||
private Long price;
|
||||
private Long estimatedValue;
|
||||
private Boolean ocrErrorResult = false;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
package app.module.front.usecase.daily.receipt.adapters.web;
|
||||
|
||||
import app.module.core.config.application.enums.DailyStatus;
|
||||
import app.module.core.config.application.enums.DailyTargetStatus;
|
||||
import app.module.core.config.application.enums.FileUploadType;
|
||||
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 app.module.core.usecase.file.createFile.ports.CreateFilePortIn;
|
||||
import app.module.core.usecase.file.createFile.ports.application.domain.CreateFile;
|
||||
import app.module.core.usecase.file.createFile.ports.application.domain.CreateFileCmd;
|
||||
import app.module.core.usecase.file.saveToStorage.ports.SaveToStoragePortIn;
|
||||
import app.module.core.usecase.file.saveToStorage.ports.application.domain.SaveToStorage;
|
||||
import app.module.front.config.application.util.AuthUtil;
|
||||
import app.module.front.usecase.daily.expense.adapters.web.model.CreateDailyExpenseReqVO;
|
||||
import app.module.front.usecase.daily.expense.ports.DailyExpensePortIn;
|
||||
import app.module.front.usecase.daily.income.adapters.web.model.CreateDailyIncomeReqVO;
|
||||
@@ -33,8 +40,13 @@ import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@@ -50,6 +62,12 @@ public class DailyReceiptController {
|
||||
private final DailyReceiptPortIn dailyReceiptPortIn;
|
||||
private final DailyExpensePortIn dailyExpensePortIn;
|
||||
|
||||
private final DailyDayGroupPortIn dailyDayGroupPortIn;
|
||||
|
||||
|
||||
private final DailyUtil dailyUtil;
|
||||
|
||||
private boolean errorItem = false;
|
||||
/**
|
||||
* 일계부 영수증 등록
|
||||
*/
|
||||
@@ -110,7 +128,7 @@ public class DailyReceiptController {
|
||||
*
|
||||
* @param searchMonth 검색 월(yyyyMM)
|
||||
* @param groupNo 검색 그룹
|
||||
* @param id 수입 일련번호
|
||||
* @param id 수입 일련번호(존재유무에 따라, create/update
|
||||
* @param reqVOList 영수증 데이터
|
||||
*/
|
||||
@PostMapping(path = "/{inputType}/{searchMonth}/{groupNo}/form/{id}")
|
||||
@@ -122,18 +140,56 @@ public class DailyReceiptController {
|
||||
@RequestPart(value = "reqVO") List<CreateReceiptFileReqVO> reqVOList,
|
||||
@RequestPart(value = "file") List<MultipartFile> files ) throws IOException {
|
||||
|
||||
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo);
|
||||
Map<String, Integer> addedDate = new HashMap<>();
|
||||
|
||||
this.errorItem = false;
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
|
||||
String judgeSearchMonth = searchMonth;
|
||||
String judgeGroupNo = groupNo;
|
||||
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(judgeSearchMonth, judgeGroupNo);;
|
||||
|
||||
MultipartFile file = files.get(i);
|
||||
CreateReceiptFileReqVO createReceiptFileReqVO = reqVOList.get(i);
|
||||
|
||||
LocalDate today = LocalDate.now();
|
||||
try {
|
||||
String ocrDateStr = createReceiptFileReqVO.getOcr().getDate();
|
||||
LocalDate ocrDate = LocalDate.parse(ocrDateStr, formatter);
|
||||
|
||||
LocalDate startDate = dailyRecord.getStartDate();
|
||||
LocalDate endDate = dailyRecord.getEndDate();
|
||||
|
||||
if (isBefore(today, createReceiptFileReqVO.getOcr().getDate())
|
||||
&& !(ocrDate.equals(startDate) || ocrDate.equals(endDate))
|
||||
) {
|
||||
|
||||
if (!dailyUtil.isEditable(createReceiptFileReqVO.getOcr().getDate())) {
|
||||
continue;
|
||||
}
|
||||
LocalDate date = LocalDate.parse(createReceiptFileReqVO.getOcr().getDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
judgeSearchMonth = String.format("%d%02d", date.getYear(), date.getMonthValue());
|
||||
int day = date.getDayOfMonth();
|
||||
DailyDayGroupDto dailyDayGroupDto = dailyDayGroupPortIn.detail(String.valueOf(day));
|
||||
|
||||
dailyRecord = getOtherDailyRecord(judgeSearchMonth, dailyDayGroupDto, inputType);
|
||||
judgeGroupNo = String.valueOf(dailyDayGroupDto.getGroupNo());
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info("OCR Date ERROR : date={}", createReceiptFileReqVO.getOcr().getDate());
|
||||
}
|
||||
|
||||
// storage 에 물리적 파일 저장. `LOCAL` or `S3`
|
||||
SaveToStorage saveToStorage =
|
||||
saveToStoragePortIn
|
||||
.operate(createReceiptFileReqVO.getFileUploadType(), file)
|
||||
.orElseThrow(() -> new RuntimeException("물리적 파일 저장에 실패했습니다."));
|
||||
|
||||
|
||||
// DB 에 파일정보 저장
|
||||
CreateFile createFile =
|
||||
createFilePortIn
|
||||
@@ -151,19 +207,25 @@ public class DailyReceiptController {
|
||||
|
||||
// 1. 레코드 저장
|
||||
for(ReceiptItem item : createReceiptFileReqVO.getOcr().getItems()){
|
||||
|
||||
//날짜별 카운트 추가
|
||||
addedDate.merge(formatDateRange(dailyRecord.getStartDate(),dailyRecord.getEndDate()), 1, Integer::sum);
|
||||
|
||||
if("income".equals(inputType)) {
|
||||
CreateDailyIncomeReqVO formVO = new CreateDailyIncomeReqVO();
|
||||
formVO.setSearchMonth(searchMonth);
|
||||
formVO.setGroupNo(Integer.parseInt(groupNo));
|
||||
formVO.setSearchMonth(judgeSearchMonth);
|
||||
formVO.setGroupNo(Integer.parseInt(judgeGroupNo));
|
||||
formVO.setId(Long.parseLong(id));
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
formVO.setInputType(DailyInputType.OCR);
|
||||
formVO.setCredit(false);
|
||||
formVO.setSourcePurpose(createReceiptFileReqVO.getOcr().getStoreName());
|
||||
formVO.setIncomeKind(item.getName());
|
||||
formVO.setQuantity((double) item.getQuantity());
|
||||
formVO.setPrice((long) item.getTotalPrice());
|
||||
formVO.setSourcePurpose(limitLengthOrNull(createReceiptFileReqVO.getOcr().getStoreName(),100));
|
||||
formVO.setIncomeKind(limitLengthOrNull(item.getName(),100));
|
||||
|
||||
formVO.setQuantity(toDoubleOrNull(item.getQuantity()));
|
||||
formVO.setPrice(toLongOrNull(item.getTotalPrice()));
|
||||
log.debug("formVO: {}", formVO);
|
||||
formVO.setOcrErrorResult(this.errorItem);
|
||||
dailyIncomePortIn.create(formVO);
|
||||
//has 파일에 매핑 시키기
|
||||
dailyReceiptPortIn.insertReceiptMappingFile(new CreateReceiptHasFileReqVO(FileUploadType.INCOME.getName(),formVO.getId(),createFile.getId()));
|
||||
@@ -171,18 +233,18 @@ public class DailyReceiptController {
|
||||
}else if ("expense".equals(inputType)) {
|
||||
|
||||
CreateDailyExpenseReqVO formVO = new CreateDailyExpenseReqVO();
|
||||
formVO.setSearchMonth(searchMonth);
|
||||
formVO.setGroupNo(Integer.parseInt(groupNo));
|
||||
formVO.setSearchMonth(judgeSearchMonth);
|
||||
formVO.setGroupNo(Integer.parseInt(judgeGroupNo));
|
||||
formVO.setId(Long.parseLong(id));
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
formVO.setInputType(DailyInputType.OCR);
|
||||
|
||||
formVO.setCredit(false);
|
||||
formVO.setSourcePurpose(createReceiptFileReqVO.getOcr().getStoreName());
|
||||
formVO.setExpenseKind(item.getName());
|
||||
formVO.setQuantity((double) item.getQuantity());
|
||||
formVO.setPrice((long) item.getTotalPrice());
|
||||
|
||||
formVO.setSourcePurpose(limitLengthOrNull(createReceiptFileReqVO.getOcr().getStoreName(),100));
|
||||
formVO.setExpenseKind(limitLengthOrNull(item.getName(),100));
|
||||
formVO.setQuantity(toDoubleOrNull(item.getQuantity()));
|
||||
formVO.setPrice(toLongOrNull(item.getTotalPrice()));
|
||||
formVO.setOcrErrorResult(this.errorItem);
|
||||
log.debug("formVO: {}", formVO);
|
||||
|
||||
dailyExpensePortIn.create(formVO);
|
||||
@@ -190,11 +252,23 @@ public class DailyReceiptController {
|
||||
//has 파일에 매핑 시키기
|
||||
dailyReceiptPortIn.insertReceiptMappingFile(new CreateReceiptHasFileReqVO(FileUploadType.EXPENSE.getName(),formVO.getId(),createFile.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
//DailyRecord 가 기존에 등록되어 있는경우 등록완료상태로 변경.
|
||||
if(!createReceiptFileReqVO.getOcr().getItems().isEmpty()){
|
||||
if("income".equals(inputType) && !dailyRecord.getIncomeStatus().equals(DailyTargetStatus.TARGET)) {
|
||||
dailyRecordPortIn.updateByStatus(dailyRecord.getRecordMonth(), dailyRecord.getGroupNo(), dailyRecord.getHouseholdSeq(), "INCOME", DailyTargetStatus.TARGET.name());
|
||||
}else if ("expense".equals(inputType) && !dailyRecord.getExpenseStatus().equals(DailyTargetStatus.TARGET)) {
|
||||
dailyRecordPortIn.updateByStatus(dailyRecord.getRecordMonth(), dailyRecord.getGroupNo(), dailyRecord.getHouseholdSeq(), "EXPENSE", DailyTargetStatus.TARGET.name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body("");
|
||||
Map<String, Object> body = new HashMap<>();
|
||||
body.put("list", addedDate);
|
||||
body.put("error", this.errorItem);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(body);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -222,4 +296,129 @@ public class DailyReceiptController {
|
||||
}
|
||||
return dailyRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* otherDailyRecord
|
||||
|
||||
* @return
|
||||
*/
|
||||
private DailyRecordDto getOtherDailyRecord(String searchMonth, DailyDayGroupDto dailyDayGroupDto, String inputType) {
|
||||
Long userSeq = AuthUtil.getUserSeq();
|
||||
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(searchMonth, dailyDayGroupDto.getGroupNo(), userSeq);
|
||||
|
||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||
CreateDailyRecordReqVO createDailyRecordReqVO = new CreateDailyRecordReqVO();
|
||||
createDailyRecordReqVO.setTodayNone("N");
|
||||
createDailyRecordReqVO.setAllStatus(DailyStatus.DONE);
|
||||
|
||||
if(inputType.equals("expense")) {
|
||||
createDailyRecordReqVO.setExpenseStatus(DailyTargetStatus.TARGET);
|
||||
} else {
|
||||
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(userSeq);
|
||||
|
||||
dailyRecordPortIn.create(createDailyRecordReqVO);
|
||||
|
||||
dailyRecord = dailyRecordPortIn.detail(searchMonth, dailyDayGroupDto.getGroupNo(), userSeq);
|
||||
}
|
||||
return dailyRecord;
|
||||
}
|
||||
|
||||
|
||||
public Double toDoubleOrNull(Object value) {
|
||||
if (value == null) {
|
||||
this.errorItem = true;
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
if(value.toString().trim().equals("0")){
|
||||
this.errorItem = true;
|
||||
return null;
|
||||
}
|
||||
return Double.valueOf(value.toString().trim());
|
||||
} catch (NumberFormatException e) {
|
||||
this.errorItem = true;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Long toLongOrNull(Object value) {
|
||||
if (value == null) {
|
||||
this.errorItem = true;
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
if(value.toString().trim().equals("0")){
|
||||
this.errorItem = true;
|
||||
return null;
|
||||
}
|
||||
return Long.valueOf(value.toString().trim());
|
||||
} catch (NumberFormatException e) {
|
||||
this.errorItem = true;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String limitLengthOrNull(String value, int maxLength) {
|
||||
if (value == null) {
|
||||
this.errorItem = true;
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
String trimmed = value.trim();
|
||||
if(trimmed.length() > maxLength || trimmed.isEmpty()){
|
||||
this.errorItem = true;
|
||||
return null;
|
||||
} else {
|
||||
return trimmed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
public boolean isBefore(LocalDate a, String b) {
|
||||
|
||||
if (a == null || b == null) {
|
||||
this.errorItem = true;
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
LocalDate dateB = LocalDate.parse(b, FORMATTER);
|
||||
if(dateB.isBefore(a)){
|
||||
return true;
|
||||
} else {
|
||||
this.errorItem = true;
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
this.errorItem = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String formatDateRange(LocalDate a, LocalDate b) {
|
||||
if (a == null) return "";
|
||||
|
||||
int month = a.getMonthValue();
|
||||
int dayA = a.getDayOfMonth();
|
||||
|
||||
// b가 null이거나 a와 같으면 "7월 5일"
|
||||
if (b == null || a.equals(b)) {
|
||||
return String.format("%d월 %d일", month, dayA);
|
||||
}
|
||||
|
||||
// a와 b가 다르면 "7월 5~6일"
|
||||
int dayB = b.getDayOfMonth();
|
||||
return String.format("%d월 %d~%d일", month, dayA, dayB);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,13 +45,13 @@
|
||||
daily_record_seq, input_type, category, income_mark
|
||||
, is_credit, expense_kind, source_purpose
|
||||
, quantity, unit_code, unit_self, price, estimated_value
|
||||
, is_deleted
|
||||
, is_deleted, ocr_error_result
|
||||
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||
) values (
|
||||
#{dailyRecordSeq}, #{inputType}, #{category}, #{incomeMark}
|
||||
, #{credit}, #{expenseKind}, #{sourcePurpose}
|
||||
, #{quantity}, #{unitCode}, #{unitSelf}, #{price}, #{estimatedValue}
|
||||
, false
|
||||
, false, #{ocrErrorResult}
|
||||
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||
)
|
||||
</insert>
|
||||
|
||||
@@ -45,13 +45,13 @@
|
||||
daily_record_seq, input_type, category, expense_mark
|
||||
, is_credit, crop_code, income_kind, source_purpose
|
||||
, quantity, unit_code, unit_self, price, estimated_value
|
||||
, is_deleted
|
||||
, is_deleted, ocr_error_result
|
||||
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||
) values (
|
||||
#{dailyRecordSeq}, #{inputType}, #{category}, #{expenseMark}
|
||||
, #{credit}, #{cropCode}, #{incomeKind}, #{sourcePurpose}
|
||||
, #{quantity}, #{unitCode}, #{unitSelf}, #{price}, #{estimatedValue}
|
||||
, false
|
||||
, false, #{ocrErrorResult}
|
||||
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||
)
|
||||
</insert>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
etUI.utils.ready(function () {
|
||||
console.log('document ready');
|
||||
|
||||
// etUI.initUI();
|
||||
|
||||
// [공통] 헤더 스크롤 관련 기능
|
||||
|
||||
@@ -163,7 +163,7 @@ var ajaxUtil = {
|
||||
kri.logger.error('statusCode: 403');
|
||||
},
|
||||
422:function(rstData, status) {
|
||||
console.log('422', rstData)
|
||||
// console.log('422', rstData)
|
||||
|
||||
let isResetDone = false;
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ krip.daily.todayNone = function(month, groupNo, target, checked) {
|
||||
url,
|
||||
{},
|
||||
function (rstData, status) {
|
||||
console.log('rstData', rstData)
|
||||
// console.log('rstData', rstData)
|
||||
|
||||
$('.component-btns').find('.btn-primary').attr('disabled', !checked);
|
||||
},
|
||||
@@ -241,7 +241,7 @@ krip.daily.createComment = function(month, groupNo) {
|
||||
const f = document.commentReqForm;
|
||||
|
||||
const obj = $(f).serializeObject();
|
||||
console.log(obj, month, groupNo)
|
||||
// console.log(obj, month, groupNo)
|
||||
if (f.content.value === '') {
|
||||
krip.daily.goToDone(month, groupNo);
|
||||
return;
|
||||
|
||||
@@ -251,7 +251,7 @@ uiUtil.uploadFile = (fileUploadType, input) => {
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success(res) {
|
||||
console.log(res);
|
||||
// console.log(res);
|
||||
|
||||
// 에러 메세지가 있었다면 초기화
|
||||
$(input).removeClass('is-invalid');
|
||||
|
||||
@@ -181,7 +181,7 @@
|
||||
<dl class="guide-gray-box">
|
||||
<dt>전·겸업</dt>
|
||||
<dd>
|
||||
<span>1. 임엄전업</span>
|
||||
<span>1. 임업전업</span>
|
||||
<span>2. 임업주업</span>
|
||||
<span>3. 임업부업</span>
|
||||
</dd>
|
||||
|
||||
@@ -407,7 +407,7 @@
|
||||
if (!form.price.value) errors.push({field: 'price', message: '금액을 입력해주세요.'});
|
||||
else if (form.price.value && form.price.value <= 0) errors.push({field: 'price', message: '입력값은 0보다 커야 합니다. '});
|
||||
|
||||
console.log(errors) //////////////////////////
|
||||
// console.log(errors) //////////////////////////
|
||||
kri.form.error(errors);
|
||||
if (errors.length > 0) {
|
||||
return;
|
||||
|
||||
@@ -370,7 +370,7 @@
|
||||
});
|
||||
|
||||
const errors = [];
|
||||
if (!form.transferCategoryCode.value) errors.push({field: 'transferCategoryCode', message: '지출종류를 선택해주세요.'});
|
||||
if (!form.transferCategoryCode.value) errors.push({field: 'transferCategoryCode', message: '지출 종류를 선택해 주세요.'});
|
||||
if(document.getElementById(form.transferCategoryCode.value+"_value")){
|
||||
if (form.transferCategoryCode.value && document.getElementById(form.transferCategoryCode.value+"_value")
|
||||
&& !document.getElementById(form.transferCategoryCode.value+"_value").value){
|
||||
@@ -400,7 +400,7 @@
|
||||
if (!form.price.value) errors.push({field: 'price', message: '금액을 입력해주세요.'});
|
||||
else if (form.price.value && form.price.value <= 0) errors.push({field: 'price', message: '입력값은 0보다 커야 합니다. '});
|
||||
|
||||
console.log(errors) //////////////////////////
|
||||
// console.log(errors) //////////////////////////
|
||||
kri.form.error(errors);
|
||||
if (errors.length > 0) {
|
||||
return;
|
||||
|
||||
@@ -42,17 +42,14 @@
|
||||
<dd class="date" th:if="${#strings.isEmpty(dailyLatest)}">등록된 일계부가 없습니다.</dd>
|
||||
</dl>
|
||||
|
||||
<th:block th:if="${notice != null}">
|
||||
<div class="notice-box">
|
||||
<a href="/info/notice" class="tit">공지사항</a>
|
||||
<a th:href="@{'/info/notice/' + ${notice.id}}" class="txt" th:text="${notice.title}"></a>
|
||||
</div>
|
||||
<div class="notice-box nodata"
|
||||
th:unless="${notice != null}">
|
||||
<a href="/info/notice" class="tit">공지사항</a>
|
||||
<a href="javascript:void(0)" class="txt">등록된 공지사항이 없습니다</a>
|
||||
</div>
|
||||
</th:block>
|
||||
<div class="notice-box" th:if="${notice != null}">
|
||||
<a href="/info/notice" class="tit">공지사항</a>
|
||||
<a th:href="@{'/info/notice/' + ${notice.id}}" class="txt" th:text="${notice.title}"></a>
|
||||
</div>
|
||||
<div class="notice-box nodata" th:unless="${notice != null}">
|
||||
<a href="/info/notice" class="tit">공지사항</a>
|
||||
<a href="javascript:void(0)" class="txt">등록된 공지사항이 없습니다.</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -327,13 +327,13 @@
|
||||
document.querySelector(`#${targetId}`).value = dataValue;
|
||||
|
||||
const withoutCode = targetId.replace(/Code$/, '');
|
||||
console.log(withoutCode);
|
||||
// console.log(withoutCode);
|
||||
if(dataValue == "code.record.unit.self") {
|
||||
console.log(dataValue + "close")
|
||||
// console.log(dataValue + "close")
|
||||
document.querySelector('#'+withoutCode).value="";
|
||||
document.querySelector('#'+withoutCode+'Div').style.display ='block';
|
||||
} else {
|
||||
console.log(dataValue + "close")
|
||||
// console.log(dataValue + "close")
|
||||
document.querySelector('#'+withoutCode).value="";
|
||||
document.querySelector('#'+withoutCode+'Div').style.display ='none';
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ root: /*[[|#{uri.front.info.user.path}/password|]]*/'rootUrl',
|
||||
'Accept': 'application/octet-stream'
|
||||
}
|
||||
}).then(response => {
|
||||
console.log('Response status:', response.status);
|
||||
// console.log('Response status:', response.status);
|
||||
if (!response.ok) {
|
||||
// 응답 본문 읽기
|
||||
return response.text().then(errorMessage => {
|
||||
@@ -95,7 +95,7 @@ root: /*[[|#{uri.front.info.user.path}/password|]]*/'rootUrl',
|
||||
}
|
||||
// Content-Disposition 헤더에서 파일명 추출
|
||||
const disposition = response.headers.get('Content-Disposition');
|
||||
console.log('Content-Disposition:', disposition);
|
||||
// console.log('Content-Disposition:', disposition);
|
||||
let serverFileName = fileName;
|
||||
if (disposition && disposition.includes('filename*=')) {
|
||||
const matches = disposition.match(/filename\*=UTF-8''(.+)/);
|
||||
@@ -110,7 +110,7 @@ root: /*[[|#{uri.front.info.user.path}/password|]]*/'rootUrl',
|
||||
return response.blob().then(blob => ({ blob, fileName: serverFileName }));
|
||||
})
|
||||
.then(({ blob, fileName }) => {
|
||||
console.log('Blob received, size:', blob.size);
|
||||
// console.log('Blob received, size:', blob.size);
|
||||
const link = document.createElement('a');
|
||||
link.href = window.URL.createObjectURL(blob);
|
||||
link.download = fileName;
|
||||
|
||||
@@ -334,7 +334,7 @@
|
||||
|
||||
let formControl = {
|
||||
init() {
|
||||
console.log("init")
|
||||
// console.log("init")
|
||||
setTimeout(function(){
|
||||
formControl._bindUI();
|
||||
},300);
|
||||
@@ -343,7 +343,7 @@
|
||||
ENV.initialOwnerName = document.querySelector('input[name="ownerName"]').value;
|
||||
},
|
||||
_bindUI() {
|
||||
console.log("bind")
|
||||
// console.log("bind")
|
||||
ENV.module.confirmPopup = document.querySelector(".confirmPopup").ui;
|
||||
|
||||
const $selectTel = document.querySelector('#tel1Id');
|
||||
|
||||
@@ -649,7 +649,7 @@
|
||||
// // Month setup and data loading
|
||||
_setupMonth(date) {
|
||||
this.state.currentMonth = this._getMonthKey(date)
|
||||
console.log('this.state.currentMonth', this.state.currentMonth, date)
|
||||
// console.log('this.state.currentMonth', this.state.currentMonth, date)
|
||||
|
||||
const allCells = this._getAllCells()
|
||||
const thisMonthCells = this._getThisMonthCells()
|
||||
@@ -862,11 +862,11 @@
|
||||
// data: {no: 2, start: 3, end: 4, children: Array(2)}
|
||||
// currentDate: {start: '2025.06.15', end: '2025.06.16'}
|
||||
// viewDate: instanceof Date
|
||||
console.log('changeDateCallback', data, currentDate, viewDate);
|
||||
// console.log('changeDateCallback', data, currentDate, viewDate);
|
||||
|
||||
formControl.setDetail(data, currentDate, viewDate);
|
||||
}, function(monthKey, currentDate) {
|
||||
console.log('changeMonthCallback', monthKey, currentDate);
|
||||
// console.log('changeMonthCallback', monthKey, currentDate);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
const selectboxInstance2 = new etUI.components.SelectBox();
|
||||
selectboxInstance2.core.init($select2, {
|
||||
selectItemCallback({selectValue, dataValue}){
|
||||
console.log('selectItemCallback', selectValue, dataValue)
|
||||
// console.log('selectItemCallback', selectValue, dataValue)
|
||||
$('input[name="unitCode"]').val(dataValue)
|
||||
|
||||
etUI.pages.initDirectInputToggle();
|
||||
@@ -239,7 +239,7 @@
|
||||
const f = document.reqModalForm;
|
||||
|
||||
const obj = $(f).serializeObject();
|
||||
console.log(obj)
|
||||
// console.log(obj)
|
||||
|
||||
ajaxUtil._ajaxAsync(
|
||||
ENV.httpUrl.create.replace('{id}', f.id.value ? f.id.value : '0'),
|
||||
@@ -384,7 +384,7 @@
|
||||
|
||||
ajaxUtil._showWaiting();
|
||||
|
||||
console.log("receiptDataList",receiptDataList);
|
||||
// console.log("receiptDataList",receiptDataList);
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
@@ -399,9 +399,24 @@
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success(res) {
|
||||
// console.log(res)
|
||||
|
||||
const entries = Object.entries(res.list);
|
||||
|
||||
let listStr = entries
|
||||
.map(([date, count], idx) => `${idx + 1}. ${date} : ${count}건`)
|
||||
.join('<br>');
|
||||
|
||||
let message;
|
||||
if (res.error) {
|
||||
message = `인식오류로 결측치 처리 되었으니 영수증을 확인후 등록된 값을 수정등록 부탁드립니다.<br>${listStr}`;
|
||||
} else {
|
||||
message = `첨부하신 영수증에 대하여 아래와 같이 등록되었습니다. 자세한 내용은 각 일계부에서 확인하실 수 있습니다.<br>${listStr}`;
|
||||
}
|
||||
|
||||
etUI.dialog.alert({
|
||||
title: '등록',
|
||||
message: '영수증이 성공적으로 등록되었습니다.',
|
||||
message: message,
|
||||
type: 'alert',
|
||||
callback: function () {
|
||||
// 초기화
|
||||
@@ -432,7 +447,7 @@
|
||||
500: function (res) {
|
||||
const resJson = res.responseJSON || {};
|
||||
const errorMessage = resJson.error || '서버 오류가 발생했습니다.';
|
||||
console.log(`서버 오류: ${errorMessage}`);
|
||||
// console.log(`서버 오류: ${errorMessage}`);
|
||||
etUI.dialog.alert({
|
||||
title: '등록 실패',
|
||||
message: '영수증이 등록 실패하였습니다.',
|
||||
@@ -449,7 +464,7 @@
|
||||
},
|
||||
error: function (xhr) {
|
||||
const errorMessage = xhr.responseJSON?.error || `HTTP ${xhr.status}`;
|
||||
console.log(`영수증 업로드 실패: ${errorMessage}`);
|
||||
// console.log(`영수증 업로드 실패: ${errorMessage}`);
|
||||
etUI.dialog.alert({
|
||||
title: '등록 실패',
|
||||
message: '영수증이 등록 실패하였습니다.',
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
const selectboxInstance1 = new etUI.components.SelectBox();
|
||||
selectboxInstance1.core.init($select1, {
|
||||
selectItemCallback({selectValue, dataValue}){
|
||||
console.log('selectItemCallback', selectValue, dataValue)
|
||||
// console.log('selectItemCallback', selectValue, dataValue)
|
||||
$('input[name="productCode"]').val(dataValue)
|
||||
|
||||
etUI.pages.initDirectInputToggle();
|
||||
@@ -187,7 +187,7 @@
|
||||
const selectboxInstance2 = new etUI.components.SelectBox();
|
||||
selectboxInstance2.core.init($select2, {
|
||||
selectItemCallback({selectValue, dataValue}){
|
||||
console.log('selectItemCallback', selectValue, dataValue)
|
||||
// console.log('selectItemCallback', selectValue, dataValue)
|
||||
$('input[name="unitCode"]').val(dataValue)
|
||||
|
||||
etUI.pages.initDirectInputToggle();
|
||||
@@ -207,7 +207,7 @@
|
||||
const f = document.reqModalForm;
|
||||
|
||||
const obj = $(f).serializeObject();
|
||||
console.log(obj)
|
||||
// console.log(obj)
|
||||
|
||||
ajaxUtil._ajaxAsync(
|
||||
ENV.httpUrl.create.replace('{id}', f.id.value ? f.id.value : '0'),
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
const selectboxInstance2 = new etUI.components.SelectBox();
|
||||
selectboxInstance2.core.init($select2, {
|
||||
selectItemCallback({selectValue, dataValue}){
|
||||
console.log('selectItemCallback', selectValue, dataValue)
|
||||
// console.log('selectItemCallback', selectValue, dataValue)
|
||||
$('input[name="unitCode"]').val(dataValue)
|
||||
|
||||
etUI.pages.initDirectInputToggle();
|
||||
@@ -195,7 +195,7 @@
|
||||
const f = document.reqModalForm;
|
||||
|
||||
const obj = $(f).serializeObject();
|
||||
console.log(obj)
|
||||
// console.log(obj)
|
||||
|
||||
ajaxUtil._ajaxAsync(
|
||||
ENV.httpUrl.create.replace('{id}', f.id.value ? f.id.value : '0'),
|
||||
|
||||
@@ -189,7 +189,7 @@
|
||||
const selectboxInstance1 = new etUI.components.SelectBox();
|
||||
selectboxInstance1.core.init($select1, {
|
||||
selectItemCallback({selectValue, dataValue}){
|
||||
console.log('selectItemCallback', selectValue, dataValue)
|
||||
// console.log('selectItemCallback', selectValue, dataValue)
|
||||
$('input[name="cropCode"]').val(dataValue)
|
||||
}
|
||||
});
|
||||
@@ -198,7 +198,7 @@
|
||||
const selectboxInstance2 = new etUI.components.SelectBox();
|
||||
selectboxInstance2.core.init($select2, {
|
||||
selectItemCallback({selectValue, dataValue}){
|
||||
console.log('selectItemCallback', selectValue, dataValue)
|
||||
// console.log('selectItemCallback', selectValue, dataValue)
|
||||
$('input[name="unitCode"]').val(dataValue)
|
||||
|
||||
etUI.pages.initDirectInputToggle();
|
||||
@@ -287,7 +287,7 @@
|
||||
const f = document.reqModalForm;
|
||||
|
||||
const obj = $(f).serializeObject();
|
||||
console.log(obj)
|
||||
// console.log(obj)
|
||||
|
||||
ajaxUtil._ajaxAsync(
|
||||
ENV.httpUrl.create.replace('{id}', f.id.value ? f.id.value : '0'),
|
||||
@@ -443,7 +443,7 @@
|
||||
|
||||
ajaxUtil._showWaiting();
|
||||
|
||||
console.log("receiptDataList",receiptDataList);
|
||||
// console.log("receiptDataList",receiptDataList);
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
@@ -457,10 +457,33 @@
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
/**
|
||||
* {
|
||||
* "list": {
|
||||
* "8월 8~9일": 1
|
||||
* },
|
||||
* "error": true
|
||||
* }
|
||||
*/
|
||||
success(res) {
|
||||
// console.log(res)
|
||||
|
||||
const entries = Object.entries(res.list);
|
||||
|
||||
let listStr = entries
|
||||
.map(([date, count], idx) => `${idx + 1}. ${date} : ${count}건`)
|
||||
.join('<br>');
|
||||
|
||||
let message;
|
||||
if (res.error) {
|
||||
message = `인식오류로 결측치 처리 되었으니 영수증을 확인후 등록된 값을 수정등록 부탁드립니다.<br>${listStr}`;
|
||||
} else {
|
||||
message = `첨부하신 영수증에 대하여 아래와 같이 등록되었습니다. 자세한 내용은 각 일계부에서 확인하실 수 있습니다.<br>${listStr}`;
|
||||
}
|
||||
|
||||
etUI.dialog.alert({
|
||||
title: '등록',
|
||||
message: '영수증이 성공적으로 등록되었습니다.',
|
||||
message: message,
|
||||
type: 'alert',
|
||||
callback: function () {
|
||||
// 초기화
|
||||
@@ -491,7 +514,7 @@
|
||||
500: function (res) {
|
||||
const resJson = res.responseJSON || {};
|
||||
const errorMessage = resJson.error || '서버 오류가 발생했습니다.';
|
||||
console.log(`서버 오류: ${errorMessage}`);
|
||||
// console.log(`서버 오류: ${errorMessage}`);
|
||||
etUI.dialog.alert({
|
||||
title: '등록 실패',
|
||||
message: '영수증이 등록 실패하였습니다.',
|
||||
@@ -508,7 +531,7 @@
|
||||
},
|
||||
error: function (xhr) {
|
||||
const errorMessage = xhr.responseJSON?.error || `HTTP ${xhr.status}`;
|
||||
console.log(`영수증 업로드 실패: ${errorMessage}`);
|
||||
// console.log(`영수증 업로드 실패: ${errorMessage}`);
|
||||
etUI.dialog.alert({
|
||||
title: '등록 실패',
|
||||
message: '영수증이 등록 실패하였습니다.',
|
||||
|
||||
@@ -196,7 +196,7 @@
|
||||
const f = document.reqModalForm;
|
||||
|
||||
const obj = $(f).serializeObject();
|
||||
console.log(obj)
|
||||
// console.log(obj)
|
||||
|
||||
ajaxUtil._ajaxAsync(
|
||||
ENV.httpUrl.create.replace('{id}', f.id.value ? f.id.value : '0'),
|
||||
|
||||
@@ -222,7 +222,7 @@
|
||||
const selectboxInstance1 = new etUI.components.SelectBox();
|
||||
selectboxInstance1.core.init($select1, {
|
||||
selectItemCallback({selectValue, dataValue}){
|
||||
console.log('selectItemCallback', selectValue, dataValue)
|
||||
// console.log('selectItemCallback', selectValue, dataValue)
|
||||
$('input[name="areaUnitCode"]').val(dataValue)
|
||||
etUI.pages.initDirectInputToggle();
|
||||
}
|
||||
@@ -232,7 +232,7 @@
|
||||
const selectboxInstance2 = new etUI.components.SelectBox();
|
||||
selectboxInstance2.core.init($select2, {
|
||||
selectItemCallback({selectValue, dataValue}){
|
||||
console.log('selectItemCallback', selectValue, dataValue)
|
||||
// console.log('selectItemCallback', selectValue, dataValue)
|
||||
$('input[name="harvestUnitCode"]').val(dataValue)
|
||||
etUI.pages.initDirectInputToggle();
|
||||
}
|
||||
@@ -251,7 +251,7 @@
|
||||
const f = document.reqModalForm;
|
||||
|
||||
const obj = $(f).serializeObject();
|
||||
console.log(obj)
|
||||
// console.log(obj)
|
||||
|
||||
ajaxUtil._ajaxAsync(
|
||||
ENV.httpUrl.create.replace('{id}', f.id.value ? f.id.value : '0'),
|
||||
|
||||
Reference in New Issue
Block a user