upload dokumen
This commit is contained in:
@@ -38,14 +38,13 @@ public class PostCreateDrpService implements BaseService<DrpRequest, DrpResponse
|
||||
@Override
|
||||
public DrpResponse execute(DrpRequest input) {
|
||||
|
||||
validateTahunDrp(input);
|
||||
var drp = drpRepository.findByIdAndIsDeleteFalse(input.getId())
|
||||
.orElseThrow(() -> new BusinessException(Constants.ERR_CODE_10001,
|
||||
Constants.ERR_TTL_10001,
|
||||
String.format(Constants.ERR_MSG_10001, "DRP", input.getId())));
|
||||
|
||||
Drp drp = Drp.builder()
|
||||
.tahun(input.getTahun())
|
||||
.approveStatus(input.getApproveStatus())
|
||||
.isActive(input.getIsActive())
|
||||
.isDelete(false)
|
||||
.build();
|
||||
drp.setApproveStatus(input.getApproveStatus());
|
||||
drp.setIsActive(input.getIsActive());
|
||||
|
||||
var drpSaved = drpRepository.save(drp);
|
||||
|
||||
@@ -85,13 +84,4 @@ public class PostCreateDrpService implements BaseService<DrpRequest, DrpResponse
|
||||
.id(drpSaved.getId())
|
||||
.build();
|
||||
}
|
||||
|
||||
public void validateTahunDrp(DrpRequest input) {
|
||||
Optional<Drp> drpOptional = drpRepository.findByTahunAndIsDeleteFalse(input.getTahun());
|
||||
if (drpOptional.isPresent()) {
|
||||
throw new BusinessException(Constants.ERR_CODE_10010,
|
||||
Constants.ERR_TTL_10010,
|
||||
Constants.ERR_MSG_10010);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user