From b0ad2cbe00da6e3651b32d62fd1c01f30d35a021 Mon Sep 17 00:00:00 2001 From: Salman Manoe Date: Tue, 21 Jan 2025 09:34:55 +0700 Subject: [PATCH] Update service logbook remunerasi Perubahan filter dokter rekap logbook menggunakan unit kerja ksm --- .../dao/MapPegawaiJabatanToUnitKerjaDao.java | 17 ++++---- .../medifirst2000/service/BaseVoService.java | 41 ++++++------------- .../service/impl/LogbookRemunServiceImpl.java | 20 ++++----- 3 files changed, 30 insertions(+), 48 deletions(-) diff --git a/jasamedika-business/src/main/java/com/jasamedika/medifirst2000/dao/MapPegawaiJabatanToUnitKerjaDao.java b/jasamedika-business/src/main/java/com/jasamedika/medifirst2000/dao/MapPegawaiJabatanToUnitKerjaDao.java index 6f3b6497..19bbc315 100644 --- a/jasamedika-business/src/main/java/com/jasamedika/medifirst2000/dao/MapPegawaiJabatanToUnitKerjaDao.java +++ b/jasamedika-business/src/main/java/com/jasamedika/medifirst2000/dao/MapPegawaiJabatanToUnitKerjaDao.java @@ -262,11 +262,11 @@ public interface MapPegawaiJabatanToUnitKerjaDao extends JpaRepository> getMapSubunitKerjaMonitoringByKelompokJabatan(@Param("idUnitKerja") Integer idUnitKerja, - @Param("kelompokJabatanId") Integer IdKelompokJabatan); + @Param("kelompokJabatanId") Integer IdKelompokJabatan); @Query("select distinct mapp.pegawaiId from MapPegawaiJabatanToUnitKerja mapp " + "where mapp.statusEnabled is true and mapp.pegawaiId is not null and mapp.unitKerjaPegawaiId = :idUnitKerja") @@ -517,13 +517,14 @@ public interface MapPegawaiJabatanToUnitKerjaDao extends JpaRepository findPegawaiIdByUnitKerjaIdAndJabatanId(@Param("unitKerjaId") List unitKerjaId, @Param("jabatanId") List jabatanId); - @Query("select mj.pegawaiId from MapPegawaiJabatanToUnitKerja mj " + "where mj.statusEnabled is true " - + "and mj.subUnitKerjaPegawaiId in (:subUnitKerjaIdIn)") - Set findPegawaiIdBySubUnitKerjaIn(@Param("subUnitKerjaIdIn") List subUnitKerjaIdIn); - @Query(value = "select exists(select 1 from mappegawaijabatantounitkerja_m mj " + "where mj.statusenabled is true and mj.objectpegawaifk = :pegawaiId " + "and mj.objectjabatanfk in (:listJabatanId))", nativeQuery = true) boolean existsByPegawaiIdAndJabatanIdIn(@Param("pegawaiId") Integer idPegawai, @Param("listJabatanId") List idJabatanList); + + @Query("select mj.pegawaiId from MapPegawaiJabatanToUnitKerja mj " + "inner join mj.pegawai pg " + + "where mj.statusEnabled is true " + "and pg.statusEnabled is true " + + "and mj.unitKerjaPegawaiId in (:listUnitKerjaId) " + "and pg.jenisPegawaiId = 1") + Set findDokterByUnitKerja(@Param("listUnitKerjaId") List listIdUnitKerja); } diff --git a/jasamedika-business/src/main/java/com/jasamedika/medifirst2000/service/BaseVoService.java b/jasamedika-business/src/main/java/com/jasamedika/medifirst2000/service/BaseVoService.java index ef25bef0..a3da7e05 100644 --- a/jasamedika-business/src/main/java/com/jasamedika/medifirst2000/service/BaseVoService.java +++ b/jasamedika-business/src/main/java/com/jasamedika/medifirst2000/service/BaseVoService.java @@ -1,12 +1,11 @@ package com.jasamedika.medifirst2000.service; +import com.jasamedika.medifirst2000.exception.ServiceVOException; +import org.springframework.orm.jpa.JpaSystemException; + import java.util.List; import java.util.Map; -import org.springframework.orm.jpa.JpaSystemException; - -import com.jasamedika.medifirst2000.exception.ServiceVOException; - /** * View Object service * @@ -19,53 +18,39 @@ import com.jasamedika.medifirst2000.exception.ServiceVOException; * @author Roberto */ public interface BaseVoService { - + /** * Add model from VO - * - * @param vo - * @return */ - public V add(V vo) throws JpaSystemException, ServiceVOException; + V add(V vo) throws JpaSystemException, ServiceVOException; /** * Update model from vo - * - * @param vo - * @return */ - public V update(V vo) throws JpaSystemException, ServiceVOException; + V update(V vo) throws JpaSystemException, ServiceVOException; /** * Delete model by primary key - * - * @param key - * @return */ - public Boolean delete(K key) throws JpaSystemException; + Boolean delete(K key) throws JpaSystemException; /** - * Find by Id - * + * Find by ID + * * @param key * primary key - * @return */ - public V findById(K key) throws JpaSystemException; + V findById(K key) throws JpaSystemException; /** * Find all model to vo - * - * @return */ - public List findAll() throws JpaSystemException; + List findAll() throws JpaSystemException; /** * Find all model to vo by page and limit and sort and dir parameter - * - * @return */ - public Map findAllWithPageAndLimitAndSortByAndDirectionParameter( - Integer page, Integer limit, String sort, String dir); + Map findAllWithPageAndLimitAndSortByAndDirectionParameter(Integer page, Integer limit, + String sort, String dir); } diff --git a/jasamedika-business/src/main/java/com/jasamedika/medifirst2000/service/impl/LogbookRemunServiceImpl.java b/jasamedika-business/src/main/java/com/jasamedika/medifirst2000/service/impl/LogbookRemunServiceImpl.java index aa4ffa70..8df01962 100644 --- a/jasamedika-business/src/main/java/com/jasamedika/medifirst2000/service/impl/LogbookRemunServiceImpl.java +++ b/jasamedika-business/src/main/java/com/jasamedika/medifirst2000/service/impl/LogbookRemunServiceImpl.java @@ -36,7 +36,7 @@ import static com.jasamedika.medifirst2000.constants.Master.Profesi.TERAPI; */ @Service @Transactional -public class LogbookRemunServiceImpl implements LogbookRemunService { +public class LogbookRemunServiceImpl extends BaseVoServiceImpl implements LogbookRemunService { private static final Logger LOGGER = LoggerFactory.getLogger(LogbookRemunServiceImpl.class); @@ -58,9 +58,6 @@ public class LogbookRemunServiceImpl implements LogbookRemunService { @Autowired private MapPegawaiJabatanToUnitKerjaDao mapPegawaiJabatanToUnitKerjaDao; - @Autowired - private SubUnitKerjaDao subUnitKerjaDao; - @Autowired private MapJabatanProfesiDao mapJabatanProfesiDao; @@ -72,16 +69,15 @@ public class LogbookRemunServiceImpl implements LogbookRemunService { Date date = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant()); Date tglAwal = DateUtil.startMonth(date); Date tglAkhir = DateUtil.endMonth(date); - List subUnitKerjaIn = subUnitKerjaDao.findAllKelompokKerjaMedisId(); - Set idPegawaiKelompokKerja = mapPegawaiJabatanToUnitKerjaDao - .findPegawaiIdBySubUnitKerjaIn(subUnitKerjaIn); - List terapisRehabMedik = mapJabatanProfesiDao.findIdPegawaiByProfesiIn(Arrays.asList(TERAPI)); - idPegawaiKelompokKerja.addAll(terapisRehabMedik); - if (!idPegawaiKelompokKerja.isEmpty()) { + Set listIdDokter = mapPegawaiJabatanToUnitKerjaDao + .findDokterByUnitKerja(splitDataSettingDatafixed("listIdUnitKerjaKsm")); + List listTerapis = mapJabatanProfesiDao.findIdPegawaiByProfesiIn(Arrays.asList(TERAPI)); + listIdDokter.addAll(listTerapis); + if (!listIdDokter.isEmpty()) { // Delete untuk pembaharuan data - deleteByPeriod(idPegawaiKelompokKerja, tglAwal, tglAkhir); + deleteByPeriod(listIdDokter, tglAwal, tglAkhir); } - saveRekapDetailLogbookDokter(idPegawaiKelompokKerja, date); + saveRekapDetailLogbookDokter(listIdDokter, date); } public void deleteByPeriod(Set idPegawai, Date tglAwal, Date tglAkhir) {