Update controller
Clean code
This commit is contained in:
parent
9d932fb6db
commit
60de4d71fa
@ -1,39 +1,22 @@
|
||||
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 com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.entities.GenericView;
|
||||
import com.jasamedika.medifirst2000.service.GenericViewService;
|
||||
import com.jasamedika.medifirst2000.vo.GenericViewVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.entities.GenericView;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.GenericViewService;
|
||||
import com.jasamedika.medifirst2000.util.DateUtil;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.GenericViewVO;
|
||||
import com.jasamedika.medifirst2000.vo.PapSkriningNyeriVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Controller class for Pengakjian Awal Gawat Darurat Business
|
||||
@ -42,135 +25,34 @@ import com.jasamedika.medifirst2000.vo.PapSkriningNyeriVO;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/genericView")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class GenericViewController extends LocaleController<GenericViewVO> implements
|
||||
IBaseRestController<GenericViewVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(GenericViewController.class);
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class GenericViewController extends LocaleController<GenericViewVO> {
|
||||
|
||||
@Autowired
|
||||
private GenericViewService papGenericViewService;
|
||||
private GenericViewService<GenericView> papGenericViewService;
|
||||
|
||||
@RequestMapping(value = "/StatusAdaTidakAda", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/StatusAdaTidakAda", method = GET, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<GenericViewVO>> findAdaTidakAda(HttpServletRequest request) {
|
||||
List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("yaTidak");
|
||||
/*
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
if(dataFound){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
}else{
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
}*/
|
||||
return RestUtil.getJsonResponse(list, HttpStatus.OK);
|
||||
return getJsonResponse(list, OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/StatusRegulerIrreguler", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/StatusRegulerIrreguler", method = GET, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<GenericViewVO>> findByRegulerIrreguler(HttpServletRequest request) {
|
||||
List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("regulerIrreguler");
|
||||
return RestUtil.getJsonResponse(list, HttpStatus.OK);
|
||||
return getJsonResponse(list, OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/StatusNormalTidakNormal", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/StatusNormalTidakNormal", method = GET, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<GenericViewVO>> findByNormalTidakNormal(HttpServletRequest request) {
|
||||
List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("normalTidakNormal");
|
||||
return RestUtil.getJsonResponse(list, HttpStatus.OK);
|
||||
return getJsonResponse(list, OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/StatusBebasTerbatas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<GenericViewVO>> findByBebasTerbatas(HttpServletRequest request) {
|
||||
List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("bebasTerbatas");
|
||||
return RestUtil.getJsonResponse(list, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/DataAlatBantuNafas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/DataAlatBantuNafas", method = GET, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<GenericViewVO>> findByAlatBantuNafas(HttpServletRequest request) {
|
||||
List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("alatBantuNafas");
|
||||
return RestUtil.getJsonResponse(list, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/Akral", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<GenericViewVO>> findByAkral(HttpServletRequest request) {
|
||||
List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("akral");
|
||||
return RestUtil.getJsonResponse(list, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/Crt", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<GenericViewVO>> findByCrt(HttpServletRequest request) {
|
||||
List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("crt");
|
||||
return RestUtil.getJsonResponse(list, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/IntensitasNadi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<GenericViewVO>> findByIntensitasNadi(HttpServletRequest request) {
|
||||
List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("intensitasNadi");
|
||||
return RestUtil.getJsonResponse(list, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/Kesadaran", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<GenericViewVO>> findByKesadaran(HttpServletRequest request) {
|
||||
List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("kesadaran");
|
||||
return RestUtil.getJsonResponse(list, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/Mulut", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<GenericViewVO>> findByMulut(HttpServletRequest request) {
|
||||
List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("mulut");
|
||||
return RestUtil.getJsonResponse(list, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/StatusPsikologi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<GenericViewVO>> findByStatusPsikologi(HttpServletRequest request) {
|
||||
List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("statusPsikologi");
|
||||
return RestUtil.getJsonResponse(list, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/TempatTinggal", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<GenericViewVO>> findByTempatTinggal(HttpServletRequest request) {
|
||||
List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("tempatTinggal");
|
||||
return RestUtil.getJsonResponse(list, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/BaikTidakBaik", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<GenericViewVO>> findByBaikTidakBaik(HttpServletRequest request) {
|
||||
List<GenericViewVO> list = papGenericViewService.findGenericViewByPrevix("baikTidakBaik");
|
||||
return RestUtil.getJsonResponse(list, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/Test", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<GenericView>> findByTest(HttpServletRequest request) {
|
||||
List<GenericView> list = papGenericViewService.findGenericViewByPrevix("test");
|
||||
return RestUtil.getJsonResponse(list, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<GenericViewVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<GenericViewVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(GenericViewVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(GenericViewVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<GenericViewVO>> getAllVO() {
|
||||
return null;
|
||||
return getJsonResponse(list, OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,40 +1,25 @@
|
||||
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 com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.entities.GolonganDarah;
|
||||
import com.jasamedika.medifirst2000.service.GolonganDarahRhesusService;
|
||||
import com.jasamedika.medifirst2000.vo.GolonganDarahRhesusVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.GolonganDarahRhesusService;
|
||||
import com.jasamedika.medifirst2000.service.PapSirkulasiService;
|
||||
import com.jasamedika.medifirst2000.util.DateUtil;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.GolonganDarahRhesusVO;
|
||||
import com.jasamedika.medifirst2000.vo.PapSirkulasiVO;
|
||||
import com.jasamedika.medifirst2000.vo.PapSkriningNyeriVO;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Controller class for Pengakjian Awal Gawat Darurat Business
|
||||
@ -43,60 +28,23 @@ import com.jasamedika.medifirst2000.vo.PapSkriningNyeriVO;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/gol-darah-rhesus")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class GolonganDarahRhesusController extends LocaleController<GolonganDarahRhesusVO> implements
|
||||
IBaseRestController<GolonganDarahRhesusVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(GolonganDarahRhesusController.class);
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class GolonganDarahRhesusController extends LocaleController<GolonganDarahRhesusVO> {
|
||||
|
||||
@Autowired
|
||||
private GolonganDarahRhesusService golonganDarahRhesusService;
|
||||
private GolonganDarahRhesusService<GolonganDarah> golonganDarahRhesusService;
|
||||
|
||||
@RequestMapping(value = "/find-all/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> findAll(HttpServletRequest request) {
|
||||
Map<String,Object> result = golonganDarahRhesusService.findAll();
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
if(dataFound){
|
||||
mapHeaderMessage.clear();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
}else{
|
||||
mapHeaderMessage.clear();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
@RequestMapping(value = "/find-all/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findAll(HttpServletRequest request) {
|
||||
Map<String, Object> result = golonganDarahRhesusService.findAll();
|
||||
boolean dataFound = (boolean) result.get("dataFound");
|
||||
mapHeaderMessage.clear();
|
||||
if (dataFound) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} else {
|
||||
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
|
||||
}
|
||||
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<GolonganDarahRhesusVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<GolonganDarahRhesusVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(GolonganDarahRhesusVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(GolonganDarahRhesusVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<GolonganDarahRhesusVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,103 +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.HVAService;
|
||||
import com.jasamedika.medifirst2000.vo.HVAVO;
|
||||
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.HVAService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.HVAVO;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/hva")
|
||||
public class HVAController extends LocaleController<HVAVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HVAController.class);
|
||||
|
||||
@Autowired
|
||||
private HVAService hvaService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(PegawaiController.class);
|
||||
|
||||
@RequestMapping(value = "/find-hva/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findByJenisPeriode(
|
||||
@RequestParam(value="periodeTahun") Long periodeTahun,
|
||||
@RequestParam(value="jenisHVA") Integer jenisHVA,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = hvaService.findByJenisPeriode(periodeTahun, jenisHVA);
|
||||
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 findByJenisPeriode", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when findByJenisPeriode", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-hva/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findHVAByJenisPeriode(@Valid @RequestBody HVAVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = hvaService.saveHVA(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 findHVAByJenisPeriode", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when findHVAByJenisPeriode", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-summary-analysis", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getSummaryAnalysis(
|
||||
@RequestParam(value="periodeTahun") Long periodeTahun,
|
||||
@RequestMapping(value = "/find-hva/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findByJenisPeriode(
|
||||
@RequestParam(value = "periodeTahun") Long periodeTahun, @RequestParam(value = "jenisHVA") Integer jenisHVA,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = hvaService.getSummaryAnalysis(periodeTahun);
|
||||
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 = hvaService.findByJenisPeriode(periodeTahun, jenisHVA);
|
||||
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 getSummaryAnalysis", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when findByJenisPeriode", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getSummaryAnalysis", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when findByJenisPeriode", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-hva/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findHVAByJenisPeriode(@Valid @RequestBody HVAVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = hvaService.saveHVA(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 saveHVA", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when saveHVA", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-summary-analysis", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getSummaryAnalysis(
|
||||
@RequestParam(value = "periodeTahun") Long periodeTahun, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = hvaService.getSummaryAnalysis(periodeTahun);
|
||||
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 getSummaryAnalysis", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when getSummaryAnalysis", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,38 +1,26 @@
|
||||
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 com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.entities.HasilPemeriksaanPraKerja;
|
||||
import com.jasamedika.medifirst2000.service.HasilPemeriksaanPraKerjaService;
|
||||
import com.jasamedika.medifirst2000.vo.HasilPemeriksaanPraKerjaVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.HasilPemeriksaanPraKerjaService;
|
||||
import com.jasamedika.medifirst2000.util.DateUtil;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.HasilPemeriksaanPraKerjaVO;
|
||||
import com.jasamedika.medifirst2000.vo.PapSkriningNyeriVO;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Controller class for Pengakjian Awal Gawat Darurat Business
|
||||
@ -41,83 +29,23 @@ import com.jasamedika.medifirst2000.vo.PapSkriningNyeriVO;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/hasil-pemeriksaan-pra-kerja")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class HasilPemeriksaanPraKerjaController extends LocaleController<HasilPemeriksaanPraKerjaVO> implements
|
||||
IBaseRestController<HasilPemeriksaanPraKerjaVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HasilPemeriksaanPraKerjaController.class);
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class HasilPemeriksaanPraKerjaController extends LocaleController<HasilPemeriksaanPraKerjaVO> {
|
||||
|
||||
@Autowired
|
||||
private HasilPemeriksaanPraKerjaService hasilPemeriksaanPraKerjaService;
|
||||
private HasilPemeriksaanPraKerjaService<HasilPemeriksaanPraKerja> hasilPemeriksaanPraKerjaService;
|
||||
|
||||
@RequestMapping(value = "/save-hasil-pemeriksaan-pra-kerja", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody HasilPemeriksaanPraKerjaVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = hasilPemeriksaanPraKerjaService.addHasilPemeriksaanPraKerja(vo);
|
||||
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
}else{
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add HasilPemeriksaanPraKerja", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add HasilPemeriksaanPraKerja", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
@RequestMapping(value = "/find-by-pegawai-id/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findByPegawaiId(
|
||||
@RequestParam(value = "pegawaiId", required = false) Integer pegawaiId, HttpServletRequest request) {
|
||||
Map<String, Object> result = hasilPemeriksaanPraKerjaService.findByPegawaiId(pegawaiId);
|
||||
boolean dataFound = (boolean) result.get("dataFound");
|
||||
if (dataFound) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} else {
|
||||
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
|
||||
}
|
||||
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-by-pegawai-id/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> findByPegawaiId(@RequestParam(value = "pegawaiId", required = false) Integer pegawaiId,HttpServletRequest request) {
|
||||
Map<String,Object> result = hasilPemeriksaanPraKerjaService.findByPegawaiId(pegawaiId);
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
if(dataFound){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
}else{
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
}
|
||||
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<HasilPemeriksaanPraKerjaVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<HasilPemeriksaanPraKerjaVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(HasilPemeriksaanPraKerjaVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(HasilPemeriksaanPraKerjaVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<HasilPemeriksaanPraKerjaVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,222 +1,131 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.entities.HasilPemeriksaanSwaPantauLimbahCair;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.HasilPemeriksaanSwaPantauLimbahCairService;
|
||||
import com.jasamedika.medifirst2000.vo.HasilPemeriksaanSwaPantauLimbahCairVO;
|
||||
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.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
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.BakuMutuService;
|
||||
import com.jasamedika.medifirst2000.service.HasilPemeriksaanSwaPantauLimbahCairService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.BakuMutuVO;
|
||||
import com.jasamedika.medifirst2000.vo.HasilPemeriksaanSwaPantauLimbahCairVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
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.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("/hasil-pemeriksaan-swa-pantau-limbah-cair")
|
||||
public class HasilPemeriksaanSwaPantauLimbahCairController extends LocaleController<HasilPemeriksaanSwaPantauLimbahCairVO> {
|
||||
|
||||
public class HasilPemeriksaanSwaPantauLimbahCairController
|
||||
extends LocaleController<HasilPemeriksaanSwaPantauLimbahCairVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HasilPemeriksaanSwaPantauLimbahCairController.class);
|
||||
|
||||
@Autowired
|
||||
private HasilPemeriksaanSwaPantauLimbahCairService hasilPemeriksaanSwaPantauLimbahCairService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(BakuMutuController.class);
|
||||
|
||||
@RequestMapping(value = "/save-hasil-pemeriksaan-swa-pantau-limbah-cair/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody HasilPemeriksaanSwaPantauLimbahCairVO vo,HttpServletRequest request) {
|
||||
|
||||
try{
|
||||
Map<String, Object> result = hasilPemeriksaanSwaPantauLimbahCairService.addHasilPemeriksaanSwaPantauLimbahCair(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 hasilPemeriksaanSwaPantauLimbahCair", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add hasilPemeriksaanSwaPantauLimbahCair", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-all-hasil-pemeriksaan-swa-pantau-limbah-cair/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=hasilPemeriksaanSwaPantauLimbahCairService.findAllhasilPemeriksaanSwaPantauLimbahCair();
|
||||
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 hasilPemeriksaanSwaPantauLimbahCair", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get all hasilPemeriksaanSwaPantauLimbahCair", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete-hasil-pemeriksaan-swa-pantau-limbah-cair", method = RequestMethod.GET)
|
||||
public ResponseEntity<String> deleteNamaBahan(@RequestParam(value = "noRec", required = true) String noRec) {
|
||||
|
||||
private HasilPemeriksaanSwaPantauLimbahCairService<HasilPemeriksaanSwaPantauLimbahCair> hasilPemeriksaanSwaPantauLimbahCairService;
|
||||
|
||||
@RequestMapping(value = "/save-hasil-pemeriksaan-swa-pantau-limbah-cair/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody HasilPemeriksaanSwaPantauLimbahCairVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
if (hasilPemeriksaanSwaPantauLimbahCairService.deleteHasilPemeriksaanSwaPantauLimbahCair(noRec) == true)
|
||||
return RestUtil.getJsonResponse(noRec +" Dihapus", HttpStatus.CREATED);
|
||||
|
||||
Map<String, Object> result = hasilPemeriksaanSwaPantauLimbahCairService
|
||||
.addHasilPemeriksaanSwaPantauLimbahCair(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 delete hasilPemeriksaanSwaPantauLimbahCair", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when addHasilPemeriksaanSwaPantauLimbahCair", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when delete hasilPemeriksaanSwaPantauLimbahCair", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when addHasilPemeriksaanSwaPantauLimbahCair", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@RequestMapping(value = "/find-all-hasil-pemeriksaan-swa-pantau-limbah-cair/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllVO(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = hasilPemeriksaanSwaPantauLimbahCairService
|
||||
.findAllhasilPemeriksaanSwaPantauLimbahCair();
|
||||
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 findAllhasilPemeriksaanSwaPantauLimbahCair", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when findAllhasilPemeriksaanSwaPantauLimbahCair", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/delete-hasil-pemeriksaan-swa-pantau-limbah-cair", method = GET)
|
||||
public ResponseEntity<String> deleteNamaBahan(@RequestParam(value = "noRec") String noRec) {
|
||||
try {
|
||||
if (hasilPemeriksaanSwaPantauLimbahCairService.deleteHasilPemeriksaanSwaPantauLimbahCair(noRec))
|
||||
return getJsonResponse(noRec + " Dihapus", CREATED);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got ServiceVOException {} when deleteHasilPemeriksaanSwaPantauLimbahCair", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when deleteHasilPemeriksaanSwaPantauLimbahCair", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
return getJsonHttpStatus(NOT_ACCEPTABLE);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/list-hasil-pemeriksaan-limbah-cair")
|
||||
@ResponseBody
|
||||
public Map<String,Object> listHasilPemeriksaanLimbahCair(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@ResponseBody
|
||||
public Map<String, Object> listHasilPemeriksaanLimbahCair(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "100") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "noRec") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@RequestParam(value = "dateStart", required = false) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = false) String dateEnd) {
|
||||
return hasilPemeriksaanSwaPantauLimbahCairService.listHasilPemeriksaanSwaLimbahCair(page, limit, sort, dir,
|
||||
dateStart, dateEnd);
|
||||
}
|
||||
|
||||
Map<String, Object> resultPageMap = hasilPemeriksaanSwaPantauLimbahCairService.listHasilPemeriksaanSwaLimbahCair(page, limit, sort, dir, dateStart, dateEnd);
|
||||
return resultPageMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-inlet-meter-lalu/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Double>> getInletMeterLalu(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Double> result=hasilPemeriksaanSwaPantauLimbahCairService.getInletMeterAirLalu();
|
||||
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 inlet", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get all hasilPemeriksaanSwaPantauLimbahCair", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-outlet-meter-lalu/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Double>> getOutletMeterLalu(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Double> result=hasilPemeriksaanSwaPantauLimbahCairService.getOutletMeterAirLalu();
|
||||
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 outlet", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get all hasilPemeriksaanSwaPantauLimbahCair", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/hasil-pemeriksaan-limbah-cair-detail")
|
||||
public Map<String,Object> hasilPemeriksaanLimbahCairDetail(
|
||||
@RequestParam(value = "noRec", required = true) String noRec) {
|
||||
|
||||
Map<String, Object> resultPageMap = hasilPemeriksaanSwaPantauLimbahCairService.hasilPemeriksaanLimbahCairDetail(noRec);
|
||||
|
||||
return resultPageMap;
|
||||
public Map<String, Object> hasilPemeriksaanLimbahCairDetail(@RequestParam(value = "noRec") String noRec) {
|
||||
return hasilPemeriksaanSwaPantauLimbahCairService.hasilPemeriksaanLimbahCairDetail(noRec);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-hasil-pemeriksaan-pantau-limbah-cair")
|
||||
public Map<String,Object> getHasilPemeriksaanPantauLimbahCair(
|
||||
@RequestParam(value = "startDate", required = true) String startDate, @RequestParam(value="endDate", required=true)String endDate) {
|
||||
|
||||
Map<String, Object> resultPageMap = this.hasilPemeriksaanSwaPantauLimbahCairService.getHasilPemeriksaanPantauLImbahCair(startDate, endDate);
|
||||
|
||||
return resultPageMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/lapHasilPemeriksaanSWAPantauLimbahCair")
|
||||
public ModelAndView generateLapHasilPemeriksaanSWAPantauLimbahCair(ModelAndView m,
|
||||
@RequestParam(value = "format", required = false) String format,
|
||||
@RequestParam(value = "startDate", required = false) String startDate,
|
||||
@RequestParam(value = "endDate", required = false) String endDate) {
|
||||
|
||||
Map<String, Object> result = this.hasilPemeriksaanSwaPantauLimbahCairService.getHasilPemeriksaanPantauLImbahCair(startDate, endDate);
|
||||
|
||||
Map<String, Object> result = this.hasilPemeriksaanSwaPantauLimbahCairService
|
||||
.getHasilPemeriksaanPantauLImbahCair(startDate, endDate);
|
||||
Map<String, Object> header = (Map<String, Object>) result.get("header");
|
||||
String periode = header.get("tanggalAwal") == null ? "" : (String) header.get("tanggalAwal");
|
||||
periode = periode + (header.get("tanggalAkhir") == null ? "" : " sd " + (String) header.get("tanggalAkhir"));
|
||||
periode = periode + (header.get("tanggalAkhir") == null ? "" : " sd " + header.get("tanggalAkhir"));
|
||||
m.addObject("dataSource", result.get("listData"));
|
||||
m.addObject("periode", periode);
|
||||
m.addObject("format", "pdf");
|
||||
if (format != null && !format.isEmpty()) {
|
||||
if (format != null && !format.isEmpty())
|
||||
m.addObject("format", format);
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
|
||||
@ -1,226 +1,165 @@
|
||||
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.HistoriPelayananCsService;
|
||||
import com.jasamedika.medifirst2000.vo.HistoriPelayananCsVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.jasamedika.medifirst2000.base.vo.BaseModelVO;
|
||||
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.HistoriPelayananCs;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.HistoriPelayananCsService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AkunVO;
|
||||
import com.jasamedika.medifirst2000.vo.HistoriPelayananCsVO;
|
||||
import com.jasamedika.medifirst2000.vo.JadwalDokter_VO;
|
||||
import com.jasamedika.medifirst2000.vo.PlanningPegawaiStatusVO;
|
||||
import com.mysema.query.types.Constant;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/historiPelayananCs")
|
||||
public class HistoriPelayananCsController extends LocaleController<HistoriPelayananCsVO> {
|
||||
public class HistoriPelayananCsController extends LocaleController<HistoriPelayananCsVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HistoriPelayananCsController.class);
|
||||
|
||||
|
||||
@Autowired
|
||||
private HistoriPelayananCsService historiPelayananCsService;
|
||||
|
||||
@RequestMapping(value = "/save-histori-pelayanancs",
|
||||
method = RequestMethod.POST,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> saveHistoriPelayananCs(
|
||||
@Valid @RequestBody HistoriPelayananCsVO hpcsvo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result = this.historiPelayananCsService.saveHistriPelayananCs(hpcsvo);
|
||||
if (result != null)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
@RequestMapping(value = "/save-histori-pelayanancs", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveHistoriPelayananCs(@Valid @RequestBody HistoriPelayananCsVO hpcsvo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.historiPelayananCsService.saveHistriPelayananCs(hpcsvo);
|
||||
if (result != null)
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
|
||||
LOGGER.error("Got exception {} when saveHistoriPelayananCs", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when saveHistriPelayananCs", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
|
||||
LOGGER.error("Got exception {} when saveHistoriPelayananCs", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveHistriPelayananCs", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "/get-list-histori-pelayanan",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-list-histori-pelayanan", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getListHistoriPelayanan(
|
||||
@RequestParam(value = "ruanganId", required = true) Integer ruanganId, HttpServletRequest request){
|
||||
|
||||
@RequestParam(value = "ruanganId") Integer ruanganId, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = this.historiPelayananCsService.getListHistoriPelayananCs(ruanganId);
|
||||
|
||||
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.historiPelayananCsService.getListHistoriPelayananCs(ruanganId);
|
||||
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 getListHistoriPelayanan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when getListHistoriPelayananCs", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getListHistoriPelayanan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got JpaSystemException {} when getListHistoriPelayananCs", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "/get-load-histori-pelayanan",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getLoadData(
|
||||
@RequestParam(value = "ruanganId", required = true) Integer ruanganId, HttpServletRequest request){
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-load-histori-pelayanan", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getLoadData(@RequestParam(value = "ruanganId") Integer ruanganId,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = this.historiPelayananCsService.getLoadData(ruanganId);
|
||||
|
||||
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.historiPelayananCsService.getLoadData(ruanganId);
|
||||
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 getLoadData", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when getLoadData", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getLoadData", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got JpaSystemException {} when getLoadData", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "/get-load-pasien-bynocm",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getDataPasienByNoCm(
|
||||
@RequestParam(value = "noCm", required = true) String noCm, HttpServletRequest request){
|
||||
|
||||
try {
|
||||
Map<String,Object> result = this.historiPelayananCsService.getListPasienByNoCm(noCm);
|
||||
|
||||
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 getLoadData", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getLoadData", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-load-pasien-bynocm", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getDataPasienByNoCm(@RequestParam(value = "noCm") String noCm,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.historiPelayananCsService.getListPasienByNoCm(noCm);
|
||||
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 getListPasienByNoCm", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when getListPasienByNoCm", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "/get-load-produk-informasi",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getDataProdukInformasi(
|
||||
HttpServletRequest request){
|
||||
|
||||
try {
|
||||
Map<String,Object> result = this.historiPelayananCsService.getListProdukInformasi();
|
||||
|
||||
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 getLoadData", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getLoadData", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-load-produk-informasi", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getDataProdukInformasi(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.historiPelayananCsService.getListProdukInformasi();
|
||||
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 getListProdukInformasi", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when getListProdukInformasi", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "/get-histori-pelayanan-norec/{norec}",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getDataHistoriCsByNoRec(
|
||||
@PathVariable(value = "norec") String norec, HttpServletRequest request){
|
||||
|
||||
try {
|
||||
Map<String,Object> result = this.historiPelayananCsService.getListHistoriCsByNorec(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 getLoadData", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getLoadData", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-histori-pelayanan-norec/{norec}", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getDataHistoriCsByNoRec(@PathVariable(value = "norec") String norec,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.historiPelayananCsService.getListHistoriCsByNorec(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 getListHistoriCsByNorec", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when getListHistoriCsByNorec", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,68 +1,47 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.jasamedika.medifirst2000.entities.HistoryLoginModulAplikasi;
|
||||
import com.jasamedika.medifirst2000.entities.HistoryLoginUser;
|
||||
import com.jasamedika.medifirst2000.service.HistoryLoginModulAplikasiService;
|
||||
import com.jasamedika.medifirst2000.service.HistoryLoginUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.service.HistoryLoginModulAplikasiService;
|
||||
import com.jasamedika.medifirst2000.service.HistoryLoginUserService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
|
||||
/*
|
||||
*
|
||||
* @author Syamsu
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping({"/test-tanpa-auth/logging", "/logging"})
|
||||
@RequestMapping("/logging")
|
||||
public class HistoryLoggingController {
|
||||
|
||||
@Autowired
|
||||
HistoryLoginUserService historyLoginUserService;
|
||||
|
||||
HistoryLoginUserService<HistoryLoginUser> historyLoginUserService;
|
||||
|
||||
@Autowired
|
||||
HistoryLoginModulAplikasiService historyLoginModulAplikasiService;
|
||||
|
||||
@RequestMapping(value = "/get-all-history-login-on-modul", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllHistoryModulAplikasi(
|
||||
@RequestParam("kdUser") String kdUser){
|
||||
HistoryLoginModulAplikasiService<HistoryLoginModulAplikasi> historyLoginModulAplikasiService;
|
||||
|
||||
@RequestMapping(value = "/get-all-history-login-on-modul", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllHistoryModulAplikasi(@RequestParam("kdUser") String kdUser) {
|
||||
Map<String, Object> hasil = historyLoginModulAplikasiService.findByHistoryLoginModulAplikasi(kdUser);
|
||||
return RestUtil.getJsonResponse(hasil, HttpStatus.OK);
|
||||
return getJsonResponse(hasil, OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-page-history-login-on-modul", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getPageHistoryModulAplikasi(
|
||||
@RequestParam("kdUser") String kdUser,
|
||||
@RequestParam("page") Integer page,
|
||||
@RequestParam("limit") Integer limit,
|
||||
@RequestParam("sort") String sort,
|
||||
@RequestParam("dir") String dir){
|
||||
Map<String, Object> hasil = historyLoginModulAplikasiService.findByHistoryLoginModulAplikasi(kdUser, page, limit, sort, dir);
|
||||
return RestUtil.getJsonResponse(hasil, HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-all-history-login-activity", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-all-history-login-activity", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAllHistoryLogin(
|
||||
@RequestParam("kdHistoryLogin") Integer kdHistoryLogin){
|
||||
@RequestParam("kdHistoryLogin") Integer kdHistoryLogin) {
|
||||
Map<String, Object> hasil = historyLoginUserService.findByHistoryLoginId(kdHistoryLogin);
|
||||
return RestUtil.getJsonResponse(hasil, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-page-history-login-activity", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getPageHistoryLogin(
|
||||
@RequestParam("kdHistoryLogin") Integer kdHistoryLogin,
|
||||
@RequestParam("page") Integer page,
|
||||
@RequestParam("limit") Integer limit,
|
||||
@RequestParam("sort") String sort,
|
||||
@RequestParam("dir") String dir){
|
||||
Map<String, Object> hasil = historyLoginUserService.findByHistoryLoginId(kdHistoryLogin, page, limit, sort, dir);
|
||||
return RestUtil.getJsonResponse(hasil, HttpStatus.OK);
|
||||
return getJsonResponse(hasil, OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,269 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
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.itextpdf.text.BadElementException;
|
||||
import com.itextpdf.text.Document;
|
||||
import com.itextpdf.text.DocumentException;
|
||||
import com.itextpdf.text.Image;
|
||||
import com.itextpdf.text.PageSize;
|
||||
import com.itextpdf.text.pdf.PdfWriter;
|
||||
import com.itextpdf.text.pdf.codec.Base64;
|
||||
import com.itextpdf.tool.xml.XMLWorker;
|
||||
import com.itextpdf.tool.xml.XMLWorkerHelper;
|
||||
import com.itextpdf.tool.xml.html.Tags;
|
||||
import com.itextpdf.tool.xml.parser.XMLParser;
|
||||
import com.itextpdf.tool.xml.pipeline.css.CSSResolver;
|
||||
import com.itextpdf.tool.xml.pipeline.css.CssResolverPipeline;
|
||||
import com.itextpdf.tool.xml.pipeline.end.PdfWriterPipeline;
|
||||
import com.itextpdf.tool.xml.pipeline.html.AbstractImageProvider;
|
||||
import com.itextpdf.tool.xml.pipeline.html.HtmlPipeline;
|
||||
import com.itextpdf.tool.xml.pipeline.html.HtmlPipelineContext;
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.PemakaianAsuransiVO;
|
||||
|
||||
class Base64ImageProvider extends AbstractImageProvider {
|
||||
|
||||
@Override
|
||||
public Image retrieve(String src) {
|
||||
int pos = src.indexOf("base64,");
|
||||
try {
|
||||
if (src.startsWith("data") && pos > 0) {
|
||||
byte[] img = Base64.decode(src.substring(pos + 7));
|
||||
return Image.getInstance(img);
|
||||
}
|
||||
else {
|
||||
|
||||
return Image.getInstance(src);
|
||||
}
|
||||
} catch (BadElementException ex) {
|
||||
return null;
|
||||
} catch (IOException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getImageRootPath() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/html-to-pdf")
|
||||
public class HtmlToPdfController extends LocaleController {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HtmlToPdfController.class);
|
||||
|
||||
@RequestMapping(value = "/get-pdf", method = RequestMethod.GET)
|
||||
public ResponseEntity<String> getAllVOWithQueryString(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam(value = "url") String url, @RequestParam(value = "fileName") String fileName) {
|
||||
|
||||
try {
|
||||
createPDF(fileName, url, request, response);
|
||||
return RestUtil.getJsonResponse("", HttpStatus.CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Agama", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Agama", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/post-pdf", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> postPdf(HttpServletRequest request, HttpServletResponse response,
|
||||
@RequestParam(value = "url") String url, @RequestParam(value = "fileName") String fileName) {
|
||||
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream()));
|
||||
|
||||
String read = null;
|
||||
String resultData = "";
|
||||
while ((read = reader.readLine()) != null) {
|
||||
resultData += read;
|
||||
System.out.println(read);
|
||||
}
|
||||
InputStream is = new ByteArrayInputStream(resultData.getBytes());
|
||||
createPDF(fileName, url, resultData, request, response);
|
||||
return RestUtil.getJsonResponse("", HttpStatus.CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add Agama", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Agama", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
private void createPDF(String pdfFilename, String url, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
// path for the PDF file to be generated
|
||||
String dataDirectory = request.getServletContext().getRealPath("/WEB-INF/downloads/pdf/" + pdfFilename);
|
||||
PdfWriter pdfWriter = null;
|
||||
|
||||
// create a new document
|
||||
Document document = new Document();
|
||||
|
||||
try {
|
||||
|
||||
// get Instance of the PDFWriter
|
||||
pdfWriter = PdfWriter.getInstance(document, new FileOutputStream(dataDirectory));
|
||||
|
||||
// document header attributes
|
||||
document.addAuthor("betterThanZero");
|
||||
document.addCreationDate();
|
||||
document.addProducer();
|
||||
document.addCreator("MySampleCode.com");
|
||||
document.addTitle("Demo for iText XMLWorker");
|
||||
document.setPageSize(PageSize.LETTER);
|
||||
|
||||
// open document
|
||||
document.open();
|
||||
|
||||
// To convert a HTML file from the filesystem
|
||||
// String File_To_Convert = "docs/SamplePDF.html";
|
||||
// FileInputStream fis = new FileInputStream(File_To_Convert);
|
||||
|
||||
// URL for HTML page
|
||||
URL myWebPage = new URL(url);
|
||||
InputStreamReader fis = new InputStreamReader(myWebPage.openStream());
|
||||
|
||||
// get the XMLWorkerHelper Instance
|
||||
XMLWorkerHelper worker = XMLWorkerHelper.getInstance();
|
||||
|
||||
// convert to PDF
|
||||
worker.parseXHtml(pdfWriter, document, fis);
|
||||
|
||||
// close the document
|
||||
document.close();
|
||||
// close the writer
|
||||
pdfWriter.close();
|
||||
|
||||
}
|
||||
|
||||
catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (DocumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String dataDirectoryDownload = request.getServletContext().getRealPath("/WEB-INF/downloads/pdf/");
|
||||
Path file = Paths.get(dataDirectoryDownload, pdfFilename);
|
||||
if (Files.exists(file)) {
|
||||
response.setContentType("application/pdf");
|
||||
response.addHeader("Content-Disposition", "attachment; filename=" + pdfFilename);
|
||||
try {
|
||||
Files.copy(file, response.getOutputStream());
|
||||
response.getOutputStream().flush();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void createPDF(String pdfFilename, String url, String inputStream, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
|
||||
// path for the PDF file to be generated
|
||||
String dataDirectory = request.getServletContext().getRealPath("/WEB-INF/downloads/pdf/" + pdfFilename);
|
||||
PdfWriter pdfWriter = null;
|
||||
|
||||
// create a new document
|
||||
Document document = new Document();
|
||||
|
||||
try {
|
||||
|
||||
|
||||
// step 2
|
||||
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(dataDirectory));
|
||||
// step 3
|
||||
document.open();
|
||||
// step 4
|
||||
|
||||
// CSS
|
||||
CSSResolver cssResolver =
|
||||
XMLWorkerHelper.getInstance().getDefaultCssResolver(true);
|
||||
|
||||
// HTML
|
||||
HtmlPipelineContext htmlContext = new HtmlPipelineContext(null);
|
||||
htmlContext.setTagFactory(Tags.getHtmlTagProcessorFactory());
|
||||
htmlContext.setImageProvider(new Base64ImageProvider());
|
||||
|
||||
// Pipelines
|
||||
PdfWriterPipeline pdf = new PdfWriterPipeline(document, writer);
|
||||
HtmlPipeline html = new HtmlPipeline(htmlContext, pdf);
|
||||
CssResolverPipeline css = new CssResolverPipeline(cssResolver, html);
|
||||
|
||||
// XML Worker
|
||||
XMLWorker worker = new XMLWorker(css, true);
|
||||
XMLParser p = new XMLParser(worker);
|
||||
p.parse(new ByteArrayInputStream(inputStream.getBytes()));
|
||||
|
||||
// step 5
|
||||
document.close();
|
||||
|
||||
}
|
||||
|
||||
catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (DocumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String dataDirectoryDownload = request.getServletContext().getRealPath("/WEB-INF/downloads/pdf/");
|
||||
Path file = Paths.get(dataDirectoryDownload, pdfFilename);
|
||||
if (Files.exists(file)) {
|
||||
response.setContentType("application/pdf");
|
||||
response.addHeader("Content-Disposition", "attachment; filename=" + pdfFilename);
|
||||
try {
|
||||
Files.copy(file, response.getOutputStream());
|
||||
response.getOutputStream().flush();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,197 +1,157 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.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.IkiDanRemunerasiService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.IkiDanRemunerasiVO;
|
||||
import com.jasamedika.medifirst2000.vo.SettingPirSdmVO;
|
||||
import com.jasamedika.medifirst2000.vo.StrukHistoriVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/iki-remunerasi")
|
||||
public class IkiDanRemunerasiController extends LocaleController<IkiDanRemunerasiVO>{
|
||||
public class IkiDanRemunerasiController extends LocaleController<IkiDanRemunerasiVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(IkiDanRemunerasiController.class);
|
||||
|
||||
@Autowired
|
||||
private IkiDanRemunerasiService service;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(IkiDanRemunerasiController.class);
|
||||
|
||||
@RequestMapping(value = "/get-load-data", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getLoadData(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.loadData();
|
||||
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 getLoadData", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getLoadData", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-kalkulasi-remunerasi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getKalkulasiDataRemunerasi(
|
||||
@RequestParam(value = "id", required = true) Integer id,
|
||||
@RequestParam(value = "date", required = true) String date, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.getKalkulasiDataRemunerasi(id, date);
|
||||
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 getKalkulasiDataRemunerasi", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getKalkulasiDataRemunerasi", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-iki-remunerasi", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> saveIkiRemunerasi(@Valid @RequestBody StrukHistoriVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.saveIkiRemunerasi(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
private IkiDanRemunerasiService service;
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when saveIkiRemunerasi", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveIkiRemunerasi", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-kalkulasi-remunerasi-pegawai", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getKalkulasiDataRemunerasiPegawai(
|
||||
@RequestParam(value = "date", required = true) String date, HttpServletRequest request) {
|
||||
@RequestMapping(value = "/get-kalkulasi-remunerasi", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getKalkulasiDataRemunerasi(@RequestParam(value = "id") Integer id,
|
||||
@RequestParam(value = "date") String date, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.getKalkulasiDataRemunerasiPegawai(date);
|
||||
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.getKalkulasiDataRemunerasi(id, date);
|
||||
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 getKalkulasiDataRemunerasi", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getKalkulasiDataRemunerasi", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getKalkulasiDataRemunerasi", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getKalkulasiDataRemunerasi", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-pir/{tahun}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/save-iki-remunerasi", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveIkiRemunerasi(@Valid @RequestBody StrukHistoriVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.saveIkiRemunerasi(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 saveIkiRemunerasi", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when saveIkiRemunerasi", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-kalkulasi-remunerasi-pegawai", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getKalkulasiDataRemunerasiPegawai(
|
||||
@RequestParam(value = "date") String date, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.getKalkulasiDataRemunerasiPegawai(date);
|
||||
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 getKalkulasiDataRemunerasiPegawai", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when getKalkulasiDataRemunerasiPegawai", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-pir/{tahun}", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findPir(@PathVariable("tahun") String tahun,
|
||||
HttpServletRequest request) {
|
||||
Map<String, Object> result = null;
|
||||
try {
|
||||
|
||||
result = service.findPir(tahun);
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
Map<String, Object> result = service.findPir(tahun);
|
||||
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);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-iku/{periode}/{idUnitKerja}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findPir(@PathVariable("periode") String periode,@PathVariable("idUnitKerja") Integer idUnitKerja,
|
||||
HttpServletRequest request) {
|
||||
Map<String, Object> result = null;
|
||||
try {
|
||||
|
||||
result = service.findIKU(periode,idUnitKerja);
|
||||
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-all-iku/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> findPir(
|
||||
HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = null;
|
||||
|
||||
@RequestMapping(value = "/get-iku/{periode}/{idUnitKerja}", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findPir(@PathVariable("periode") String periode,
|
||||
@PathVariable("idUnitKerja") Integer idUnitKerja, HttpServletRequest request) {
|
||||
try {
|
||||
|
||||
result = service.findAllIKU();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
Map<String, Object> result = service.findIKU(periode, idUnitKerja);
|
||||
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);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-pir-dan-iku", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-all-iku/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> findPir(HttpServletRequest request) {
|
||||
try {
|
||||
List<Map<String, Object>> result = service.findAllIKU();
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-pir-dan-iku", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> savePirDanIku(@Valid @RequestBody List<SettingPirSdmVO> vo,
|
||||
HttpServletRequest request) throws ParseException {
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = service.savePirDanIku(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 Pegawai Jadwal kerja", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when savePirDanIku", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Pegawai Jadwal kerja", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when savePirDanIku", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user