add api drp list rekomendasi
This commit is contained in:
parent
d2015e6695
commit
f1f071b512
@ -5,10 +5,7 @@ import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||
import com.iconplus.smartproc.model.request.DrpApprovalRequest;
|
||||
import com.iconplus.smartproc.model.request.DrpRekomendasiRequest;
|
||||
import com.iconplus.smartproc.model.request.ListDrpApprovalRequest;
|
||||
import com.iconplus.smartproc.model.response.DrpApprovalResponse;
|
||||
import com.iconplus.smartproc.model.response.DrpRekomendasiResponse;
|
||||
import com.iconplus.smartproc.model.response.GetListDrpApprovalResponse;
|
||||
import com.iconplus.smartproc.model.response.GetListUserApprovalResponse;
|
||||
import com.iconplus.smartproc.model.response.*;
|
||||
import com.iconplus.smartproc.service.approval.*;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@ -26,13 +23,15 @@ public class ApprovalDrpController {
|
||||
private PostDrpRekomendasiService postDrpRekomendasiService;
|
||||
private PostDrpApprovalExecutionService postDrpApprovalExecutionService;
|
||||
private GetApprovalService getApprovalService;
|
||||
private GetListRekomendasiService getListRekomendasiService;
|
||||
public ApprovalDrpController(GetListUserVpService getListUserVpService,
|
||||
GetListUserDirekturKomiteService getListUserDirekturKomiteService,
|
||||
PostCreateDrpApprovalService postCreateDrpApprovalService,
|
||||
GetListApprovalDrpServie getListApprovalDrpServie,
|
||||
PostDrpRekomendasiService postDrpRekomendasiService,
|
||||
PostDrpApprovalExecutionService postDrpApprovalExecutionService,
|
||||
GetApprovalService getApprovalService) {
|
||||
GetApprovalService getApprovalService,
|
||||
GetListRekomendasiService getListRekomendasiService) {
|
||||
this.getListUserVpService = getListUserVpService;
|
||||
this.getListUserDirekturKomiteService = getListUserDirekturKomiteService;
|
||||
this.postCreateDrpApprovalService = postCreateDrpApprovalService;
|
||||
@ -40,6 +39,7 @@ public class ApprovalDrpController {
|
||||
this.postDrpRekomendasiService = postDrpRekomendasiService;
|
||||
this.postDrpApprovalExecutionService = postDrpApprovalExecutionService;
|
||||
this.getApprovalService = getApprovalService;
|
||||
this.getListRekomendasiService = getListRekomendasiService;
|
||||
}
|
||||
|
||||
@GetMapping("/vp")
|
||||
@ -87,4 +87,18 @@ public class ApprovalDrpController {
|
||||
.jenisPengadaanId(id)
|
||||
.build());
|
||||
}
|
||||
|
||||
@GetMapping("/rekomendasi/jenis-pengadaan/{id}")
|
||||
public GetListDrpRekomendasiResponse getListRekomendasi(@PathVariable(name = "id") Long id,
|
||||
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||
@RequestParam(name = "size", defaultValue = "5") Integer size) {
|
||||
|
||||
Pageable pageable = PageRequest.of((page - 1), size);
|
||||
DrpRekomendasiRequest drpRekomendasiRequest = DrpRekomendasiRequest.builder()
|
||||
.jenisPengadaanId(id)
|
||||
.pageable(pageable)
|
||||
.build();
|
||||
|
||||
return getListRekomendasiService.execute(drpRekomendasiRequest);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.iconplus.smartproc.controller;
|
||||
|
||||
import com.iconplus.smartproc.helper.model.EmptyResponse;
|
||||
import com.iconplus.smartproc.model.request.DrpDokumenRequest;
|
||||
import com.iconplus.smartproc.model.request.DrpRekomendasiRequest;
|
||||
import com.iconplus.smartproc.model.request.DrpRequest;
|
||||
import com.iconplus.smartproc.model.response.*;
|
||||
import com.iconplus.smartproc.service.drp.*;
|
||||
@ -24,6 +25,7 @@ public class DrpController {
|
||||
private final DeleteDokumenUploadService deleteDokumenUploadService;
|
||||
private final PostCreateDrpService postCreateDrpService;
|
||||
private final EditUploadDokumenDrpService editUploadDokumenDrpService;
|
||||
private final GetListDrpRekomendasiService getListDrpRekomendasiService;
|
||||
|
||||
public DrpController(GetDrpService getDrpService,
|
||||
GetListDrpService getListDrpService,
|
||||
@ -31,7 +33,8 @@ public class DrpController {
|
||||
PostCreateTahunDrpService postCreateTahunDrpService,
|
||||
DeleteDokumenUploadService deleteDokumenUploadService,
|
||||
PostCreateDrpService postCreateDrpService,
|
||||
EditUploadDokumenDrpService editUploadDokumenDrpService) {
|
||||
EditUploadDokumenDrpService editUploadDokumenDrpService,
|
||||
GetListDrpRekomendasiService getListDrpRekomendasiService) {
|
||||
this.getDrpService = getDrpService;
|
||||
this.getListDrpService = getListDrpService;
|
||||
this.postDrpUploadDokumenRKAPService = postDrpUploadDokumenRKAPService;
|
||||
@ -39,6 +42,7 @@ public class DrpController {
|
||||
this.deleteDokumenUploadService = deleteDokumenUploadService;
|
||||
this.postCreateDrpService = postCreateDrpService;
|
||||
this.editUploadDokumenDrpService = editUploadDokumenDrpService;
|
||||
this.getListDrpRekomendasiService = getListDrpRekomendasiService;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ -102,4 +106,17 @@ public class DrpController {
|
||||
.build());
|
||||
}
|
||||
|
||||
@GetMapping("/{id}/rekomendasi")
|
||||
public GetListDrpRekomendasiResponse getListDrpRekomendasiResponse(@PathVariable(name = "id") Long id,
|
||||
@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||
@RequestParam(name = "size", defaultValue = "5") Integer size) {
|
||||
Pageable pageable = PageRequest.of((page - 1), size);
|
||||
DrpRekomendasiRequest drpRekomendasiRequest = DrpRekomendasiRequest.builder()
|
||||
.drpId(id)
|
||||
.pageable(pageable)
|
||||
.build();
|
||||
|
||||
return getListDrpRekomendasiService.execute(drpRekomendasiRequest);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
package com.iconplus.smartproc.controller;
|
||||
|
||||
import com.iconplus.smartproc.model.request.PrintDrpRequest;
|
||||
import com.iconplus.smartproc.model.request.RolesRequest;
|
||||
import com.iconplus.smartproc.model.response.GetListPrintDrpResponse;
|
||||
import com.iconplus.smartproc.service.print.GetListPrintDrpService;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@CrossOrigin(origins = "${fe.server}", allowCredentials = "true")
|
||||
@RestController
|
||||
@RequestMapping("/api/drp/cetak")
|
||||
public class PrintController {
|
||||
|
||||
private final GetListPrintDrpService getListPrintDrpService;
|
||||
|
||||
public PrintController(GetListPrintDrpService getListPrintDrpService) {
|
||||
this.getListPrintDrpService = getListPrintDrpService;
|
||||
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public GetListPrintDrpResponse getListPrintDrpResponse(@RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||
@RequestParam(name = "size", defaultValue = "5") Integer size) {
|
||||
|
||||
Pageable pageable = PageRequest.of((page - 1), size);
|
||||
PrintDrpRequest printDrpRequest = PrintDrpRequest.builder()
|
||||
.pageable(pageable)
|
||||
.build();
|
||||
|
||||
return getListPrintDrpService.execute(printDrpRequest);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -26,6 +26,12 @@ public interface DrpApprovalView {
|
||||
Date getDirekturApproveDate();
|
||||
void setDirekturApproveDate(Date direkturApproveDate);
|
||||
|
||||
Boolean getIsPrint();
|
||||
void setIsPrint(Boolean isPrint);
|
||||
|
||||
Date getPrintDate();
|
||||
void setPrintDate(Date printDate);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -20,4 +20,13 @@ public interface DrpRekomendasiView {
|
||||
String getRekomendasi();
|
||||
void setRekomendasiDate(String rekomendasi);
|
||||
|
||||
String getNomor();
|
||||
void setNomor(String nomor);
|
||||
|
||||
String getNamaPengadaan();
|
||||
void setNamaPengadaan(String namaPengadaan);
|
||||
|
||||
String getLevel();
|
||||
void setLevel(String level);
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.iconplus.smartproc.model.projection;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
public interface DrpView {
|
||||
@ -16,6 +17,12 @@ public interface DrpView {
|
||||
Timestamp getApproveDate();
|
||||
void setApproveDate(Timestamp approveDate);
|
||||
|
||||
Boolean getIsPrint();
|
||||
void setIsPrint(Boolean isPrint);
|
||||
|
||||
Date getPrintDate();
|
||||
void setPrintDate(Date printDate);
|
||||
|
||||
Boolean getIsActive();
|
||||
void setIsActive(Boolean isActive);
|
||||
|
||||
|
@ -5,6 +5,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.sql.Date;
|
||||
|
||||
@ -21,6 +22,7 @@ public class DrpRekomendasiRequest extends BaseRequest {
|
||||
private Long jenisPengadaanId;
|
||||
private String rekomendasi;
|
||||
private Date rekomendasiDate;
|
||||
private transient Pageable pageable;
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,17 @@
|
||||
package com.iconplus.smartproc.model.request;
|
||||
|
||||
import com.iconplus.smartproc.helper.base.BaseRequest;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PrintDrpRequest extends BaseRequest {
|
||||
|
||||
private transient Pageable pageable;
|
||||
}
|
@ -23,5 +23,5 @@ public class DrpRekomendasiResponse extends BaseResponse {
|
||||
private Date approveDate;
|
||||
private Date rekomendasiDate;
|
||||
private String rekomendasi;
|
||||
private String jabatan;
|
||||
private String jabatan;;
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package com.iconplus.smartproc.model.response;
|
||||
|
||||
import com.iconplus.smartproc.helper.base.BaseResponse;
|
||||
import com.iconplus.smartproc.helper.model.Pagination;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GetListPrintDrpResponse extends BaseResponse {
|
||||
|
||||
private List<PrintDrpResponse> data;
|
||||
private Pagination pagination;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.iconplus.smartproc.model.response;
|
||||
|
||||
import com.iconplus.smartproc.helper.base.BaseResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.sql.Date;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PrintDrpResponse extends BaseResponse {
|
||||
|
||||
private Long id;
|
||||
private Integer tahun;
|
||||
private String status;
|
||||
private Date printDate;
|
||||
}
|
@ -2,6 +2,8 @@ package com.iconplus.smartproc.repository;
|
||||
|
||||
import com.iconplus.smartproc.model.entity.DrpRekomendasi;
|
||||
import com.iconplus.smartproc.model.projection.DrpRekomendasiView;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@ -23,4 +25,34 @@ public interface DrpRekomendasiRepository extends JpaRepository<DrpRekomendasi,
|
||||
"WHERE dr.isDelete = false " +
|
||||
"AND dr.jenisPengadaanId = :jenisPengadaanId")
|
||||
List<DrpRekomendasiView> getListDrpRekomendasi(Long jenisPengadaanId);
|
||||
|
||||
@Query(value = "SELECT dr.id as id, " +
|
||||
"da.isApprove as isApprove, " +
|
||||
"j.jabatan as jabatan, " +
|
||||
"dr.rekomendasi as rekomendasi, " +
|
||||
"dr.rekomendasiDate as rekomendasiDate " +
|
||||
"FROM DrpRekomendasi dr " +
|
||||
"JOIN DrpApproval da ON da.id = dr.drpApprovalId " +
|
||||
"JOIN Users u ON u.id = dr.userId " +
|
||||
"JOIN Jabatan j ON j.id = u.jabatanId " +
|
||||
"WHERE dr.isDelete = false " +
|
||||
"AND dr.jenisPengadaanId = :jenisPengadaanId")
|
||||
Page<DrpRekomendasiView> getListDrpRekomendasi(Long jenisPengadaanId, Pageable pageable);
|
||||
|
||||
@Query(value = "SELECT dr.id as id, " +
|
||||
"dp.nomor as nomor, " +
|
||||
"dp.namaPengadaan as namaPengadaan, " +
|
||||
"da.isApprove as isApprove, " +
|
||||
"da.level as level, " +
|
||||
"j.jabatan as jabatan, " +
|
||||
"dr.rekomendasi as rekomendasi, " +
|
||||
"dr.rekomendasiDate as rekomendasiDate " +
|
||||
"FROM DrpRekomendasi dr " +
|
||||
"JOIN DrpApproval da ON da.id = dr.drpApprovalId " +
|
||||
"JOIN Users u ON u.id = dr.userId " +
|
||||
"JOIN Jabatan j ON j.id = u.jabatanId " +
|
||||
"JOIN DrpPengadaan dp ON dp.id = dr.jenisPengadaanId " +
|
||||
"WHERE dr.isDelete = false " +
|
||||
"AND dr.drpId = :drpId")
|
||||
Page<DrpRekomendasiView> getListDrpRekomendasiByDrpId(Long drpId, Pageable pageable);
|
||||
}
|
||||
|
@ -44,4 +44,15 @@ public interface DrpRepository extends JpaRepository<Drp, Long> {
|
||||
"FROM Drp d " +
|
||||
"WHERE d.isDelete = false")
|
||||
Page<DrpApprovalView> getListApprovalDrp(Pageable pageable);
|
||||
|
||||
|
||||
|
||||
@Query(value = "SELECT d.id as id, " +
|
||||
"d.tahun as tahun, " +
|
||||
"d.isPrint as isPrint, " +
|
||||
"d.printDate as printDate " +
|
||||
"FROM Drp d " +
|
||||
"WHERE d.isDelete = false")
|
||||
Page<DrpView> getListPrintDrp(Pageable pageable);
|
||||
|
||||
}
|
||||
|
@ -94,10 +94,12 @@ public class GetApprovalService implements BaseService<DrpApprovalRequest, DrpAp
|
||||
.rekomendasi(drpRekomendasiView.getRekomendasi())
|
||||
.rekomendasiDate(drpRekomendasiView.getRekomendasiDate())
|
||||
.build();
|
||||
if (BooleanUtils.isTrue(drpRekomendasiView.getIsApprove())) {
|
||||
drpRekomendasiResponse.setStatus("Setuju");
|
||||
} else {
|
||||
drpRekomendasiResponse.setStatus("Tolak");
|
||||
if (drpRekomendasiView.getIsApprove() != null) {
|
||||
if (BooleanUtils.isTrue(drpRekomendasiView.getIsApprove())) {
|
||||
drpRekomendasiResponse.setStatus("Setuju");
|
||||
} else {
|
||||
drpRekomendasiResponse.setStatus("Tolak");
|
||||
}
|
||||
}
|
||||
|
||||
drpRekomendasiResponseList.add(drpRekomendasiResponse);
|
||||
|
@ -1,12 +1,18 @@
|
||||
package com.iconplus.smartproc.service.approval;
|
||||
|
||||
import com.iconplus.smartproc.helper.model.Pagination;
|
||||
import com.iconplus.smartproc.helper.service.BaseService;
|
||||
import com.iconplus.smartproc.model.projection.DrpRekomendasiView;
|
||||
import com.iconplus.smartproc.model.request.DrpRekomendasiRequest;
|
||||
import com.iconplus.smartproc.model.response.DrpRekomendasiResponse;
|
||||
import com.iconplus.smartproc.model.response.GetListDrpRekomendasiResponse;
|
||||
import com.iconplus.smartproc.repository.DrpRekomendasiRepository;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class GetListRekomendasiService implements BaseService<DrpRekomendasiRequest, GetListDrpRekomendasiResponse> {
|
||||
@ -19,6 +25,37 @@ public class GetListRekomendasiService implements BaseService<DrpRekomendasiRequ
|
||||
|
||||
@Override
|
||||
public GetListDrpRekomendasiResponse execute(DrpRekomendasiRequest input) {
|
||||
return null;
|
||||
|
||||
List<DrpRekomendasiResponse> drpRekomendasiResponseList = new ArrayList<>();
|
||||
var listDrpRekomendasi = drpRekomendasiRepository.getListDrpRekomendasi(input.getJenisPengadaanId(), input.getPageable());
|
||||
for (DrpRekomendasiView drpRekomendasiView : listDrpRekomendasi) {
|
||||
DrpRekomendasiResponse drpRekomendasiResponse = DrpRekomendasiResponse.builder()
|
||||
.id(drpRekomendasiView.getId())
|
||||
.jabatan(drpRekomendasiView.getJabatan())
|
||||
.rekomendasi(drpRekomendasiView.getRekomendasi())
|
||||
.rekomendasiDate(drpRekomendasiView.getRekomendasiDate())
|
||||
.build();
|
||||
if (drpRekomendasiView.getIsApprove() != null) {
|
||||
if (BooleanUtils.isTrue(drpRekomendasiView.getIsApprove())) {
|
||||
drpRekomendasiResponse.setStatus("Setuju");
|
||||
} else {
|
||||
drpRekomendasiResponse.setStatus("Tolak");
|
||||
}
|
||||
}
|
||||
|
||||
drpRekomendasiResponseList.add(drpRekomendasiResponse);
|
||||
}
|
||||
|
||||
return GetListDrpRekomendasiResponse.builder()
|
||||
.data(drpRekomendasiResponseList)
|
||||
.pagination(Pagination.builder()
|
||||
.pageSize(input.getPageable().getPageSize())
|
||||
.currentPage(input.getPageable().getPageNumber())
|
||||
.totalPages(listDrpRekomendasi.getTotalPages())
|
||||
.totalRecords(listDrpRekomendasi.getTotalElements())
|
||||
.isFirstPage(listDrpRekomendasi.isFirst())
|
||||
.isLastPage(listDrpRekomendasi.isLast())
|
||||
.build())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,75 @@
|
||||
package com.iconplus.smartproc.service.drp;
|
||||
|
||||
import com.iconplus.smartproc.helper.model.Pagination;
|
||||
import com.iconplus.smartproc.helper.service.BaseService;
|
||||
import com.iconplus.smartproc.model.projection.DrpRekomendasiView;
|
||||
import com.iconplus.smartproc.model.request.DrpRekomendasiRequest;
|
||||
import com.iconplus.smartproc.model.response.DrpRekomendasiResponse;
|
||||
import com.iconplus.smartproc.model.response.GetListDrpRekomendasiResponse;
|
||||
import com.iconplus.smartproc.repository.DrpRekomendasiRepository;
|
||||
import com.iconplus.smartproc.util.Constants;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class GetListDrpRekomendasiService implements BaseService<DrpRekomendasiRequest, GetListDrpRekomendasiResponse> {
|
||||
|
||||
private final DrpRekomendasiRepository drpRekomendasiRepository;
|
||||
|
||||
public GetListDrpRekomendasiService(DrpRekomendasiRepository drpRekomendasiRepository) {
|
||||
this.drpRekomendasiRepository = drpRekomendasiRepository;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GetListDrpRekomendasiResponse execute(DrpRekomendasiRequest input) {
|
||||
|
||||
List<DrpRekomendasiResponse> drpRekomendasiResponseList = new ArrayList<>();
|
||||
var listDrpRekomendasi = drpRekomendasiRepository.getListDrpRekomendasiByDrpId(input.getDrpId(), input.getPageable());
|
||||
for (DrpRekomendasiView drpRekomendasiView : listDrpRekomendasi) {
|
||||
DrpRekomendasiResponse drpRekomendasiResponse = DrpRekomendasiResponse.builder()
|
||||
.id(drpRekomendasiView.getId())
|
||||
.nomorRkp(drpRekomendasiView.getNomor())
|
||||
.namaPengadaan(drpRekomendasiView.getNamaPengadaan())
|
||||
.jabatan(drpRekomendasiView.getJabatan())
|
||||
.rekomendasi(drpRekomendasiView.getRekomendasi())
|
||||
.rekomendasiDate(drpRekomendasiView.getRekomendasiDate())
|
||||
.build();
|
||||
|
||||
if (drpRekomendasiView.getIsApprove() != null) {
|
||||
if (BooleanUtils.isTrue(drpRekomendasiView.getIsApprove())) {
|
||||
drpRekomendasiResponse.setStatus("Setuju");
|
||||
} else {
|
||||
drpRekomendasiResponse.setStatus("Tolak");
|
||||
}
|
||||
|
||||
if (StringUtils.equalsIgnoreCase("VP", drpRekomendasiView.getLevel())) {
|
||||
drpRekomendasiResponse.setApproval(Constants.STATUS_APPROVAL_VP);
|
||||
} else if (StringUtils.equalsIgnoreCase("KOMITE", drpRekomendasiView.getLevel())) {
|
||||
drpRekomendasiResponse.setApproval(Constants.STATUS_REKOMENDASI_KOMITE);
|
||||
} else {
|
||||
drpRekomendasiResponse.setApproval(Constants.STATUS_APPROVAL_DIRUT);
|
||||
}
|
||||
}
|
||||
|
||||
drpRekomendasiResponseList.add(drpRekomendasiResponse);
|
||||
}
|
||||
|
||||
return GetListDrpRekomendasiResponse.builder()
|
||||
.data(drpRekomendasiResponseList)
|
||||
.pagination(Pagination.builder()
|
||||
.pageSize(input.getPageable().getPageSize())
|
||||
.currentPage(input.getPageable().getPageNumber())
|
||||
.totalPages(listDrpRekomendasi.getTotalPages())
|
||||
.totalRecords(listDrpRekomendasi.getTotalElements())
|
||||
.isFirstPage(listDrpRekomendasi.isFirst())
|
||||
.isLastPage(listDrpRekomendasi.isLast())
|
||||
.build())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.iconplus.smartproc.service.print;
|
||||
|
||||
import com.iconplus.smartproc.helper.model.Pagination;
|
||||
import com.iconplus.smartproc.helper.service.BaseService;
|
||||
import com.iconplus.smartproc.model.projection.DrpView;
|
||||
import com.iconplus.smartproc.model.request.PrintDrpRequest;
|
||||
import com.iconplus.smartproc.model.response.GetListPrintDrpResponse;
|
||||
import com.iconplus.smartproc.model.response.PrintDrpResponse;
|
||||
import com.iconplus.smartproc.repository.DrpRepository;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class GetListPrintDrpService implements BaseService<PrintDrpRequest, GetListPrintDrpResponse> {
|
||||
|
||||
private DrpRepository drpRepository;
|
||||
|
||||
public GetListPrintDrpService(DrpRepository drpRepository) {
|
||||
this.drpRepository = drpRepository;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GetListPrintDrpResponse execute(PrintDrpRequest input) {
|
||||
|
||||
List<PrintDrpResponse> printDrpResponseList = new ArrayList<>();
|
||||
|
||||
var drpViews = drpRepository.getListPrintDrp(input.getPageable());
|
||||
for (DrpView drpView : drpViews) {
|
||||
PrintDrpResponse printDrpResponse = PrintDrpResponse.builder()
|
||||
.id(drpView.getId())
|
||||
.printDate(drpView.getPrintDate())
|
||||
.build();
|
||||
if (BooleanUtils.isTrue(drpView.getIsPrint())) {
|
||||
printDrpResponse.setStatus("Tercetak");
|
||||
} else {
|
||||
printDrpResponse.setStatus("Belum Bisa Dicetak");
|
||||
}
|
||||
printDrpResponseList.add(printDrpResponse);
|
||||
}
|
||||
|
||||
return GetListPrintDrpResponse.builder()
|
||||
.data(printDrpResponseList)
|
||||
.pagination(Pagination.builder()
|
||||
.pageSize(input.getPageable().getPageSize())
|
||||
.currentPage(input.getPageable().getPageNumber())
|
||||
.totalPages(drpViews.getTotalPages())
|
||||
.totalRecords(drpViews.getTotalElements())
|
||||
.isFirstPage(drpViews.isFirst())
|
||||
.isLastPage(drpViews.isLast())
|
||||
.build())
|
||||
.build();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user