[BO] 월초이월금
This commit is contained in:
@@ -7,6 +7,9 @@ import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDe
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyPowerRecords;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyRecordStatus;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyWorkRecords;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
import app.module.core.config.application.enums.FileStorageType;
|
||||
@@ -58,8 +61,10 @@ class GetDailyRecordStatusDetailDao implements GetDailyRecordStatusDetailPortOut
|
||||
List<GetDailyForestryRecords> forestries = mapper.getDailyForestryRecords(cmd);
|
||||
List<GetDailyFarmingRecords> farmings = mapper.getDailyFarmingRecords(cmd);
|
||||
|
||||
Long carryOver = mapper.getMonthlyCarryOver(cmd);
|
||||
|
||||
return Optional.of(
|
||||
new GetDailyRecordStatusDetail(status, incomes, works, expenses, powers, forestries,
|
||||
farmings));
|
||||
farmings, carryOver));
|
||||
}
|
||||
}
|
||||
@@ -20,4 +20,5 @@ public interface GetDailyRecordStatusDetailMapper {
|
||||
List<GetDailyPowerRecords> getDailyPowerRecords(GetDailyRecordStatusCmd cmd);
|
||||
List<GetDailyForestryRecords> getDailyForestryRecords(GetDailyRecordStatusCmd cmd);
|
||||
List<GetDailyFarmingRecords> getDailyFarmingRecords(GetDailyRecordStatusCmd cmd);
|
||||
Long getMonthlyCarryOver(GetDailyRecordStatusCmd cmd);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,12 @@ class GetDailyRecordStatusDetailController {
|
||||
GetDailyRecordStatusDetail recordView =
|
||||
portIn.operate(new GetDailyRecordStatusCmd(reqVO.getRecordSeq())).orElse(null);
|
||||
|
||||
if (recordView != null) {
|
||||
if (!LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMM")).equals(reqVO.getRecordMonth()) && recordView.getMonthlyCarryOver() == null) {
|
||||
recordView.setMonthlyCarryOver(0L);
|
||||
}
|
||||
}
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(recordView);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,4 +18,5 @@ public class GetDailyRecordStatusDetail {
|
||||
List<GetDailyPowerRecords> powers; // 동력사용시간
|
||||
List<GetDailyForestryRecords> forestries; // 자가임업
|
||||
List<GetDailyFarmingRecords> farmings; // 자가농업
|
||||
Long monthlyCarryOver; //월초이월금
|
||||
}
|
||||
|
||||
@@ -309,5 +309,15 @@
|
||||
ORDER BY dr.start_date asc, df.created_at asc
|
||||
</if>
|
||||
</select>
|
||||
<select id="getMonthlyCarryOver">
|
||||
select ds.carry_over
|
||||
from daily_summary ds
|
||||
inner join daily_record dr on dr.household_seq = ds.household_seq and dr.record_month = ds.record_month
|
||||
and dr.id = #{recordSeq}
|
||||
order by
|
||||
ds.id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -72,6 +72,13 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 월초이월금 -->
|
||||
<section class="table-group _monthlyCarryOver" style="display: none;">
|
||||
<div class="table-tit-group">
|
||||
<h3>월초이월금 <strong id="carryOver">(0원)</strong></h3>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 수입 -->
|
||||
<section class="table-group">
|
||||
<div class="table-tit-group">
|
||||
@@ -435,7 +442,7 @@
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/household/dailyRecordStatus',
|
||||
{ recordSeq: id },
|
||||
{ recordSeq: id, recordMonth: f.recordMonth.value },
|
||||
function(response) { // 성공
|
||||
console.log("일계부 등록 상세 데이터 : ", response);
|
||||
|
||||
@@ -462,6 +469,18 @@
|
||||
gridPowerTable(response.status.powerStatus, response.powers);
|
||||
gridForestryTable(response.status.forestryStatus, response.forestries);
|
||||
gridFarmingTable(response.status.farmingStatus, response.farmings);
|
||||
|
||||
if (groupNo === 1) {
|
||||
console.log(groupNo, response.monthlyCarryOver)
|
||||
if (response.monthlyCarryOver != null) {
|
||||
$('#carryOver').text(Number(response.monthlyCarryOver).toLocaleString() + '원');
|
||||
} else {
|
||||
$('#carryOver').text('계산중입니다.');
|
||||
}
|
||||
$('._monthlyCarryOver').show();
|
||||
} else {
|
||||
$('._monthlyCarryOver').hide();
|
||||
}
|
||||
},
|
||||
function (code, rstData) { // 실패
|
||||
console.log("error : ", code);
|
||||
|
||||
Reference in New Issue
Block a user