diff --git a/jasamedika-bridging/src/main/java/com/jasamedika/medifirst2000/controller/BridgingBiosController.java b/jasamedika-bridging/src/main/java/com/jasamedika/medifirst2000/controller/BridgingBiosController.java index 9e91f26d..e3d3e659 100644 --- a/jasamedika-bridging/src/main/java/com/jasamedika/medifirst2000/controller/BridgingBiosController.java +++ b/jasamedika-bridging/src/main/java/com/jasamedika/medifirst2000/controller/BridgingBiosController.java @@ -6,73 +6,50 @@ import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.OutputStream; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.List; import java.util.Map; -import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.validation.Valid; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.orm.jpa.JpaSystemException; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import com.jasamedika.medifirst2000.constants.Constants; -import com.jasamedika.medifirst2000.constants.MessageResource; import com.jasamedika.medifirst2000.controller.base.LocaleController; -import com.jasamedika.medifirst2000.core.web.WebConstants; import com.jasamedika.medifirst2000.dao.BridgingDao; import com.jasamedika.medifirst2000.entities.Profile; -import com.jasamedika.medifirst2000.exception.ServiceVOException; -import com.jasamedika.medifirst2000.service.IndikatorBIOSService; -import com.jasamedika.medifirst2000.util.rest.RestUtil; -import com.jasamedika.medifirst2000.vo.IndikatorBIOSCustomVO; import com.jasamedika.medifirst2000.vo.IndikatorBIOSVO; @RestController @RequestMapping("/bios") -public class BridgingBiosController extends LocaleController{ - - private static final Logger LOGGER = LoggerFactory.getLogger(BridgingBiosController.class); - +public class BridgingBiosController extends LocaleController { + @Autowired private BridgingDao bridgingDao; - - @Autowired - private IndikatorBIOSService indikatorBIOSService; - @RequestMapping(value = "/profile", method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE }) - public Map biosProfile(@RequestParam(value = "param", required = false) String param1, - HttpServletResponse response) throws IOException { + @RequestMapping(value = "/profile", method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE }) + public Map biosProfile(@RequestParam(value = "param", required = false) String param1, + HttpServletResponse response) throws IOException { List x = bridgingDao.biosProfile(); - String text =""; - if (x.size()>0){ - for(int i=0;i 0) { + for (int i = 0; i < x.size(); i++) { + text = (x.get(i).getAlamatLengkap()) + "|"; + text = text + (x.get(i).getKdPos()) + "|"; + text = text + (x.get(i).getFixedPhone()) + "|"; + text = text + (x.get(i).getFaksimile()) + "|"; + text = text + (x.get(i).getAlamatEmail()) + "|"; + text = text + (x.get(i).getWebsite()); + } } - //harus diubah menjadi downloadable - + // harus diubah menjadi downloadable + String fileName = null; - + String osname = System.getProperty("os.name", "").toLowerCase(); if (osname.startsWith("windows")) { fileName = "d:/profile.txt"; @@ -108,210 +85,9 @@ public class BridgingBiosController extends LocaleController{ } @RequestMapping(value = "/sk", method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE }) - public List biosSK(){ - //List x = bridgingDao.biosSK(); + public List biosSK() { + // List x = bridgingDao.biosSK(); return null; } - - @RequestMapping(value = "/save-indikator-bios", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity> saveIndikatorBIOS(@Valid @RequestBody IndikatorBIOSCustomVO vo, - HttpServletRequest request) throws ParseException { - try { - SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy"); - Map result = indikatorBIOSService.saveIndikatorBIOS(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 Indikator", e.getMessage()); - addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); - return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); - } catch (JpaSystemException jse) { - LOGGER.error("Got exception {} when add Indikator", jse.getMessage()); - addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); - return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); - } - - } - - @RequestMapping(value = "/save-indikator-bios-pengeluaran", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity> saveIndikatorBIOS(@Valid @RequestBody List vo, - HttpServletRequest request) throws ParseException { - try { - SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy"); - - Map result = indikatorBIOSService.saveIndikatorBIOSPengeluaran(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 Indikator", e.getMessage()); - addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); - return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); - } catch (JpaSystemException jse) { - LOGGER.error("Got exception {} when add Indikator", jse.getMessage()); - addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); - return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); - } - - } - - @RequestMapping(value = "/get-layanan-lainnya", method = RequestMethod.GET) - public ResponseEntity>> getBIOSLayananLainnyaOLD( @RequestParam(value = "tanggal_update", required = false) String tanggal_update, - HttpServletRequest request) { - try { - List> result = new ArrayList>(); - result = indikatorBIOSService.layananLainBIOS(tanggal_update); - mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, - getMessage(MessageResource.LABEL_SUCCESS, request)); - return RestUtil.getNewJsonResponse(result, HttpStatus.OK, mapHeaderMessage,"layanan_lainnya"); - } catch (ServiceVOException e) { - LOGGER.error("Got exception {} when getAllPegawaiAktifVerfiedByUnitKerja", 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 getAllPegawaiAktifVerfiedByUnitKerja", jse.getMessage()); - addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); - return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); - } - } - - @RequestMapping(value = "/get-layanan-kesehatan", method = RequestMethod.GET) - public ResponseEntity>> getBIOSLayananKesehatanOLD( @RequestParam(value = "tanggal_update", required = false) String tanggal_update, - HttpServletRequest request) { - try { - List> result = new ArrayList>(); - result = indikatorBIOSService.layananKesehatanBIOS(tanggal_update); - mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, - getMessage(MessageResource.LABEL_SUCCESS, request)); - return RestUtil.getNewJsonResponse(result, HttpStatus.OK, mapHeaderMessage,"layanan_kesehatan"); - } catch (ServiceVOException e) { - LOGGER.error("Got exception {} when getAllPegawaiAktifVerfiedByUnitKerja", 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 getAllPegawaiAktifVerfiedByUnitKerja", jse.getMessage()); - addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); - return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); - } - } - - @RequestMapping(value = "/penerimaan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity>> getPenerimaan(@RequestParam(value = "TanggalUpdate", required = false) String tanggal, - HttpServletRequest request) throws ParseException { - try { - - - //List> result = indikatorBIOSService.penerimaanBLU(tanggal); - List> result = indikatorBIOSService.penerimaanPengeluaranBLUNew(tanggal, "Penerimaan"); - - mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, - getMessage(MessageResource.LABEL_SUCCESS, request)); - return RestUtil.getNewJsonResponse(result, HttpStatus.OK, mapHeaderMessage,"Penerimaan"); - - } catch (ServiceVOException e) { - LOGGER.error("Got exception {} when add Indikator", e.getMessage()); - addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); - return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); - } catch (JpaSystemException jse) { - LOGGER.error("Got exception {} when add Indikator", jse.getMessage()); - addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); - return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); - } - - } - - @RequestMapping(value = "/pengeluaran", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity>> getPengeluaran(@RequestParam(value = "TanggalUpdate", required = false) String tanggal, - HttpServletRequest request) throws ParseException { - try { - - - //List> result = indikatorBIOSService.pengeluaranBLU(tanggal); - List> result = indikatorBIOSService.penerimaanPengeluaranBLUNew(tanggal, "Pengeluaran"); - mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, - getMessage(MessageResource.LABEL_SUCCESS, request)); - return RestUtil.getNewJsonResponse(result, HttpStatus.OK, mapHeaderMessage,"Pengeluaran"); - - } catch (ServiceVOException e) { - LOGGER.error("Got exception {} when add Indikator", e.getMessage()); - addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); - return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); - } catch (JpaSystemException jse) { - LOGGER.error("Got exception {} when add Indikator", jse.getMessage()); - addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); - return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); - } - - } - - @RequestMapping(value = "/saldo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity>> getSaldo(@RequestParam(value = "TanggalUpdate", required = false) String tanggal, - HttpServletRequest request) throws ParseException { - try { - - - //List> result = indikatorBIOSService.saldoBLU(tanggal); - List> result = indikatorBIOSService.saldoBLUNew(tanggal); - mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, - getMessage(MessageResource.LABEL_SUCCESS, request)); - return RestUtil.getNewJsonResponse(result, HttpStatus.OK, mapHeaderMessage,"SaldoBLU"); - - } catch (ServiceVOException e) { - LOGGER.error("Got exception {} when add Indikator", e.getMessage()); - addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); - return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); - } catch (JpaSystemException jse) { - LOGGER.error("Got exception {} when add Indikator", jse.getMessage()); - addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); - return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); - } - - } - - @RequestMapping(value = "/get-layanan-lainnya-old", method = RequestMethod.GET) - public ResponseEntity>> getBIOSLayananLainnya( @RequestParam(value = "tanggal_update", required = false) String tanggal_update, - HttpServletRequest request) { - try { - List> result = new ArrayList>(); - result = indikatorBIOSService.layananLainBIOSNew(tanggal_update); - mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, - getMessage(MessageResource.LABEL_SUCCESS, request)); - return RestUtil.getNewJsonResponse(result, HttpStatus.OK, mapHeaderMessage,"layanan_lainnya"); - } catch (ServiceVOException e) { - LOGGER.error("Got exception {} when getAllPegawaiAktifVerfiedByUnitKerja", 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 getAllPegawaiAktifVerfiedByUnitKerja", jse.getMessage()); - addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); - return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); - } - } - - @RequestMapping(value = "/get-layanan-kesehatan-old", method = RequestMethod.GET) - public ResponseEntity>> getBIOSLayananKesehatan( @RequestParam(value = "tanggal_update", required = false) String tanggal_update, - HttpServletRequest request) { - try { - List> result = new ArrayList>(); - result = indikatorBIOSService.layananKesehatanBIOSNew(tanggal_update); - mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, - getMessage(MessageResource.LABEL_SUCCESS, request)); - return RestUtil.getNewJsonResponse(result, HttpStatus.OK, mapHeaderMessage,"layanan_kesehatan"); - } catch (ServiceVOException e) { - LOGGER.error("Got exception {} when getAllPegawaiAktifVerfiedByUnitKerja", 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 getAllPegawaiAktifVerfiedByUnitKerja", jse.getMessage()); - addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); - return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); - } - } - }