Update controller

Clean code
This commit is contained in:
Salman Manoe 2024-12-17 15:50:41 +07:00
parent 47ba4a96a1
commit 0da96226b1
30 changed files with 612 additions and 809 deletions

View File

@ -0,0 +1,52 @@
package com.jasamedika.medifirst2000.vo;
import com.jasamedika.medifirst2000.base.vo.BaseTransactionVO;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
/**
* @author Salman
* @version 1.0.0
* @since 17/12/2024
*/
@Getter
@Setter
public class BowidickVO extends BaseTransactionVO {
@Caption(value = "Tanggal")
private Date tanggal;
@Caption(value="Object Mesin")
private MesinVO mesin;
private Integer mesinId;
@Caption(value = "Program Mesin")
private String programMesin;
@Caption(value = "Suhu")
private String suhu;
@Caption(value = "Hasil")
private String hasil;
@Caption(value="Object Supervisor")
private PegawaiVO supervisor;
private Integer supervisorId;
@Caption(value="Object Operator")
private PegawaiVO operator;
private Integer operatorId;
private PencatatanSuhuMesinVO pencatatanSuhuMesin;
private String pencatatanSuhuMesinId;
private String keterangan;
}

View File

@ -0,0 +1,29 @@
package com.jasamedika.medifirst2000.vo;
import com.jasamedika.medifirst2000.base.vo.BaseMasterVO;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.Setter;
/**
* @author Salman
* @version 1.0.0
* @since 17/12/2024
*/
@Getter
@Setter
public class CssdAlatVO extends BaseMasterVO {
@Caption(value = "Cssd Alat")
private CssdSetAlatVO cssdSetAlat;
private Integer cssdSetAlatId;
@Caption(value = "Nama Alat")
private MapPaketToProdukVO namaAlat;
private Integer namaAlatId;
protected Integer id;
}

View File

@ -0,0 +1,37 @@
package com.jasamedika.medifirst2000.vo;
import com.jasamedika.medifirst2000.base.vo.BaseMasterVO;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.Setter;
/**
* @author Salman
* @version 1.0.0
* @since 17/12/2024
*/
@Getter
@Setter
public class CssdBmhpVO extends BaseMasterVO {
@Caption(value = "Cssd Alat")
private CssdSetAlatVO cssdSetAlat;
private Integer cssdSetAlatId;
@Caption(value = "Nama Barang")
private ProdukVO namaBarang;
private Integer namaBarangId;
@Caption(value = "Jumlah")
private Integer jumlah;
@Caption(value = "Satuan")
private SatuanStandarVO satuan;
private Integer satuanId;
protected Integer id;
}

View File

@ -0,0 +1,31 @@
package com.jasamedika.medifirst2000.vo;
import com.jasamedika.medifirst2000.base.vo.BaseMasterVO;
import com.jasamedika.medifirst2000.helper.Caption;
import lombok.Getter;
import lombok.Setter;
import java.util.HashSet;
import java.util.Set;
/**
* @author Salman
* @version 1.0.0
* @since 17/12/2024
*/
@Getter
@Setter
public class CssdSetAlatVO extends BaseMasterVO {
@Caption(value = "Set Alat")
private PaketVO paket;
private Integer paketId;
private Set<CssdAlatVO> cssdAlat = new HashSet<>();
private Set<CssdBmhpVO> cssdBmhp = new HashSet<>();
protected Integer id;
}

View File

@ -21,7 +21,7 @@ import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE; 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.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 com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*; import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@ -48,11 +48,11 @@ public class AdmisiRencanaPindahRuanganController extends LocaleController<Admis
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when save", e.getMessage()); LOGGER.error("Got ServiceVOException {} when save", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when save", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when save", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -71,11 +71,11 @@ public class AdmisiRencanaPindahRuanganController extends LocaleController<Admis
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getDataGrid", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getDataGrid", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getDataGrid", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getDataGrid", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -95,11 +95,11 @@ public class AdmisiRencanaPindahRuanganController extends LocaleController<Admis
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when update", e.getMessage()); LOGGER.error("Got ServiceVOException {} when update", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update", jse.getMessage()); LOGGER.error("Got exception {} when update", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }

View File

@ -22,7 +22,7 @@ import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE; 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.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 com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*; import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@ -48,11 +48,11 @@ public class AdvokasiHukumMedicolegalController extends LocaleController<UsulanE
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when saveEvaluasiRekanan", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveEvaluasiRekanan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when saveEvaluasiRekanan", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveEvaluasiRekanan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -67,11 +67,11 @@ public class AdvokasiHukumMedicolegalController extends LocaleController<UsulanE
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when noAdvokasiHukumMedicolegal", e.getMessage()); LOGGER.error("Got ServiceVOException {} when noAdvokasiHukumMedicolegal", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when noAdvokasiHukumMedicolegal", jse.getMessage()); LOGGER.error("Got exception {} when noAdvokasiHukumMedicolegal", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -88,12 +88,12 @@ public class AdvokasiHukumMedicolegalController extends LocaleController<UsulanE
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when listAdvokasiHukumMedicolegalByRuanganTujuan", e.getMessage()); LOGGER.error("Got ServiceVOException {} when listAdvokasiHukumMedicolegalByRuanganTujuan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when listAdvokasiHukumMedicolegalByRuanganTujuan", LOGGER.error("Got JpaSystemException {} when listAdvokasiHukumMedicolegalByRuanganTujuan",
jse.getMessage()); jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -110,11 +110,11 @@ public class AdvokasiHukumMedicolegalController extends LocaleController<UsulanE
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when listAdvokasiHukumMedicolegalByRuanganPembuat", e.getMessage()); LOGGER.error("Got ServiceVOException {} when listAdvokasiHukumMedicolegalByRuanganPembuat", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when listAdvokasiHukumMedicolegalByRuanganPembuat", jse.getMessage()); LOGGER.error("Got exception {} when listAdvokasiHukumMedicolegalByRuanganPembuat", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -137,11 +137,11 @@ public class AdvokasiHukumMedicolegalController extends LocaleController<UsulanE
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when saveRekomendasiEvaluasiRekanan", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveRekomendasiEvaluasiRekanan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when saveRekomendasiEvaluasiRekanan", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveRekomendasiEvaluasiRekanan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }

View File

