Update controller
Clean code
This commit is contained in:
parent
f7327095ea
commit
2af9d575b7
@ -1,38 +1,41 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.dao.LoginUserDao;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.security.model.UserAuthentication;
|
||||
import com.jasamedika.medifirst2000.service.ActivityPegawaiService;
|
||||
import com.jasamedika.medifirst2000.service.DiagnosaTindakanPasienService;
|
||||
import com.jasamedika.medifirst2000.vo.DiagnosaTindakanPasienVO;
|
||||
import com.jasamedika.medifirst2000.vo.PegawaiVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.dao.LoginUserDao;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.security.model.UserAuthentication;
|
||||
import com.jasamedika.medifirst2000.security.service.TokenAuthenticationService;
|
||||
import com.jasamedika.medifirst2000.service.ActivityPegawaiService;
|
||||
import com.jasamedika.medifirst2000.service.DiagnosaTindakanPasienService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DiagnosaTindakanPasienVO;
|
||||
import com.jasamedika.medifirst2000.vo.PegawaiVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.AUTH_HEADER_NAME;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.security.service.TokenAuthenticationService.tokenHandler;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
/**
|
||||
* Controller class for Registrasi Pasien Business
|
||||
@ -41,71 +44,69 @@ import com.jasamedika.medifirst2000.vo.PegawaiVO;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/diagnosa-tindakan-pasien")
|
||||
public class DiagnosaTindakanPasienController extends LocaleController<DiagnosaTindakanPasienVO>{
|
||||
public class DiagnosaTindakanPasienController extends LocaleController<DiagnosaTindakanPasienVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DiagnosaTindakanPasienController.class);
|
||||
|
||||
@Autowired
|
||||
private LoginUserDao loginUserDao;
|
||||
|
||||
@Autowired
|
||||
private ActivityPegawaiService activityPegawaiServiceImpl;
|
||||
|
||||
@Autowired
|
||||
private DiagnosaTindakanPasienService diagnosaTindakanPasienService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(DiagnosaTindakanPasienController.class);
|
||||
|
||||
@RequestMapping(value = "/save-diagnosa-tindakan-pasien", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveDiagnosaTindakanPasien(@Valid @RequestBody DiagnosaTindakanPasienVO vo,HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/save-diagnosa-tindakan-pasien", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveDiagnosaTindakanPasien(
|
||||
@Valid @RequestBody DiagnosaTindakanPasienVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=diagnosaTindakanPasienService.saveDiagnosaTindakanPasien(vo);
|
||||
Map<String, Object> result = diagnosaTindakanPasienService.saveDiagnosaTindakanPasien(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
String token = request.getHeader(WebConstants.AUTH_HEADER_NAME);
|
||||
final User user = TokenAuthenticationService.tokenHandler.parseUserFromToken(token);
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
String token = request.getHeader(AUTH_HEADER_NAME);
|
||||
final User user = tokenHandler.parseUserFromToken(token);
|
||||
if (user != null) {
|
||||
{
|
||||
UserAuthentication data= new UserAuthentication(user);
|
||||
PegawaiVO pegawai = new PegawaiVO();
|
||||
pegawai.setId(loginUserDao.findByNamaUser(data.getName()).get(0).getPegawai().getId());
|
||||
activityPegawaiServiceImpl.record(pegawai, new Date(), "Memasukan Diagnosis");
|
||||
BroadcastMessage("IKI", "");
|
||||
}
|
||||
UserAuthentication data = new UserAuthentication(user);
|
||||
PegawaiVO pegawai = new PegawaiVO();
|
||||
pegawai.setId(loginUserDao.findByNamaUser(data.getName()).get(0).getPegawai().getId());
|
||||
activityPegawaiServiceImpl.record(pegawai, new Date(), "Memasukan Diagnosis");
|
||||
BroadcastMessage("IKI", "");
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when saveDiagnosaTindakanPasien", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveDiagnosaTindakanPasien", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveDiagnosaTindakanPasien", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveDiagnosaTindakanPasien", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-diagnosa-tindakan-by-antrian", method = RequestMethod.GET)
|
||||
public ResponseEntity<Map<String, Object>> getDiagnosaByAntrian(@RequestParam(value="noRec", required= true) String noRec,HttpServletRequest request) {
|
||||
@RequestMapping(value = "/get-diagnosa-tindakan-by-antrian", method = GET)
|
||||
public ResponseEntity<Map<String, Object>> getDiagnosaByAntrian(@RequestParam(value = "noRec") String noRec,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=diagnosaTindakanPasienService.findDiagnosaTindakanPasienByAntrian(noRec);
|
||||
Boolean dataFound=new Boolean((boolean) result.get("dataFound"));
|
||||
if(dataFound){
|
||||
mapHeaderMessage.clear();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
}else{
|
||||
mapHeaderMessage.clear();
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
|
||||
Map<String, Object> result = diagnosaTindakanPasienService.findDiagnosaTindakanPasienByAntrian(noRec);
|
||||
boolean dataFound = (boolean) result.get("dataFound");
|
||||
mapHeaderMessage.clear();
|
||||
if (dataFound) {
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} else {
|
||||
mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
|
||||
}
|
||||
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
|
||||
return getJsonResponse(result, OK, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when saveDiagnosaPasien", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when findDiagnosaTindakanPasienByAntrian", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveDiagnosaPasien", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when findDiagnosaTindakanPasienByAntrian", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,57 +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.DiagnosisKeperawatanService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DiagnosaKeperawatanVO;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/diagnosis-keperawatan")
|
||||
public class DiagnosisKeperawatanController extends LocaleController<DiagnosaKeperawatanVO> {
|
||||
|
||||
@Autowired
|
||||
private DiagnosisKeperawatanService service;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DiagnosisKeperawatanController.class);
|
||||
|
||||
@RequestMapping(value = "/save-diagnosis-keperawatan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> saveDiagnosisKeperawatan(@Valid @RequestBody DiagnosaKeperawatanVO vo,HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result = service.saveDiagnosaKeperawatan(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when saveDiagnosisKeperawatan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when saveDiagnosisKeperawatan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,157 +0,0 @@
|
||||
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 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.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.entities.Disposisi;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DisposisiService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DisposisiVO;
|
||||
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.DateBetween;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/disposisi")
|
||||
public class DisposisiController extends LocaleController<DisposisiVO> implements IBaseRestController<DisposisiVO>{
|
||||
|
||||
@Autowired
|
||||
private DisposisiService disposisiService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DisposisiController.class);
|
||||
|
||||
@RequestMapping(value = "/save-disposisi/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody DisposisiVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=disposisiService.addDisposisi(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 disposisi", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add disposisi", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-no-surat/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getNoSurat(HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
String noSurat=disposisiService.getNoSurat();
|
||||
Map<String,Object> result=new HashMap<String,Object>();
|
||||
result.put("noSurat", noSurat);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add disposisi", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add disposisi", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/grid-disposisi")
|
||||
@ResponseBody
|
||||
public ResponseEntity<List<Object>> andCondition(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "10") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "noRec") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@Spec(path = "disposisi.tanggal", params = {"tanggalAwal", "tanggalAhir"}, config = "yyyy-MM-dd", spec = DateBetween.class)Specification<Disposisi> spec){
|
||||
|
||||
Map<String, Object> resultPageMap = disposisiService.gridDisposisi(page, limit, sort, dir, spec);
|
||||
|
||||
return constructListPageResult(resultPageMap);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-detail-disposisi", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<DisposisiVO> findByNoRec(@RequestParam(value = "noRec", required = true) String noRec){
|
||||
DisposisiVO disposisi = disposisiService.findByNoRec(noRec);
|
||||
|
||||
try {
|
||||
return RestUtil.getJsonResponse(disposisi, HttpStatus.OK, mapHeaderMessage);
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return RestUtil.getJsonResponse(null, HttpStatus.NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<DisposisiVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<DisposisiVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(DisposisiVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(DisposisiVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<DisposisiVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,201 +1,132 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.net.URLDecoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.*;
|
||||
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.DistribusiAsetService;
|
||||
import com.jasamedika.medifirst2000.service.ProdukService;
|
||||
import com.jasamedika.medifirst2000.vo.DistribusiAsetVO;
|
||||
import com.jasamedika.medifirst2000.vo.KonfirmasiAsetVO;
|
||||
import com.jasamedika.medifirst2000.vo.PenerimaanBarangVO;
|
||||
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.entities.DetailSpekAnggaran;
|
||||
import com.jasamedika.medifirst2000.entities.StrukOrder;
|
||||
import com.jasamedika.medifirst2000.entities.StrukPelayananDetail;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.security.model.AppPermission;
|
||||
import com.jasamedika.medifirst2000.service.DistribusiAsetService;
|
||||
import com.jasamedika.medifirst2000.service.PemusnahanBarangService;
|
||||
import com.jasamedika.medifirst2000.service.ProdukService;
|
||||
import com.jasamedika.medifirst2000.service.StrukOrderService;
|
||||
import com.jasamedika.medifirst2000.service.StrukPelayananDetailService;
|
||||
import com.jasamedika.medifirst2000.service.StrukPelayananService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DetailAnggaranVO;
|
||||
import com.jasamedika.medifirst2000.vo.DistribusiAsetVO;
|
||||
import com.jasamedika.medifirst2000.vo.DistribusiBarangInvestasiVO;
|
||||
import com.jasamedika.medifirst2000.vo.KonfirmasiAsetVO;
|
||||
import com.jasamedika.medifirst2000.vo.PenerimaanBarangDetailVO;
|
||||
import com.jasamedika.medifirst2000.vo.PenerimaanBarangVO;
|
||||
import com.jasamedika.medifirst2000.vo.RequestBarangDariRuanganVO;
|
||||
import com.jasamedika.medifirst2000.vo.StrukKirimVO;
|
||||
import com.jasamedika.medifirst2000.vo.StrukOrderVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.DateBetween;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Like;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Null;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.And;
|
||||
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 java.net.URLDecoder.decode;
|
||||
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("/distribusi-aset")
|
||||
public class DistribusiAsetController extends LocaleController<PenerimaanBarangVO> {
|
||||
|
||||
@Autowired
|
||||
private DistribusiAsetService distribusiAsetService;
|
||||
|
||||
@Autowired
|
||||
private ProdukService produkService;
|
||||
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DistribusiAsetController.class);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/find-produk-aset", method = RequestMethod.GET)
|
||||
public Map<String,Object> findProdukAset(HttpServletRequest request) {
|
||||
@Autowired
|
||||
private DistribusiAsetService distribusiAsetService;
|
||||
|
||||
@Autowired
|
||||
private ProdukService produkService;
|
||||
|
||||
@RequestMapping(value = "/find-produk-aset", method = GET)
|
||||
public Map<String, Object> findProdukAset(HttpServletRequest request) {
|
||||
String data = request.getQueryString();
|
||||
data = URLDecoder.decode(data);
|
||||
data = decode(data);
|
||||
String[] arrQueries = data.split("&");
|
||||
String criteria = "";
|
||||
String values = "";
|
||||
StringBuilder criteria = new StringBuilder();
|
||||
StringBuilder values = new StringBuilder();
|
||||
for (String query : arrQueries) {
|
||||
if (query.indexOf("filter[filters][0][field]") >= 0) {
|
||||
if (criteria == null)
|
||||
criteria = query.replace("filter[filters][0][field]=", "");
|
||||
else
|
||||
criteria += "," + query.replace("filter[filters][0][field]=", "");
|
||||
|
||||
} else if (query.indexOf("filter[filters][0][value]") >= 0) {
|
||||
if (values == null)
|
||||
values = query.replace("filter[filters][0][value]=", "");
|
||||
else
|
||||
values += query.replace("filter[filters][0][value]=", "");
|
||||
if (query.contains("filter[filters][0][field]")) {
|
||||
criteria.append(",").append(query.replace("filter[filters][0][field]=", ""));
|
||||
} else if (query.contains("filter[filters][0][value]")) {
|
||||
values.append(query.replace("filter[filters][0][value]=", ""));
|
||||
}
|
||||
}
|
||||
|
||||
Map<String,Object>resultPageMap = produkService.findProdukAset(values);
|
||||
|
||||
return resultPageMap;
|
||||
return produkService.findProdukAset(values.toString());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/find-aset-by-produk", method = RequestMethod.GET)
|
||||
public Map<String,Object> findAsetByProduk(@RequestParam(value = "id", required = false) Integer id,HttpServletRequest request) {
|
||||
|
||||
@RequestMapping(value = "/find-aset-by-produk", method = GET)
|
||||
public Map<String, Object> findAsetByProduk(@RequestParam(value = "id", required = false) Integer id,
|
||||
HttpServletRequest request) {
|
||||
String data = request.getQueryString();
|
||||
data = URLDecoder.decode(data);
|
||||
data = decode(data);
|
||||
String[] arrQueries = data.split("&");
|
||||
String criteria = "";
|
||||
String values = "";
|
||||
StringBuilder criteria = new StringBuilder();
|
||||
StringBuilder values = new StringBuilder();
|
||||
for (String query : arrQueries) {
|
||||
if (query.indexOf("filter[filters][0][field]") >= 0) {
|
||||
if (criteria == null)
|
||||
criteria = query.replace("filter[filters][0][field]=", "");
|
||||
else
|
||||
criteria += "," + query.replace("filter[filters][0][field]=", "");
|
||||
|
||||
} else if (query.indexOf("filter[filters][0][value]") >= 0) {
|
||||
if (values == null)
|
||||
values = query.replace("filter[filters][0][value]=", "");
|
||||
else
|
||||
values += query.replace("filter[filters][0][value]=", "");
|
||||
if (query.contains("filter[filters][0][field]")) {
|
||||
criteria.append(",").append(query.replace("filter[filters][0][field]=", ""));
|
||||
} else if (query.contains("filter[filters][0][value]")) {
|
||||
values.append(query.replace("filter[filters][0][value]=", ""));
|
||||
}
|
||||
}
|
||||
|
||||
Map<String,Object>resultPageMap = produkService.findAsetByProduk(id,values);
|
||||
|
||||
return resultPageMap;
|
||||
return produkService.findAsetByProduk(id, values.toString());
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-distribusi-aset/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveDistribusiAset(@Valid @RequestBody DistribusiAsetVO vo,HttpServletRequest request,HttpServletResponse response) {
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-distribusi-aset/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveDistribusiAset(@Valid @RequestBody DistribusiAsetVO vo,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
Map<String, Object> result = distribusiAsetService.saveRequestDistribusi(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 Penerimaan Barang", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveRequestDistribusi", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when save Penerimaan Barang", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveRequestDistribusi", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-kirim-detail-permintaan-barang/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getKirimDetailPermintaanBarang(
|
||||
@RequestParam(value = "noRec", required = true) String noRec) {
|
||||
Map<String,Object> strukOrder = distribusiAsetService.findByStrukKirimNoRec(noRec);
|
||||
|
||||
@RequestMapping(value = "/get-kirim-detail-permintaan-barang/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getKirimDetailPermintaanBarang(
|
||||
@RequestParam(value = "noRec") String noRec) {
|
||||
try {
|
||||
return RestUtil.getJsonResponse(strukOrder, HttpStatus.OK, mapHeaderMessage);
|
||||
Map<String, Object> strukOrder = distribusiAsetService.findByStrukKirimNoRec(noRec);
|
||||
return getJsonResponse(strukOrder, OK, mapHeaderMessage);
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
return RestUtil.getJsonResponse(null, HttpStatus.NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/save-konfirmasi-aset/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveKonfirmasiAset(@Valid @RequestBody KonfirmasiAsetVO vo,HttpServletRequest request,HttpServletResponse response) {
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-konfirmasi-aset/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> saveKonfirmasiAset(@Valid @RequestBody KonfirmasiAsetVO vo,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
Map<String, Object> result = distribusiAsetService.saveKonfirmasiAset(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 Penerimaan Barang", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when saveKonfirmasiAset", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when save Penerimaan Barang", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when saveKonfirmasiAset", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/daftar-barang-aset")
|
||||
@ResponseBody
|
||||
public Map<String,Object> daftarBarangAset(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "10000") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "noRec") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@RequestParam(value = "ruanganId", required = false) Integer ruanganId) {
|
||||
|
||||
Map<String, Object> resultPageMap = distribusiAsetService.daftarBarangAset(page, limit, sort, dir,ruanganId);
|
||||
|
||||
return resultPageMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,132 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.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.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.entities.Dokumen;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DokumenService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DokumenVO;
|
||||
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.DateBetween;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dokumen")
|
||||
public class DokumenController extends LocaleController<DokumenVO> implements IBaseRestController<DokumenVO> {
|
||||
|
||||
@Autowired
|
||||
private DokumenService dokumenService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(DokumenController.class);
|
||||
|
||||
@RequestMapping(value = "/save-dokumen/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody DokumenVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=dokumenService.addDokumen(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 Surat Masuk Internal", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Surat Masuk Internal", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/dateBetweenCondition")
|
||||
@ResponseBody
|
||||
public ResponseEntity<List<Object>> findDokumenInternalByTanggal(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "10") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "noRec") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@Spec(path = "tglDokumen", params = {"dateStart", "dateEnd"}, config = "yyyy-MM-dd", spec = DateBetween.class) Specification<Dokumen> spec) {
|
||||
|
||||
Map<String, Object> resultPageMap = dokumenService.dokumenPaging(page,limit,sort,dir,spec);
|
||||
|
||||
return constructListPageResult(resultPageMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<DokumenVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<DokumenVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(DokumenVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(DokumenVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<DokumenVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
@RequestMapping(value = "/get-all-dokumen-uraian-tugas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity <List<Map<String, Object>>> getAllDokumenUT(
|
||||
HttpServletRequest request) {
|
||||
List<Map<String, Object>> result = null;
|
||||
try {
|
||||
|
||||
result = dokumenService.findAllDokumenUraianTugas();
|
||||
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
|
||||
getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@ -1,138 +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.DokumenInternalService;
|
||||
import com.jasamedika.medifirst2000.vo.DokumenInternalVO;
|
||||
import com.jasamedika.medifirst2000.vo.PasienVO;
|
||||
import com.jasamedika.medifirst2000.vo.SuratMasukInternalVO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.data.jpa.domain.Specifications;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.entities.DetailSpekAnggaran;
|
||||
import com.jasamedika.medifirst2000.entities.DokumenInternal;
|
||||
import com.jasamedika.medifirst2000.entities.Ruangan;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DokumenInternalService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DetailAnggaranVO;
|
||||
import com.jasamedika.medifirst2000.vo.DokumenInternalVO;
|
||||
import com.jasamedika.medifirst2000.vo.SuratMasukInternalVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.DateBetween;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Like;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Null;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.And;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Or;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dokumen-internal")
|
||||
public class DokumenInternalController extends LocaleController<SuratMasukInternalVO> {
|
||||
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DokumenInternalController.class);
|
||||
|
||||
@Autowired
|
||||
private DokumenInternalService dokumenInternalService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(DokumenInternalController.class);
|
||||
|
||||
@RequestMapping(value = "/save-dokumen-internal/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody SuratMasukInternalVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=dokumenInternalService.addSuratMasukInternal(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 Surat Masuk Internal", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Surat Masuk Internal", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/set-distribusi-dokumen/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> setDistribusi(@Valid @RequestBody SuratMasukInternalVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=dokumenInternalService.setDistribusiKirimSuratInternalEksternal(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 Surat Masuk Internal", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Surat Masuk Internal", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(value = "/save-dokumen-internal/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody SuratMasukInternalVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = dokumenInternalService.addSuratMasukInternal(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got ServiceVOException {} when addSuratMasukInternal", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when addSuratMasukInternal", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/set-distribusi-dokumen/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> setDistribusi(@Valid @RequestBody SuratMasukInternalVO vo,
|
||||
HttpServletRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = dokumenInternalService.setDistribusiKirimSuratInternalEksternal(vo);
|
||||
if (null != result)
|
||||
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
|
||||
return getJsonResponse(result, CREATED, mapHeaderMessage);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got ServiceVOException {} when setDistribusiKirimSuratInternalEksternal", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got JpaSystemException {} when setDistribusiKirimSuratInternalEksternal", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-dokumen")
|
||||
@ResponseBody
|
||||
public ResponseEntity<List<Object>> findDokumenInternalByTanggalAndNama(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@ResponseBody
|
||||
public ResponseEntity<Collection<PasienVO>> findDokumenInternalByTanggalAndNama(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "10") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "noRec") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@RequestParam(value = "dateStart", required = false) String dateStart,
|
||||
@RequestParam(value = "dateEnd", required = false) String dateEnd,
|
||||
@RequestParam(value = "noKirim", required = false) String noKirim) {
|
||||
|
||||
Map<String, Object> resultPageMap = dokumenInternalService.dokumenInternalPaging(page, limit, sort, dir, dateStart, dateEnd, noKirim);
|
||||
|
||||
Map<String, Object> resultPageMap = dokumenInternalService.dokumenInternalPaging(page, limit, sort, dir,
|
||||
dateStart, dateEnd, noKirim);
|
||||
return constructListPageResult(resultPageMap);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-dokumen-by-norec/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<DokumenInternalVO> findByNoRec(
|
||||
@RequestParam(value = "noRec", required = true) String noRec) {
|
||||
|
||||
DokumenInternalVO vo = dokumenInternalService.findByNoRec(noRec);
|
||||
|
||||
try {
|
||||
return RestUtil.getJsonResponse(vo, HttpStatus.OK, mapHeaderMessage);
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return RestUtil.getJsonResponse(null, HttpStatus.NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-dokumen-by-norec/", method = GET, produces = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<DokumenInternalVO> findByNoRec(@RequestParam(value = "noRec") String noRec) {
|
||||
DokumenInternalVO vo = dokumenInternalService.findByNoRec(noRec);
|
||||
try {
|
||||
return getJsonResponse(vo, OK, mapHeaderMessage);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,98 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DokumenKeluarService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DokumenKeluarVO;
|
||||
import com.jasamedika.medifirst2000.vo.JadwalDokter_VO;
|
||||
import com.jasamedika.medifirst2000.vo.SuratKeluarVO;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dokumenKeluar")
|
||||
public class DokumenKeluarController extends LocaleController<DokumenKeluarVO> implements IBaseRestController<DokumenKeluarVO> {
|
||||
|
||||
@Autowired
|
||||
private DokumenKeluarService dokumenKeluarService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(DokumenKeluarController.class);
|
||||
|
||||
@RequestMapping(value = "/save-surat-keluar/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody SuratKeluarVO vo, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
Map<String,Object> result=dokumenKeluarService.addSuratKeluar(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 Catatan Perkembangan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add Catatan Perkembangan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<DokumenKeluarVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<DokumenKeluarVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(DokumenKeluarVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(DokumenKeluarVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<DokumenKeluarVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,212 +0,0 @@
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.data.jpa.domain.Specifications;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.entities.DetailDraftPeraturan;
|
||||
import com.jasamedika.medifirst2000.entities.DraftPeraturan;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DetailDraftPeraturanService;
|
||||
import com.jasamedika.medifirst2000.service.DraftPeraturanService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DetailDraftPeraturanVO;
|
||||
import com.jasamedika.medifirst2000.vo.DraftPeraturanVO;
|
||||
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.DateBetween;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/draft-peraturan")
|
||||
public class DraftPeraturanController extends LocaleController<DraftPeraturanVO>
|
||||
implements IBaseRestController<DraftPeraturanVO>{
|
||||
|
||||
@Autowired
|
||||
private DraftPeraturanService peraturanService;
|
||||
|
||||
@Autowired
|
||||
private DetailDraftPeraturanService detailService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(PegawaiController.class);
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<DraftPeraturanVO>> getAllVOWithQueryString(HttpServletRequest request,
|
||||
Integer page, Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<DraftPeraturanVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(DraftPeraturanVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(DraftPeraturanVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<DraftPeraturanVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/find-all/",method= RequestMethod.GET)
|
||||
public ResponseEntity<List<Object>> findAll(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "20") Integer take,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@Spec(path = "tglPeraturan", params = {"dateStart", "dateEnd"}, config = "yyyy-MM-dd", spec = DateBetween.class) Specification<DraftPeraturan> tglPeraturan,
|
||||
@Spec(path = "noPeraturan", params = "noPeraturan" , spec = Equal.class) Specification<DraftPeraturan> noPeraturan) {
|
||||
Map<String,Object> result = new HashMap<String, Object>();
|
||||
|
||||
Specification<DraftPeraturan> spec = Specifications.where(tglPeraturan).and(noPeraturan);
|
||||
result = peraturanService.findAll(page, take, sort, dir, spec);
|
||||
return constructListPageResult(result);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/save/",method= RequestMethod.POST)
|
||||
public ResponseEntity<Map<String,Object>> saveKajian(@Valid @RequestBody DraftPeraturanVO vo,HttpServletRequest request){
|
||||
try{
|
||||
Map<String, Object> result = peraturanService.saveDraft(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 draft peraturan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add draft peraturan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/generate-no-peraturan/{bulan}/{tahun}",method= RequestMethod.GET)
|
||||
public ResponseEntity<Map<String,Object>> getGenerateNoUsulan(
|
||||
@PathVariable("bulan") Integer bulan,
|
||||
@PathVariable("tahun") Integer tahun,
|
||||
HttpServletRequest request)
|
||||
{
|
||||
try{
|
||||
Map<String,Object> result = peraturanService.generateNoPeraturan(bulan, tahun);
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
|
||||
}catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when generate no usulan", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when generate no usulan", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete/",method= RequestMethod.POST)
|
||||
public ResponseEntity<Map<String,Object>> deleteKajian(@Valid @RequestBody List<DraftPeraturanVO> vos,HttpServletRequest request){
|
||||
try{
|
||||
Map<String, Object> result = peraturanService.deleteDraft(vos);
|
||||
if(null!= result)
|
||||
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS,request));
|
||||
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
|
||||
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when delete draft", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when delete draft", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/update-draft/",method= RequestMethod.POST)
|
||||
public ResponseEntity<Map<String,Object>> updateKajian(@Valid @RequestBody List<DetailDraftPeraturanVO> vos,HttpServletRequest request){
|
||||
try{
|
||||
Map<String, Object> result = detailService.updateDraft(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 kajian", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when update kajian", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value="/find-all-by-jabatan/",method= RequestMethod.GET)
|
||||
public ResponseEntity<List<Object>> findAllByJabatan(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "20") Integer take,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@Spec(path = "draftPeraturan.tglPeraturan", params = {"dateStart", "dateEnd"}, config = "yyyy-MM-dd", spec = DateBetween.class) Specification<DetailDraftPeraturan> tglPeraturan,
|
||||
@Spec(path = "draftPeraturan.noPeraturan", params = "noUsulan" , spec = Equal.class) Specification<DetailDraftPeraturan> noPeraturan,
|
||||
@Spec(path = "tujuanDraft.id",params="jabatanId",spec=Equal.class)Specification<DetailDraftPeraturan> tujuanId) {
|
||||
Map<String,Object> result = new HashMap<String, Object>();
|
||||
|
||||
Specification<DetailDraftPeraturan> spec = Specifications.where(tglPeraturan).and(tujuanId).and(noPeraturan);
|
||||
result = detailService.findAll(page, take, sort, dir, spec);
|
||||
return constructListPageResult(result);
|
||||
}
|
||||
}
|
||||
@ -1,164 +1,94 @@
|
||||
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.DraftSuratRuangan;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DraftSuratService;
|
||||
import com.jasamedika.medifirst2000.vo.DraftSuratVO;
|
||||
import com.jasamedika.medifirst2000.vo.PasienVO;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.DateBetween;
|
||||
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.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.jasamedika.medifirst2000.constants.Constants;
|
||||
import com.jasamedika.medifirst2000.constants.MessageResource;
|
||||
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
|
||||
import com.jasamedika.medifirst2000.controller.base.LocaleController;
|
||||
import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.entities.DetailSpekAnggaran;
|
||||
import com.jasamedika.medifirst2000.entities.DraftSurat;
|
||||
import com.jasamedika.medifirst2000.entities.DraftSuratRuangan;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.DraftSuratService;
|
||||
import com.jasamedika.medifirst2000.util.rest.RestUtil;
|
||||
import com.jasamedika.medifirst2000.vo.DetailAnggaranVO;
|
||||
import com.jasamedika.medifirst2000.vo.DraftSuratVO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.DateBetween;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Equal;
|
||||
import net.kaczmarzyk.spring.data.jpa.domain.Null;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.And;
|
||||
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec;
|
||||
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
|
||||
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
|
||||
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
|
||||
import static org.springframework.http.HttpStatus.*;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.GET;
|
||||
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/draft-surat")
|
||||
public class DraftSuratController extends LocaleController<DraftSuratVO> implements IBaseRestController<DraftSuratVO>{
|
||||
|
||||
public class DraftSuratController extends LocaleController<DraftSuratVO> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DraftSuratController.class);
|
||||
|
||||
@Autowired
|
||||
private DraftSuratService draftSuratService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory
|
||||
.getLogger(DraftSuratController.class);
|
||||
|
||||
@RequestMapping(value = "/save-draft-surat/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody DraftSuratVO vo, HttpServletRequest request) {
|
||||
|
||||
|
||||
@RequestMapping(value = "/save-draft-surat/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody DraftSuratVO vo, HttpServletRequest request) {
|
||||
try {
|
||||
Map<String,Object> result=draftSuratService.addDraftSurat(vo);
|
||||
Map<String, Object> result = draftSuratService.addDraftSurat(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 draft-surat", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when addDraftSurat", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add draft-surat", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when addDraftSurat", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/get-no-surat/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String,Object>> getNoSurat(HttpServletRequest request) {
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-no-surat/", method = GET, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Map<String, Object>> getNoSurat(HttpServletRequest request) {
|
||||
try {
|
||||
String noSurat=draftSuratService.getNoSurat();
|
||||
Map<String,Object> result=new HashMap<String,Object>();
|
||||
String noSurat = draftSuratService.getNoSurat();
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("noSurat", noSurat);
|
||||
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);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when add draft-surat", e.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
e.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got ServiceVOException {} when getNoSurat", e.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
|
||||
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
|
||||
} catch (JpaSystemException jse) {
|
||||
LOGGER.error("Got exception {} when add draft-surat", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
|
||||
jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
|
||||
mapHeaderMessage);
|
||||
LOGGER.error("Got JpaSystemException {} when getNoSurat", jse.getMessage());
|
||||
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
|
||||
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@RequestMapping(value = "/grid-draft-surat")
|
||||
@ResponseBody
|
||||
public ResponseEntity<List<Object>> andCondition(
|
||||
public ResponseEntity<Collection<PasienVO>> andCondition(
|
||||
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(value = "take", required = false, defaultValue = "10") Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "noRec") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
|
||||
@Spec(path = "draftSurat.tanggal", params = {"tanggalAwal", "tanggalAhir"}, config = "yyyy-MM-dd", spec = DateBetween.class)Specification<DraftSuratRuangan> spec){
|
||||
|
||||
@Spec(path = "draftSurat.tanggal", params = { "tanggalAwal",
|
||||
"tanggalAhir" }, config = "yyyy-MM-dd", spec = DateBetween.class) Specification<DraftSuratRuangan> spec) {
|
||||
Map<String, Object> resultPageMap = draftSuratService.gridDraftSurat(page, limit, sort, dir, spec);
|
||||
|
||||
return constructListPageResult(resultPageMap);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/get-detail-draft-surat", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<DraftSuratVO> findByNoRec(@RequestParam(value = "noRec", required = true) String noRec){
|
||||
DraftSuratVO draftSurat = draftSuratService.findByNoRec(noRec);
|
||||
|
||||
try {
|
||||
return RestUtil.getJsonResponse(draftSurat, HttpStatus.OK, mapHeaderMessage);
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return RestUtil.getJsonResponse(null, HttpStatus.NOT_FOUND, mapHeaderMessage);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Collection<DraftSuratVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
|
||||
Integer limit, String sort, String dir) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<DraftSuratVO> getVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> addVO(DraftSuratVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> editVO(DraftSuratVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<String> deleteVO(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<DraftSuratVO>> getAllVO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user