Update controller

Clean code
This commit is contained in:
Salman Manoe 2024-12-18 09:08:39 +07:00
parent 0da96226b1
commit aee2b1ff60
37 changed files with 1505 additions and 2917 deletions

View File

@ -1,70 +1,65 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdDecontaminasiService;
import com.jasamedika.medifirst2000.vo.CssdDecontaminasiVO;
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.CssdDecontaminasiService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.CssdDecontaminasiVO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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("/cssd-decontaminasi")
public class CssdDecontaminasiController extends LocaleController {
@Autowired
private CssdDecontaminasiService cssdDecontaminasiService;
public class CssdDecontaminasiController extends LocaleController<CssdDecontaminasiVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(CssdDecontaminasiController.class);
@RequestMapping(value = "/save-decontaminasi/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveDecontaminasi(@Valid @RequestBody CssdDecontaminasiVO vo,HttpServletRequest request,HttpServletResponse response) {
@Autowired
private CssdDecontaminasiService cssdDecontaminasiService;
@RequestMapping(value = "/save-decontaminasi/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveDecontaminasi(@Valid @RequestBody CssdDecontaminasiVO vo,
HttpServletRequest request, HttpServletResponse response) {
try {
Map<String, Object> result = cssdDecontaminasiService.saveDecontaminasi(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Decontaminasi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveDecontaminasi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save save Decontaminasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveDecontaminasi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
// Menampilkan Kartu Pengendali Berdasarkan Norec (array)
@RequestMapping(value = "/detail-decontaminasi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> detailDecontaminasi(@RequestParam(value = "strukPelayananId", required = true) String strukPelayananId) {
Map<String, Object> result = cssdDecontaminasiService.detailDecontaminasi(strukPelayananId);
return result;
}
@RequestMapping(value = "/detail-decontaminasi", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> detailDecontaminasi(@RequestParam(value = "strukPelayananId") String strukPelayananId) {
return cssdDecontaminasiService.detailDecontaminasi(strukPelayananId);
}
}

View File

@ -1,80 +1,70 @@
package com.jasamedika.medifirst2000.controller;
import java.util.HashMap;
import java.util.Map;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdDistribusiService;
import com.jasamedika.medifirst2000.vo.CssdDistribusiVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdDistribusiService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.CssdDistribusiVO;
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("/cssd-distribusi")
public class CssdDistribusiController extends LocaleController {
@Autowired
private CssdDistribusiService cssdDistribusiService;
public class CssdDistribusiController extends LocaleController<CssdDistribusiVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(CssdDistribusiController.class);
@RequestMapping(value = "/save-distribusi/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveDistribusi(@Valid @RequestBody CssdDistribusiVO vo,HttpServletRequest request,HttpServletResponse response) {
@Autowired
private CssdDistribusiService cssdDistribusiService;
@RequestMapping(value = "/save-distribusi/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveDistribusi(@Valid @RequestBody CssdDistribusiVO vo,
HttpServletRequest request, HttpServletResponse response) {
try {
Map<String, Object> result = cssdDistribusiService.saveDistribusi(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Distribusi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveDistribusi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save save Distribusi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveDistribusi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
// Menampilkan Kartu Pengendali Berdasarkan Norec (array)
@RequestMapping(value = "/detail-distribusi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> detailDistribusi(@RequestParam(value = "strukPelayananId", required = true) String strukPelayananId) {
Map<String, Object> result = cssdDistribusiService.detailDistribusi(strukPelayananId);
return result;
}
@RequestMapping(value = "/get-no-kirim", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String,Object> getNoOrder() {
@RequestMapping(value = "/detail-distribusi", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> detailDistribusi(@RequestParam(value = "strukPelayananId") String strukPelayananId) {
return cssdDistribusiService.detailDistribusi(strukPelayananId);
}
Map<String, Object> result = new HashMap<String,Object>();
result.put("noKirim", cssdDistribusiService.preFormatNoUrut("Penerimaan Supplier", "PNB"));
return result;
}
@RequestMapping(value = "/get-no-kirim", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getNoOrder() {
Map<String, Object> result = new HashMap<>();
result.put("noKirim", cssdDistribusiService.preFormatNoUrut("Penerimaan Supplier", "PNB"));
return result;
}
}

View File

@ -1,70 +1,62 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdMonitoringEoService;
import com.jasamedika.medifirst2000.vo.CssdMonitoringEoVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdMonitoringEoService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.CssdMonitoringEoVO;
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("/cssd-monitoring-eo")
public class CssdMonitoringEoController extends LocaleController {
@Autowired
private CssdMonitoringEoService cssdMonitoringEoService;
public class CssdMonitoringEoController extends LocaleController<CssdMonitoringEoVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(CssdMonitoringEoController.class);
@RequestMapping(value = "/save-monitoring-eo/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveMoioringEo(@Valid @RequestBody CssdMonitoringEoVO vo,HttpServletRequest request,HttpServletResponse response) {
@Autowired
private CssdMonitoringEoService cssdMonitoringEoService;
@RequestMapping(value = "/save-monitoring-eo/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveMoioringEo(@Valid @RequestBody CssdMonitoringEoVO vo,
HttpServletRequest request, HttpServletResponse response) {
try {
Map<String, Object> result = cssdMonitoringEoService.saveMonitoringEo(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save MonitoringEo", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveMonitoringEo", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save save MonitoringEo", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveMonitoringEo", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
// Menampilkan Kartu Pengendali Berdasarkan Norec (array)
@RequestMapping(value = "/detail-monitoring-eo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> detailMonitoringEo(@RequestParam(value = "strukPelayananId", required = true) String strukPelayananId) {
Map<String, Object> result = cssdMonitoringEoService.detailMonitoringEo(strukPelayananId);
return result;
}
@RequestMapping(value = "/detail-monitoring-eo", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> detailMonitoringEo(@RequestParam(value = "strukPelayananId") String strukPelayananId) {
return cssdMonitoringEoService.detailMonitoringEo(strukPelayananId);
}
}

View File

@ -1,70 +1,63 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdMonitoringSteamService;
import com.jasamedika.medifirst2000.vo.CssdMonitoringSteamVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdMonitoringSteamService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.CssdMonitoringSteamVO;
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("/cssd-monitoring-steam")
public class CssdMonitoringSteamController extends LocaleController {
@Autowired
private CssdMonitoringSteamService cssdMonitoringSteamService;
public class CssdMonitoringSteamController extends LocaleController<CssdMonitoringSteamVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(CssdMonitoringSteamController.class);
@RequestMapping(value = "/save-monitoring-steam/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveMoioringEo(@Valid @RequestBody CssdMonitoringSteamVO vo,HttpServletRequest request,HttpServletResponse response) {
@Autowired
private CssdMonitoringSteamService cssdMonitoringSteamService;
@RequestMapping(value = "/save-monitoring-steam/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveMoioringEo(@Valid @RequestBody CssdMonitoringSteamVO vo,
HttpServletRequest request, HttpServletResponse response) {
try {
Map<String, Object> result = cssdMonitoringSteamService.saveMonitoringSteam(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save MonitoringSteam", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveMonitoringSteam", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save save MonitoringSteam", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveMonitoringSteam", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
// Menampilkan Kartu Pengendali Berdasarkan Norec (array)
@RequestMapping(value = "/detail-monitoring-steam", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> detailMonitoringSteam(@RequestParam(value = "strukPelayananId", required = true) String strukPelayananId) {
Map<String, Object> result = cssdMonitoringSteamService.detailMonitoringSteam(strukPelayananId);
return result;
}
@RequestMapping(value = "/detail-monitoring-steam", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> detailMonitoringSteam(
@RequestParam(value = "strukPelayananId") String strukPelayananId) {
return cssdMonitoringSteamService.detailMonitoringSteam(strukPelayananId);
}
}

View File

@ -1,70 +1,62 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdPengemasanService;
import com.jasamedika.medifirst2000.vo.CssdPengemasanVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdPengemasanService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.CssdPengemasanVO;
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("/cssd-pengemasan")
public class CssdPengemasanController extends LocaleController {
@Autowired
private CssdPengemasanService cssdPengemasanService;
public class CssdPengemasanController extends LocaleController<CssdPengemasanVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(CssdPengemasanController.class);
@RequestMapping(value = "/save-pengemasan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePengemasan(@Valid @RequestBody CssdPengemasanVO vo,HttpServletRequest request,HttpServletResponse response) {
@Autowired
private CssdPengemasanService cssdPengemasanService;
@RequestMapping(value = "/save-pengemasan/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePengemasan(@Valid @RequestBody CssdPengemasanVO vo,
HttpServletRequest request, HttpServletResponse response) {
try {
Map<String, Object> result = cssdPengemasanService.savePengemasan(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Pengemasan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePengemasan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save save Pengemasan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePengemasan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
// Menampilkan Kartu Pengendali Berdasarkan Norec (array)
@RequestMapping(value = "/detail-pengemasan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> detailPengemasan(@RequestParam(value = "strukPelayananId", required = true) String strukPelayananId) {
Map<String, Object> result = cssdPengemasanService.detailPengemasan(strukPelayananId);
return result;
}
@RequestMapping(value = "/detail-pengemasan", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> detailPengemasan(@RequestParam(value = "strukPelayananId") String strukPelayananId) {
return cssdPengemasanService.detailPengemasan(strukPelayananId);
}
}

View File

@ -1,70 +0,0 @@
package com.jasamedika.medifirst2000.controller;
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.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdPengeringanService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.CssdPengeringanVO;
@RestController
@RequestMapping("/cssd-pengeringan")
public class CssdPengeringanController extends LocaleController {
@Autowired
private CssdPengeringanService cssdPengeringanService;
private static final Logger LOGGER = LoggerFactory.getLogger(CssdPengeringanController.class);
@RequestMapping(value = "/save-pengeringan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePengeringan(@Valid @RequestBody CssdPengeringanVO vo,HttpServletRequest request,HttpServletResponse response) {
try {
Map<String, Object> result = cssdPengeringanService.savePengeringan(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Pengeringan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save save Pengeringan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
// Menampilkan Kartu Pengendali Berdasarkan Norec (array)
@RequestMapping(value = "/detail-pengeringan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> detailPengeringan(@RequestParam(value = "strukPelayananId", required = true) String strukPelayananId) {
Map<String, Object> result = cssdPengeringanService.detailPengeringan(strukPelayananId);
return result;
}
}

View File

@ -1,70 +1,62 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdPenyimpananService;
import com.jasamedika.medifirst2000.vo.CssdPenyimpananVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdPenyimpananService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.CssdPenyimpananVO;
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("/cssd-penyimpanan")
public class CssdPenyimpananController extends LocaleController {
@Autowired
private CssdPenyimpananService cssdPenyimpananService;
public class CssdPenyimpananController extends LocaleController<CssdPenyimpananVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(CssdPenyimpananController.class);
@RequestMapping(value = "/save-penyimpanan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePenyimpanan(@Valid @RequestBody CssdPenyimpananVO vo,HttpServletRequest request,HttpServletResponse response) {
@Autowired
private CssdPenyimpananService cssdPenyimpananService;
@RequestMapping(value = "/save-penyimpanan/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePenyimpanan(@Valid @RequestBody CssdPenyimpananVO vo,
HttpServletRequest request, HttpServletResponse response) {
try {
Map<String, Object> result = cssdPenyimpananService.savePenyimpanan(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Penyimpanan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when savePenyimpanan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save save Penyimpanan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when savePenyimpanan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
// Menampilkan Kartu Pengendali Berdasarkan Norec (array)
@RequestMapping(value = "/detail-penyimpanan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> detailPenyimpanan(@RequestParam(value = "strukPelayananId", required = true) String strukPelayananId) {
Map<String, Object> result = cssdPenyimpananService.detailPenyimpanan(strukPelayananId);
return result;
}
@RequestMapping(value = "/detail-penyimpanan", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> detailPenyimpanan(@RequestParam(value = "strukPelayananId") String strukPelayananId) {
return cssdPenyimpananService.detailPenyimpanan(strukPelayananId);
}
}

View File

@ -1,84 +1,64 @@
package com.jasamedika.medifirst2000.controller;
import java.util.HashMap;
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.CssdReturService;
import com.jasamedika.medifirst2000.vo.ReturCssdVO;
import com.jasamedika.medifirst2000.vo.StrukPelayananDetailVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdReturService;
import com.jasamedika.medifirst2000.service.StrukPelayananService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.ReturCssdVO;
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("/retur-cssd")
public class CssdReturController extends LocaleController{
public class CssdReturController extends LocaleController<StrukPelayananDetailVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(CssdReturController.class);
@Autowired
private CssdReturService cssdReturService;
// save kartu Pengendali
@RequestMapping(value = "/save-retur-cssd", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-retur-cssd", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveReturCssd(@Valid @RequestBody ReturCssdVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = cssdReturService.saveReturCssd(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Retur Cssd", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveReturCssd", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Retur Cssd", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveReturCssd", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-order-sterilisasi/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getDetailPenerimaanBarang(
@RequestParam(value = "noRec", required = true) String noRec) {
Map<String, Object> result = cssdReturService.getOrderSterilisasi(noRec);
return result;
}
@RequestMapping(value = "/get-no-retur", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String,Object> getNoOrder() {
Map<String, Object> result = new HashMap<String,Object>();
result.put("noKirim", cssdReturService.formatNoUrut("Struk Retur", "RRS"));
return result;
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/get-order-sterilisasi/", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getDetailPenerimaanBarang(@RequestParam(value = "noRec") String noRec) {
return cssdReturService.getOrderSterilisasi(noRec);
}
@RequestMapping(value = "/list-retur-cssd")
@ResponseBody
public Map<String, Object> listReturSupplier(
@ -92,11 +72,8 @@ public class CssdReturController extends LocaleController{
@RequestParam(value = "jenisProdukId", required = false) Integer jenisProdukId,
@RequestParam(value = "kelompokProdukId", required = false) Integer kelompokProdukId,
@RequestParam(value = "supplierId", required = false) Integer supplierId) {
Map<String, Object> resultPageMap = cssdReturService.listReturCssd(page, limit, sort, dir, tanggalAwal,tanggalAhir,produkId,jenisProdukId,kelompokProdukId,supplierId);
return resultPageMap;
return cssdReturService.listReturCssd(page, limit, sort, dir, tanggalAwal, tanggalAhir, produkId, jenisProdukId,
kelompokProdukId, supplierId);
}
}

View File

@ -1,70 +1,62 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdSterilService;
import com.jasamedika.medifirst2000.vo.CssdSterilVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdSterilService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.CssdSterilVO;
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("/cssd-steril")
public class CssdSterilController extends LocaleController {
@Autowired
private CssdSterilService cssdSterilService;
public class CssdSterilController extends LocaleController<CssdSterilVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(CssdSterilController.class);
@RequestMapping(value = "/save-steril/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveSteril(@Valid @RequestBody CssdSterilVO vo,HttpServletRequest request,HttpServletResponse response) {
@Autowired
private CssdSterilService cssdSterilService;
@RequestMapping(value = "/save-steril/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveSteril(@Valid @RequestBody CssdSterilVO vo,
HttpServletRequest request, HttpServletResponse response) {
try {
Map<String, Object> result = cssdSterilService.saveSteril(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Steril", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveSteril", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save save Steril", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveSteril", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
// Menampilkan Kartu Pengendali Berdasarkan Norec (array)
@RequestMapping(value = "/detail-steril", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> detailSteril(@RequestParam(value = "strukPelayananId", required = true) String strukPelayananId) {
Map<String, Object> result = cssdSterilService.detailSteril(strukPelayananId);
return result;
}
@RequestMapping(value = "/detail-steril", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> detailSteril(@RequestParam(value = "strukPelayananId") String strukPelayananId) {
return cssdSterilService.detailSteril(strukPelayananId);
}
}

View File

@ -1,102 +1,88 @@
package com.jasamedika.medifirst2000.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.dto.MapPaketToProdukDto;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdSterilisasiService;
import com.jasamedika.medifirst2000.vo.CssdSterilisasiVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.dto.MapPaketToProdukDto;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdBmhpService;
import com.jasamedika.medifirst2000.service.CssdSterilisasiService;
import com.jasamedika.medifirst2000.service.StokProdukGlobalService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.CssdBmhpHeaderVO;
import com.jasamedika.medifirst2000.vo.CssdProduksiBmhpHeaderVO;
import com.jasamedika.medifirst2000.vo.CssdSterilisasiVO;
import com.jasamedika.medifirst2000.vo.PermintaanPerbaikanVO;
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("/cssd-sterilisasi")
public class CssdSterilisasiController extends LocaleController {
@Autowired
private CssdSterilisasiService cssdSterilisasiService;
public class CssdSterilisasiController extends LocaleController<CssdSterilisasiVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(CssdSterilisasiController.class);
@RequestMapping(value = "/save-cssd-sterilisasi/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveCssdSterilisasi(@Valid @RequestBody CssdSterilisasiVO vo,HttpServletRequest request,HttpServletResponse response) {
@Autowired
private CssdSterilisasiService cssdSterilisasiService;
@RequestMapping(value = "/save-cssd-sterilisasi/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveCssdSterilisasi(@Valid @RequestBody CssdSterilisasiVO vo,
HttpServletRequest request, HttpServletResponse response) {
try {
Map<String, Object> result = cssdSterilisasiService.saveSterilisasi(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Sterilisasi Alat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveSterilisasi", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Sterilisasi Alat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveSterilisasi", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}
@RequestMapping(value = "/get-paket", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-paket", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getPaket() {
Map<String, Object> data = cssdSterilisasiService.getPaket();
return data;
return cssdSterilisasiService.getPaket();
}
@RequestMapping(value = "/get-no-urut", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-no-urut", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getNoUrut() {
Map<String, Object> data = cssdSterilisasiService.getNoUrut();
return data;
return cssdSterilisasiService.getNoUrut();
}
@RequestMapping(value = "/get-produk", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getByIdProduk(@RequestParam(value = "paketId", required = true) Integer paketId, @RequestParam(value = "produkId", required = true) Integer produkId) {
Map<String, Object> data = cssdSterilisasiService.getByIdProduk(paketId, produkId);
return data;
@RequestMapping(value = "/get-produk", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getByIdProduk(@RequestParam(value = "paketId") Integer paketId,
@RequestParam(value = "produkId") Integer produkId) {
return cssdSterilisasiService.getByIdProduk(paketId, produkId);
}
@RequestMapping(value = "/get-produk-by-paket", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getProdukByPaket(@RequestParam(value = "paketId", required = true) Integer paketId) {
Map<String, Object> data = cssdSterilisasiService.getProdukByPaket(paketId);
return data;
@RequestMapping(value = "/get-produk-by-paket", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getProdukByPaket(@RequestParam(value = "paketId") Integer paketId) {
return cssdSterilisasiService.getProdukByPaket(paketId);
}
@RequestMapping(value = "/get-produk-non-paket", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-produk-non-paket", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getProdukNonPaket() {
Map<String, Object> data = cssdSterilisasiService.getProdukNonPaket();
return data;
return cssdSterilisasiService.getProdukNonPaket();
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/list-sterilisasi")
@ResponseBody
public Map<String, Object> listSterilisasi(
@ -108,115 +94,54 @@ public class CssdSterilisasiController extends LocaleController {
@RequestParam(value = "tanggalAhir", required = false) String tanggalAhir,
@RequestParam(value = "noOrder", required = false) String noOrder,
@RequestParam(value = "jenisCustomer", required = false) String jenisCustomer) {
Map<String, Object> resultPageMap = cssdSterilisasiService.listSterilisasi(page,limit,sort,dir,tanggalAwal,tanggalAhir,noOrder,jenisCustomer);
return resultPageMap;
return cssdSterilisasiService.listSterilisasi(page, limit, sort, dir, tanggalAwal, tanggalAhir, noOrder,
jenisCustomer);
}
@RequestMapping(value = "/get-no-order", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String,Object> getNoOrder() {
Map<String, Object> result = new HashMap<String,Object>();
@RequestMapping(value = "/get-no-order", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getNoOrder() {
Map<String, Object> result = new HashMap<>();
result.put("noOrderPerbaikan", cssdSterilisasiService.preFormatNoUrut("Penerimaan Supplier", "PNB"));
return result;
}
@RequestMapping(value = "/cetak-sterilisasi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> cetakSterilisasi(
@RequestParam(value = "strukPelayananId", required = true) String strukPelayananId) {
Map<String, Object> result = cssdSterilisasiService.cetakSterilisasi(strukPelayananId);
return result;
}
@RequestMapping(value = "/cetak-bukti-sterilisasi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> cetakBuktiSterilisasi(
@RequestParam(value = "strukPelayananId", required = true) String strukPelayananId) {
Map<String, Object> result = cssdSterilisasiService.cetakBuktiSterilisasi(strukPelayananId);
String data=(String)result.get("status");
if(data.equalsIgnoreCase("error")){
return result;
}else{
return result;
}
}
@RequestMapping(value = "/get-jenis-paket",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String,Object> getjenisPaket() {
Map<String, Object> result = new HashMap<String,Object>();
@RequestMapping(value = "/get-jenis-paket", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getjenisPaket() {
Map<String, Object> result = new HashMap<>();
result.put("noOrderPerbaikan", cssdSterilisasiService.getJenisPaket());
return result;
}
@RequestMapping(value = "/get-paket-by-jenis-paket",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getPaketByJenisPaket(
@RequestParam(value = "idJenisPaket", required = true) Integer idJenisPaket) {
Map<String, Object> result = cssdSterilisasiService.getPaketByJenisPaket(idJenisPaket);
return result;
@RequestMapping(value = "/get-paket-by-jenis-paket", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getPaketByJenisPaket(@RequestParam(value = "idJenisPaket") Integer idJenisPaket) {
return cssdSterilisasiService.getPaketByJenisPaket(idJenisPaket);
}
@RequestMapping(value = "/get-map-paket-to-produk",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getMapProdukByPaket(
@RequestParam(value = "idPaket", required = true) Integer idPaket) {
Map<String, Object> result = cssdSterilisasiService.getMapPaketToProduk(idPaket);
return result;
@RequestMapping(value = "/get-map-paket-to-produk", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getMapProdukByPaket(@RequestParam(value = "idPaket") Integer idPaket) {
return cssdSterilisasiService.getMapPaketToProduk(idPaket);
}
@RequestMapping(value="/save-all-map-paket-to-produk",
method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> saveAllMapPaketToProduk(
@RequestBody List<MapPaketToProdukDto> dto,
@RequestMapping(value = "/save-all-map-paket-to-produk", method = POST, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, Object>>> saveAllMapPaketToProduk(@RequestBody List<MapPaketToProdukDto> dto,
HttpServletRequest request) {
List<Map<String,Object>> result = cssdSterilisasiService.saveMapPaketToProduk(dto);
List<Map<String, Object>> result = cssdSterilisasiService.saveMapPaketToProduk(dto);
if (!result.isEmpty()) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
}
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/list-map-paket-to-produk")
@ResponseBody
public Map<String, Object> getListMapPaketToProduk(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "take", required = false, defaultValue = "10000000") Integer limit,
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
@RequestParam(value = "namaPaket", required = false, defaultValue = "") String namaPaket) {
Map<String, Object> resultPageMap =
cssdSterilisasiService.getListMapPaketToProduk(page,limit,sort,dir,namaPaket);
return resultPageMap;
}
@RequestMapping(value="/unmapping-paket-to-produk",
method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> unmappingPaketToProduk(
@RequestBody MapPaketToProdukDto dto, HttpServletRequest request){
@RequestMapping(value = "/unmapping-paket-to-produk", method = POST, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> unmappingPaketToProduk(@RequestBody MapPaketToProdukDto dto,
HttpServletRequest request) {
Map<String, Object> result = cssdSterilisasiService.unmappingPaketToProduk(dto);
if (!result.isEmpty()) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, OK, mapHeaderMessage);
}
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
}
}

View File

@ -1,76 +1,62 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdUjiSwapService;
import com.jasamedika.medifirst2000.vo.CssdUjiSwapVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.CssdBmhpService;
import com.jasamedika.medifirst2000.service.CssdUjiSwapService;
import com.jasamedika.medifirst2000.service.StokProdukGlobalService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.CssdBmhpHeaderVO;
import com.jasamedika.medifirst2000.vo.CssdProduksiBmhpHeaderVO;
import com.jasamedika.medifirst2000.vo.CssdUjiSwapVO;
import com.jasamedika.medifirst2000.vo.PermintaanPerbaikanVO;
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("/cssd-uji-swap")
public class CssdUjiSwapController extends LocaleController {
@Autowired
private CssdUjiSwapService cssdUjiSwapService;
public class CssdUjiSwapController extends LocaleController<CssdUjiSwapVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(CssdUjiSwapController.class);
@RequestMapping(value = "/save-uji-swap/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveCssdBmhp(@Valid @RequestBody CssdUjiSwapVO vo,HttpServletRequest request,HttpServletResponse response) {
@Autowired
private CssdUjiSwapService cssdUjiSwapService;
@RequestMapping(value = "/save-uji-swap/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveCssdBmhp(@Valid @RequestBody CssdUjiSwapVO vo,
HttpServletRequest request, HttpServletResponse response) {
try {
Map<String, Object> result = cssdUjiSwapService.saveUjiSwap(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Uji Swap", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveUjiSwap", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save save Uji Swap", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveUjiSwap", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
// Menampilkan Kartu Pengendali Berdasarkan Norec (array)
@RequestMapping(value = "/detail-uji-swap", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> detailUjiSwap(@RequestParam(value = "strukPelayananId", required = true) String strukPelayananId) {
Map<String, Object> result = cssdUjiSwapService.detailUjiSwap(strukPelayananId);
return result;
}
@RequestMapping(value = "/detail-uji-swap", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> detailUjiSwap(@RequestParam(value = "strukPelayananId") String strukPelayananId) {
return cssdUjiSwapService.detailUjiSwap(strukPelayananId);
}
}

View File

@ -1,223 +1,115 @@
package com.jasamedika.medifirst2000.controller;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.UnitCostService;
import com.jasamedika.medifirst2000.vo.UnitCostVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.entities.UnitCost;
import com.jasamedika.medifirst2000.entities.UnitCostDetail;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.UnitCostService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.UnitCostDetailVO;
import com.jasamedika.medifirst2000.vo.UnitCostVO;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
@RestController
@RequestMapping("/unit-cost")
public class DaftarKegiatanController extends LocaleController<UnitCostDetailVO> {
@Autowired
private UnitCostService unitCostService;
public class DaftarKegiatanController extends LocaleController<UnitCostVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarKegiatanController.class);
@RequestMapping(value = "/detail-unit-cost", method = RequestMethod.GET)
public ResponseEntity< Map<String,Object>> findAllDepartemenById5And6(
@Autowired
private UnitCostService<UnitCostVO> unitCostService;
@RequestMapping(value = "/detail-unit-cost", method = GET)
public ResponseEntity<Map<String, Object>> findAllDepartemenById5And6(
@RequestParam(value = "idRuangan", required = false) Integer idRuangan,
@RequestParam(value = "idInstalasiDepartemen", required = false) Integer idInstalasiDepartemen,
@RequestParam(value = "idLayanan", required = false) Integer idLayanan,
@RequestParam(value = "periodeAwal", required = false) String periodeAwal,
@RequestParam(value = "periodeAkhir", required = false) String periodeAkhir,
HttpServletRequest request) {
@RequestParam(value = "periodeAkhir", required = false) String periodeAkhir, HttpServletRequest request) {
try {
//String idRuangan, String idInstalasiDepartemen, Date periodeAwal, Date periodeAkhir,String idLayanan
Map<String,Object> listDepartemen = unitCostService.findDetailCostUnit(idRuangan,idInstalasiDepartemen,periodeAwal,periodeAkhir,idLayanan);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(listDepartemen, HttpStatus.OK,mapHeaderMessage);
Map<String, Object> listDepartemen = unitCostService.findDetailCostUnit(idRuangan, idInstalasiDepartemen,
periodeAwal, periodeAkhir, idLayanan);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(listDepartemen, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get all dokter", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when findDetailCostUnit", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get all dokter", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when findDetailCostUnit", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-list-pelayanan", method = RequestMethod.GET)
public ResponseEntity< Map<String,Object>> findListPelayanan(
@RequestParam(value = "idRuangan", required = false) Integer idRuangan,
HttpServletRequest request) {
@RequestMapping(value = "/get-list-unit-cost-jenis", method = GET)
public ResponseEntity<Map<String, Object>> findUnitCostJenis(HttpServletRequest request) {
try {
Map<String,Object> listPelayanan = unitCostService.findListPelayanan(idRuangan);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(listPelayanan, HttpStatus.OK,mapHeaderMessage);
Map<String, Object> mapResult = unitCostService.getListJenisUnitCost();
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(mapResult, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get all dokter", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getListJenisUnitCost", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get all dokter", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getListJenisUnitCost", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
//Simpan data unit cost
@RequestMapping(value = "/save-unit-cost", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveDaftarKerja( @RequestBody UnitCostVO vo,
HttpServletRequest request) throws ParseException {
try {
UnitCostVO result = (UnitCostVO) unitCostService.add(vo);
Map<String, Object> mapResult= new HashMap<>();
mapResult.put("data", result);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(mapResult, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-list-unit-cost-jenis", method = RequestMethod.GET)
public ResponseEntity<Map<String, Object>> findUnitCostJenis(HttpServletRequest request) throws ParseException {
try {
Map<String, Object> mapResult= unitCostService.getListJenisUnitCost();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(mapResult, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", 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 Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-list-unit-cost-jenis-detail", method = RequestMethod.GET)
@RequestMapping(value = "/get-list-unit-cost-jenis-detail", method = GET)
public ResponseEntity<Map<String, Object>> findUnitCostJenisDetail(
@RequestParam(value = "idUnitCostJenis", required = false) Integer idUnitCostJenis,
HttpServletRequest request) throws ParseException {
HttpServletRequest request) {
try {
Map<String, Object> mapResult= unitCostService.getListDetailJenisUnitCost(idUnitCostJenis);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(mapResult, HttpStatus.CREATED, mapHeaderMessage);
Map<String, Object> mapResult = unitCostService.getListDetailJenisUnitCost(idUnitCostJenis);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(mapResult, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getListDetailJenisUnitCost", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getListDetailJenisUnitCost", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-list-unit-cost", method = RequestMethod.GET)
@RequestMapping(value = "/get-list-unit-cost", method = GET)
public ResponseEntity<Map<String, Object>> findUnitCost(
@RequestParam(value = "idRuangan", required = false) Integer idRuangan,
@RequestParam(value = "idInstalasi", required = false) Integer idInstalasi,
@RequestParam(value = "namaKegiatan", required = false) String namaKegiatan,
HttpServletRequest request) throws ParseException {
@RequestParam(value = "namaKegiatan", required = false) String namaKegiatan, HttpServletRequest request) {
try {
Map<String, Object> mapResult= unitCostService.getListUnitCost(idRuangan,idInstalasi,namaKegiatan);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(mapResult, HttpStatus.OK, mapHeaderMessage);
Map<String, Object> mapResult = unitCostService.getListUnitCost(idRuangan, idInstalasi, namaKegiatan);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(mapResult, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getListUnitCost", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
jse.printStackTrace();
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getListUnitCost", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-unit-cost-by-id", method = RequestMethod.GET)
public ResponseEntity<UnitCost> findUnitCost(
@RequestParam(value = "idUnitCost", required = false) Integer idUnitCost,
HttpServletRequest request) throws ParseException {
try {
UnitCost mapResult= unitCostService.findbyUnitCostId(idUnitCost);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(mapResult, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
jse.printStackTrace();
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-unit-cost-detail-by-unit-cost-id", method = RequestMethod.GET)
public ResponseEntity<List<UnitCostDetail>> findUnitCostDetailByUnitCostId(
@RequestParam(value = "idUnitCost", required = false) Integer idUnitCost,
HttpServletRequest request) throws ParseException {
try {
List<UnitCostDetail> mapResult= unitCostService.findUnitCostDetailByUnitCostId(idUnitCost);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(mapResult, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
jse.printStackTrace();
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,120 +1,105 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DaftarKendaraanDinasService;
import com.jasamedika.medifirst2000.vo.OrderKendaraanDinasVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DaftarKendaraanDinasService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.OrderKendaraanDinasVO;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
@RestController
@RequestMapping("/daftar-kendaraan-dinas")
public class DaftarKendaraanDinasController extends LocaleController<OrderKendaraanDinasVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarKendaraanDinasController.class);
@Autowired
private DaftarKendaraanDinasService daftarKendaraanDinasService;
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarKendaraanDinasController.class);
@RequestMapping(value = "/find-by-periode/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-by-periode/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findDaftarKendaraanDinasByPeriode(
@RequestParam(value = "periodeAwal", required = true) String periodeAwal,
@RequestParam(value = "periodeAkhir", required = true) String periodeAkhir, HttpServletRequest request) {
Map<String, Object> result = null;
@RequestParam(value = "periodeAwal") String periodeAwal,
@RequestParam(value = "periodeAkhir") String periodeAkhir, HttpServletRequest request) {
try {
result = daftarKendaraanDinasService.findDaftarKendaraanDinasByPeriode(periodeAwal, periodeAkhir);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
Map<String, Object> result = daftarKendaraanDinasService.findDaftarKendaraanDinasByPeriode(periodeAwal,
periodeAkhir);
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
return getJsonResponse(result, OK);
} catch (Exception e) {
e.printStackTrace();
throw new ServiceVOException(e.getMessage());
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/find-by-no-rec/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoRec(@RequestParam(value = "noRec", required = true) String noRec,
HttpServletRequest request) {
Map<String, Object> result = daftarKendaraanDinasService.findByNoRec(noRec);
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/find-penggunaan-kendaraan-dinas-by-no-rec/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findPenggunaanKendaraanDinasByNoRec(@RequestParam(value = "noRec", required = true) String noRec,
HttpServletRequest request) {
@RequestMapping(value = "/find-penggunaan-kendaraan-dinas-by-no-rec/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findPenggunaanKendaraanDinasByNoRec(
@RequestParam(value = "noRec") String noRec, HttpServletRequest request) {
Map<String, Object> result = daftarKendaraanDinasService.getPenggunaanKendaranDinasByNoRec(noRec);
return RestUtil.getJsonResponse(result, HttpStatus.OK);
return getJsonResponse(result, OK);
}
@RequestMapping(value = "/find-pengembalian-kendaraan-dinas-by-no-rec/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-pengembalian-kendaraan-dinas-by-no-rec/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findPengembalianKendaraanDinasByNoRec(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
//Map<String, Object> result = daftarKendaraanDinasService.findPengembalianKendaraanDinasByNoRec(noRec);
@RequestParam(value = "noRec") String noRec, HttpServletRequest request) {
Map<String, Object> result = this.daftarKendaraanDinasService.getPengembalianKendaraanDinasByNoRec(noRec);
return RestUtil.getJsonResponse(result, HttpStatus.OK);
return getJsonResponse(result, OK);
}
@RequestMapping(value = "/get-all-kendaraan-dinas-dan-pejabat/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-all-kendaraan-dinas-dan-pejabat/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllKendaraanDinasDanPejabat(HttpServletRequest request) {
try {
Map<String, Object> result = daftarKendaraanDinasService.getAllKendaraanDinasDanPejabat();
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get All Kendaraan Dinas dan Pejabat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getAllKendaraanDinasDanPejabat", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get All Kendaraan Dinas dan Pejabat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getAllKendaraanDinasDanPejabat", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-all-pengembalian-kendaraan-dinas/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-all-pengembalian-kendaraan-dinas/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllPengembalianKendaraanDinas(
@RequestParam(value = "startDate", required = true) String startDate,
@RequestParam(value="endDate", required=true)String endDate, HttpServletRequest request) {
Map<String, Object> result = this.daftarKendaraanDinasService.getAllPengembalianKendaraanDinas(startDate, endDate);
return RestUtil.getJsonResponse(result, HttpStatus.OK);
@RequestParam(value = "startDate") String startDate, @RequestParam(value = "endDate") String endDate,
HttpServletRequest request) {
Map<String, Object> result = this.daftarKendaraanDinasService.getAllPengembalianKendaraanDinas(startDate,
endDate);
return getJsonResponse(result, OK);
}
@RequestMapping(value = "/get-detail-pengembalian-kendaraan-dinas-by-norec/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getDetailPengembalianKendaraanDinasByNoRec(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
@RequestMapping(value = "/get-detail-pengembalian-kendaraan-dinas-by-norec/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getDetailPengembalianKendaraanDinasByNoRec(
@RequestParam(value = "noRec") String noRec, HttpServletRequest request) {
Map<String, Object> result = this.daftarKendaraanDinasService.getPengembalianKendaraanDetailByNoRec(noRec);
return RestUtil.getJsonResponse(result, HttpStatus.OK);
return getJsonResponse(result, OK);
}
}

View File

@ -1,55 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.dto.DaftarMappingCycleDto;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DaftarMappingCycleService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.MappingCycleLaundryVO;
@RestController
@RequestMapping("/daftar-mapping-cycle-laundry")
public class DaftarMappingCycleController extends LocaleController<MappingCycleLaundryVO> {
@Autowired
private DaftarMappingCycleService daftarMappingCycleService;
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarMappingCycleController.class);
@RequestMapping(value = "/find-mapping-cycle-laundry/", method = RequestMethod.GET)
public ResponseEntity<List<DaftarMappingCycleDto>> findMappingCycleLaundry(HttpServletRequest request) {
try {
List<DaftarMappingCycleDto> listMappingCycleVO = daftarMappingCycleService.findMappingCycleLaundry();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(listMappingCycleVO, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when Find Mapping Cycle Laundry", 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 Find Mapping Cycle Laundry", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,127 +1,84 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DaftarOrderAmbulanceService;
import com.jasamedika.medifirst2000.vo.OrderPelayananVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DaftarOrderAmbulanceService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.OrderPelayananVO;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
@RestController
@RequestMapping("/daftar-order-ambulance")
public class DaftarOrderAmbulanceController extends LocaleController<OrderPelayananVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarOrderAmbulanceController.class);
@Autowired
private DaftarOrderAmbulanceService daftarOrderAmbulanceService;
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarOrderAmbulanceController.class);
@RequestMapping(value = "/find-by-periode/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-by-periode/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findDaftarOrderAmbulanceByPeriode(
@RequestParam(value = "periodeAwal", required = true) String periodeAwal,
@RequestParam(value = "periodeAkhir", required = true) String periodeAkhir, HttpServletRequest request) {
@RequestParam(value = "periodeAwal") String periodeAwal,
@RequestParam(value = "periodeAkhir") String periodeAkhir, HttpServletRequest request) {
Map<String, Object> result = daftarOrderAmbulanceService.findDaftarOrderAmbulanceByPeriode(periodeAwal,
periodeAkhir);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
return getJsonResponse(result, OK);
}
@RequestMapping(value = "/find-by-no-rec/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-by-no-rec/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findDaftarOrderAmbulanceByNoRec(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
@RequestParam(value = "noRec") String noRec, HttpServletRequest request) {
Map<String, Object> result = daftarOrderAmbulanceService.findDaftarOrderAmbulanceByNoRec(noRec);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
return getJsonResponse(result, OK);
}
@RequestMapping(value = "/find-by-no-order/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findDaftarOrderAmbulanceByNoOrder(
@RequestParam(value = "noOrder", required = true) String noOrder, HttpServletRequest request) {
Map<String, Object> result = daftarOrderAmbulanceService.findDaftarOrderAmbulanceByNoOrder(noOrder);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/find-by-periode-dan-no-order/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByPeriodeDanNoOrder(
@RequestParam(value = "noOrder", required = true) String noOrder,
@RequestParam(value = "periodeAwal", required = true) String periodeAwal,
@RequestParam(value = "periodeAkhir", required = true) String periodeAkhir, HttpServletRequest request) {
Map<String, Object> result = daftarOrderAmbulanceService.findByPeriodeDanNoOrder(noOrder, periodeAwal,
periodeAkhir);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/get-all-daftar-order-ambulance/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-all-daftar-order-ambulance/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllDaftarOrderAmbulance(HttpServletRequest request) {
try {
Map<String, Object> result = daftarOrderAmbulanceService.getAllDaftarOrderAmbulance();
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get All Daftar Order Ambulance", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getAllDaftarOrderAmbulance", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get All Daftar Order Ambulance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getAllDaftarOrderAmbulance", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,101 +1,86 @@
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.DaftarOrderPemakaianRuangRapatService;
import com.jasamedika.medifirst2000.vo.OrderPemakaianRuangRapatVO;
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.DaftarOrderPemakaianRuangRapatService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.OrderPemakaianRuangRapatVO;
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("/daftar-order-pemakaian-ruang-rapat")
public class DaftarOrderPemakaianRuangRapatController extends LocaleController<OrderPemakaianRuangRapatVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarOrderPemakaianRuangRapatController.class);
@Autowired
private DaftarOrderPemakaianRuangRapatService daftarOrderPemakaianRuangRapatService;
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarOrderPemakaianRuangRapatController.class);
@RequestMapping(value = "/find-by-periode/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-by-periode/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findDaftarOrderPemakaianRuangRapatByPeriode(
@RequestParam(value = "periodeAwal", required = true) String periodeAwal,
@RequestParam(value = "periodeAkhir", required = true) String periodeAkhir, HttpServletRequest request) {
@RequestParam(value = "periodeAwal") String periodeAwal,
@RequestParam(value = "periodeAkhir") String periodeAkhir, HttpServletRequest request) {
Map<String, Object> result = daftarOrderPemakaianRuangRapatService
.findDaftarOrderPemakaianRuangRapatByPeriode(periodeAwal, periodeAkhir);
return RestUtil.getJsonResponse(result, HttpStatus.OK);
return getJsonResponse(result, OK);
}
@RequestMapping(value = "/find-by-no-rec/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findDaftarOrderPemakaianRuangRapatNoRec(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
Map<String, Object> result = daftarOrderPemakaianRuangRapatService
.findDaftarOrderPemakaianRuangRapatNoRec(noRec);
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/save-status-pemakaian-ruang-rapat/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveStatusRuangRapat(
@RequestParam(value = "noRec", required = true) String noRec,
@RequestMapping(value = "/save-status-pemakaian-ruang-rapat/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveStatusRuangRapat(@RequestParam(value = "noRec") String noRec,
@Valid @RequestBody OrderPemakaianRuangRapatVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = daftarOrderPemakaianRuangRapatService.saveStatusRuangRapat(noRec, 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 saveStatusPemakaianRuangRapat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveStatusRuangRapat", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveStatusPemakaianRuangRapat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveStatusRuangRapat", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-all-order-ruang-rapat/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-all-order-ruang-rapat/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllOrderRuangRapat(HttpServletRequest request) {
try {
Map<String, Object> result = daftarOrderPemakaianRuangRapatService.getAllOrderRuangRapat();
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 getAllDaftarOrderRuangRapat", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getAllOrderRuangRapat", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getAllDaftarOrderRuangRapat", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getAllOrderRuangRapat", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,99 +1,93 @@
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.DaftarPemakaianRumahDukaService;
import com.jasamedika.medifirst2000.vo.PemakaianRumahDukaVO;
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.DaftarPemakaianRumahDukaService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PemakaianRumahDukaVO;
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("/daftar-pemakaian-rumah-duka")
public class DaftarPemakaianRumahDukaController extends LocaleController<PemakaianRumahDukaVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarPemakaianRumahDukaController.class);
@Autowired
private DaftarPemakaianRumahDukaService daftarPemakaianRumahDukaService;
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarPemakaianRumahDukaController.class);
@RequestMapping(value = "/find-by-periode/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-by-periode/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findDaftarPemakaianRumahDukaByPeriode(
@RequestParam(value = "periodeAwal", required = true) String periodeAwal,
@RequestParam(value = "periodeAkhir", required = true) String periodeAkhir, HttpServletRequest request) {
@RequestParam(value = "periodeAwal") String periodeAwal,
@RequestParam(value = "periodeAkhir") String periodeAkhir, HttpServletRequest request) {
Map<String, Object> result = daftarPemakaianRumahDukaService.findDaftarPemakaianRumahDukaByPeriode(periodeAwal,
periodeAkhir);
return RestUtil.getJsonResponse(result, HttpStatus.OK);
return getJsonResponse(result, OK);
}
@RequestMapping(value = "/find-by-no-rec/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoRec(@RequestParam(value = "noRec", required = true) String noRec,
@RequestMapping(value = "/find-by-no-rec/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoRec(@RequestParam(value = "noRec") String noRec,
HttpServletRequest request) {
Map<String, Object> result = daftarPemakaianRumahDukaService.findByNoRec(noRec);
return RestUtil.getJsonResponse(result, HttpStatus.OK);
return getJsonResponse(result, OK);
}
@RequestMapping(value = "/save-status-pemakaian-rumah-duka/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveStatusRumahDuka(
@RequestParam(value = "noRec", required = true) String noRec, @Valid @RequestBody PemakaianRumahDukaVO vo,
HttpServletRequest request) {
@RequestMapping(value = "/save-status-pemakaian-rumah-duka/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveStatusRumahDuka(@RequestParam(value = "noRec") String noRec,
@Valid @RequestBody PemakaianRumahDukaVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = daftarPemakaianRumahDukaService.saveStatusRumahDuka(noRec, vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Status Pemakaian Rumah Duka", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveStatusRumahDuka", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Status Pemakaian Rumah Duka", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveStatusRumahDuka", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-all-daftar-pemakaian-rumah-duka/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-all-daftar-pemakaian-rumah-duka/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllDaftarPemakaianRumahDuka(HttpServletRequest request) {
try {
Map<String, Object> result = daftarPemakaianRumahDukaService.getAllDaftarPemakaianRumahDuka();
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 getAllDaftarPemakaianRumahDuka", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getAllDaftarPemakaianRumahDuka", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getAllDaftarPemakaianRumahDuka", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getAllDaftarPemakaianRumahDuka", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,164 +1,90 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DaftarPemulasaraanJenazahService;
import com.jasamedika.medifirst2000.vo.OrderPelayananVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DaftarPemulasaraanJenazahService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.OrderPelayananVO;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
@RestController
@RequestMapping("/daftar-pemulasaraan-jenazah")
public class DaftarPemulasaraanJenazahController extends LocaleController<OrderPelayananVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarPemulasaraanJenazahController.class);
@Autowired
private DaftarPemulasaraanJenazahService daftarPemulasaraanJenazahService;
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarPemulasaraanJenazahController.class);
@RequestMapping(value = "/find-by-periode/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findDaftarPemulasaraanJenazahByPeriode(
@RequestParam(value = "periodeAwal", required = true) String periodeAwal,
@RequestParam(value = "periodeAkhir", required = true) String periodeAkhir, HttpServletRequest request) {
Map<String, Object> result = daftarPemulasaraanJenazahService
.findDaftarPemulasaraanJenazahByPeriode(periodeAwal, periodeAkhir);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/find-by-no-rec/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoRec(@RequestParam(value = "noRec", required = true) String noRec,
@RequestMapping(value = "/find-by-no-rec/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoRec(@RequestParam(value = "noRec") String noRec,
HttpServletRequest request) {
Map<String, Object> result = daftarPemulasaraanJenazahService.findDaftarPemulasaraanJenazahByNoRec(noRec);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
return getJsonResponse(result, OK);
}
@RequestMapping(value = "/find-by-periode-dan-no-order/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByPeriodeDanNoOrder(
@RequestParam(value = "noOrder", required = true) String noOrder,
@RequestParam(value = "periodeAwal", required = true) String periodeAwal,
@RequestParam(value = "periodeAkhir", required = true) String periodeAkhir, HttpServletRequest request) {
Map<String, Object> result = daftarPemulasaraanJenazahService.findByPeriodeDanNoOrder(noOrder, periodeAwal,
periodeAkhir);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/get-all-daftar-pemulasaraan-jenazah/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-all-daftar-pemulasaraan-jenazah/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllDaftarPemulasaraanJenazah(HttpServletRequest request) {
try {
Map<String, Object> result = daftarPemulasaraanJenazahService.getAllDaftarPemulasaraanJenazah();
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get All Daftar Pemulasaraan Jenazah", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getAllDaftarPemulasaraanJenazah", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get All Daftar Pemulasaraan Jenazah", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getAllDaftarPemulasaraanJenazah", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-all-daftar-pemulasaraan-jenazah-rev-1/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllDaftarPemulasaraanJenazahRev1(HttpServletRequest request) {
@RequestMapping(value = "/get-pemulasaraan-jenazah-external/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPemulasaraanJenazahExternal(
@RequestParam(value = "startDate") String startDate, @RequestParam(value = "endDate") String endDate,
HttpServletRequest request) {
try {
Map<String, Object> result = daftarPemulasaraanJenazahService.getAllDaftarPemulasaraanJenazahRev1();
Map<String, Object> result = daftarPemulasaraanJenazahService.getDaftarPemulasaranJenazahExternal(startDate,
endDate);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get All Daftar Pemulasaraan Jenazah", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getDaftarPemulasaranJenazahExternal", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get All Daftar Pemulasaraan Jenazah", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getDaftarPemulasaranJenazahExternal", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-pemulasaraan-jenazah-external/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPemulasaraanJenazahExternal(@RequestParam(value="startDate")String startDate,
@RequestParam(value="endDate")String endDate,HttpServletRequest request) {
try {
Map<String, Object> result = daftarPemulasaraanJenazahService.getDaftarPemulasaranJenazahExternal(startDate, endDate);
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 Daftar Pemulasaraan Jenazah External", 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 Daftar Pemulasaraan Jenazah External", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-pemulasaraan-jenazah-external-detail-by-norec/",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getPemulasaraanJenazahExternal(
@RequestParam(value = "noRec") String noRec) {
Map<String, Object> result = this.daftarPemulasaraanJenazahService.getPemulasaranJenazahExternalDetailByNoRec(noRec);
return result;
}
}

View File

@ -1,43 +1,44 @@
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.DaftarPenerimaanService;
import com.jasamedika.medifirst2000.vo.MappingKirimDokumenPasienVO;
import com.jasamedika.medifirst2000.vo.StrukBuktiPenerimaanCaraBayarVO;
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.DaftarPenerimaanService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.MappingKirimDokumenPasienVO;
import com.jasamedika.medifirst2000.vo.StrukBuktiPenerimaanCaraBayarVO;
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("/daftar-penerimaan")
public class DaftarPenerimaanController extends LocaleController<StrukBuktiPenerimaanCaraBayarVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarPenerimaanController.class);
@Autowired
private DaftarPenerimaanService service;
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarPenerimaanController.class);
@RequestMapping(value = "/penerimaan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/penerimaan", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getDaftarPenerimaan(
@RequestParam(value = "idPegawai", required = false) Integer idPegawai,
@RequestParam(value = "idCaraBayar", required = false) Integer idCaraBayar,
@ -51,53 +52,46 @@ public class DaftarPenerimaanController extends LocaleController<StrukBuktiPener
@RequestParam(value = "status", required = false) String status,
@RequestParam(value = "noClosing", required = false) String noClosing,
@RequestParam(value = "noVerifikasi", required = false) String noVerifikasi) {
Map<String, Object> resultPageMap = service.getDaftarPenerimaan(idPegawai, idCaraBayar, idKelTransaksi,
dateStartTglSbm, dateEndTglSbm, dateStartVerif, dateEndVerif, dateStartClosing, dateEndClosing, status,
noClosing, noVerifikasi);
return resultPageMap;
return service.getDaftarPenerimaan(idPegawai, idCaraBayar, idKelTransaksi, dateStartTglSbm, dateEndTglSbm,
dateStartVerif, dateEndVerif, dateStartClosing, dateEndClosing, status, noClosing, noVerifikasi);
}
@RequestMapping(value = "/save-verifikasi-setoran", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-verifikasi-setoran", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveVerifikasiSetoran(@Valid @RequestBody MappingKirimDokumenPasienVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = service.saveVerifikasiSetoran(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 saveVerifikasiSetoran", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveVerifikasiSetoran", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveVerifikasiSetoran", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveVerifikasiSetoran", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-closing-verifikasi-setoran", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-closing-verifikasi-setoran", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveClosingVerifikasiSetoran(
@Valid @RequestBody MappingKirimDokumenPasienVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = service.saveClosingVerifikasiSetoran(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 saveClosingVerifikasiSetoran", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveClosingVerifikasiSetoran", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveClosingVerifikasiSetoran", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveClosingVerifikasiSetoran", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,52 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.service.DaftarPenerimaanLinenService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.MappingPenerimaanLinenVO;
@RestController
@RequestMapping("/daftar-penerimaan-linen")
public class DaftarPenerimaanLinenController extends LocaleController<MappingPenerimaanLinenVO> {
@Autowired
private DaftarPenerimaanLinenService daftarPenerimaanLinenService;
@RequestMapping(value = "/find-penerimaan-linen-by-tgl/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findDaftarPenerimaanLinenByTgl(
@RequestParam(value = "tglAwal", required = true) String tglAwal,
@RequestParam(value = "tglAkhir", required = true) String tglAkhir, HttpServletRequest request) {
Map<String, Object> result = null;
try {
result = daftarPenerimaanLinenService.findDaftarPenerimaanLinenByTgl(tglAwal,tglAkhir);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
}
} catch (Exception e) {
e.printStackTrace();
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
}

View File

@ -1,20 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.service.DaftarPenerimaanSterilisasiAlatService;
import com.jasamedika.medifirst2000.vo.PenerimaanSterilisasiAlatInternalVO;
@RestController
@RequestMapping("/daftar-penerimaan-sterilisasi-alat")
public class DaftarPenerimaanSterilisasiAlatController extends LocaleController<PenerimaanSterilisasiAlatInternalVO> {
@Autowired
private DaftarPenerimaanSterilisasiAlatService daftarPenerimaanSterilisasiAlatService;
}

View File

@ -1,17 +1,17 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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.controller.base.LocaleController;
import com.jasamedika.medifirst2000.service.DaftarPengajuanAnggaranService;
import com.jasamedika.medifirst2000.vo.HeadAnggaranVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
@RestController
@RequestMapping("/daftar-pengajuan-anggaran/")
@ -20,7 +20,7 @@ public class DaftarPengajuanAnggaranController extends LocaleController<HeadAngg
@Autowired
private DaftarPengajuanAnggaranService daftarPengajuanAnggaranService;
@RequestMapping(value = "/get-pengajuan-anggaran/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-pengajuan-anggaran/", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> findDaftarPengajuanAnggaran(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "limit", required = false, defaultValue = "100") Integer limit,
@ -30,10 +30,8 @@ public class DaftarPengajuanAnggaranController extends LocaleController<HeadAngg
@RequestParam(value = "dateEnd", required = false) String dateEnd,
@RequestParam(value = "noRec", required = false) String noRec,
@RequestParam(value = "tahun", required = false) Integer tahun) {
Map<String, Object> resultPageMap = daftarPengajuanAnggaranService.findDaftarPengajuanAnggaran(page, limit,
sort, dir, dateStart, dateEnd, noRec, tahun);
return resultPageMap;
return daftarPengajuanAnggaranService.findDaftarPengajuanAnggaran(page, limit, sort, dir, dateStart, dateEnd,
noRec, tahun);
}
}

View File

@ -1,22 +1,21 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.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.controller.base.LocaleController;
import com.jasamedika.medifirst2000.service.DaftarPenilaianKinerjaSatpamService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.PenilaianKinerjaSatpamVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.OK;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
@RestController
@RequestMapping("/daftar-penilaian-kinerja-satpam")
@ -25,25 +24,12 @@ public class DaftarPenilaianKinerjaSatpamController extends LocaleController<Pen
@Autowired
private DaftarPenilaianKinerjaSatpamService daftarPenilaianKinerjaSatpamService;
@RequestMapping(value = "/find-by-nama-pegawai/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-by-nama-pegawai/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findPenilaianKinerjaSatpamByNamaSatpam(
@RequestParam(value = "namaPegawai", required = true) String namaPegawai, HttpServletRequest request) {
@RequestParam(value = "namaPegawai") String namaPegawai, HttpServletRequest request) {
Map<String, Object> result = daftarPenilaianKinerjaSatpamService
.findPenilaianKinerjaSatpamByNamaSatpam(namaPegawai);
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/find-by-no-rec/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findPenilaianKinerjaSatpamByNoRec(
@RequestParam(value = "noRec", required = true) String noRec, HttpServletRequest request) {
Map<String, Object> result = daftarPenilaianKinerjaSatpamService.findPenilaianKinerjaSatpamByNoRec(noRec);
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/get-all-penilaian-kinerja-satpam/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPenilaianKinerjaSatpam(HttpServletRequest request) {
Map<String, Object> result = daftarPenilaianKinerjaSatpamService.getPenilaianKinerjaSatpam();
return RestUtil.getJsonResponse(result, HttpStatus.OK);
return getJsonResponse(result, OK);
}
}

View File

@ -1,94 +1,86 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DaftarPesanAmbulanceService;
import com.jasamedika.medifirst2000.vo.OrderAmbulanceVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DaftarPesanAmbulanceService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.OrderAmbulanceVO;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.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("/daftar-pesan-ambulance")
public class DaftarPesanAmbulanceController extends LocaleController<OrderAmbulanceVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarPesanAmbulanceController.class);
@Autowired
private DaftarPesanAmbulanceService daftarPesanAmbulanceService;
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarPesanAmbulanceController.class);
@RequestMapping(value = "/find-by-periode/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-by-periode/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findDaftarPesanAmbulanceByPeriode(
@RequestParam(value = "periodeAwal", required = true) String periodeAwal,
@RequestParam(value = "periodeAkhir", required = true) String periodeAkhir, HttpServletRequest request) {
@RequestParam(value = "periodeAwal") String periodeAwal,
@RequestParam(value = "periodeAkhir") String periodeAkhir, HttpServletRequest request) {
Map<String, Object> result = daftarPesanAmbulanceService.findDaftarPesanAmbulanceByPeriode(periodeAwal,
periodeAkhir);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
return getJsonResponse(result, OK);
}
@RequestMapping(value = "/find-by-no-order/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoOrder(
@RequestParam(value = "noOrder", required = true) String noOrder, HttpServletRequest request) {
@RequestMapping(value = "/find-by-no-order/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoOrder(@RequestParam(value = "noOrder") String noOrder,
HttpServletRequest request) {
Map<String, Object> result = daftarPesanAmbulanceService.findByNoOrder(noOrder);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
return getJsonResponse(result, OK);
}
@RequestMapping(value = "/save-status-ambulance/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveStatusAmbulance(
@RequestParam(value = "noOrder", required = true) String noOrder,
@RequestParam(value = "id", required = true) Integer id, HttpServletRequest request) {
@RequestMapping(value = "/save-status-ambulance/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveStatusAmbulance(@RequestParam(value = "noOrder") String noOrder,
@RequestParam(value = "id") Integer id, HttpServletRequest request) {
try {
Map<String, Object> result = daftarPesanAmbulanceService.saveStatusAmbulance(noOrder, id);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Status Ambulance", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveStatusAmbulance", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Status Ambulance", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveStatusAmbulance", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,17 +1,17 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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.controller.base.LocaleController;
import com.jasamedika.medifirst2000.service.DaftarRKAKLTahunanService;
import com.jasamedika.medifirst2000.vo.HeadAnggaranVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
@RestController
@RequestMapping("/daftar-rka-kl")
@ -20,29 +20,14 @@ public class DaftarRKAKLTahunanController extends LocaleController<HeadAnggaranV
@Autowired
private DaftarRKAKLTahunanService daftarRKAKLTahunanService;
@RequestMapping(value = "/find-riwayat", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> findDaftarPengajuanAnggaran(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "limit", required = false, defaultValue = "100") Integer limit,
@RequestParam(value = "sort", required = false, defaultValue = "spesifikasi") String sort,
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
@RequestParam(value = "noRec", required = false) String noRec,
@RequestParam(value = "tahun", required = false) Integer tahun) {
Map<String, Object> resultPageMap = daftarRKAKLTahunanService.findRiwayat(page, limit, sort, dir, noRec, tahun);
return resultPageMap;
}
@RequestMapping(value = "/get-detail-rka-kl", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-detail-rka-kl", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getDetailRKAKL(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "limit", required = false, defaultValue = "100") Integer limit,
@RequestParam(value = "sort", required = false, defaultValue = "spesifikasi") String sort,
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
@RequestParam(value = "tahun", required = false) Integer tahun) {
Map<String, Object> resultPageMap = daftarRKAKLTahunanService.getDetailRKAKL(page, limit, sort, dir, tahun);
return resultPageMap;
return daftarRKAKLTahunanService.getDetailRKAKL(page, limit, sort, dir, tahun);
}
}

View File

@ -1,115 +1,105 @@
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.DaftarSewaAsramaService;
import com.jasamedika.medifirst2000.vo.SewaAsramaVO;
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.DaftarSewaAsramaService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.SewaAsramaVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.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("/daftar-sewa-asrama")
public class DaftarSewaAsramaController extends LocaleController<SewaAsramaVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarSewaAsramaController.class);
@Autowired
private DaftarSewaAsramaService daftarSewaAsramaService;
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarSewaAsramaController.class);
@RequestMapping(value = "/find-by-periode/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-by-periode/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findDaftarSewaAsramaByPeriode(
@RequestParam(value = "periodeAwal", required = true) String periodeAwal,
@RequestParam(value = "periodeAkhir", required = true) String periodeAkhir, HttpServletRequest request) {
@RequestParam(value = "periodeAwal") String periodeAwal,
@RequestParam(value = "periodeAkhir") String periodeAkhir, HttpServletRequest request) {
Map<String, Object> result = daftarSewaAsramaService.findDaftarSewaAsramaByPeriode(periodeAwal, periodeAkhir);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
return getJsonResponse(result, OK);
}
@RequestMapping(value = "/find-by-no-order/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoOrder(
@RequestParam(value = "noOrder", required = true) String noOrder, HttpServletRequest request) {
Map<String, Object> result = daftarSewaAsramaService.findByNoOrder(noOrder);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/save-status-sewa-asrama/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveStatusSewaAsrama(
@RequestParam(value = "noOrder", required = true) String noOrder, @Valid @RequestBody SewaAsramaVO vo,
@RequestMapping(value = "/find-by-no-order/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoOrder(@RequestParam(value = "noOrder") String noOrder,
HttpServletRequest request) {
Map<String, Object> result = daftarSewaAsramaService.findByNoOrder(noOrder);
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);
}
@RequestMapping(value = "/save-status-sewa-asrama/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveStatusSewaAsrama(@RequestParam(value = "noOrder") String noOrder,
@Valid @RequestBody SewaAsramaVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = daftarSewaAsramaService.saveStatusSewaAsrama(noOrder, vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Status Sewa Asrama", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveStatusSewaAsrama", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Status Sewa Asrama", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveStatusSewaAsrama", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-all-sewa-asrama/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-all-sewa-asrama/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllSewaAsrama(HttpServletRequest request) {
try {
Map<String, Object> result = daftarSewaAsramaService.getAllSewaAsrama();
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get All Sewa Asrama", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getAllSewaAsrama", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get All Sewa Asrama", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getAllSewaAsrama", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,119 +1,109 @@
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.DaftarSewaLahanService;
import com.jasamedika.medifirst2000.vo.SewaLahanVO;
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.DaftarSewaLahanService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.SewaLahanVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.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("/daftar-sewa-lahan")
public class DaftarSewaLahanController extends LocaleController<SewaLahanVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarSewaLahanController.class);
@Autowired
private DaftarSewaLahanService daftarSewaLahanService;
private static final Logger LOGGER = LoggerFactory.getLogger(DaftarSewaLahanController.class);
@RequestMapping(value = "/find-by-periode/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/find-by-periode/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findDaftarSewaLahanByPeriode(
@RequestParam(value = "periodeAwal", required = true) String periodeAwal,
@RequestParam(value = "periodeAkhir", required = true) String periodeAkhir, HttpServletRequest request) {
Map<String, Object> result = null;
@RequestParam(value = "periodeAwal") String periodeAwal,
@RequestParam(value = "periodeAkhir") String periodeAkhir, HttpServletRequest request) {
try {
result = daftarSewaLahanService.findDaftarSewaLahanByPeriode(periodeAwal, periodeAkhir);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
Map<String, Object> result = daftarSewaLahanService.findDaftarSewaLahanByPeriode(periodeAwal, periodeAkhir);
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
return getJsonResponse(result, OK);
} catch (Exception e) {
e.printStackTrace();
throw new ServiceVOException(e.getMessage());
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/find-by-no-order/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoOrder(
@RequestParam(value = "noOrder", required = true) String noOrder, HttpServletRequest request) {
Map<String, Object> result = daftarSewaLahanService.findByNoOrder(noOrder);
Boolean dataFound = new Boolean((boolean) result.get("dataFound"));
if (dataFound) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,
getMessage(MessageResource.LABEL_ERROR, request));
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/save-status-sewa-lahan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveStatusSewaLahan(
@RequestParam(value = "noOrder", required = true) String noOrder, @Valid @RequestBody SewaLahanVO vo,
@RequestMapping(value = "/find-by-no-order/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoOrder(@RequestParam(value = "noOrder") String noOrder,
HttpServletRequest request) {
Map<String, Object> result = daftarSewaLahanService.findByNoOrder(noOrder);
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);
}
@RequestMapping(value = "/save-status-sewa-lahan/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveStatusSewaLahan(@RequestParam(value = "noOrder") String noOrder,
@Valid @RequestBody SewaLahanVO vo, HttpServletRequest request) {
try {
Map<String, Object> result = daftarSewaLahanService.saveStatusSewaLahan(noOrder, vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Status Sewa Lahan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveStatusSewaLahan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Status Sewa Lahan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveStatusSewaLahan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-all-sewa-lahan/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-all-sewa-lahan/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllSewaLahan(HttpServletRequest request) {
try {
Map<String, Object> result = daftarSewaLahanService.getAllSewaLahan();
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get All Sewa Lahan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when getAllSewaLahan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get All Sewa Lahan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when getAllSewaLahan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}

View File

@ -1,18 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.service.DaftarSterilisasiAlatService;
import com.jasamedika.medifirst2000.vo.ProsesSterilisasiAlatVO;
@RestController
@RequestMapping("/daftar-sterilisasi-alat")
public class DaftarSterilisasiAlatController extends LocaleController<ProsesSterilisasiAlatVO> {
// @Autowired
private DaftarSterilisasiAlatService daftarSterilisasiAlatService;
}

View File

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

View File

@ -1,125 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.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.PegawaiService;
import com.jasamedika.medifirst2000.service.RisikoKerjaRuanganService;
import com.jasamedika.medifirst2000.util.DateUtil;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.RisikoKerjaRuanganVO;
import com.jasamedika.medifirst2000.vo.PapSkriningNyeriVO;
import com.jasamedika.medifirst2000.vo.PegawaiVO;
/**
* Controller class for Pengakjian Awal Gawat Darurat Business
*
* @author Askur
*/
@RestController
@RequestMapping("/data-pegawai")
@JsonIgnoreProperties(ignoreUnknown = true)
public class DataPegawaiController extends LocaleController<RisikoKerjaRuanganVO> implements
IBaseRestController<RisikoKerjaRuanganVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(DataPegawaiController.class);
@Autowired
private PegawaiService pegawaiService;
@RequestMapping(value = "/save-data-pegawai", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody PegawaiVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = pegawaiService.addPegawai(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 RisikoKerjaRuangan", 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 RisikoKerjaRuangan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> findByNoCm(HttpServletRequest request) {
Map<String,Object> result = pegawaiService.findAllPegawai();
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<RisikoKerjaRuanganVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<RisikoKerjaRuanganVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(RisikoKerjaRuanganVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(RisikoKerjaRuanganVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<RisikoKerjaRuanganVO>> getAllVO() {
return null;
}
}

View File

@ -1,305 +1,194 @@
package com.jasamedika.medifirst2000.controller;
import java.util.HashMap;
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.DataPerusahaanYangBekerjaSamaService;
import com.jasamedika.medifirst2000.vo.DataPerusahaanYangBekerjaSamaVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.domain.Specifications;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.entities.AdvokasiHukumMedicolegal;
import com.jasamedika.medifirst2000.entities.DataPerusahaanYangBekerjaSama;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DataPerusahaanYangBekerjaSamaService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.DataPerusahaanYangBekerjaSamaVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Map;
import net.kaczmarzyk.spring.data.jpa.domain.DateBetween;
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.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("/data-perusahaan-yang-bekerjasama")
public class DataPerusahaanYangBekerjaSamaController extends LocaleController<DataPerusahaanYangBekerjaSamaVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(DataPerusahaanYangBekerjaSamaController.class);
@Autowired
private DataPerusahaanYangBekerjaSamaService dataPerusahaanYangBekerjaSamaService;
private static final Logger LOGGER = LoggerFactory
.getLogger(DataPerusahaanYangBekerjaSamaController.class);
@RequestMapping(value = "/save-data-perusahaan-yang-bekerjasama/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody DataPerusahaanYangBekerjaSamaVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=dataPerusahaanYangBekerjaSamaService.addDataPerusahaanYangBekerjaSama(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 DataPerusahaanYangBekerjaSamaService", 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 DataPerusahaanYangBekerjaSamaService", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/update-data-perusahaan-yang-bekerjasama/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody DataPerusahaanYangBekerjaSamaVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=dataPerusahaanYangBekerjaSamaService.addDataPerusahaanYangBekerjaSama(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when update DataPerusahaanYangBekerjaSamaService", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update DataPerusahaanYangBekerjaSamaService", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-data-perusahaan-yang-bekerjasama/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getAllVO(
@RequestParam(value="jenisRekananId",required=false,defaultValue="6") Integer jenisRekananId,
@RequestParam(value="status",required=false,defaultValue="1") Integer status,
@RequestMapping(value = "/save-data-perusahaan-yang-bekerjasama/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody DataPerusahaanYangBekerjaSamaVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result=dataPerusahaanYangBekerjaSamaService.findAllDataPerusahaanYangBekerjaSama(jenisRekananId,status);
Map<String, Object> result = dataPerusahaanYangBekerjaSamaService.addDataPerusahaanYangBekerjaSama(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 get DataPerusahaanYangBekerjaSamaService", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addDataPerusahaanYangBekerjaSama", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get DataPerusahaanYangBekerjaSamaService", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addDataPerusahaanYangBekerjaSama", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-data-perusahaan-yang-bekerjasama-2/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getAllVO2(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "take", required = false, defaultValue = "20") Integer take,
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
@RequestParam(value = "dir", required = false, defaultValue = "desc") String dir,
@Spec(path = "rekanan.jenisRekanan.id", params = "idJenisRekanan", spec = Equal.class) Specification<DataPerusahaanYangBekerjaSama> jenisRekanan,HttpServletRequest request) {
Map<String,Object> result = new HashMap<String, Object>();
Specification<DataPerusahaanYangBekerjaSama> spec = jenisRekanan;
result = dataPerusahaanYangBekerjaSamaService.findAll(page, take, sort, dir, spec);
return constructListPageResult(result);
// try {
// Map<String,Object> result=dataPerusahaanYangBekerjaSamaService.findAllDataPerusahaanYangBekerjaSama();
// 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 DataPerusahaanYangBekerjaSamaService", 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 DataPerusahaanYangBekerjaSamaService", jse.getMessage());
// addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
// jse.getMessage());
// return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
// mapHeaderMessage);
// }
}
@RequestMapping(value = "/get-perusanaan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPerusahaan(HttpServletRequest request) {
Map<String, Object> result = null;
try{
result = dataPerusahaanYangBekerjaSamaService.getPerusahaan();
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
}
else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
}catch (Exception e){
e.printStackTrace();
@RequestMapping(value = "/find-all-data-perusahaan-yang-bekerjasama/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllVO(
@RequestParam(value = "jenisRekananId", required = false, defaultValue = "6") Integer jenisRekananId,
@RequestParam(value = "status", required = false, defaultValue = "1") Integer status,
HttpServletRequest request) {
try {
Map<String, Object> result = dataPerusahaanYangBekerjaSamaService
.findAllDataPerusahaanYangBekerjaSama(jenisRekananId, status);
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 findAllDataPerusahaanYangBekerjaSama", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when findAllDataPerusahaanYangBekerjaSama", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/get-asuransi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-asuransi", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAsuransi(HttpServletRequest request) {
Map<String, Object> result = null;
try{
result = dataPerusahaanYangBekerjaSamaService.getAsuransi();
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
try {
Map<String, Object> result = dataPerusahaanYangBekerjaSamaService.getAsuransi();
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
}catch (Exception e){
e.printStackTrace();
return getJsonResponse(result, OK);
} catch (Exception e) {
throw new ServiceVOException(e.getMessage());
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/get-rumah-sakit", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-rumah-sakit", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getRumahSakit(HttpServletRequest request) {
Map<String, Object> result = null;
try{
result = dataPerusahaanYangBekerjaSamaService.getRumahSakit();
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
try {
Map<String, Object> result = dataPerusahaanYangBekerjaSamaService.getRumahSakit();
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
}catch (Exception e){
e.printStackTrace();
return getJsonResponse(result, OK);
} catch (Exception e) {
throw new ServiceVOException(e.getMessage());
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/get-yayasan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-yayasan", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getYayasan(HttpServletRequest request) {
Map<String, Object> result = null;
try{
result = dataPerusahaanYangBekerjaSamaService.getYayasan();
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
try {
Map<String, Object> result = dataPerusahaanYangBekerjaSamaService.getYayasan();
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
}catch (Exception e){
e.printStackTrace();
return getJsonResponse(result, OK);
} catch (Exception e) {
throw new ServiceVOException(e.getMessage());
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/get-perusahaan-yang-bekerja-sama/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-perusahaan-yang-bekerja-sama/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getPerusahaanYangBekerjaSama(HttpServletRequest request) {
Map<String, Object> result = null;
try{
result = dataPerusahaanYangBekerjaSamaService.getPerusahaanYangBekerjaSama();
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
try {
Map<String, Object> result = dataPerusahaanYangBekerjaSamaService.getPerusahaanYangBekerjaSama();
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
}catch (Exception e){
e.printStackTrace();
return getJsonResponse(result, OK);
} catch (Exception e) {
throw new ServiceVOException(e.getMessage());
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/get-asuransi-yang-bekerja-sama/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-asuransi-yang-bekerja-sama/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAsuransiYangBekerjaSama(HttpServletRequest request) {
Map<String, Object> result = null;
try{
result = dataPerusahaanYangBekerjaSamaService.getAsuransiYangBekerjaSama();
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
try {
Map<String, Object> result = dataPerusahaanYangBekerjaSamaService.getAsuransiYangBekerjaSama();
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
}catch (Exception e){
e.printStackTrace();
return getJsonResponse(result, OK);
} catch (Exception e) {
throw new ServiceVOException(e.getMessage());
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/get-rumah-sakit-yang-bekerja-sama/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-rumah-sakit-yang-bekerja-sama/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getRumahSakitYangBekerjaSama(HttpServletRequest request) {
Map<String, Object> result = null;
try{
result = dataPerusahaanYangBekerjaSamaService.getRumahSakitYangBekerjaSama();
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
try {
Map<String, Object> result = dataPerusahaanYangBekerjaSamaService.getRumahSakitYangBekerjaSama();
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
}catch (Exception e){
e.printStackTrace();
return getJsonResponse(result, OK);
} catch (Exception e) {
throw new ServiceVOException(e.getMessage());
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/get-yayasan-yang-bekerja-sama/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-yayasan-yang-bekerja-sama/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getYayasanYangBekerjaSama(HttpServletRequest request) {
Map<String, Object> result = null;
try{
result = dataPerusahaanYangBekerjaSamaService.getYayasanYangBekerjaSama();
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
try {
Map<String, Object> result = dataPerusahaanYangBekerjaSamaService.getYayasanYangBekerjaSama();
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
}catch (Exception e){
e.printStackTrace();
return getJsonResponse(result, OK);
} catch (Exception e) {
throw new ServiceVOException(e.getMessage());
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
}

View File

@ -1,274 +1,133 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DataPesertaPerusahanYangBekerjaSamaService;
import com.jasamedika.medifirst2000.vo.DataPesertaPerusahanYangBekerjaSamaVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DataPesertaPerusahanYangBekerjaSamaService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.DataPesertaPerusahanYangBekerjaSamaVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.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("/data-peserta-perusahaan-yang-bekerja-sama")
public class DataPesertaPerusahanYangBekerjaSamaController extends LocaleController<DataPesertaPerusahanYangBekerjaSamaVO> implements IBaseRestController<DataPesertaPerusahanYangBekerjaSamaVO> {
public class DataPesertaPerusahanYangBekerjaSamaController
extends LocaleController<DataPesertaPerusahanYangBekerjaSamaVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(DataPesertaPerusahanYangBekerjaSamaController.class);
@Autowired
private DataPesertaPerusahanYangBekerjaSamaService service;
private static final Logger LOGGER = LoggerFactory
.getLogger(DataPesertaPerusahanYangBekerjaSamaController.class);
@RequestMapping(value = "/save-data-peserta-perusahaan-yang-bekerja-sama/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody DataPesertaPerusahanYangBekerjaSamaVO vo, HttpServletRequest request) {
@RequestMapping(value = "/save-data-peserta-perusahaan-yang-bekerja-sama/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody DataPesertaPerusahanYangBekerjaSamaVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result=service.addDataPesertaPerusahanYangBekerjaSama(vo);
Map<String, Object> result = service.addDataPesertaPerusahanYangBekerjaSama(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 DataPesertaPerusahanYangBekerjaSama", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when addDataPesertaPerusahanYangBekerjaSama", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add DataPesertaPerusahanYangBekerjaSama", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when addDataPesertaPerusahanYangBekerjaSama", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/save-all-data-peserta-perusahaan-yang-bekerja-sama/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody List<DataPesertaPerusahanYangBekerjaSamaVO> vos, HttpServletRequest request) {
try {
Map<String,Object> result=service.addallDataPesertaPerusahanYangBekerjaSama(vos);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add all DataPesertaPerusahanYangBekerjaSama", 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 all DataPesertaPerusahanYangBekerjaSama", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/update-data-peserta-perusahaan-yang-bekerja-sama/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody DataPesertaPerusahanYangBekerjaSamaVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=service.updateDataPesertaPerusahanYangBekerjaSama(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when update DataPesertaPerusahanYangBekerjaSama", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update DataPesertaPerusahanYangBekerjaSama", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-data-peserta/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
try {
Map<String,Object> result=service.findAllDataPesertaPerusahanYangBekerjaSama();
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 DataPesertaPerusahanYangBekerjaSama", 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 DataPesertaPerusahanYangBekerjaSama", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-peserta-rumah-sakit-yang-bekerja-sama/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllPesertaRumahSakitYangBekerjaSama(HttpServletRequest request) {
try {
Map<String,Object> result=service.findAllDataPesertaRumahSakitYangBekerjaSama();
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 DataPesertaRumahSakitYangBekerjaSama", 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 DataPesertaRumahSakitYangBekerjaSama", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-peserta-asuransi-yang-bekerja-sama/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllPesertaAsuransiYangBekerjaSama(HttpServletRequest request) {
try {
Map<String,Object> result=service.findAllDataPesertaAsuransiYangBekerjaSama();
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 DataPesertaAsuransiYangBekerjaSama", 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 DataPesertaAsuransiYangBekerjaSama", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/get-rekanan-rumah-sakit/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllRumahSakitYangBekerjaSama(HttpServletRequest request) {
try {
Map<String,Object> result=service.findAllDataRumahSakitYangBekerjaSama();
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 DataRumahSakitYangBekerjaSama", 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 DataRumahSakitYangBekerjaSama", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/get-rekanan-asuransi/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllAsuransiYangBekerjaSama(HttpServletRequest request) {
try {
Map<String,Object> result=service.findAllDataAsuransiYangBekerjaSama();
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 DataAsuransiYangBekerjaSama", 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 DataAsuransiYangBekerjaSama", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@Override
public ResponseEntity<Collection<DataPesertaPerusahanYangBekerjaSamaVO>> getAllVOWithQueryString(
HttpServletRequest request, Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<DataPesertaPerusahanYangBekerjaSamaVO> getVO(Integer id) {
return null;
@RequestMapping(value = "/find-all-data-peserta/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllVO(HttpServletRequest request) {
try {
Map<String, Object> result = service.findAllDataPesertaPerusahanYangBekerjaSama();
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 findAllDataPesertaPerusahanYangBekerjaSama", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when findAllDataPesertaPerusahanYangBekerjaSama", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@Override
public ResponseEntity<String> addVO(DataPesertaPerusahanYangBekerjaSamaVO vo) {
return null;
@RequestMapping(value = "/find-all-peserta-rumah-sakit-yang-bekerja-sama/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllPesertaRumahSakitYangBekerjaSama(HttpServletRequest request) {
try {
Map<String, Object> result = service.findAllDataPesertaRumahSakitYangBekerjaSama();
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 findAllDataPesertaRumahSakitYangBekerjaSama", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when findAllDataPesertaRumahSakitYangBekerjaSama",
jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@Override
public ResponseEntity<String> editVO(DataPesertaPerusahanYangBekerjaSamaVO vo) {
return null;
@RequestMapping(value = "/get-rekanan-rumah-sakit/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getAllRumahSakitYangBekerjaSama(HttpServletRequest request) {
try {
Map<String, Object> result = service.findAllDataRumahSakitYangBekerjaSama();
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 findAllDataRumahSakitYangBekerjaSama", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when findAllDataRumahSakitYangBekerjaSama", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<DataPesertaPerusahanYangBekerjaSamaVO>> getAllVO() {
return null;
}
@RequestMapping(value = "/get-peserta-by-data-perusahaan/{noRec}/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getKelasByRuangan(@PathVariable("noRec") String noRec, HttpServletRequest request) {
Map<String, Object> result = null;
try{
result = service.findDataPesertaByDataPerusahaan(noRec);
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
if(dataFound){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
@RequestMapping(value = "/get-peserta-by-data-perusahaan/{noRec}/", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getKelasByRuangan(@PathVariable("noRec") String noRec,
HttpServletRequest request) {
try {
Map<String, Object> result = service.findDataPesertaByDataPerusahaan(noRec);
boolean dataFound = (boolean) result.get("dataFound");
if (dataFound) {
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
} else {
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
}
else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
}
}catch (Exception e){
e.printStackTrace();
return getJsonResponse(result, OK);
} catch (Exception e) {
throw new ServiceVOException(e.getMessage());
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
}

View File

@ -1,177 +1,110 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.Departemen;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DepartemenService;
import com.jasamedika.medifirst2000.vo.DepartemenVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DepartemenService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.DepartemenVO;
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("/departemen")
public class DepartemenController extends LocaleController<DepartemenVO> implements
IBaseRestController<DepartemenVO>{
public class DepartemenController extends LocaleController<DepartemenVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(DepartemenController.class);
@Autowired
private DepartemenService departemenService;
private static final Logger LOGGER = LoggerFactory
.getLogger(DepartemenController.class);
private DepartemenService<Departemen> departemenService;
@Override
public ResponseEntity<Collection<DepartemenVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<DepartemenVO> getVO(Integer id) {
return null;
}
@RequestMapping(value = "/save-departemen/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> addVO(@Valid @RequestBody DepartemenVO vo,HttpServletRequest request) {
@RequestMapping(value = "/save-departemen/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<String> addVO(@Valid @RequestBody DepartemenVO vo, HttpServletRequest request) {
try {
DepartemenVO result = (DepartemenVO) departemenService.add(vo);
DepartemenVO result = departemenService.add(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse("", HttpStatus.CREATED,mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse("", CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Departemen", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when add", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Departemen", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when add", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-departemen/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/update-departemen/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<String> editVO(@Valid @RequestBody DepartemenVO vo) {
try {
DepartemenVO result = (DepartemenVO) departemenService.update(vo);
DepartemenVO result = departemenService.update(vo);
if (null != result)
return RestUtil.getJsonResponse("", HttpStatus.OK);
return getJsonResponse("", OK);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when update Departemen", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when update", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update Departemen",
jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when update", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE);
return getJsonHttpStatus(NOT_ACCEPTABLE);
}
@RequestMapping(value = "/delete-departemen/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/delete-departemen/", method = GET, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<String> deleteVO(Integer id) {
try {
if (departemenService.delete(id) == true)
return RestUtil.getJsonResponse("", HttpStatus.OK);
if (departemenService.delete(id))
return getJsonResponse("", OK);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when delete Departemen", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when delete", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when delete Departemen", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when delete", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE);
return getJsonHttpStatus(NOT_ACCEPTABLE);
}
@Override
public ResponseEntity<List<DepartemenVO>> getAllVO() {
return null;
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/search-departemen", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<DepartemenVO>> getAllVOWithQueryString(
@RequestParam(value = "page", required = false ,defaultValue = "1") Integer page,
@RequestParam(value = "limit", required = false ,defaultValue = "10") Integer limit,
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir){
Map<String, Object> resultPageMap = departemenService.findAllWithPageAndLimitAndSortByAndDirectionParameter(page,
limit, sort, dir);
return constructListPageResult(resultPageMap);
}
@Override
public ResponseEntity<String> addVO(DepartemenVO vo) {
return null;
@RequestMapping(value = "/get-all-departemen-for-tagihan", method = GET)
public ResponseEntity<Map<String, Object>> findAllDepartemenById5And6(HttpServletRequest request) {
try {
Map<String, Object> listDepartemen = departemenService.findAllDepartemeById5And6();
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(listDepartemen, OK, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when findAllDepartemeById5And6", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when findAllDepartemeById5And6", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
@RequestMapping(value = "/get-all-departemen-for-tagihan", method = RequestMethod.GET)
public ResponseEntity< Map<String,Object>> findAllDepartemenById5And6(HttpServletRequest request) {
try {
Map<String,Object> listDepartemen = departemenService.findAllDepartemeById5And6();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(listDepartemen, HttpStatus.OK,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get all dokter", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get all dokter", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
}
}

View File

@ -1,78 +1,61 @@
package com.jasamedika.medifirst2000.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.hibernate.sql.JoinType;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DetailRupService;
import com.jasamedika.medifirst2000.vo.DetailRupCustomVO;
import com.jasamedika.medifirst2000.vo.HeadAnggaranVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.entities.DetailRup;
import com.jasamedika.medifirst2000.entities.Ruangan;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DetailRupService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.DetailRupCustomVO;
import com.jasamedika.medifirst2000.vo.HeadAnggaranVO;
import net.kaczmarzyk.spring.data.jpa.domain.Like;
import net.kaczmarzyk.spring.data.jpa.web.annotation.JoinFetch;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
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("/detail-rup")
public class DetailRupController extends LocaleController<HeadAnggaranVO>{
public class DetailRupController extends LocaleController<HeadAnggaranVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(DetailRupController.class);
@Autowired
private DetailRupService service;
private static final Logger LOGGER = LoggerFactory.getLogger(DetailRupController.class);
@RequestMapping(value = "/save-detail-rup", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveDetailRup(@Valid @RequestBody DetailRupCustomVO vo, HttpServletRequest request) {
@RequestMapping(value = "/save-detail-rup", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveDetailRup(@Valid @RequestBody DetailRupCustomVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result = service.saveDetailLRup(vo);
Map<String, Object> result = service.saveDetailLRup(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save RUP", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveDetailLRup", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save RUP", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveDetailLRup", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/list-rup")
public Map<String,Object> joinCondition(
public Map<String, Object> joinCondition(
@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,
@ -80,15 +63,11 @@ public class DetailRupController extends LocaleController<HeadAnggaranVO>{
@RequestParam(value = "dateStart", required = false) String dateStart,
@RequestParam(value = "dateEnd", required = false) String dateEnd,
@RequestParam(value = "pengendaliId", required = false) Integer pengendaliId) {
Map<String, Object> resultPageMap = service.detailRupPaging(page,limit,sort,dir,dateStart,dateEnd);
return resultPageMap;
return service.detailRupPaging(page, limit, sort, dir, dateStart, dateEnd);
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/pre-add-kartu-pengendali")
public Map<String,Object> preAddKartuPengendali(
public Map<String, Object> preAddKartuPengendali(
@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,
@ -98,46 +77,34 @@ public class DetailRupController extends LocaleController<HeadAnggaranVO>{
@RequestParam(value = "kegiatanId", required = false) Integer kegiatanId,
@RequestParam(value = "akunId", required = false) Integer akunId,
@RequestParam(value = "asalProdukId", required = false) Integer asalProdukId) {
Map<String, Object> resultPageMap = service.preAddKartuPengendali(page, limit, sort, dir, dateStart, dateEnd,kegiatanId,akunId,asalProdukId);
return resultPageMap;
return service.preAddKartuPengendali(page, limit, sort, dir, dateStart, dateEnd, kegiatanId, akunId,
asalProdukId);
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/find-rup-list")
public Map<String,Object> findRupList(
public Map<String, Object> findRupList(
@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 service.findRupList(page, limit, sort, dir, dateStart, dateEnd);
}
Map<String, Object> resultPageMap = service.findRupList(page, limit, sort, dir, dateStart, dateEnd);
return resultPageMap;
@RequestMapping(value = "/get-rup-header-by-norec/", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getKartuPengendaliHeaderByNoRec(@RequestParam(value = "noRec") String noRec) {
return service.getDetailRupHeaderByNoRec(noRec);
}
@RequestMapping(value = "/get-rup-header-by-norec/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String,Object> getKartuPengendaliHeaderByNoRec(
@RequestParam(value = "noRec", required = true) String noRec) {
Map<String,Object> detailRupList=service.getDetailRupHeaderByNoRec(noRec);
return detailRupList;
@RequestMapping(value = "/get-asal-produk/", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getAsalProduk(@RequestParam(value = "kegiatanId") Integer kegiatanId) {
return service.getAsalProduk(kegiatanId);
}
@RequestMapping(value = "/get-asal-produk/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String,Object> getAsalProduk(
@RequestParam(value = "kegiatanId", required = true) Integer kegiatanId) {
Map<String,Object> asalProduk=service.getAsalProduk(kegiatanId);
return asalProduk;
}
@RequestMapping(value = "/get-mata-anggaran/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String,Object> getMataAnggaran(
@RequestParam(value = "asalProdukId", required = true) Integer asalProdukId) {
Map<String,Object> mataAnggaran=service.getMataAnggaran(asalProdukId);
return mataAnggaran;
@RequestMapping(value = "/get-mata-anggaran/", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getMataAnggaran(@RequestParam(value = "asalProdukId") Integer asalProdukId) {
return service.getMataAnggaran(asalProdukId);
}
}

View File

@ -1,114 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Collection;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DetailTriaseService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.DetailTriaseVO;
/******************
* @author Shakato
******************/
@RestController
@RequestMapping("/detail-triase")
@JsonIgnoreProperties(ignoreUnknown = true)
public class DetailTriaseController extends LocaleController<DetailTriaseVO> implements IBaseRestController<DetailTriaseVO> {
@Autowired
private DetailTriaseService detailTriaseService;
private static final Logger LOGGER = LoggerFactory.getLogger(DetailTriaseController.class);
@RequestMapping(value = "/save-detail-triase", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> saveDetailTriase(@Valid @RequestBody DetailTriaseVO vo,HttpServletRequest request) {
try {
DetailTriaseVO result = detailTriaseService.add(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
RestUtil.getJsonHttptatus(HttpStatus.CREATED);
return RestUtil.getJsonResponse("Status Sukses", HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Status Keluarga", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Status Keluarga", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@Override
public ResponseEntity<DetailTriaseVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(DetailTriaseVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(DetailTriaseVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<DetailTriaseVO>> getAllVO() {
return null;
}
@Override
public ResponseEntity<Collection<DetailTriaseVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
Integer limit, String sort, String dir) {
return null;
}
}

View File

@ -1,79 +1,76 @@
package com.jasamedika.medifirst2000.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DiagnosaKeperawatanService;
import com.jasamedika.medifirst2000.service.DiagnosaKeperawatanTransaksiService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.DiagnosaKeperawatanTransaksiVO;
import com.jasamedika.medifirst2000.vo.DiagnosaKeperawatanVO;
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.POST;
@RestController
@RequestMapping("/diagnosa-keperawatan")
public class DiagnosaKeperawatanTransaksiController extends LocaleController {
public class DiagnosaKeperawatanTransaksiController extends LocaleController<DiagnosaKeperawatanVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(DiagnosaKeperawatanTransaksiController.class);
@Autowired
private DiagnosaKeperawatanTransaksiService service;
@Autowired
private DiagnosaKeperawatanService diagnosaKeperawatanService;
private static final Logger LOGGER = LoggerFactory.getLogger(DiagnosaKeperawatanTransaksiController.class);
@RequestMapping(value = "/save-diagnosa-keperawatan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> saveDiagnosaKeperawatanTransaksi(@Valid @RequestBody List<DiagnosaKeperawatanTransaksiVO> vo, HttpServletRequest request) {
try {
Map<String,Object> result = service.saveDiagnosaKeperawatan(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
@RequestMapping(value = "/save-diagnosa-keperawatan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveDiagnosaKeperawatanTransaksi(
@Valid @RequestBody List<DiagnosaKeperawatanTransaksiVO> vo, HttpServletRequest request) {
try {
Map<String, Object> result = service.saveDiagnosaKeperawatan(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 saveRencana", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveDiagnosaKeperawatan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveRencana", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveDiagnosaKeperawatan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-all-master")
@ResponseBody
public List<Map<String, Object>> getDiagnosaKeperawatan() {
return diagnosaKeperawatanService.getDiagnosaKeperawatan();
}
@RequestMapping(value = "/get-detail-by-master")
@ResponseBody
public List<Map<String, Object>> getDetailDiagnosaKeperawatan(
@RequestParam(value = "id", required = false) Integer id) {
return diagnosaKeperawatanService.getDetailDiagnosisKeperawatan(id);
}
@RequestMapping(value = "/get-detail-by-transaction")
@ResponseBody
public Map<String, Object> getDetailDiagnosaKeperawatanTransaction(

View File

@ -1,41 +1,34 @@
package com.jasamedika.medifirst2000.controller;
import java.util.Date;
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.DiagnosaPasienService;
import com.jasamedika.medifirst2000.vo.DiagnosaPasienVO;
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
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.security.core.userdetails.User;
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.LoginUserDao;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.security.model.UserAuthentication;
import com.jasamedika.medifirst2000.security.service.TokenAuthenticationService;
import com.jasamedika.medifirst2000.service.ActivityPegawaiService;
import com.jasamedika.medifirst2000.service.DiagnosaPasienService;
import com.jasamedika.medifirst2000.service.LoginUserService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.DiagnosaPasienVO;
import com.jasamedika.medifirst2000.vo.K3CheckListFacillitySefetyVO;
import com.jasamedika.medifirst2000.vo.PegawaiVO;
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
/**
* Controller class for Registrasi Pasien Business
@ -44,132 +37,72 @@ import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
*/
@RestController
@RequestMapping("/diagnosa-pasien")
public class DiagnosaPasienController extends LocaleController<RegistrasiPelayananVO>{
public class DiagnosaPasienController extends LocaleController<RegistrasiPelayananVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(DiagnosaPasienController.class);
@Autowired
private DiagnosaPasienService diagnosaPasienService;
private static final Logger LOGGER = LoggerFactory
.getLogger(DiagnosaPasienController.class);
@Autowired
private LoginUserDao loginUserDao;
@Autowired
private ActivityPegawaiService activityPegawaiServiceImpl;
// @RequestMapping(value = "/save-diagnosa-pasien", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<Map<String, Object>> saveDiagnosaPasien(@Valid @RequestBody DiagnosaPasienVO vo,HttpServletRequest request) {
// try {
// Map<String,Object> result=diagnosaPasienService.saveDiagnosaPasien(vo);
// if (null != result)
// mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
// String token = request.getHeader(WebConstants.AUTH_HEADER_NAME);
// final User user = TokenAuthenticationService.tokenHandler.parseUserFromToken(token);
// if (user != null) {
// {
// UserAuthentication data= new UserAuthentication(user);
// PegawaiVO pegawai = new PegawaiVO();
// pegawai.setId(loginUserDao.findByNamaUser(data.getName()).get(0).getPegawai().getId());
// activityPegawaiServiceImpl.record(pegawai, new Date(), "Memasukan Diagnosis");
// BroadcastMessage("IKI", "");
// }
// }
// return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
//
// } catch (ServiceVOException e) {
// LOGGER.error("Got exception {} when saveDiagnosaPasien", 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 saveDiagnosaPasien", jse.getMessage());
// addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
// return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
// }
//
// }
@RequestMapping(value = "/save-diagnosa-pasien", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveDiagnosaPasien(@Valid @RequestBody DiagnosaPasienVO vo, HttpServletRequest request) {
@RequestMapping(value = "/save-diagnosa-pasien", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveDiagnosaPasien(@Valid @RequestBody DiagnosaPasienVO vo,
HttpServletRequest request) {
try {
Map<String,Object> result=diagnosaPasienService.saveDiagnosaPasien(vo);
Map<String, Object> result = diagnosaPasienService.saveDiagnosaPasien(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 saveDiagnosaPasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when saveDiagnosaPasien", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveDiagnosaPasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when saveDiagnosaPasien", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-by-no-cm", method = RequestMethod.GET)
public ResponseEntity<Map<String, Object>> getByNoCM(@RequestParam(value="noCM", required= false) String noCm,HttpServletRequest request) {
try {
Map<String,Object> result=diagnosaPasienService.findByNoCm(noCm);
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 saveDiagnosaPasien", 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 saveDiagnosaPasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all", method = RequestMethod.GET)
public ResponseEntity<Map<String, Object>> findAll(HttpServletRequest request) {
@RequestMapping(value = "/get-by-no-cm", method = GET)
public ResponseEntity<Map<String, Object>> getByNoCM(@RequestParam(value = "noCM", required = false) String noCm,
HttpServletRequest request) {
try {
Map<String,Object> result=diagnosaPasienService.findAll();
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
Map<String, Object> result = diagnosaPasienService.findByNoCm(noCm);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got ServiceVOException {} when findByNoCm", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when findByNoCm", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when saveDiagnosaPasien", 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 saveDiagnosaPasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-diagnosa-by-antrian", method = RequestMethod.GET)
public ResponseEntity<Map<String, Object>> getDiagnosaByAntrian(@RequestParam(value="noRec", required= true) String noRec,HttpServletRequest request) {
@RequestMapping(value = "/get-diagnosa-by-antrian", method = GET)
public ResponseEntity<Map<String, Object>> getDiagnosaByAntrian(@RequestParam(value = "noRec") String noRec,
HttpServletRequest request) {
try {
Map<String,Object> result=diagnosaPasienService.findDiagnosaPasienByAntrian(noRec);
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 ));
Map<String, Object> result = diagnosaPasienService.findDiagnosaPasienByAntrian(noRec);
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);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when saveDiagnosaPasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
LOGGER.error("Got ServiceVOException {} when findDiagnosaPasienByAntrian", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveDiagnosaPasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
LOGGER.error("Got JpaSystemException {} when findDiagnosaPasienByAntrian", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
}