package com.jasamedika.medifirst2000.controller; import com.jasamedika.medifirst2000.constants.MessageResource; import com.jasamedika.medifirst2000.controller.base.LocaleController; import com.jasamedika.medifirst2000.dao.MapJabatanToUraianTugasDao; import com.jasamedika.medifirst2000.dao.MapUraianTugasToRincianKegiatanDao; import com.jasamedika.medifirst2000.dto.EditPegawaiDto; import com.jasamedika.medifirst2000.dto.PegawaiDto; import com.jasamedika.medifirst2000.entities.LoginUser; import com.jasamedika.medifirst2000.exception.ServiceVOException; import com.jasamedika.medifirst2000.security.model.AppPermission; import com.jasamedika.medifirst2000.security.service.TokenAuthenticationService; import com.jasamedika.medifirst2000.service.*; import com.jasamedika.medifirst2000.util.CommonUtil; import com.jasamedika.medifirst2000.util.JsonUtil; import com.jasamedika.medifirst2000.util.PasswordUtil; import com.jasamedika.medifirst2000.vo.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.orm.jpa.JpaSystemException; import org.springframework.security.core.Authentication; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE; import static com.jasamedika.medifirst2000.constants.Master.TIDAK_ADA_PERUBAHAN_DATA; import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.*; import static com.jasamedika.medifirst2000.security.model.AppPermission.SPECIALS; import static com.jasamedika.medifirst2000.util.DateUtil.toDate; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse; import static org.springframework.http.HttpStatus.*; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.web.bind.annotation.RequestMethod.GET; import static org.springframework.web.bind.annotation.RequestMethod.POST; /** * Controller class for Pasien Business * * @author Roberto */ @RestController @RequestMapping("/pegawai") public class PegawaiController extends LocaleController { private static final Logger LOGGER = LoggerFactory.getLogger(PegawaiController.class); @Autowired private LoginUserService loginUserService; @Autowired private TokenAuthenticationService tokenAuthenticationService; @Autowired private RiwayatPekerjaanService riwayatPekerjaanService; @Autowired private MapJabatanToUraianTugasDao mapUraianToJabatanDao; @Autowired private MapUraianTugasToRincianKegiatanDao mapUraianTugasToRincianKegiatanDao; @Autowired private PegawaiService pegawaiService; @Autowired private KeluargaPegawaiService keluargaPegawaiService; @Autowired private RiwayatPendidikanService riwayatPendidikanService; @Autowired private RiwayatPelatihanService riwayatPelatihanService; @Autowired private RiwayatJabatanService riwayatJabatanService; @Autowired private PegawaiJadwalKerjaService pegawaiJadwalKerjaServices; @Autowired private MapPegawaiJabatanToUnitKerjaService mapPegawaiJabatanToUnitKerjaService; @Autowired private LogbookKinerjaService logbookKinerjaService; @RequestMapping(value = "/get-all-dokter2", method = GET) public ResponseEntity> getAllDokter2(HttpServletRequest request) { try { List result = pegawaiService.getAllDokter(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getAllDokter", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getAllDokter", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-all-dokter", method = GET) public ResponseEntity> getAllDokter( @RequestParam(value = "kodeRuangan", required = false) String kodeRuangan, @RequestParam(value = "tanggal", required = false) String tanggal, HttpServletRequest request) { try { List result = pegawaiService.getAllDokterByRuanganAndTanggal(kodeRuangan, toDate(tanggal)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getAllDokterByRuanganAndTanggal", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getAllDokterByRuanganAndTanggal", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-all-pegawai", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity> getAllPegawai( @RequestParam(value = "page", required = false, defaultValue = "0") Integer page, @RequestParam(value = "take", required = false, defaultValue = "20") Integer take, @RequestParam(value = "sort", required = false, defaultValue = "id") String sort, @RequestParam(value = "dir", required = false, defaultValue = "asc") String dir, @RequestParam(value = "id", required = false) Integer id, @RequestParam(value = "namaLengkap", required = false) String namaLengkap) { Map result = pegawaiService.getAllPegawai(page, take, sort, dir, id, namaLengkap); return constructListPageResult(result); } @RequestMapping(value = "/get-by-satuan-kerja", method = GET) public ResponseEntity>> getAllBySatuanKerja( @RequestParam(value = "satuankerjaId") Integer satuanKerjaId, HttpServletRequest request) { try { List> result = pegawaiService.getAllBySatuanKerja(satuanKerjaId); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getAllBySatuanKerja", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getAllBySatuanKerja", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-all-pegawai", method = GET) public ResponseEntity>> getAllPegawai( @RequestParam(value = "key", required = false) String key, @RequestParam(value = "tanggal", required = false) String tanggal, HttpServletRequest request) { try { List> result = pegawaiService.getAll(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when pegawaiService.getAll", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when pegawaiService.getAll", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-all-perawat", method = GET) public ResponseEntity>> getAllPerawat( @RequestParam(value = "key", required = false) String key, @RequestParam(value = "tanggal", required = false) String tanggal, HttpServletRequest request) { try { List> result = pegawaiService .getAllByJenisPegawai(GetSettingDataFixed("KdJenisPegawaiParamedis"), key); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getAllByJenisPegawai", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getAllByJenisPegawai", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/save-riwayat-pekerjaan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE) public ResponseEntity saveRiwayatPekerjaan(@Valid @RequestBody RiwayatPekerjaanVO vo, HttpServletRequest request) { try { RiwayatPekerjaanVO result = riwayatPekerjaanService.add(vo); if (null != result) mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse("Status Sukses", CREATED, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when riwayatPekerjaanService.add", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when riwayatPekerjaanService.add", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/save-riwayat-pelatihan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE) public ResponseEntity saveRiwayatPelatihan(@Valid @RequestBody RiwayatPelatihanVO vo, HttpServletRequest request) { try { RiwayatPelatihanVO result = riwayatPelatihanService.add(vo); if (null != result) mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse("Status Sukses", CREATED, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when riwayatPelatihanService.add", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when riwayatPelatihanService.add", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/save-riwayat-pendidikan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE) public ResponseEntity saveRiwayatPendidikan(@Valid @RequestBody RiwayatPendidikanVO vo, HttpServletRequest request) { try { RiwayatPendidikanVO result = riwayatPendidikanService.add(vo); if (null != result && result.getKeterangan().equals(TIDAK_ADA_PERUBAHAN_DATA)) { mapHeaderMessage.put(LABEL_SUCCESS_OK, getMessage(MessageResource.LABEL_SUCCESS_OK, request)); return getJsonResponse(TIDAK_ADA_PERUBAHAN_DATA, NOT_MODIFIED, mapHeaderMessage); } else { mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse("Status Sukses", CREATED, mapHeaderMessage); } } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when riwayatPendidikanService.add", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when riwayatPendidikanService.add", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/save-riwayat-jabatan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE) public ResponseEntity saveRiwayatJabatan(@Valid @RequestBody RiwayatJabatanVO vo, HttpServletRequest request) { try { RiwayatJabatanVO result = riwayatJabatanService.add(vo); if (null != result && result.getKeterangan().equals(TIDAK_ADA_PERUBAHAN_DATA)) { mapHeaderMessage.put(LABEL_SUCCESS_OK, getMessage(MessageResource.LABEL_SUCCESS_OK, request)); return getJsonResponse(TIDAK_ADA_PERUBAHAN_DATA, NOT_MODIFIED, mapHeaderMessage); } else { mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse("Status Sukses", CREATED, mapHeaderMessage); } } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when riwayatJabatanService.add", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when riwayatJabatanService.add", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/save-pegawai", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE) public ResponseEntity addVO(@Valid @RequestBody PegawaiVO vo) { try { PegawaiVO result = pegawaiService.add(vo); if (null != result) return getJsonResponse("", CREATED); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when pegawaiService.add", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when pegawaiService.add", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } return getJsonHttpStatus(NOT_ACCEPTABLE); } @RequestMapping(value = "/update-pegawai", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE) @AppPermission(SPECIALS) public ResponseEntity editVOWithPassword(@Valid @RequestBody EditPegawaiDto vo, HttpServletRequest request) { try { Authentication authentication = tokenAuthenticationService.getAuthentication(request); String namaUser = authentication.getName(); List loginUser = loginUserService.findByNamaUser(namaUser); if (!loginUser.isEmpty()) { LoginUser user = loginUser.get(0); PasswordUtil passwordUtil = new PasswordUtil(); boolean isValidPassword = passwordUtil.isPasswordEqual(vo.getPassword(), user.getKataSandi()); if (isValidPassword) { PegawaiVO result = vo.getPegawaiVO(); return editVO(result); } else { LOGGER.error("Got exception when update Pegawai, password invalid"); addHeaderMessage(ERROR_MESSAGE, "Invalid Password"); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } } else { LOGGER.error("Got exception when update Pegawai"); addHeaderMessage(ERROR_MESSAGE, "User is unauthorized"); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } } catch (Exception e) { LOGGER.error("Got exception {} when getAuthentication", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } } public ResponseEntity editVO(@Valid @RequestBody PegawaiVO vo) { try { PegawaiVO result = pegawaiService.update(vo); if (null != result) { mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS)); return getJsonResponse("", OK, mapHeaderMessage); } } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when pegawaiService.update", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when pegawaiService.update", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } return getJsonHttpStatus(NOT_ACCEPTABLE); } @RequestMapping(value = "/{id}", method = GET) public ResponseEntity getVO(@PathVariable("id") Integer id) { PegawaiVO pegawaiVO = pegawaiService.findById(id); return getJsonResponse(pegawaiVO, OK); } @RequestMapping(value = "/get-pegawai-by-nik/{nik}", method = GET) public ResponseEntity> getAllVOWithQueryString(@PathVariable("nik") String nik, HttpServletRequest request) { try { List result = pegawaiService.findByNik(nik); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findByNik", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findByNik", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-pegawai-by-id/{id}/", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity> getKelasByRuangan(@PathVariable("id") Integer id, HttpServletRequest request) { try { Map result = pegawaiService.findPegawaiById(id); boolean dataFound = (boolean) result.get("dataFound"); if (dataFound) { mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); } else { mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request)); } return getJsonResponse(result, OK); } catch (Exception e) { return getJsonHttpStatus(INTERNAL_SERVER_ERROR); } } @RequestMapping(value = "/get-pegawai-by-customs/{id}", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity getPegawaiById(@PathVariable("id") Integer id) { RekamDataPegawaiVO rekamDataPegawaiVO = pegawaiService.findRekamDataPegawaiById(id); return getJsonResponse(rekamDataPegawaiVO, OK); } @RequestMapping(value = "/get-pegawai-detail-by-customs/{id}", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity> getPegawaiDetailById(@PathVariable("id") Integer id) { try { Map rekamDataPegawaiVO = pegawaiService.findPegawaiDetailById(id); List> mappingJabatan = mapPegawaiJabatanToUnitKerjaService.findAllDetailByPegawai(id); rekamDataPegawaiVO.put("mappingJabatan", mappingJabatan); return getJsonResponse(rekamDataPegawaiVO, OK); } catch (Exception e) { return getJsonHttpStatus(INTERNAL_SERVER_ERROR); } } @RequestMapping(value = "/get-peserta-didik-detail-by-customs/{id}", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity> getPesertaDidikDetailById(@PathVariable("id") Integer id) { try { Map rekamDataPegawaiVO = pegawaiService.findPesertaDidikDetailById(id); return getJsonResponse(rekamDataPegawaiVO, OK); } catch (Exception e) { return getJsonHttpStatus(INTERNAL_SERVER_ERROR); } } @RequestMapping(value = "/get-pegawai-by-ruangan/{unitKerja}/{tahun}/{bulan}", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity> getPegawaiByRuangan(@PathVariable("unitKerja") Integer unitKerja, @PathVariable("tahun") Integer tahun, @PathVariable("bulan") Integer bulan, HttpServletRequest request) { try { Map result = pegawaiService.findPegawaiByRuangan(unitKerja, tahun, bulan); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK); } catch (Exception e) { return getJsonHttpStatus(INTERNAL_SERVER_ERROR); } } @RequestMapping(value = "/get-pegawai-by-jadwal/{tahun}/{bulan}/{pegawai}", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity> getPegawaiByJadwal(@PathVariable("tahun") Integer tahun, @PathVariable("bulan") Integer bulan, @PathVariable("pegawai") Integer pegawai, HttpServletRequest request) { try { Map result = pegawaiService.findPegawaiByRuangan(0, tahun, bulan, pegawai); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK); } catch (Exception e) { return getJsonHttpStatus(INTERNAL_SERVER_ERROR); } } @RequestMapping(value = "/get-uraian/{jabatan}/{pegawai}", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity> getUraianPegawai(@PathVariable("jabatan") Integer jabatan, @PathVariable("pegawai") Integer pegawai, HttpServletRequest request) { try { Map result = new HashMap<>(); result.put("items", JsonUtil.ToMaps(mapUraianTugasToRincianKegiatanDao .findByMapJabatanToUraianTugasId(mapUraianToJabatanDao.findByPegawaiId(pegawai).get(0).getId()))); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK); } catch (Exception e) { return getJsonHttpStatus(INTERNAL_SERVER_ERROR); } } @RequestMapping(value = "/get-pegawai/", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity> getDataPegawai(HttpServletRequest request) { try { Map result = pegawaiService.dataAllPegawai(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK); } catch (Exception e) { return getJsonHttpStatus(INTERNAL_SERVER_ERROR); } } @RequestMapping(value = "/get-pegawai-by-pelaksana", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity> getPegawaiByPelaksana(@RequestParam(value = "id") Integer id, HttpServletRequest request) { try { Map result = pegawaiService.getPegawaiByPelaksana(id); if (null != result) { mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } else { return getJsonResponse(null, NOT_FOUND, mapHeaderMessage); } } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getPegawaiByPelaksana", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getPegawaiByPelaksana", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-all-pegawai-no-paging/", method = GET) public ResponseEntity> findAllPegwawaiNoPaging(HttpServletRequest request) { try { Map result = pegawaiService.findAllPegawaiNoPaging(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findAllPegawaiNoPaging", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findAllPegawaiNoPaging", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-all-pegawai-pns/", method = GET) public ResponseEntity> findAllPegawaiPns(HttpServletRequest request) { try { Map result = pegawaiService.findAllPegawaiPNS(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findAllPegawaiPNS", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findAllPegawaiPNS", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-all-pegawai-mitra/", method = GET) public ResponseEntity> findAllPegawaiMitra(HttpServletRequest request) { try { Map result = pegawaiService.findAllPegawaiMitra(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findAllPegawaiMitra", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findAllPegawaiMitra", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-all-pegawai-peserta-didik/", method = GET) public ResponseEntity> findAllPegawaiPesertaDidik(HttpServletRequest request) { try { Map result = pegawaiService.findAllPegawaiPesertaDidik(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findAllPegawaiPesertaDidik", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findAllPegawaiPesertaDidik", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-all-dokter-tamu/", method = GET) public ResponseEntity> findAllPegawaiDokterTamu(HttpServletRequest request) { try { Map result = pegawaiService.findAllPegawaiDokterTamu(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findAllPegawaiDokterTamu", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findAllPegawaiDokterTamu", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/search-pegawai", method = GET) public ResponseEntity> searchPegawaiCustom( @RequestParam(value = "nama", required = false) String nama, @RequestParam(value = "idUnitKerja", required = false) Integer idUnitKerja, @RequestParam(value = "idKedudukan", required = false) Integer idKedudukan, @RequestParam(value = "listStatusPegawaiId", required = false) List listStatusPegawaiId, @RequestParam(value = "periode", required = false) String periode, HttpServletRequest request) { try { Map result = pegawaiService.searchPegawaiCustom(nama, idUnitKerja, idKedudukan, listStatusPegawaiId, periode); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when searchPegawaiCustom", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when searchPegawaiCustom", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/search-pegawai-mitra", method = GET) public ResponseEntity> searchMitraCustom( @RequestParam(value = "nama", required = false) String nama, @RequestParam(value = "idUnitKerja", required = false) Integer idUnitKerja, @RequestParam(value = "idKedudukan", required = false) Integer idKedudukan, @RequestParam(value = "periode", required = false) String periode, HttpServletRequest request) { try { Map result = pegawaiService.searchMitraCustom(nama, idUnitKerja, idKedudukan, periode); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when searchMitraCustom", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when searchMitraCustom", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/search-dokter-tamu", method = GET) public ResponseEntity> searchPegawaiDokterTamu( @RequestParam(value = "nama", required = false) String nama, @RequestParam(value = "idUnitKerja", required = false) Integer idUnitKerja, @RequestParam(value = "idKedudukan", required = false) Integer idKedudukan, @RequestParam(value = "periode", required = false) String periode, HttpServletRequest request) { try { Map result = pegawaiService.searchDokterTamuCustom(nama, idUnitKerja, idKedudukan, periode); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when searchDokterTamuCustom", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when searchDokterTamuCustom", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/search-peserta-didik", method = GET) public ResponseEntity> searchPesertaDidikCustom( @RequestParam(value = "nama", required = false) String nama, @RequestParam(value = "idUnitKerja", required = false) Integer idUnitKerja, @RequestParam(value = "idKedudukan", required = false) Integer idKedudukan, @RequestParam(value = "periode", required = false) String periode, HttpServletRequest request) { try { Map result = pegawaiService.searchPesertaDidikCustom(nama, idUnitKerja, idKedudukan, periode); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when searchPesertaDidikCustom", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when searchPesertaDidikCustom", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-all-pegawai-lain-lain/", method = GET) public ResponseEntity> findAllPegwawaiLainLain( @RequestParam(value = "key", required = false) String key, HttpServletRequest request) { try { Map result = pegawaiService.findAllPegawaiLainLain(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findAllPegawaiLainLain", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findAllPegawaiLainLain", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-all-pegawai-no-paging-search", method = GET) public ResponseEntity> findAllPegawaiNoPagingSearch( @RequestParam(value = "namaPegawai") String namaPegawai, @RequestParam(value = "idJabatan") String idJabatan, @RequestParam(value = "idSubUnitKerja") Integer idSubUnitKerja, HttpServletRequest request) { try { Map result = pegawaiService.findAllPegawaiNoPagingSearch(namaPegawai, idJabatan, idSubUnitKerja); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findAllPegawaiNoPagingSearch", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findAllPegawaiNoPagingSearch", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-keluarga-pegawai", method = GET) public ResponseEntity> getDataKeluargaPegawai(@RequestParam(value = "id") Integer id, HttpServletRequest request) { try { Map result = keluargaPegawaiService.findAllDataKeluargaPegawai(id); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findAllDataKeluargaPegawai", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findAllDataKeluargaPegawai", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/find-pegawai-by-id-custom/{idPegawai}", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity> findpegawaiByIdCustom(@PathVariable("idPegawai") Integer idPegawai, HttpServletRequest request) { try { Map result = pegawaiService.findPegawaiByIdCustom(idPegawai); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK); } catch (Exception e) { return getJsonHttpStatus(INTERNAL_SERVER_ERROR); } } @RequestMapping(value = "/get-pegawai-by-ruangan/{ruangan}", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity> getPegawaiByRuangan(@PathVariable("ruangan") Integer ruangan, HttpServletRequest request) { try { Map result = pegawaiService.findPegawaiByRuangan(ruangan); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK); } catch (Exception e) { return getJsonHttpStatus(INTERNAL_SERVER_ERROR); } } @RequestMapping(value = "/save-all-jadwal-pegawai-rev2/", method = POST) public ResponseEntity> addAllVOPegawai(@RequestBody List vos, HttpServletRequest request) { try { Map result = pegawaiJadwalKerjaServices.saveListJadwalPegawai(vos, false, false); if (null != result) mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, CREATED, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when saveListJadwalPegawai", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when saveListJadwalPegawai", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/unggah-simpan-jadwal-pegawai/", method = POST) public ResponseEntity> unggahSimpanJadwalPegawai( @RequestBody List vos, HttpServletRequest request) { try { Map result = pegawaiJadwalKerjaServices.saveListJadwalPegawaiExcel(vos); if (null != result) mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, CREATED, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when saveListJadwalPegawaiExcel", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when saveListJadwalPegawaiExcel", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-pegawai-by-ruangan-rev2/{subUnitKerja}/{tahun}/{bulan}", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity> getPegawaiByRuanganrev2( @PathVariable("subUnitKerja") Integer subUnitKerja, @PathVariable("tahun") Integer tahun, @PathVariable("bulan") Integer bulan, HttpServletRequest request) { try { Map result = pegawaiService.findPegawaiByRuanganRev2(subUnitKerja, tahun, bulan); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK); } catch (Exception e) { return getJsonHttpStatus(INTERNAL_SERVER_ERROR); } } @RequestMapping(value = "/get-all-pegawai-aktif-by-ruangan/", method = GET) public ResponseEntity> getAllPegawaiAktifByRuangan( @RequestParam(value = "idRuangan", required = false) Integer idRuangan, HttpServletRequest request) { try { List result = pegawaiService.findAllPegawaiAktifByRuangan(idRuangan); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findAllPegawaiAktifByRuangan", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findAllPegawaiAktifByRuangan", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-pegawai-by-id-mobile/{idPegawai}", method = GET) public ResponseEntity> getPegawaiByIdForMobile(@PathVariable("idPegawai") Integer idPegawai, HttpServletRequest request) { try { Map result = pegawaiService.getPegawaiByIdMobile(idPegawai); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getPegawaiByIdMobile", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getPegawaiByIdMobile", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-pegawai-with-username-by-id/{id}", method = GET) public ResponseEntity> getPegawaiWithNamaUserById(@PathVariable("id") Integer id, HttpServletRequest request) { try { Map result = pegawaiService.getPegawaiWithNamaUserById(id); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getPegawaiWithNamaUserById", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getPegawaiWithNamaUserById", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/save-registrasi-pegawai-mobile", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE) public ResponseEntity SaveRegistrasiPegawaiMobile(@RequestBody RegistrasiPegawaiMobileVO vo, HttpServletRequest request) { try { String result = pegawaiService.SaveRegistrasiPegawaiMobile(vo); if (null != result) mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, CREATED, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when SaveRegistrasiPegawaiMobile", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when SaveRegistrasiPegawaiMobile", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-tgl-pensiun/{tglLahir}/{idjabatan}", method = GET) public ResponseEntity> getPegawaiByIdForMobile(@PathVariable("idjabatan") Integer idjabatan, @PathVariable("tglLahir") String tglLahir, HttpServletRequest request) { try { Map tglpensiun = pegawaiService.getTglpensiun(tglLahir, idjabatan); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(tglpensiun, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getTglpensiun", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getTglpensiun", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/non-aktif-pegawai-by-id/{id}/", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity> deletePegawai(@PathVariable("id") Integer id, HttpServletRequest request) { try { Map result = pegawaiService.nonAktifPegawai(id); if (CommonUtil.isNotNullOrEmpty(result)) { mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); } else { mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request)); } return getJsonResponse(result, OK); } catch (Exception e) { return getJsonHttpStatus(INTERNAL_SERVER_ERROR); } } @RequestMapping(value = "/get-pegawai-pensiun/{startPeriode}/{endPeriode}", method = GET) public ResponseEntity>> getPegawaiPensiun( @PathVariable("startPeriode") String startPeriode, @PathVariable("endPeriode") String endPeriode, HttpServletRequest request) { try { List> result = pegawaiService.getPegawaiYgAkanPensiun(startPeriode, endPeriode); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getPegawaiYgAkanPensiun", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getPegawaiYgAkanPensiun", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-pegawai-by-sub-Unit-kerja/{idSubUnitKerja}", method = GET) public ResponseEntity>> getPegawaiPensiun( @PathVariable("idSubUnitKerja") Integer idSubUnitKerja, HttpServletRequest request) { try { List> result = pegawaiService.getpegawaiByUnitkerja(idSubUnitKerja); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getpegawaiByUnitkerja", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getpegawaiByUnitkerja", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-pegawai-kewenangan-klinis-expired", method = GET) public ResponseEntity>> getPegawaiKewenanganKlinisExpired(HttpServletRequest request) { try { List> result = pegawaiService.getpegawaiPenugasanKlinisExpired(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getpegawaiPenugasanKlinisExpired", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getpegawaiPenugasanKlinisExpired", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-pegawai-str-expired", method = GET) public ResponseEntity>> getPegawaiStrExpired(HttpServletRequest request) { try { List> result = pegawaiService.getpegawaiStrExpired(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getpegawaiStrExpired", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getpegawaiStrExpired", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-pegawai-sip-expired", method = GET) public ResponseEntity>> getPegawaiSipExpired(HttpServletRequest request) { try { List> result = pegawaiService.getpegawaiSipExpired(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getpegawaiSipExpired", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getpegawaiSipExpired", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-count-pegawai-by-unit-kerja", method = GET) public ResponseEntity>> getCountPegawaiByUnitKerja(HttpServletRequest request) { try { List> result = pegawaiService.getpegawaiByUnitKerja(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getpegawaiByUnitKerja", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getpegawaiByUnitKerja", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-count-pegawai-by-kelompok-jabatan", method = GET) public ResponseEntity>> getCountPegawaiByKelompokJabatan(HttpServletRequest request) { try { List> result = pegawaiService.getpegawaiByKelompokJabatan(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getpegawaiByKelompokJabatan", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getpegawaiByKelompokJabatan", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-count-pegawai-by-status-pegawai", method = GET) public ResponseEntity>> getCountPegawaiByStatusPegawai(HttpServletRequest request) { try { List> result = pegawaiService.getpegawaiByStatusPegawai(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getpegawaiByStatusPegawai", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getpegawaiByStatusPegawai", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-count-pegawai-by-jk", method = GET) public ResponseEntity>> getCountPegawaiByJK(HttpServletRequest request) { try { List> result = pegawaiService.getpegawaiByJenisKelamin(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getpegawaiByJenisKelamin", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getpegawaiByJenisKelamin", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-pegawai-meninggal-pindah-pensiun-no-paging/", method = GET) public ResponseEntity> findPegawaiMeninggalPindahPensiunNoPaging( @RequestParam(value = "key", required = false) String key, HttpServletRequest request) { try { Map result = pegawaiService.findPegawaiMeninggalPindahPensiunNoPaging(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findPegawaiMeninggalPindahPensiunNoPaging", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findPegawaiMeninggalPindahPensiunNoPaging", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-pegawai-meninggal-pindah-pensiun-nonsdm/", method = GET) public ResponseEntity> findPegawaiMeninggalPindahPensiunNonSdm( @RequestParam(value = "key", required = false) String key, HttpServletRequest request) { try { Map result = pegawaiService.findPegawaiMeninggalPindahPensiunNonSdm(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findPegawaiMeninggalPindahPensiunNonSdm", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findPegawaiMeninggalPindahPensiunNonSdm", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-pegawai-outsourcing/", method = GET) public ResponseEntity> findPegawaiOutSourcingNoPaging( @RequestParam(value = "key", required = false) String key, HttpServletRequest request) { try { Map result = pegawaiService.findPegawaiOutSourcingNoPaging(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findPegawaiOutSourcingNoPaging", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findPegawaiOutSourcingNoPaging", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-all-pegawai-custom/", method = GET) public ResponseEntity>> findAllPegawaiCustom( @RequestParam(value = "key", required = false) String key, HttpServletRequest request) { try { List> result = pegawaiService.getAllPegawaiCustom(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getAllPegawaiCustom", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getAllPegawaiCustom", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-all-pegawai-kepala-ruangan", method = GET) public ResponseEntity>> findAllPegawaiKepalaRuangan(HttpServletRequest request) { try { List> result = pegawaiService.getAllKepalaRuangan(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when getAllKepalaRuangan", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when getAllKepalaRuangan", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-all-jabatan", method = GET) public ResponseEntity>> findAllJabatan(HttpServletRequest request) { try { List> result = pegawaiService.findAllJabatan(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findAllJabatan", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findAllJabatan", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-pegawai-sdm-for-cred", method = GET) public ResponseEntity> findPegawaiSDMforCred(HttpServletRequest request) { Map result = new HashMap<>(); try { List data = pegawaiService.findPegawaiSDMforCred(); result.put("data", data); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findPegawaiSDMforCred", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findPegawaiSDMforCred", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-all-jabatan-by-pegawai", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity>> getAllJabatanByPegawai( @RequestParam(value = "idPegawai") Integer idPegawai, HttpServletRequest request) { try { List> result = pegawaiService.findJabatanByPegawai(idPegawai); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK); } catch (Exception e) { return getJsonHttpStatus(INTERNAL_SERVER_ERROR); } } @RequestMapping(value = "/jabatan-kontrak-verif-kinerja", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity>> getJabatanKontrakVerifKinerja(HttpServletRequest request, @RequestParam(value = "pegawaiId") Integer idPegawai, @RequestParam(value = "pegawaiLoginId") Integer idPegawaiLogin) { try { List> result = logbookKinerjaService.findJabatanKontrakVerifKinerja(idPegawai, idPegawaiLogin); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK); } catch (Exception e) { return getJsonHttpStatus(INTERNAL_SERVER_ERROR); } } @RequestMapping(value = "/jabatan-logbook-kinerja", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity>> getJabatanLogbookKinerja(HttpServletRequest request, @RequestParam(value = "pegawaiId") Integer idPegawai, @RequestParam(value = "bulan") Long bulan) { try { List> result = logbookKinerjaService.findJabatanByLogbookPegawai(idPegawai, bulan); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK); } catch (Exception e) { return getJsonHttpStatus(INTERNAL_SERVER_ERROR); } } @RequestMapping(value = "/get-list-jurusan-by-pendidikan", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity> getListJurusanByPendidikan( @RequestParam(value = "pendidikanId") Integer pendidikanId, HttpServletRequest request) { try { Map result = pegawaiService.findListJurusanByPendidikan(pendidikanId); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findListJurusanByPendidikan", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findListJurusanByPendidikan", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-all-pangkat-golongan", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity>> getAllPangkatGolongan(HttpServletRequest request) { try { List> result = pegawaiService.findAllPangkatGolongan(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK); } catch (Exception e) { return getJsonHttpStatus(INTERNAL_SERVER_ERROR); } } @RequestMapping(value = "/get-list-pegawai-pendapatan", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity> getListPegawaiPendapatan(HttpServletRequest request, @RequestParam(value = "idDepartemen", required = false) Integer idDepartemen, @RequestParam(value = "idRuangan", required = false) Integer idRuangan, @RequestParam(value = "idUnitKerja", required = false) Integer idUnitKerja, @RequestParam(value = "month") String month) { Map result = new HashMap<>(); try { if (CommonUtil.isNotNullOrEmpty(idDepartemen) && CommonUtil.isNullOrEmpty(idRuangan)) { result = pegawaiService.findListPegawaiPendapatanDepartemen(idDepartemen, month); } else if (CommonUtil.isNotNullOrEmpty(idDepartemen) && CommonUtil.isNotNullOrEmpty(idRuangan)) { result = pegawaiService.findListPegawaiPendapatanRuangan(idDepartemen, idRuangan, month); } else if (CommonUtil.isNotNullOrEmpty(idUnitKerja)) { result = pegawaiService.findListPegawaiPendapatanUnitKerja(idUnitKerja, month); } mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findListPegawaiPendapatan departemen/ruangan/unitkerja", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findListPegawaiPendapatan departemen/ruangan/unitkerja", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/reset-login-pegawai-keluar", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity> resetLoginPegawaiKeluar(HttpServletRequest request) { try { LoginUser loginUser = loginUserService.getLoginUser(); Map result = pegawaiService.resetLoginPegawaiKeluar(loginUser.getPegawai().getId()); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when resetLoginPegawaiKeluar", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when resetLoginPegawaiKeluar", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/check-existing-fingerid", method = GET) public ResponseEntity>> findExistingFingerId(HttpServletRequest request, @RequestParam(value = "fingerId") String idFinger, @RequestParam(value = "pegawaiId", required = false) Integer idPegawai) { try { List> result = pegawaiService.findExistingFingerId(idFinger, idPegawai); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findExistingFingerId", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findExistingFingerId", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-birthday", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity>> getBirthdayEmployee(HttpServletRequest request) { try { List> result = pegawaiService.findBirthdayEmployees(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findBirthdayEmployees", e.getMessage()); mapHeaderMessage.put(LABEL_SUCCESS, e.getMessage()); return getJsonResponse(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findBirthdayEmployees", jse.getMessage()); mapHeaderMessage.put(LABEL_SUCCESS, jse.getMessage()); return getJsonResponse(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/get-avatar", method = GET, produces = APPLICATION_JSON_VALUE) public ResponseEntity getAvatar(HttpServletRequest request, @RequestParam(value = "pegawaiId", required = false) Integer idPegawai) { try { String result = pegawaiService.findAvatar(idPegawai); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when findAvatar", e.getMessage()); mapHeaderMessage.put(LABEL_SUCCESS, e.getMessage()); return getJsonResponse(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when findAvatar", jse.getMessage()); mapHeaderMessage.put(LABEL_SUCCESS, jse.getMessage()); return getJsonResponse(CONFLICT, mapHeaderMessage); } } @RequestMapping(value = "/kelengkapan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE) public ResponseEntity completePegawai(@Valid @RequestBody PegawaiDto dto) { try { pegawaiService.completeDataPegawai(dto); return getJsonResponse(true, CREATED); } catch (ServiceVOException e) { LOGGER.error("Got ServiceVOException {} when completeDataPegawai", e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); } catch (JpaSystemException jse) { LOGGER.error("Got JpaSystemException {} when completeDataPegawai", jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage); } } }