Update JabatanService

Penyesuaian service untuk akses tampilan logbook skor kinerja
This commit is contained in:
salmanoersabhk 2022-06-28 14:21:48 +07:00
parent ccd678a2ed
commit 8ba5f58d4a
5 changed files with 27 additions and 15 deletions

View File

@ -369,9 +369,14 @@ public class Master {
public static final Integer[] SAKIT_ALASAN_PENTING = { 26, 29 };
public static final Integer[] TUGAS_LUAR = { 28 };
}
public static final class SubKategoriPegawai {
public static final Integer DOKTER_FARMAKOLOGI = 1;
}
public static final class SubUnitKerja {
public static final Integer KK_ANESTESI = 223;
public static final Integer KK_FARMAKOLOGI = 205;
public static final Integer KK_PATOLOGI_ANATOMI = 197;
public static final Integer KK_PATOLOGI_KLINIK = 199;
public static final Integer KK_RADIOLOGI = 203;

View File

@ -16,9 +16,10 @@ public interface KelompokJabatanDao extends PagingAndSortingRepository<KelompokJ
@Query("select new map (model.id as id, model.namaKelompokJabatan as namaKelompokJabatan) from KelompokJabatan model where model.statusEnabled is true")
public List<Map<String, Object>> getAllByStatusEnabled();
@Query("select jb.kelompokJabatanId " + "from MapPegawaiJabatanToUnitKerja mj " + "inner join mj.jabatan jb "
+ "where mj.statusEnabled is true " + "and mj.pegawaiId = :pegawaiId "
+ "and jb.kelompokJabatanId in (3,4,5,6) " + "order by jb.kelompokJabatanId")
public List<Integer> findIdByLoginLogbookSkor(@Param("pegawaiId") Integer idPegawai);
@Query("select new Map(jb.kelompokJabatanId as kelompokJabatanId,mj.subUnitKerjaPegawaiId as subunitKerjaId) "
+ "from MapPegawaiJabatanToUnitKerja mj " + "inner join mj.jabatan jb " + "where mj.statusEnabled is true "
+ "and mj.pegawaiId = :pegawaiId " + "and jb.kelompokJabatanId in (3,4,5,6) "
+ "order by jb.kelompokJabatanId")
public List<Map<String, Object>> findIdByLoginLogbookSkor(@Param("pegawaiId") Integer idPegawai);
}

View File

@ -39,7 +39,7 @@ public interface JabatanService extends BaseVoService<Jabatan, JabatanVO, Intege
List<Map<String, Object>> findJabatanDanBatasNilai(Integer idJenisJabatan, Integer idUnitKerja)
throws JpaSystemException;
Integer findIdKelompokByLoginLogbookSkoring(Integer idPegawai) throws JpaSystemException;
Map<String, Object> findAksesLogbookSkoring(Integer idPegawai) throws JpaSystemException;
List<Map<String, Object>> findByUnitKerja(Integer idUnitKerja) throws JpaSystemException;

View File

@ -12,6 +12,8 @@ import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.stereotype.Service;
import com.jasamedika.medifirst2000.constants.Master;
import com.jasamedika.medifirst2000.constants.Master.SubKategoriPegawai;
import com.jasamedika.medifirst2000.constants.Master.SubUnitKerja;
import com.jasamedika.medifirst2000.converter.BaseConverterImpl;
import com.jasamedika.medifirst2000.dao.JabatanDao;
import com.jasamedika.medifirst2000.dao.KelompokJabatanDao;
@ -396,12 +398,17 @@ public class JabatanServiceImpl extends BaseVoServiceImpl implements JabatanServ
}
@Override
public Integer findIdKelompokByLoginLogbookSkoring(Integer idPegawai) throws JpaSystemException {
Integer result = null;
public Map<String, Object> findAksesLogbookSkoring(Integer idPegawai) throws JpaSystemException {
Map<String, Object> result = new HashMap<>();
List<Integer> data = kelompokJabatanDao.findIdByLoginLogbookSkor(idPegawai);
List<Map<String, Object>> data = kelompokJabatanDao.findIdByLoginLogbookSkor(idPegawai);
if (CommonUtil.isNotNullOrEmpty(data)) {
result = data.get(0);
result.put("kategori", data.get(0).get("kelompokJabatanId"));
if (SubUnitKerja.KK_FARMAKOLOGI.equals(data.get(0).get("subunitKerjaId"))) {
result.put("subKategori", SubKategoriPegawai.DOKTER_FARMAKOLOGI);
} else {
result.put("subKategori", 0);
}
}
return result;

View File

@ -6029,14 +6029,13 @@ public class SdmController extends LocaleController<AkunVO> {
}
}
@RequestMapping(value = "/get-kelompok-jabatan-logbook-skor", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Integer> getKelompokJabatanLogbookSkor(HttpServletRequest request,
@RequestMapping(value = "/get-akses-logbook-skor", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAksesLogbookSkor(HttpServletRequest request,
@RequestParam(value = "pegawaiId", required = true) Integer idPegawai) {
try {
Integer result = jabatanService.findIdKelompokByLoginLogbookSkoring(idPegawai);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
Map<String, Object> result = jabatanService.findAksesLogbookSkoring(idPegawai);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get kelompok jabatan logbook skor", e.getMessage());