Update controller
Clean code
This commit is contained in:
parent
711084879d
commit
5405e1c11e
@ -1,81 +1,53 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.entities.DetailSWOT;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DetailSWOTService;
|
||||
import com.jasamedika.medifirst2000.vo.DetailSWOTVO;
|
||||
import com.jasamedika.medifirst2000.vo.PasienVO;
|
||||
import com.jasamedika.medifirst2000.vo.SWOTVO;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.GreaterThanOrEqual;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.LessThanOrEqual;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.data.jpa.domain.Specifications;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.data.jpa.domain.Specifications;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.entities.DetailSWOT;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DetailSWOTService;
|
||||
import com.jasamedika.medifirst2000.service.SWOTService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DetailSWOTVO;
|
||||
import com.jasamedika.medifirst2000.vo.SWOTVO;
|
||||
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.GreaterThanOrEqual;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.LessThanOrEqual;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/swot")
|
||||
public class SWOTController extends LocaleController<SWOTVO> implements
|
||||
IBaseRestController<SWOTVO>{
|
||||
|
||||
public class SWOTController extends LocaleController<SWOTVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(SWOTController.class);
|
||||
|
||||
@Autowired
|
||||
private DetailSWOTService detailSWOTService;
|
||||
|
||||
@Autowired
|
||||
private SWOTService swotService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(PegawaiController.class);
|
||||
|
||||
@RequestMapping(value="/find-all-faktor/", method= RequestMethod.GET)
|
||||
public ResponseEntity<List<SWOTVO>> findAllFaktor(HttpServletRequest request)
|
||||
{
|
||||
try{
|
||||
List<SWOTVO> listSwotVo = swotService.findAll();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(listSwotVo, HttpStatus.OK,mapHeaderMessage);
|
||||
}catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get all swot", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get all swot", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/find-detail-faktor/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Collection<DetailSWOT>> findDetailFaktor(
|
||||
|
||||
@RequestMapping(value = "/find-detail-faktor/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Collection<PasienVO>> findDetailFaktor(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "100") Integer take,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
|
||||
@ -83,120 +55,50 @@ IBaseRestController<SWOTVO>{
|
||||
@RequestParam(value = "faktorId", required = false, defaultValue = "1") Integer faktorId,
|
||||
@Spec(path = "awalPeriode", params = "awalPeriode", spec = GreaterThanOrEqual.class) Specification<DetailSWOT> awalPeriode,
|
||||
@Spec(path = "akhirPeriode", params = "akhirPeriode", spec = LessThanOrEqual.class) Specification<DetailSWOT> akhirPeriode,
|
||||
@Spec(path = "swot.id", params = "faktorId", spec = Equal.class) Specification<DetailSWOT> swot)
|
||||
{
|
||||
Specification<DetailSWOT> spec = Specifications.where(awalPeriode).and(akhirPeriode).and(swot);
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result = detailSWOTService.findDetail(page, take, sort,dir, spec);
|
||||
return constructListPageResult(result);
|
||||
@Spec(path = "swot.id", params = "faktorId", spec = Equal.class) Specification<DetailSWOT> swot) {
|
||||
Specification<DetailSWOT> spec = Specifications.where(awalPeriode).and(akhirPeriode).and(swot);
|
||||
Map<String, Object> result = detailSWOTService.findDetail(page, take, sort, dir, spec);
|
||||
return constructListPageResult(result);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/find-total-skor/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> findTotalSkor(
|
||||
|
||||
@RequestMapping(value = "/find-total-skor/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findTotalSkor(
|
||||
@RequestParam(value = "faktorId", required = false, defaultValue = "1") Integer faktorId,
|
||||
@RequestParam(value = "awalPeriode", required = false, defaultValue = "2016") Integer dateAwalPeriode,
|
||||
HttpServletRequest request)
|
||||
{
|
||||
try{
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("totalSkor", detailSWOTService.totalSkor(faktorId, dateAwalPeriode));
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add detailHasil", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when totalSkor", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add detailHasil", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when totalSkor", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/save-detail-faktor/", method= RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> saveDetailFaktor(@Valid @RequestBody List<DetailSWOTVO>vos,HttpServletRequest request){
|
||||
try{
|
||||
@RequestMapping(value = "/save-detail-faktor/", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveDetailFaktor(@Valid @RequestBody List<DetailSWOTVO> vos,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = detailSWOTService.saveDetailFaktor(vos);
|
||||
if(null!= result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add detailHasil", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when saveDetailFaktor", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add detailHasil", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveDetailFaktor", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete-detail-faktor/", method= RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> deleteDetailFaktor(@Valid @RequestBody List<DetailSWOTVO>vos,HttpServletRequest request){
|
||||
try{
|
||||
Map<String, Object> result = detailSWOTService.deleteDetailFaktor(vos);
|
||||
if(null!= result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when delete Detail Analisis", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when delete Detail Analisis", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<SWOTVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<SWOTVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(SWOTVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(SWOTVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<SWOTVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,63 +1,48 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.service.StokProdukGlobalService;
|
||||
import com.jasamedika.medifirst2000.vo.StokProdukGlobalVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.AlatService;
|
||||
import com.jasamedika.medifirst2000.service.StokProdukGlobalService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AlatVO;
|
||||
import com.jasamedika.medifirst2000.vo.StokProdukGlobalVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/stok-produk-global")
|
||||
public class StokProdukGlobalController extends LocaleController<StokProdukGlobalVO> {
|
||||
|
||||
|
||||
@Autowired
|
||||
private StokProdukGlobalService stokProdukGlobalService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(StokProdukGlobalController.class);
|
||||
|
||||
@RequestMapping(value = "/find-produk-obat-stok/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllVO(
|
||||
@RequestParam(value = "generikId", required = true) Integer generikId, HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/find-produk-obat-stok/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllVO(@RequestParam(value = "generikId") Integer generikId,
|
||||
HttpServletRequest request) {
|
||||
Map<String, Object> result = stokProdukGlobalService.findProdukObatAndStok(generikId);
|
||||
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
|
||||
boolean dataFound = (boolean) result.get("dataFound");
|
||||
mapHeaderMessage.clear();
|
||||
if (dataFound) {
|
||||
mapHeaderMessage.clear();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} else {
|
||||
mapHeaderMessage.clear();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
|
||||
getMessage(MessageResource.LABEL_ERROR, request));
|
||||
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@RequestMapping(value = "/list-stok")
|
||||
@ResponseBody
|
||||
public Map<String, Object> listStok(
|
||||
@ -70,28 +55,10 @@ public class StokProdukGlobalController extends LocaleController<StokProdukGloba
|
||||
@RequestParam(value = "asalProdukId", required = false) Integer asalProdukId,
|
||||
@RequestParam(value = "ruanganId", required = false) Integer ruanganId,
|
||||
@RequestParam(value = "jenisProdukId", required = false) Integer jenisProdukId) {
|
||||
|
||||
Map<String, Object> resultPageMap = stokProdukGlobalService.listStok(page, limit, sort, dir, kelompokProdukId, produkId, asalProdukId, ruanganId,jenisProdukId);
|
||||
|
||||
return resultPageMap;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/cetak-list-stok")
|
||||
@ResponseBody
|
||||
public Map<String, Object> cetakListStok(
|
||||
@RequestParam(value = "kelompokProdukId", required = false) Integer kelompokProdukId,
|
||||
@RequestParam(value = "produkId", required = false) Integer produkId,
|
||||
@RequestParam(value = "asalProdukId", required = false) Integer asalProdukId,
|
||||
@RequestParam(value = "ruanganId", required = false) Integer ruanganId,
|
||||
@RequestParam(value = "jenisProdukId", required = false) Integer jenisProdukId) {
|
||||
|
||||
Map<String, Object> resultPageMap = stokProdukGlobalService.cetakListStok(kelompokProdukId, produkId, asalProdukId, ruanganId,jenisProdukId);
|
||||
|
||||
return resultPageMap;
|
||||
return stokProdukGlobalService.listStok(page, limit, sort, dir, kelompokProdukId, produkId, asalProdukId,
|
||||
ruanganId, jenisProdukId);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/list-stok-detail")
|
||||
@ResponseBody
|
||||
public Map<String, Object> listStokDetail(
|
||||
@ -104,52 +71,21 @@ public class StokProdukGlobalController extends LocaleController<StokProdukGloba
|
||||
@RequestParam(value = "asalProdukId", required = false) Integer asalProdukId,
|
||||
@RequestParam(value = "ruanganId", required = false) Integer ruanganId,
|
||||
@RequestParam(value = "noTerima", required = false) String noTerima) {
|
||||
|
||||
Map<String, Object> resultPageMap = stokProdukGlobalService.listStokDetail(page,
|
||||
limit,
|
||||
sort,
|
||||
dir,
|
||||
kelompokProdukId,
|
||||
1, // Sementara
|
||||
produkId,
|
||||
asalProdukId,
|
||||
ruanganId,
|
||||
noTerima);
|
||||
|
||||
return resultPageMap;
|
||||
return stokProdukGlobalService.listStokDetail(page, limit, sort, dir, kelompokProdukId, 1, produkId,
|
||||
asalProdukId, ruanganId, noTerima);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/cetak-list-stok-detail")
|
||||
@ResponseBody
|
||||
public Map<String, Object> cetakListStokDetail(
|
||||
@RequestParam(value = "kelompokProdukId", required = false) Integer kelompokProdukId,
|
||||
@RequestParam(value = "produkId", required = false) Integer produkId,
|
||||
@RequestParam(value = "asalProdukId", required = false) Integer asalProdukId,
|
||||
@RequestParam(value = "ruanganId", required = false) Integer ruanganId,
|
||||
@RequestParam(value = "noTerima", required = false) String noTerima,
|
||||
@RequestParam(value = "jenisProdukId", required = false) Integer jenisProdukId) {
|
||||
|
||||
Map<String, Object> resultPageMap = stokProdukGlobalService.cetakListStokDetail(kelompokProdukId, produkId, asalProdukId, ruanganId,noTerima,jenisProdukId);
|
||||
|
||||
return resultPageMap;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-produk-obat-stok-no-generik/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/find-produk-obat-stok-no-generik/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getProdukObatStok(HttpServletRequest request) {
|
||||
Map<String, Object> result = stokProdukGlobalService.findProdukObatAndStok();
|
||||
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
|
||||
boolean dataFound = (boolean) result.get("dataFound");
|
||||
mapHeaderMessage.clear();
|
||||
if (dataFound) {
|
||||
mapHeaderMessage.clear();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} else {
|
||||
mapHeaderMessage.clear();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
|
||||
getMessage(MessageResource.LABEL_ERROR, request));
|
||||
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,74 +1,62 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.StrukBuktiPengeluaranService;
|
||||
import com.jasamedika.medifirst2000.vo.StrukPengeluaranVO;
|
||||
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 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.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.StrukBuktiPengeluaranService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.StrukPengeluaranVO;
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/struk-pengeluaran")
|
||||
public class StrukBuktiPengeluaranController extends LocaleController<StrukPengeluaranVO> {
|
||||
|
||||
@Autowired
|
||||
|
||||
@Autowired
|
||||
private StrukBuktiPengeluaranService strukBuktiPengeluaranService;
|
||||
|
||||
@RequestMapping(value = "/pengeluaran-umum", method = RequestMethod.POST,
|
||||
consumes = MediaType.APPLICATION_JSON_VALUE,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/pengeluaran-umum", method = POST, consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> simpanPengeluaranUmum(@RequestBody StrukPengeluaranVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = strukBuktiPengeluaranService.simpanPengeluaranUmum(vo);
|
||||
if (result != null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
} catch(ServiceVOException se) {
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, se.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch(JpaSystemException jse) {
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT);
|
||||
if (result != null)
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException se) {
|
||||
addHeaderMessage(ERROR_MESSAGE, se.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-struk-bukti-pengeluaran", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public List<Map<String, Object>> getDaftarTagihanRekananVerifikasi(
|
||||
|
||||
@RequestMapping(value = "/get-struk-bukti-pengeluaran", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public List<Map<String, Object>> getDaftarTagihanRekananVerifikasi(
|
||||
@RequestParam(value = "startDate", required = false) String startDate,
|
||||
@RequestParam(value = "endDate", required = false) String endDate,
|
||||
@RequestParam(value = "ketLain", required = false) String ketLain,
|
||||
@RequestParam(value = "idPegawai", required = false) Integer idPegawai,
|
||||
@RequestParam(value = "noSBK", required = false) String noSBK,
|
||||
@RequestParam(value = "idRuangan", required = false) Integer idRuangan) {
|
||||
List<Map<String, Object>> resultPageMap = strukBuktiPengeluaranService.getStrukBuktiPengeluaran(startDate,endDate, ketLain, idPegawai, noSBK, idRuangan);
|
||||
|
||||
return resultPageMap;
|
||||
return strukBuktiPengeluaranService.getStrukBuktiPengeluaran(startDate,
|
||||
endDate, ketLain, idPegawai, noSBK, idRuangan);
|
||||
}
|
||||
|
||||
// @RequestMapping(value = "/pengeluaran-umum", method = RequestMethod.GET,
|
||||
// produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
// public @ResponseBody Map<String, Object> getPengeluaranUmum(@RequestParam("norec") String norec) {
|
||||
// return strukBuktiPengeluaranService.ambilPengeluaranUmum(norec);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,96 +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.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.StrukKirimService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.StrukKirimVO;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/struk-kirim")
|
||||
public class StrukKirimController extends LocaleController<StrukKirimVO> implements IBaseRestController<StrukKirimVO>{
|
||||
|
||||
@Autowired
|
||||
private StrukKirimService strukKirimService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(StrukKirimController.class);
|
||||
|
||||
@RequestMapping(value = "/save-struk-kirim/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody StrukKirimVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=strukKirimService.addStrukKirim(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 Sasaran Strategis", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Sasaran Strategis", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<StrukKirimVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<StrukKirimVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(StrukKirimVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(StrukKirimVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<StrukKirimVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,194 +1,153 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
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.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.entities.LimbahB3Masuk;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DaftarStrukPenjualanService;
|
||||
import com.jasamedika.medifirst2000.service.InputKantongDarahService;
|
||||
import com.jasamedika.medifirst2000.service.LimbahB3MasukService;
|
||||
import com.jasamedika.medifirst2000.service.PelayananObatService;
|
||||
import com.jasamedika.medifirst2000.service.StrukPelayananService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.InputKantongDarahVO;
|
||||
import com.jasamedika.medifirst2000.vo.KirimProdukRuanganVO;
|
||||
import com.jasamedika.medifirst2000.vo.LimbahB3MasukVO;
|
||||
import com.jasamedika.medifirst2000.vo.PelayananObatVO;
|
||||
import com.jasamedika.medifirst2000.vo.StrukPelayananVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/struk-pelayanan")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class StrukPelayananController extends LocaleController<StrukPelayananVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(StrukPelayananController.class);
|
||||
|
||||
@Autowired
|
||||
private InputKantongDarahService inputKantongDarahService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private LimbahB3MasukService limbahB3MasukService;
|
||||
|
||||
private LimbahB3MasukService<LimbahB3Masuk> limbahB3MasukService;
|
||||
|
||||
@Autowired
|
||||
private StrukPelayananService strukPelayananService;
|
||||
|
||||
@Autowired
|
||||
private PelayananObatService pelayananObatService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(StrukPelayananController.class);
|
||||
|
||||
@RequestMapping(value = "/kirim-produk-ke-ruangan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> kirimProdukKeRuangan(@Valid @RequestBody KirimProdukRuanganVO vo,HttpServletRequest request) {
|
||||
private DaftarStrukPenjualanService service;
|
||||
|
||||
@RequestMapping(value = "/kirim-produk-ke-ruangan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> kirimProdukKeRuangan(@Valid @RequestBody KirimProdukRuanganVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=inputKantongDarahService.kirimProdukKeRuangan(vo);
|
||||
Map<String, Object> result = inputKantongDarahService.kirimProdukKeRuangan(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when save blood pack data", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when kirimProdukKeRuangan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when save blood pack data", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when kirimProdukKeRuangan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
@RequestMapping(value = "/simpan-kantong-darah", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveInputKantongDarah(@Valid @RequestBody InputKantongDarahVO vo,HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/simpan-kantong-darah", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveInputKantongDarah(@Valid @RequestBody InputKantongDarahVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=inputKantongDarahService.saveInputKantongDarah(vo);
|
||||
Map<String, Object> result = inputKantongDarahService.saveInputKantongDarah(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when save blood pack data", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveInputKantongDarah", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when save blood pack data", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveInputKantongDarah", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/simpan-limbah-b3-masuk", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveLimbahB3Masuk(@Valid @RequestBody LimbahB3MasukVO vo,HttpServletRequest request) throws IllegalAccessException {
|
||||
|
||||
@RequestMapping(value = "/simpan-limbah-b3-masuk", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveLimbahB3Masuk(@Valid @RequestBody LimbahB3MasukVO vo,
|
||||
HttpServletRequest request) throws IllegalAccessException {
|
||||
try {
|
||||
Map<String,Object> result=limbahB3MasukService.saveLimbahB3Masuk(vo);
|
||||
Map<String, Object> result = limbahB3MasukService.saveLimbahB3Masuk(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when save limbah b3 masuk data", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveLimbahB3Masuk", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when save limbah b3 masuk data", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveLimbahB3Masuk", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-limbah-b3-masuk", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> updateLimbahB3Masuk(@Valid @RequestBody LimbahB3MasukVO vo,HttpServletRequest request) throws IllegalAccessException {
|
||||
|
||||
@RequestMapping(value = "/update-limbah-b3-masuk", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> updateLimbahB3Masuk(@Valid @RequestBody LimbahB3MasukVO vo,
|
||||
HttpServletRequest request) throws IllegalAccessException {
|
||||
try {
|
||||
Map<String,Object> result=limbahB3MasukService.updateLimbahB3Masuk(vo);
|
||||
Map<String, Object> result = limbahB3MasukService.updateLimbahB3Masuk(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when save limbah b3 masuk data", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when updateLimbahB3Masuk", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when save limbah b3 masuk data", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when updateLimbahB3Masuk", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete-limbah-b3-masuk", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Boolean> deleteLimbahB3Masuk(
|
||||
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/delete-limbah-b3-masuk", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Boolean> deleteLimbahB3Masuk(@RequestParam(value = "noRec") String noRec,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Boolean result = limbahB3MasukService.deleteLimbahB3Masuk(noRec);
|
||||
if (result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got ServiceVOException {} when deleteLimbahB3Masuk", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException | IllegalAccessException e) {
|
||||
LOGGER.error("Got exception {} when deleteLimbahB3Masuk", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when deleteLimbahB3Masuk", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
} catch (IllegalAccessException e) {
|
||||
LOGGER.error("Got exception {} when deleteLimbahB3Masuk", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-all-limbah-b3-masuk/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=strukPelayananService.findAllStrukPelayananLimbahMasuk();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get all LimbahB3Masuk", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get all LimbahB3Masuk", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@RequestMapping(value = "/list-limbah-b3-masuk")
|
||||
public Map<String,Object> lisLimbahB3Masuk(
|
||||
public Map<String, Object> lisLimbahB3Masuk(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "10000") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "noRec") String sort,
|
||||
@ -196,71 +155,31 @@ public class StrukPelayananController extends LocaleController<StrukPelayananVO>
|
||||
@RequestParam(value = "dateStart", required = false) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = false) String dateEnd,
|
||||
@RequestParam(value = "jenisLimbah", required = false) Integer jenisLimbah) {
|
||||
|
||||
Map<String, Object> resultPageMap = limbahB3MasukService.lisLimbahB3Masuk(page, limit, sort, dir, dateStart, dateEnd, jenisLimbah);
|
||||
|
||||
return resultPageMap;
|
||||
return limbahB3MasukService.lisLimbahB3Masuk(page, limit, sort, dir, dateStart, dateEnd, jenisLimbah);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/list-limbah-b3-masuk-bynorec")
|
||||
public Map<String,Object> lisLimbahB3MasukByNoRec(
|
||||
@RequestParam(value = "noRec", required = false) String noRec) {
|
||||
|
||||
Map<String, Object> resultPageMap = limbahB3MasukService.lisLimbahB3MasukByNoRec(noRec);
|
||||
|
||||
return resultPageMap;
|
||||
public Map<String, Object> lisLimbahB3MasukByNoRec(@RequestParam(value = "noRec", required = false) String noRec) {
|
||||
return limbahB3MasukService.lisLimbahB3MasukByNoRec(noRec);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-pelayanan-obat-dari-luar/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> savePelayananObatDariLuar(HttpServletRequest request) throws ParseException {
|
||||
@RequestMapping(value = "/save-retur-struk-pelayanan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> returStrukPelayanan(@Valid @RequestBody StrukPelayananVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
PelayananObatVO vo = (PelayananObatVO) getItem(request, new PelayananObatVO());
|
||||
if (vo.getTanggalPendaftaran().indexOf("-") > -1)
|
||||
vo.setTglRegistrasi(format.parse(vo.getTanggalPendaftaran()));
|
||||
else
|
||||
vo.setTglRegistrasi(new Date(Long.parseLong(vo.getTanggalPendaftaran())));
|
||||
Map<String, Object> result = pelayananObatService.savePelayananObat2(vo);
|
||||
Map<String, Object> result = service.returPelayananPasien(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
SaveLog("Order Farmasi", "Permintaan", request);
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when returPelayananPasien", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private DaftarStrukPenjualanService service;
|
||||
|
||||
@RequestMapping(value = "/save-retur-struk-pelayanan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> returStrukPelayanan(@Valid @RequestBody StrukPelayananVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.returPelayananPasien(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 saveK3CheckListFacillitySefety", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveK3CheckListFacillitySefety", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when returPelayananPasien", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,67 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.*;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.StrukPelayananDetailService;
|
||||
import com.jasamedika.medifirst2000.service.StrukPelayananService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.KirimPesananBarangVO;
|
||||
import com.jasamedika.medifirst2000.vo.PenerimaanBarangVO;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/kirim-pesanan-barang")
|
||||
public class StrukVerifikasiController extends LocaleController<PenerimaanBarangVO> {
|
||||
|
||||
@Autowired
|
||||
private StrukPelayananService strukPelayananService;
|
||||
|
||||
@Autowired
|
||||
private StrukPelayananDetailService strukPelayananDetailService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(StrukVerifikasiController.class);
|
||||
|
||||
@RequestMapping(value = "/save-kirim-pesanan-barang/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> savePenerimaanBarang(@Valid @RequestBody KirimPesananBarangVO vo,HttpServletRequest request,HttpServletResponse response) {
|
||||
|
||||
try {
|
||||
Map<String, Object> result = strukPelayananService.saveKirimPesananBarang(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when save Penerimaan Barang", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when save Penerimaan Barang", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,140 +1,54 @@
|
||||
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.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.SuratService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.SuratVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
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.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/surat")
|
||||
public class SuratController extends LocaleController<SuratVO> implements IBaseRestController<SuratVO>{
|
||||
|
||||
public class SuratController extends LocaleController<SuratVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(SuratController.class);
|
||||
|
||||
@Autowired
|
||||
private SuratService suratService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SuratController.class);
|
||||
|
||||
@RequestMapping(value = "/save-surat/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody SuratVO vo, HttpServletRequest request) {
|
||||
|
||||
|
||||
@RequestMapping(value = "/find-all-surat/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllVO(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=suratService.addSurat(vo);
|
||||
Map<String, Object> result = suratService.findAllSurat();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Surat", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when findAllSurat", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Surat", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when findAllSurat", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-surat/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody SuratVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=suratService.updateSurat(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 Surat", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update Surat", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-all-surat/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=suratService.findAllSurat();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get all sasaran strategis", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get all sasaran strategis", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<SuratVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<SuratVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(SuratVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(SuratVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<SuratVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,167 +1,124 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
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.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.entities.DokumenTemplate;
|
||||
import com.jasamedika.medifirst2000.service.SuratMasukService;
|
||||
import com.jasamedika.medifirst2000.util.StringUtil;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DokumenTemplateVO;
|
||||
import com.jasamedika.medifirst2000.vo.KirimDraftVO;
|
||||
import com.jasamedika.medifirst2000.vo.SuratMasukDariExternalVO;
|
||||
import com.jasamedika.medifirst2000.vo.SuratMasukInternalEksternalVO;
|
||||
import com.jasamedika.medifirst2000.vo.SuratMasukKeEksternalVO;
|
||||
import com.jasamedika.medifirst2000.vo.SuratMasukKeInternalVO;
|
||||
import com.jasamedika.medifirst2000.vo.SuratMasukVO;
|
||||
import com.jasamedika.medifirst2000.vo.VerbalKonsepVO;
|
||||
import com.jasamedika.medifirst2000.vo.*;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.CommonUtil.isNotNullOrEmpty;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/surat-masuk")
|
||||
public class SuratMasukController extends LocaleController<SuratMasukVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(SuratMasukController.class);
|
||||
|
||||
@Autowired
|
||||
private SuratMasukService service;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SuratMasukController.class);
|
||||
|
||||
//Adding by Lukman Hakim
|
||||
/*Function Name :
|
||||
* Description : Upload Template Dokumen
|
||||
* */
|
||||
@RequestMapping(value="/save-document-template", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> uploadTemplateSurat(
|
||||
@RequestBody DokumenTemplateVO dokumenTemplateVO,
|
||||
@RequestMapping(value = "/save-document-template", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> uploadTemplateSurat(@RequestBody DokumenTemplateVO dokumenTemplateVO,
|
||||
HttpServletRequest request) {
|
||||
String result = service.uploadDocumentTemplateSurat(dokumenTemplateVO);
|
||||
if (result != null) {
|
||||
if (!result.isEmpty()) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR, "Processing data error returns empty data");
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
if (isNotNullOrEmpty(result)) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
mapHeaderMessage.put(LABEL_ERROR, "Processing data error returns empty data");
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/download-dokumen-template/{id}", method = RequestMethod.GET)
|
||||
public void downloadFileDokumenTemplate(HttpServletResponse response, @PathVariable("id") Integer id) throws IOException {
|
||||
DokumenTemplate result= service.findById(id);
|
||||
File file = new File(result.getFileLocation());
|
||||
System.out.println();
|
||||
if(!file.exists()){
|
||||
String errorMessage = "Sorry. The file you are looking for does not exist";
|
||||
System.out.println(errorMessage);
|
||||
OutputStream outputStream = response.getOutputStream();
|
||||
outputStream.write(errorMessage.getBytes(Charset.forName("UTF-8")));
|
||||
outputStream.close();
|
||||
return;
|
||||
}
|
||||
|
||||
String mimeType= URLConnection.guessContentTypeFromName(file.getName());
|
||||
if(mimeType==null){
|
||||
System.out.println("mimetype is not detectable, will take default");
|
||||
mimeType = "application/octet-stream";
|
||||
}
|
||||
|
||||
System.out.println("mimetype : "+mimeType);
|
||||
|
||||
response.setContentType(mimeType);
|
||||
|
||||
/* "Content-Disposition : inline" will show viewable types [like images/text/pdf/anything viewable by browser] right on browser
|
||||
while others(zip e.g) will be directly downloaded [may provide save as popup, based on your browser setting.]*/
|
||||
response.setHeader("Content-Disposition", String.format("inline; filename=\"" + result.getFileName() +"\""));
|
||||
|
||||
|
||||
/* "Content-Disposition : attachment" will be directly download, may provide save as popup, based on your browser setting*/
|
||||
//response.setHeader("Content-Disposition", String.format("attachment; filename=\"%s\"", file.getName()));
|
||||
|
||||
response.setContentLength((int)file.length());
|
||||
|
||||
InputStream inputStream = new BufferedInputStream(new FileInputStream(file));
|
||||
|
||||
//Copy bytes from source to destination(outputstream in this example), closes both streams.
|
||||
FileCopyUtils.copy(inputStream, response.getOutputStream());
|
||||
}
|
||||
@RequestMapping(value="/download-dokumen/{id}", method = RequestMethod.GET)
|
||||
public void downloadFileDokumen(HttpServletResponse response, @PathVariable("id") Integer id) throws IOException {
|
||||
Map<String,Object> result= service.findPathFileById(id);
|
||||
File file = new File(result.get("pathFile").toString());
|
||||
|
||||
|
||||
String fileName= result.get("namaJudulDokumen").toString()+"_"+StringUtil.formatNumber(result.get("noDokumen").toString(), 10)+"."+FilenameUtils.getExtension(result.get("pathFile").toString());
|
||||
if(!file.exists()){
|
||||
String errorMessage = "Sorry. The file you are looking for does not exist";
|
||||
System.out.println(errorMessage);
|
||||
OutputStream outputStream = response.getOutputStream();
|
||||
outputStream.write(errorMessage.getBytes(Charset.forName("UTF-8")));
|
||||
outputStream.close();
|
||||
return;
|
||||
}
|
||||
|
||||
String mimeType= URLConnection.guessContentTypeFromName(file.getName());
|
||||
if(mimeType==null){
|
||||
System.out.println("mimetype is not detectable, will take default");
|
||||
mimeType = "application/octet-stream";
|
||||
}
|
||||
|
||||
System.out.println("mimetype : "+mimeType);
|
||||
|
||||
response.setContentType(mimeType);
|
||||
|
||||
/* "Content-Disposition : inline" will show viewable types [like images/text/pdf/anything viewable by browser] right on browser
|
||||
while others(zip e.g) will be directly downloaded [may provide save as popup, based on your browser setting.]*/
|
||||
response.setHeader("Content-Disposition", String.format("inline; filename=\"" + fileName +"\""));
|
||||
|
||||
|
||||
/* "Content-Disposition : attachment" will be directly download, may provide save as popup, based on your browser setting*/
|
||||
//response.setHeader("Content-Disposition", String.format("attachment; filename=\"%s\"", file.getName()));
|
||||
|
||||
response.setContentLength((int)file.length());
|
||||
|
||||
InputStream inputStream = new BufferedInputStream(new FileInputStream(file));
|
||||
|
||||
//Copy bytes from source to destination(outputstream in this example), closes both streams.
|
||||
FileCopyUtils.copy(inputStream, response.getOutputStream());
|
||||
}
|
||||
@RequestMapping(value="/get-running-number/", method = RequestMethod.GET)
|
||||
public String getRunningNumber(HttpServletResponse response) throws IOException {
|
||||
String result= service.getRunningNumber();
|
||||
return result;
|
||||
}
|
||||
@RequestMapping(value = "/daftar-dokumen-template", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/download-dokumen-template/{id}", method = GET)
|
||||
public void downloadFileDokumenTemplate(HttpServletResponse response, @PathVariable("id") Integer id)
|
||||
throws IOException {
|
||||
DokumenTemplate result = service.findById(id);
|
||||
File file = new File(result.getFileLocation());
|
||||
if (!file.exists()) {
|
||||
String errorMessage = "Sorry. The file you are looking for does not exist";
|
||||
|
||||
LOGGER.error("{} in service.findById", errorMessage);
|
||||
|
||||
OutputStream outputStream = response.getOutputStream();
|
||||
outputStream.write(errorMessage.getBytes(UTF_8));
|
||||
outputStream.close();
|
||||
return;
|
||||
}
|
||||
String mimeType = URLConnection.guessContentTypeFromName(file.getName());
|
||||
if (mimeType == null) {
|
||||
LOGGER.warn("mimetype is not detectable in service.findById, will take default");
|
||||
|
||||
mimeType = "application/octet-stream";
|
||||
}
|
||||
response.setContentType(mimeType);
|
||||
response.setHeader("Content-Disposition", String.format("inline; filename=\"" + result.getFileName() + "\""));
|
||||
response.setContentLength((int) file.length());
|
||||
InputStream inputStream = new BufferedInputStream(Files.newInputStream(file.toPath()));
|
||||
FileCopyUtils.copy(inputStream, response.getOutputStream());
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/download-dokumen/{id}", method = GET)
|
||||
public void downloadFileDokumen(HttpServletResponse response, @PathVariable("id") Integer id) throws IOException {
|
||||
Map<String, Object> result = service.findPathFileById(id);
|
||||
File file = new File(result.get("pathFile").toString());
|
||||
String fileName = result.get("namaJudulDokumen").toString() + "_"
|
||||
+ StringUtil.formatNumber(result.get("noDokumen").toString(), 10) + "."
|
||||
+ FilenameUtils.getExtension(result.get("pathFile").toString());
|
||||
if (!file.exists()) {
|
||||
String errorMessage = "Sorry. The file you are looking for does not exist";
|
||||
|
||||
LOGGER.error("{} in service.findPathFileById", errorMessage);
|
||||
|
||||
OutputStream outputStream = response.getOutputStream();
|
||||
outputStream.write(errorMessage.getBytes(UTF_8));
|
||||
outputStream.close();
|
||||
return;
|
||||
}
|
||||
String mimeType = URLConnection.guessContentTypeFromName(file.getName());
|
||||
if (mimeType == null) {
|
||||
LOGGER.warn("mimetype is not detectable in service.findPathFileById, will take default");
|
||||
|
||||
mimeType = "application/octet-stream";
|
||||
}
|
||||
response.setContentType(mimeType);
|
||||
response.setHeader("Content-Disposition", String.format("inline; filename=\"" + fileName + "\""));
|
||||
response.setContentLength((int) file.length());
|
||||
InputStream inputStream = new BufferedInputStream(Files.newInputStream(file.toPath()));
|
||||
FileCopyUtils.copy(inputStream, response.getOutputStream());
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-running-number/", method = GET)
|
||||
public String getRunningNumber(HttpServletResponse response) {
|
||||
return service.getRunningNumber();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/daftar-dokumen-template", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public List<DokumenTemplate> getAllDokumenTemplate(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "limit", required = false, defaultValue = "50") Integer limit,
|
||||
@ -170,329 +127,267 @@ public class SuratMasukController extends LocaleController<SuratMasukVO> {
|
||||
@RequestParam(value = "dateStart", required = false) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = false) String dateEnd,
|
||||
@RequestParam(value = "id", required = false) Integer suratId) {
|
||||
List<DokumenTemplate> resultPageMap = service.getAllDokumenTemplate(page, limit, sort, dir, dateStart, dateEnd, suratId);
|
||||
return service.getAllDokumenTemplate(page, limit, sort, dir, dateStart, dateEnd, suratId);
|
||||
}
|
||||
|
||||
return resultPageMap;
|
||||
}
|
||||
@RequestMapping(value="/save-draft-surat", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> saveDraftSurat(
|
||||
@RequestBody DokumenTemplateVO dokumenTemplateVO,
|
||||
@RequestMapping(value = "/save-draft-surat", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> saveDraftSurat(@RequestBody DokumenTemplateVO dokumenTemplateVO,
|
||||
HttpServletRequest request) {
|
||||
|
||||
String result = service.saveDraftSurat(dokumenTemplateVO);
|
||||
if (result != null) {
|
||||
if (!result.isEmpty()) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR, "Processing data error returns empty data");
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
if (isNotNullOrEmpty(result)) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
mapHeaderMessage.put(LABEL_ERROR, "Processing data error returns empty data");
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
@RequestMapping(value = "/get-draft-surat", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String,Object>>> getListDaftarDraftSuratByPeriode(
|
||||
@RequestParam(value = "dateStart", required = true) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = true) String dateEnd,
|
||||
|
||||
@RequestMapping(value = "/get-draft-surat", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getListDaftarDraftSuratByPeriode(
|
||||
@RequestParam(value = "dateStart") String dateStart, @RequestParam(value = "dateEnd") String dateEnd,
|
||||
@RequestParam(value = "idRuangan", required = false) Integer idRuangan) {
|
||||
List<Map<String,Object>> resultPageMap = service.getAllDraftSuratByPeriode(dateStart, dateEnd,idRuangan);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
List<Map<String, Object>> resultPageMap = service.getAllDraftSuratByPeriode(dateStart, dateEnd, idRuangan);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
@RequestMapping(value = "/get-draft-surat-by-ruangan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String,Object>>> getListDaftarDraftSuratByRuanganPeriode(
|
||||
@RequestParam(value = "dateStart", required = true) String dateStart,
|
||||
@RequestParam(value = "idRuangan", required = true) Integer idRuangan,
|
||||
@RequestParam(value = "dateEnd", required = true) String dateEnd) {
|
||||
List<Map<String,Object>> resultPageMap = service.getAllDraftSuratByRuanganPeriode(dateStart, dateEnd,idRuangan);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
|
||||
@RequestMapping(value = "/get-draft-surat-by-ruangan", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getListDaftarDraftSuratByRuanganPeriode(
|
||||
@RequestParam(value = "dateStart") String dateStart, @RequestParam(value = "idRuangan") Integer idRuangan,
|
||||
@RequestParam(value = "dateEnd") String dateEnd) {
|
||||
List<Map<String, Object>> resultPageMap = service.getAllDraftSuratByRuanganPeriode(dateStart, dateEnd,
|
||||
idRuangan);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
@RequestMapping(value = "/get-draft-surat-by-ruangan-pembuat", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String,Object>>> getListDaftarDraftSuratByRuanganPeriode(
|
||||
@RequestParam(value = "idRuangan", required = true) Integer idRuangan
|
||||
) {
|
||||
List<Map<String,Object>> resultPageMap = service.getAllDraftSuratByRuangan(idRuangan);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
|
||||
@RequestMapping(value = "/get-draft-surat-by-ruangan-pembuat", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getListDaftarDraftSuratByRuanganPeriode(
|
||||
@RequestParam(value = "idRuangan") Integer idRuangan) {
|
||||
List<Map<String, Object>> resultPageMap = service.getAllDraftSuratByRuangan(idRuangan);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
@RequestMapping(value = "/get-draft-surat-by-id/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getListDaftarDraftById(
|
||||
@PathVariable("id") Integer id) {
|
||||
Map<String,Object> resultPageMap = service.getDraftSuratById(id);
|
||||
List<Map<String,Object>> ruangans = service.findByDokumenTujuanByIdDokumen(id);
|
||||
|
||||
@RequestMapping(value = "/get-draft-surat-by-id/{id}", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getListDaftarDraftById(@PathVariable("id") Integer id) {
|
||||
Map<String, Object> resultPageMap = service.getDraftSuratById(id);
|
||||
List<Map<String, Object>> ruangans = service.findByDokumenTujuanByIdDokumen(id);
|
||||
resultPageMap.put("ruangans", ruangans);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/save-kirim-draft-surat", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> kirimDraftSurat(
|
||||
@RequestBody KirimDraftVO kirimDraftVO,
|
||||
HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/save-kirim-draft-surat", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> kirimDraftSurat(@RequestBody KirimDraftVO kirimDraftVO, HttpServletRequest request) {
|
||||
String result = service.saveKirimDraftSurat(kirimDraftVO);
|
||||
if (result != null) {
|
||||
if (!result.isEmpty()) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR, "Processing data error returns empty data");
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
if (isNotNullOrEmpty(result)) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
mapHeaderMessage.put(LABEL_ERROR, "Processing data error returns empty data");
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-draft-surat-by-id-and-ruangan/{id}/{idRuangan}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getListDaftarDraftById(
|
||||
@PathVariable("id") Integer id,
|
||||
|
||||
@RequestMapping(value = "/get-draft-surat-by-id-and-ruangan/{id}/{idRuangan}", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getListDaftarDraftById(@PathVariable("id") Integer id,
|
||||
@PathVariable("idRuangan") Integer idRuangan) {
|
||||
Map<String,Object> resultPageMap = service.getDraftSuratByIdAndRuangan(id,idRuangan);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
Map<String, Object> resultPageMap = service.getDraftSuratByIdAndRuangan(id, idRuangan);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
@RequestMapping(value="/save-draft-verbal-konsep", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> saveVerbalKonsep(
|
||||
@RequestBody VerbalKonsepVO verbalKonsepVO,
|
||||
|
||||
@RequestMapping(value = "/save-draft-verbal-konsep", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> saveVerbalKonsep(@RequestBody VerbalKonsepVO verbalKonsepVO,
|
||||
HttpServletRequest request) {
|
||||
String result = service.saveVerbalKonsep(verbalKonsepVO);
|
||||
if (result != null) {
|
||||
if (!result.isEmpty()) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR, "Processing data error returns empty data");
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
if (isNotNullOrEmpty(result)) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
mapHeaderMessage.put(LABEL_ERROR, "Processing data error returns empty data");
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
@RequestMapping(value = "/get-verbal-konsep-by-id-dokumen/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getVerbalKonsepByIdDokumen(
|
||||
@PathVariable("id") Integer id) {
|
||||
Map<String,Object> resultPageMap = service.getDraftSuratVerbalKonsepByIdDokumen(id);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
|
||||
@RequestMapping(value = "/get-verbal-konsep-by-id-dokumen/{id}", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getVerbalKonsepByIdDokumen(@PathVariable("id") Integer id) {
|
||||
Map<String, Object> resultPageMap = service.getDraftSuratVerbalKonsepByIdDokumen(id);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
/* Function :
|
||||
* Author :
|
||||
* Description : Surat Masuk dari Eksternal
|
||||
* */
|
||||
@RequestMapping(value="/save-surat-masuk-dari-external", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/save-surat-masuk-dari-external", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> saveSuratMasukDariExternal(
|
||||
@RequestBody SuratMasukDariExternalVO suratMasukDariExternalVO,
|
||||
HttpServletRequest request) {
|
||||
@RequestBody SuratMasukDariExternalVO suratMasukDariExternalVO, HttpServletRequest request) {
|
||||
String result = service.saveSuratMasukDariExternal(suratMasukDariExternalVO);
|
||||
if (result != null) {
|
||||
if (!result.isEmpty()) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR, "Processing data error returns empty data");
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
if (isNotNullOrEmpty(result)) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
mapHeaderMessage.put(LABEL_ERROR, "Processing data error returns empty data");
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-surat-masuk-internal-eksternal-by-ruangan-periode/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String,Object>>> getListDaftarSuratMasukByRuangan(
|
||||
@RequestParam(value = "dateStart", required = true) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = true) String dateEnd,
|
||||
|
||||
@RequestMapping(value = "/get-surat-masuk-internal-eksternal-by-ruangan-periode/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getListDaftarSuratMasukByRuangan(
|
||||
@RequestParam(value = "dateStart") String dateStart, @RequestParam(value = "dateEnd") String dateEnd,
|
||||
@RequestParam(value = "idRuangan", required = false) Integer idRuangan) {
|
||||
List<Map<String,Object>> resultPageMap = service.getListDokumenMasukInternalExternal(dateStart,dateEnd,idRuangan);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
List<Map<String, Object>> resultPageMap = service.getListDokumenMasukInternalExternal(dateStart, dateEnd,
|
||||
idRuangan);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
@RequestMapping(value = "/get-surat-masuk-internal-eksternal-by-no-rec/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity< Map<String,Object>> getSuratMasukInternalEksternalBynoRec(
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-surat-masuk-internal-eksternal-by-no-rec/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getSuratMasukInternalEksternalBynoRec(
|
||||
@RequestParam(value = "norec", required = false) String norec) {
|
||||
Map<String,Object> resultPageMap = service.getDokumenMasukInternalExternalBynoRec(norec);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
Map<String, Object> resultPageMap = service.getDokumenMasukInternalExternalBynoRec(norec);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
@RequestMapping(value = "/get-surat-masuk-internal-eksternal-by-id-dokumen/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity< Map<String,Object>> getSuratMasukInternalEksternalByidDokumen(
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-surat-masuk-internal-eksternal-by-id-dokumen/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getSuratMasukInternalEksternalByidDokumen(
|
||||
@RequestParam(value = "idDokumen", required = false) Integer idDokumen) {
|
||||
Map<String,Object> resultPageMap = service.getDokumenMasukInternalExternalByIdDokumen(idDokumen);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
Map<String, Object> resultPageMap = service.getDokumenMasukInternalExternalByIdDokumen(idDokumen);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
@RequestMapping(value="/save-kirim-distribusi-surat", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> kirimDistribusiSurat(
|
||||
@RequestBody KirimDraftVO kirimDraftVO,
|
||||
|
||||
@RequestMapping(value = "/save-kirim-distribusi-surat", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> kirimDistribusiSurat(@RequestBody KirimDraftVO kirimDraftVO,
|
||||
HttpServletRequest request) {
|
||||
String result = service.saveKirimDistribusiSurat(kirimDraftVO);
|
||||
if (result != null) {
|
||||
if (!result.isEmpty()) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR, "Processing data error returns empty data");
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
if (isNotNullOrEmpty(result)) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
mapHeaderMessage.put(LABEL_ERROR, "Processing data error returns empty data");
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
@RequestMapping(value="/save-terima-surat", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> terimaSuratMasuk(
|
||||
@RequestBody KirimDraftVO kirimDraftVO,
|
||||
HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/save-terima-surat", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> terimaSuratMasuk(@RequestBody KirimDraftVO kirimDraftVO, HttpServletRequest request) {
|
||||
String result = service.saveTerimaSurat(kirimDraftVO);
|
||||
if (result != null) {
|
||||
if (!result.isEmpty()) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR, "Processing data error returns empty data");
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
if (isNotNullOrEmpty(result)) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
mapHeaderMessage.put(LABEL_ERROR, "Processing data error returns empty data");
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
/*SURAT MASUK INTERNAL DAN EKSTERNAL*/
|
||||
@RequestMapping(value="/save-surat-masuk-to-internal-ekternal", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/save-surat-masuk-to-internal-ekternal", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> suratMasukKeInternalEksternal(
|
||||
@RequestBody SuratMasukInternalEksternalVO suratMasukInternalEksternalVO,
|
||||
HttpServletRequest request) {
|
||||
@RequestBody SuratMasukInternalEksternalVO suratMasukInternalEksternalVO, HttpServletRequest request) {
|
||||
String result = service.saveSuratMasukKeInternalEksternal(suratMasukInternalEksternalVO);
|
||||
if (result != null) {
|
||||
if (!result.isEmpty()) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR, "Processing data error returns empty data");
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
if (isNotNullOrEmpty(result)) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
mapHeaderMessage.put(LABEL_ERROR, "Processing data error returns empty data");
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
@RequestMapping(value = "/get-surat-masuk-internal-eksternal-by-ruangan-periode-penomoran/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String,Object>>> getAllSuratMasukPenomoranByPeriodeAndRuangan(
|
||||
@RequestParam(value = "dateStart", required = true) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = true) String dateEnd,
|
||||
|
||||
@RequestMapping(value = "/get-surat-masuk-internal-eksternal-by-ruangan-periode-penomoran/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getAllSuratMasukPenomoranByPeriodeAndRuangan(
|
||||
@RequestParam(value = "dateStart") String dateStart, @RequestParam(value = "dateEnd") String dateEnd,
|
||||
@RequestParam(value = "idRuangan", required = false) Integer idRuangan) {
|
||||
List<Map<String,Object>> resultPageMap = service.getAllSuratMasukPenomoranByPeriodeAndRuangan(dateStart,dateEnd,idRuangan);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
List<Map<String, Object>> resultPageMap = service.getAllSuratMasukPenomoranByPeriodeAndRuangan(dateStart,
|
||||
dateEnd, idRuangan);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
@RequestMapping(value = "/get-daftar-distribusi-surat-by-ruangan-periode/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String,Object>>> getListDaftarDistribusiSurat(
|
||||
@RequestParam(value = "dateStart", required = true) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = true) String dateEnd,
|
||||
|
||||
@RequestMapping(value = "/get-daftar-distribusi-surat-by-ruangan-periode/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getListDaftarDistribusiSurat(
|
||||
@RequestParam(value = "dateStart") String dateStart, @RequestParam(value = "dateEnd") String dateEnd,
|
||||
@RequestParam(value = "idRuangan", required = false) Integer idRuangan) {
|
||||
List<Map<String,Object>> resultPageMap = service.getListDaftarDistribusiSurat(dateStart,dateEnd,idRuangan);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
List<Map<String, Object>> resultPageMap = service.getListDaftarDistribusiSurat(dateStart, dateEnd, idRuangan);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
//Surat Masuk untuk penomoran
|
||||
@RequestMapping(value = "/get-surat-masuk-by-ruangan-periode-penomoran/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String,Object>>> getAllSuratMasukPenomoranTatausahaByPeriodeAndRuangan(
|
||||
@RequestParam(value = "dateStart", required = true) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = true) String dateEnd,
|
||||
|
||||
@RequestMapping(value = "/get-surat-masuk-by-ruangan-periode-penomoran/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getAllSuratMasukPenomoranTatausahaByPeriodeAndRuangan(
|
||||
@RequestParam(value = "dateStart") String dateStart, @RequestParam(value = "dateEnd") String dateEnd,
|
||||
@RequestParam(value = "idRuangan", required = false) Integer idRuangan) {
|
||||
List<Map<String,Object>> resultPageMap = service.getAllSuratMasukPenomoranByPeriodeAndRuanganTujuan(dateStart,dateEnd,idRuangan);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
List<Map<String, Object>> resultPageMap = service.getAllSuratMasukPenomoranByPeriodeAndRuanganTujuan(dateStart,
|
||||
dateEnd, idRuangan);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
@RequestMapping(value = "/get-surat-masuk-internal-eksternal-penomoran-by-no-rec/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity< Map<String,Object>> getDokumenMasukKeluarBuatPenomoranByNoRec(
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-surat-masuk-internal-eksternal-penomoran-by-no-rec/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getDokumenMasukKeluarBuatPenomoranByNoRec(
|
||||
@RequestParam(value = "norec", required = false) String norec) {
|
||||
Map<String,Object> resultPageMap = service.getDokumenMasukKeluarBuatPenomoranByNoRec(norec);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
Map<String, Object> resultPageMap = service.getDokumenMasukKeluarBuatPenomoranByNoRec(norec);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
//Ruangan Tujuan Surat untuk didistribusikan
|
||||
@RequestMapping(value = "/get-daftar-distribusi-surat-by-ruangan-tujuan-periode/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String,Object>>> getListDaftarDistribusiSuratTujuan(
|
||||
@RequestParam(value = "dateStart", required = true) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = true) String dateEnd,
|
||||
|
||||
@RequestMapping(value = "/get-daftar-distribusi-surat-by-ruangan-tujuan-periode/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getListDaftarDistribusiSuratTujuan(
|
||||
@RequestParam(value = "dateStart") String dateStart, @RequestParam(value = "dateEnd") String dateEnd,
|
||||
@RequestParam(value = "idRuangan", required = false) Integer idRuangan) {
|
||||
List<Map<String,Object>> resultPageMap = service.getListDaftarDistribusiSuratTujuan(dateStart,dateEnd,idRuangan);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
List<Map<String, Object>> resultPageMap = service.getListDaftarDistribusiSuratTujuan(dateStart, dateEnd,
|
||||
idRuangan);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/save-surat-masuk-ke-external-penomoran", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/save-surat-masuk-ke-external-penomoran", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> saveSuratMasukKeExternalPenomoran(
|
||||
@RequestBody SuratMasukKeEksternalVO suratMasukKeEksternalVO,
|
||||
HttpServletRequest request) {
|
||||
@RequestBody SuratMasukKeEksternalVO suratMasukKeEksternalVO, HttpServletRequest request) {
|
||||
String result = service.saveSuratMasukKeExternal(suratMasukKeEksternalVO);
|
||||
if (result != null) {
|
||||
if (!result.isEmpty()) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR, "Processing data error returns empty data");
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
if (isNotNullOrEmpty(result)) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
mapHeaderMessage.put(LABEL_ERROR, "Processing data error returns empty data");
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
@RequestMapping(value="/save-surat-masuk-ke-internal-penomoran", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/save-surat-masuk-ke-internal-penomoran", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> saveSuratMasukKeInternalPenomoran(
|
||||
@RequestBody SuratMasukKeInternalVO suratMasukKeInternalVO,
|
||||
HttpServletRequest request) {
|
||||
@RequestBody SuratMasukKeInternalVO suratMasukKeInternalVO, HttpServletRequest request) {
|
||||
String result = service.saveSuratMasukKeInternal(suratMasukKeInternalVO);
|
||||
if (result != null) {
|
||||
if (!result.isEmpty()) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR, "Processing data error returns empty data");
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
if (isNotNullOrEmpty(result)) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} else {
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
mapHeaderMessage.put(LABEL_ERROR, "Processing data error returns empty data");
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
@RequestMapping(value = "/get-no-surat-ke-eksternal/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-no-surat-ke-eksternal/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> getNoSuratKeEksternal(
|
||||
@RequestParam(value = "idUnitPemrakarsa", required = true) Integer idUnitPemrakarsa,
|
||||
@RequestParam(value = "idKlasifikasiArsip", required = true) Integer idKlasifikasiArsip,
|
||||
@RequestParam(value = "idSubKlasifikasiArsip", required = true) Integer idSubKlasifikasiArsip,
|
||||
@RequestParam(value = "idUnitPemrakarsa") Integer idUnitPemrakarsa,
|
||||
@RequestParam(value = "idKlasifikasiArsip") Integer idKlasifikasiArsip,
|
||||
@RequestParam(value = "idSubKlasifikasiArsip") Integer idSubKlasifikasiArsip,
|
||||
@RequestParam(value = "tahun", required = false) Integer tahun) {
|
||||
String resultPageMap = service.getNoSuratKeEksternal(idUnitPemrakarsa,idKlasifikasiArsip,idSubKlasifikasiArsip,tahun);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
String resultPageMap = service.getNoSuratKeEksternal(idUnitPemrakarsa, idKlasifikasiArsip,
|
||||
idSubKlasifikasiArsip, tahun);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
@RequestMapping(value = "/get-no-surat-ke-internal/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-no-surat-ke-internal/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> getNoSuratKeInternal(
|
||||
@RequestParam(value = "idUnitPemrakarsa", required = true) Integer idUnitPemrakarsa,
|
||||
@RequestParam(value = "bulan", required = true) Integer bulan,
|
||||
@RequestParam(value = "idUnitPemrakarsa") Integer idUnitPemrakarsa,
|
||||
@RequestParam(value = "bulan") Integer bulan,
|
||||
@RequestParam(value = "tahun", required = false) Integer tahun) {
|
||||
String resultPageMap = service.getNoSuratKeInternal(idUnitPemrakarsa,bulan,tahun);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
String resultPageMap = service.getNoSuratKeInternal(idUnitPemrakarsa, bulan, tahun);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
@RequestMapping(value = "/get-daftar-surat-masuk-ke-eksternal/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String,Object>>> getListSuratMasukKeEksternal(
|
||||
@RequestParam(value = "dateStart", required = true) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = true) String dateEnd,
|
||||
|
||||
@RequestMapping(value = "/get-daftar-surat-masuk-ke-eksternal/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getListSuratMasukKeEksternal(
|
||||
@RequestParam(value = "dateStart") String dateStart, @RequestParam(value = "dateEnd") String dateEnd,
|
||||
@RequestParam(value = "idRuangan", required = false) Integer idRuangan) {
|
||||
List<Map<String,Object>> resultPageMap = service.getListSuratMasukKeEksternal(dateStart,dateEnd,idRuangan);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
List<Map<String, Object>> resultPageMap = service.getListSuratMasukKeEksternal(dateStart, dateEnd, idRuangan);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
@RequestMapping(value = "/get-daftar-surat-masuk-jangka-waktu/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String,Object>>> getListSuratMasukJangkaWaktu(
|
||||
@RequestParam(value = "dateStart", required = true) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = true) String dateEnd,
|
||||
|
||||
@RequestMapping(value = "/get-daftar-surat-masuk-jangka-waktu/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getListSuratMasukJangkaWaktu(
|
||||
@RequestParam(value = "dateStart") String dateStart, @RequestParam(value = "dateEnd") String dateEnd,
|
||||
@RequestParam(value = "idRuangan", required = false) Integer idRuangan) {
|
||||
List<Map<String,Object>> resultPageMap = service.getListSuratMasukJangkaWaktu(dateStart,dateEnd,idRuangan);
|
||||
|
||||
return RestUtil.getJsonResponse(resultPageMap, HttpStatus.OK, mapHeaderMessage);
|
||||
List<Map<String, Object>> resultPageMap = service.getListSuratMasukJangkaWaktu(dateStart, dateEnd, idRuangan);
|
||||
return getJsonResponse(resultPageMap, OK, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,42 +1,39 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.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.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.dao.ResultSurveiDetailDao;
|
||||
import com.jasamedika.medifirst2000.dao.SurveiDao;
|
||||
import com.jasamedika.medifirst2000.dao.SurveiDetailDao;
|
||||
import com.jasamedika.medifirst2000.entities.ResultSurveiDetail;
|
||||
import com.jasamedika.medifirst2000.entities.Survei;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.SurveiService;
|
||||
import com.jasamedika.medifirst2000.util.DateUtil;
|
||||
import com.jasamedika.medifirst2000.util.JsonUtil;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.ResultSurveiVO;
|
||||
//import com.jasamedika.medifirst2000.vo.UploadVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.util.JsonUtil.ToMaps;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
/**
|
||||
* Controller class for Registrasi Pasien Business
|
||||
@ -44,208 +41,100 @@ import com.jasamedika.medifirst2000.vo.ResultSurveiVO;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/survei")
|
||||
public class SurveiController extends LocaleController<ResultSurveiVO>
|
||||
implements IBaseRestController<ResultSurveiVO> {
|
||||
public class SurveiController extends LocaleController<ResultSurveiVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(SurveiController.class);
|
||||
|
||||
@Autowired
|
||||
private SurveiService surveiService;
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SurveiController.class);
|
||||
private SurveiService<Survei> surveiService;
|
||||
|
||||
@RequestMapping(value = "/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map> savePapInformasiIbu(@Valid @RequestBody List<ResultSurveiVO> vo,HttpServletRequest request) throws ParseException {
|
||||
try {
|
||||
return RestUtil.getJsonResponse(surveiService.Save(vo), HttpStatus.CREATED,mapHeaderMessage);
|
||||
// Map<String,Object> result=papInformasiIbuService.savePapInformasiIbu(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 Pasien", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
@Autowired
|
||||
private SurveiDao surveiDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private SurveiDetailDao surveiDetailDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ResultSurveiDetailDao resultSurveiDetailDao;
|
||||
|
||||
@RequestMapping(value = "/get-survei", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String, Object>> getOrderFromSirs(
|
||||
@RequestParam(value = "group", required = false
|
||||
) String group,
|
||||
|
||||
HttpServletRequest request) throws ParseException {
|
||||
|
||||
@RequestMapping(value = "/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> savePapInformasiIbu(@Valid @RequestBody List<ResultSurveiVO> vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> hasil = new HashMap<>();
|
||||
List<Map<String,Object>> list = new ArrayList<>();
|
||||
Map<String, Object> result = surveiService.Save(vo);
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got ServiceVOException {} when surveiService.Save", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when surveiService.Save", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-survei", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> getOrderFromSirs(
|
||||
@RequestParam(value = "group", required = false) String group, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> hasil = new HashMap<>();
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (Survei data : surveiDao.findByKelompok(group)) {
|
||||
Map<String, Object> temp;
|
||||
try {
|
||||
temp = data.ToMap();
|
||||
|
||||
|
||||
temp.put("detail",JsonUtil.ToMaps(surveiDetailDao.findBySurveiId(data.getId())));
|
||||
|
||||
|
||||
|
||||
list.add(temp);
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Map<String, Object> temp = data.ToMap();
|
||||
temp.put("detail", ToMaps(surveiDetailDao.findBySurveiId(data.getId())));
|
||||
list.add(temp);
|
||||
}
|
||||
hasil.put("items", list);
|
||||
return RestUtil.getJsonResponse(hasil, HttpStatus.OK, mapHeaderMessage);
|
||||
return getJsonResponse(hasil, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when findBySurveiId", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException | IllegalArgumentException | IllegalAccessException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when findBySurveiId", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-rekap-survei", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/get-rekap-survei", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> getRekapOrderFromSirs(
|
||||
@RequestParam(value = "group", required = false
|
||||
) String group,
|
||||
@RequestParam(value = "groupId", required = false) Integer groupId,
|
||||
|
||||
HttpServletRequest request) throws ParseException {
|
||||
try {
|
||||
Map<String,Object> hasil = new HashMap<>();
|
||||
List<Map<String,Object>> list = new ArrayList<>();
|
||||
|
||||
Map<String, Object> temp= new HashMap<String, Object>();
|
||||
try {
|
||||
|
||||
Boolean valid =false;
|
||||
|
||||
temp.put("detail",JsonUtil.ToMaps(resultSurveiDetailDao.findBySurveiDetailSurveiId(Integer.parseInt(group))));
|
||||
valid=true;
|
||||
|
||||
if(valid==true)
|
||||
list.add(temp);
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
hasil.put("items", list);
|
||||
return RestUtil.getJsonResponse(temp, HttpStatus.OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-rekap-survei-kuisioner", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String, Object>> getRekapSurveiKuisioner(
|
||||
@RequestParam(value = "group", required = false
|
||||
) String group,
|
||||
@RequestParam(value = "groupId", required = false) Integer groupId,
|
||||
|
||||
HttpServletRequest request) throws ParseException {
|
||||
try {
|
||||
Map<String,Object> hasil = new HashMap<>();
|
||||
List<Map<String,Object>> list = new ArrayList<>();
|
||||
|
||||
Map<String, Object> temp= new HashMap<String, Object>();
|
||||
try {
|
||||
|
||||
Boolean valid =false;
|
||||
|
||||
temp.put("detail",JsonUtil.ToMaps(resultSurveiDetailDao.findBySurveiDetailSurveiId()));
|
||||
valid=true;
|
||||
|
||||
if(valid==true)
|
||||
list.add(temp);
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
hasil.put("items", list);
|
||||
return RestUtil.getJsonResponse(temp, HttpStatus.OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-rekap", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String, Object>> getOrderFromSirs(
|
||||
@RequestParam(value = "dateStart", required = false) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = false) String dateEnd,
|
||||
@RequestParam(value = "group", required = false) String group,
|
||||
HttpServletRequest request) throws ParseException {
|
||||
@RequestParam(value = "groupId", required = false) Integer groupId, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> hasil = new HashMap<>();
|
||||
Map<String,Object> list=surveiService.getRekap(DateUtil.toDate(dateStart),DateUtil.toDate(dateEnd),group);
|
||||
hasil.put("result", list);
|
||||
return RestUtil.getJsonResponse(hasil, HttpStatus.OK, mapHeaderMessage);
|
||||
Map<String, Object> temp = new HashMap<>();
|
||||
List<ResultSurveiDetail> detail = resultSurveiDetailDao.findBySurveiDetailSurveiId(Integer.parseInt(group));
|
||||
temp.put("detail", ToMaps(detail));
|
||||
return getJsonResponse(temp, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when findBySurveiDetailSurveiId", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException | IllegalArgumentException | IllegalAccessException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when findBySurveiDetailSurveiId", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-rekap-survei-kuisioner", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> getRekapSurveiKuisioner(
|
||||
@RequestParam(value = "group", required = false) String group,
|
||||
@RequestParam(value = "groupId", required = false) Integer groupId, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> temp = new HashMap<>();
|
||||
temp.put("detail", ToMaps(resultSurveiDetailDao.findBySurveiDetailSurveiId()));
|
||||
return getJsonResponse(temp, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got ServiceVOException {} when findBySurveiDetailSurveiId--kuisioner", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException | IllegalArgumentException | IllegalAccessException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when findBySurveiDetailSurveiId--kuisioner", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public ResponseEntity<Collection<ResultSurveiVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ResponseEntity<ResultSurveiVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(ResultSurveiVO vo) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(ResultSurveiVO vo) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ResponseEntity<List<ResultSurveiVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,132 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.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.SurveyKepuasanPelangganService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.SurveyKepuasanPelangganVO;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/survey-kepuasan-pelanggan")
|
||||
public class SurveyKepuasanPelangganController extends LocaleController<SurveyKepuasanPelangganVO>{
|
||||
|
||||
@Autowired
|
||||
private SurveyKepuasanPelangganService surveyKepuasanPelangganService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(SurveyKepuasanPelangganController.class);
|
||||
|
||||
@RequestMapping(value = "/save-survey-kepuasan-pelanggan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody SurveyKepuasanPelangganVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=surveyKepuasanPelangganService.addSurveyKepuasanPelanggan(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 SurveyKepuasanPelanggan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add SurveyKepuasanPelanggan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-all-survey-kepuasan-pelanggan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVOS(@Valid @RequestBody List<SurveyKepuasanPelangganVO> vos, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=surveyKepuasanPelangganService.addAllSurveyKepuasanPelanggan(vos);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add all SurveyKepuasanPelanggan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add all SurveyKepuasanPelanggan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-survey-kepuasan-pelanggan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody SurveyKepuasanPelangganVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=surveyKepuasanPelangganService.updateSurveyKepuasanPelanggan(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 SurveyKepuasanPelanggan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update SurveyKepuasanPelanggan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-all-survey-kepuasan-pelanggan/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=surveyKepuasanPelangganService.findAllSurveyKepuasanPelanggan();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when get all SurveyKepuasanPelanggan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get all SurveyKepuasanPelanggan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,160 +1,120 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.SwabAlatPermukaanService;
|
||||
import com.jasamedika.medifirst2000.vo.SwabAlatPermukaanVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.SwabAlatPermukaanService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.SwabAlatPermukaanVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/swab-alat-permukaan")
|
||||
public class SwabAlatPermukaanController extends LocaleController<SwabAlatPermukaanVO>{
|
||||
public class SwabAlatPermukaanController extends LocaleController<SwabAlatPermukaanVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(SwabAlatPermukaanController.class);
|
||||
|
||||
@Autowired
|
||||
private SwabAlatPermukaanService service;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SwabAlatPermukaanController.class);
|
||||
|
||||
@RequestMapping(value = "/get-unit-ruangan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-unit-ruangan", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getUnitRuangan(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.getUnitRuangan();
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
} else{
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
|
||||
Map<String, Object> result = service.getUnitRuangan();
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} else {
|
||||
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when getUnitRuangan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getUnitRuangan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getUnitRuangan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getUnitRuangan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-swab-alat-permukaan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveSwabAlatPermukaan(@Valid @RequestBody SwabAlatPermukaanVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.saveSwabAlatPermukaan(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
@RequestMapping(value = "/save-swab-alat-permukaan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveSwabAlatPermukaan(@Valid @RequestBody SwabAlatPermukaanVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.saveSwabAlatPermukaan(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when saveSwabAlatPermukaan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveSwabAlatPermukaan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveSwabAlatPermukaan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveSwabAlatPermukaan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-swab-alat-permukaan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-swab-alat-permukaan", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getSwabAlatPermukaan(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.getSwabAlatPermukaan();
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
} else{
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
|
||||
Map<String, Object> result = service.getSwabAlatPermukaan();
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} else {
|
||||
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when getSwabAlatPermukaa", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getSwabAlatPermukaan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getSwabAlatPermukaa", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getSwabAlatPermukaan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-swab-alat-permukaan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Boolean> updateSwabAlatPermukaan(@Valid @RequestBody SwabAlatPermukaanVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Boolean result = service.updateSwabAlatPermukaan(vo);
|
||||
if (result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when updateSwabAlatPermukaan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when updateSwabAlatPermukaan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete-swab-alat-permukaan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Boolean> deleteSwabAlatPermukaan(
|
||||
@RequestParam(value = "id", required = true) Integer id, HttpServletRequest request) {
|
||||
@RequestMapping(value = "/delete-swab-alat-permukaan", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Boolean> deleteSwabAlatPermukaan(@RequestParam(value = "id") Integer id,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Boolean result = service.deleteSwabAlatPermukaan(id);
|
||||
if (result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got ServiceVOException {} when deleteSwabAlatPermukaan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when deleteSwabAlatPermukaan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when deleteSwabAlatPermukaan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when deleteSwabAlatPermukaan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/download-file-hasil-pemantauan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> downloadFileHasilPemantauan(
|
||||
@RequestParam(value = "id", required = true) Integer id, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.downloadFileHasilPemantauan(id);
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
} else{
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
|
||||
}
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when downloadFileHasilPemantauan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when downloadFileHasilPemantauan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,120 +1,75 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.entities.DetailTOWS;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DetailTOWSService;
|
||||
import com.jasamedika.medifirst2000.vo.DetailTOWSVO;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.entities.DetailTOWS;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DetailTOWSService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DetailTOWSVO;
|
||||
import com.jasamedika.medifirst2000.vo.TOWSVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/tows")
|
||||
public class TOWSController extends LocaleController<TOWSVO> implements
|
||||
IBaseRestController<TOWSVO>{
|
||||
public class TOWSController extends LocaleController<DetailTOWSVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(TOWSController.class);
|
||||
|
||||
@Autowired
|
||||
private DetailTOWSService detailTOWSService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(PegawaiController.class);
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<TOWSVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<TOWSVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(TOWSVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(TOWSVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<TOWSVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/find-all/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Collection<DetailTOWS>> findAll(
|
||||
@RequestMapping(value = "/find-all/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Collection<DetailTOWSVO>> findAll(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "100") Integer take,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@RequestParam(value = "jenisId", required = false, defaultValue = "1") Integer faktorId,
|
||||
@Spec(path = "tows.id", params = "jenisId", spec = Equal.class) Specification<DetailTOWS> tows)
|
||||
{
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result = detailTOWSService.findDetail(page, take, sort,dir, tows);
|
||||
return constructListPageResult(result);
|
||||
@Spec(path = "tows.id", params = "jenisId", spec = Equal.class) Specification<DetailTOWS> tows) {
|
||||
Map<String, Object> result = detailTOWSService.findDetail(page, take, sort, dir, tows);
|
||||
return constructListPageResult(result);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/save/", method= RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody DetailTOWSVO vo,HttpServletRequest request){
|
||||
try{
|
||||
|
||||
@RequestMapping(value = "/save/", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody DetailTOWSVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = detailTOWSService.save(vo);
|
||||
if(null!= result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add detailTOWS", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when detailTOWSService.save", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add detailTOWS", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when detailTOWSService.save", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,126 +1,40 @@
|
||||
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.TagihanRekananService;
|
||||
import com.jasamedika.medifirst2000.vo.StrukBuktiPengeluaranCaraBayarVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.entities.Ruangan;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.TagihanRekananService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MappingKirimDokumenPasienVO;
|
||||
import com.jasamedika.medifirst2000.vo.StrukBuktiPengeluaranCaraBayarVO;
|
||||
import com.jasamedika.medifirst2000.vo.StrukPelayananVO;
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/tagihan-rekanan")
|
||||
public class TagihanRekananController extends LocaleController<StrukPelayananVO> {
|
||||
public class TagihanRekananController extends LocaleController<StrukBuktiPengeluaranCaraBayarVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(TagihanRekananController.class);
|
||||
|
||||
@Autowired
|
||||
private TagihanRekananService service;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TagihanRekananController.class);
|
||||
|
||||
@RequestMapping(value = "/daftar-tagihan-rekanan-belum-verifikasi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getDaftarTagihanRekanan(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "limit", required = false, defaultValue = "5000") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "namaRekanan") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@RequestParam(value = "noFaktur", required = false) String noFaktur,
|
||||
@RequestParam(value = "namaRekanan", required = false) String namaRekanan,
|
||||
@RequestParam(value = "dateStart", required = false) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = false) String dateEnd,
|
||||
@RequestParam(value = "noTerima", required = false) String noTerima,
|
||||
@RequestParam(value = "status", required = false) String status,
|
||||
@RequestParam(value = "noRec", required = false) String noRec,
|
||||
@RequestParam(value = "gridFor", required = false) String gridFor) {
|
||||
Map<String, Object> resultPageMap = service.getDaftarTagihanRekanan(page, limit, sort, dir, dateStart, dateEnd,
|
||||
noFaktur, namaRekanan, noTerima, status, noRec, gridFor);
|
||||
|
||||
return resultPageMap;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/daftar-tagihan-rekanan-verifikasi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getDaftarTagihanRekananVerifikasi(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "limit", required = false, defaultValue = "5000") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "namaRekanan") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@RequestParam(value = "noFaktur", required = false) String noFaktur,
|
||||
@RequestParam(value = "namaRekanan", required = false) String namaRekanan,
|
||||
@RequestParam(value = "dateStart", required = false) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = false) String dateEnd,
|
||||
@RequestParam(value = "noTerima", required = false) String noTerima,
|
||||
@RequestParam(value = "status", required = false) String status,
|
||||
@RequestParam(value = "noRec", required = false) String noRec,
|
||||
@RequestParam(value = "gridFor", required = false) String gridFor) {
|
||||
Map<String, Object> resultPageMap = service.getDaftarTagihanRekananVerifikasi(page, limit, sort, dir, dateStart,
|
||||
dateEnd, noFaktur, namaRekanan, noTerima, status, noRec, gridFor);
|
||||
|
||||
return resultPageMap;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/detail-tagihan-rekanan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getDetailTagihanRekanan(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "limit", required = false, defaultValue = "5000") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "namaRekanan") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@RequestParam(value = "noFaktur", required = false) String noFaktur,
|
||||
@RequestParam(value = "namaRekanan", required = false) String namaRekanan,
|
||||
@RequestParam(value = "dateStart", required = false) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = false) String dateEnd,
|
||||
@RequestParam(value = "noTerima", required = false) String noTerima,
|
||||
@RequestParam(value = "noRec", required = false) String noRec) {
|
||||
Map<String, Object> resultPageMap = service.getDetailTagihanRekanan(page, limit, sort, dir, dateStart, dateEnd,
|
||||
noFaktur, namaRekanan, noTerima, noRec);
|
||||
|
||||
return resultPageMap;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/detail-total-harga-rekanan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getDetailTotalTagihanRekanan(
|
||||
@RequestParam(value = "noFaktur", required = false) String noFaktur,
|
||||
@RequestParam(value = "namaRekanan", required = false) String namaRekanan,
|
||||
@RequestParam(value = "dateStart", required = false) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = false) String dateEnd,
|
||||
@RequestParam(value = "noTerima", required = false) String noTerima,
|
||||
@RequestParam(value = "noRec", required = false) String noRec) {
|
||||
Map<String, Object> resultPageMap = service.getDetailTotalTagihanRekanan(dateStart, dateEnd, noFaktur,
|
||||
namaRekanan, noTerima, noRec);
|
||||
|
||||
return resultPageMap;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/riwayat-pembayaran-tagihan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getRiwayatPembayaranTagihan(
|
||||
@RequestParam(value = "idRekanan", required = false) Integer idRekanan,
|
||||
@RequestParam(value = "noRec", required = false) String noRec) {
|
||||
Map<String, Object> resultPageMap = service.getRiwayatPembayaranTagihan(idRekanan, noRec);
|
||||
|
||||
return resultPageMap;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-pembayaran-tagihan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/save-pembayaran-tagihan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> savePembayaranTagihan(
|
||||
@Valid @RequestBody StrukBuktiPengeluaranCaraBayarVO vo,
|
||||
@RequestParam(value = "idRekanan", required = false) Integer idRekanan,
|
||||
@ -129,134 +43,20 @@ public class TagihanRekananController extends LocaleController<StrukPelayananVO>
|
||||
try {
|
||||
Map<String, Object> result = service.savePembayaranTagihan(vo, idRekanan, noRec, status);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when savePembayaranTagihan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when savePembayaranTagihan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when savePembayaranTagihan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when savePembayaranTagihan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-verifikasi-tagihan-rekanan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveVerifikasiTagihanRekanan(
|
||||
@RequestParam(value = "noRec", required = false) String noRec, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.saveVerifikasiTagihanRekanan(noRec);
|
||||
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 saveVerifikasiTagihanRekanan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveVerifikasiTagihanRekanan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-ruangan", method = RequestMethod.GET)
|
||||
public ResponseEntity<Ruangan> getRuangan(HttpServletRequest request) {
|
||||
try {
|
||||
Ruangan ruangan = service.getRuanganByUserLogin();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(ruangan, HttpStatus.OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when getRuangan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getRuangan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-klaim-pembayaran", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveKlaimPembayaran(@Valid @RequestBody MappingKirimDokumenPasienVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.saveKlaimPembayaran(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 saveKlaimPembayaran", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveKlaimPembayaran", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/daftar-klaim-pembayaran", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getKlaimPembayaran(
|
||||
@RequestParam(value = "noRegistrasi", required = false) String noRegistrasi) {
|
||||
Map<String, Object> resultPageMap = service.getKlaimPembayaran(noRegistrasi);
|
||||
|
||||
return resultPageMap;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/detail-kwitansi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getDetailKwitansi(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "100") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "noSbm") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@RequestParam(value = "noRec", required = false) String noRec,
|
||||
@RequestParam(value = "noSbm", required = false) String noSbm) {
|
||||
Map<String, Object> resultPageMap = service.getDetailKwitansi(page, limit, sort, dir, noRec, noSbm);
|
||||
|
||||
return resultPageMap;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/detail-kwitansi-noregistrasi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getDetailKwitansiNoRegistrasi(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "100") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "noRegistrasi") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@RequestParam(value = "noRec", required = false) String noRec,
|
||||
@RequestParam(value = "noSbm", required = false) String noSbm,
|
||||
@RequestParam(value = "noRegistrasi", required = false) String noRegistrasi) {
|
||||
Map<String, Object> resultPageMap = service.getDetailKwitansiNoRegistrasi(page, limit, sort, dir, noRec, noSbm,
|
||||
noRegistrasi);
|
||||
|
||||
return resultPageMap;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/kartu-piutang-perusahaan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getKartuPiutangPerusahaan(
|
||||
@RequestParam(value = "dateStart", required = false) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = false) String dateEnd,
|
||||
@RequestParam(value = "noCm", required = false) String noCm,
|
||||
@RequestParam(value = "namaPasien", required = false) String namaPasien,
|
||||
@RequestParam(value = "noRegistrasi", required = false) String noRegistrasi,
|
||||
@RequestParam(value = "kdRekanan", required = false) Short kdRekanan,
|
||||
@RequestParam(value = "namaRekanan", required = false) String namaRekanan) {
|
||||
Map<String, Object> resultPageMap = service.getKartuPiutangPerusahaan(dateStart, dateEnd, noCm, namaPasien,
|
||||
noRegistrasi, kdRekanan, namaRekanan);
|
||||
|
||||
return resultPageMap;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/verifikasi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/verifikasi", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getDaftarVerifikasi(
|
||||
@RequestParam(value = "dateStart", required = false) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = false) String dateEnd,
|
||||
@ -264,10 +64,8 @@ public class TagihanRekananController extends LocaleController<StrukPelayananVO>
|
||||
@RequestParam(value = "dateEndVerif", required = false) String dateEndVerif,
|
||||
@RequestParam(value = "idKelTransaksi", required = false) Integer idKelTransaksi,
|
||||
@RequestParam(value = "kelTransaksi", required = false) String kelTransaksi) {
|
||||
Map<String, Object> resultPageMap = service.getDaftarVerifikasi(dateStart, dateEnd, dateStartVerif,
|
||||
dateEndVerif, idKelTransaksi, kelTransaksi);
|
||||
|
||||
return resultPageMap;
|
||||
return service.getDaftarVerifikasi(dateStart, dateEnd, dateStartVerif, dateEndVerif, idKelTransaksi,
|
||||
kelTransaksi);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,70 +1,53 @@
|
||||
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.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.dto.TahapanRekrutmenTestDto;
|
||||
import com.jasamedika.medifirst2000.service.TahapanRekrutmenTestService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.PegawaiVO;
|
||||
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.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/tahapan-rekrutmen")
|
||||
public class TahapanRekrutmenTestController extends LocaleController<PegawaiVO>{
|
||||
public class TahapanRekrutmenTestController extends LocaleController<PegawaiVO> {
|
||||
|
||||
@Autowired
|
||||
private TahapanRekrutmenTestService tahapanRekrutmenTestService;
|
||||
|
||||
@RequestMapping(value="/get-all", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAll(
|
||||
HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/get-all", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAll(HttpServletRequest request) {
|
||||
Map<String, Object> result = tahapanRekrutmenTestService.getAll();
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
if (result != null) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> save(
|
||||
@RequestBody TahapanRekrutmenTestDto dto,
|
||||
@RequestMapping(value = "/save", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> save(@RequestBody TahapanRekrutmenTestDto dto,
|
||||
HttpServletRequest request) {
|
||||
Map<String, Object> result = tahapanRekrutmenTestService.save(dto);
|
||||
|
||||
if (!result.isEmpty()) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-by-id", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllPenerimaanLinen(
|
||||
@RequestParam(value="id",required=false) Integer id,
|
||||
HttpServletRequest request) {
|
||||
Map<String, Object> result = tahapanRekrutmenTestService.getById(id);
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,119 +1,58 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.TargetIndikatorService;
|
||||
import com.jasamedika.medifirst2000.vo.TargetIndikatorVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.entities.TargetIndikator;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.TargetIndikatorService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.TargetIndikatorVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/target-indikator")
|
||||
public class TargetIndikatorController extends LocaleController<TargetIndikatorVO>
|
||||
implements IBaseRestController<TargetIndikatorVO>{
|
||||
|
||||
public class TargetIndikatorController extends LocaleController<TargetIndikatorVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(TargetIndikatorController.class);
|
||||
|
||||
@Autowired
|
||||
private TargetIndikatorService targetIndikatorService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(TargetIndikatorController.class);
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<TargetIndikatorVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<TargetIndikatorVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(TargetIndikatorVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(TargetIndikatorVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<TargetIndikatorVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/find-all/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Collection<TargetIndikator>> findAll(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "100") Integer take,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "noRec") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@Spec(path = "noRec", params = "norec", spec = Equal.class) Specification<TargetIndikator> spec)
|
||||
{
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result = targetIndikatorService.findAll(page, take, sort,dir, spec);
|
||||
return constructListPageResult(result);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/save/", method= RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody List<TargetIndikatorVO> vos,HttpServletRequest request){
|
||||
try{
|
||||
@RequestMapping(value = "/save/", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody List<TargetIndikatorVO> vos,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = targetIndikatorService.save(vos);
|
||||
if(null!= result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add/update kamus IKU", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when targetIndikatorService.save", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add/update kamus IKU", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when targetIndikatorService.save", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
|
||||
@RestController
|
||||
public class TestConnection {
|
||||
|
||||
@RequestMapping(value = "/test-tanpa-auth/index.json", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> testTomcat(){
|
||||
|
||||
return RestUtil.defaultJsonResponse(new asal());
|
||||
}
|
||||
|
||||
public static class asal {
|
||||
|
||||
String asalada = "<body><h1>Jasamedika Web</h1></body>";
|
||||
|
||||
public String getAsalada(){
|
||||
return asalada;
|
||||
}
|
||||
|
||||
public void setAsalada(String asalada){
|
||||
this.asalada = asalada;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,109 +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.RestController;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.Tht2Service;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.Tht2VO;
|
||||
|
||||
/**
|
||||
* Controller class for Pengakjian Awal Tht2Controller
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/tht-2")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class Tht2Controller extends LocaleController<Tht2VO> implements
|
||||
IBaseRestController<Tht2VO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Tht2Controller.class);
|
||||
|
||||
@Autowired
|
||||
private Tht2Service tht2Service;
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-tht-2", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody Tht2VO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = tht2Service.addTht2(vo);
|
||||
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
result.put("message", "Berhasil");
|
||||
}else{
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
result.put("message", "Gagal");
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<Tht2VO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Tht2VO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(Tht2VO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(Tht2VO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<Tht2VO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,34 +1,33 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.entities.TidurIstirahat;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.TidurIstirahatService;
|
||||
import com.jasamedika.medifirst2000.vo.TidurIstirahatVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.TidurIstirahatService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.TidurIstirahatVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
/**
|
||||
* Controller class for TidurIstirahatController
|
||||
@ -37,70 +36,35 @@ import com.jasamedika.medifirst2000.vo.TidurIstirahatVO;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/tidur-istirahat")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class TidurIstirahatController extends LocaleController<TidurIstirahatVO> implements
|
||||
IBaseRestController<TidurIstirahatVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TidurIstirahatController.class);
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class TidurIstirahatController extends LocaleController<TidurIstirahatVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(TidurIstirahatController.class);
|
||||
|
||||
@Autowired
|
||||
private TidurIstirahatService tidurIstirahatService;
|
||||
private TidurIstirahatService<TidurIstirahat> tidurIstirahatService;
|
||||
|
||||
@RequestMapping(value = "/save-tidur-istirahat", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody TidurIstirahatVO vo,HttpServletRequest request) {
|
||||
@RequestMapping(value = "/save-tidur-istirahat", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody TidurIstirahatVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = tidurIstirahatService.addTidurIstirahat(vo);
|
||||
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
}else{
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
Map<String, Object> result = tidurIstirahatService.addTidurIstirahat(vo);
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} else {
|
||||
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
|
||||
}
|
||||
SaveLog("Tidur Istirahat", "Pemeriksaan",request);
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
SaveLog("Tidur Istirahat", "Pemeriksaan", request);
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when addTidurIstirahat", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when addTidurIstirahat", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<TidurIstirahatVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<TidurIstirahatVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(TidurIstirahatVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(TidurIstirahatVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<TidurIstirahatVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,147 +1,103 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.TimeOutControlService;
|
||||
import com.jasamedika.medifirst2000.vo.TimeOutControlVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.TimeOutControlService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.TimeOutControlVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/time-out-control")
|
||||
public class TimeOutControlController extends LocaleController<TimeOutControlVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TimeOutControlController.class);
|
||||
private static final Logger LOGGER = getLogger(TimeOutControlController.class);
|
||||
|
||||
@Autowired
|
||||
private TimeOutControlService timeOutControlService;
|
||||
|
||||
@RequestMapping(value = "/save-time-out-control", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/save-time-out-control", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveTimeOutControl(@Valid @RequestBody TimeOutControlVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = timeOutControlService.saveTimeOutControl(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when save Time Out Control", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveTimeOutControl", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when save Time Out Control", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveTimeOutControl", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-time-out-control", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> updateTimeOutControl(@Valid @RequestBody TimeOutControlVO vo,
|
||||
@RequestMapping(value = "/get-time-out-by-norec", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getTimeOutByNoRec(@RequestParam(value = "noRec") String noRec,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = timeOutControlService.updateTimeOutControl(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 Time Out Control", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update Time Out Control", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "/get-time-out-by-norec",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getTimeOutByNoRec(
|
||||
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request){
|
||||
|
||||
try {
|
||||
Map<String,Object> result = this.timeOutControlService.findByNoRec(noRec);
|
||||
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
|
||||
} else{
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
|
||||
|
||||
Map<String, Object> result = this.timeOutControlService.findByNoRec(noRec);
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} else {
|
||||
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when getTimeOutByNoRec", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when findByNoRec", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getTimeOutByNoRec", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "/get-time-out-by-norec-antrian",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getTimeOutByNoRecAntrian(
|
||||
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request){
|
||||
|
||||
try {
|
||||
Map<String,Object> result = this.timeOutControlService.getTimeOutByNoRecAntrian(noRec);
|
||||
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
|
||||
} else{
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
|
||||
|
||||
}
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when getTimeOutByNoRecAntrian", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getTimeOutByNoRecAntrian", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got JpaSystemException {} when findByNoRec", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-time-out-by-norec-antrian", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getTimeOutByNoRecAntrian(@RequestParam(value = "noRec") String noRec,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.timeOutControlService.getTimeOutByNoRecAntrian(noRec);
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} else {
|
||||
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got ServiceVOException {} when getTimeOutByNoRecAntrian", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when getTimeOutByNoRecAntrian", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,115 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.TingkatKelulusanService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.TingkatKelulusanVO;
|
||||
|
||||
|
||||
/******************
|
||||
* @author Shakato
|
||||
******************/
|
||||
@RestController
|
||||
@RequestMapping("/tingkat-kelulusan")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class TingkatKelulusanController extends LocaleController<TingkatKelulusanVO> implements IBaseRestController<TingkatKelulusanVO> {
|
||||
|
||||
@Autowired
|
||||
private TingkatKelulusanService tingkatKelulusanService;
|
||||
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TingkatKelulusanController.class);
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-tingkat-kelulusan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> saveTingkatKelulusan(@Valid @RequestBody TingkatKelulusanVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
TingkatKelulusanVO result = tingkatKelulusanService.add(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
RestUtil.getJsonHttpStatus(HttpStatus.CREATED);
|
||||
return RestUtil.getJsonResponse("Status Sukses", HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Status Keluarga", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Status Keluarga", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<TingkatKelulusanVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(TingkatKelulusanVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(TingkatKelulusanVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<TingkatKelulusanVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<TingkatKelulusanVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,118 +1,57 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.TingkatResikoService;
|
||||
import com.jasamedika.medifirst2000.vo.TingkatResikoVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.entities.TingkatResiko;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.TingkatResikoService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.TingkatResikoVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/tingkat-resiko")
|
||||
public class TingkatResikoController extends LocaleController<TingkatResikoVO>
|
||||
implements IBaseRestController<TingkatResikoVO>{
|
||||
public class TingkatResikoController extends LocaleController<TingkatResikoVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(TingkatResikoController.class);
|
||||
|
||||
@Autowired
|
||||
private TingkatResikoService tingkatResikoService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(PegawaiController.class);
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<TingkatResikoVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<TingkatResikoVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(TingkatResikoVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(TingkatResikoVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<TingkatResikoVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/find-all/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Collection<TingkatResiko>> findAll(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "100") Integer take,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@Spec(path = "id", params = "id", spec = Equal.class) Specification<TingkatResiko> spec)
|
||||
{
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result = tingkatResikoService.findAll(page, take, sort,dir, spec);
|
||||
return constructListPageResult(result);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/save/", method= RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody TingkatResikoVO vo,HttpServletRequest request){
|
||||
try{
|
||||
@RequestMapping(value = "/save/", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody TingkatResikoVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = tingkatResikoService.save(vo);
|
||||
if(null!= result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add/update tingkatResiko", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when tingkatResikoService.save", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add/update tingkatResiko", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when tingkatResikoService.save", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,152 +1,56 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.entities.Tor;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.TorService;
|
||||
import com.jasamedika.medifirst2000.vo.TorVO;
|
||||
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.TorService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.TorVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/tor")
|
||||
public class TorController extends LocaleController<TorVO> implements
|
||||
IBaseRestController<TorVO> {
|
||||
|
||||
public class TorController extends LocaleController<TorVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(TorController.class);
|
||||
|
||||
@Autowired
|
||||
private TorService torService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(TorController.class);
|
||||
private TorService<Tor> torService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<TorVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<TorVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-tor/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> addVO(@Valid @RequestBody TorVO vo,HttpServletRequest request) {
|
||||
@RequestMapping(value = "/save-tor/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> addVO(@Valid @RequestBody TorVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
TorVO result = (TorVO) torService.add(vo);
|
||||
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result.getId().toString(), HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Tor", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Tor", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-tor/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> editVO(@Valid @RequestBody TorVO vo) {
|
||||
try {
|
||||
TorVO result = (TorVO) torService.update(vo);
|
||||
|
||||
TorVO result = torService.add(vo);
|
||||
if (null != result)
|
||||
return RestUtil.getJsonResponse("", HttpStatus.OK);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse("The TOR has been successfully saved", CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when update Tor", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when torService.add", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update Tor",
|
||||
jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when torService.add", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.NOT_ACCEPTABLE);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete-tor/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
try {
|
||||
if (torService.delete(id) == true)
|
||||
return RestUtil.getJsonResponse("", HttpStatus.CREATED);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when delete Tor", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when delete Tor", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.NOT_ACCEPTABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<TorVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/search-tor", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Collection<TorVO>> getAllVOWithQueryString(
|
||||
@RequestParam(value = "page", required = false ,defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "limit", required = false ,defaultValue = "10") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir){
|
||||
Map<String, Object> resultPageMap = torService.findAllWithPageAndLimitAndSortByAndDirectionParameter(page,limit, sort, dir);
|
||||
|
||||
return constructListPageResult(resultPageMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(TorVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,209 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
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.DetailAktivitasKemandirianService;
|
||||
import com.jasamedika.medifirst2000.service.DetailAlasanPemindahanPasienService;
|
||||
import com.jasamedika.medifirst2000.service.DetailInformasiMedisService;
|
||||
import com.jasamedika.medifirst2000.service.DetailPsikologisService;
|
||||
import com.jasamedika.medifirst2000.service.PeralatanDetailService;
|
||||
import com.jasamedika.medifirst2000.service.ResikoJatuhDetailService;
|
||||
import com.jasamedika.medifirst2000.service.TransferPasienInternalService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AlasanPemindahanPasienVO;
|
||||
import com.jasamedika.medifirst2000.vo.PeralatanDetailCustomVO;
|
||||
import com.jasamedika.medifirst2000.vo.ResikoJatuhDetailCustomVO;
|
||||
import com.jasamedika.medifirst2000.vo.TransferPasienAktivitasKemandirianVO;
|
||||
import com.jasamedika.medifirst2000.vo.TransferPasienInformasiMedisVO;
|
||||
import com.jasamedika.medifirst2000.vo.TransferPasienPsikologisVO;
|
||||
import com.jasamedika.medifirst2000.vo.TransferPasienExsternalVO;
|
||||
|
||||
/**
|
||||
* Controller class for Registrasi Pasien Business
|
||||
*
|
||||
* @author Adik
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/transfer-pasien-exsternal")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class TransferPasienExsternalController extends LocaleController<AlasanPemindahanPasienVO> {
|
||||
|
||||
@Autowired
|
||||
private DetailAlasanPemindahanPasienService detailAlasanPemindahanPasienService;
|
||||
|
||||
@Autowired
|
||||
private DetailPsikologisService detailPsikologisService;
|
||||
|
||||
@Autowired
|
||||
private DetailInformasiMedisService detailInformasiMedisService;
|
||||
|
||||
@Autowired
|
||||
private TransferPasienInternalService transferPasienExsternalService;
|
||||
|
||||
@Autowired
|
||||
private DetailAktivitasKemandirianService detailAktivitasKemandirianService;
|
||||
|
||||
@Autowired
|
||||
private PeralatanDetailService peralatanDetailService;
|
||||
|
||||
@Autowired
|
||||
private ResikoJatuhDetailService resikoJatuhDetailService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TransferPasienExsternalController.class);
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-detail-psikologis", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveDetailStatusPsikologis(@Valid @RequestBody TransferPasienPsikologisVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=detailPsikologisService.saveDetailPsikologis(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 Detail Psikologi", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Detail Psikologi", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-informasi-medis", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveInformasiMedis(@Valid @RequestBody TransferPasienInformasiMedisVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=detailInformasiMedisService.saveInformasiMedis(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 informasi Medis", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add informasi Medis", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-transfer-pasien-exsternal", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveTransferPasienExsternal(@Valid @RequestBody TransferPasienExsternalVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=transferPasienExsternalService.saveTransferPasienExsternal(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 Transfer Pasien Exsternal", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Transfer Pasien Exsternal", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-aktivitas-kemandirian", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveTransferPasienExsternal(@Valid @RequestBody TransferPasienAktivitasKemandirianVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=detailAktivitasKemandirianService.saveAktivitasKemandirian(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 Transfer Aktivias Kemandirian Exsternal", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Transfer Pasien Exsternal", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-peralatan-detail/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> savePeralatanDetail(@Valid @RequestBody PeralatanDetailCustomVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=peralatanDetailService.addPeralatan(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 Peralatan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Peralatan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-resiko-jatuh/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> saveResikoJatuh(@Valid @RequestBody ResikoJatuhDetailCustomVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=resikoJatuhDetailService.addResikoJatuh(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 Resiko Jatuh", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Resiko Jatuh", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,46 +1,33 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.*;
|
||||
import com.jasamedika.medifirst2000.vo.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
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.DetailAktivitasKemandirianService;
|
||||
import com.jasamedika.medifirst2000.service.DetailAlasanPemindahanPasienService;
|
||||
import com.jasamedika.medifirst2000.service.DetailInformasiMedisService;
|
||||
import com.jasamedika.medifirst2000.service.DetailPsikologisService;
|
||||
import com.jasamedika.medifirst2000.service.PeralatanDetailService;
|
||||
import com.jasamedika.medifirst2000.service.ProdukService;
|
||||
import com.jasamedika.medifirst2000.service.ResikoJatuhDetailService;
|
||||
import com.jasamedika.medifirst2000.service.TransferPasienInternalService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AlasanPemindahanPasienVO;
|
||||
import com.jasamedika.medifirst2000.vo.PeralatanDetailCustomVO;
|
||||
import com.jasamedika.medifirst2000.vo.ResikoJatuhDetailCustomVO;
|
||||
import com.jasamedika.medifirst2000.vo.TransferPasienAktivitasKemandirianVO;
|
||||
import com.jasamedika.medifirst2000.vo.TransferPasienInformasiMedisVO;
|
||||
import com.jasamedika.medifirst2000.vo.TransferPasienPsikologisVO;
|
||||
import com.jasamedika.medifirst2000.vo.TransferPasienInternalVO;
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
/**
|
||||
* Controller class for Registrasi Pasien Business
|
||||
@ -49,227 +36,133 @@ import com.jasamedika.medifirst2000.vo.TransferPasienInternalVO;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/transfer-pasien-internal")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class TransferPasienInternalController extends LocaleController<AlasanPemindahanPasienVO> {
|
||||
|
||||
@Autowired
|
||||
private DetailAlasanPemindahanPasienService detailAlasanPemindahanPasienService;
|
||||
|
||||
private static final Logger LOGGER = getLogger(TransferPasienInternalController.class);
|
||||
|
||||
@Autowired
|
||||
private DetailPsikologisService detailPsikologisService;
|
||||
|
||||
@Autowired
|
||||
private DetailInformasiMedisService detailInformasiMedisService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private TransferPasienInternalService transferPasienInternalService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private DetailAktivitasKemandirianService detailAktivitasKemandirianService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private PeralatanDetailService peralatanDetailService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ProdukService produkService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ResikoJatuhDetailService resikoJatuhDetailService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TransferPasienInternalController.class);
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-detail-psikologis", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveDetailStatusPsikologis(@Valid @RequestBody TransferPasienPsikologisVO vo,HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/save-detail-psikologis", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveDetailStatusPsikologis(
|
||||
@Valid @RequestBody TransferPasienPsikologisVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=detailPsikologisService.saveDetailPsikologis(vo);
|
||||
Map<String, Object> result = detailPsikologisService.saveDetailPsikologis(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Detail Psikologi", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveDetailPsikologis", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Detail Psikologi", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-informasi-medis", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveInformasiMedis(@Valid @RequestBody TransferPasienInformasiMedisVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=detailInformasiMedisService.saveInformasiMedis(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 informasi Medis", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add informasi Medis", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-transfer-pasien-internal", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveTransferPasienInternal(@Valid @RequestBody TransferPasienInternalVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=transferPasienInternalService.saveTransferPasienInternal(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 Transfer Pasien Internal", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Transfer Pasien Internal", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-aktivitas-kemandirian", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveTransferPasienInternal(@Valid @RequestBody TransferPasienAktivitasKemandirianVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=detailAktivitasKemandirianService.saveAktivitasKemandirian(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 Transfer Aktivias Kemandirian Internal", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Transfer Pasien Internal", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-peralatan-detail/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> savePeralatanDetail(@Valid @RequestBody PeralatanDetailCustomVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=peralatanDetailService.addPeralatan(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 Peralatan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Peralatan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveDetailPsikologis", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-resiko-jatuh/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> saveResikoJatuh(@Valid @RequestBody ResikoJatuhDetailCustomVO vo, HttpServletRequest request) {
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-transfer-pasien-internal", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveTransferPasienInternal(
|
||||
@Valid @RequestBody TransferPasienInternalVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=resikoJatuhDetailService.addResikoJatuh(vo);
|
||||
Map<String, Object> result = transferPasienInternalService.saveTransferPasienInternal(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Resiko Jatuh", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveTransferPasienInternal", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Resiko Jatuh", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveTransferPasienInternal", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-list-obat", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getListObat(
|
||||
|
||||
@RequestMapping(value = "/save-aktivitas-kemandirian", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveTransferPasienInternal(
|
||||
@Valid @RequestBody TransferPasienAktivitasKemandirianVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = detailAktivitasKemandirianService.saveAktivitasKemandirian(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got ServiceVOException {} when saveAktivitasKemandirian", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when saveAktivitasKemandirian", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-peralatan-detail/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> savePeralatanDetail(@Valid @RequestBody PeralatanDetailCustomVO vo,
|
||||
HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = null;
|
||||
try {
|
||||
|
||||
result = produkService.findObat();
|
||||
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Map<String, Object> result = peralatanDetailService.addPeralatan(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got ServiceVOException {} when addPeralatan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when addPeralatan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-list-peralatan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getListPeralatan(
|
||||
HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = null;
|
||||
try {
|
||||
|
||||
result = transferPasienInternalService.findPeralatan(false);
|
||||
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@RequestMapping(value = "/save-resiko-jatuh/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveResikoJatuh(@Valid @RequestBody ResikoJatuhDetailCustomVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = resikoJatuhDetailService.addResikoJatuh(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got ServiceVOException {} when addResikoJatuh", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when addResikoJatuh", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-list-metode-pemindahan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getListMetodePemindahan(
|
||||
HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = null;
|
||||
try {
|
||||
|
||||
result = transferPasienInternalService.findPeralatan(true);
|
||||
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-transfer-internal/{startDate}/{endDate}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getListTransferInternal(@PathVariable("startDate") String startDate,
|
||||
@PathVariable("endDate") String endDate,
|
||||
HttpServletRequest request) {
|
||||
Map<String,Object> result = null;
|
||||
@RequestMapping(value = "/get-list-obat", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getListObat(HttpServletRequest request) {
|
||||
try {
|
||||
|
||||
result = transferPasienInternalService.findTransferInternal(startDate, endDate);
|
||||
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
List<Map<String, Object>> result = produkService.findObat();
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,200 +1,62 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.HasilTriaseService;
|
||||
import com.jasamedika.medifirst2000.vo.HasilTriaseVO;
|
||||
import com.jasamedika.medifirst2000.vo.TriaseVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DetailTriaseService;
|
||||
import com.jasamedika.medifirst2000.service.HasilTriaseService;
|
||||
import com.jasamedika.medifirst2000.service.KategoriHasilTriaseService;
|
||||
import com.jasamedika.medifirst2000.service.PemeriksaanTriageService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DetailTriaseVO;
|
||||
import com.jasamedika.medifirst2000.vo.HasilTriaseVO;
|
||||
import com.jasamedika.medifirst2000.vo.KategoriHasilTriaseVO;
|
||||
import com.jasamedika.medifirst2000.vo.PemeriksaanTriageVO;
|
||||
import com.jasamedika.medifirst2000.vo.TriaseVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
/******************
|
||||
* @author Shakato
|
||||
******************/
|
||||
@RestController
|
||||
@RequestMapping("/triase")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class TriaseController extends LocaleController<TriaseVO>{
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class TriaseController extends LocaleController<TriaseVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(TriaseController.class);
|
||||
|
||||
@Autowired
|
||||
private DetailTriaseService detailTriaseService;
|
||||
|
||||
@Autowired
|
||||
private PemeriksaanTriageService pemeriksaanTriageService;
|
||||
|
||||
@Autowired
|
||||
private KategoriHasilTriaseService kategoriHasilTriaseService;
|
||||
|
||||
@Autowired
|
||||
private HasilTriaseService hasilTriaseService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TriaseController.class);
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-detail-triase", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> saveDetailTriase(@Valid @RequestBody DetailTriaseVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
DetailTriaseVO result = detailTriaseService.add(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
RestUtil.getJsonHttpStatus(HttpStatus.CREATED);
|
||||
return RestUtil.getJsonResponse("Status Sukses", HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Detail Triase", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Detail Triase", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-pemeriksaan-triage", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> savePemeriksaanTriage(@Valid @RequestBody PemeriksaanTriageVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
PemeriksaanTriageVO result = pemeriksaanTriageService.add(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
RestUtil.getJsonHttpStatus(HttpStatus.CREATED);
|
||||
return RestUtil.getJsonResponse("Status Sukses", HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Pemeriksaan Triase", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Pemeriksaan Triase", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-hasil-kategori-triase", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> saveHasilKategoriTriase(@Valid @RequestBody KategoriHasilTriaseVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
KategoriHasilTriaseVO result = kategoriHasilTriaseService.add(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
RestUtil.getJsonHttpStatus(HttpStatus.CREATED);
|
||||
return RestUtil.getJsonResponse("Status Sukses", HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Hasil Kategori Triase", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Hasil Kategori Triase", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/edit-detail-triase", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> editVO(@Valid @RequestBody DetailTriaseVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
DetailTriaseVO result = detailTriaseService.update(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
RestUtil.getJsonHttpStatus(HttpStatus.CREATED);
|
||||
return RestUtil.getJsonResponse("Status Sukses", HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when update Detail Triase", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update Detail Triase", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/edit-pemeriksaan-triage", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> editVO(@Valid @RequestBody PemeriksaanTriageVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
PemeriksaanTriageVO result = pemeriksaanTriageService.update(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
RestUtil.getJsonHttpStatus(HttpStatus.CREATED);
|
||||
return RestUtil.getJsonResponse("Status Sukses", HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when update Pemeriksaan Triase", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update Pemeriksaan Triase", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/edit-hasil-kategori-triase", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> editVO(@Valid @RequestBody KategoriHasilTriaseVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
KategoriHasilTriaseVO result = kategoriHasilTriaseService.update(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
RestUtil.getJsonHttpStatus(HttpStatus.CREATED);
|
||||
return RestUtil.getJsonResponse("Status Sukses", HttpStatus.CREATED,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when update Detail Triase", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update Detail Triase", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-hasil-triase", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/save-hasil-triase", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> saveHasilTriase(@Valid @RequestBody HasilTriaseVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = hasilTriaseService.saveHasilTriaseService(vo);
|
||||
Map<String, Object> result = hasilTriaseService.saveHasilTriaseService(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
RestUtil.getJsonHttpStatus(HttpStatus.CREATED);
|
||||
return RestUtil.getJsonResponse("Status Sukses", HttpStatus.CREATED,mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse("Status Sukses", CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when update Detail Triase", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveHasilTriaseService", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update Detail Triase", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveHasilTriaseService", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -14,7 +14,6 @@ import com.jasamedika.medifirst2000.service.LoginUserService;
|
||||
import com.jasamedika.medifirst2000.service.ModelService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.ModelVO;
|
||||
import com.jasamedika.medifirst2000.vo.PasienVO;
|
||||
import com.jasamedika.medifirst2000.vo.PegawaiVO;
|
||||
import io.socket.client.IO;
|
||||
import io.socket.client.Socket;
|
||||
@ -182,7 +181,7 @@ public abstract class LocaleController<V extends BaseModelVO> {
|
||||
return lang;
|
||||
}
|
||||
|
||||
protected ResponseEntity<Collection<PasienVO>> constructListPageResult(Map<String, Object> map) {
|
||||
protected ResponseEntity<Collection<V>> constructListPageResult(Map<String, Object> map) {
|
||||
if (map == null) {
|
||||
Map<String, String> mapHeaderMessage = new HashMap<>();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.TOTAL_PAGE_HEADER, "0");
|
||||
@ -190,8 +189,8 @@ public abstract class LocaleController<V extends BaseModelVO> {
|
||||
mapHeaderMessage.put(Constants.MessageInfo.ERROR_MESSAGE, "Data not found.");
|
||||
return RestUtil.getJsonResponse(null, HttpStatus.BAD_REQUEST, mapHeaderMessage);
|
||||
} else {
|
||||
Collection<PasienVO> vos = (Collection<PasienVO>) map.get(WebConstants.PageParameter.LIST_DATA);
|
||||
Map<String, String> mapHeaderMessage = new HashMap<>();
|
||||
Collection<V> vos = (Collection<V>) map.get(WebConstants.PageParameter.LIST_DATA);
|
||||
Map<String, String> mapHeaderMessage = new HashMap<>();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.TOTAL_PAGE_HEADER,
|
||||
String.valueOf(map.get(WebConstants.PageParameter.TOTAL_PAGES)));
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.TOTAL_COUNT_HEADER,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user