@ -5,7 +5,9 @@ import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.Agama; import com.jasamedika.medifirst2000.entities.Agama;
import com.jasamedika.medifirst2000.exception.ServiceVOException; import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.AgamaService; import com.jasamedika.medifirst2000.service.AgamaService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.AgamaVO; import com.jasamedika.medifirst2000.vo.AgamaVO;
import com.jasamedika.medifirst2000.vo.PasienVO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -23,7 +25,7 @@ import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE; 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.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 com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*; import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@ -49,11 +51,11 @@ public class AgamaController extends LocaleController<AgamaVO> {
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when add", e.getMessage()); LOGGER.error("Got ServiceVOException {} when add", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when add", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when add", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -66,13 +68,13 @@ public class AgamaController extends LocaleController<AgamaVO> {
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when update", e.getMessage()); LOGGER.error("Got ServiceVOException {} when update", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when update", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when update", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
return getJsonHttptatus(NOT_ACCEPTABLE); return RestUtil.getJsonHttpStatus(NOT_ACCEPTABLE);
} }
@RequestMapping(value = "/delete-agama/", method = GET, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE) @RequestMapping(value = "/delete-agama/", method = GET, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
@ -83,18 +85,17 @@ public class AgamaController extends LocaleController<AgamaVO> {
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when delete", e.getMessage()); LOGGER.error("Got ServiceVOException {} when delete", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when delete", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when delete", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
return getJsonHttptatus(NOT_ACCEPTABLE); return RestUtil.getJsonHttpStatus(NOT_ACCEPTABLE);
} }
@SuppressWarnings("unchecked")
@RequestMapping(value = "/search-agama", method = GET, produces = APPLICATION_JSON_VALUE) @RequestMapping(value = "/search-agama", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<AgamaVO>> getAllVOWithQueryString( public ResponseEntity<Collection<PasienVO>> getAllVOWithQueryString(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page, @RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "limit", required = false, defaultValue = "10") Integer limit, @RequestParam(value = "limit", required = false, defaultValue = "10") Integer limit,
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort, @RequestParam(value = "sort", required = false, defaultValue = "id") String sort,

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.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS; 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 com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*; import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@ -49,11 +49,11 @@ public class AlatController extends LocaleController<AlatVO> {
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when findAllAlat", e.getMessage()); LOGGER.error("Got ServiceVOException {} when findAllAlat", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when findAllAlat", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when findAllAlat", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -64,7 +64,7 @@ public class AlatController extends LocaleController<AlatVO> {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage); return getJsonResponse(result, OK, mapHeaderMessage);
} }
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} }
@RequestMapping(value = "/get-all-mesin-cuci", method = GET, produces = APPLICATION_JSON_VALUE) @RequestMapping(value = "/get-all-mesin-cuci", method = GET, produces = APPLICATION_JSON_VALUE)
@ -74,7 +74,7 @@ public class AlatController extends LocaleController<AlatVO> {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage); return getJsonResponse(result, OK, mapHeaderMessage);
} }
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} }
@RequestMapping(value = "/get-mesin-aset", method = GET, produces = APPLICATION_JSON_VALUE) @RequestMapping(value = "/get-mesin-aset", method = GET, produces = APPLICATION_JSON_VALUE)
@ -84,7 +84,7 @@ public class AlatController extends LocaleController<AlatVO> {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage); return getJsonResponse(result, OK, mapHeaderMessage);
} }
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} }
@RequestMapping(value = "/get-satuan", method = GET, produces = APPLICATION_JSON_VALUE) @RequestMapping(value = "/get-satuan", method = GET, produces = APPLICATION_JSON_VALUE)
@ -94,7 +94,7 @@ public class AlatController extends LocaleController<AlatVO> {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage); return getJsonResponse(result, OK, mapHeaderMessage);
} }
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} }
@RequestMapping(value = "/get-departemen-laundry", method = GET, produces = APPLICATION_JSON_VALUE) @RequestMapping(value = "/get-departemen-laundry", method = GET, produces = APPLICATION_JSON_VALUE)
@ -104,7 +104,7 @@ public class AlatController extends LocaleController<AlatVO> {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage); return getJsonResponse(result, OK, mapHeaderMessage);
} }
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} }
@RequestMapping(value = "/get-max-no-mesin", method = GET, produces = APPLICATION_JSON_VALUE) @RequestMapping(value = "/get-max-no-mesin", method = GET, produces = APPLICATION_JSON_VALUE)
@ -114,7 +114,7 @@ public class AlatController extends LocaleController<AlatVO> {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage); return getJsonResponse(result, OK, mapHeaderMessage);
} }
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} }
@RequestMapping(value = "/get-produkasetid-alatid", method = GET, produces = APPLICATION_JSON_VALUE) @RequestMapping(value = "/get-produkasetid-alatid", method = GET, produces = APPLICATION_JSON_VALUE)
@ -126,7 +126,7 @@ public class AlatController extends LocaleController<AlatVO> {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage); return getJsonResponse(result, OK, mapHeaderMessage);
} }
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} }
@RequestMapping(value = "/get-asset-laundry", method = GET, produces = APPLICATION_JSON_VALUE) @RequestMapping(value = "/get-asset-laundry", method = GET, produces = APPLICATION_JSON_VALUE)

View File

@ -21,7 +21,7 @@ import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE; 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.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 com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*; import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@ -53,11 +53,11 @@ public class AnamnesisController extends LocaleController<RegistrasiPelayananVO>
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when saveAnamnesis", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveAnamnesis", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when saveAnamnesis", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveAnamnesis", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
} }
} }

View File

