Salman Manoe 0801da3173 Update sdm controllers
Clean code
2025-03-14 13:39:23 +07:00

1371 lines
69 KiB
Java

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<PegawaiVO> {
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<List<PegawaiVO>> getAllDokter2(HttpServletRequest request) {
try {
List<PegawaiVO> 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<List<PegawaiVO>> getAllDokter(
@RequestParam(value = "kodeRuangan", required = false) String kodeRuangan,
@RequestParam(value = "tanggal", required = false) String tanggal, HttpServletRequest request) {
try {
List<PegawaiVO> 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<Collection<PegawaiVO>> 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<String, Object> result = pegawaiService.getAllPegawai(page, take, sort, dir, id, namaLengkap);
return constructListPageResult(result);
}
@RequestMapping(value = "/get-by-satuan-kerja", method = GET)
public ResponseEntity<List<Map<String, Object>>> getAllBySatuanKerja(
@RequestParam(value = "satuankerjaId") Integer satuanKerjaId, HttpServletRequest request) {
try {
List<Map<String, Object>> 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<List<Map<String, Object>>> getAllPegawai(
@RequestParam(value = "key", required = false) String key,
@RequestParam(value = "tanggal", required = false) String tanggal, HttpServletRequest request) {
try {
List<Map<String, Object>> 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<List<Map<String, Object>>> getAllPerawat(
@RequestParam(value = "key", required = false) String key,
@RequestParam(value = "tanggal", required = false) String tanggal, HttpServletRequest request) {
try {
List<Map<String, Object>> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> editVOWithPassword(@Valid @RequestBody EditPegawaiDto vo,
HttpServletRequest request) {
try {
Authentication authentication = tokenAuthenticationService.getAuthentication(request);
String namaUser = authentication.getName();
List<LoginUser> 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<String> 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<PegawaiVO> 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<List<PegawaiVO>> getAllVOWithQueryString(@PathVariable("nik") String nik,
HttpServletRequest request) {
try {
List<PegawaiVO> 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<Map<String, Object>> getKelasByRuangan(@PathVariable("id") Integer id,
HttpServletRequest request) {
try {
Map<String, Object> 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<RekamDataPegawaiVO> 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<Map<String, Object>> getPegawaiDetailById(@PathVariable("id") Integer id) {
try {
Map<String, Object> rekamDataPegawaiVO = pegawaiService.findPegawaiDetailById(id);
List<Map<String, Object>> 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<Map<String, Object>> getPesertaDidikDetailById(@PathVariable("id") Integer id) {
try {
Map<String, Object> 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<Map<String, Object>> getPegawaiByRuangan(@PathVariable("unitKerja") Integer unitKerja,
@PathVariable("tahun") Integer tahun, @PathVariable("bulan") Integer bulan, HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> getPegawaiByJadwal(@PathVariable("tahun") Integer tahun,
@PathVariable("bulan") Integer bulan, @PathVariable("pegawai") Integer pegawai,
HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> getUraianPegawai(@PathVariable("jabatan") Integer jabatan,
@PathVariable("pegawai") Integer pegawai, HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> getDataPegawai(HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> getPegawaiByPelaksana(@RequestParam(value = "id") Integer id,
HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> findAllPegwawaiNoPaging(HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> findAllPegawaiPns(HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> findAllPegawaiMitra(HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> findAllPegawaiPesertaDidik(HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> findAllPegawaiDokterTamu(HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> 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<Integer> listStatusPegawaiId,
@RequestParam(value = "periode", required = false) String periode, HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> 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<String, Object> 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<Map<String, Object>> 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<String, Object> 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<Map<String, Object>> 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<String, Object> 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<Map<String, Object>> findAllPegwawaiLainLain(
@RequestParam(value = "key", required = false) String key, HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> findAllPegawaiNoPagingSearch(
@RequestParam(value = "namaPegawai") String namaPegawai,
@RequestParam(value = "idJabatan") String idJabatan,
@RequestParam(value = "idSubUnitKerja") Integer idSubUnitKerja, HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> getDataKeluargaPegawai(@RequestParam(value = "id") Integer id,
HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> findpegawaiByIdCustom(@PathVariable("idPegawai") Integer idPegawai,
HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> getPegawaiByRuangan(@PathVariable("ruangan") Integer ruangan,
HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> addAllVOPegawai(@RequestBody List<PegawaiJadwalKerjaVO> vos,
HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> unggahSimpanJadwalPegawai(
@RequestBody List<PegawaiJadwalKerjaExcelVO> vos, HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> getPegawaiByRuanganrev2(
@PathVariable("subUnitKerja") Integer subUnitKerja, @PathVariable("tahun") Integer tahun,
@PathVariable("bulan") Integer bulan, HttpServletRequest request) {
try {
Map<String, Object> 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<List<PegawaiVO>> getAllPegawaiAktifByRuangan(
@RequestParam(value = "idRuangan", required = false) Integer idRuangan, HttpServletRequest request) {
try {
List<PegawaiVO> 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<Map<String, Object>> getPegawaiByIdForMobile(@PathVariable("idPegawai") Integer idPegawai,
HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> getPegawaiWithNamaUserById(@PathVariable("id") Integer id,
HttpServletRequest request) {
try {
Map<String, Object> 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<String> 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<Map<String, Object>> getPegawaiByIdForMobile(@PathVariable("idjabatan") Integer idjabatan,
@PathVariable("tglLahir") String tglLahir, HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> deletePegawai(@PathVariable("id") Integer id,
HttpServletRequest request) {
try {
Map<String, Object> 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<List<Map<String, Object>>> getPegawaiPensiun(
@PathVariable("startPeriode") String startPeriode, @PathVariable("endPeriode") String endPeriode,
HttpServletRequest request) {
try {
List<Map<String, Object>> 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<List<Map<String, Object>>> getPegawaiPensiun(
@PathVariable("idSubUnitKerja") Integer idSubUnitKerja, HttpServletRequest request) {
try {
List<Map<String, Object>> 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<List<Map<String, Object>>> getPegawaiKewenanganKlinisExpired(HttpServletRequest request) {
try {
List<Map<String, Object>> 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<List<Map<String, Object>>> getPegawaiStrExpired(HttpServletRequest request) {
try {
List<Map<String, Object>> 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<List<Map<String, Object>>> getPegawaiSipExpired(HttpServletRequest request) {
try {
List<Map<String, Object>> 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<List<Map<String, Object>>> getCountPegawaiByUnitKerja(HttpServletRequest request) {
try {
List<Map<String, Object>> 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<List<Map<String, Object>>> getCountPegawaiByKelompokJabatan(HttpServletRequest request) {
try {
List<Map<String, Object>> 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<List<Map<String, Object>>> getCountPegawaiByStatusPegawai(HttpServletRequest request) {
try {
List<Map<String, Object>> 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<List<Map<String, Object>>> getCountPegawaiByJK(HttpServletRequest request) {
try {
List<Map<String, Object>> 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<Map<String, Object>> findPegawaiMeninggalPindahPensiunNoPaging(
@RequestParam(value = "key", required = false) String key, HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> findPegawaiMeninggalPindahPensiunNonSdm(
@RequestParam(value = "key", required = false) String key, HttpServletRequest request) {
try {
Map<String, Object> 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<Map<String, Object>> findPegawaiOutSourcingNoPaging(
@RequestParam(value = "key", required = false) String key, HttpServletRequest request) {
try {
Map<String, Object> 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<List<Map<String, Object>>> findAllPegawaiCustom(
@RequestParam(value = "key", required = false) String key, HttpServletRequest request) {
try {
List<Map<String, Object>> 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<List<Map<String, Object>>> findAllPegawaiKepalaRuangan(HttpServletRequest request) {
try {
List<Map<String, Object>> 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<List<Map<String, Object>>> findAllJabatan(HttpServletRequest request) {
try {
List<Map<String, Object>> 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<Map<String, Object>> findPegawaiSDMforCred(HttpServletRequest request) {
Map<String, Object> result = new HashMap<>();
try {
List<Integer> 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<List<Map<String, Object>>> getAllJabatanByPegawai(
@RequestParam(value = "idPegawai") Integer idPegawai, HttpServletRequest request) {
try {
List<Map<String, Object>> 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<List<Map<String, Object>>> getJabatanKontrakVerifKinerja(HttpServletRequest request,
@RequestParam(value = "pegawaiId") Integer idPegawai,
@RequestParam(value = "pegawaiLoginId") Integer idPegawaiLogin) {
try {
List<Map<String, Object>> 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<List<Map<String, Object>>> getJabatanLogbookKinerja(HttpServletRequest request,
@RequestParam(value = "pegawaiId") Integer idPegawai, @RequestParam(value = "bulan") Long bulan) {
try {
List<Map<String, Object>> 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<Map<String, Object>> getListJurusanByPendidikan(
@RequestParam(value = "pendidikanId") Integer pendidikanId, HttpServletRequest request) {
try {
Map<String, Object> 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<List<Map<String, Object>>> getAllPangkatGolongan(HttpServletRequest request) {
try {
List<Map<String, Object>> 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<Map<String, Object>> 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<String, Object> 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<Map<String, Object>> resetLoginPegawaiKeluar(HttpServletRequest request) {
try {
LoginUser loginUser = loginUserService.getLoginUser();
Map<String, Object> 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<List<Map<String, Object>>> findExistingFingerId(HttpServletRequest request,
@RequestParam(value = "fingerId") String idFinger,
@RequestParam(value = "pegawaiId", required = false) Integer idPegawai) {
try {
List<Map<String, Object>> 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<List<Map<String, Object>>> getBirthdayEmployee(HttpServletRequest request) {
try {
List<Map<String, Object>> 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<String> 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<Boolean> 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);
}
}
}