[BO] 일계부 등록 현황의 삭제 처리
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package app.module.admin.usecase.household.tab.dailyRecord.removeDaily.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.RemoveDailyPortOut;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.application.domain.RemoveDailyCmd;
|
||||
import app.module.core.config.application.enums.DailySort;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class RemoveDailyDao implements RemoveDailyPortOut {
|
||||
private final RemoveDailyMapper mapper;
|
||||
|
||||
@Override
|
||||
public void operate(RemoveDailyCmd command) {
|
||||
if (command.getCurrentStep() != null) {
|
||||
log.error("[RemoveDaily] cmd: {}", command);
|
||||
|
||||
if (DailySort.INCOME.equals(command.getCurrentStep())) {
|
||||
mapper.removeDailyIncome(command);
|
||||
} else if (DailySort.WORK.equals(command.getCurrentStep())) {
|
||||
mapper.removeDailyWork(command);
|
||||
} else if (DailySort.EXPENSE.equals(command.getCurrentStep())) {
|
||||
mapper.removeDailyExpense(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 {
|
||||
log.error("[RemoveDaily] Current step is null. cmd: {}", command);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package app.module.admin.usecase.household.tab.dailyRecord.removeDaily.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.application.domain.RemoveDailyCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface RemoveDailyMapper {
|
||||
/**
|
||||
* 특정일의 수입 전체 삭제
|
||||
* @param command 검색 조건
|
||||
*/
|
||||
void removeDailyIncome(RemoveDailyCmd command);
|
||||
|
||||
/**
|
||||
* 특정일의 임업노동 투입 전체 삭제
|
||||
* @param command 검색 조건
|
||||
*/
|
||||
void removeDailyWork(RemoveDailyCmd command);
|
||||
|
||||
/**
|
||||
* 특정일의 지출 전체 삭제
|
||||
* @param command 검색 조건
|
||||
*/
|
||||
void removeDailyExpense(RemoveDailyCmd command);
|
||||
|
||||
/**
|
||||
* 동력 사용시간 전체 삭제
|
||||
* @param command 검색 조건
|
||||
*/
|
||||
void removeDailyPower(RemoveDailyCmd command);
|
||||
|
||||
/**
|
||||
* 자가임업 생산물 중 자가소비량 전체 삭제
|
||||
* @param command 검색 조건
|
||||
*/
|
||||
void removeDailyForestry(RemoveDailyCmd command);
|
||||
|
||||
/**
|
||||
* 자가농업 생산물 중 자가소비량 전체 삭제
|
||||
* @param command 검색 조건
|
||||
*/
|
||||
void removeDailyFarming(RemoveDailyCmd command);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package app.module.admin.usecase.household.tab.dailyRecord.removeDaily.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 lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class RemoveDailyController {
|
||||
private final RemoveDailyPortIn removeDailyNonePortIn;
|
||||
|
||||
@PostMapping(path = "/api/household/daily/remove")
|
||||
ResponseEntity<?> remove(@RequestBody RemoveDailyReqVO reqVO) {
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
|
||||
if (!reqVO.getSelectedIds().isEmpty()) {
|
||||
removeDailyNonePortIn.operate(reqVO);
|
||||
}
|
||||
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package app.module.admin.usecase.household.tab.dailyRecord.removeDaily.adapters.web.modal;
|
||||
|
||||
import app.module.core.config.application.enums.DailySort;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class RemoveDailyReqVO {
|
||||
/**
|
||||
* 항목 일련번호
|
||||
*/
|
||||
private Set<Long> selectedIds;
|
||||
/**
|
||||
* 현재 단계
|
||||
*/
|
||||
private DailySort currentStep;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports;
|
||||
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.adapters.web.modal.RemoveDailyReqVO;
|
||||
|
||||
public interface RemoveDailyPortIn {
|
||||
void operate(RemoveDailyReqVO reqVO);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports;
|
||||
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.application.domain.RemoveDailyCmd;
|
||||
|
||||
public interface RemoveDailyPortOut {
|
||||
void operate(RemoveDailyCmd command);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.application;
|
||||
|
||||
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.removeDaily.ports.RemoveDailyPortOut;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.application.domain.RemoveDailyCmd;
|
||||
import app.module.core.config.application.util.AuditUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RemoveDailyService implements RemoveDailyPortIn {
|
||||
private final RemoveDailyPortOut portOut;
|
||||
|
||||
@Override
|
||||
public void operate(RemoveDailyReqVO reqVO) {
|
||||
RemoveDailyCmd command = AuditUtil.update(
|
||||
new RemoveDailyCmd(
|
||||
reqVO.getSelectedIds(),
|
||||
reqVO.getCurrentStep())
|
||||
);
|
||||
|
||||
portOut.operate(command);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.application.domain;
|
||||
|
||||
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||
import app.module.core.config.application.enums.DailySort;
|
||||
import app.module.core.config.application.enums.DailyTargetStatus;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@AllArgsConstructor
|
||||
public class RemoveDailyCmd extends AuditCommand {
|
||||
/**
|
||||
* 항목 일련번호
|
||||
*/
|
||||
private Set<Long> removeIds;
|
||||
/**
|
||||
* 현재 단계
|
||||
*/
|
||||
private DailySort currentStep;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ class UpdateDailyNoneDao implements UpdateDailyNonePortOut {
|
||||
dailyRecordPortIn.updateByStatus(command.getSearchMonth(), command.getGroupNo(), command.getHouseholdSeq(), command.getCurrentStep().name(), command.getCurrentStatus().name());
|
||||
|
||||
} else {
|
||||
log.error("[CreateDailyNone] Current step is null. cmd:{}", command);
|
||||
log.error("[UpdateDailyNone] Current step is null. cmd: {}", command);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user