Update controller

Clean code
This commit is contained in:
Salman Manoe 2024-12-23 09:32:43 +07:00
parent 60de4d71fa
commit 9d2466eaca
39 changed files with 1854 additions and 4127 deletions

View File

@ -1,57 +0,0 @@
package com.jasamedika.medifirst2000.controller;
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.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.ImplementasiService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.ImplementasiVO;
@RestController
@RequestMapping("/implementasi")
public class ImplementasiController extends LocaleController<ImplementasiVO> {
@Autowired
private ImplementasiService service;
private static final Logger LOGGER = LoggerFactory.getLogger(ImplementasiController.class);
@RequestMapping(value = "/save-implementasi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> saveImplementasi(@Valid @RequestBody ImplementasiVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = service.saveImplementasi(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 saveDiagnosisKeperawatan", 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 saveDiagnosisKeperawatan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,13 +0,0 @@
package com.jasamedika.medifirst2000.controller;
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.vo.IndikatorBIOSVO;
@RestController
@RequestMapping("/indikator-bios")
public class IndikatorBIOSController extends LocaleController<IndikatorBIOSVO>{
}

View File

@ -1,123 +1,82 @@
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.vo.PasienVO;
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.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.entities.IndikatorRensar;
import com.jasamedika.medifirst2000.entities.PeriodePelaporan;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.IndikatorRensarService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.IndikatorRensarVO;
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("/indikator-rensar")
public class IndikatorRensarController extends LocaleController<IndikatorRensarVO> implements IBaseRestController<IndikatorRensarVO>{
public class IndikatorRensarController extends LocaleController<IndikatorRensarVO> {
@Autowired
private IndikatorRensarService indikatorRensarService;
private static final Logger LOGGER = LoggerFactory
.getLogger(IndikatorRensarController.class);
@RequestMapping(value="/find-all/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<IndikatorRensar>> findAll(
private static final Logger LOGGER = LoggerFactory.getLogger(IndikatorRensarController.class);
@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<IndikatorRensar> spec1,
@Spec(path = "sasaranStrategisId", params = "sasaranStrategisId", spec = Equal.class) Specification<IndikatorRensar> spec2)
{
Specification<IndikatorRensar> spec = Specifications.where(spec1).and(spec2);
Map<String, Object> result = new HashMap<String, Object>();
result = indikatorRensarService.findAll(page, take, sort,dir, spec);
return constructListPageResult(result);
@Spec(path = "sasaranStrategisId", params = "sasaranStrategisId", spec = Equal.class) Specification<IndikatorRensar> spec2) {
Specification<IndikatorRensar> spec = Specifications.where(spec1).and(spec2);
Map<String, Object> result = indikatorRensarService.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 IndikatorRensarVO vo,HttpServletRequest request){
try{
@RequestMapping(value = "/save/", method = POST, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody IndikatorRensarVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = indikatorRensarService.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 Indikator Kinerja Utama", 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 Indikator Kinerja Utama", 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);
}
}
@Override
public ResponseEntity<Collection<IndikatorRensarVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<IndikatorRensarVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(IndikatorRensarVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(IndikatorRensarVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<IndikatorRensarVO>> getAllVO() {
return null;
}
}

View File

@ -1,50 +0,0 @@
package com.jasamedika.medifirst2000.controller;
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.notification.antrian.InfoTambahanAntrian;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
/**
* @author Syamsu
*/
@RestController
@RequestMapping({"/test-tanpa-auth/info-tambahan-antrian", "/info-tambahan-antrian"})
public class InfoTambahanAntrianController {
@Autowired
InfoTambahanAntrian infoAntrian;
@RequestMapping(value="/kirim-pesan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> kirimPesankeLayar(@RequestParam("pesan") String pesan, @RequestParam("targetlayar") String targetlayar){
try{
infoAntrian.kirimPesan(pesan, targetlayar);
return RestUtil.getJsonResponse("Pesan berhasil terkirim", HttpStatus.OK);
}catch(Exception e){
return RestUtil.getJsonResponse("Pesan gagal terkirim penyebab " + e.getMessage(), HttpStatus.BAD_REQUEST);
}
}
@RequestMapping(value="/jenis-total-antrian", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> tambahTotalPerJenisAntrian(@RequestParam("label") String label,
@RequestParam("tipe") String tipe, @RequestParam("total") Integer total,
@RequestParam("hapus") boolean hapus,
@RequestParam("targetlayar") String targetlayar){
try{
infoAntrian.kirimJumlahAntrian(label, tipe, String.valueOf(total), hapus, targetlayar);
return RestUtil.getJsonResponse("Total antrian berhasil diinfokan", HttpStatus.OK);
}catch(Exception e){
return RestUtil.getJsonResponse("Total antrian gagal diinfokan penyebab " + e.getMessage(), HttpStatus.BAD_REQUEST);
}
}
}

View File

@ -1,155 +1,49 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
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.web.bind.annotation.PathVariable;
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.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.InformasiTarifLayananService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.HargaNettoProdukByKelasVO;
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.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.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("/informasi-tarif-layanan")
public class InformasiTarifLayananController extends LocaleController<HargaNettoProdukByKelasVO>{
public class InformasiTarifLayananController extends LocaleController<HargaNettoProdukByKelasVO> {
@Autowired
private InformasiTarifLayananService service;
private static final Logger LOGGER = LoggerFactory
.getLogger(InformasiTarifLayananController.class);
@RequestMapping(value = "/get-tarif-layanan-ruangan/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findTarifLayanan(HttpServletRequest request) {
Map<String, Object> result = null;
try{
result = service.getInformasiTarifLayananRuangan();
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);
}
@RequestMapping(value = "/get-tarif-by-id-produk/{produkId}/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findHargaByIdProduk(@PathVariable("produkId") Integer produkId, HttpServletRequest request) {
Map<String, Object> result = null;
try{
result = service.getHargaByIdProduk(produkId);
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);
}
// minimized
@RequestMapping(value = "/get-tarif-layanan-by-id-produk/{produkId}/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findHargaLayananByIdProduk(@PathVariable("produkId") Integer produkId, HttpServletRequest request) {
Map<String, Object> result = null;
try{
result = service.getHargaProdukByIdProdukMinimized(produkId);
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);
}
@RequestMapping(value = "/get-all-tarif-produk/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findAllHarga(HttpServletRequest request) {
Map<String, Object> result = null;
try{
result = service.getAllHargaProduk();
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);
}
@RequestMapping(value = "/get-harga-netto-by-nama-produk", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-harga-netto-by-nama-produk", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findHargaNettoByNamaProduk(
@RequestParam(value="namaProduk", required = false, defaultValue = "") String namaProduk,
@RequestParam(value = "namaProduk", required = false, defaultValue = "") String namaProduk,
HttpServletRequest request) {
Map<String, Object> result = null;
try{
result = service.getHargaNettoByNamaProduk(namaProduk);
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 = service.getHargaNettoByNamaProduk(namaProduk);
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-produk-by-detail-jenis-produk-akomodasi/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findProdukByDetailJenisProdukAkomodasi(HttpServletRequest request) {
Map<String, Object> result = null;
try{
result = service.findProdukByDetailJenisProdukAkomodasi();
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);
}
}

View File

@ -1,133 +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.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.InseminasiService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.InseminasiVO;
@RestController
@RequestMapping("/inseminasi")
public class InseminasiController extends LocaleController<InseminasiVO> implements IBaseRestController<InseminasiVO>{
@Autowired
private InseminasiService inseminasiService;
private static final Logger LOGGER = LoggerFactory
.getLogger(InseminasiController.class);
@Override
public ResponseEntity<Collection<InseminasiVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<InseminasiVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(InseminasiVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(InseminasiVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<InseminasiVO>> getAllVO() {
return null;
}
@RequestMapping(value = "/save-inseminasi/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody InseminasiVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=inseminasiService.saveInseminasi(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 Inseminasi", 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 Inseminasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
// @RequestMapping(value = "/update-inseminasi/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<Map<String,Object>> editVO(@Valid @RequestBody InseminasiVO vo, HttpServletRequest request) {
//
// try {
// Map<String,Object> result=inseminasiService.updateInseminasi(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 Inseminasi", 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 Inseminasi", jse.getMessage());
// addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
// jse.getMessage());
// return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
// mapHeaderMessage);
// }
// }
// @SuppressWarnings("unchecked")
// @RequestMapping(value = "/find-by-noCm/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<Map<String,Object>> findByNoCm(@RequestParam(value = "noCm", required = false, defaultValue = "000000000000001") String noCm,HttpServletRequest request) {
// Map<String,Object> result = inseminasiService.findByNoCm(noCm);
// 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);
// }
}

View File

@ -1,74 +1,72 @@
package com.jasamedika.medifirst2000.controller;
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.InstruksiService;
import com.jasamedika.medifirst2000.vo.InstruksiCustomVO;
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.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.InstruksiService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.InstruksiCustomVO;
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.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/instruksi")
public class InstruksiController extends LocaleController<InstruksiCustomVO> {
@Autowired
private InstruksiService service;
private static final Logger LOGGER = LoggerFactory.getLogger(InstruksiController.class);
@RequestMapping(value = "/save-instruksi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> saveInstruksi(@Valid @RequestBody InstruksiCustomVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = service.saveInstruksi(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
@Autowired
private InstruksiService service;
private static final Logger LOGGER = LoggerFactory.getLogger(InstruksiController.class);
@RequestMapping(value = "/save-instruksi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveInstruksi(@Valid @RequestBody InstruksiCustomVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = service.saveInstruksi(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 saveInstruksi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveInstruksi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveInstruksi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveInstruksi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-instruksi/{noCm}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-instruksi/{noCm}", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> getTindakanByIdUserAndPeriod(@PathVariable("noCm") String noCm,
HttpServletRequest request) {
List<Map<String, Object>> result = null;
try {
result = service.getInstruksi(noCm);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
List<Map<String, Object>> result = service.getInstruksi(noCm);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK);
} catch (Exception e) {
e.printStackTrace();
throw new ServiceVOException(e.getMessage());
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
}

View File

@ -1,57 +0,0 @@
package com.jasamedika.medifirst2000.controller;
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.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.IntervensiService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.DiagnosaKeperawatanVO;
import com.jasamedika.medifirst2000.vo.IntervensiVO;
@RestController
@RequestMapping("/intervensi")
public class IntervensiController extends LocaleController<IntervensiVO> {
@Autowired
private IntervensiService service;
private static final Logger LOGGER = LoggerFactory.getLogger(IntervensiController.class);
@RequestMapping(value = "/save-intervensi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> saveIntervensi(@Valid @RequestBody IntervensiVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = service.saveIntervensi(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 saveDiagnosisKeperawatan", 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 saveDiagnosisKeperawatan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,127 +1,102 @@
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.IntraOperasiAnestesiService;
import com.jasamedika.medifirst2000.vo.AsuhanKeperawatanPeriOperasiHeaderVO;
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.IntraOperasiAnestesiService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.AsuhanKeperawatanPeriOperasiHeaderVO;
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("/intra-operasi-anestesi")
public class IntraOperasiAnestesiController extends LocaleController<AsuhanKeperawatanPeriOperasiHeaderVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(IntraOperasiPerawatBedahController.class);
public class IntraOperasiAnestesiController extends LocaleController<AsuhanKeperawatanPeriOperasiHeaderVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(IntraOperasiAnestesiController.class);
@Autowired
private IntraOperasiAnestesiService intraOperasiAnestesiService;
@RequestMapping(
value = "/save-intra-operasi-anestesi",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-intra-operasi-anestesi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveIntraOperasiAnestesi(
@Valid @RequestBody AsuhanKeperawatanPeriOperasiHeaderVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = this.intraOperasiAnestesiService.saveInteraOperasiAnestesi(vo);
if (result != null)
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 saveIntraOperasiAnestesi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveInteraOperasiAnestesi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveIntraOperasiAnestesi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-list-intra-operasi-anestesi-by-notrans",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataByNoTrans(
@RequestParam(value = "notrans", required = true) String notrans, HttpServletRequest request) {
try {
Map<String, Object> result = this.intraOperasiAnestesiService.getInteraOperasiAnestesi(notrans);
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoadDataByNoTrans", 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 getLoadDataByNoTrans", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveInteraOperasiAnestesi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-pasien-operasi",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPasienDaftarOperasi(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
@RequestMapping(value = "/get-list-intra-operasi-anestesi-by-notrans", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataByNoTrans(@RequestParam(value = "notrans") String notrans,
HttpServletRequest request) {
try {
Map<String, Object> result = this.intraOperasiAnestesiService.getInteraOperasiAnestesi(notrans);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getInteraOperasiAnestesi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getInteraOperasiAnestesi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-pasien-operasi", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPasienDaftarOperasi(@RequestParam(value = "noRec") String noRec,
HttpServletRequest request) {
try {
Map<String, Object> result = this.intraOperasiAnestesiService.getPasienDaftarOperasi(noRec);
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getPasienDaftarOperasi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getPasienDaftarOperasi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getPasienDaftarOperasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getPasienDaftarOperasi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}

View File

@ -1,128 +1,104 @@
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.IntraOperasiPerawatBedahService;
import com.jasamedika.medifirst2000.vo.AsuhanKeperawatanPeriOperasiHeaderVO;
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.IntraOperasiPerawatBedahService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.AsuhanKeperawatanPeriOperasiHeaderVO;
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("/intra-operasi-perawat-bedah")
public class IntraOperasiPerawatBedahController extends LocaleController<AsuhanKeperawatanPeriOperasiHeaderVO> {
public class IntraOperasiPerawatBedahController extends LocaleController<AsuhanKeperawatanPeriOperasiHeaderVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(IntraOperasiPerawatBedahController.class);
@Autowired
private IntraOperasiPerawatBedahService intraOperasiPerawatBedahService;
@RequestMapping(
value = "/save-intra-operasi-bedah",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-intra-operasi-bedah", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveIntraOperasiPerawatBedah(
@Valid @RequestBody AsuhanKeperawatanPeriOperasiHeaderVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = this.intraOperasiPerawatBedahService.saveInteraOperasiPerawatBedah(vo);
if (result != null)
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 saveIntraOperasiPerawatBedah", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveInteraOperasiPerawatBedah", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveIntraOperasiPerawatBedah", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
LOGGER.error("Got JpaSystemException {} when saveInteraOperasiPerawatBedah", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-list-intra-operasi-perawat-bedah-by-notrans",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataByNoTrans(
@RequestParam(value = "notrans", required = true) String notrans, HttpServletRequest request) {
@RequestMapping(value = "/get-list-intra-operasi-perawat-bedah-by-notrans", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoadDataByNoTrans(@RequestParam(value = "notrans") String notrans,
HttpServletRequest request) {
try {
Map<String, Object> result = this.intraOperasiPerawatBedahService.getInteraOperasiPerwatanBedah(notrans);
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoadDataByNoTrans", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getInteraOperasiPerwatanBedah", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoadDataByNoTrans", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getInteraOperasiPerwatanBedah", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(
value = "get-pasien-operasi",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPasienDaftarOperasi(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
@RequestMapping(value = "get-pasien-operasi", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPasienDaftarOperasi(@RequestParam(value = "noRec") String noRec,
HttpServletRequest request) {
try {
Map<String, Object> result = this.intraOperasiPerawatBedahService.getPasienDaftarOperasi(noRec);
if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
} else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
return getJsonResponse(null, HttpStatus.NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getPasienDaftarOperasi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getPasienDaftarOperasi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getPasienDaftarOperasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getPasienDaftarOperasi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,243 +1,101 @@
package com.jasamedika.medifirst2000.controller;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.EnumMap;
import java.util.Map;
import javax.imageio.ImageIO;
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.IpsrsDataAlatService;
import com.jasamedika.medifirst2000.vo.RegistrasiAsetVO;
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.IpsrsDataAlatService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.IpsrsSertifikatKalibrasiVO;
import com.jasamedika.medifirst2000.vo.RegistrasiAsetVO;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
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;
@RestController
@RequestMapping("/ipsrs-data-alat")
public class IpsrsDataAlatController extends LocaleController<RegistrasiAsetVO>{
public class IpsrsDataAlatController extends LocaleController<RegistrasiAsetVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(IpsrsDataAlatController.class);
@Autowired
private IpsrsDataAlatService service;
private static final Logger LOGGER = LoggerFactory.getLogger(IpsrsDataAlatController.class);
@RequestMapping(value = "/get-all-registrasi-aset", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-all-registrasi-aset", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllRegistrasiAset(HttpServletRequest request) {
try {
Map<String,Object> result = service.getAllRegistrasiAset();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getAllRegistrasiAset();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getAllRegistrasiAset", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getAllRegistrasiAset", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getAllRegistrasiAset", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getAllRegistrasiAset", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-one-registrasi-aset", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getOneRegistrasiAset(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
try {
Map<String,Object> result = service.getOneRegistrasiAset(noRec);
if (null != result){
//serialQRCode(noRec);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getOneRegistrasiAset", 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 getOneRegistrasiAset", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-history-alat", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getHistoryAlat(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
try {
Map<String,Object> result = service.getHistoryAlat(noRec);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getHistoryAlat", 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 getHistoryAlat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/upload-sertifikat-kalibrasi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> uploadSertifikatKalibrasi(@Valid @RequestBody IpsrsSertifikatKalibrasiVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = service.uploadSertifikatKalibrasi(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 uploadSertifikatKalibrasi", 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 uploadSertifikatKalibrasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-sertifikat-kalibrasi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getSertifikatKalibrasi(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
@RequestMapping(value = "/get-one-registrasi-aset", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getOneRegistrasiAset(@RequestParam(value = "noRec") String noRec,
HttpServletRequest request) {
try {
Map<String,Object> result = service.getSertifikatKalibrasi(noRec);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getOneRegistrasiAset(noRec);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getSertifikatKalibrasi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getOneRegistrasiAset", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getSertifikatKalibrasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getOneRegistrasiAset", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/download-sertifikat-kalibrasi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> downloadSertifikatKalibrasi(
@RequestParam(value = "id", required = true) Integer id, HttpServletRequest request) {
try {
Map<String,Object> result = service.downloadSertifikatKalibrasi(id);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when downloadSertifikatKalibrasi", 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 downloadSertifikatKalibrasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
public byte[] serialQRCode(String value){
byte[] result = null;
try{
String filePath = "D:/serialQRCode.png";
int size = 250;
String fileType = "png";
File myFile = new File(filePath);
Map<EncodeHintType, Object> hintMap = new EnumMap<EncodeHintType, Object>(EncodeHintType.class);
hintMap.put(EncodeHintType.CHARACTER_SET, "UTF-8");
hintMap.put(EncodeHintType.MARGIN, 1);
hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
QRCodeWriter qrCodeWriter = new QRCodeWriter();
BitMatrix byteMatrix = qrCodeWriter.encode(value, BarcodeFormat.QR_CODE, size, size, hintMap);
int CrunchifyWidth = byteMatrix.getWidth();
BufferedImage image = new BufferedImage(CrunchifyWidth, CrunchifyWidth, BufferedImage.TYPE_INT_RGB);
image.createGraphics();
Graphics2D graphics = (Graphics2D) image.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, CrunchifyWidth, CrunchifyWidth);
graphics.setColor(Color.BLACK);
for (int i = 0; i < CrunchifyWidth; i++) {
for (int j = 0; j < CrunchifyWidth; j++) {
if (byteMatrix.get(i, j)) {
graphics.fillRect(i, j, 1, 1);
}
}
}
ImageIO.write(image, fileType, myFile);
}catch(Exception ex){
ex.printStackTrace();
}
return result;
}
@RequestMapping(value = "/get-jenis-produk",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-jenis-produk", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getJenisProduk(HttpServletRequest request) {
try {
Map<String,Object> result = service.getAllJenisProdukByIpsrs();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getAllJenisProdukByIpsrs();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getJenisProduk", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getAllJenisProdukByIpsrs", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getJenisProduk", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getAllJenisProdukByIpsrs", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,263 +1,77 @@
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.IpsrsMaintenanceService;
import com.jasamedika.medifirst2000.vo.IpsrsPemeliharaanVO;
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.IpsrsMaintenanceService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.IpsrsMaintenanceVO;
import com.jasamedika.medifirst2000.vo.IpsrsPemeliharaanVO;
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_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;
@RestController
@RequestMapping("/ipsrs-maintenance")
public class IpsrsMaintenanceController extends LocaleController<IpsrsPemeliharaanVO>{
public class IpsrsMaintenanceController extends LocaleController<IpsrsPemeliharaanVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(IpsrsMaintenanceController.class);
@Autowired
private IpsrsMaintenanceService service;
private static final Logger LOGGER = LoggerFactory.getLogger(IpsrsMaintenanceController.class);
@RequestMapping(value = "/get-ruangan-maintenance", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-ruangan-maintenance", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getRuanganMaintenance(HttpServletRequest request) {
try {
Map<String,Object> result = service.getRuanganMaintenance();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getRuanganMaintenance();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getRuanganMaintenance", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getRuanganMaintenance", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getRuanganMaintenance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getRuanganMaintenance", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-aset-maintenance", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAsetMaintenance(@RequestParam(value = "id", required = true) Integer id, HttpServletRequest request) {
try {
Map<String,Object> result = service.getAsetMaintenance(id);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getAsetMaintenance", 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 getAsetMaintenance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-teknisi-maintenace", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getTeknisiMaintenance(HttpServletRequest request) {
try {
Map<String,Object> result = service.getTeknisiMaintenance();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getTeknisiMaintenance", 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 getTeknisiMaintenance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-rekanan-maintenance", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-rekanan-maintenance", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getRekananMaintenance(HttpServletRequest request) {
try {
Map<String,Object> result = service.getRekananMaintenance();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getRekananMaintenance();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getRekananMaintenance", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getRekananMaintenance", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getRekananMaintenance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-maintenance", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveMaintenance(@Valid @RequestBody IpsrsMaintenanceVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = service.saveMaintenance(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 saveMaintenance", 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 saveMaintenance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-maintenance", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateMaintenance(@Valid @RequestBody IpsrsMaintenanceVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = service.updateMaintenance(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 updateMaintenance", 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 updateMaintenance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-jadwal-pemeliharaan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getJadwalMaintenance(HttpServletRequest request) {
try {
Map<String,Object> result = service.getJadwalPemeliharaan();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getJadwalPemeliharaan", 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 getJadwalPemeliharaan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-jadwal-kontak-service", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getJadwalKontakService(HttpServletRequest request) {
try {
Map<String,Object> result = service.getJadwalKontakService();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getJadwalKontakService", 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 getJadwalKontakService", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-jadwal-kalibrasi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getJadwalKalibrasi(HttpServletRequest request) {
try {
Map<String,Object> result = service.getJadwalKalibrasi();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getJadwalKalibrasi", 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 getJadwalKalibrasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-all-aset-maintenance", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllAsetMaintenance(HttpServletRequest request) {
try {
Map<String,Object> result = service.getAllAsetMaintenance();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getAllAsetMaintenance", 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 getAllAsetMaintenance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-alert-maintenance", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAlertPemeliharaan(HttpServletRequest request) {
try {
Map<String,Object> result = service.getAlertMaintenance();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getAlertPemeliharaan", 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 getAlertPemeliharaan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getRekananMaintenance", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}

View File

@ -1,76 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
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.IpsrsMonevMaintenanceService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.IpsrsMaintenanceVO;
@RestController
@RequestMapping("/ipsrs-monev-maintenance")
public class IpsrsMonevMaintenanceController extends LocaleController<IpsrsMaintenanceVO>{
@Autowired
private IpsrsMonevMaintenanceService service;
private static final Logger LOGGER = LoggerFactory.getLogger(IpsrsMonevMaintenanceController.class);
@RequestMapping(value = "/get-rekanan-by-jadwal", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getRekananByJadwal(HttpServletRequest request) {
try {
Map<String,Object> result = service.getRekananByJadwal();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getRekananByJadwal", 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 getRekananByJadwal", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-kontak-service", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getKontakService(
@RequestParam(value = "rekananId", required = true) Integer rekananId, HttpServletRequest request) {
try {
Map<String,Object> result = service.getKontakService(rekananId);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getKontakService", 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 getKontakService", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,212 +1,187 @@
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.IpsrsPemakaianMesinService;
import com.jasamedika.medifirst2000.vo.IpsrsPemakaianMesinVO;
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.IpsrsPemakaianMesinService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.IpsrsPemakaianMesinVO;
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("/ipsrs-pemakaian-mesin")
public class IpsrsPemakaianMesinController extends LocaleController<IpsrsPemakaianMesinVO>{
public class IpsrsPemakaianMesinController extends LocaleController<IpsrsPemakaianMesinVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(IpsrsPemakaianMesinController.class);
@Autowired
private IpsrsPemakaianMesinService service;
private static final Logger LOGGER = LoggerFactory.getLogger(IpsrsPemakaianMesinController.class);
@RequestMapping(value = "/get-login-user/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-login-user/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoginUser(HttpServletRequest request) {
try {
Map<String,Object> result = service.getUserLogin();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getUserLogin();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getPetugasPeminjamanAlat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getUserLogin", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getPetugasPeminjamanAlat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getUserLogin", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-jenis-mesin", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-jenis-mesin", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getJenisMesin(HttpServletRequest request) {
try {
Map<String, Object> result = service.getJenisMesin();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getJenisMesin", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getJenisMesin", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getJenisMesin", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getJenisMesin", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-data-mesin", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getDataMesin(@RequestParam(value = "id", required = true) Integer id, HttpServletRequest request) {
@RequestMapping(value = "/get-data-mesin", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getDataMesin(@RequestParam(value = "id") Integer id,
HttpServletRequest request) {
try {
Map<String, Object> result = service.getDataMesin(id);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getDataMesin", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getDataMesin", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getDataMesin", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getDataMesin", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-all-pemakaian-boiler", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-all-pemakaian-boiler", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllPemakaianBoiler(HttpServletRequest request) {
try {
Map<String, Object> result = service.getAllPemakaianBoiler();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getAllPemakaianBoiler", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getAllPemakaianBoiler", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getAllPemakaianBoiler", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getAllPemakaianBoiler", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-all-pemakaian-genset", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-all-pemakaian-genset", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllPemakaianGenset(HttpServletRequest request) {
try {
Map<String, Object> result = service.getAllPemakaianGenset();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getAllPemakaianGenset", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getAllPemakaianGenset", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getAllPemakaianGenset", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getAllPemakaianGenset", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-pemakaian-mesin", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePemakaianMesin(@Valid @RequestBody IpsrsPemakaianMesinVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = service.savePemakaianMesin(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 savePemakaianMesin", 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 savePemakaianMesin", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/delete-pemakaian-mesin", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> deletePemakaianMesin(
@RequestParam(value = "noRec", required = true) String noRec,
@RequestMapping(value = "/save-pemakaian-mesin", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePemakaianMesin(@Valid @RequestBody IpsrsPemakaianMesinVO vo,
HttpServletRequest request) {
try {
Boolean status = service.deletePemakaianMesin(noRec);
if (status){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse("noRec : "+noRec, HttpStatus.OK);
} else{
return RestUtil.getJsonResponse("noRec : null", HttpStatus.BAD_REQUEST);
}
Map<String, Object> result = service.savePemakaianMesin(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 deletePemakaianMesin", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePemakaianMesin", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when deletePemakaianMesin", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePemakaianMesin", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/pemakaian-mesin-boiler")
public Map<String,Object> pemakaianMesinBoiler(
public Map<String, Object> pemakaianMesinBoiler(
@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 = "tanggalAwal", required = false) String tanggalAwal,
@RequestParam(value = "tanggalAhir", required = false) String tanggalAhir) {
Map<String, Object> resultPageMap = service.pemakaianBoiler(page, limit, sort, dir, tanggalAwal, tanggalAhir);
return resultPageMap;
return service.pemakaianBoiler(page, limit, sort, dir, tanggalAwal, tanggalAhir);
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/pemakaian-mesin-genset")
public Map<String,Object> pemakaianMesinGenset(
public Map<String, Object> pemakaianMesinGenset(
@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 = "tanggalAwal", required = false) String tanggalAwal,
@RequestParam(value = "tanggalAhir", required = false) String tanggalAhir) {
Map<String, Object> resultPageMap = service.pemakaianGenset(page, limit, sort, dir, tanggalAwal, tanggalAhir);
return resultPageMap;
return service.pemakaianGenset(page, limit, sort, dir, tanggalAwal, tanggalAhir);
}
}

View File

@ -1,192 +1,192 @@
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.IpsrsPemakaianRuanganService;
import com.jasamedika.medifirst2000.vo.IpsrsPemakaianRuanganVO;
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.IpsrsPemakaianRuanganService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.IpsrsPemakaianRuanganVO;
import org.springframework.web.bind.annotation.*;
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("/ipsrs-pemakaian-ruangan")
public class IpsrsPemakaianRuanganController extends LocaleController<IpsrsPemakaianRuanganVO>{
public class IpsrsPemakaianRuanganController extends LocaleController<IpsrsPemakaianRuanganVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(IpsrsPemakaianRuanganController.class);
@Autowired
private IpsrsPemakaianRuanganService service;
private static final Logger LOGGER = LoggerFactory.getLogger(IpsrsPemakaianRuanganController.class);
@RequestMapping(value = "/get-ruangan-pemakaian", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-ruangan-pemakaian", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getRuanganPemakaian(HttpServletRequest request) {
try {
Map<String,Object> result = service.getRuanganPemakaianRuangan();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getRuanganPemakaianRuangan();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getRuanganPemakaian", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getRuanganPemakaianRuangan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getRuanganPemakaian", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getRuanganPemakaianRuangan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-jenis-pemakaian", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-jenis-pemakaian", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getJenisPemakaianRuangan(HttpServletRequest request) {
try {
Map<String,Object> result = service.getJenisPemakaianRuangan();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getJenisPemakaianRuangan();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getJenisPemakaianRuangan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getJenisPemakaianRuangan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getJenisPemakaianRuangan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getJenisPemakaianRuangan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-kapasitas-jenis-pemakaian", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getKapasitasJenisPemakaianRuangan(@RequestParam(value = "id", required = true) Integer id, HttpServletRequest request) {
try {
Map<String,Object> result = service.getKapasitasJenisPemakaianRuangan(id);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getKapasitasJenisPemakaianRuangan", 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 getSatuanPgetKapasitasJenisPemakaianRuanganemakaian", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-pemakaian-ruangan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePemakaianRuangan(@Valid @RequestBody IpsrsPemakaianRuanganVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = service.savePemakaianRuangan(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 savePemakaianRuangan", 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 savePemakaianRuangan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-all-pemakaian-ruangan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllPemakaianRuangan(HttpServletRequest request) {
try {
Map<String,Object> result = service.getAllPemakaianRuangan();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getAllPemakaianRuangan", 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 getAllPemakaianRuangan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/delete-pemakaian-ruangan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> deletePemakaianRuangan(
@RequestParam(value = "noRec", required = true) String noRec,
@RequestMapping(value = "/get-kapasitas-jenis-pemakaian", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getKapasitasJenisPemakaianRuangan(@RequestParam(value = "id") Integer id,
HttpServletRequest request) {
try {
Boolean status = service.deletePemakaianRuangan(noRec);
if (status){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse("noRec : "+noRec, HttpStatus.OK);
} else{
return RestUtil.getJsonResponse("noRec : null", HttpStatus.BAD_REQUEST);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when deletePemakaianRuangan", 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 deletePemakaianRuangan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-periode", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findDaftarPemakaianRuanganByPeriode(
@RequestParam(value = "periodeAwal", required = true) String periodeAwal,
@RequestParam(value = "periodeAkhir", required = true) String periodeAkhir,
@RequestParam(value = "id", required = true) Integer id, HttpServletRequest request) {
try {
Map<String,Object> result = service.findDaftarPemakaianRuanganByPeriode(periodeAwal, periodeAkhir, id);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getKapasitasJenisPemakaianRuangan(id);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when findDaftarKendaraanDinasByPeriode", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getKapasitasJenisPemakaianRuangan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when findDaftarKendaraanDinasByPeriode", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getKapasitasJenisPemakaianRuangan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/save-pemakaian-ruangan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePemakaianRuangan(@Valid @RequestBody IpsrsPemakaianRuanganVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = service.savePemakaianRuangan(vo);
if (null != result)
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when savePemakaianRuangan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when savePemakaianRuangan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-all-pemakaian-ruangan", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllPemakaianRuangan(HttpServletRequest request) {
try {
Map<String, Object> result = service.getAllPemakaianRuangan();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getAllPemakaianRuangan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getAllPemakaianRuangan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/delete-pemakaian-ruangan", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<String> deletePemakaianRuangan(@RequestParam(value = "noRec") String noRec,
HttpServletRequest request) {
try {
boolean status = service.deletePemakaianRuangan(noRec);
if (status) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse("noRec : " + noRec, OK);
} else {
return getJsonResponse("noRec : null", HttpStatus.BAD_REQUEST);
}
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when deletePemakaianRuangan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when deletePemakaianRuangan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-periode", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findDaftarPemakaianRuanganByPeriode(
@RequestParam(value = "periodeAwal") String periodeAwal,
@RequestParam(value = "periodeAkhir") String periodeAkhir, @RequestParam(value = "id") Integer id,
HttpServletRequest request) {
try {
Map<String, Object> result = service.findDaftarPemakaianRuanganByPeriode(periodeAwal, periodeAkhir, id);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when findDaftarPemakaianRuanganByPeriode", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when findDaftarPemakaianRuanganByPeriode", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/pemakaian-air")
public Map<String,Object> pemakaianMesinGenset(
public Map<String, Object> pemakaianMesinGenset(
@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,
@ -194,9 +194,7 @@ public class IpsrsPemakaianRuanganController extends LocaleController<IpsrsPemak
@RequestParam(value = "tanggalAwal", required = false) String tanggalAwal,
@RequestParam(value = "tanggalAhir", required = false) String tanggalAhir,
@RequestParam(value = "ruanganId", required = false) Integer ruanganId) {
Map<String, Object> resultPageMap = service.pemakaianAir(page, limit, sort, dir, tanggalAwal, tanggalAhir,ruanganId);
return resultPageMap;
return service.pemakaianAir(page, limit, sort, dir, tanggalAwal, tanggalAhir, ruanganId);
}
}

View File

@ -1,248 +1,205 @@
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.IpsrsPeminjamanAlatService;
import com.jasamedika.medifirst2000.vo.IpsrsPeminjamanAlatVO;
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.IpsrsPeminjamanAlatService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.IpsrsPeminjamanAlatVO;
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("/ipsrs-peminjaman-alat")
public class IpsrsPeminjamanAlatController extends LocaleController<IpsrsPeminjamanAlatVO>{
public class IpsrsPeminjamanAlatController extends LocaleController<IpsrsPeminjamanAlatVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(IpsrsPeminjamanAlatController.class);
@Autowired
private IpsrsPeminjamanAlatService service;
private static final Logger LOGGER = LoggerFactory.getLogger(IpsrsPeminjamanAlatController.class);
@RequestMapping(value = "/get-login-user/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-login-user/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoginUser(HttpServletRequest request) {
try {
Map<String,Object> result = service.getUserLogin();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getUserLogin();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getPetugasPeminjamanAlat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getUserLogin", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getPetugasPeminjamanAlat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemExceptions {} when getUserLogin", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-no-peminjaman-alat", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-no-peminjaman-alat", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getNoOrder(HttpServletRequest request) {
try {
Map<String, Object> result = service.getNoPeminjamanAlatTable();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getJadwalPemeliharaan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getNoPeminjamanAlatTable", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getJadwalPemeliharaan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getNoPeminjamanAlatTable", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-ruangan-peminjaman-alat", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-ruangan-peminjaman-alat", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getRuanganPeminjamanAlat(HttpServletRequest request) {
try {
Map<String, Object> result = service.getRuanganPeminjamanAlat();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getRuanganPeminjamanAlat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getRuanganPeminjamanAlat", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getRuanganPeminjamanAlat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getRuanganPeminjamanAlat", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-aset-peminjaman-alat", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAsetPeminjamanAlat(@RequestParam(value = "id", required = true) Integer id, HttpServletRequest request) {
@RequestMapping(value = "/get-aset-peminjaman-alat", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAsetPeminjamanAlat(@RequestParam(value = "id") Integer id,
HttpServletRequest request) {
try {
Map<String,Object> result = service.getAsetPeminjamanAlat(id);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getAsetPeminjamanAlat(id);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getAsetPeminjamanAlat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getAsetPeminjamanAlat", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getAsetPeminjamanAlat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getAsetPeminjamanAlat", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-petugas-peminjaman-alat", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-petugas-peminjaman-alat", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPetugasPeminjamanAlat(HttpServletRequest request) {
try {
Map<String,Object> result = service.getPetugasPeminjamanAlat();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getPetugasPeminjamanAlat();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getPetugasPeminjamanAlat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getPetugasPeminjamanAlat", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getPetugasPeminjamanAlat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getPetugasPeminjamanAlat", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-peminjaman-alat", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePemeliharaan(@Valid @RequestBody IpsrsPeminjamanAlatVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = service.savePeminjamanAlat(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 savePemeliharaan", 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 savePemeliharaan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-all-peminjaman-alat", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllPeminjamanAlat(@RequestParam(value = "status", required = true) String status,
@RequestMapping(value = "/save-peminjaman-alat", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePemeliharaan(@Valid @RequestBody IpsrsPeminjamanAlatVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result = service.getAllPeminjamanAlat(status);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
Map<String, Object> result = service.savePeminjamanAlat(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 getAllPeminjamanAlat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePeminjamanAlat", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getAllPeminjamanAlat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePeminjamanAlat", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/delete-pemakaian-ruangan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> deletePeminjamanAlat(
@RequestParam(value = "noRec", required = true) String noRec,
@RequestMapping(value = "/get-all-peminjaman-alat", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllPeminjamanAlat(@RequestParam(value = "status") String status,
HttpServletRequest request) {
try {
Boolean status = service.deletePeminjamanAlat(noRec);
if (status){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse("noRec : "+noRec, HttpStatus.OK);
} else{
return RestUtil.getJsonResponse("noRec : null", HttpStatus.BAD_REQUEST);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when deletePeminjamanAlat", 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 deletePeminjamanAlat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-periode", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findPeminjamanAlatByPeriode(
@RequestParam(value = "periodeAwal", required = true) String periodeAwal,
@RequestParam(value = "periodeAkhir", required = true) String periodeAkhir,
@RequestParam(value = "id", required = true) Integer id,
@RequestParam(value = "status", required = true) String status, HttpServletRequest request) {
try {
Map<String,Object> result = service.findPeminjamanAlatByPeriode(periodeAwal, periodeAkhir, id, status);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getAllPeminjamanAlat(status);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when findPeminjamanAlatByPeriode", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getAllPeminjamanAlat", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when findPeminjamanAlatByPeriode", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getAllPeminjamanAlat", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-status-peminjaman", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateStatusPeminjaman(@Valid @RequestBody IpsrsPeminjamanAlatVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = service.updateStatusPeminjaman(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
@RequestMapping(value = "/update-status-peminjaman", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateStatusPeminjaman(@Valid @RequestBody IpsrsPeminjamanAlatVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = service.updateStatusPeminjaman(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 updateStatusPeminjaman", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when updateStatusPeminjaman", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when updateStatusPeminjaman", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when updateStatusPeminjaman", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}

View File

@ -9,10 +9,12 @@ import com.jasamedika.medifirst2000.vo.IpsrsPerbaikanVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
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 javax.validation.Valid;
@ -20,7 +22,7 @@ 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.getJsonHttptatus;
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;
@ -31,11 +33,11 @@ import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RequestMapping("/ipsrs-perbaikan")
public class IpsrsPerbaikanController extends LocaleController<IpsrsPerbaikanVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(IpsrsPerbaikanController.class);
@Autowired
private IpsrsPerbaikanService service;
private static final Logger LOGGER = LoggerFactory.getLogger(IpsrsPerbaikanController.class);
@RequestMapping(value = "/save-permintaan-perbaikan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePermintaanPerbaikan(@Valid @RequestBody IpsrsPerbaikanVO vo,
HttpServletRequest request) {
@ -52,11 +54,11 @@ public class IpsrsPerbaikanController extends LocaleController<IpsrsPerbaikanVO>
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when savePermintaanPerbaikan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when savePermintaanPerbaikan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@ -73,11 +75,11 @@ public class IpsrsPerbaikanController extends LocaleController<IpsrsPerbaikanVO>
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getRuanganPerbaikan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getRuanganPerbaikan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@ -95,11 +97,11 @@ public class IpsrsPerbaikanController extends LocaleController<IpsrsPerbaikanVO>
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getAsetPerbaikan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getAsetPerbaikan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@ -117,11 +119,11 @@ public class IpsrsPerbaikanController extends LocaleController<IpsrsPerbaikanVO>
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getOnePermintaanPerbaikan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getOnePermintaanPerbaikan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@ -136,11 +138,11 @@ public class IpsrsPerbaikanController extends LocaleController<IpsrsPerbaikanVO>
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when savePelaksanaanPerbaikan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when savePelaksanaanPerbaikan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@ -156,13 +158,13 @@ public class IpsrsPerbaikanController extends LocaleController<IpsrsPerbaikanVO>
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when updatePermintaanPerbaikan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when updatePermintaanPerbaikan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
return getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE);
return getJsonHttpStatus(NOT_ACCEPTABLE);
}
}

View File

@ -1,143 +1,124 @@
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.IpsrsPreventiveMaintenanceService;
import com.jasamedika.medifirst2000.vo.IpsrsPemeliharaanVO;
import com.jasamedika.medifirst2000.vo.IpsrsPreventiveMaintenanceVO;
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.IpsrsPreventiveMaintenanceService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.IpsrsPemeliharaanVO;
import com.jasamedika.medifirst2000.vo.IpsrsPreventiveMaintenanceVO;
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("/ipsrs-preventive-maintenance")
public class IpsrsPreventiveMaintenanceController extends LocaleController<IpsrsPemeliharaanVO>{
public class IpsrsPreventiveMaintenanceController extends LocaleController<IpsrsPemeliharaanVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(IpsrsPreventiveMaintenanceController.class);
@Autowired
private IpsrsPreventiveMaintenanceService service;
private static final Logger LOGGER = LoggerFactory.getLogger(IpsrsPreventiveMaintenanceController.class);
@RequestMapping(value = "/get-login-user/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoginUser(HttpServletRequest request) {
try {
Map<String,Object> result = service.getUserLogin();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getPetugasPeminjamanAlat", 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 getPetugasPeminjamanAlat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-aset-preventive-maintenance", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-aset-preventive-maintenance", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAsetPreventiveMaintenance(HttpServletRequest request) {
try {
Map<String,Object> result = service.getAsetPreventiveMaintenance();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getAsetPreventiveMaintenance();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getAllRegistrasi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getAsetPreventiveMaintenance", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getAllRegistrasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getAsetPreventiveMaintenance", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-bagian-alat", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getBagianAlat(@RequestParam(value = "id", required = true) Integer id, HttpServletRequest request) {
try {
Map<String,Object> result = service.getBagianAlat(id);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getBagianAlat", 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 getBagianAlat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-preventive-maintenance", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveMaintenance(@Valid @RequestBody IpsrsPreventiveMaintenanceVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = service.savePreventiveMaintenance(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
@RequestMapping(value = "/get-bagian-alat", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getBagianAlat(@RequestParam(value = "id") Integer id,
HttpServletRequest request) {
try {
Map<String, Object> result = service.getBagianAlat(id);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when saveMaintenance", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getBagianAlat", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveMaintenance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getBagianAlat", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-user-verifikasi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-preventive-maintenance", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveMaintenance(@Valid @RequestBody IpsrsPreventiveMaintenanceVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = service.savePreventiveMaintenance(vo);
if (null != result)
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when savePreventiveMaintenance", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when savePreventiveMaintenance", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-user-verifikasi", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getUserVerifikasi(HttpServletRequest request) {
try {
Map<String,Object> result = service.getUserVerifikasi();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getUserVerifikasi();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getUserVerifikasi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getUserVerifikasi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getUserVerifikasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getUserVerifikasi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,185 +1,190 @@
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.IpsrsTagihanBusinessCenterService;
import com.jasamedika.medifirst2000.vo.IpsrsTagihanBusinessCenterVO;
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.IpsrsTagihanBusinessCenterService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.IpsrsTagihanBusinessCenterVO;
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("/ipsrs-tagihan-business-center")
public class IpsrsTagihanBusinessCenterController extends LocaleController<IpsrsTagihanBusinessCenterVO>{
public class IpsrsTagihanBusinessCenterController extends LocaleController<IpsrsTagihanBusinessCenterVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(IpsrsTagihanBusinessCenterController.class);
@Autowired
private IpsrsTagihanBusinessCenterService service;
private static final Logger LOGGER = LoggerFactory.getLogger(IpsrsTagihanBusinessCenterController.class);
@RequestMapping(value = "/get-ruangan-business-center", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-ruangan-business-center", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getRuanganTagihanBusinessCenter(HttpServletRequest request) {
try {
Map<String,Object> result = service.getRuanganTagihanBusinessCenter();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getRuanganTagihanBusinessCenter();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getRuanganTagihanBusinessCenter", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getRuanganTagihanBusinessCenter", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getRuanganTagihanBusinessCenter", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getRuanganTagihanBusinessCenter", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-jenis-business-center", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-jenis-business-center", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getJenisPemakaianBusinessCenter(HttpServletRequest request) {
try {
Map<String,Object> result = service.getJenisPemakaianBusinessCenter();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getJenisPemakaianBusinessCenter();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getJenisPemakaianBusinessCenter", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getJenisPemakaianBusinessCenter", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getJenisPemakaianBusinessCenter", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getJenisPemakaianBusinessCenter", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-kapasitas-jenis-business-center", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getKapasitasJenisPemakaianBusinessCenter(@RequestParam(value = "id", required = true) Integer id, HttpServletRequest request) {
try {
Map<String,Object> result = service.getKapasitasJenisPemakaianBusinessCenter(id);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getKapasitasJenisPemakaianBusinessCenter", 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 getKapasitasJenisPemakaianBusinessCenter", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-business-center", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveBusinessCenter(@Valid @RequestBody IpsrsTagihanBusinessCenterVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = service.saveTagihanBusinessCenter(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 saveBusinessCenter", 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 saveBusinessCenter", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-all-business-center", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllBusinessCenter(HttpServletRequest request) {
@RequestMapping(value = "/get-kapasitas-jenis-business-center", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getKapasitasJenisPemakaianBusinessCenter(
@RequestParam(value = "id") Integer id, HttpServletRequest request) {
try {
Map<String,Object> result = service.getAllTagihanBusinessCenter();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getKapasitasJenisPemakaianBusinessCenter(id);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getAllBusinessCenter", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getKapasitasJenisPemakaianBusinessCenter", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getAllBusinessCenter", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getKapasitasJenisPemakaianBusinessCenter", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/delete-business-center", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> deleteBusinessCenter(
@RequestParam(value = "noRec", required = true) String noRec,
@RequestMapping(value = "/save-business-center", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveBusinessCenter(@Valid @RequestBody IpsrsTagihanBusinessCenterVO vo,
HttpServletRequest request) {
try {
Boolean status = service.deleteTagihanBusinessCenter(noRec);
if (status){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse("noRec : "+noRec, HttpStatus.OK);
} else{
return RestUtil.getJsonResponse("noRec : null", HttpStatus.BAD_REQUEST);
}
Map<String, Object> result = service.saveTagihanBusinessCenter(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 deleteBusinessCenter", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveTagihanBusinessCenter", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when deleteBusinessCenter", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveTagihanBusinessCenter", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-periode", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findTagihanBusinessCenterByPeriode(
@RequestParam(value = "periodeAwal", required = true) String periodeAwal,
@RequestParam(value = "periodeAkhir", required = true) String periodeAkhir,
@RequestParam(value = "id", required = true) Integer id, HttpServletRequest request) {
@RequestMapping(value = "/get-all-business-center", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllBusinessCenter(HttpServletRequest request) {
try {
Map<String,Object> result = service.findTagihanBusinessCenterByPeriode(periodeAwal, periodeAkhir, id);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getAllTagihanBusinessCenter();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when findTagihanBusinessCenterByPeriode", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getAllTagihanBusinessCenter", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when findTagihanBusinessCenterByPeriode", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getAllTagihanBusinessCenter", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/delete-business-center", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<String> deleteBusinessCenter(@RequestParam(value = "noRec") String noRec,
HttpServletRequest request) {
try {
boolean status = service.deleteTagihanBusinessCenter(noRec);
if (status) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse("noRec : " + noRec, OK);
} else {
return getJsonResponse("noRec : null", BAD_REQUEST);
}
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when deleteTagihanBusinessCenter", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when deleteTagihanBusinessCenter", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-periode", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findTagihanBusinessCenterByPeriode(
@RequestParam(value = "periodeAwal") String periodeAwal,
@RequestParam(value = "periodeAkhir") String periodeAkhir, @RequestParam(value = "id") Integer id,
HttpServletRequest request) {
try {
Map<String, Object> result = service.findTagihanBusinessCenterByPeriode(periodeAwal, periodeAkhir, id);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when findTagihanBusinessCenterByPeriode", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when findTagihanBusinessCenterByPeriode", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,74 +1,57 @@
package com.jasamedika.medifirst2000.controller;
import java.util.List;
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.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.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.dto.ItJadwalPerawatanDto;
import com.jasamedika.medifirst2000.dto.PenerimaanLinenDto;
import com.jasamedika.medifirst2000.service.ItJadwalPerawatanService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
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.INTERNAL_SERVER_ERROR;
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;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/it-jadwal-perawatan")
public class ItJadwalPerawatanController extends LocaleController{
public class ItJadwalPerawatanController extends LocaleController<ItJadwalPerawatanDto> {
@Autowired
private ItJadwalPerawatanService itJadwalPerawatanService;
@RequestMapping(value="/save-jadwal", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveJadwalPerawatan(
@RequestBody ItJadwalPerawatanDto dto, HttpServletRequest request) {
@RequestMapping(value = "/save-jadwal", method = POST, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveJadwalPerawatan(@RequestBody ItJadwalPerawatanDto dto,
HttpServletRequest request) {
Map<String, Object> result = this.itJadwalPerawatanService.saveJadwalPerawatan(dto);
if (!result.isEmpty()) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
}
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
}
// @RequestMapping(value = "/get-jadwal-perawatan",
// method = RequestMethod.GET,
// produces = MediaType.APPLICATION_JSON_VALUE)
// public Map<String, Object> getJadwalPerawatanIt(
// @RequestParam(value = "startDate") String startDate,
// @RequestParam(value = "endDate") String endDate
// ) {
// Map<String, Object> result = this.itJadwalPerawatanService.getJadwalPerawatanAll(startDate, endDate);
// return result;
// }
@RequestMapping(value = "/get-jadwal-perawatan-by-norec",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getJadwalPerawatanByNoRec(
@RequestParam(value = "noRec") String noRec) {
Map<String, Object> result = this.itJadwalPerawatanService.getJadwalPerawatanbyNoRec(noRec);
return result;
@RequestMapping(value = "/get-jadwal-perawatan-by-norec", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getJadwalPerawatanByNoRec(@RequestParam(value = "noRec") String noRec) {
return this.itJadwalPerawatanService.getJadwalPerawatanbyNoRec(noRec);
}
@RequestMapping(value="/save-realisasi-jadwal", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveRealisasiJadwalPerawatan(
@RequestBody ItJadwalPerawatanDto dto, HttpServletRequest request) {
@RequestMapping(value = "/save-realisasi-jadwal", method = POST, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveRealisasiJadwalPerawatan(@RequestBody ItJadwalPerawatanDto dto,
HttpServletRequest request) {
Map<String, Object> result = this.itJadwalPerawatanService.saveRealisasiJadwalPerawatan(dto);
if (!result.isEmpty()) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
}
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
}
}

View File

@ -23,7 +23,7 @@ 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.getJsonHttptatus;
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;
@ -34,11 +34,11 @@ import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RequestMapping("/it-perbaikan")
public class ItPerbaikanController extends LocaleController<ItPerbaikanVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(ItPerbaikanController.class);
@Autowired
private ItPerbaikanService service;
private static final Logger LOGGER = LoggerFactory.getLogger(ItPerbaikanController.class);
@RequestMapping(value = "/get-no-order", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getNoOrder(HttpServletRequest request) {
try {
@ -50,13 +50,13 @@ public class ItPerbaikanController extends LocaleController<ItPerbaikanVO> {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when get no order", e.getMessage());
LOGGER.error("Got ServiceVOException {} when getNoOrderTable", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when get no order", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when getNoOrderTable", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@ -74,13 +74,13 @@ public class ItPerbaikanController extends LocaleController<ItPerbaikanVO> {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when save permintaan perbaikan", e.getMessage());
LOGGER.error("Got ServiceVOException {} when savePermintaanPerbaikan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when save permintaan perbaikan", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when savePermintaanPerbaikan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@ -95,13 +95,13 @@ public class ItPerbaikanController extends LocaleController<ItPerbaikanVO> {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when find ruangan asset", e.getMessage());
LOGGER.error("Got ServiceVOException {} when getRuanganPerbaikan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when find ruangan asset", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when getRuanganPerbaikan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@ -117,13 +117,13 @@ public class ItPerbaikanController extends LocaleController<ItPerbaikanVO> {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when find asset by ruangan", e.getMessage());
LOGGER.error("Got ServiceVOException {} when getAsetPerbaikan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when find asset by ruangan", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when getAsetPerbaikan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@ -136,13 +136,13 @@ public class ItPerbaikanController extends LocaleController<ItPerbaikanVO> {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when save pelaksanaan perbaikan", e.getMessage());
LOGGER.error("Got ServiceVOException {} when savePelaksanaanPerbaikanRev1", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when save pelaksanaan perbaikan", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when savePelaksanaanPerbaikanRev1", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@ -158,13 +158,13 @@ public class ItPerbaikanController extends LocaleController<ItPerbaikanVO> {
return getJsonResponse("noRec : null", HttpStatus.BAD_REQUEST);
}
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when delete list perbaikan", e.getMessage());
LOGGER.error("Got ServiceVOException {} when deleteItPerbaikan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when delete list perbaikan", jse.getMessage());
LOGGER.error("Got JpaSystemException {} when deleteItPerbaikan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage);
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}

View File

@ -1,178 +1,109 @@
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.JabatanService;
import com.jasamedika.medifirst2000.vo.JabatanVO;
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 org.springframework.web.bind.annotation.*;
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.JabatanService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.AgamaVO;
import com.jasamedika.medifirst2000.vo.JabatanVO;
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("/jabatan")
public class JabatanController extends LocaleController<JabatanVO> implements IBaseRestController<JabatanVO> {
public class JabatanController extends LocaleController<JabatanVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(JabatanController.class);
@Autowired
private JabatanService jabatanService;
private static final Logger LOGGER = LoggerFactory.getLogger(JabatanController.class);
@Override
public ResponseEntity<Collection<JabatanVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<JabatanVO> getVO(Integer id) {
return null;
}
@RequestMapping(value = "/save-jabatan-internal/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-jabatan-internal/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<String> addVO(@Valid @RequestBody JabatanVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = jabatanService.saveJabatan(vo);// saveJabatanInternal(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result.toString(), HttpStatus.CREATED, mapHeaderMessage);
Map<String, Object> result = jabatanService.saveJabatan(vo);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result.toString(), CREATED, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Agama", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveJabatan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Agama", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveJabatan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
return getJsonHttpStatus(NOT_ACCEPTABLE);
}
@RequestMapping(value = "/update-jabatan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/update-jabatan/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<String> editVO(@Valid @RequestBody JabatanVO vo) {
try {
JabatanVO result = (JabatanVO) jabatanService.update(vo);
JabatanVO result = jabatanService.update(vo);
if (null != result)
return RestUtil.getJsonResponse("", HttpStatus.OK);
return getJsonResponse("", OK);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when update Agama", 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 Agama", 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 = "/update-jabatan-false/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/update-jabatan-false/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<String> editFalseVO(@Valid @RequestBody JabatanVO vo) {
try {
JabatanVO result = (JabatanVO) jabatanService.deleteJabatan(vo);
JabatanVO result = jabatanService.deleteJabatan(vo);
if (null != result)
return RestUtil.getJsonResponse("", HttpStatus.OK);
return getJsonResponse("", OK);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when update Agama", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when deleteJabatan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update Agama", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when deleteJabatan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE);
return getJsonHttpStatus(NOT_ACCEPTABLE);
}
@RequestMapping(value = "/delete-jabatan/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> deleteVO(@RequestParam(value = "id", required = true) Integer id,
HttpServletRequest request) {
@RequestMapping(value = "/delete-jabatan/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<String> deleteVO(@RequestParam(value = "id") Integer id, HttpServletRequest request) {
try {
boolean result = jabatanService.delete(id);
return RestUtil.getJsonResponse(String.valueOf(result), HttpStatus.CREATED);
return getJsonResponse(String.valueOf(result), CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when delete Jabatan", 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 Jabatan", 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);
}
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/search-jabatan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<AgamaVO>> getAllVOWithQueryString(
@RequestParam(value = "page", required = false, defaultValue = "0") 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 = jabatanService.findAllWithPageAndLimitAndSortByAndDirectionParameter(page,
limit, sort, dir);
return constructListPageResult(resultPageMap);
}
@Override
public ResponseEntity<String> addVO(JabatanVO vo) {
return null;
}
@Override
public ResponseEntity<List<JabatanVO>> getAllVO() {
return null;
}
@RequestMapping(value = "/get-all-jabatan-struktural", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> getAllJabatanStruktural(HttpServletRequest request) {
List<Map<String, Object>> result = null;
try {
result = jabatanService.getJabatanStruktural();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
} catch (Exception e) {
e.printStackTrace();
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
}

View File

@ -1,450 +1,182 @@
package com.jasamedika.medifirst2000.controller;
import java.io.PrintWriter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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.JadwalDokterService;
import com.jasamedika.medifirst2000.vo.JadwalDokter_VO;
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.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.fasterxml.jackson.databind.ObjectMapper;
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.JadwalDokter;
import com.jasamedika.medifirst2000.entities.Ruangan;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.service.JadwalDokterService;
import com.jasamedika.medifirst2000.service.PegawaiService;
import com.jasamedika.medifirst2000.service.RuanganService;
import com.jasamedika.medifirst2000.vo.JadwalDokter_VO;
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_ERROR;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.DateUtil.toDate;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController
@RequestMapping("/jadwalDokter")
public class JadwalDokterController extends LocaleController<JadwalDokter_VO>
implements IBaseRestController<JadwalDokter_VO> {
public class JadwalDokterController extends LocaleController<JadwalDokter_VO> {
private static final Logger LOGGER = LoggerFactory.getLogger(JadwalDokterController.class);
@Autowired
private JadwalDokterService jadwalDokterService;
@Autowired
private RuanganService ruanganService;
@Autowired
private PegawaiService pegawaiService;
private static final Logger LOGGER = LoggerFactory.getLogger(JadwalDokterController.class);
@Override
public ResponseEntity<Collection<JadwalDokter_VO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<JadwalDokter_VO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(JadwalDokter_VO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(JadwalDokter_VO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<JadwalDokter_VO>> getAllVO() {
return null;
}
@RequestMapping(value = "/save-jadwal-dokter/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-jadwal-dokter/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody JadwalDokter_VO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = jadwalDokterService.saveJadwalDokter(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 Catatan Perkembangan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveJadwalDokter", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Catatan Perkembangan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveJadwalDokter", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/delete-jadwal-dokter/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> deleteVO(@Valid @RequestBody JadwalDokter_VO vo, HttpServletRequest request) {
try {
Map<String,Object> result=jadwalDokterService.deleteJadwalDokter(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 Catatan Perkembangan", 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 Catatan Perkembangan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/save-all-jadwal-dokter/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-all-jadwal-dokter/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> addAllVO(@Valid @RequestBody List<JadwalDokter_VO> vos,
HttpServletRequest request) {
try {
Map<String, Object> result = jadwalDokterService.saveListJadwalDokter(vos);
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 Catatan Perkembangan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveListJadwalDokter", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Catatan Perkembangan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveListJadwalDokter", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-all-jadwal-dokter/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/update-all-jadwal-dokter/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateAllVo(@Valid @RequestBody List<JadwalDokter_VO> vos,
HttpServletRequest request) {
try {
Map<String, Object> result = jadwalDokterService.updateListJadwalDokter(vos);
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 Catatan Perkembangan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when updateListJadwalDokter", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Catatan Perkembangan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when updateListJadwalDokter", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-jadwal-dokter/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> editVO(@Valid @RequestBody JadwalDokter_VO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = jadwalDokterService.updateJadwalDokter(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 Catatan Perkembangan", 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 Catatan Perkembangan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-list-jadwal-dokter/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> addListVO(@Valid @RequestBody List<JadwalDokter_VO> vos,
HttpServletRequest request) {
try {
Map<String, Object> result = jadwalDokterService.saveListJadwalDokter(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 jadwal-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 add jadwal-dokter", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-jadwal-supir/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> addJadwalSupirVO(@Valid @RequestBody JadwalDokter_VO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = jadwalDokterService.saveJadwalSupirAmbulance(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 jadwal-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 add jadwal-dokter", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-by-tanggal/{tglJadwal}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByTanggal(@PathVariable("tglJadwal") String tanggalJadwal,
HttpServletRequest request) {
Map<String, Object> result = jadwalDokterService.findByTanggal(DateUtil.toDate(tanggalJadwal));
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 = "/find-by-ruangan/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-by-ruangan/{id}", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoCm(@PathVariable("id") Integer id, HttpServletRequest request) {
Map<String, Object> result = jadwalDokterService.findByRuangan(id);
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-ruangan-tanggal/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-by-ruangan-tanggal/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoCmtglJadwal(
@RequestParam(value = "id", required = false) Integer id,
@RequestParam(value = "tglJadwal", required = false) String tanggalJadwal, HttpServletRequest request) {
Map<String, Object> result = jadwalDokterService.findJadwalByTanggalRuangan(DateUtil.toDate(tanggalJadwal), id);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
Map<String, Object> result = jadwalDokterService.findJadwalByTanggalRuangan(toDate(tanggalJadwal), id);
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-antrian-tanggal/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-by-antrian-tanggal/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoCmtglJadwal(
@RequestParam(value = "noRec", required = false) String noRec,
@RequestParam(value = "tglJadwal", required = false) String tanggalJadwal, HttpServletRequest request) {
Map<String, Object> result = jadwalDokterService.findJadwalByTanggalRuangan(DateUtil.toDate(tanggalJadwal), noRec);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
Map<String, Object> result = jadwalDokterService.findJadwalByTanggalRuangan(toDate(tanggalJadwal), noRec);
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);
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
/*
* create by iwan date : 21.04.2017
*/
@RequestMapping(
value = "/find-by-periode-ruangan-dokter",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-by-periode-ruangan-dokter", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findJadwalDokterByPeriodRuangan(
@RequestParam(value = "iddok", required = false) final int iddok,
@RequestParam(value = "id", required = false) final int id,
@RequestParam(value = "id", required = false) final int id,
@RequestParam(value = "from", required = false) final String from,
@RequestParam(value = "to", required = false) final String to,
final HttpServletRequest request) {
Map<String, Object> result = this.jadwalDokterService.findJadwalDokterByKisaranTglRuangan(iddok, id, DateUtil.toDate(from), DateUtil.toDate(to));
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
@RequestParam(value = "to", required = false) final String to, final HttpServletRequest request) {
Map<String, Object> result = this.jadwalDokterService.findJadwalDokterByKisaranTglRuangan(iddok, id,
toDate(from), toDate(to));
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(LABEL_SUCCESS, getMessage(MessageResource.LABEL_ERROR, request));
}
else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
return getJsonResponse(result, OK);
}
/*
* create by iwan date : 21.04.2017
*/
@RequestMapping(
value = "/find-by-periode-ruangan-all-dokter",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findJadwalDokterByPeriodRuangan(
@RequestParam(value = "iddok", required = false) final int iddok,
@RequestParam(value = "from", required = false) final String from,
@RequestParam(value = "to", required = false) final String to,
final HttpServletRequest request) {
Map<String, Object> result = this.jadwalDokterService.findJadwalDokterByKisaranTglRuanganAll(iddok, DateUtil.toDate(from), DateUtil.toDate(to));
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_SUCCESS,
getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/get-jadwal-dokter-by-id", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-jadwal-dokter-by-id", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getJadwalDokterByIdDokter(
@RequestParam(value = "id", required = false) Integer id, HttpServletRequest request) {
Map<String, Object> result = jadwalDokterService.getJadwalDokterByIdDokter(id);
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 = "/get-jadwal-dokter-mingguan-by-id/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getJadwalDokterMingguanByIdDokter(
@RequestParam(value = "id", required = false) Integer id, HttpServletRequest request) {
Map<String, Object> result = jadwalDokterService.getJadwalDokterMingguanByIdDokter(id);
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 = "/get-jadwal-supir-ambulance/{bulan}/{tahun}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-jadwal-supir-ambulance/{bulan}/{tahun}", method = GET, produces = APPLICATION_JSON_VALUE)
public List<Map<String, Object>> getAllInformasi(@PathVariable("bulan") Integer bulan,
@PathVariable("tahun") Integer tahun, HttpServletRequest request) {
List<Map<String, Object>> result = null;
result = jadwalDokterService.getJadwalSupirAmbulanceByPeriode(bulan, tahun);
return result;
return jadwalDokterService.getJadwalSupirAmbulanceByPeriode(bulan, tahun);
}
@RequestMapping(value = "/get-jadwal-supir-ambulance/{id}/{bulan}/{tahun}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-jadwal-supir-ambulance/{id}/{bulan}/{tahun}", method = GET, produces = APPLICATION_JSON_VALUE)
public List<Map<String, Object>> getJadwalByIdAndPeriode(@PathVariable("id") Integer id,
@PathVariable("bulan") Integer bulan, @PathVariable("tahun") Integer tahun, HttpServletRequest request) {
List<Map<String, Object>> result = null;
result = jadwalDokterService.getJadwalSupirAmbulanByIdAndPeriode(id, bulan, tahun);
return result;
return jadwalDokterService.getJadwalSupirAmbulanByIdAndPeriode(id, bulan, tahun);
}
@RequestMapping(value = "/get-jadwal-by-date/{tanggal}/{bulan}/{tahun}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getJadwalByDate(@PathVariable("tanggal") Integer tanggal,
@PathVariable("bulan") Integer bulan, @PathVariable("tahun") Integer tahun, HttpServletRequest request) {
Map<String, Object> result = null;
try {
result = jadwalDokterService.getJadwalSupirByDate(tanggal, bulan, tahun);
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);
}
/* Author : Lukman Hakim
* */
@RequestMapping(value = "/get-pegawai-by-ruangan/{ruangan}/{tahun}/{bulan}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPegawaiByRuangan(@PathVariable("ruangan") Integer ruangan,
@PathVariable("tahun") Integer tahun, @PathVariable("bulan") Integer bulan, HttpServletRequest request) {
Map<String, Object> result = null;
try {
result = pegawaiService.findPegawaiByRuanganRev(ruangan, tahun, bulan);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
} catch (Exception e) {
e.printStackTrace();
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
}

View File

@ -1,71 +1,64 @@
package com.jasamedika.medifirst2000.controller;
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.JadwalDpjpRawatInapService;
import com.jasamedika.medifirst2000.vo.JadwalDpjpRawatInapVO;
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 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.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.JadwalDpjpRawatInapService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.JadwalDpjpRawatInapVO;
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("/jadwal-dpjp")
public class JadwalDpjpRawatInapController extends LocaleController{
@Autowired
private JadwalDpjpRawatInapService service;
public class JadwalDpjpRawatInapController extends LocaleController<JadwalDpjpRawatInapVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(JadwalDpjpRawatInapController.class);
@RequestMapping(value = "/save-jadwal-dpjp", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody JadwalDpjpRawatInapVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = service.save(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
@Autowired
private JadwalDpjpRawatInapService service;
@RequestMapping(value = "/save-jadwal-dpjp", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody JadwalDpjpRawatInapVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = service.save(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 save", 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 save", 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);
}
}
@RequestMapping(value = "/get-jadwal-dpjp")
@ResponseBody
public List<Map<String, Object>> getJadwalDPJP(
@RequestParam(value = "id", required = false) Integer id) {
public List<Map<String, Object>> getJadwalDPJP(@RequestParam(value = "id", required = false) Integer id) {
return service.getAll(id);
}
@RequestMapping(value = "/get-load-data-dpjp")
@ResponseBody
public Map<String, Object> getLoadDataDpjp() {

View File

@ -1,141 +1,78 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.Date;
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.JadwalRencanaPemeriksaanService;
import com.jasamedika.medifirst2000.vo.JadwalRencanaPemeriksaanVO;
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.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.JadwalRencanaPemeriksaanService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.JadwalRencanaPemeriksaanVO;
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("/jadwal-rencana-pemeriksaan")
public class JadwalRencanaPemeriksaanController extends LocaleController<JadwalRencanaPemeriksaanVO> implements
IBaseRestController<JadwalRencanaPemeriksaanVO>{
public class JadwalRencanaPemeriksaanController extends LocaleController<JadwalRencanaPemeriksaanVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(JadwalRencanaPemeriksaanController.class);
@Autowired
private JadwalRencanaPemeriksaanService rencanaPemeriksaanService;
private static final Logger LOGGER = LoggerFactory
.getLogger(PegawaiController.class);
@RequestMapping(value="/find-all/",method= RequestMethod.GET)
public ResponseEntity<Map<String,Object>> findAll(@RequestParam(value="id") Integer id, HttpServletRequest request){
try{
Map<String,Object> result = rencanaPemeriksaanService.findAllJadwal();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get all jadwal", 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 jadwal", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value="/find-all-by-date-satuan-kerja/{bulan}/{tahun}/{satuanKerjaId}",method= RequestMethod.GET)
public ResponseEntity<Map<String,Object>> findByDateSatuanKerja(
@PathVariable("bulan") Integer bulan,
@PathVariable("tahun") Integer tahun,
@PathVariable("satuanKerjaId") Integer satuanKerjaId,
HttpServletRequest request){
try{
Map<String,Object> result = rencanaPemeriksaanService.findByDateSatuanKerjaId(bulan, tahun, satuanKerjaId);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get all jadwal by Date", 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 jadwal by Date", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value="/save-jadwal/", method= RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> saveJadwal(@Valid @RequestBody JadwalRencanaPemeriksaanVO vo, HttpServletRequest request)
{
try{
Map<String, Object> result = rencanaPemeriksaanService.saveJadwal(vo);
if(null!= result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
@RequestMapping(value = "/find-all-by-date-satuan-kerja/{bulan}/{tahun}/{satuanKerjaId}", method = GET)
public ResponseEntity<Map<String, Object>> findByDateSatuanKerja(@PathVariable("bulan") Integer bulan,
@PathVariable("tahun") Integer tahun, @PathVariable("satuanKerjaId") Integer satuanKerjaId,
HttpServletRequest request) {
try {
Map<String, Object> result = rencanaPemeriksaanService.findByDateSatuanKerjaId(bulan, tahun, satuanKerjaId);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add jadwal", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when findByDateSatuanKerjaId", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add jadwal", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when findByDateSatuanKerjaId", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@Override
public ResponseEntity<Collection<JadwalRencanaPemeriksaanVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
@RequestMapping(value = "/save-jadwal/", method = POST, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveJadwal(@Valid @RequestBody JadwalRencanaPemeriksaanVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = rencanaPemeriksaanService.saveJadwal(vo);
if (null != result)
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when saveJadwal", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when saveJadwal", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@Override
public ResponseEntity<JadwalRencanaPemeriksaanVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(JadwalRencanaPemeriksaanVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(JadwalRencanaPemeriksaanVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<JadwalRencanaPemeriksaanVO>> getAllVO() {
return null;
}
}

View File

@ -1,197 +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.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.JadwalSupirAmbulanceService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.JadwalSupirAmbulanceVO;
import com.jasamedika.medifirst2000.vo.PegawaiVO;
@RestController
@RequestMapping("/jadwal-supir-ambulance")
public class JadwalSupirAmbulanceController extends LocaleController<JadwalSupirAmbulanceVO>
implements IBaseRestController<JadwalSupirAmbulanceVO> {
@Autowired
private JadwalSupirAmbulanceService jadwalSupirAmbulanceService;
private static final Logger LOGGER = LoggerFactory.getLogger(JadwalSupirAmbulanceController.class);
@RequestMapping(value = "/save-jadwal-supir-ambulance/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody JadwalSupirAmbulanceVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = jadwalSupirAmbulanceService.addJadwalSupirAmbulance(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 {} whenaddJadwalSupirAmbulance", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} whenaddJadwalSupirAmbulance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-all-jadwal-supir-ambulance/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveAllVO(@Valid @RequestBody List<JadwalSupirAmbulanceVO> vos,
HttpServletRequest request) {
try {
Map<String, Object> result = jadwalSupirAmbulanceService.saveAllJadwalSupirAmbulance(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 saveAllJadwalSupirAmbulance", 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 saveAllJadwalSupirAmbulance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-jadwal-supir-ambulance/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateVO(@Valid @RequestBody JadwalSupirAmbulanceVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = jadwalSupirAmbulanceService.updateJadwalSupirAmbulance(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 updateJadwalSupirAmbulance", 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 updateJadwalSupirAmbulance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-jadwal-supir-ambulance/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findAllJadwalSupirAmbulance(HttpServletRequest request) {
try {
Map<String, Object> result = jadwalSupirAmbulanceService.findAllJadwalSupirAmbulance();
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 getJadwalSupirAmbulance", 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 getJadwalSupirAmbulance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-supir-ambulance/", method = RequestMethod.GET)
public ResponseEntity<List<PegawaiVO>> getSupirAmbulance(HttpServletRequest request) {
try {
List<PegawaiVO> listSupirVO = jadwalSupirAmbulanceService.getSupirAmbulance();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(listSupirVO, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getAllSupir Ambulance", 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 getAllSupirAmbulance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-jadwal-by-date/{bulan}/{tahun}/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getJadwalByDate(@PathVariable("bulan") Integer bulan,
@PathVariable("tahun") Integer tahun, HttpServletRequest request) {
Map<String, Object> result = null;
try {
result = jadwalSupirAmbulanceService.findJadwalByTanggal(bulan, tahun);
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);
}
@Override
public ResponseEntity<Collection<JadwalSupirAmbulanceVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<JadwalSupirAmbulanceVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(JadwalSupirAmbulanceVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(JadwalSupirAmbulanceVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<JadwalSupirAmbulanceVO>> getAllVO() {
return null;
}
}

View File

@ -1,139 +1,63 @@
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.JenisBahanService;
import com.jasamedika.medifirst2000.vo.JenisBahanVO;
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.JenisBahanService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.JenisBahanVO;
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("/jenis-bahan/")
public class JenisBahanController extends LocaleController<JenisBahanVO>{
public class JenisBahanController extends LocaleController<JenisBahanVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(JenisBahanController.class);
@Autowired
private JenisBahanService jenisBahanService;
@RequestMapping(value = "/save-jenis-bahan/",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> saveJenisBahan(@Valid @RequestBody JenisBahanVO vo,HttpServletRequest request) {
try{
@RequestMapping(value = "/save-jenis-bahan/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveJenisBahan(@Valid @RequestBody JenisBahanVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = this.jenisBahanService.saveJenisBahan(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 Jenis Bahan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveJenisBahan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Jenis Bahan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveJenisBahan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
/*
@RequestMapping(value = "/get-jenis-bahan/",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getAll(HttpServletRequest request) {
try{
Map<String, Object> result = this.jenisBahanService.getJenisBahan();
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 Jenis Bahan", 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 Jenis Bahan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
*/
@RequestMapping(value="/get-jenis-bahan/",
method=RequestMethod.GET,
produces=MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-jenis-bahan/", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getAll(HttpServletRequest request) {
Map<String, Object> result = this.jenisBahanService.getJenisBahan();
return result;
}
/*
@RequestMapping(value = "/get-jenis-bahan-by-id/",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getJenisBahanById(@RequestParam(value="id", required=true)Integer id, HttpServletRequest request) {
try{
Map<String, Object> result = this.jenisBahanService.getJenisBahanById(id);
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 Jenis Bahan", 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 Jenis Bahan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
*/
@RequestMapping(value="/get-jenis-bahan-by-id/",
method=RequestMethod.GET,
produces=MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getJenisBahanById(@RequestParam("id")Integer id, HttpServletRequest request) {
Map<String, Object> result = this.jenisBahanService.getJenisBahanById(id);
return result;
return this.jenisBahanService.getJenisBahan();
}
}

View File

@ -1,80 +0,0 @@
package com.jasamedika.medifirst2000.controller;
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.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.JenisBelanjaService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.JenisBelanjaVO;
@RestController
@RequestMapping("/jenis-belanja")
public class JenisBelanjaController extends LocaleController<JenisBelanjaVO> {
@Autowired
private JenisBelanjaService jenisBelanjaService;
private static final Logger LOGGER = LoggerFactory.getLogger(JenisBelanjaController.class);
@RequestMapping(value = "/save-jenis-belanja", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveJenisBelanja(@Valid @RequestBody JenisBelanjaVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = jenisBelanjaService.saveJenisBelanja(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 save Jenis Belanja", 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 save Jenis Belanja", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-jenis-belanja", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateJenisBelanja(@Valid @RequestBody JenisBelanjaVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = jenisBelanjaService.updateJenisBelanja(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 Jenis Belanja", 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 Jenis Belanja", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,139 +1,92 @@
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.JenisDiet;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.JenisDietService;
import com.jasamedika.medifirst2000.vo.JenisDietVO;
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.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.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.JenisDiet;
import com.jasamedika.medifirst2000.entities.SatuanIndikator;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.JenisDietService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.JenisDietVO;
import com.jasamedika.medifirst2000.vo.SatuanIndikatorVO;
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(value="/jenis-diet")
public class JenisDietController extends LocaleController<JenisDietVO>
implements IBaseRestController<JenisDietVO>{
@RequestMapping(value = "/jenis-diet")
public class JenisDietController extends LocaleController<JenisDietVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(JenisDietController.class);
@Autowired
private JenisDietService jenisDietService;
private static final Logger LOGGER = LoggerFactory
.getLogger(PegawaiController.class);
@Override
public ResponseEntity<Collection<JenisDietVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<JenisDietVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(JenisDietVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(JenisDietVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<JenisDietVO>> getAllVO() {
return null;
}
@RequestMapping(value="/generate/",method= RequestMethod.GET)
public ResponseEntity<Map<String,Object>> getGenerateNoUsulan(
HttpServletRequest request)
{
try{
Map<String,Object> result = jenisDietService.generate();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}catch (ServiceVOException e) {
LOGGER.error("Got exception {} when generate no usulan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
@RequestMapping(value = "/generate/", method = GET)
public ResponseEntity<Map<String, Object>> getGenerateNoUsulan(HttpServletRequest request) {
try {
Map<String, Object> result = jenisDietService.generate();
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when generate", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when generate no usulan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when generate", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value="/find-all/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<JenisDiet>> 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<JenisDiet> spec)
{
Map<String, Object> result = new HashMap<String, Object>();
result = jenisDietService.findAll(page, take, sort,dir, spec);
return constructListPageResult(result);
@Spec(path = "id", params = "id", spec = Equal.class) Specification<JenisDiet> spec) {
Map<String, Object> result = jenisDietService.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 JenisDietVO vo,HttpServletRequest request){
try{
@RequestMapping(value = "/save/", method = POST, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody JenisDietVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = jenisDietService.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 Jenis Diet", 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 Jenis Diet", 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);
}
}
}

View File

@ -1,118 +0,0 @@
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 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.JenisIndikator;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.JenisIndikatorService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.JenisIndikatorVO;
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
@RestController
@RequestMapping("/jenis-indikator")
public class JenisIndikatorController extends LocaleController<JenisIndikatorVO>
implements IBaseRestController<JenisIndikatorVO>{
@Autowired
private JenisIndikatorService jenisIndikatorService;
private static final Logger LOGGER = LoggerFactory
.getLogger(PegawaiController.class);
@Override
public ResponseEntity<Collection<JenisIndikatorVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<JenisIndikatorVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(JenisIndikatorVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(JenisIndikatorVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<JenisIndikatorVO>> getAllVO() {
return null;
}
@RequestMapping(value="/find-all/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<JenisIndikator>> 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<JenisIndikator> spec)
{
Map<String, Object> result = new HashMap<String, Object>();
result = jenisIndikatorService.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 JenisIndikatorVO vo,HttpServletRequest request){
try{
Map<String, Object> result = jenisIndikatorService.save(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/update Jenis Indikator", 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/update Jenis Indikator", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
}

View File

@ -1,156 +1,96 @@
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.entities.JenisLimbahB3Masuk;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.JenisLimbahB3MasukService;
import com.jasamedika.medifirst2000.vo.JenisLimbahB3MasukVO;
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.entities.Pengendali;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.JenisLimbahB3MasukService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.JenisLimbahB3MasukVO;
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("/jenis-limbah-b3-masuk")
public class JenisLimbahB3MasukController extends LocaleController<JenisLimbahB3MasukVO>{
public class JenisLimbahB3MasukController extends LocaleController<JenisLimbahB3MasukVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(JenisLimbahB3MasukController.class);
@Autowired
private JenisLimbahB3MasukService jenisLimbahB3MasukService;
private static final Logger LOGGER = LoggerFactory
.getLogger(JenisLimbahB3MasukController.class);
@RequestMapping(value = "/save-jenis-limbah-b3-masuk/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody JenisLimbahB3MasukVO vo,HttpServletRequest request) {
try{
private JenisLimbahB3MasukService<JenisLimbahB3Masuk> jenisLimbahB3MasukService;
@RequestMapping(value = "/save-jenis-limbah-b3-masuk/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody JenisLimbahB3MasukVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = jenisLimbahB3MasukService.addJenisLimbahB3(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 jenisLimbahB3Masuk", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when add addJenisLimbahB3", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add jenisLimbahB3Masuk", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when add addJenisLimbahB3", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-jenis-limbah-b3-masuk/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody JenisLimbahB3MasukVO vo,HttpServletRequest request) {
try{
Map<String, Object> result = jenisLimbahB3MasukService.addJenisLimbahB3(vo);
@RequestMapping(value = "/find-all-jenis-limbah-b3-masuk/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllVO(HttpServletRequest request) {
try {
Map<String, Object> result = jenisLimbahB3MasukService.findAllAlat();
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 update jenisLimbahB3Masuk", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when findAllAlat", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update jenisLimbahB3Masuk", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when findAllAlat", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-jenis-limbah-b3-masuk/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
try {
Map<String,Object> result=jenisLimbahB3MasukService.findAllAlat();
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 jenisLimbahB3Masuk", 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 jenisLimbahB3Masuk", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/delete-jenis-limbah-b3-masuk", method = RequestMethod.GET)
public ResponseEntity<String> deleteNamaBahan(@RequestParam(value = "id", required = true) Integer id) {
@RequestMapping(value = "/get-jenis-limbah-b3-masuk", method = GET)
public ResponseEntity<Map<String, Object>> getJenisLimbahB3Masuk(HttpServletRequest request,
@RequestParam(value = "kategori") String kategori) {
try {
if (jenisLimbahB3MasukService.deleteJenisLimbahB3(id) == true)
return RestUtil.getJsonResponse(id +" Dihapus", HttpStatus.CREATED);
Map<String, Object> result = jenisLimbahB3MasukService.getJenisLimbahB3Masuk(kategori);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when delete jenisLimbahB3Masuk", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getJenisLimbahB3Masuk", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when delete jenisLimbahB3Masuk", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getJenisLimbahB3Masuk", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE);
}
@RequestMapping(value = "/get-jenis-limbah-b3-masuk", method = RequestMethod.GET)
public ResponseEntity<Map<String,Object>> getJenisLimbahB3Masuk(HttpServletRequest request,@RequestParam(value = "kategori", required = true) String kategori) {
try {
Map<String,Object> result = jenisLimbahB3MasukService.getJenisLimbahB3Masuk(kategori);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get all pengendali", 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);
}
}
}

View File

@ -1,122 +1,94 @@
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.JenisLinenService;
import com.jasamedika.medifirst2000.vo.JenisLinenVO;
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.JenisLinenService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.JenisLinenVO;
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("/jenis-linen")
public class JenisLinenController extends LocaleController<JenisLinenVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(JenisLinenController.class);
@Autowired
private JenisLinenService jenisLinenService;
private static final Logger LOGGER = LoggerFactory.getLogger(JenisLinenController.class);
@RequestMapping(value = "/save-jenis-linen/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-jenis-linen/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveJenisLinen(@Valid @RequestBody JenisLinenVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = jenisLinenService.saveJenisLinen(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 Jenis Linen", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveJenisLinen", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Jenis Linen", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveJenisLinen", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-jenis-linen/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateJenisLinen(@Valid @RequestBody JenisLinenVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = jenisLinenService.updateJenisLinen(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 Jenis Linen", 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 Jenis Linen", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-jenis-linen/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-all-jenis-linen/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findAllJenisLinen(HttpServletRequest request) {
try {
Map<String, Object> result = jenisLinenService.findAllJenisLinen();
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 Jenis Linen", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when findAllJenisLinen", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get All Jenis Linen", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when findAllJenisLinen", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/delete-jenis-linen/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> deleteJenisLinen(@RequestParam(value = "id", required = true) Integer id) {
@RequestMapping(value = "/delete-jenis-linen/", method = GET, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<String> deleteJenisLinen(@RequestParam(value = "id") Integer id) {
try {
if (jenisLinenService.deleteJenisLinen(id) == true)
return RestUtil.getJsonResponse(id + " Dihapus", HttpStatus.CREATED);
if (jenisLinenService.deleteJenisLinen(id))
return getJsonResponse(id + " Dihapus", CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when delete Jenis Linen", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when deleteJenisLinen", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when delete Jenis Linen", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when deleteJenisLinen", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE);
return getJsonHttpStatus(NOT_ACCEPTABLE);
}
}

View File

@ -1,47 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.JenisLogService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.JenisLogVO;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.CREATED;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
/**
* @author Salman
* @version 1.0.0
* @since 02/02/2024
*/
@RestController
@RequestMapping("/log/jenis")
public class JenisLogController {
private static final Logger LOGGER = getLogger(JenisLogController.class);
@Autowired
private JenisLogService jenisLogService;
@RequestMapping(method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<String> addVO(@Valid @RequestBody List<JenisLogVO> vos, HttpServletRequest request) {
try {
jenisLogService.save(vos);
return RestUtil.getJsonResponse(CREATED.getReasonPhrase(), CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add jenis log", e.getMessage());
return RestUtil.getJsonHttptatus(INTERNAL_SERVER_ERROR);
}
}
}

View File

@ -1,80 +0,0 @@
package com.jasamedika.medifirst2000.controller;
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.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.JenisPengadaanService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.JenisPengadaanVO;
@RestController
@RequestMapping("/jenis-pengadaan")
public class JenisPengadaanController extends LocaleController<JenisPengadaanVO> {
@Autowired
private JenisPengadaanService jenisPengadaanService;
private static final Logger LOGGER = LoggerFactory.getLogger(JenisPengadaanService.class);
@RequestMapping(value = "/save-jenis-pengadaan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveJenisPengadaan(@Valid @RequestBody JenisPengadaanVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = jenisPengadaanService.saveJenisPengadaan(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 save Jenis Pengadaan", 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 save Jenis Pengadaan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-jenis-pengadaan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateJenisPengadaan(@Valid @RequestBody JenisPengadaanVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = jenisPengadaanService.updateJenisPengadaan(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 Jenis Pengadaan", 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 Jenis Pengadaan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,58 +1,57 @@
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.JenisResponService;
import com.jasamedika.medifirst2000.vo.JenisResponVO;
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.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.JenisResponService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.JenisResponVO;
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.POST;
@RestController
@RequestMapping("/jenisRespon")
public class JenisResponController extends LocaleController<JenisResponVO> {
@Autowired
private JenisResponService service;
private static final Logger LOGGER = LoggerFactory.getLogger(JenisResponController.class);
@RequestMapping(value = "/save-jenis-respon", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> saveJenisRespon(@Valid @RequestBody JenisResponVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = service.saveJenisRespon(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
private static final Logger LOGGER = LoggerFactory.getLogger(JenisResponController.class);
@Autowired
private JenisResponService service;
@RequestMapping(value = "/save-jenis-respon", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveJenisRespon(@Valid @RequestBody JenisResponVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = service.saveJenisRespon(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 saveJenisRespon", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveJenisRespon", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveJenisRespon", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveJenisRespon", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,126 +1,80 @@
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.JenisWaktu;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.JenisWaktuService;
import com.jasamedika.medifirst2000.vo.JenisWaktuVO;
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.JenisWaktu;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.JenisWaktuService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.JenisWaktuVO;
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(value="/jenis-waktu")
public class JenisWaktuController extends LocaleController<JenisWaktuVO>
implements IBaseRestController<JenisWaktuVO>{
@RequestMapping(value = "/jenis-waktu")
public class JenisWaktuController extends LocaleController<JenisWaktuVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(JenisWaktuController.class);
@Autowired
private JenisWaktuService jenisWaktuService;
private static final Logger LOGGER = LoggerFactory
.getLogger(IndikatorRensarController.class);
@Override
public ResponseEntity<Collection<JenisWaktuVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<JenisWaktuVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(JenisWaktuVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(JenisWaktuVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<JenisWaktuVO>> getAllVO() {
return null;
}
@RequestMapping(value="/find-all/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<JenisWaktu>> 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<JenisWaktu> spec)
{
Map<String, Object> result = new HashMap<String, Object>();
result = jenisWaktuService.findAll(page, take, sort,dir, spec);
return constructListPageResult(result);
@Spec(path = "id", params = "id", spec = Equal.class) Specification<JenisWaktu> spec) {
Map<String, Object> result = jenisWaktuService.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 JenisWaktuVO vo,HttpServletRequest request){
try{
@RequestMapping(value = "/save/", method = POST, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody JenisWaktuVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = jenisWaktuService.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 Jenis Waktu", 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 Jenis Waktu", 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);
}
}
@RequestMapping(value="/get-jenis-waktu/",
method=RequestMethod.GET,
produces=MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-jenis-waktu/", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getJenisWaktu(HttpServletRequest request) {
Map<String, Object> result = this.jenisWaktuService.getJenisWaktu();
return result;
return this.jenisWaktuService.getJenisWaktu();
}
}

View File

@ -1,49 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import com.jasamedika.medifirst2000.dto.JumlahDiskonDokterDto;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.JumlahDiskonDokterService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import org.apache.commons.collections4.map.SingletonMap;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.HttpStatus.CREATED;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
/**
* @author salmanoe
* @version 1.0.0
* @since 07/02/2024
*/
@RestController
@RequestMapping("/master/dokter/jumlah-diskon")
public class JumlahDiskonDokterController {
private static final Logger LOGGER = getLogger(JumlahDiskonDokterController.class);
@Autowired
private JumlahDiskonDokterService jumlahDiskonDokterService;
@RequestMapping(method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<List<JumlahDiskonDokterDto>> save(HttpServletRequest request,
@Valid @RequestBody List<JumlahDiskonDokterDto> dtos) {
try {
jumlahDiskonDokterService.save(dtos);
return RestUtil.getJsonResponse(dtos, CREATED, new SingletonMap<>("status", CREATED.getReasonPhrase()));
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add jumlah diskon dokter", e.getMessage());
return RestUtil.getJsonHttptatus(INTERNAL_SERVER_ERROR);
}
}
}

View File

@ -1,170 +1,146 @@
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.K3CheckListFacillitySefetyService;
import com.jasamedika.medifirst2000.vo.K3CheckListFacillitySefetyVO;
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.K3CheckListFacillitySefetyService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.K3CheckListFacillitySefetyVO;
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("/k3-checklist-facillity-sefety")
public class K3CheckListFacillitySefetyController extends LocaleController<K3CheckListFacillitySefetyVO>{
public class K3CheckListFacillitySefetyController extends LocaleController<K3CheckListFacillitySefetyVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(K3CheckListFacillitySefetyController.class);
@Autowired
private K3CheckListFacillitySefetyService service;
private static final Logger LOGGER = LoggerFactory.getLogger(K3CheckListFacillitySefetyController.class);
@RequestMapping(value = "/get-k3-ruangan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-k3-ruangan", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getK3Ruangan(HttpServletRequest request) {
try {
Map<String,Object> result = service.getK3Ruangan();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getK3Ruangan();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getK3Ruangan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getK3Ruangan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getK3Ruangan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getK3Ruangan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-k3-facillity-check", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getK3FacillityCheck(HttpServletRequest request) {
try {
Map<String,Object> result = service.getK3FacillityCheck();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getK3FacillityCheck", 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 getK3FacillityCheck", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-k3-kelompokLpj-gedung", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-k3-kelompokLpj-gedung", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getK3KelompokLpjGedung(
@RequestParam(value = "k3FacillityCheckId", required = true) Integer k3FacillityCheckId,
HttpServletRequest request) {
@RequestParam(value = "k3FacillityCheckId") Integer k3FacillityCheckId, HttpServletRequest request) {
try {
Map<String,Object> result = service.getK3KelompokLpjGedung(k3FacillityCheckId);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getK3KelompokLpjGedung(k3FacillityCheckId);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getK3KelompokLpjGedung", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getK3KelompokLpjGedung", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getK3KelompokLpjGedung", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getK3KelompokLpjGedung", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-k3-checklist-facillity-sefety", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveK3CheckListFacillitySefety(@Valid @RequestBody K3CheckListFacillitySefetyVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = service.saveK3CheckListFacillitySefety(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-k3-checklist-facillity-sefety", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveK3CheckListFacillitySefety(
@Valid @RequestBody K3CheckListFacillitySefetyVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = service.saveK3CheckListFacillitySefety(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 saveK3CheckListFacillitySefety", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveK3CheckListFacillitySefety", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveK3CheckListFacillitySefety", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveK3CheckListFacillitySefety", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-k3-check-list-fasilitas-dan-keamanan",
method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-k3-check-list-fasilitas-dan-keamanan", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getCheckListFasilitasdanKeamanan(HttpServletRequest request) {
try {
Map<String,Object> result = service.getCheckListFasilitasdanKeamanan();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getCheckListFasilitasdanKeamanan();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getCheckListFasilitasdanKeamanan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getCheckListFasilitasdanKeamanan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getCheckListFasilitasdanKeamanan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getCheckListFasilitasdanKeamanan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-k3-check-list-fasilitas-dan-keamanan-detail",
method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-k3-check-list-fasilitas-dan-keamanan-detail", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getCheckListFasilitasdanKeamananDetail(
@RequestParam(value = "k3FacillityCheckId", required = true) Integer k3FacillityCheckId,
@RequestParam(value = "noRec", required = true) String noRec,
HttpServletRequest request) {
@RequestParam(value = "k3FacillityCheckId") Integer k3FacillityCheckId,
@RequestParam(value = "noRec") String noRec, HttpServletRequest request) {
try {
Map<String,Object> result = service.getCheckListFasilitasdanKeamananHeader(k3FacillityCheckId, noRec);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getCheckListFasilitasdanKeamananHeader(k3FacillityCheckId, noRec);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getCheckListFasilitasdanKeamanan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getCheckListFasilitasdanKeamananHeader", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getCheckListFasilitasdanKeamanan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getCheckListFasilitasdanKeamananHeader", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,282 +1,280 @@
package com.jasamedika.medifirst2000.controller;
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.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.K3LaporanKecelakaanKerjaService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.K3LaporanKecelakaanKerjaVO;
import com.jasamedika.medifirst2000.vo.LkkIdentifikasiKejadianVO;
import com.jasamedika.medifirst2000.vo.LkkIdentifikasiKorbanVO;
import com.jasamedika.medifirst2000.vo.LkkSaksiKejadianVO;
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.RequestBody;
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 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("/k3-laporan-kecelakaan-kerja")
public class K3LaporanKecelakaanKerjaController extends LocaleController<K3LaporanKecelakaanKerjaVO>{
public class K3LaporanKecelakaanKerjaController extends LocaleController<K3LaporanKecelakaanKerjaVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(K3LaporanKecelakaanKerjaController.class);
@Autowired
private K3LaporanKecelakaanKerjaService service;
private static final Logger LOGGER = LoggerFactory.getLogger(K3LaporanKecelakaanKerjaController.class);
@RequestMapping(value = "/get-login-pelapor", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-login-pelapor", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getLoginUser(HttpServletRequest request) {
try {
Map<String,Object> result = service.getUserLogin();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getUserLogin();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getLoginUser", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getUserLogin", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getLoginUser", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getUserLogin", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-unit-ruangan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-unit-ruangan", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getUnitRuangan(HttpServletRequest request) {
try {
Map<String,Object> result = service.getUnitRuangan();
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
Map<String, Object> result = service.getUnitRuangan();
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getUnitRuangan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getUnitRuangan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getUnitRuangan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getUnitRuangan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-data-lkk", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveDataLkk(@Valid @RequestBody K3LaporanKecelakaanKerjaVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = service.saveDataLkk(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 saveDataLkk", 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 saveDataLkk", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-identifikasi-kejadian", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getIdentifikasiKejadian(
@RequestParam(value = "idPegawai", required = true) Integer idPegawai, HttpServletRequest request) {
try {
Map<String,Object> result = service.getIdentifikasiKejadian(idPegawai);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getIdentifikasiKejadian", 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 getIdentifikasiKejadian", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-lkk-by-norec", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getDataLkkByNoRec(@RequestParam(value = "noRec", required = true) String noRec,
@RequestMapping(value = "/save-data-lkk", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveDataLkk(@Valid @RequestBody K3LaporanKecelakaanKerjaVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result = service.getDataLkkByNoRec(noRec);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
} else{
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
}
Map<String, Object> result = service.saveDataLkk(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 getDataLkkByNoRec", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveDataLkk", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getDataLkkByNoRec", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveDataLkk", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-identifikasi-kejadian", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> updateIdentifikasiKejadian(@Valid @RequestBody LkkIdentifikasiKejadianVO vo, HttpServletRequest request) {
@RequestMapping(value = "/get-identifikasi-kejadian", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getIdentifikasiKejadian(
@RequestParam(value = "idPegawai") Integer idPegawai, HttpServletRequest request) {
try {
Map<String, Object> result = service.getIdentifikasiKejadian(idPegawai);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getIdentifikasiKejadian", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getIdentifikasiKejadian", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-lkk-by-norec", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getDataLkkByNoRec(@RequestParam(value = "noRec") String noRec,
HttpServletRequest request) {
try {
Map<String, Object> result = service.getDataLkkByNoRec(noRec);
if (null != result) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} else {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
}
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getDataLkkByNoRec", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getDataLkkByNoRec", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-identifikasi-kejadian", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<String> updateIdentifikasiKejadian(@Valid @RequestBody LkkIdentifikasiKejadianVO vo,
HttpServletRequest request) {
try {
Integer result = service.updateIdentifikasiKejadian(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(vo.getNoRec(), HttpStatus.OK,mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(vo.getNoRec(), OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when updateIdentifikasiKejadian", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when updateIdentifikasiKejadian", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when updateIdentifikasiKejadian", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when updateIdentifikasiKejadian", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-identifikasi-korban", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> updateIdentifikasiKorban(@Valid @RequestBody LkkIdentifikasiKorbanVO vo, HttpServletRequest request) {
@RequestMapping(value = "/update-identifikasi-korban", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<String> updateIdentifikasiKorban(@Valid @RequestBody LkkIdentifikasiKorbanVO vo,
HttpServletRequest request) {
try {
Integer result = service.updateIdentifikasiKorban(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(vo.getNoRec(), HttpStatus.OK,mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(vo.getNoRec(), OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when updateIdentifikasiKorban", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when updateIdentifikasiKorban", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when updateIdentifikasiKorban", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when updateIdentifikasiKorban", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-saksi-kejadian", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> updateSaksiKejadian(@Valid @RequestBody LkkSaksiKejadianVO vo, HttpServletRequest request) {
@RequestMapping(value = "/update-saksi-kejadian", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<String> updateSaksiKejadian(@Valid @RequestBody LkkSaksiKejadianVO vo,
HttpServletRequest request) {
try {
Integer result = service.updateSaksiKejadian(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(vo.getNoRec(), HttpStatus.OK,mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(vo.getNoRec(), OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when updateSaksiKejadian", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when updateSaksiKejadian", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when updateSaksiKejadian", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when updateSaksiKejadian", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/delete-identifikasi-kejadian", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Boolean> deleteIdentifikasiKejadian(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
@RequestMapping(value = "/delete-identifikasi-kejadian", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Boolean> deleteIdentifikasiKejadian(@RequestParam(value = "noRec") String noRec,
HttpServletRequest request) {
try {
Boolean result = service.deleteIdentifikasiKejadian(noRec);
if (result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when deleteIdentifikasiKejadian", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when deleteIdentifikasiKejadian", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when deleteIdentifikasiKejadian", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when deleteIdentifikasiKejadian", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/delete-identifikasi-korban", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Boolean> deleteIdentifikasiKorban(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
@RequestMapping(value = "/delete-identifikasi-korban", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Boolean> deleteIdentifikasiKorban(@RequestParam(value = "noRec") String noRec,
HttpServletRequest request) {
try {
Boolean result = service.deleteIdentifikasiKorban(noRec);
if (result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when deleteIdentifikasiKorban", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when deleteIdentifikasiKorban", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when deleteIdentifikasiKorban", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when deleteIdentifikasiKorban", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/delete-saksi-kejadian", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Boolean> deleteSaksiKejadian(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
@RequestMapping(value = "/delete-saksi-kejadian", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Boolean> deleteSaksiKejadian(@RequestParam(value = "noRec") String noRec,
HttpServletRequest request) {
try {
Boolean result = service.deleteSaksiKejadian(noRec);
if (result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when deleteSaksiKejadian", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when deleteSaksiKejadian", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when deleteSaksiKejadian", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when deleteSaksiKejadian", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/verifikasi-lkk", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> verifLaporanKecelakaan(@Valid @RequestBody K3LaporanKecelakaanKerjaVO vo, HttpServletRequest request) {
@RequestMapping(value = "/verifikasi-lkk", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<String> verifLaporanKecelakaan(@Valid @RequestBody K3LaporanKecelakaanKerjaVO vo,
HttpServletRequest request) {
try {
Integer result = service.verifLaporanKecelakaan(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(vo.getNoRec(), HttpStatus.OK,mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(vo.getNoRec(), OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when verifLaporanKecelakaan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when verifLaporanKecelakaan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when verifLaporanKecelakaan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when verifLaporanKecelakaan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}