Merge branch 'dev/technical-debt/clean-code' of ssh://172.16.55.31/volume1/git/SC-be-java into dev/technical-debt/clean-code
This commit is contained in:
commit
5a1f5ab3c9
@ -1,43 +1,44 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DaftarPenerimaanService;
|
||||
import com.jasamedika.medifirst2000.vo.MappingKirimDokumenPasienVO;
|
||||
import com.jasamedika.medifirst2000.vo.StrukBuktiPenerimaanCaraBayarVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DaftarPenerimaanService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MappingKirimDokumenPasienVO;
|
||||
import com.jasamedika.medifirst2000.vo.StrukBuktiPenerimaanCaraBayarVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/daftar-penerimaan")
|
||||
public class DaftarPenerimaanController extends LocaleController<StrukBuktiPenerimaanCaraBayarVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarPenerimaanController.class);
|
||||
|
||||
@Autowired
|
||||
private DaftarPenerimaanService service;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarPenerimaanController.class);
|
||||
|
||||
@RequestMapping(value = "/penerimaan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/penerimaan", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getDaftarPenerimaan(
|
||||
@RequestParam(value = "idPegawai", required = false) Integer idPegawai,
|
||||
@RequestParam(value = "idCaraBayar", required = false) Integer idCaraBayar,
|
||||
@ -51,53 +52,46 @@ public class DaftarPenerimaanController extends LocaleController<StrukBuktiPener
|
||||
@RequestParam(value = "status", required = false) String status,
|
||||
@RequestParam(value = "noClosing", required = false) String noClosing,
|
||||
@RequestParam(value = "noVerifikasi", required = false) String noVerifikasi) {
|
||||
Map<String, Object> resultPageMap = service.getDaftarPenerimaan(idPegawai, idCaraBayar, idKelTransaksi,
|
||||
dateStartTglSbm, dateEndTglSbm, dateStartVerif, dateEndVerif, dateStartClosing, dateEndClosing, status,
|
||||
noClosing, noVerifikasi);
|
||||
|
||||
return resultPageMap;
|
||||
return service.getDaftarPenerimaan(idPegawai, idCaraBayar, idKelTransaksi, dateStartTglSbm, dateEndTglSbm,
|
||||
dateStartVerif, dateEndVerif, dateStartClosing, dateEndClosing, status, noClosing, noVerifikasi);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-verifikasi-setoran", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/save-verifikasi-setoran", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveVerifikasiSetoran(@Valid @RequestBody MappingKirimDokumenPasienVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.saveVerifikasiSetoran(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when saveVerifikasiSetoran", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveVerifikasiSetoran", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveVerifikasiSetoran", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveVerifikasiSetoran", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-closing-verifikasi-setoran", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/save-closing-verifikasi-setoran", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveClosingVerifikasiSetoran(
|
||||
@Valid @RequestBody MappingKirimDokumenPasienVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.saveClosingVerifikasiSetoran(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when saveClosingVerifikasiSetoran", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveClosingVerifikasiSetoran", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveClosingVerifikasiSetoran", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveClosingVerifikasiSetoran", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,52 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.service.DaftarPenerimaanLinenService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MappingPenerimaanLinenVO;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/daftar-penerimaan-linen")
|
||||
public class DaftarPenerimaanLinenController extends LocaleController<MappingPenerimaanLinenVO> {
|
||||
|
||||
@Autowired
|
||||
private DaftarPenerimaanLinenService daftarPenerimaanLinenService;
|
||||
|
||||
@RequestMapping(value = "/find-penerimaan-linen-by-tgl/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findDaftarPenerimaanLinenByTgl(
|
||||
@RequestParam(value = "tglAwal", required = true) String tglAwal,
|
||||
@RequestParam(value = "tglAkhir", required = true) String tglAkhir, HttpServletRequest request) {
|
||||
|
||||
Map<String, Object> result = null;
|
||||
try {
|
||||
result = daftarPenerimaanLinenService.findDaftarPenerimaanLinenByTgl(tglAwal,tglAkhir);
|
||||
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
|
||||
if (dataFound) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
|
||||
getMessage(MessageResource.LABEL_ERROR, request));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.service.DaftarPenerimaanSterilisasiAlatService;
|
||||
import com.jasamedika.medifirst2000.vo.PenerimaanSterilisasiAlatInternalVO;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/daftar-penerimaan-sterilisasi-alat")
|
||||
public class DaftarPenerimaanSterilisasiAlatController extends LocaleController<PenerimaanSterilisasiAlatInternalVO> {
|
||||
|
||||
@Autowired
|
||||
private DaftarPenerimaanSterilisasiAlatService daftarPenerimaanSterilisasiAlatService;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,17 +1,17 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.service.DaftarPengajuanAnggaranService;
|
||||
import com.jasamedika.medifirst2000.vo.HeadAnggaranVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/daftar-pengajuan-anggaran/")
|
||||
@ -20,7 +20,7 @@ public class DaftarPengajuanAnggaranController extends LocaleController<HeadAngg
|
||||
@Autowired
|
||||
private DaftarPengajuanAnggaranService daftarPengajuanAnggaranService;
|
||||
|
||||
@RequestMapping(value = "/get-pengajuan-anggaran/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/get-pengajuan-anggaran/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> findDaftarPengajuanAnggaran(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "limit", required = false, defaultValue = "100") Integer limit,
|
||||
@ -30,10 +30,8 @@ public class DaftarPengajuanAnggaranController extends LocaleController<HeadAngg
|
||||
@RequestParam(value = "dateEnd", required = false) String dateEnd,
|
||||
@RequestParam(value = "noRec", required = false) String noRec,
|
||||
@RequestParam(value = "tahun", required = false) Integer tahun) {
|
||||
Map<String, Object> resultPageMap = daftarPengajuanAnggaranService.findDaftarPengajuanAnggaran(page, limit,
|
||||
sort, dir, dateStart, dateEnd, noRec, tahun);
|
||||
|
||||
return resultPageMap;
|
||||
return daftarPengajuanAnggaranService.findDaftarPengajuanAnggaran(page, limit, sort, dir, dateStart, dateEnd,
|
||||
noRec, tahun);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,22 +1,21 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.service.DaftarPenilaianKinerjaSatpamService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.PenilaianKinerjaSatpamVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/daftar-penilaian-kinerja-satpam")
|
||||
@ -25,25 +24,12 @@ public class DaftarPenilaianKinerjaSatpamController extends LocaleController<Pen
|
||||
@Autowired
|
||||
private DaftarPenilaianKinerjaSatpamService daftarPenilaianKinerjaSatpamService;
|
||||
|
||||
@RequestMapping(value = "/find-by-nama-pegawai/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/find-by-nama-pegawai/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findPenilaianKinerjaSatpamByNamaSatpam(
|
||||
@RequestParam(value = "namaPegawai", required = true) String namaPegawai, HttpServletRequest request) {
|
||||
@RequestParam(value = "namaPegawai") String namaPegawai, HttpServletRequest request) {
|
||||
Map<String, Object> result = daftarPenilaianKinerjaSatpamService
|
||||
.findPenilaianKinerjaSatpamByNamaSatpam(namaPegawai);
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-by-no-rec/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findPenilaianKinerjaSatpamByNoRec(
|
||||
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
|
||||
Map<String, Object> result = daftarPenilaianKinerjaSatpamService.findPenilaianKinerjaSatpamByNoRec(noRec);
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-all-penilaian-kinerja-satpam/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getPenilaianKinerjaSatpam(HttpServletRequest request) {
|
||||
Map<String, Object> result = daftarPenilaianKinerjaSatpamService.getPenilaianKinerjaSatpam();
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
return getJsonResponse(result, OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,94 +1,86 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DaftarPesanAmbulanceService;
|
||||
import com.jasamedika.medifirst2000.vo.OrderAmbulanceVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DaftarPesanAmbulanceService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.OrderAmbulanceVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/daftar-pesan-ambulance")
|
||||
public class DaftarPesanAmbulanceController extends LocaleController<OrderAmbulanceVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarPesanAmbulanceController.class);
|
||||
|
||||
@Autowired
|
||||
private DaftarPesanAmbulanceService daftarPesanAmbulanceService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarPesanAmbulanceController.class);
|
||||
|
||||
@RequestMapping(value = "/find-by-periode/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/find-by-periode/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findDaftarPesanAmbulanceByPeriode(
|
||||
@RequestParam(value = "periodeAwal", required = true) String periodeAwal,
|
||||
@RequestParam(value = "periodeAkhir", required = true) String periodeAkhir, HttpServletRequest request) {
|
||||
|
||||
@RequestParam(value = "periodeAwal") String periodeAwal,
|
||||
@RequestParam(value = "periodeAkhir") String periodeAkhir, HttpServletRequest request) {
|
||||
Map<String, Object> result = daftarPesanAmbulanceService.findDaftarPesanAmbulanceByPeriode(periodeAwal,
|
||||
periodeAkhir);
|
||||
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
|
||||
boolean dataFound = (boolean) result.get("dataFound");
|
||||
if (dataFound) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
|
||||
getMessage(MessageResource.LABEL_ERROR, request));
|
||||
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
return getJsonResponse(result, OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-by-no-order/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findByNoOrder(
|
||||
@RequestParam(value = "noOrder", required = true) String noOrder, HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/find-by-no-order/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findByNoOrder(@RequestParam(value = "noOrder") String noOrder,
|
||||
HttpServletRequest request) {
|
||||
Map<String, Object> result = daftarPesanAmbulanceService.findByNoOrder(noOrder);
|
||||
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
|
||||
boolean dataFound = (boolean) result.get("dataFound");
|
||||
if (dataFound) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
|
||||
getMessage(MessageResource.LABEL_ERROR, request));
|
||||
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
return getJsonResponse(result, OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-status-ambulance/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveStatusAmbulance(
|
||||
@RequestParam(value = "noOrder", required = true) String noOrder,
|
||||
@RequestParam(value = "id", required = true) Integer id, HttpServletRequest request) {
|
||||
@RequestMapping(value = "/save-status-ambulance/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveStatusAmbulance(@RequestParam(value = "noOrder") String noOrder,
|
||||
@RequestParam(value = "id") Integer id, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = daftarPesanAmbulanceService.saveStatusAmbulance(noOrder, id);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when save Status Ambulance", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveStatusAmbulance", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when save Status Ambulance", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveStatusAmbulance", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.service.DaftarRKAKLTahunanService;
|
||||
import com.jasamedika.medifirst2000.vo.HeadAnggaranVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/daftar-rka-kl")
|
||||
@ -20,29 +20,14 @@ public class DaftarRKAKLTahunanController extends LocaleController<HeadAnggaranV
|
||||
@Autowired
|
||||
private DaftarRKAKLTahunanService daftarRKAKLTahunanService;
|
||||
|
||||
@RequestMapping(value = "/find-riwayat", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> findDaftarPengajuanAnggaran(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "limit", required = false, defaultValue = "100") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "spesifikasi") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@RequestParam(value = "noRec", required = false) String noRec,
|
||||
@RequestParam(value = "tahun", required = false) Integer tahun) {
|
||||
Map<String, Object> resultPageMap = daftarRKAKLTahunanService.findRiwayat(page, limit, sort, dir, noRec, tahun);
|
||||
|
||||
return resultPageMap;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-detail-rka-kl", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/get-detail-rka-kl", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getDetailRKAKL(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "limit", required = false, defaultValue = "100") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "spesifikasi") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@RequestParam(value = "tahun", required = false) Integer tahun) {
|
||||
Map<String, Object> resultPageMap = daftarRKAKLTahunanService.getDetailRKAKL(page, limit, sort, dir, tahun);
|
||||
|
||||
return resultPageMap;
|
||||
return daftarRKAKLTahunanService.getDetailRKAKL(page, limit, sort, dir, tahun);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,115 +1,105 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DaftarSewaAsramaService;
|
||||
import com.jasamedika.medifirst2000.vo.SewaAsramaVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DaftarSewaAsramaService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.SewaAsramaVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/daftar-sewa-asrama")
|
||||
public class DaftarSewaAsramaController extends LocaleController<SewaAsramaVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarSewaAsramaController.class);
|
||||
|
||||
@Autowired
|
||||
private DaftarSewaAsramaService daftarSewaAsramaService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarSewaAsramaController.class);
|
||||
|
||||
@RequestMapping(value = "/find-by-periode/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/find-by-periode/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findDaftarSewaAsramaByPeriode(
|
||||
@RequestParam(value = "periodeAwal", required = true) String periodeAwal,
|
||||
@RequestParam(value = "periodeAkhir", required = true) String periodeAkhir, HttpServletRequest request) {
|
||||
|
||||
@RequestParam(value = "periodeAwal") String periodeAwal,
|
||||
@RequestParam(value = "periodeAkhir") String periodeAkhir, HttpServletRequest request) {
|
||||
Map<String, Object> result = daftarSewaAsramaService.findDaftarSewaAsramaByPeriode(periodeAwal, periodeAkhir);
|
||||
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
|
||||
boolean dataFound = (boolean) result.get("dataFound");
|
||||
if (dataFound) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
|
||||
getMessage(MessageResource.LABEL_ERROR, request));
|
||||
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
return getJsonResponse(result, OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-by-no-order/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findByNoOrder(
|
||||
@RequestParam(value = "noOrder", required = true) String noOrder, HttpServletRequest request) {
|
||||
Map<String, Object> result = daftarSewaAsramaService.findByNoOrder(noOrder);
|
||||
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
|
||||
if (dataFound) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
|
||||
getMessage(MessageResource.LABEL_ERROR, request));
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-status-sewa-asrama/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveStatusSewaAsrama(
|
||||
@RequestParam(value = "noOrder", required = true) String noOrder, @Valid @RequestBody SewaAsramaVO vo,
|
||||
@RequestMapping(value = "/find-by-no-order/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findByNoOrder(@RequestParam(value = "noOrder") String noOrder,
|
||||
HttpServletRequest request) {
|
||||
Map<String, Object> result = daftarSewaAsramaService.findByNoOrder(noOrder);
|
||||
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);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-status-sewa-asrama/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveStatusSewaAsrama(@RequestParam(value = "noOrder") String noOrder,
|
||||
@Valid @RequestBody SewaAsramaVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = daftarSewaAsramaService.saveStatusSewaAsrama(noOrder, vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when save Status Sewa Asrama", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveStatusSewaAsrama", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when save Status Sewa Asrama", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveStatusSewaAsrama", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-all-sewa-asrama/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/get-all-sewa-asrama/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllSewaAsrama(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String, Object> result = daftarSewaAsramaService.getAllSewaAsrama();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get All Sewa Asrama", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getAllSewaAsrama", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get All Sewa Asrama", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getAllSewaAsrama", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,119 +1,109 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DaftarSewaLahanService;
|
||||
import com.jasamedika.medifirst2000.vo.SewaLahanVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DaftarSewaLahanService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.SewaLahanVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/daftar-sewa-lahan")
|
||||
public class DaftarSewaLahanController extends LocaleController<SewaLahanVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarSewaLahanController.class);
|
||||
|
||||
@Autowired
|
||||
private DaftarSewaLahanService daftarSewaLahanService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarSewaLahanController.class);
|
||||
|
||||
@RequestMapping(value = "/find-by-periode/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/find-by-periode/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findDaftarSewaLahanByPeriode(
|
||||
@RequestParam(value = "periodeAwal", required = true) String periodeAwal,
|
||||
@RequestParam(value = "periodeAkhir", required = true) String periodeAkhir, HttpServletRequest request) {
|
||||
Map<String, Object> result = null;
|
||||
@RequestParam(value = "periodeAwal") String periodeAwal,
|
||||
@RequestParam(value = "periodeAkhir") String periodeAkhir, HttpServletRequest request) {
|
||||
try {
|
||||
result = daftarSewaLahanService.findDaftarSewaLahanByPeriode(periodeAwal, periodeAkhir);
|
||||
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
|
||||
Map<String, Object> result = daftarSewaLahanService.findDaftarSewaLahanByPeriode(periodeAwal, periodeAkhir);
|
||||
boolean dataFound = (boolean) result.get("dataFound");
|
||||
if (dataFound) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
|
||||
getMessage(MessageResource.LABEL_ERROR, request));
|
||||
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
|
||||
}
|
||||
return getJsonResponse(result, OK);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-by-no-order/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findByNoOrder(
|
||||
@RequestParam(value = "noOrder", required = true) String noOrder, HttpServletRequest request) {
|
||||
Map<String, Object> result = daftarSewaLahanService.findByNoOrder(noOrder);
|
||||
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
|
||||
if (dataFound) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
|
||||
getMessage(MessageResource.LABEL_ERROR, request));
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-status-sewa-lahan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveStatusSewaLahan(
|
||||
@RequestParam(value = "noOrder", required = true) String noOrder, @Valid @RequestBody SewaLahanVO vo,
|
||||
@RequestMapping(value = "/find-by-no-order/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findByNoOrder(@RequestParam(value = "noOrder") String noOrder,
|
||||
HttpServletRequest request) {
|
||||
Map<String, Object> result = daftarSewaLahanService.findByNoOrder(noOrder);
|
||||
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);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-status-sewa-lahan/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveStatusSewaLahan(@RequestParam(value = "noOrder") String noOrder,
|
||||
@Valid @RequestBody SewaLahanVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = daftarSewaLahanService.saveStatusSewaLahan(noOrder, vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when save Status Sewa Lahan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveStatusSewaLahan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when save Status Sewa Lahan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveStatusSewaLahan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-all-sewa-lahan/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/get-all-sewa-lahan/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllSewaLahan(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String, Object> result = daftarSewaLahanService.getAllSewaLahan();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get All Sewa Lahan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getAllSewaLahan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get All Sewa Lahan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getAllSewaLahan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.service.DaftarSterilisasiAlatService;
|
||||
import com.jasamedika.medifirst2000.vo.ProsesSterilisasiAlatVO;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/daftar-sterilisasi-alat")
|
||||
public class DaftarSterilisasiAlatController extends LocaleController<ProsesSterilisasiAlatVO> {
|
||||
|
||||
// @Autowired
|
||||
private DaftarSterilisasiAlatService daftarSterilisasiAlatService;
|
||||
|
||||
}
|
||||
@ -1,119 +1,75 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.entities.DampakResiko;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DampakResikoService;
|
||||
import com.jasamedika.medifirst2000.vo.DampakResikoVO;
|
||||
import com.jasamedika.medifirst2000.vo.PasienVO;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.entities.DampakResiko;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DampakResikoService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DampakResikoVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dampak-resiko")
|
||||
public class DampakResikoController extends LocaleController<DampakResikoVO>
|
||||
implements IBaseRestController<DampakResikoVO>{
|
||||
public class DampakResikoController extends LocaleController<DampakResikoVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DampakResikoController.class);
|
||||
|
||||
@Autowired
|
||||
private DampakResikoService dampakResikoService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(PegawaiController.class);
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<DampakResikoVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<DampakResikoVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(DampakResikoVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(DampakResikoVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<DampakResikoVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/find-all/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Collection<DampakResiko>> findAll(
|
||||
@RequestMapping(value = "/find-all/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Collection<PasienVO>> findAll(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "100") Integer take,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@Spec(path = "id", params = "id", spec = Equal.class) Specification<DampakResiko> spec)
|
||||
{
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result = dampakResikoService.findAll(page, take, sort,dir, spec);
|
||||
return constructListPageResult(result);
|
||||
@Spec(path = "id", params = "id", spec = Equal.class) Specification<DampakResiko> spec) {
|
||||
Map<String, Object> result = dampakResikoService.findAll(page, take, sort, dir, spec);
|
||||
return constructListPageResult(result);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/save/", method= RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody DampakResikoVO vo,HttpServletRequest request){
|
||||
try{
|
||||
@RequestMapping(value = "/save/", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody DampakResikoVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = dampakResikoService.save(vo);
|
||||
if(null!= result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add/update dampakResiko", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when save", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add/update dampakResiko", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when save", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,125 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.PegawaiService;
|
||||
import com.jasamedika.medifirst2000.service.RisikoKerjaRuanganService;
|
||||
import com.jasamedika.medifirst2000.util.DateUtil;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.RisikoKerjaRuanganVO;
|
||||
import com.jasamedika.medifirst2000.vo.PapSkriningNyeriVO;
|
||||
import com.jasamedika.medifirst2000.vo.PegawaiVO;
|
||||
|
||||
/**
|
||||
* Controller class for Pengakjian Awal Gawat Darurat Business
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/data-pegawai")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DataPegawaiController extends LocaleController<RisikoKerjaRuanganVO> implements
|
||||
IBaseRestController<RisikoKerjaRuanganVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DataPegawaiController.class);
|
||||
|
||||
@Autowired
|
||||
private PegawaiService pegawaiService;
|
||||
|
||||
@RequestMapping(value = "/save-data-pegawai", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PegawaiVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = pegawaiService.addPegawai(vo);
|
||||
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
}else{
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add RisikoKerjaRuangan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add RisikoKerjaRuangan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-all", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> findByNoCm(HttpServletRequest request) {
|
||||
Map<String,Object> result = pegawaiService.findAllPegawai();
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
if(dataFound){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
}else{
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
}
|
||||
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<RisikoKerjaRuanganVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<RisikoKerjaRuanganVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(RisikoKerjaRuanganVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(RisikoKerjaRuanganVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<RisikoKerjaRuanganVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,305 +1,194 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DataPerusahaanYangBekerjaSamaService;
|
||||
import com.jasamedika.medifirst2000.vo.DataPerusahaanYangBekerjaSamaVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.data.jpa.domain.Specifications;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.entities.AdvokasiHukumMedicolegal;
|
||||
import com.jasamedika.medifirst2000.entities.DataPerusahaanYangBekerjaSama;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DataPerusahaanYangBekerjaSamaService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DataPerusahaanYangBekerjaSamaVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.DateBetween;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data-perusahaan-yang-bekerjasama")
|
||||
public class DataPerusahaanYangBekerjaSamaController extends LocaleController<DataPerusahaanYangBekerjaSamaVO> {
|
||||
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DataPerusahaanYangBekerjaSamaController.class);
|
||||
|
||||
@Autowired
|
||||
private DataPerusahaanYangBekerjaSamaService dataPerusahaanYangBekerjaSamaService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(DataPerusahaanYangBekerjaSamaController.class);
|
||||
|
||||
@RequestMapping(value = "/save-data-perusahaan-yang-bekerjasama/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody DataPerusahaanYangBekerjaSamaVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=dataPerusahaanYangBekerjaSamaService.addDataPerusahaanYangBekerjaSama(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add DataPerusahaanYangBekerjaSamaService", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add DataPerusahaanYangBekerjaSamaService", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-data-perusahaan-yang-bekerjasama/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody DataPerusahaanYangBekerjaSamaVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=dataPerusahaanYangBekerjaSamaService.addDataPerusahaanYangBekerjaSama(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when update DataPerusahaanYangBekerjaSamaService", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update DataPerusahaanYangBekerjaSamaService", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-all-data-perusahaan-yang-bekerjasama/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getAllVO(
|
||||
@RequestParam(value="jenisRekananId",required=false,defaultValue="6") Integer jenisRekananId,
|
||||
@RequestParam(value="status",required=false,defaultValue="1") Integer status,
|
||||
|
||||
@RequestMapping(value = "/save-data-perusahaan-yang-bekerjasama/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody DataPerusahaanYangBekerjaSamaVO vo,
|
||||
HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=dataPerusahaanYangBekerjaSamaService.findAllDataPerusahaanYangBekerjaSama(jenisRekananId,status);
|
||||
Map<String, Object> result = dataPerusahaanYangBekerjaSamaService.addDataPerusahaanYangBekerjaSama(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get DataPerusahaanYangBekerjaSamaService", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when addDataPerusahaanYangBekerjaSama", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get DataPerusahaanYangBekerjaSamaService", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when addDataPerusahaanYangBekerjaSama", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-all-data-perusahaan-yang-bekerjasama-2/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getAllVO2(
|
||||
@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 = "desc") String dir,
|
||||
@Spec(path = "rekanan.jenisRekanan.id", params = "idJenisRekanan", spec = Equal.class) Specification<DataPerusahaanYangBekerjaSama> jenisRekanan,HttpServletRequest request) {
|
||||
|
||||
Map<String,Object> result = new HashMap<String, Object>();
|
||||
|
||||
Specification<DataPerusahaanYangBekerjaSama> spec = jenisRekanan;
|
||||
result = dataPerusahaanYangBekerjaSamaService.findAll(page, take, sort, dir, spec);
|
||||
return constructListPageResult(result);
|
||||
// try {
|
||||
// Map<String,Object> result=dataPerusahaanYangBekerjaSamaService.findAllDataPerusahaanYangBekerjaSama();
|
||||
// if (null != result)
|
||||
// mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
// return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
// } catch (ServiceVOException e) {
|
||||
// LOGGER.error("Got exception {} when get DataPerusahaanYangBekerjaSamaService", e.getMessage());
|
||||
// addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
// e.getMessage());
|
||||
// return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
// mapHeaderMessage);
|
||||
// } catch (JpaSystemException jse) {
|
||||
// LOGGER.error("Got exception {} when get DataPerusahaanYangBekerjaSamaService", jse.getMessage());
|
||||
// addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
// jse.getMessage());
|
||||
// return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
// mapHeaderMessage);
|
||||
// }
|
||||
}
|
||||
@RequestMapping(value = "/get-perusanaan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getPerusahaan(HttpServletRequest request) {
|
||||
Map<String, Object> result = null;
|
||||
try{
|
||||
result = dataPerusahaanYangBekerjaSamaService.getPerusahaan();
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
|
||||
if(dataFound){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
}
|
||||
else{
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
||||
@RequestMapping(value = "/find-all-data-perusahaan-yang-bekerjasama/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllVO(
|
||||
@RequestParam(value = "jenisRekananId", required = false, defaultValue = "6") Integer jenisRekananId,
|
||||
@RequestParam(value = "status", required = false, defaultValue = "1") Integer status,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = dataPerusahaanYangBekerjaSamaService
|
||||
.findAllDataPerusahaanYangBekerjaSama(jenisRekananId, status);
|
||||
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 findAllDataPerusahaanYangBekerjaSama", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when findAllDataPerusahaanYangBekerjaSama", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-asuransi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-asuransi", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAsuransi(HttpServletRequest request) {
|
||||
Map<String, Object> result = null;
|
||||
try{
|
||||
result = dataPerusahaanYangBekerjaSamaService.getAsuransi();
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
|
||||
if(dataFound){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
try {
|
||||
Map<String, Object> result = dataPerusahaanYangBekerjaSamaService.getAsuransi();
|
||||
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));
|
||||
}
|
||||
else{
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return getJsonResponse(result, OK);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-rumah-sakit", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-rumah-sakit", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getRumahSakit(HttpServletRequest request) {
|
||||
Map<String, Object> result = null;
|
||||
try{
|
||||
result = dataPerusahaanYangBekerjaSamaService.getRumahSakit();
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
|
||||
if(dataFound){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
try {
|
||||
Map<String, Object> result = dataPerusahaanYangBekerjaSamaService.getRumahSakit();
|
||||
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));
|
||||
}
|
||||
else{
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return getJsonResponse(result, OK);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-yayasan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-yayasan", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getYayasan(HttpServletRequest request) {
|
||||
Map<String, Object> result = null;
|
||||
try{
|
||||
result = dataPerusahaanYangBekerjaSamaService.getYayasan();
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
|
||||
if(dataFound){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
try {
|
||||
Map<String, Object> result = dataPerusahaanYangBekerjaSamaService.getYayasan();
|
||||
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));
|
||||
}
|
||||
else{
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return getJsonResponse(result, OK);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-perusahaan-yang-bekerja-sama/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-perusahaan-yang-bekerja-sama/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getPerusahaanYangBekerjaSama(HttpServletRequest request) {
|
||||
Map<String, Object> result = null;
|
||||
try{
|
||||
result = dataPerusahaanYangBekerjaSamaService.getPerusahaanYangBekerjaSama();
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
|
||||
if(dataFound){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
try {
|
||||
Map<String, Object> result = dataPerusahaanYangBekerjaSamaService.getPerusahaanYangBekerjaSama();
|
||||
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));
|
||||
}
|
||||
else{
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return getJsonResponse(result, OK);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-asuransi-yang-bekerja-sama/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-asuransi-yang-bekerja-sama/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAsuransiYangBekerjaSama(HttpServletRequest request) {
|
||||
Map<String, Object> result = null;
|
||||
try{
|
||||
result = dataPerusahaanYangBekerjaSamaService.getAsuransiYangBekerjaSama();
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
|
||||
if(dataFound){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
try {
|
||||
Map<String, Object> result = dataPerusahaanYangBekerjaSamaService.getAsuransiYangBekerjaSama();
|
||||
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));
|
||||
}
|
||||
else{
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return getJsonResponse(result, OK);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-rumah-sakit-yang-bekerja-sama/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-rumah-sakit-yang-bekerja-sama/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getRumahSakitYangBekerjaSama(HttpServletRequest request) {
|
||||
Map<String, Object> result = null;
|
||||
try{
|
||||
result = dataPerusahaanYangBekerjaSamaService.getRumahSakitYangBekerjaSama();
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
|
||||
if(dataFound){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
try {
|
||||
Map<String, Object> result = dataPerusahaanYangBekerjaSamaService.getRumahSakitYangBekerjaSama();
|
||||
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));
|
||||
}
|
||||
else{
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return getJsonResponse(result, OK);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-yayasan-yang-bekerja-sama/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-yayasan-yang-bekerja-sama/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getYayasanYangBekerjaSama(HttpServletRequest request) {
|
||||
Map<String, Object> result = null;
|
||||
try{
|
||||
result = dataPerusahaanYangBekerjaSamaService.getYayasanYangBekerjaSama();
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
|
||||
if(dataFound){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
try {
|
||||
Map<String, Object> result = dataPerusahaanYangBekerjaSamaService.getYayasanYangBekerjaSama();
|
||||
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));
|
||||
}
|
||||
else{
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return getJsonResponse(result, OK);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,274 +1,133 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DataPesertaPerusahanYangBekerjaSamaService;
|
||||
import com.jasamedika.medifirst2000.vo.DataPesertaPerusahanYangBekerjaSamaVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DataPesertaPerusahanYangBekerjaSamaService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DataPesertaPerusahanYangBekerjaSamaVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/data-peserta-perusahaan-yang-bekerja-sama")
|
||||
public class DataPesertaPerusahanYangBekerjaSamaController extends LocaleController<DataPesertaPerusahanYangBekerjaSamaVO> implements IBaseRestController<DataPesertaPerusahanYangBekerjaSamaVO> {
|
||||
|
||||
public class DataPesertaPerusahanYangBekerjaSamaController
|
||||
extends LocaleController<DataPesertaPerusahanYangBekerjaSamaVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DataPesertaPerusahanYangBekerjaSamaController.class);
|
||||
|
||||
@Autowired
|
||||
private DataPesertaPerusahanYangBekerjaSamaService service;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(DataPesertaPerusahanYangBekerjaSamaController.class);
|
||||
|
||||
@RequestMapping(value = "/save-data-peserta-perusahaan-yang-bekerja-sama/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody DataPesertaPerusahanYangBekerjaSamaVO vo, HttpServletRequest request) {
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-data-peserta-perusahaan-yang-bekerja-sama/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody DataPesertaPerusahanYangBekerjaSamaVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=service.addDataPesertaPerusahanYangBekerjaSama(vo);
|
||||
Map<String, Object> result = service.addDataPesertaPerusahanYangBekerjaSama(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add DataPesertaPerusahanYangBekerjaSama", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when addDataPesertaPerusahanYangBekerjaSama", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add DataPesertaPerusahanYangBekerjaSama", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when addDataPesertaPerusahanYangBekerjaSama", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-all-data-peserta-perusahaan-yang-bekerja-sama/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody List<DataPesertaPerusahanYangBekerjaSamaVO> vos, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=service.addallDataPesertaPerusahanYangBekerjaSama(vos);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add all DataPesertaPerusahanYangBekerjaSama", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add all DataPesertaPerusahanYangBekerjaSama", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-data-peserta-perusahaan-yang-bekerja-sama/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody DataPesertaPerusahanYangBekerjaSamaVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=service.updateDataPesertaPerusahanYangBekerjaSama(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when update DataPesertaPerusahanYangBekerjaSama", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update DataPesertaPerusahanYangBekerjaSama", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/find-all-data-peserta/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=service.findAllDataPesertaPerusahanYangBekerjaSama();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get all DataPesertaPerusahanYangBekerjaSama", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get all DataPesertaPerusahanYangBekerjaSama", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-all-peserta-rumah-sakit-yang-bekerja-sama/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllPesertaRumahSakitYangBekerjaSama(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=service.findAllDataPesertaRumahSakitYangBekerjaSama();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get all DataPesertaRumahSakitYangBekerjaSama", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get all DataPesertaRumahSakitYangBekerjaSama", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-all-peserta-asuransi-yang-bekerja-sama/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllPesertaAsuransiYangBekerjaSama(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=service.findAllDataPesertaAsuransiYangBekerjaSama();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get all DataPesertaAsuransiYangBekerjaSama", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get all DataPesertaAsuransiYangBekerjaSama", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-rekanan-rumah-sakit/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllRumahSakitYangBekerjaSama(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=service.findAllDataRumahSakitYangBekerjaSama();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get all DataRumahSakitYangBekerjaSama", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get all DataRumahSakitYangBekerjaSama", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-rekanan-asuransi/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllAsuransiYangBekerjaSama(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=service.findAllDataAsuransiYangBekerjaSama();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get all DataAsuransiYangBekerjaSama", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get all DataAsuransiYangBekerjaSama", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<DataPesertaPerusahanYangBekerjaSamaVO>> getAllVOWithQueryString(
|
||||
HttpServletRequest request, Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<DataPesertaPerusahanYangBekerjaSamaVO> getVO(Integer id) {
|
||||
return null;
|
||||
@RequestMapping(value = "/find-all-data-peserta/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllVO(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.findAllDataPesertaPerusahanYangBekerjaSama();
|
||||
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 findAllDataPesertaPerusahanYangBekerjaSama", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when findAllDataPesertaPerusahanYangBekerjaSama", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(DataPesertaPerusahanYangBekerjaSamaVO vo) {
|
||||
return null;
|
||||
@RequestMapping(value = "/find-all-peserta-rumah-sakit-yang-bekerja-sama/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllPesertaRumahSakitYangBekerjaSama(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.findAllDataPesertaRumahSakitYangBekerjaSama();
|
||||
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 findAllDataPesertaRumahSakitYangBekerjaSama", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when findAllDataPesertaRumahSakitYangBekerjaSama",
|
||||
jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(DataPesertaPerusahanYangBekerjaSamaVO vo) {
|
||||
return null;
|
||||
@RequestMapping(value = "/get-rekanan-rumah-sakit/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllRumahSakitYangBekerjaSama(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.findAllDataRumahSakitYangBekerjaSama();
|
||||
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 findAllDataRumahSakitYangBekerjaSama", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when findAllDataRumahSakitYangBekerjaSama", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<DataPesertaPerusahanYangBekerjaSamaVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-peserta-by-data-perusahaan/{noRec}/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getKelasByRuangan(@PathVariable("noRec") String noRec, HttpServletRequest request) {
|
||||
Map<String, Object> result = null;
|
||||
try{
|
||||
result = service.findDataPesertaByDataPerusahaan(noRec);
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
|
||||
if(dataFound){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
@RequestMapping(value = "/get-peserta-by-data-perusahaan/{noRec}/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getKelasByRuangan(@PathVariable("noRec") String noRec,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.findDataPesertaByDataPerusahaan(noRec);
|
||||
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));
|
||||
}
|
||||
else{
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return getJsonResponse(result, OK);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,177 +1,110 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.entities.Departemen;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DepartemenService;
|
||||
import com.jasamedika.medifirst2000.vo.DepartemenVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DepartemenService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DepartemenVO;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/departemen")
|
||||
public class DepartemenController extends LocaleController<DepartemenVO> implements
|
||||
IBaseRestController<DepartemenVO>{
|
||||
|
||||
public class DepartemenController extends LocaleController<DepartemenVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DepartemenController.class);
|
||||
|
||||
@Autowired
|
||||
private DepartemenService departemenService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(DepartemenController.class);
|
||||
private DepartemenService<Departemen> departemenService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<DepartemenVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<DepartemenVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-departemen/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> addVO(@Valid @RequestBody DepartemenVO vo,HttpServletRequest request) {
|
||||
@RequestMapping(value = "/save-departemen/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> addVO(@Valid @RequestBody DepartemenVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
DepartemenVO result = (DepartemenVO) departemenService.add(vo);
|
||||
|
||||
DepartemenVO result = departemenService.add(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse("", HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse("", CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Departemen", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when add", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Departemen", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when add", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-departemen/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/update-departemen/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> editVO(@Valid @RequestBody DepartemenVO vo) {
|
||||
try {
|
||||
DepartemenVO result = (DepartemenVO) departemenService.update(vo);
|
||||
|
||||
DepartemenVO result = departemenService.update(vo);
|
||||
if (null != result)
|
||||
return RestUtil.getJsonResponse("", HttpStatus.OK);
|
||||
return getJsonResponse("", OK);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when update Departemen", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when update", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update Departemen",
|
||||
jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when update", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE);
|
||||
return getJsonHttpStatus(NOT_ACCEPTABLE);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete-departemen/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/delete-departemen/", method = GET, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
try {
|
||||
if (departemenService.delete(id) == true)
|
||||
|
||||
return RestUtil.getJsonResponse("", HttpStatus.OK);
|
||||
if (departemenService.delete(id))
|
||||
return getJsonResponse("", OK);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when delete Departemen", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when delete", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when delete Departemen", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when delete", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE);
|
||||
return getJsonHttpStatus(NOT_ACCEPTABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<DepartemenVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/search-departemen", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Collection<DepartemenVO>> getAllVOWithQueryString(
|
||||
@RequestParam(value = "page", required = false ,defaultValue = "1") Integer page,
|
||||
@RequestParam(value = "limit", required = false ,defaultValue = "10") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir){
|
||||
Map<String, Object> resultPageMap = departemenService.findAllWithPageAndLimitAndSortByAndDirectionParameter(page,
|
||||
limit, sort, dir);
|
||||
|
||||
return constructListPageResult(resultPageMap);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(DepartemenVO vo) {
|
||||
return null;
|
||||
@RequestMapping(value = "/get-all-departemen-for-tagihan", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> findAllDepartemenById5And6(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> listDepartemen = departemenService.findAllDepartemeById5And6();
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(listDepartemen, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got ServiceVOException {} when findAllDepartemeById5And6", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when findAllDepartemeById5And6", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
@RequestMapping(value = "/get-all-departemen-for-tagihan", method = RequestMethod.GET)
|
||||
public ResponseEntity< Map<String,Object>> findAllDepartemenById5And6(HttpServletRequest request) {
|
||||
try {
|
||||
|
||||
Map<String,Object> listDepartemen = departemenService.findAllDepartemeById5And6();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(listDepartemen, HttpStatus.OK,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get all dokter", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get all dokter", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,78 +1,61 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.hibernate.sql.JoinType;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DetailRupService;
|
||||
import com.jasamedika.medifirst2000.vo.DetailRupCustomVO;
|
||||
import com.jasamedika.medifirst2000.vo.HeadAnggaranVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.entities.DetailRup;
|
||||
import com.jasamedika.medifirst2000.entities.Ruangan;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DetailRupService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DetailRupCustomVO;
|
||||
import com.jasamedika.medifirst2000.vo.HeadAnggaranVO;
|
||||
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Like;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.JoinFetch;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/detail-rup")
|
||||
public class DetailRupController extends LocaleController<HeadAnggaranVO>{
|
||||
public class DetailRupController extends LocaleController<HeadAnggaranVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DetailRupController.class);
|
||||
|
||||
@Autowired
|
||||
private DetailRupService service;
|
||||
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DetailRupController.class);
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-detail-rup", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveDetailRup(@Valid @RequestBody DetailRupCustomVO vo, HttpServletRequest request) {
|
||||
@RequestMapping(value = "/save-detail-rup", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveDetailRup(@Valid @RequestBody DetailRupCustomVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.saveDetailLRup(vo);
|
||||
Map<String, Object> result = service.saveDetailLRup(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when save RUP", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveDetailLRup", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when save RUP", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveDetailLRup", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@RequestMapping(value = "/list-rup")
|
||||
public Map<String,Object> joinCondition(
|
||||
public Map<String, Object> joinCondition(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "100") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "noRec") String sort,
|
||||
@ -80,15 +63,11 @@ public class DetailRupController extends LocaleController<HeadAnggaranVO>{
|
||||
@RequestParam(value = "dateStart", required = false) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = false) String dateEnd,
|
||||
@RequestParam(value = "pengendaliId", required = false) Integer pengendaliId) {
|
||||
|
||||
Map<String, Object> resultPageMap = service.detailRupPaging(page,limit,sort,dir,dateStart,dateEnd);
|
||||
|
||||
return resultPageMap;
|
||||
return service.detailRupPaging(page, limit, sort, dir, dateStart, dateEnd);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/pre-add-kartu-pengendali")
|
||||
public Map<String,Object> preAddKartuPengendali(
|
||||
public Map<String, Object> preAddKartuPengendali(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "100") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "noRec") String sort,
|
||||
@ -98,46 +77,34 @@ public class DetailRupController extends LocaleController<HeadAnggaranVO>{
|
||||
@RequestParam(value = "kegiatanId", required = false) Integer kegiatanId,
|
||||
@RequestParam(value = "akunId", required = false) Integer akunId,
|
||||
@RequestParam(value = "asalProdukId", required = false) Integer asalProdukId) {
|
||||
|
||||
Map<String, Object> resultPageMap = service.preAddKartuPengendali(page, limit, sort, dir, dateStart, dateEnd,kegiatanId,akunId,asalProdukId);
|
||||
|
||||
return resultPageMap;
|
||||
return service.preAddKartuPengendali(page, limit, sort, dir, dateStart, dateEnd, kegiatanId, akunId,
|
||||
asalProdukId);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@RequestMapping(value = "/find-rup-list")
|
||||
public Map<String,Object> findRupList(
|
||||
public Map<String, Object> findRupList(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "100") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "noRec") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@RequestParam(value = "dateStart", required = false) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = false) String dateEnd) {
|
||||
return service.findRupList(page, limit, sort, dir, dateStart, dateEnd);
|
||||
}
|
||||
|
||||
Map<String, Object> resultPageMap = service.findRupList(page, limit, sort, dir, dateStart, dateEnd);
|
||||
|
||||
return resultPageMap;
|
||||
@RequestMapping(value = "/get-rup-header-by-norec/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getKartuPengendaliHeaderByNoRec(@RequestParam(value = "noRec") String noRec) {
|
||||
return service.getDetailRupHeaderByNoRec(noRec);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-rup-header-by-norec/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String,Object> getKartuPengendaliHeaderByNoRec(
|
||||
@RequestParam(value = "noRec", required = true) String noRec) {
|
||||
Map<String,Object> detailRupList=service.getDetailRupHeaderByNoRec(noRec);
|
||||
return detailRupList;
|
||||
|
||||
@RequestMapping(value = "/get-asal-produk/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getAsalProduk(@RequestParam(value = "kegiatanId") Integer kegiatanId) {
|
||||
return service.getAsalProduk(kegiatanId);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-asal-produk/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String,Object> getAsalProduk(
|
||||
@RequestParam(value = "kegiatanId", required = true) Integer kegiatanId) {
|
||||
Map<String,Object> asalProduk=service.getAsalProduk(kegiatanId);
|
||||
return asalProduk;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-mata-anggaran/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String,Object> getMataAnggaran(
|
||||
@RequestParam(value = "asalProdukId", required = true) Integer asalProdukId) {
|
||||
Map<String,Object> mataAnggaran=service.getMataAnggaran(asalProdukId);
|
||||
return mataAnggaran;
|
||||
|
||||
@RequestMapping(value = "/get-mata-anggaran/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getMataAnggaran(@RequestParam(value = "asalProdukId") Integer asalProdukId) {
|
||||
return service.getMataAnggaran(asalProdukId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,114 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DetailTriaseService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DetailTriaseVO;
|
||||
|
||||
|
||||
/******************
|
||||
* @author Shakato
|
||||
******************/
|
||||
@RestController
|
||||
@RequestMapping("/detail-triase")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DetailTriaseController extends LocaleController<DetailTriaseVO> implements IBaseRestController<DetailTriaseVO> {
|
||||
|
||||
@Autowired
|
||||
private DetailTriaseService detailTriaseService;
|
||||
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DetailTriaseController.class);
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-detail-triase", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> saveDetailTriase(@Valid @RequestBody DetailTriaseVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
DetailTriaseVO result = detailTriaseService.add(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
RestUtil.getJsonHttptatus(HttpStatus.CREATED);
|
||||
return RestUtil.getJsonResponse("Status Sukses", HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Status Keluarga", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Status Keluarga", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<DetailTriaseVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(DetailTriaseVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(DetailTriaseVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<DetailTriaseVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<DetailTriaseVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,79 +1,76 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DiagnosaKeperawatanService;
|
||||
import com.jasamedika.medifirst2000.service.DiagnosaKeperawatanTransaksiService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DiagnosaKeperawatanTransaksiVO;
|
||||
import com.jasamedika.medifirst2000.vo.DiagnosaKeperawatanVO;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
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.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/diagnosa-keperawatan")
|
||||
public class DiagnosaKeperawatanTransaksiController extends LocaleController {
|
||||
|
||||
public class DiagnosaKeperawatanTransaksiController extends LocaleController<DiagnosaKeperawatanVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DiagnosaKeperawatanTransaksiController.class);
|
||||
|
||||
@Autowired
|
||||
private DiagnosaKeperawatanTransaksiService service;
|
||||
|
||||
|
||||
@Autowired
|
||||
private DiagnosaKeperawatanService diagnosaKeperawatanService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DiagnosaKeperawatanTransaksiController.class);
|
||||
|
||||
@RequestMapping(value = "/save-diagnosa-keperawatan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> saveDiagnosaKeperawatanTransaksi(@Valid @RequestBody List<DiagnosaKeperawatanTransaksiVO> vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.saveDiagnosaKeperawatan(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
@RequestMapping(value = "/save-diagnosa-keperawatan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveDiagnosaKeperawatanTransaksi(
|
||||
@Valid @RequestBody List<DiagnosaKeperawatanTransaksiVO> vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.saveDiagnosaKeperawatan(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when saveRencana", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveDiagnosaKeperawatan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveRencana", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveDiagnosaKeperawatan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-all-master")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> getDiagnosaKeperawatan() {
|
||||
return diagnosaKeperawatanService.getDiagnosaKeperawatan();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-detail-by-master")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> getDetailDiagnosaKeperawatan(
|
||||
@RequestParam(value = "id", required = false) Integer id) {
|
||||
return diagnosaKeperawatanService.getDetailDiagnosisKeperawatan(id);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-detail-by-transaction")
|
||||
@ResponseBody
|
||||
public Map<String, Object> getDetailDiagnosaKeperawatanTransaction(
|
||||
|
||||
@ -1,41 +1,34 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DiagnosaPasienService;
|
||||
import com.jasamedika.medifirst2000.vo.DiagnosaPasienVO;
|
||||
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.dao.LoginUserDao;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.security.model.UserAuthentication;
|
||||
import com.jasamedika.medifirst2000.security.service.TokenAuthenticationService;
|
||||
import com.jasamedika.medifirst2000.service.ActivityPegawaiService;
|
||||
import com.jasamedika.medifirst2000.service.DiagnosaPasienService;
|
||||
import com.jasamedika.medifirst2000.service.LoginUserService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DiagnosaPasienVO;
|
||||
import com.jasamedika.medifirst2000.vo.K3CheckListFacillitySefetyVO;
|
||||
import com.jasamedika.medifirst2000.vo.PegawaiVO;
|
||||
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
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 Registrasi Pasien Business
|
||||
@ -44,132 +37,72 @@ import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/diagnosa-pasien")
|
||||
public class DiagnosaPasienController extends LocaleController<RegistrasiPelayananVO>{
|
||||
public class DiagnosaPasienController extends LocaleController<RegistrasiPelayananVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DiagnosaPasienController.class);
|
||||
|
||||
@Autowired
|
||||
private DiagnosaPasienService diagnosaPasienService;
|
||||
|
||||
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(DiagnosaPasienController.class);
|
||||
@Autowired
|
||||
private LoginUserDao loginUserDao;
|
||||
@Autowired
|
||||
private ActivityPegawaiService activityPegawaiServiceImpl;
|
||||
|
||||
// @RequestMapping(value = "/save-diagnosa-pasien", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
// public ResponseEntity<Map<String, Object>> saveDiagnosaPasien(@Valid @RequestBody DiagnosaPasienVO vo,HttpServletRequest request) {
|
||||
// try {
|
||||
// Map<String,Object> result=diagnosaPasienService.saveDiagnosaPasien(vo);
|
||||
// if (null != result)
|
||||
// mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
// String token = request.getHeader(WebConstants.AUTH_HEADER_NAME);
|
||||
// final User user = TokenAuthenticationService.tokenHandler.parseUserFromToken(token);
|
||||
// if (user != null) {
|
||||
// {
|
||||
// UserAuthentication data= new UserAuthentication(user);
|
||||
// PegawaiVO pegawai = new PegawaiVO();
|
||||
// pegawai.setId(loginUserDao.findByNamaUser(data.getName()).get(0).getPegawai().getId());
|
||||
// activityPegawaiServiceImpl.record(pegawai, new Date(), "Memasukan Diagnosis");
|
||||
// BroadcastMessage("IKI", "");
|
||||
// }
|
||||
// }
|
||||
// return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
//
|
||||
// } catch (ServiceVOException e) {
|
||||
// LOGGER.error("Got exception {} when saveDiagnosaPasien", e.getMessage());
|
||||
// addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
// return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
// } catch (JpaSystemException jse) {
|
||||
// LOGGER.error("Got exception {} when saveDiagnosaPasien", jse.getMessage());
|
||||
// addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
// return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
@RequestMapping(value = "/save-diagnosa-pasien", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveDiagnosaPasien(@Valid @RequestBody DiagnosaPasienVO vo, HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/save-diagnosa-pasien", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveDiagnosaPasien(@Valid @RequestBody DiagnosaPasienVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=diagnosaPasienService.saveDiagnosaPasien(vo);
|
||||
Map<String, Object> result = diagnosaPasienService.saveDiagnosaPasien(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when saveDiagnosaPasien", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveDiagnosaPasien", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveDiagnosaPasien", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveDiagnosaPasien", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-by-no-cm", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String, Object>> getByNoCM(@RequestParam(value="noCM", required= false) String noCm,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=diagnosaPasienService.findByNoCm(noCm);
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when saveDiagnosaPasien", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveDiagnosaPasien", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-all", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String, Object>> findAll(HttpServletRequest request) {
|
||||
@RequestMapping(value = "/get-by-no-cm", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> getByNoCM(@RequestParam(value = "noCM", required = false) String noCm,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=diagnosaPasienService.findAll();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
Map<String, Object> result = diagnosaPasienService.findByNoCm(noCm);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got ServiceVOException {} when findByNoCm", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when findByNoCm", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when saveDiagnosaPasien", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveDiagnosaPasien", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-diagnosa-by-antrian", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String, Object>> getDiagnosaByAntrian(@RequestParam(value="noRec", required= true) String noRec,HttpServletRequest request) {
|
||||
@RequestMapping(value = "/get-diagnosa-by-antrian", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> getDiagnosaByAntrian(@RequestParam(value = "noRec") String noRec,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=diagnosaPasienService.findDiagnosaPasienByAntrian(noRec);
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
if(dataFound){
|
||||
mapHeaderMessage.clear();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
}else{
|
||||
mapHeaderMessage.clear();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
Map<String, Object> result = diagnosaPasienService.findDiagnosaPasienByAntrian(noRec);
|
||||
boolean dataFound = (boolean) result.get("dataFound");
|
||||
mapHeaderMessage.clear();
|
||||
if (dataFound) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} else {
|
||||
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
|
||||
}
|
||||
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when saveDiagnosaPasien", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when findDiagnosaPasienByAntrian", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveDiagnosaPasien", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when findDiagnosaPasienByAntrian", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user