@ -22,7 +22,7 @@ import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE; 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.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 com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*; import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@ -67,11 +67,11 @@ public class AnggaranController extends LocaleController<HeadAnggaranVO> {
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when savePengajuanUsulanAnggaranBaru", e.getMessage()); LOGGER.error("Got ServiceVOException {} when savePengajuanUsulanAnggaranBaru", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when savePengajuanUsulanAnggaranBaru", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when savePengajuanUsulanAnggaranBaru", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -94,11 +94,11 @@ public class AnggaranController extends LocaleController<HeadAnggaranVO> {
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when saveVerifikasiSpekAnggaran", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveVerifikasiSpekAnggaran", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when saveVerifikasiSpekAnggaran", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveVerifikasiSpekAnggaran", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -113,11 +113,11 @@ public class AnggaranController extends LocaleController<HeadAnggaranVO> {
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when saveUnVerifikasiSpekAnggaran", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveUnVerifikasiSpekAnggaran", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when saveUnVerifikasiSpekAnggaran", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveUnVerifikasiSpekAnggaran", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -130,11 +130,11 @@ public class AnggaranController extends LocaleController<HeadAnggaranVO> {
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getPengendaliByUserLogin", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getPengendaliByUserLogin", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getPengendaliByUserLogin", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getPengendaliByUserLogin", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -147,11 +147,11 @@ public class AnggaranController extends LocaleController<HeadAnggaranVO> {
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getRuanganByUserLogin", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getRuanganByUserLogin", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getRuanganByUserLogin", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getRuanganByUserLogin", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -167,11 +167,11 @@ public class AnggaranController extends LocaleController<HeadAnggaranVO> {
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when editPengajuanUsulanAnggaran", e.getMessage()); LOGGER.error("Got ServiceVOException {} when editPengajuanUsulanAnggaran", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when editPengajuanUsulanAnggaran", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when editPengajuanUsulanAnggaran", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
// end add by Arya 2017-01-19 // end add by Arya 2017-01-19

View File

@ -22,7 +22,7 @@ import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE; 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_ERROR;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS; 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 com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*; import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@ -49,11 +49,11 @@ public class ApresiasiAtasLayananController extends LocaleController<ApresiasiAt
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when addApresiasiAtasLayanan", e.getMessage()); LOGGER.error("Got ServiceVOException {} when addApresiasiAtasLayanan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when addApresiasiAtasLayanan", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when addApresiasiAtasLayanan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }

View File

@ -21,7 +21,7 @@ import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE; 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.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 com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*; import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@ -53,11 +53,11 @@ public class AsesmenGiziAwalController extends LocaleController<RegistrasiPelaya
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when saveAsesmenGiziAwal", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveAsesmenGiziAwal", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when saveAsesmenGiziAwal", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveAsesmenGiziAwal", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }

View File

@ -21,7 +21,7 @@ import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE; 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.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 com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*; import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@ -48,11 +48,11 @@ public class AsesmenGiziLanjutController extends LocaleController<RegistrasiPela
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when saveAsesmenGiziLanjut", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveAsesmenGiziLanjut", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when saveAsesmenGiziLanjut", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveAsesmenGiziLanjut", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }

View File

@ -18,7 +18,7 @@ import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE; 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.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 com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*; import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@ -46,11 +46,11 @@ public class AsuhanKeperawatanPeriOperasiController extends LocaleController<Asu
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getAllAsuhan", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getAllAsuhan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getAllAsuhan", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getAllAsuhan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -67,11 +67,11 @@ public class AsuhanKeperawatanPeriOperasiController extends LocaleController<Asu
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getAllIntraOperasiPerawatBedah", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getAllIntraOperasiPerawatBedah", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getAllIntraOperasiPerawatBedah", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getAllIntraOperasiPerawatBedah", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -88,11 +88,11 @@ public class AsuhanKeperawatanPeriOperasiController extends LocaleController<Asu
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getAllPostOperasiPerawatBedah", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getAllPostOperasiPerawatBedah", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getAllPostOperasiPerawatBedah", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getAllPostOperasiPerawatBedah", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -109,11 +109,11 @@ public class AsuhanKeperawatanPeriOperasiController extends LocaleController<Asu
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getAllIntraOperasiAnestesi", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getAllIntraOperasiAnestesi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getAllIntraOperasiAnestesi", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getAllIntraOperasiAnestesi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -130,11 +130,11 @@ public class AsuhanKeperawatanPeriOperasiController extends LocaleController<Asu
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getAllPostOperasiAnestesi", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getAllPostOperasiAnestesi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getAllPostOperasiAnestesi", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getAllPostOperasiAnestesi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -151,11 +151,11 @@ public class AsuhanKeperawatanPeriOperasiController extends LocaleController<Asu
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getAllIntraOperasiPerawatBedahV1", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getAllIntraOperasiPerawatBedahV1", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getAllIntraOperasiPerawatBedahV1", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getAllIntraOperasiPerawatBedahV1", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }

View File

@ -21,7 +21,7 @@ import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE; 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.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 com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*; import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@ -49,11 +49,11 @@ public class AsuhanKeperawatanPeriOperasiHeaderController
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when saveAsuhanHeader", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveAsuhanHeader", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when saveAsuhanHeader", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveAsuhanHeader", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -71,11 +71,11 @@ public class AsuhanKeperawatanPeriOperasiHeaderController
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getListAsuhanByNoTrans", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getListAsuhanByNoTrans", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getListAsuhanByNoTrans", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getListAsuhanByNoTrans", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -93,11 +93,11 @@ public class AsuhanKeperawatanPeriOperasiHeaderController
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getPasienDaftarOperasi", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getPasienDaftarOperasi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getPasienDaftarOperasi", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getPasienDaftarOperasi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }

View File

@ -29,7 +29,7 @@ import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE; 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.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 com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*; import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@ -66,11 +66,11 @@ public class AsuransiController extends LocaleController<PemakaianAsuransiVO> {
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when savePemakaianAsuransi", e.getMessage()); LOGGER.error("Got ServiceVOException {} when savePemakaianAsuransi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when savePemakaianAsuransi", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when savePemakaianAsuransi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }

View File

@ -87,7 +87,7 @@ public class AuthenticateController {
HttpServletResponse httpResponse) { HttpServletResponse httpResponse) {
if (vo.getNamaUser() == null || vo.getKataSandi() == null) { if (vo.getNamaUser() == null || vo.getKataSandi() == null) {
this.mapHeaderMessage.put(Constants.MessageInfo.ERROR_MESSAGE, "Username or Password is empty"); this.mapHeaderMessage.put(Constants.MessageInfo.ERROR_MESSAGE, "Username or Password is empty");
return RestUtil.getJsonHttptatus(HttpStatus.BAD_REQUEST, mapHeaderMessage); return RestUtil.getJsonHttpStatus(HttpStatus.BAD_REQUEST, mapHeaderMessage);
} }
LOGGER.info("starting sign-in {}", vo.getNamaUser() + " at " + DateUtil.getIndonesianStringDate(new Date())); LOGGER.info("starting sign-in {}", vo.getNamaUser() + " at " + DateUtil.getIndonesianStringDate(new Date()));
@ -97,7 +97,7 @@ public class AuthenticateController {
LoginUserVO loginUserVo = loginUserService.signIn(vo); LoginUserVO loginUserVo = loginUserService.signIn(vo);
if (loginUserVo == null) { if (loginUserVo == null) {
this.mapHeaderMessage.put(Constants.MessageInfo.ERROR_MESSAGE, "Invalid Username or Password"); this.mapHeaderMessage.put(Constants.MessageInfo.ERROR_MESSAGE, "Invalid Username or Password");
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE, mapHeaderMessage); return RestUtil.getJsonHttpStatus(HttpStatus.NOT_ACCEPTABLE, mapHeaderMessage);
} }
GrantedAuthority authority = new SimpleGrantedAuthority("USER"); GrantedAuthority authority = new SimpleGrantedAuthority("USER");
String token = tokenAuthenticationService.addAuthentication(httpResponse, String token = tokenAuthenticationService.addAuthentication(httpResponse,
@ -124,7 +124,7 @@ public class AuthenticateController {
} catch (Exception ex) { } catch (Exception ex) {
LOGGER.error("Signing-in error {}", ex.getMessage()); LOGGER.error("Signing-in error {}", ex.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.UNAUTHORIZED); return RestUtil.getJsonHttpStatus(HttpStatus.UNAUTHORIZED);
} }
} }
@ -153,7 +153,7 @@ public class AuthenticateController {
HttpServletResponse httpResponse) { HttpServletResponse httpResponse) {
if (vo.getNamaUser() == null || vo.getKataSandi() == null) { if (vo.getNamaUser() == null || vo.getKataSandi() == null) {
this.mapHeaderMessage.put(Constants.MessageInfo.ERROR_MESSAGE, "Username or Password is empty"); this.mapHeaderMessage.put(Constants.MessageInfo.ERROR_MESSAGE, "Username or Password is empty");
return RestUtil.getJsonHttptatus(HttpStatus.BAD_REQUEST, mapHeaderMessage); return RestUtil.getJsonHttpStatus(HttpStatus.BAD_REQUEST, mapHeaderMessage);
} }
LOGGER.info("starting sign-in-mobile {}", LOGGER.info("starting sign-in-mobile {}",
@ -164,7 +164,7 @@ public class AuthenticateController {
LoginUserVO loginUserVo = loginUserService.signIn(vo); LoginUserVO loginUserVo = loginUserService.signIn(vo);
if (loginUserVo == null) { if (loginUserVo == null) {
this.mapHeaderMessage.put(Constants.MessageInfo.ERROR_MESSAGE, "Invalid Username or Password"); this.mapHeaderMessage.put(Constants.MessageInfo.ERROR_MESSAGE, "Invalid Username or Password");
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE, mapHeaderMessage); return RestUtil.getJsonHttpStatus(HttpStatus.NOT_ACCEPTABLE, mapHeaderMessage);
} }
GrantedAuthority authority = new SimpleGrantedAuthority("USER"); GrantedAuthority authority = new SimpleGrantedAuthority("USER");
String token = tokenAuthenticationService.addAuthentication(httpResponse, String token = tokenAuthenticationService.addAuthentication(httpResponse,
@ -202,7 +202,7 @@ public class AuthenticateController {
} catch (Exception ex) { } catch (Exception ex) {
LOGGER.error("Signing-in-mobile error {}", ex.getMessage()); LOGGER.error("Signing-in-mobile error {}", ex.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.UNAUTHORIZED); return RestUtil.getJsonHttpStatus(HttpStatus.UNAUTHORIZED);
} }
} }

View File

@ -21,7 +21,7 @@ import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE; 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.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 com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*; import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@ -50,11 +50,11 @@ public class B3RuanganInputDataController extends LocaleController<B3RuanganInpu
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getUserLogin", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getUserLogin", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getUserLogin", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getUserLogin", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -71,11 +71,11 @@ public class B3RuanganInputDataController extends LocaleController<B3RuanganInpu
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getRuangan", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getRuangan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getRuangan", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getRuangan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -92,11 +92,11 @@ public class B3RuanganInputDataController extends LocaleController<B3RuanganInpu
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getB3StokGlobal", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getB3StokGlobal", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getB3StokGlobal", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getB3StokGlobal", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -111,11 +111,11 @@ public class B3RuanganInputDataController extends LocaleController<B3RuanganInpu
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when saveB3RuanganInputData", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveB3RuanganInputData", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when saveB3RuanganInputData", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveB3RuanganInputData", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -133,11 +133,11 @@ public class B3RuanganInputDataController extends LocaleController<B3RuanganInpu
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getB3RuanganInput", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getB3RuanganInput", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getB3RuanganInput", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getB3RuanganInput", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -152,11 +152,11 @@ public class B3RuanganInputDataController extends LocaleController<B3RuanganInpu
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when deleteB3DaftarBahanBerbahaya", e.getMessage()); LOGGER.error("Got ServiceVOException {} when deleteB3DaftarBahanBerbahaya", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when deleteB3DaftarBahanBerbahaya", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when deleteB3DaftarBahanBerbahaya", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }

View File

@ -22,7 +22,7 @@ import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE; 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.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 com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*; import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@ -48,11 +48,11 @@ public class BakuMutuController extends LocaleController<BakuMutuVO> {
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when addBakuMutu", e.getMessage()); LOGGER.error("Got ServiceVOException {} when addBakuMutu", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when addBakuMutu", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when addBakuMutu", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -66,11 +66,11 @@ public class BakuMutuController extends LocaleController<BakuMutuVO> {
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when findAllBakuMutu", e.getMessage()); LOGGER.error("Got ServiceVOException {} when findAllBakuMutu", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when findAllBakuMutu", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when findAllBakuMutu", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -83,11 +83,11 @@ public class BakuMutuController extends LocaleController<BakuMutuVO> {
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getBakuMutuParent", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getBakuMutuParent", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getBakuMutuParent", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getBakuMutuParent", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -101,11 +101,11 @@ public class BakuMutuController extends LocaleController<BakuMutuVO> {
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when getBakuMutuChild", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getBakuMutuChild", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when getBakuMutuChild", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getBakuMutuChild", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -119,11 +119,11 @@ public class BakuMutuController extends LocaleController<BakuMutuVO> {
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when bakuMutuById", e.getMessage()); LOGGER.error("Got ServiceVOException {} when bakuMutuById", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when bakuMutuById", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when bakuMutuById", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }

View File

@ -24,7 +24,7 @@ import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE; 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.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 com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*; import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@ -54,11 +54,11 @@ public class BatalRegistrasiController extends LocaleController<BatalRegistrasiV
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when saveBatalRegistrasi", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveBatalRegistrasi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when saveBatalRegistrasi", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveBatalRegistrasi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }

View File

@ -20,7 +20,7 @@ import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE; 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.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 com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*; import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@ -47,12 +47,12 @@ public class BentukProdukController extends LocaleController<BentukProdukVO> {
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when save", e.getMessage()); LOGGER.error("Got ServiceVOException {} when save", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when save", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when save", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }

View File

@ -1,118 +1,76 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.Collection; import com.jasamedika.medifirst2000.constants.MessageResource;
import java.util.HashMap; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import java.util.List; import com.jasamedika.medifirst2000.entities.BobotIndikator;
import java.util.Map; import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.BobotIndikatorService;
import javax.servlet.http.HttpServletRequest; import com.jasamedika.medifirst2000.vo.BobotIndikatorVO;
import javax.validation.Valid; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.Specification; 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.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException; import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; 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.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants; import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.MessageResource; import javax.validation.Valid;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController; import java.util.Collection;
import com.jasamedika.medifirst2000.controller.base.LocaleController; import java.util.Map;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.entities.BobotIndikator;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.BobotIndikatorService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.BobotIndikatorVO;
import net.kaczmarzyk.spring.data.jpa.domain.Equal; import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec; 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 @RestController
@RequestMapping("/bobot-indikator") @RequestMapping("/bobot-indikator")
public class BobotIndikatorController extends LocaleController<BobotIndikatorVO> public class BobotIndikatorController extends LocaleController<BobotIndikatorVO> {
implements IBaseRestController<BobotIndikatorVO>{
@Autowired @Autowired
private BobotIndikatorService bobotService; private BobotIndikatorService bobotService;
private static final Logger LOGGER = LoggerFactory private static final Logger LOGGER = LoggerFactory.getLogger(BobotIndikatorController.class);
.getLogger(PegawaiController.class);
@Override @RequestMapping(value = "/find-all/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<BobotIndikatorVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page, public ResponseEntity<Collection<PasienVO>> findAll(
Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<BobotIndikatorVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(BobotIndikatorVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(BobotIndikatorVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<BobotIndikatorVO>> getAllVO() {
return null;
}
@RequestMapping(value="/find-all/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<BobotIndikator>> findAll(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page, @RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "take", required = false, defaultValue = "100") Integer take, @RequestParam(value = "take", required = false, defaultValue = "100") Integer take,
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort, @RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir, @RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
@Spec(path = "id", params = "id", spec = Equal.class) Specification<BobotIndikator> spec) @Spec(path = "id", params = "id", spec = Equal.class) Specification<BobotIndikator> spec) {
{ Map<String, Object> result = bobotService.findAll(page, take, sort, dir, spec);
Map<String, Object> result = new HashMap<String, Object>(); return constructListPageResult(result);
result = bobotService.findAll(page, take, sort,dir, spec);
return constructListPageResult(result);
} }
@RequestMapping(value="/save/", method= RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/save/", method = POST, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody BobotIndikatorVO vo,HttpServletRequest request){ public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody BobotIndikatorVO vo,
try{ HttpServletRequest request) {
try {
Map<String, Object> result = bobotService.save(vo); Map<String, Object> result = bobotService.save(vo);
if(null!= result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS,request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add/update Bobot IKU", e.getMessage()); LOGGER.error("Got ServiceVOException {} when save", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, e.getMessage());
e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add/update Bobot IKU", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when save", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
} }
} }
} }

View File

@ -1,77 +1,66 @@
package com.jasamedika.medifirst2000.controller; 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.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.dto.BowidickDto; import com.jasamedika.medifirst2000.dto.BowidickDto;
import com.jasamedika.medifirst2000.dto.PenerimaanLinenDto;
import com.jasamedika.medifirst2000.service.BowidickService; import com.jasamedika.medifirst2000.service.BowidickService;
import com.jasamedika.medifirst2000.util.rest.RestUtil; import com.jasamedika.medifirst2000.vo.BowidickVO;
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.Collections;
import java.util.List;
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 @RestController
@RequestMapping("/bowidick") @RequestMapping("/bowidick")
public class BowidickController extends LocaleController { public class BowidickController extends LocaleController<BowidickVO> {
@Autowired @Autowired
private BowidickService bowidickService; private BowidickService bowidickService;
@RequestMapping(value="/save-bowidick", @RequestMapping(value = "/save-bowidick", method = POST, produces = APPLICATION_JSON_VALUE)
method = RequestMethod.POST, public ResponseEntity<List<Map<String, Object>>> saveBowidick(@RequestBody BowidickDto dto,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> saveBowidick(
@RequestBody BowidickDto dto,
HttpServletRequest request) { HttpServletRequest request) {
Map<String, Object> result = this.bowidickService.saveBowidick(dto); Map<String, Object> result = this.bowidickService.saveBowidick(dto);
if (!result.isEmpty()) { if (!result.isEmpty()) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage); return getJsonResponse(Collections.singletonList(result), OK, mapHeaderMessage);
} }
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} }
@RequestMapping(value="/get-bowidick", @RequestMapping(value = "/get-bowidick", method = GET, produces = APPLICATION_JSON_VALUE)
method = RequestMethod.GET, public ResponseEntity<Map<String, Object>> getBowidick(@RequestParam(value = "startDate") String startDate,
produces = MediaType.APPLICATION_JSON_VALUE) @RequestParam(value = "endDate") String endDate, HttpServletRequest request) {
public ResponseEntity<Map<String, Object>> getBowidick(
@RequestParam(value="startDate") String startDate,
@RequestParam(value="endDate") String endDate,
HttpServletRequest request) {
Map<String, Object> result = this.bowidickService.getBowidick(startDate, endDate); Map<String, Object> result = this.bowidickService.getBowidick(startDate, endDate);
if (!result.isEmpty()) { if (!result.isEmpty()) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage); return getJsonResponse(result, OK, mapHeaderMessage);
} }
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} }
@RequestMapping(value="/get-bowidick-by-norec", @RequestMapping(value = "/get-bowidick-by-norec", method = GET, produces = APPLICATION_JSON_VALUE)
method = RequestMethod.GET, public ResponseEntity<Map<String, Object>> getBowidickByNoRec(@RequestParam("noRec") String noRec,
produces = MediaType.APPLICATION_JSON_VALUE) HttpServletRequest request) {
public ResponseEntity<Map<String, Object>> getBowidickByNoRec(
@RequestParam("noRec")String noRec, HttpServletRequest request) {
Map<String, Object> result = this.bowidickService.getBowidickbyNorec(noRec); Map<String, Object> result = this.bowidickService.getBowidickbyNorec(noRec);
if (!result.isEmpty()) { if (!result.isEmpty()) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage); return getJsonResponse(result, OK, mapHeaderMessage);
} }
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} }
} }

View File

@ -1,53 +1,48 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.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.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.service.BundleSetAlatService; import com.jasamedika.medifirst2000.service.BundleSetAlatService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.BundleSetAlatVO; import com.jasamedika.medifirst2000.vo.BundleSetAlatVO;
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 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 @RestController
@RequestMapping("/bundlesetalat") @RequestMapping("/bundlesetalat")
public class BundleSetAlatController extends LocaleController { public class BundleSetAlatController extends LocaleController<BundleSetAlatVO> {
@Autowired @Autowired
private BundleSetAlatService bundleSetAlatService; private BundleSetAlatService bundleSetAlatService;
@RequestMapping(value="/get-bundle-set-alat", @RequestMapping(value = "/get-bundle-set-alat", method = GET, produces = APPLICATION_JSON_VALUE)
method=RequestMethod.GET,
produces=MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getBundleSetAlat(HttpServletRequest request) { public Map<String, Object> getBundleSetAlat(HttpServletRequest request) {
Map<String, Object> result = this.bundleSetAlatService.getBundleSetAlat(); return this.bundleSetAlatService.getBundleSetAlat();
return result;
} }
@RequestMapping(value="/save-bundle-set-alat", @RequestMapping(value = "/save-bundle-set-alat", method = POST, produces = APPLICATION_JSON_VALUE)
method = RequestMethod.POST, public ResponseEntity<Map<String, Object>> saveDistribusiLinenExternal(@RequestBody BundleSetAlatVO vo,
produces = MediaType.APPLICATION_JSON_VALUE) HttpServletRequest request) {
public ResponseEntity<Map<String, Object>> saveDistribusiLinenExternal(
@RequestBody BundleSetAlatVO vo, HttpServletRequest request){
Map<String, Object> result = this.bundleSetAlatService.saveBundleSetAlat(vo); Map<String, Object> result = this.bundleSetAlatService.saveBundleSetAlat(vo);
if (!result.isEmpty()) { if (!result.isEmpty()) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage); return getJsonResponse(result, OK, mapHeaderMessage);
} }
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} }
} }

View File

@ -1,131 +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. CatatanPerkembanganService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.CatatanPerkembanganVO;
@RestController
@RequestMapping("/catatanPerkembangan")
public class CatatanPerkembanganController extends LocaleController<CatatanPerkembanganVO> implements IBaseRestController<CatatanPerkembanganVO>{
@Autowired
private CatatanPerkembanganService catatanPerkembanganService;
private static final Logger LOGGER = LoggerFactory
.getLogger(CatatanPerkembanganController.class);
@Override
public ResponseEntity<Collection<CatatanPerkembanganVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<CatatanPerkembanganVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(CatatanPerkembanganVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(CatatanPerkembanganVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<CatatanPerkembanganVO>> getAllVO() {
return null;
}
@RequestMapping(value = "/save-catatan-perkembangan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody CatatanPerkembanganVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=catatanPerkembanganService.saveCatatanPerkembangan(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 = "/update-catatan-perkembangan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<Map<String,Object>> editVO(@Valid @RequestBody CatatanPerkembanganVO vo, HttpServletRequest request) {
//
// try {
// Map<String,Object> result=catatanPerkembanganService.updateCatatanPerkembangan(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);
// }
// }
@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 = catatanPerkembanganService.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,39 +1,41 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.Map; import com.jasamedika.medifirst2000.base.vo.BaseModelVO;
import com.jasamedika.medifirst2000.constants.MessageResource;
import javax.servlet.http.HttpServletRequest; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import javax.servlet.http.HttpServletResponse; import com.jasamedika.medifirst2000.exception.ServiceVOException;
import javax.validation.Valid; import com.jasamedika.medifirst2000.service.CekListGedungBangunanHeaderService;
import com.jasamedika.medifirst2000.service.CekListGedungBangunanService;
import com.jasamedika.medifirst2000.vo.CekListGedungBangunanHeaderVO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException; import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; 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.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.base.vo.BaseModelVO; import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.Constants; import javax.servlet.http.HttpServletResponse;
import com.jasamedika.medifirst2000.constants.MessageResource; import javax.validation.Valid;
import com.jasamedika.medifirst2000.controller.base.LocaleController; import java.util.Map;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException; import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.ERROR_MESSAGE;
import com.jasamedika.medifirst2000.service.CekListGedungBangunanHeaderService; import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import com.jasamedika.medifirst2000.service.CekListGedungBangunanService; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import com.jasamedika.medifirst2000.util.rest.RestUtil; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import com.jasamedika.medifirst2000.vo.AkunVO; import static org.springframework.http.HttpStatus.*;
import com.jasamedika.medifirst2000.vo.CekListGedungBangunanHeaderVO; 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 @RestController
@RequestMapping("/ceklistgedungbangunan") @RequestMapping("/ceklistgedungbangunan")
public class CekListGedungBangunanController extends LocaleController<BaseModelVO> { public class CekListGedungBangunanController extends LocaleController<BaseModelVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(CekListGedungBangunanController.class); private static final Logger LOGGER = LoggerFactory.getLogger(CekListGedungBangunanController.class);
@Autowired @Autowired
@ -42,99 +44,73 @@ public class CekListGedungBangunanController extends LocaleController<BaseModelV
@Autowired @Autowired
private CekListGedungBangunanHeaderService cekListGedungBangunanHeaderService; private CekListGedungBangunanHeaderService cekListGedungBangunanHeaderService;
@RequestMapping(value = "/get-cek-list-gedung-bangunan", @RequestMapping(value = "/get-cek-list-gedung-bangunan", method = GET, produces = APPLICATION_JSON_VALUE)
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getCekListBangunanGedung(HttpServletRequest request) { public Map<String, Object> getCekListBangunanGedung(HttpServletRequest request) {
Map<String, Object> data = this.cekListGedungBangunanService.getCekListGedungBangunan(); return this.cekListGedungBangunanService.getCekListGedungBangunan();
return data;
} }
@RequestMapping(value = "/save-perawatan-gedung/", @RequestMapping(value = "/save-perawatan-gedung/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
method = RequestMethod.POST, public ResponseEntity<Map<String, Object>> savePerawatanGedung(@Valid @RequestBody CekListGedungBangunanHeaderVO vo,
produces = MediaType.APPLICATION_JSON_VALUE, HttpServletRequest request, HttpServletResponse response) {
consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePerawatanGedung(
@Valid @RequestBody CekListGedungBangunanHeaderVO vo,
HttpServletRequest request,HttpServletResponse response) {
try { try {
//Map<String, Object> result = cekListGedungBangunanHeaderService.saveTrans(vo);
Map<String, Object> result = this.cekListGedungBangunanHeaderService.savePemeliharaanGedung(vo); Map<String, Object> result = this.cekListGedungBangunanHeaderService.savePemeliharaanGedung(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, CREATED, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when savePerawatanGedung", e.getMessage()); LOGGER.error("Got ServiceVOException {} when savePemeliharaanGedung", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when savePerawatanGedung", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when savePemeliharaanGedung", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@RequestMapping(value = "/save-jadwal-perawatan-gedung/", @RequestMapping(value = "/save-jadwal-perawatan-gedung/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveJadwalPerawatanGedung( public ResponseEntity<Map<String, Object>> saveJadwalPerawatanGedung(
@Valid @RequestBody CekListGedungBangunanHeaderVO vo, @Valid @RequestBody CekListGedungBangunanHeaderVO vo, HttpServletRequest request,
HttpServletRequest request,HttpServletResponse response) { HttpServletResponse response) {
try { try {
Map<String, Object> result = cekListGedungBangunanHeaderService.saveCekListMasterToJadwalGedung(vo); Map<String, Object> result = cekListGedungBangunanHeaderService.saveCekListMasterToJadwalGedung(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, CREATED, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when saveJadwalPerawatanGedung", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveCekListMasterToJadwalGedung", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveJadwalPerawatanGedung", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveCekListMasterToJadwalGedung", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@RequestMapping(value = "/save-jadwal-perawatan-gedung-v1/", @RequestMapping(value = "/save-jadwal-perawatan-gedung-v1/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveJadwalPerawatanGedungV1( public ResponseEntity<Map<String, Object>> saveJadwalPerawatanGedungV1(
@Valid @RequestBody CekListGedungBangunanHeaderVO vo, @Valid @RequestBody CekListGedungBangunanHeaderVO vo, HttpServletRequest request,
HttpServletRequest request,HttpServletResponse response) { HttpServletResponse response) {
try { try {
Map<String, Object> result = cekListGedungBangunanHeaderService.savePenjadwalanGedung(vo); Map<String, Object> result = cekListGedungBangunanHeaderService.savePenjadwalanGedung(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, CREATED, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when saveJadwalPerawatanGedung", e.getMessage()); LOGGER.error("Got ServiceVOException {} when savePenjadwalanGedung", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveJadwalPerawatanGedung", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when savePenjadwalanGedung", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@RequestMapping(value = "/get-cek-list-jadwal-pemeliharan-gedung", @RequestMapping(value = "/get-cek-list-jadwal-pemeliharan-gedung", method = GET, produces = APPLICATION_JSON_VALUE)
method = RequestMethod.GET, public Map<String, Object> getCekListPemeliharaanGedung(@RequestParam("noRec") String noRec) {
produces = MediaType.APPLICATION_JSON_VALUE) return this.cekListGedungBangunanHeaderService.getCekListPemeliharanGedungByNoRec(noRec);
public Map<String, Object> getCekListPemeliharaanGedung(@RequestParam("noRec")String noRec) {
Map<String, Object> data = this.cekListGedungBangunanHeaderService.getCekListPemeliharanGedungByNoRec(noRec);
return data;
} }
} }

View File

@ -1,95 +1,57 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.Collection; import com.jasamedika.medifirst2000.constants.MessageResource;
import java.util.List; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import java.util.Map; import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CetakPengantarSuratService;
import javax.servlet.http.HttpServletRequest; import com.jasamedika.medifirst2000.vo.CetakPengantarSuratVO;
import javax.validation.Valid;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; 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.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException; import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants; import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.MessageResource; import javax.validation.Valid;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController; import java.util.Map;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants; import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import com.jasamedika.medifirst2000.exception.ServiceVOException; import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import com.jasamedika.medifirst2000.service.CetakPengantarSuratService; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import com.jasamedika.medifirst2000.util.rest.RestUtil; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import com.jasamedika.medifirst2000.vo.CetakPengantarSuratVO; 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 @RestController
@RequestMapping("/pengantar-surat") @RequestMapping("/pengantar-surat")
public class CetakPengantarSuratController extends LocaleController<CetakPengantarSuratVO> implements IBaseRestController<CetakPengantarSuratVO>{ public class CetakPengantarSuratController extends LocaleController<CetakPengantarSuratVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(CetakPengantarSuratController.class);
@Autowired @Autowired
private CetakPengantarSuratService pengantarSuratService; private CetakPengantarSuratService pengantarSuratService;
private static final Logger LOGGER = LoggerFactory @RequestMapping(value = "/save-pengantar-surat/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
.getLogger(CetakPengantarSuratController.class); public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody CetakPengantarSuratVO vo,
HttpServletRequest request) {
@RequestMapping(value = "/save-pengantar-surat/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody CetakPengantarSuratVO vo, HttpServletRequest request) {
try { try {
Map<String,Object> result=pengantarSuratService.addPengantarSurat(vo); Map<String, Object> result = pengantarSuratService.addPengantarSurat(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request )); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Sasaran Strategis", e.getMessage()); LOGGER.error("Got ServiceVOException {} when addPengantarSurat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, e.getMessage());
e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Sasaran Strategis", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when addPengantarSurat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
} }
} }
@Override
public ResponseEntity<Collection<CetakPengantarSuratVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<CetakPengantarSuratVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(CetakPengantarSuratVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(CetakPengantarSuratVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<CetakPengantarSuratVO>> getAllVO() {
return null;
}
} }

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.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS; 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 com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*; import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
@ -48,13 +48,13 @@ public class CheckInController extends LocaleController<CheckInVO> {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when save check in", e.getMessage()); LOGGER.error("Got ServiceVOException {} when addCheckIn", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when save check in", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when addCheckIn", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -70,13 +70,13 @@ public class CheckInController extends LocaleController<CheckInVO> {
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage); return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
} }
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when get check in by norec", e.getMessage()); LOGGER.error("Got ServiceVOException {} when findByNoRec", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when get check in by norec", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when findByNoRec", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@ -94,14 +94,14 @@ public class CheckInController extends LocaleController<CheckInVO> {
} }
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when get check in by norec antrian", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getCheckInByNoRecAntrian", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get check in by norec antrian", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getCheckInByNoRecAntrian", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttptatus(CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }

View File

@ -1,40 +1,39 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.Map; import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdBmhpService;
import com.jasamedika.medifirst2000.service.StokProdukGlobalService;
import com.jasamedika.medifirst2000.vo.CssdBmhpHeaderVO;
import com.jasamedika.medifirst2000.vo.CssdBmhpVO;
import com.jasamedika.medifirst2000.vo.CssdProduksiBmhpHeaderVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.Map;
import org.slf4j.Logger; import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import org.slf4j.LoggerFactory; import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import org.springframework.beans.factory.annotation.Autowired; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import org.springframework.http.HttpStatus; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import org.springframework.http.MediaType; import static org.springframework.http.HttpStatus.*;
import org.springframework.http.ResponseEntity; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import org.springframework.orm.jpa.JpaSystemException; import static org.springframework.web.bind.annotation.RequestMethod.GET;
import org.springframework.web.bind.annotation.RequestBody; import static org.springframework.web.bind.annotation.RequestMethod.POST;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdBmhpService;
import com.jasamedika.medifirst2000.service.StokProdukGlobalService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.CssdBmhpHeaderVO;
import com.jasamedika.medifirst2000.vo.CssdProduksiBmhpHeaderVO;
import com.jasamedika.medifirst2000.vo.PermintaanPerbaikanVO;
@RestController @RestController
@RequestMapping("/cssd-bmhp") @RequestMapping("/cssd-bmhp")
public class CssdBmhpController extends LocaleController { public class CssdBmhpController extends LocaleController<CssdBmhpVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(CssdBmhpController.class);
@Autowired @Autowired
private CssdBmhpService cssdBmhpService; private CssdBmhpService cssdBmhpService;
@ -42,73 +41,49 @@ public class CssdBmhpController extends LocaleController {
@Autowired @Autowired
private StokProdukGlobalService stokProdukGlobalService; private StokProdukGlobalService stokProdukGlobalService;
private static final Logger LOGGER = LoggerFactory.getLogger(CssdBmhpController.class); @RequestMapping(value = "/save-bmhp/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveCssdBmhp(@Valid @RequestBody CssdBmhpHeaderVO vo,
@RequestMapping(value = "/save-bmhp/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) HttpServletRequest request, HttpServletResponse response) {
public ResponseEntity<Map<String, Object>> saveCssdBmhp(@Valid @RequestBody CssdBmhpHeaderVO vo,HttpServletRequest request,HttpServletResponse response) {
try { try {
Map<String, Object> result = cssdBmhpService.saveCssdBmhp(vo); Map<String, Object> result = cssdBmhpService.saveCssdBmhp(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Permintaan Perbaikan", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveCssdBmhp", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Permintaan Perbaikan", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveCssdBmhp", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@RequestMapping(value = "/produksi-bmhp/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/produksi-bmhp/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> produksiBmhp(@Valid @RequestBody CssdProduksiBmhpHeaderVO vo,HttpServletRequest request,HttpServletResponse response) { public ResponseEntity<Map<String, Object>> produksiBmhp(@Valid @RequestBody CssdProduksiBmhpHeaderVO vo,
HttpServletRequest request, HttpServletResponse response) {
try { try {
Map<String, Object> result = cssdBmhpService.produksiBmhp(vo); Map<String, Object> result = cssdBmhpService.produksiBmhp(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Permintaan Perbaikan", e.getMessage()); LOGGER.error("Got ServiceVOException {} when produksiBmhp", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Permintaan Perbaikan", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when produksiBmhp", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
// Menampilkan Kartu Pengendali Berdasarkan Norec (array) @RequestMapping(value = "/detail-produk-bmhp", method = GET, produces = APPLICATION_JSON_VALUE)
@RequestMapping(value = "/detail-produk-bmhp", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public Map<String, Object> detailProdukBmhp(@RequestParam(value = "produkId") Integer produkId) {
public Map<String, Object> detailProdukBmhp(@RequestParam(value = "produkId", required = true) Integer produkId) { return cssdBmhpService.detailProdukBmhp(produkId);
Map<String, Object> result = cssdBmhpService.detailProdukBmhp(produkId);
return result;
} }
@SuppressWarnings("unchecked")
@RequestMapping(value = "/list-barang-bmhp")
@ResponseBody
public Map<String, Object> listBarangBmhp(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "take", required = false, defaultValue = "10000000") Integer limit,
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
@RequestParam(value = "produkId", required = false) Integer produkId) {
Map<String, Object> resultPageMap = cssdBmhpService.listBarangBmhp(page,limit,sort,dir,produkId);
return resultPageMap;
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/master-bmhp") @RequestMapping(value = "/master-bmhp")
@ResponseBody @ResponseBody
public Map<String, Object> listBarangBmhp( public Map<String, Object> listBarangBmhp(
@ -116,13 +91,9 @@ public class CssdBmhpController extends LocaleController {
@RequestParam(value = "take", required = false, defaultValue = "10000000") Integer limit, @RequestParam(value = "take", required = false, defaultValue = "10000000") Integer limit,
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort, @RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir) { @RequestParam(value = "dir", required = false, defaultValue = "asc") String dir) {
return cssdBmhpService.masterBmhp(page, limit, sort, dir);
Map<String, Object> resultPageMap = cssdBmhpService.masterBmhp(page, limit, sort, dir);
return resultPageMap;
} }
@SuppressWarnings("unchecked")
@RequestMapping(value = "/barang-persediaan") @RequestMapping(value = "/barang-persediaan")
@ResponseBody @ResponseBody
public Map<String, Object> barangPersediaan( public Map<String, Object> barangPersediaan(
@ -130,17 +101,12 @@ public class CssdBmhpController extends LocaleController {
@RequestParam(value = "take", required = false, defaultValue = "10000000") Integer limit, @RequestParam(value = "take", required = false, defaultValue = "10000000") Integer limit,
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort, @RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir) { @RequestParam(value = "dir", required = false, defaultValue = "asc") String dir) {
return cssdBmhpService.barangPersediaan(page, limit, sort, dir);
Map<String, Object> resultPageMap = cssdBmhpService.barangPersediaan(page, limit, sort, dir);
return resultPageMap;
} }
// Menampilkan Kartu Pengendali Berdasarkan Norec (array) @RequestMapping(value = "/get-stok-by-ruangan", method = GET, produces = APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-stok-by-ruangan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> stokProdukGlobal() { public Map<String, Object> stokProdukGlobal() {
Map<String, Object> result = stokProdukGlobalService.getStokByRuangan(); return stokProdukGlobalService.getStokByRuangan();
return result;
} }
} }

View File

@ -1,16 +1,17 @@
package com.jasamedika.medifirst2000.util.rest; package com.jasamedika.medifirst2000.util.rest;
import com.google.gson.Gson;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.springframework.http.HttpHeaders; import static org.springframework.http.HttpStatus.OK;
import org.springframework.http.HttpStatus; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import com.google.gson.Gson;
/** /**
* Rest Util Class * Rest Util Class
@ -20,67 +21,44 @@ import com.google.gson.Gson;
public class RestUtil { public class RestUtil {
private static final String CONTENT_TYPE = "Content-Type"; private static final String CONTENT_TYPE = "Content-Type";
private static final String ACCESS_CONTROL_ALLOW_ORIGIN = "Access-Control-Allow-Origin";
/** /**
* get JSON response from Object * get JSON response from Object
* *
* @param src
* @param <T> * @param <T>
* source class * source class
* @return @ResponseEntity * @return @ResponseEntity
*/ */
public static <T> ResponseEntity<T> getJsonResponse(T src) { public static <T> ResponseEntity<T> getJsonResponse(T src) {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
//headers.add(ACCESS_CONTROL_ALLOW_ORIGIN, "*"); headers.set(CONTENT_TYPE, APPLICATION_JSON_VALUE);
headers.set(CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); return new ResponseEntity<>(src, headers, OK);
return new ResponseEntity<T>(src, headers, HttpStatus.OK);
} }
/** /**
* get JSON response from Object with HTTP status * get JSON response from Object with HTTP status
* *
* @param src * @param <T> source class
* @param <T>
* source class
* @return @ResponseEntity * @return @ResponseEntity
*/ */
public static <T> ResponseEntity<T> getJsonResponse(T src, HttpStatus status) { public static <T> ResponseEntity<T> getJsonResponse(T src, HttpStatus status) {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
// headers.add(ACCESS_CONTROL_ALLOW_ORIGIN, "*"); headers.set(CONTENT_TYPE, APPLICATION_JSON_VALUE);
headers.set(CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); Map<String, Object> map = new HashMap<>();
Map<String,Object> map=new HashMap<String,Object>();
map.put("data", src); map.put("data", src);
return new ResponseEntity(map, headers, status); return new ResponseEntity(map, headers, status);
} }
/** public static <T> ResponseEntity<T> getJsonResponse(T src, HttpStatus status,
* Map<String, String> mapHeaderMessage) {
* @param src
* @param status
* @param mapHeaderMessage
* @param <T>
* @return
*/
public static <T> ResponseEntity<T> getJsonResponse(T src,
HttpStatus status, Map<String, String> mapHeaderMessage) {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
if (null != mapHeaderMessage)
if (null != mapHeaderMessage) { for (String key : mapHeaderMessage.keySet())
for (String key : mapHeaderMessage.keySet()) {
headers.add(key, mapHeaderMessage.get(key)); headers.add(key, mapHeaderMessage.get(key));
} Map<String, Object> map = new HashMap<>();
}
Map<String,Object> map=new HashMap<String,Object>();
map.put("messages", mapHeaderMessage); map.put("messages", mapHeaderMessage);
map.put("data", src); map.put("data", src);
//headers.add(ACCESS_CONTROL_ALLOW_ORIGIN, "*"); headers.set(CONTENT_TYPE, APPLICATION_JSON_VALUE);
headers.set(CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
return new ResponseEntity(map, headers, status); return new ResponseEntity(map, headers, status);
} }
@ -91,123 +69,87 @@ public class RestUtil {
* source class * source class
* @return @ResponseEntity * @return @ResponseEntity
*/ */
public static <T> ResponseEntity<T> getJsonHttptatus(HttpStatus status) { public static <T> ResponseEntity<T> getJsonHttpStatus(HttpStatus status) {
return new ResponseEntity<>(status);
return new ResponseEntity<T>(status);
} }
public static <T> ResponseEntity<T> getJsonHttpStatus(HttpStatus status, Map<String, String> mapHeaderMessage) {
public static <T> ResponseEntity<T> getJsonHttptatus(HttpStatus status,
Map<String, String> mapHeaderMessage) {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
if (null != mapHeaderMessage)
if (null != mapHeaderMessage) { for (String key : mapHeaderMessage.keySet())
for (String key : mapHeaderMessage.keySet()) {
headers.add(key, mapHeaderMessage.get(key)); headers.add(key, mapHeaderMessage.get(key));
} headers.set(CONTENT_TYPE, APPLICATION_JSON_VALUE);
} return new ResponseEntity<>(headers, status);
headers.set(CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
return new ResponseEntity<T>(headers, status);
} }
/** /**
* get JSON response from Set Object * get JSON response from Set Object
* *
* @param src
* @param <T> * @param <T>
* source class * source class
* @return @ResponseEntity * @return @ResponseEntity
*/ */
public static <T> ResponseEntity<Set<T>> defaultJsonResponse(Set<T> src) { public static <T> ResponseEntity<Set<T>> defaultJsonResponse(Set<T> src) {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
// headers.add(ACCESS_CONTROL_ALLOW_ORIGIN, "*"); headers.set(CONTENT_TYPE, APPLICATION_JSON_VALUE);
headers.set(CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); return new ResponseEntity<>(src, headers, OK);
return new ResponseEntity<Set<T>>(src, headers, HttpStatus.OK);
} }
/** /**
* get JSON response from Set Object with custom header * get JSON response from Set Object with custom header
* *
* @param src
* @param mapHeaderMessage
* @param <T> * @param <T>
* source class * source class
* @return @ResponseEntity * @return @ResponseEntity
*/ */
public static <T> ResponseEntity<Set<T>> defaultJsonResponse(Set<T> src, Map<String, String> mapHeaderMessage) { public static <T> ResponseEntity<Set<T>> defaultJsonResponse(Set<T> src, Map<String, String> mapHeaderMessage) {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
if (null != mapHeaderMessage)
if (null != mapHeaderMessage) { for (String key : mapHeaderMessage.keySet())
for (String key : mapHeaderMessage.keySet()) {
headers.add(key, mapHeaderMessage.get(key)); headers.add(key, mapHeaderMessage.get(key));
} headers.set(CONTENT_TYPE, APPLICATION_JSON_VALUE);
}// headers.add(ACCESS_CONTROL_ALLOW_ORIGIN, "*"); return new ResponseEntity<>(src, headers, OK);
headers.set(CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
return new ResponseEntity<Set<T>>(src, headers, HttpStatus.OK);
} }
/** /**
* get JSON response from List Object with custom header * get JSON response from List Object with custom header
* *
* @param src
* @param mapHeaderMessage
* @param <T> * @param <T>
* source class * source class
* @return @ResponseEntity * @return @ResponseEntity
*/ */
public static <T> ResponseEntity<List<T>> defaultJsonResponse(List<T> src, Map<String, String> mapHeaderMessage) { public static <T> ResponseEntity<List<T>> defaultJsonResponse(List<T> src, Map<String, String> mapHeaderMessage) {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
if (null != mapHeaderMessage)
if (null != mapHeaderMessage) { for (String key : mapHeaderMessage.keySet())
for (String key : mapHeaderMessage.keySet()) {
headers.add(key, mapHeaderMessage.get(key)); headers.add(key, mapHeaderMessage.get(key));
} headers.set(CONTENT_TYPE, APPLICATION_JSON_VALUE);
} return new ResponseEntity<>(src, headers, OK);
// headers.add(ACCESS_CONTROL_ALLOW_ORIGIN, "*");
headers.set(CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
return new ResponseEntity<List<T>>(src, headers, HttpStatus.OK);
} }
/** /**
* get JSON response from List Object * get JSON response from List Object
* *
* @param src
* @param <T> * @param <T>
* source class * source class
* @return @ResponseEntity * @return @ResponseEntity
*/ */
public static <T> ResponseEntity<List<T>> defaultJsonResponse(List<T> src) { public static <T> ResponseEntity<List<T>> defaultJsonResponse(List<T> src) {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
// headers.add(ACCESS_CONTROL_ALLOW_ORIGIN, "*"); headers.set(CONTENT_TYPE, APPLICATION_JSON_VALUE);
headers.set(CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); return new ResponseEntity<>(src, headers, OK);
return new ResponseEntity<List<T>>(src, headers, HttpStatus.OK);
} }
/** /**
* get default JSON response from Object * get default JSON response from Object
* *
* @param src
* @return @ResponseEntity * @return @ResponseEntity
*/ */
public static ResponseEntity<String> defaultJsonResponse(Object src) { public static ResponseEntity<String> defaultJsonResponse(Object src) {
Gson gson = new Gson(); Gson gson = new Gson();
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
// headers.add(ACCESS_CONTROL_ALLOW_ORIGIN, "*"); headers.set(CONTENT_TYPE, APPLICATION_JSON_VALUE);
headers.set(CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); return new ResponseEntity<>(gson.toJson(src), headers, OK);
return new ResponseEntity<String>(gson.toJson(src), headers,
HttpStatus.OK);
} }
/** /**
@ -217,9 +159,7 @@ public class RestUtil {
* string source JSON * string source JSON
* @param type * @param type
* class type result * class type result
* @param <T> */
* @return
*/
public static <T> T jsonToObject(String strJson, Class<T> type) { public static <T> T jsonToObject(String strJson, Class<T> type) {
Gson gson = new Gson(); Gson gson = new Gson();
return gson.fromJson(strJson, type); return gson.fromJson(strJson, type);
@ -228,9 +168,7 @@ public class RestUtil {
/** /**
* convert object to json * convert object to json
* *
* @param object */
* @return
*/
public static String toJson(Object object) { public static String toJson(Object object) {
Gson gson = new Gson(); Gson gson = new Gson();
return gson.toJson(object); return gson.toJson(object);