Update controller
Clean code
This commit is contained in:
parent
3e4c001ae8
commit
71a48a7dfe
@ -1,59 +1,54 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.dto.MapJenisDietToProdukDto;
|
||||
import com.jasamedika.medifirst2000.service.MapJenisDietToProdukService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/map-jenis-diet-to-produk")
|
||||
public class MapJenisDietToProdukController extends LocaleController{
|
||||
public class MapJenisDietToProdukController extends LocaleController<MapJenisDietToProdukDto> {
|
||||
|
||||
@Autowired
|
||||
private MapJenisDietToProdukService mapJenisDietToProdukService;
|
||||
|
||||
@RequestMapping(value="/get/",
|
||||
method=RequestMethod.GET,
|
||||
produces=MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> get(HttpServletRequest request) {
|
||||
Map<String, Object> result = this.mapJenisDietToProdukService.getMapJenisDietToProduk();
|
||||
return result;
|
||||
return this.mapJenisDietToProdukService.getMapJenisDietToProduk();
|
||||
}
|
||||
|
||||
@RequestMapping(value="/save/",
|
||||
method = RequestMethod.POST,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> save(
|
||||
@RequestBody List<MapJenisDietToProdukDto> dtos, HttpServletRequest request){
|
||||
|
||||
@RequestMapping(value = "/save/", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> save(@RequestBody List<MapJenisDietToProdukDto> dtos,
|
||||
HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = this.mapJenisDietToProdukService.saveMapJenisDietToProduk(dtos);
|
||||
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.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-produk-gizi/",
|
||||
method=RequestMethod.GET,
|
||||
produces=MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-produk-gizi/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getProdukGizi(HttpServletRequest request) {
|
||||
Map<String, Object> result = this.mapJenisDietToProdukService.getProdukGizi();
|
||||
return result;
|
||||
return this.mapJenisDietToProdukService.getProdukGizi();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,77 +1,63 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.base.vo.BaseModelVO;
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.dto.MapKebutuhanSaranaToKamarDto;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MapKebutuhanSaranaToKamarService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/map-kebutuhan-sarana-to-kamar")
|
||||
public class MapKebutuhanSaranaToKamarController extends LocaleController<BaseModelVO>{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MapKebutuhanSaranaToKamarController.class);
|
||||
|
||||
@Autowired
|
||||
public class MapKebutuhanSaranaToKamarController extends LocaleController<BaseModelVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(MapKebutuhanSaranaToKamarController.class);
|
||||
|
||||
@Autowired
|
||||
private MapKebutuhanSaranaToKamarService mapKebutuhanSaranaToKamarService;
|
||||
|
||||
@RequestMapping(value = "/save/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/save/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody MapKebutuhanSaranaToKamarDto dto,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.mapKebutuhanSaranaToKamarService.save(dto);
|
||||
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", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(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 save", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when save", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-all-data",
|
||||
method=RequestMethod.GET,
|
||||
produces=MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getAllData(@RequestParam("idKamar")Integer idKamar, HttpServletRequest request) {
|
||||
Map<String, Object> result = this.mapKebutuhanSaranaToKamarService.getDataAll(idKamar);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-data-by-id",
|
||||
method=RequestMethod.GET,
|
||||
produces=MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getDataById(@RequestParam("id")Integer id, HttpServletRequest request) {
|
||||
Map<String, Object> result = this.mapKebutuhanSaranaToKamarService.getDataById(id);
|
||||
return result;
|
||||
@RequestMapping(value = "/get-all-data", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getAllData(@RequestParam("idKamar") Integer idKamar, HttpServletRequest request) {
|
||||
return this.mapKebutuhanSaranaToKamarService.getDataAll(idKamar);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,103 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.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.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MapObjekModulToKelompokUserService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MapObjekModulToKelompokUserVO;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/map-objek-modul-to-kelompok-user")
|
||||
public class MapObjekModulToKelompokUserController extends LocaleController<MapObjekModulToKelompokUserVO> {
|
||||
|
||||
@Autowired
|
||||
private MapObjekModulToKelompokUserService mapObjekModulToKelompokUserService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(MapObjekModulToKelompokUserController.class);
|
||||
|
||||
@RequestMapping(value = "/save-map-objek-modul-to-kelompok-user/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody MapObjekModulToKelompokUserVO vo,HttpServletRequest request) {
|
||||
|
||||
try{
|
||||
Map<String, Object> result = mapObjekModulToKelompokUserService.addMapObjekModulToKelompokUser(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 mapObjekModulToKelompokUser", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add mapObjekModulToKelompokUser", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-map-objek-modul-to-kelompok-user/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody MapObjekModulToKelompokUserVO vo,HttpServletRequest request) {
|
||||
|
||||
try{
|
||||
Map<String, Object> result = mapObjekModulToKelompokUserService.updateMapObjekModulToKelompokUser(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 mapObjekModulToKelompokUser", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update mapObjekModulToKelompokUser", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-modul-by-kelompok-user/{kelompokUser}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> findModul(@PathVariable("kelompokUser") Integer kelompokUser,HttpServletRequest request) {
|
||||
Map<String,Object> result = mapObjekModulToKelompokUserService.findByKelompokUser(kelompokUser);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,128 +1,103 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MapPegawaiIpsrsService;
|
||||
import com.jasamedika.medifirst2000.vo.MapPegawaiIpsrsVO;
|
||||
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.MapPegawaiIpsrsService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MapPegawaiIpsrsVO;
|
||||
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.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/map-pegawai-ipsrs")
|
||||
public class MapPegawaiIpsrsController extends LocaleController<MapPegawaiIpsrsVO>{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MapPegawaiIpsrsController.class);
|
||||
|
||||
public class MapPegawaiIpsrsController extends LocaleController<MapPegawaiIpsrsVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(MapPegawaiIpsrsController.class);
|
||||
|
||||
@Autowired
|
||||
private MapPegawaiIpsrsService mapPegawaiIpsrsService;
|
||||
|
||||
@RequestMapping(
|
||||
value = "/save-map-pegawai-ipsrs",
|
||||
method = RequestMethod.POST,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE,
|
||||
consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveMapPegawaiIpsrs(
|
||||
@Valid @RequestBody List<MapPegawaiIpsrsVO> vos, HttpServletRequest request) {
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-map-pegawai-ipsrs", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveMapPegawaiIpsrs(@Valid @RequestBody List<MapPegawaiIpsrsVO> vos,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.mapPegawaiIpsrsService.saveMapPegawaiIpsrs(vos);
|
||||
|
||||
if (result != null)
|
||||
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 saveMapPegawaiIpsrs", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when saveMapPegawaiIpsrs", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
|
||||
LOGGER.error("Got exception {} when saveMapPegawaiIpsrs", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
LOGGER.error("Got JpaSystemException {} when saveMapPegawaiIpsrs", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "/get-list-pegawai-by-kategori",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getLoadDataByNoTrans(
|
||||
@RequestParam(value = "idJenis", required = true) Integer idJenis, HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/get-list-pegawai-by-kategori", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getLoadDataByNoTrans(@RequestParam(value = "idJenis") Integer idJenis,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.mapPegawaiIpsrsService.getListMapPegawaiIpsrsByJenis(idJenis);
|
||||
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} else {
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
|
||||
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when getLoadDataByNoTrans", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when getListMapPegawaiIpsrsByJenis", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getLoadDataByNoTrans", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got JpaSystemException {} when getListMapPegawaiIpsrsByJenis", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = "/get-group-pegawai-ipsrs",
|
||||
method = RequestMethod.GET,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getGroupPegawaiIpsrs(HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/get-group-pegawai-ipsrs", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getGroupPegawaiIpsrs(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.mapPegawaiIpsrsService.getGroupPegawaiIpsrs();
|
||||
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} else {
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage);
|
||||
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when getGroupPegawaiIpsrs", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when getGroupPegawaiIpsrs", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getGroupPegawaiIpsrs", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got JpaSystemException {} when getGroupPegawaiIpsrs", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,93 +1,83 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.text.ParseException;
|
||||
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.MapPegawaiJabatanToUnitKerjaService;
|
||||
import com.jasamedika.medifirst2000.vo.MapPegawaiJabatanToUnitKerjaVO;
|
||||
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.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MapPegawaiJabatanToUnitKerjaService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MapPegawaiJabatanToUnitKerjaVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.text.ParseException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/map-pegawai-jabatan-unitkerja")
|
||||
public class MapPegawaiJabatanToUnitKerjaController extends LocaleController<MapPegawaiJabatanToUnitKerjaVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(MapPegawaiJabatanToUnitKerjaController.class);
|
||||
|
||||
@Autowired
|
||||
private MapPegawaiJabatanToUnitKerjaService mapPegawaiJabatanToUnitKerjaService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MapPegawaiJabatanToUnitKerjaController.class);
|
||||
|
||||
@RequestMapping(value = "/save-map", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/save-map", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody List<MapPegawaiJabatanToUnitKerjaVO> vo,
|
||||
HttpServletRequest request) throws ParseException {
|
||||
try {
|
||||
Map<String, String> mapHeaderMessage = new HashMap<String, String>();
|
||||
Map<String, String> mapHeaderMessage = new HashMap<>();
|
||||
Map<String, Object> result = mapPegawaiJabatanToUnitKerjaService.save(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 Map", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(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 Map", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when save", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-map-by-pegawai/{id}", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/get-map-by-pegawai/{id}", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> getMapByPegawai(@PathVariable("id") Integer id) {
|
||||
return RestUtil.getJsonResponse(mapPegawaiJabatanToUnitKerjaService.findAllByPegawai(id), HttpStatus.OK);
|
||||
return getJsonResponse(mapPegawaiJabatanToUnitKerjaService.findAllByPegawai(id), OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-sub-unit-by-unit/{id}/{idUnit}", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String, Object>> getSubUnitByUnit(@PathVariable("id") Integer id,
|
||||
@PathVariable("idUnit") Integer idUnit) {
|
||||
return RestUtil.getJsonResponse(mapPegawaiJabatanToUnitKerjaService.findSubUnitByUnit(id, idUnit),
|
||||
HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-unit-by-pegawai/{id}", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/get-unit-by-pegawai/{id}", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> getSubUnitByUnit(@PathVariable("id") Integer id) {
|
||||
return RestUtil.getJsonResponse(mapPegawaiJabatanToUnitKerjaService.findUnitByPgw(id), HttpStatus.OK);
|
||||
return getJsonResponse(mapPegawaiJabatanToUnitKerjaService.findUnitByPgw(id), OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-unit-by-pegawai-jadwal/{id}", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/get-unit-by-pegawai-jadwal/{id}", method = GET)
|
||||
public ResponseEntity<List<Map<String, Object>>> getSubUnitByUnitJadwal(@PathVariable("id") Integer id) {
|
||||
return RestUtil.getJsonResponse(mapPegawaiJabatanToUnitKerjaService.findUnitByPgwJadwal(id), HttpStatus.OK);
|
||||
return getJsonResponse(mapPegawaiJabatanToUnitKerjaService.findUnitByPgwJadwal(id), OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-sub-unit-by-unit-jadwal/{id}/{idUnit}", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/get-sub-unit-by-unit-jadwal/{id}/{idUnit}", method = GET)
|
||||
public ResponseEntity<List<Map<String, Object>>> getSubUnitByUnitJadwal(@PathVariable("id") Integer id,
|
||||
@PathVariable("idUnit") Integer idUnit) {
|
||||
return RestUtil.getJsonResponse(mapPegawaiJabatanToUnitKerjaService.findSubUnitByUnitJadwal(id, idUnit),
|
||||
HttpStatus.OK);
|
||||
return getJsonResponse(mapPegawaiJabatanToUnitKerjaService.findSubUnitByUnitJadwal(id, idUnit), OK);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,68 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.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.MapPegawailaboratRadiologiService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MapPegawaiLaboratRadiologiVO;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/mappegawailaboratradiologi")
|
||||
public class MapPegawaiLaboratRadiologiController extends LocaleController<MapPegawaiLaboratRadiologiVO> {
|
||||
|
||||
@Autowired
|
||||
private MapPegawailaboratRadiologiService mapPegawailaboratRadiologiService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MapPegawaiLaboratRadiologiController.class);
|
||||
|
||||
@RequestMapping(value = "/save-map", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody List<MapPegawaiLaboratRadiologiVO> vo,
|
||||
HttpServletRequest request) throws ParseException {
|
||||
try {
|
||||
Map<String, String> mapHeaderMessage = new HashMap<String, String>();
|
||||
Map<String, Object> result = mapPegawailaboratRadiologiService.save(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 Map", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Map", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-map", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String, Object>> getMapByPegawai() {
|
||||
return RestUtil.getJsonResponse(mapPegawailaboratRadiologiService.findAll(), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@ -1,140 +1,50 @@
|
||||
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 org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.service.MapProdukMenuToBahanService;
|
||||
import com.jasamedika.medifirst2000.vo.MapProdukMenuToBahanVO;
|
||||
import com.jasamedika.medifirst2000.vo.PasienVO;
|
||||
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.entities.MapProdukMenuToBahan;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MapProdukMenuToBahanService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MapProdukMenuToBahanVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.CREATED;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value="/menu-to-bahan")
|
||||
public class MapProdukMenuToBahanController extends LocaleController<MapProdukMenuToBahanVO>
|
||||
implements IBaseRestController<MapProdukMenuToBahanVO>{
|
||||
@RequestMapping(value = "/menu-to-bahan")
|
||||
public class MapProdukMenuToBahanController extends LocaleController<MapProdukMenuToBahanVO> {
|
||||
|
||||
@Autowired
|
||||
private MapProdukMenuToBahanService mapService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(IndikatorRensarController.class);
|
||||
|
||||
|
||||
@RequestMapping(value="/find-all/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Collection<MapProdukMenuToBahan>> 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,
|
||||
@RequestParam(value = "menuId", required = true) Integer menuId)
|
||||
{
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
// result = mapService.findAll(page, take, sort,dir, spec);
|
||||
result = mapService.findAll(page, take, sort, dir, menuId);
|
||||
return constructListPageResult(result);
|
||||
@RequestParam(value = "menuId") Integer menuId) {
|
||||
Map<String, Object> result = mapService.findAll(page, take, sort, dir, menuId);
|
||||
return constructListPageResult(result);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-menu-gizi/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> findMenuGizi(
|
||||
HttpServletRequest request)
|
||||
{
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result = mapService.findMenuGizi();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-bahan-gizi/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> findBahanGizi(
|
||||
HttpServletRequest request)
|
||||
{
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result = mapService.findBahanGizi();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/save/", method= RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody List<MapProdukMenuToBahanVO> vo,HttpServletRequest request){
|
||||
try{
|
||||
Map<String, Object> result = mapService.save(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/update Menu To Bahan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add/update Menu To Bahan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<MapProdukMenuToBahanVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
@RequestMapping(value = "/get-menu-gizi/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> findMenuGizi(HttpServletRequest request) {
|
||||
Map<String, Object> result = mapService.findMenuGizi();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<MapProdukMenuToBahanVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(MapProdukMenuToBahanVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(MapProdukMenuToBahanVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<MapProdukMenuToBahanVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,211 +1,146 @@
|
||||
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.MapRuanganToKelas;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MapRuanganToKelasService;
|
||||
import com.jasamedika.medifirst2000.vo.MapRuanganToKelasVO;
|
||||
import com.jasamedika.medifirst2000.vo.MapRuanganToKelasVO_;
|
||||
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.util.rest.RestUtil;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.jasamedika.medifirst2000.service.MapRuanganToKelasService;
|
||||
import com.jasamedika.medifirst2000.vo.MapRuanganToKelasVO_;
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/mapRuanganToKelas")
|
||||
public class MapRuanganToKelasController extends LocaleController<MapRuanganToKelasVO_> implements
|
||||
IBaseRestController<MapRuanganToKelasVO_> {
|
||||
|
||||
public class MapRuanganToKelasController extends LocaleController<MapRuanganToKelasVO_> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(MapRuanganToKelasController.class);
|
||||
|
||||
@Autowired
|
||||
private MapRuanganToKelasService mapRuanganToKelasService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(MapRuanganToKelasController.class);
|
||||
private MapRuanganToKelasService<MapRuanganToKelas> mapRuanganToKelasService;
|
||||
|
||||
public ResponseEntity<Collection<MapRuanganToKelasVO_>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<MapRuanganToKelasVO_> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-map-ruangan-to-kelas", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/save-map-ruangan-to-kelas", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> addVO(@Valid @RequestBody MapRuanganToKelasVO_ vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
List<MapRuanganToKelasVO_> result = mapRuanganToKelasService.addVo(vo);
|
||||
|
||||
List<MapRuanganToKelasVO> result = mapRuanganToKelasService.addVo(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 Map Ruangan to Kelas", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when addVo", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Map Ruangan to Kelas", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when addVo", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-map-ruangan-to-kelas", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/update-map-ruangan-to-kelas", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> editVO(@Valid @RequestBody MapRuanganToKelasVO_ vo) {
|
||||
try {
|
||||
List<MapRuanganToKelasVO_> result = mapRuanganToKelasService.updateVo(vo);
|
||||
|
||||
List<MapRuanganToKelasVO> result = mapRuanganToKelasService.updateVo(vo);
|
||||
if (null != result)
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, "");
|
||||
RestUtil.getJsonHttpStatus(HttpStatus.CREATED);
|
||||
return RestUtil.getJsonResponse("", HttpStatus.CREATED);
|
||||
|
||||
addHeaderMessage(ERROR_MESSAGE, "");
|
||||
getJsonHttpStatus(CREATED);
|
||||
return getJsonResponse("", CREATED);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when update Map Ruangan to Kelas", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when updateVo", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update Map Ruangan to Kelas", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when updateVo", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/search-map-ruangan-to-kelas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Collection<MapRuanganToKelasVO_>> 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 = mapRuanganToKelasService.findAllWithPageAndLimitAndSortByAndDirectionParameter(page,
|
||||
limit, sort, dir);
|
||||
|
||||
return constructListPageResult(resultPageMap);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/delete-mapRuanganToKelas/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
try {
|
||||
if (mapRuanganToKelasService.delete(id) == true)
|
||||
return RestUtil.getJsonResponse("", HttpStatus.CREATED);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when delete MapRuanganToKelas", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when delete MapRuanganToKelas", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.NOT_ACCEPTABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<MapRuanganToKelasVO_>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(MapRuanganToKelasVO_ vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-ruangan-by-kelas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/get-ruangan-by-kelas", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getRuanganByRuangan(
|
||||
@RequestParam(value="kelasId",required = false) Integer kelasId, HttpServletRequest request) {
|
||||
@RequestParam(value = "kelasId", required = false) Integer kelasId, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = mapRuanganToKelasService.getRuanganByKelas(kelasId);
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
} else{
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
|
||||
Map<String, Object> result = mapRuanganToKelasService.getRuanganByKelas(kelasId);
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} else {
|
||||
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when getRuanganByRuangan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getRuanganByKelas", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getRuanganByRuangan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getRuanganByKelas", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-kelas-by-ruangan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-kelas-by-ruangan", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getKelasByRuangan(
|
||||
@RequestParam(value="ruanganId",required = false) Integer ruanganId, HttpServletRequest request) {
|
||||
@RequestParam(value = "ruanganId", required = false) Integer ruanganId, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = mapRuanganToKelasService.getKelasByRuangan(ruanganId);
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
} else{
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
|
||||
Map<String, Object> result = mapRuanganToKelasService.getKelasByRuangan(ruanganId);
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} else {
|
||||
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when getKelasByRuangan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getKelasByRuangan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getKelasByRuangan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getKelasByRuangan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-kamar-by-kelas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@RequestMapping(value = "/get-kamar-by-kelas", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getKamarByKelas(
|
||||
@RequestParam(value="kelasId",required = false) Integer kelasId,
|
||||
@RequestParam(value="ruanganId",required = false) Integer ruanganId, HttpServletRequest request) {
|
||||
@RequestParam(value = "kelasId", required = false) Integer kelasId,
|
||||
@RequestParam(value = "ruanganId", required = false) Integer ruanganId, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = mapRuanganToKelasService.getKamarByKelas(kelasId, ruanganId);
|
||||
if (null != result){
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
} else{
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND,mapHeaderMessage);
|
||||
Map<String, Object> result = mapRuanganToKelasService.getKamarByKelas(kelasId, ruanganId);
|
||||
if (null != result) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} else {
|
||||
return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when getKamarByKelas", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getKamarByKelas", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when getKamarByKelas", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getKamarByKelas", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,185 +1,64 @@
|
||||
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.MappingAlatToBundleService;
|
||||
import com.jasamedika.medifirst2000.vo.MappingAlatToBundleVO;
|
||||
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.MappingAlatToBundleService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MappingAlatToBundleVO;
|
||||
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.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/mapping-alat-to-bundle")
|
||||
public class MappingAlatToBundleController extends LocaleController<MappingAlatToBundleVO> implements IBaseRestController<MappingAlatToBundleVO>{
|
||||
|
||||
public class MappingAlatToBundleController extends LocaleController<MappingAlatToBundleVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(MappingAlatToBundleController.class);
|
||||
|
||||
@Autowired
|
||||
private MappingAlatToBundleService mappingAlatToBundleService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(MappingAlatToBundleController.class);
|
||||
|
||||
@RequestMapping(value = "/save-mapping-alat-to-bundle/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody MappingAlatToBundleVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=mappingAlatToBundleService.addMappingAlatToBundle(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 Mapping Alat To Bundle", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Mapping Alat To Bundle", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-mapping-alat-to-bundle/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody MappingAlatToBundleVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=mappingAlatToBundleService.updateMappingAlatToBundle(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 Mapping Alat To Bundle", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Mapping Alat To Bundle", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-all-mapping-alat-to-bundle/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=mappingAlatToBundleService.findAllMappingAlatToBundle();
|
||||
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 Mapping Alat To Bundle", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get all Mapping Alat To Bundle", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-all-mapping-alat-to-bundle/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> saveAllVO(@Valid @RequestBody List<MappingAlatToBundleVO> vos, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=mappingAlatToBundleService.saveAllMappingAlatToBundle(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 Jadwal Supir Ambulance", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add all Jadwal Supir Ambulance", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-mesin-all",
|
||||
method=RequestMethod.GET,
|
||||
produces=MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getMesinAll(HttpServletRequest request) {
|
||||
Map<String, Object> result = this.mappingAlatToBundleService.getMesinAll();
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-bundle-set-alat-by-id",
|
||||
method=RequestMethod.GET,
|
||||
produces=MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getBundleSetAlatbyId(
|
||||
@RequestParam("idBundle")Integer idBundle,
|
||||
|
||||
@RequestMapping(value = "/save-all-mapping-alat-to-bundle/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveAllVO(@Valid @RequestBody List<MappingAlatToBundleVO> vos,
|
||||
HttpServletRequest request) {
|
||||
Map<String, Object> result = this.mappingAlatToBundleService.getMappingAlatToBundleById(idBundle);
|
||||
return result;
|
||||
try {
|
||||
Map<String, Object> result = mappingAlatToBundleService.saveAllMappingAlatToBundle(vos);
|
||||
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 saveAllMappingAlatToBundle", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when saveAllMappingAlatToBundle", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<MappingAlatToBundleVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<MappingAlatToBundleVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(MappingAlatToBundleVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(MappingAlatToBundleVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<MappingAlatToBundleVO>> getAllVO() {
|
||||
return null;
|
||||
@RequestMapping(value = "/get-mesin-all", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getMesinAll(HttpServletRequest request) {
|
||||
return this.mappingAlatToBundleService.getMesinAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,165 +1,85 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.dto.MapAlatToProdukToBhpDto;
|
||||
import com.jasamedika.medifirst2000.service.MappingBahanToMesinService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MapAlatToProdukToBhpVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value="/map-bahan-to-mesin")
|
||||
public class MappingBahanToMesinController extends LocaleController<MapAlatToProdukToBhpVO>{
|
||||
@RequestMapping(value = "/map-bahan-to-mesin")
|
||||
public class MappingBahanToMesinController extends LocaleController<MapAlatToProdukToBhpVO> {
|
||||
|
||||
@Autowired
|
||||
private MappingBahanToMesinService mappingBahanToMesinService;
|
||||
|
||||
@RequestMapping(value="/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String,Object>>> save(@RequestBody List<MapAlatToProdukToBhpDto> dtos,
|
||||
|
||||
@RequestMapping(value = "/save", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> save(@RequestBody List<MapAlatToProdukToBhpDto> dtos,
|
||||
HttpServletRequest request) {
|
||||
List<Map<String,Object>> result = mappingBahanToMesinService.saveMappingBahanToMesin(dtos);
|
||||
List<Map<String, Object>> result = mappingBahanToMesinService.saveMappingBahanToMesin(dtos);
|
||||
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.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> get(
|
||||
@RequestParam(value="idMappingBahanToMesin", required = true) Integer idMappingBahanToMesin,
|
||||
HttpServletRequest request) {
|
||||
Map<String, Object> result = mappingBahanToMesinService.getById(idMappingBahanToMesin);
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-all", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getAll(
|
||||
HttpServletRequest request) {
|
||||
@RequestMapping(value = "/get-all", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getAll(HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = mappingBahanToMesinService.getAll();
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
if (result != null) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-all-mesin-cuci", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getAllMesinCuci(
|
||||
HttpServletRequest request) {
|
||||
@RequestMapping(value = "/get-all-mesin-cuci", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getAllMesinCuci(HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = mappingBahanToMesinService.findMesinCuci();
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
if (result != null) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-all-proses-cuci", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getAllProcessCuci(
|
||||
HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = mappingBahanToMesinService.findProsesCuci();
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-kapasitas-mesin-cuci", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getKapasitasMesinCuci(
|
||||
@RequestParam(value="alatId", required = true) Integer alatId,
|
||||
HttpServletRequest request) {
|
||||
Map<String, Object> result = mappingBahanToMesinService.findKapasitasMesinCuci(alatId);
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-all-bahan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getKomponenHargaByJenis(
|
||||
HttpServletRequest request) {
|
||||
@RequestMapping(value = "/get-all-bahan", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getKomponenHargaByJenis(HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = mappingBahanToMesinService.findBahanCuci();
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
if (result != null) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-satuan-bahan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getSatuanBahan(
|
||||
HttpServletRequest request) {
|
||||
@RequestMapping(value = "/get-satuan-bahan", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getSatuanBahan(HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = mappingBahanToMesinService.findSatuanBahan();
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
if (result != null) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-all-proses-cuci-cuci", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getAllProcessCuciCuci(
|
||||
HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = mappingBahanToMesinService.findProsesCuciCuci();
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-all-proses-cuci-bilas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getAllProcessCuciBilas(
|
||||
HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = mappingBahanToMesinService.findProsesCuciBilas();
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-all-proses-cuci-kering", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getAllProcessCuciKering(
|
||||
HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = mappingBahanToMesinService.findProsesCuciKering();
|
||||
|
||||
if (result!=null) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,170 +1,64 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
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.entities.MappingBmhpToSetAlat;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MappingBmhpToSetAlatService;
|
||||
import com.jasamedika.medifirst2000.vo.MappingBmhpToSetAlatVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.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.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.MappingBmhpToSetAlatService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MappingBmhpToSetAlatVO;
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/mapping-bmhp-to-set-alat")
|
||||
public class MappingBmhpToSetAlatController extends LocaleController<MappingBmhpToSetAlatVO> {
|
||||
|
||||
|
||||
private static final Logger LOGGER = getLogger(MappingBmhpToSetAlatController.class);
|
||||
|
||||
@Autowired
|
||||
private MappingBmhpToSetAlatService mappingBmhpToSetAlatService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(MappingBmhpToSetAlatController.class);
|
||||
|
||||
@RequestMapping(value = "/save-all-mapping-bmhp-to-set-alat/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVOS(@Valid @RequestBody List<MappingBmhpToSetAlatVO> vos,HttpServletRequest request) {
|
||||
|
||||
try{
|
||||
Map<String, Object> result = mappingBmhpToSetAlatService.addMappingBmhpToSetAlats(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 MappingBmhpToSetAlat", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add MappingBmhpToSetAlat", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-mapping-bmhp-to-set-alat/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody MappingBmhpToSetAlatVO vo,HttpServletRequest request) {
|
||||
|
||||
try{
|
||||
Map<String, Object> result = mappingBmhpToSetAlatService.addMappingBmhpToSetAlat(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 MappingBmhpToSetAlat", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add MappingBmhpToSetAlat", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-all-mapping-bmhp-to-set-alat/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> updateVOS(@Valid @RequestBody List<MappingBmhpToSetAlatVO> vos,HttpServletRequest request) {
|
||||
|
||||
try{
|
||||
Map<String, Object> result = mappingBmhpToSetAlatService.addMappingBmhpToSetAlats(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 update MappingBmhpToSetAlat", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update MappingBmhpToSetAlat", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-mapping-bmhp-to-set-alat/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody MappingBmhpToSetAlatVO vo,HttpServletRequest request) {
|
||||
|
||||
try{
|
||||
Map<String, Object> result = mappingBmhpToSetAlatService.updateMappingBmhpToSetAlat(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 MappingBmhpToSetAlat", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update MappingBmhpToSetAlat", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-all-mapping-bmhp-to-set-alat/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=mappingBmhpToSetAlatService.findAllMappingBmhpToSetAlat();
|
||||
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 mapping bmhp to set alat", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when get mapping bmhp to set alat", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/get-bundle-set-bmhp-by-id",
|
||||
method=RequestMethod.GET,
|
||||
produces=MediaType.APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getBundleSetAlatbyId(
|
||||
@RequestParam("idBundle")Integer idBundle,
|
||||
private MappingBmhpToSetAlatService<MappingBmhpToSetAlat> mappingBmhpToSetAlatService;
|
||||
|
||||
@RequestMapping(value = "/save-all-mapping-bmhp-to-set-alat/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> addVOS(@Valid @RequestBody List<MappingBmhpToSetAlatVO> vos,
|
||||
HttpServletRequest request) {
|
||||
Map<String, Object> result = this.mappingBmhpToSetAlatService.getMappingBmhhpToSetAlatByBundle(idBundle);
|
||||
return result;
|
||||
try {
|
||||
Map<String, Object> result = mappingBmhpToSetAlatService.addMappingBmhpToSetAlats(vos);
|
||||
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 addMappingBmhpToSetAlats", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when addMappingBmhpToSetAlats", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-bundle-set-bmhp-by-id", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public Map<String, Object> getBundleSetAlatbyId(@RequestParam("idBundle") Integer idBundle,
|
||||
HttpServletRequest request) {
|
||||
return this.mappingBmhpToSetAlatService.getMappingBmhhpToSetAlatByBundle(idBundle);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,161 +1,131 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.dto.MappingCycleDto;
|
||||
import com.jasamedika.medifirst2000.dto.MesinDto;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MappingCycleService;
|
||||
import com.jasamedika.medifirst2000.vo.MappingCycleVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import 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.MappingCycleDto;
|
||||
import com.jasamedika.medifirst2000.dto.MesinDto;
|
||||
import com.jasamedika.medifirst2000.entities.MappingCycle;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MappingCycleService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MappingCycleVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/mapping-cycle")
|
||||
public class MappingCycleController extends LocaleController<MappingCycleVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(MappingCycleController.class);
|
||||
|
||||
@Autowired
|
||||
private MappingCycleService mappingCycleService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MappingCycleController.class);
|
||||
|
||||
@RequestMapping(value = "/save-mapping-cycle/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "/save-mapping-cycle/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveMappingCycle(@Valid @RequestBody MappingCycleVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = mappingCycleService.saveMappingCycle(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 Mapping Cycle", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveMappingCycle", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when save Mapping Cycle", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveMappingCycle", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-nama-bahan/", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/find-nama-bahan/", method = GET)
|
||||
public ResponseEntity<List<MappingCycleDto>> findProdukByKelompokProduk(HttpServletRequest request) {
|
||||
try {
|
||||
List<MappingCycleDto> listNamaBahanVO = mappingCycleService.findNamaBahan();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(listNamaBahanVO, HttpStatus.OK, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(listNamaBahanVO, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when Find Nama Bahan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when findNamaBahan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when Find Nama Bahan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when findNamaBahan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/find-mesin-dengan-kapasitas/", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/find-mesin-dengan-kapasitas/", method = GET)
|
||||
public ResponseEntity<List<MesinDto>> findMesinDenganKapasitas(HttpServletRequest request) {
|
||||
try {
|
||||
List<MesinDto> listMesinVO = mappingCycleService.findMesinDenganKapasitas();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(listMesinVO, HttpStatus.OK, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(listMesinVO, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when Find Mesin", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when findMesinDenganKapasitas", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when Find Mesin", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when findMesinDenganKapasitas", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value="/find-all/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public Map<String,Object> findAll(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "100") Integer take,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "noRec") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@Spec(path = "noRec", params = "noRec", spec = Equal.class) Specification<MappingCycle> spec,
|
||||
HttpServletRequest request)
|
||||
|
||||
{
|
||||
Map<String, Object> resultPageMap = mappingCycleService.findAll(page, take, sort, dir);
|
||||
return resultPageMap;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-all/", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/get-all/", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> getAll(HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.mappingCycleService.getMappingCycle();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when Find Mesin", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getMappingCycle", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when Find Mesin", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getMappingCycle", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-mapping-cycle-by-norec/", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String, Object>> getAll(@RequestParam(value="noRec", required = true) String noRec, HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/get-mapping-cycle-by-norec/", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> getAll(@RequestParam(value = "noRec") String noRec,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = this.mappingCycleService.getMappingCycleByNoRec(noRec);
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when Find Mesin", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getMappingCycleByNoRec", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when Find Mesin", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getMappingCycleByNoRec", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,58 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.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.MappingDiagnosaKeperawatanService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MappingDiagnosaKeperawatanVO;
|
||||
import com.jasamedika.medifirst2000.vo.RencanaCustomVO;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/mapping-diagnosa-keperawatan")
|
||||
public class MappingDiagnosaKeperawatanController extends LocaleController<RencanaCustomVO> {
|
||||
|
||||
@Autowired
|
||||
private MappingDiagnosaKeperawatanService service;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MappingDiagnosaKeperawatanController.class);
|
||||
|
||||
@RequestMapping(value = "/save-mapping-diagnosa-keperawatan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> saveMappingDiagnosaKeperawatan(@Valid @RequestBody MappingDiagnosaKeperawatanVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.saveMappingDiagnosaKeperawatan(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 saveRencana", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveRencana", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,95 +1,54 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.dto.MappingJenisLinenToProdukDto;
|
||||
import com.jasamedika.medifirst2000.service.MappingJenisLinenToProdukService;
|
||||
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.dto.MappingJenisLinenToProdukDto;
|
||||
import com.jasamedika.medifirst2000.service.MappingJenisLinenToProdukService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/mapping-jenis-linen-to-produk")
|
||||
public class MappingJenisLinenToProdukController extends LocaleController<RegistrasiPelayananVO>
|
||||
implements IBaseRestController<RegistrasiPelayananVO> {
|
||||
|
||||
public class MappingJenisLinenToProdukController extends LocaleController<RegistrasiPelayananVO> {
|
||||
|
||||
@Autowired
|
||||
private MappingJenisLinenToProdukService mappingJenisLinenToProdukService;
|
||||
|
||||
|
||||
@RequestMapping(value="/save-bahan-baku-by-jenislinen/",
|
||||
method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> saveMasterBahanBaku(
|
||||
@RequestBody List<MappingJenisLinenToProdukDto> dto,
|
||||
HttpServletRequest request) {
|
||||
List<Map<String,Object>> result = mappingJenisLinenToProdukService.saveBahanBaku(dto);
|
||||
if (!result.isEmpty()) {
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
|
||||
}
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
|
||||
@RequestMapping(value = "/save-bahan-baku-by-jenislinen/", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> saveMasterBahanBaku(
|
||||
@RequestBody List<MappingJenisLinenToProdukDto> dto, HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = mappingJenisLinenToProdukService.saveBahanBaku(dto);
|
||||
if (!result.isEmpty()) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
}
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@RequestMapping(value = "/get-all-master-bahanbaku-by-linen")
|
||||
public Map<String,Object> getAllDaftarMasterBahanBakuByLinen(
|
||||
public Map<String, Object> getAllDaftarMasterBahanBakuByLinen(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "100") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "a.id") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir) {
|
||||
|
||||
Map<String, Object> resultPageMap = mappingJenisLinenToProdukService.getAllDaftarMasterBahanBakuByLinen(page, limit, sort, dir);
|
||||
|
||||
return resultPageMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<RegistrasiPelayananVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<RegistrasiPelayananVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(RegistrasiPelayananVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(RegistrasiPelayananVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<RegistrasiPelayananVO>> getAllVO() {
|
||||
return null;
|
||||
return mappingJenisLinenToProdukService.getAllDaftarMasterBahanBakuByLinen(page, limit, sort, dir);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,118 +1,78 @@
|
||||
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.MappingJenisRisikoSasaranStrategis;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MappingJenisRisikoSasaranStrategisService;
|
||||
import com.jasamedika.medifirst2000.vo.MappingJenisRisikoSasaranStrategisVO;
|
||||
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.MappingJenisRisikoSasaranStrategis;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MappingJenisRisikoSasaranStrategisService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MappingJenisRisikoSasaranStrategisVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/jenis-risiko-sasaran-strategis")
|
||||
public class MappingJenisRisikoSasaranStrategisController extends LocaleController<MappingJenisRisikoSasaranStrategisVO>
|
||||
implements IBaseRestController<MappingJenisRisikoSasaranStrategisVO>{
|
||||
public class MappingJenisRisikoSasaranStrategisController
|
||||
extends LocaleController<MappingJenisRisikoSasaranStrategisVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(MappingJenisRisikoSasaranStrategisController.class);
|
||||
|
||||
@Autowired
|
||||
private MappingJenisRisikoSasaranStrategisService mappingService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(IndikatorRensarController.class);
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<MappingJenisRisikoSasaranStrategisVO>> getAllVOWithQueryString(
|
||||
HttpServletRequest request, Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<MappingJenisRisikoSasaranStrategisVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(MappingJenisRisikoSasaranStrategisVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(MappingJenisRisikoSasaranStrategisVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<MappingJenisRisikoSasaranStrategisVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/find-all/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Collection<MappingJenisRisikoSasaranStrategis>> 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<MappingJenisRisikoSasaranStrategis> spec)
|
||||
{
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result = mappingService.findAll(page, take, sort,dir, spec);
|
||||
return constructListPageResult(result);
|
||||
@Spec(path = "id", params = "id", spec = Equal.class) Specification<MappingJenisRisikoSasaranStrategis> spec) {
|
||||
Map<String, Object> result = mappingService.findAll(page, take, sort, dir, spec);
|
||||
return constructListPageResult(result);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/save/", method= RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody List<MappingJenisRisikoSasaranStrategisVO> vos,HttpServletRequest request){
|
||||
try{
|
||||
@RequestMapping(value = "/save/", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody List<MappingJenisRisikoSasaranStrategisVO> vos,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = mappingService.save(vos);
|
||||
if(null!= result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add/update Risiko", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(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 Risiko", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when save", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,162 +1,58 @@
|
||||
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.MappingPertanyaanToKeteranganService;
|
||||
import com.jasamedika.medifirst2000.vo.MappingPertanyaanToKeteranganVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MappingPertanyaanToKeteranganService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MappingPertanyaanToKeteranganVO;
|
||||
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.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/mapping-pertanyaan")
|
||||
public class MappingPertanyaanToKeteranganController extends LocaleController<MappingPertanyaanToKeteranganVO> implements IBaseRestController<MappingPertanyaanToKeteranganVO> {
|
||||
|
||||
public class MappingPertanyaanToKeteranganController extends LocaleController<MappingPertanyaanToKeteranganVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(MappingPertanyaanToKeteranganController.class);
|
||||
|
||||
@Autowired
|
||||
private MappingPertanyaanToKeteranganService service;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(MappingPertanyaanToKeteranganController.class);
|
||||
|
||||
@RequestMapping(value = "/save-mapping-pertanyaan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody MappingPertanyaanToKeteranganVO vo, HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/save-all-mapping-pertanyaan/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> addAllVO(@Valid @RequestBody List<MappingPertanyaanToKeteranganVO> vos,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=service.addMappingPertanyaan(vo);
|
||||
Map<String, Object> result = service.addAllMappingPertanyaan(vos);
|
||||
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 Sasaran Strategis", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when addAllMappingPertanyaan", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Sasaran Strategis", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when addAllMappingPertanyaan", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-all-mapping-pertanyaan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addAllVO(@Valid @RequestBody List<MappingPertanyaanToKeteranganVO> vos, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=service.addAllMappingPertanyaan(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 Sasaran Strategis", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Sasaran Strategis", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/update-jumlah/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> updateJumlah(@Valid @RequestBody List<MappingPertanyaanToKeteranganVO> vos, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=service.updateJumlahSurvey(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 Sasaran Strategis", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Sasaran Strategis", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-all/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getAll(HttpServletRequest request) {
|
||||
Map<String, Object> result = null;
|
||||
try{
|
||||
result = service.findAllMappingPertanyaan();
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<MappingPertanyaanToKeteranganVO>> getAllVOWithQueryString(
|
||||
HttpServletRequest request, Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<MappingPertanyaanToKeteranganVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(MappingPertanyaanToKeteranganVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(MappingPertanyaanToKeteranganVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<MappingPertanyaanToKeteranganVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,67 +1,65 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MasalahKeperawatanService;
|
||||
import com.jasamedika.medifirst2000.vo.MasalahKeperawatanVO;
|
||||
import com.jasamedika.medifirst2000.vo.TriaseVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MasalahKeperawatanService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MasalahKeperawatanVO;
|
||||
import com.jasamedika.medifirst2000.vo.TriaseVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
/******************
|
||||
* @author Shakato
|
||||
******************/
|
||||
@RestController
|
||||
@RequestMapping("/masalah-keperawatan")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class MasalahKeperawatanController extends LocaleController<TriaseVO>{
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class MasalahKeperawatanController extends LocaleController<TriaseVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(MasalahKeperawatanController.class);
|
||||
|
||||
@Autowired
|
||||
private MasalahKeperawatanService masalahKeperawatanService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MasalahKeperawatanController.class);
|
||||
|
||||
@RequestMapping(value = "/save-masalah-keperawatan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> saveMasalahKeperawatan(@Valid @RequestBody MasalahKeperawatanVO vo, HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/save-masalah-keperawatan", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> saveMasalahKeperawatan(@Valid @RequestBody MasalahKeperawatanVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = masalahKeperawatanService.saveMasalahKeperawatanService(vo);
|
||||
Map<String, Object> result = masalahKeperawatanService.saveMasalahKeperawatanService(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
RestUtil.getJsonHttpStatus(HttpStatus.CREATED);
|
||||
SaveLog("Masalah Keperawatan", "Pemeriksaan",request);
|
||||
return RestUtil.getJsonResponse("Status Sukses", HttpStatus.CREATED,mapHeaderMessage);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
getJsonHttpStatus(CREATED);
|
||||
SaveLog("Masalah Keperawatan", "Pemeriksaan", request);
|
||||
return getJsonResponse("Status Sukses", CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when save masalah keperawatan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveMasalahKeperawatanService", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update masalah keperawatan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveMasalahKeperawatanService", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,118 +1,76 @@
|
||||
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.MasterProgramKerjaStrategis;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MasterProgramKerjaStrategisService;
|
||||
import com.jasamedika.medifirst2000.vo.MasterProgramKerjaStrategisVO;
|
||||
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.MasterProgramKerjaStrategis;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MasterProgramKerjaStrategisService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MasterProgramKerjaStrategisVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/master-program-kerja-strategis")
|
||||
public class MasterProgramKerjaStrategisController extends LocaleController<MasterProgramKerjaStrategisVO>
|
||||
implements IBaseRestController<MasterProgramKerjaStrategisVO>{
|
||||
public class MasterProgramKerjaStrategisController extends LocaleController<MasterProgramKerjaStrategisVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(MasterProgramKerjaStrategisController.class);
|
||||
|
||||
@Autowired
|
||||
private MasterProgramKerjaStrategisService programService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(PegawaiController.class);
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<MasterProgramKerjaStrategisVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<MasterProgramKerjaStrategisVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(MasterProgramKerjaStrategisVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(MasterProgramKerjaStrategisVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<MasterProgramKerjaStrategisVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/find-all/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Collection<MasterProgramKerjaStrategis>> 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<MasterProgramKerjaStrategis> spec)
|
||||
{
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result = programService.findAll(page, take, sort,dir, spec);
|
||||
return constructListPageResult(result);
|
||||
@Spec(path = "id", params = "id", spec = Equal.class) Specification<MasterProgramKerjaStrategis> spec) {
|
||||
Map<String, Object> result = programService.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 MasterProgramKerjaStrategisVO vo,HttpServletRequest request){
|
||||
try{
|
||||
@RequestMapping(value = "/save/", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody MasterProgramKerjaStrategisVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = programService.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 programKerjaStrategis", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(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 programKerjaStrategis", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when save", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,74 +1,59 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MasukKamarService;
|
||||
import com.jasamedika.medifirst2000.vo.MasukKamarVO;
|
||||
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.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.JadwalDpjpRawatInapService;
|
||||
import com.jasamedika.medifirst2000.service.MasukKamarService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MasukKamarVO;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/masuk-kamar")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class MasukKamarController extends LocaleController<MasukKamarVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(MasukKamarController.class);
|
||||
|
||||
@Autowired
|
||||
private MasukKamarService masukKamarService;
|
||||
|
||||
@Autowired
|
||||
private JadwalDpjpRawatInapService service;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(MasukKamarController.class);
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-masuk-kamar", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> savePasienFromRegistrasiPasienGawatDarurat(@Valid @RequestBody MasukKamarVO vo,HttpServletRequest request) {
|
||||
@RequestMapping(value = "/save-masuk-kamar", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> savePasienFromRegistrasiPasienGawatDarurat(
|
||||
@Valid @RequestBody MasukKamarVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=masukKamarService.saveMasukKamar(vo);
|
||||
Map<String, Object> result = masukKamarService.saveMasukKamar(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 Masuk Kamar", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveMasukKamar", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Masuk kamar", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveMasukKamar", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-jadwal-dpjp")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> getLoadDataDpjp(
|
||||
@RequestParam(value = "id", required = false) Integer id) {
|
||||
return service.getJadwalDpjpByRuangan(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -9,16 +9,17 @@ import net.kaczmarzyk.spring.data.jpa.domain.Equal;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
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 java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/matriks-indikator")
|
||||
public class MatriksIndikatorController extends LocaleController<KontrakKinerjaVO> {
|
||||
@ -26,7 +27,7 @@ public class MatriksIndikatorController extends LocaleController<KontrakKinerjaV
|
||||
@Autowired
|
||||
private MatriksIndikatorService matriksService;
|
||||
|
||||
@RequestMapping(value = "/find-all/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@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,
|
||||
|
||||
@ -1,112 +1,66 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MenuService;
|
||||
import com.jasamedika.medifirst2000.vo.ProdukVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.MenuService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.ProdukVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value="/menu")
|
||||
public class MenuController extends LocaleController<ProdukVO>
|
||||
implements IBaseRestController<ProdukVO>{
|
||||
@RequestMapping(value = "/menu")
|
||||
public class MenuController extends LocaleController<ProdukVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(MenuController.class);
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(MenuController.class);
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<ProdukVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
|
||||
@RequestMapping(value = "/find-all/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getOrderGizi(HttpServletRequest request) {
|
||||
Map<String, Object> result = menuService.findAllMenu();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<ProdukVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(ProdukVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(ProdukVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<ProdukVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/find-all/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getOrderGizi(
|
||||
HttpServletRequest request)
|
||||
{
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
result = menuService.findAllMenu();
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/save/", method= RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getOrderGizi(
|
||||
@Valid @RequestBody ProdukVO vo,
|
||||
HttpServletRequest request)
|
||||
{
|
||||
try{
|
||||
@RequestMapping(value = "/save/", method = POST, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getOrderGizi(@Valid @RequestBody ProdukVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = menuService.saveMenu(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 save Menu", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
LOGGER.error("Got ServiceVOException {} when saveMenu", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when save Menu", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveMenu", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,211 +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 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.web.bind.annotation.PathVariable;
|
||||
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.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.dao.LoginUserDao;
|
||||
import com.jasamedika.medifirst2000.dao.RuanganDao;
|
||||
import com.jasamedika.medifirst2000.entities.LoginUser;
|
||||
import com.jasamedika.medifirst2000.entities.Pegawai;
|
||||
import com.jasamedika.medifirst2000.logging.hibernate.async.LoggingSystemAsynchronous;
|
||||
import com.jasamedika.medifirst2000.service.LoginUserService;
|
||||
import com.jasamedika.medifirst2000.service.MapLoginUserToRuanganService;
|
||||
import com.jasamedika.medifirst2000.service.MapPegawaiToModulAplikasiService;
|
||||
import com.jasamedika.medifirst2000.service.ModulAplikasiService;
|
||||
import com.jasamedika.medifirst2000.service.ObjekModulAplikasiService;
|
||||
import com.jasamedika.medifirst2000.service.PegawaiService;
|
||||
import com.jasamedika.medifirst2000.util.CommonUtil;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.MapLoginUserToRuanganVO;
|
||||
import com.jasamedika.medifirst2000.vo.MapPegawaiToModulAplikasiVO;
|
||||
import com.jasamedika.medifirst2000.vo.ModulAplikasiSVO;
|
||||
import com.jasamedika.medifirst2000.vo.ModulAplikasiVO;
|
||||
import com.jasamedika.medifirst2000.vo.ObjekModulAplikasiVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.util.CommonUtil.isNotNullOrEmpty;
|
||||
import static com.jasamedika.medifirst2000.util.CommonUtil.isNullOrEmpty;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.defaultJsonResponse;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
import static org.springframework.http.HttpStatus.UNAUTHORIZED;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
|
||||
/**
|
||||
* Controller class for menu modul
|
||||
*
|
||||
* @author Syamsu
|
||||
*/
|
||||
* Controller class for menu modul
|
||||
*
|
||||
* @author Syamsu
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/test-tanpa-auth/modul-aplikasi", "/modul-aplikasi"})
|
||||
public class MenuDinamicController extends LocaleController<ModulAplikasiSVO> implements IBaseRestController<ModulAplikasiSVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MenuDinamicController.class);
|
||||
|
||||
@RequestMapping("/modul-aplikasi")
|
||||
public class MenuDinamicController extends LocaleController<ModulAplikasiSVO> {
|
||||
|
||||
private static final Logger LOGGER = getLogger(MenuDinamicController.class);
|
||||
|
||||
@Autowired
|
||||
ModulAplikasiService<ModulAplikasiVO> modulAplikasiService;
|
||||
|
||||
|
||||
@Autowired
|
||||
ObjekModulAplikasiService<ObjekModulAplikasiVO> objekModulAplikasiService;
|
||||
|
||||
|
||||
@Autowired
|
||||
MapLoginUserToRuanganService<MapLoginUserToRuanganVO> mapLoginUserToRuanganService;
|
||||
|
||||
|
||||
@Autowired
|
||||
LoggingSystemAsynchronous loggingSystemAsynchronous;
|
||||
|
||||
@Autowired
|
||||
MapPegawaiToModulAplikasiService<MapPegawaiToModulAplikasiVO> mapPegawaiToModulAplikasiService;
|
||||
|
||||
|
||||
@Autowired
|
||||
LoginUserService loginUserService;
|
||||
|
||||
@Autowired
|
||||
PegawaiService pegawaiService;
|
||||
|
||||
@Autowired
|
||||
private LoginUserDao loginUserDao;
|
||||
|
||||
@Autowired
|
||||
RuanganDao ruanganDao;
|
||||
|
||||
@RequestMapping(value="/keluar-ruangan/{modulaplikasiId:[0-9]+}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> keluarRuangan(@PathVariable("modulaplikasiId") int modulaplikasiId, HttpServletRequest request){
|
||||
try{
|
||||
|
||||
@RequestMapping(value = "/keluar-ruangan/{modulaplikasiId:[0-9]+}", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> keluarRuangan(@PathVariable("modulaplikasiId") int modulaplikasiId,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
LoginUser loginUser = loginUserService.getLoginUser();
|
||||
Integer idPegawai = 0;
|
||||
if (CommonUtil.isNotNullOrEmpty(loginUser.getPegawai())){
|
||||
if (isNotNullOrEmpty(loginUser.getPegawai()))
|
||||
idPegawai = loginUser.getPegawai().getId();
|
||||
}
|
||||
loggingSystemAsynchronous.saveSignInLog(modulaplikasiId, 0, loginUser.getNamaUser(), idPegawai);
|
||||
Pegawai pegawai = loginUser.getPegawai();
|
||||
return RestUtil.defaultJsonResponse(pegawai);
|
||||
}catch(Exception e){
|
||||
LOGGER.info("Got exception {} in get objek modul aplikasi", e);
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, "Gagal pilih ruangan.");
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.UNAUTHORIZED, mapHeaderMessage);
|
||||
return defaultJsonResponse(pegawai);
|
||||
} catch (Exception e) {
|
||||
LOGGER.info("Got exception {} in getLoginUser(keluarRuangan)", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, "Gagal pilih ruangan.");
|
||||
return getJsonHttpStatus(UNAUTHORIZED, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/pilih-ruangan/{modulaplikasiId:[0-9]+}/{ruanganId:[0-9]+}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> pilihRuangan(@PathVariable("modulaplikasiId") int modulaplikasiId, @PathVariable("ruanganId") int ruanganId, HttpServletRequest request){
|
||||
try{
|
||||
|
||||
@RequestMapping(value = "/pilih-ruangan/{modulaplikasiId:[0-9]+}/{ruanganId:[0-9]+}", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<String> pilihRuangan(@PathVariable("modulaplikasiId") int modulaplikasiId,
|
||||
@PathVariable("ruanganId") int ruanganId, HttpServletRequest request) {
|
||||
try {
|
||||
LoginUser loginUser = loginUserService.getLoginUser();
|
||||
Integer idPegawai = 0;
|
||||
if (CommonUtil.isNotNullOrEmpty(loginUser.getPegawai())){
|
||||
if (isNotNullOrEmpty(loginUser.getPegawai()))
|
||||
idPegawai = loginUser.getPegawai().getId();
|
||||
}
|
||||
Pegawai pegawai = loginUser.getPegawai(); //loginUserService.updateRuanganPegawaiPerLoginPerpindahRuangan(ruanganId);
|
||||
loggingSystemAsynchronous.saveSignInLog(modulaplikasiId, ruanganId, loginUser.getNamaUser(), idPegawai);
|
||||
return RestUtil.defaultJsonResponse(pegawai);
|
||||
}catch(Exception e){
|
||||
LOGGER.info("Got exception {} in get objek modul aplikasi", e);
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, "Gagal pilih ruangan.");
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.UNAUTHORIZED, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-all-sub-system", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<ModulAplikasiVO>> getAllSubSystem(){
|
||||
return RestUtil.defaultJsonResponse(modulAplikasiService.findAllSubSytemOrderByModulNoUrutAsc(), mapHeaderMessage) ;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-all-sub-modul/{kdModulAplikasi:[0-9]+}/show", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<ModulAplikasiVO>> getAllSubModul(@PathVariable("kdModulAplikasi") int kdModulAplikasi, HttpServletRequest request){
|
||||
//loggingSystemAsynchronous.saveSignInLog(kdModulAplikasi, request, null);
|
||||
return RestUtil.defaultJsonResponse(modulAplikasiService.findAllSubModulOrderByModulNoUrutAsc(kdModulAplikasi));
|
||||
}
|
||||
|
||||
/// OBJEK MODUL = FORM INPUT
|
||||
@RequestMapping(value = "/get-all-objek-modul/{idUserLogin:[0-9]+}/{kdModulAplikasi:[0-9]+}/show", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<ObjekModulAplikasiVO>> getAllObjekModul(@PathVariable("idUserLogin") int idUserLogin, @PathVariable("kdModulAplikasi") int kdModulAplikasi){
|
||||
try{
|
||||
//LoginUserVO loginUserVo = loginUserService.findById(idUserLogin);
|
||||
LoginUser loginUser = loginUserDao.findOne(idUserLogin);
|
||||
|
||||
Pegawai pegawai = loginUser.getPegawai();
|
||||
Integer pegawaiId = pegawai.getId();
|
||||
|
||||
List<MapPegawaiToModulAplikasiVO> lVO = mapPegawaiToModulAplikasiService.findByPegawaiIdAndModulAplikasiId(pegawaiId, kdModulAplikasi);
|
||||
|
||||
if (CommonUtil.isNullOrEmpty(lVO)) {
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, "Anda tidak punya izin akses");
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.UNAUTHORIZED, mapHeaderMessage);
|
||||
}
|
||||
|
||||
return RestUtil.defaultJsonResponse(objekModulAplikasiService.findAllModulAplikasi(kdModulAplikasi));
|
||||
|
||||
}catch(Exception e){
|
||||
LOGGER.info("Got exception {} in get objek modul aplikasi", e);
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, "Anda tidak punya izin akses");
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.UNAUTHORIZED, mapHeaderMessage);
|
||||
loggingSystemAsynchronous.saveSignInLog(modulaplikasiId, ruanganId, loginUser.getNamaUser(), idPegawai);
|
||||
return defaultJsonResponse(pegawai);
|
||||
} catch (Exception e) {
|
||||
LOGGER.info("Got exception {} in getLoginUser(pilihRuangan)", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, "Gagal pilih ruangan.");
|
||||
return getJsonHttpStatus(UNAUTHORIZED, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-all-default-objek-modul", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<ObjekModulAplikasiVO>> getAllDefaultObjekModulAplikasi(){
|
||||
return RestUtil.defaultJsonResponse(objekModulAplikasiService.findByKdObjekModulAplikasiHeadIsNullOrderByNoUrutAsc());
|
||||
|
||||
@RequestMapping(value = "/get-all-sub-system", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<ModulAplikasiVO>> getAllSubSystem() {
|
||||
return defaultJsonResponse(modulAplikasiService.findAllSubSytemOrderByModulNoUrutAsc(), mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-all-unit-kerja/{idUserLogin:[0-9]+}/{kdModulAplikasi:[0-9]+}/show", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getAllUnitKerjaByUserLogin(@PathVariable("idUserLogin") int idUserLogin, @PathVariable("kdModulAplikasi") int kdModulAplikasi){
|
||||
try{
|
||||
List<Map<String, Object>> ruangannya = mapLoginUserToRuanganService.findCurrentRoomByUserLoginAndModulAplikasi(idUserLogin, kdModulAplikasi);
|
||||
|
||||
if (CommonUtil.isNullOrEmpty(ruangannya)){
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, "Anda tidak punya izin akses");
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.UNAUTHORIZED, mapHeaderMessage);
|
||||
|
||||
@RequestMapping(value = "/get-all-sub-modul/{kdModulAplikasi:[0-9]+}/show", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<ModulAplikasiVO>> getAllSubModul(@PathVariable("kdModulAplikasi") int kdModulAplikasi,
|
||||
HttpServletRequest request) {
|
||||
return defaultJsonResponse(modulAplikasiService.findAllSubModulOrderByModulNoUrutAsc(kdModulAplikasi));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-all-default-objek-modul", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<ObjekModulAplikasiVO>> getAllDefaultObjekModulAplikasi() {
|
||||
return defaultJsonResponse(objekModulAplikasiService.findByKdObjekModulAplikasiHeadIsNullOrderByNoUrutAsc());
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-all-unit-kerja/{idUserLogin:[0-9]+}/{kdModulAplikasi:[0-9]+}/show", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<List<Map<String, Object>>> getAllUnitKerjaByUserLogin(
|
||||
@PathVariable("idUserLogin") int idUserLogin, @PathVariable("kdModulAplikasi") int kdModulAplikasi) {
|
||||
try {
|
||||
List<Map<String, Object>> ruangannya = mapLoginUserToRuanganService
|
||||
.findCurrentRoomByUserLoginAndModulAplikasi(idUserLogin, kdModulAplikasi);
|
||||
if (isNullOrEmpty(ruangannya)) {
|
||||
addHeaderMessage(ERROR_MESSAGE, "Anda tidak punya izin akses");
|
||||
return getJsonHttpStatus(UNAUTHORIZED, mapHeaderMessage);
|
||||
}
|
||||
|
||||
return RestUtil.defaultJsonResponse(ruangannya);
|
||||
}catch(Exception e){
|
||||
LOGGER.info("Got exception {} in get objek modul aplikasi", e);
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, "Anda tidak punya izin akses");
|
||||
return RestUtil.getJsonHttpStatus(HttpStatus.UNAUTHORIZED, mapHeaderMessage);
|
||||
return defaultJsonResponse(ruangannya);
|
||||
} catch (Exception e) {
|
||||
LOGGER.info("Got exception {} in findCurrentRoomByUserLoginAndModulAplikasi", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, "Anda tidak punya izin akses");
|
||||
return getJsonHttpStatus(UNAUTHORIZED, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<ModulAplikasiSVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<ModulAplikasiSVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(ModulAplikasiSVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(ModulAplikasiSVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<ModulAplikasiSVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user