Update controller

Clean code
This commit is contained in:
Salman Manoe 2024-12-23 14:29:40 +07:00
parent 9d2466eaca
commit f2cbdb411a
17 changed files with 630 additions and 1926 deletions

View File

@ -1,50 +1,49 @@
package com.jasamedika.medifirst2000.controller; 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.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.entities.DetailKajianEvaluasi; import com.jasamedika.medifirst2000.entities.DetailKajianEvaluasi;
import com.jasamedika.medifirst2000.entities.KajianEvaluasi; import com.jasamedika.medifirst2000.entities.KajianEvaluasi;
import com.jasamedika.medifirst2000.exception.ServiceVOException; import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.DetailKajianEvaluasiService; import com.jasamedika.medifirst2000.service.DetailKajianEvaluasiService;
import com.jasamedika.medifirst2000.service.KajianEvaluasiService; import com.jasamedika.medifirst2000.service.KajianEvaluasiService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.DetailKajianEvaluasiVO; import com.jasamedika.medifirst2000.vo.DetailKajianEvaluasiVO;
import com.jasamedika.medifirst2000.vo.KajianEvaluasiVO; import com.jasamedika.medifirst2000.vo.KajianEvaluasiVO;
import com.jasamedika.medifirst2000.vo.PasienVO;
import net.kaczmarzyk.spring.data.jpa.domain.DateBetween; import net.kaczmarzyk.spring.data.jpa.domain.DateBetween;
import net.kaczmarzyk.spring.data.jpa.domain.Equal; import net.kaczmarzyk.spring.data.jpa.domain.Equal;
import net.kaczmarzyk.spring.data.jpa.web.annotation.Spec; 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.data.jpa.domain.Specifications;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import static org.springframework.http.HttpStatus.*;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@RestController @RestController
@RequestMapping("/kajian-evaluasi") @RequestMapping("/kajian-evaluasi")
public class KajianEvaluasiController extends LocaleController<KajianEvaluasiVO> public class KajianEvaluasiController extends LocaleController<KajianEvaluasiVO> {
{
private static final Logger LOGGER = LoggerFactory.getLogger(KajianEvaluasiController.class);
@Autowired @Autowired
private KajianEvaluasiService evaluasiService; private KajianEvaluasiService evaluasiService;
@ -52,135 +51,92 @@ public class KajianEvaluasiController extends LocaleController<KajianEvaluasiVO>
@Autowired @Autowired
private DetailKajianEvaluasiService detailService; private DetailKajianEvaluasiService detailService;
private static final Logger LOGGER = LoggerFactory @RequestMapping(value = "/find-all/", method = GET)
.getLogger(PegawaiController.class); public ResponseEntity<Collection<PasienVO>> findAll(
@RequestMapping(value="/find-all/",method= RequestMethod.GET)
public ResponseEntity<List<Object>> findAll(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page, @RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "take", required = false, defaultValue = "20") Integer take, @RequestParam(value = "take", required = false, defaultValue = "20") Integer take,
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort, @RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir, @RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
@Spec(path = "tglUsulan", params = {"dateStart", "dateEnd"}, config = "yyyy-MM-dd", spec = DateBetween.class) Specification<KajianEvaluasi> tglUsulan, @Spec(path = "tglUsulan", params = { "dateStart",
"dateEnd" }, config = "yyyy-MM-dd", spec = DateBetween.class) Specification<KajianEvaluasi> tglUsulan,
@Spec(path = "noUsulan", params = "noUsulan", spec = Equal.class) Specification<KajianEvaluasi> noUsulan, @Spec(path = "noUsulan", params = "noUsulan", spec = Equal.class) Specification<KajianEvaluasi> noUsulan,
@Spec(path = "id", params = "id", spec = Equal.class) Specification<KajianEvaluasi> id) { @Spec(path = "id", params = "id", spec = Equal.class) Specification<KajianEvaluasi> id) {
Map<String,Object> result = new HashMap<String, Object>();
Specification<KajianEvaluasi> spec = Specifications.where(tglUsulan).and(noUsulan).and(id); Specification<KajianEvaluasi> spec = Specifications.where(tglUsulan).and(noUsulan).and(id);
result = evaluasiService.findAll(page, take, sort, dir, spec); Map<String, Object> result = evaluasiService.findAll(page, take, sort, dir, spec);
return constructListPageResult(result); return constructListPageResult(result);
} }
@RequestMapping(value="/find-all-by-jabatan/",method= RequestMethod.GET) @RequestMapping(value = "/find-all-by-jabatan/", method = GET)
public ResponseEntity<List<Object>> findAllByJabatan( public ResponseEntity<Collection<PasienVO>> findAllByJabatan(
@RequestParam(value = "page", required = false, defaultValue = "0") Integer page, @RequestParam(value = "page", required = false, defaultValue = "0") Integer page,
@RequestParam(value = "take", required = false, defaultValue = "20") Integer take, @RequestParam(value = "take", required = false, defaultValue = "20") Integer take,
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort, @RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir, @RequestParam(value = "dir", required = false, defaultValue = "asc") String dir,
@Spec(path = "kajianEvaluasi.tglUsulan", params = {"dateStart", "dateEnd"}, config = "yyyy-MM-dd", spec = DateBetween.class) Specification<DetailKajianEvaluasi> tglUsulan, @Spec(path = "kajianEvaluasi.tglUsulan", params = { "dateStart",
"dateEnd" }, config = "yyyy-MM-dd", spec = DateBetween.class) Specification<DetailKajianEvaluasi> tglUsulan,
@Spec(path = "kajianEvaluasi.noUsulan", params = "noUsulan", spec = Equal.class) Specification<DetailKajianEvaluasi> noUsulan, @Spec(path = "kajianEvaluasi.noUsulan", params = "noUsulan", spec = Equal.class) Specification<DetailKajianEvaluasi> noUsulan,
@Spec(path = "tujuan.id", params = "jabatanId", spec = Equal.class) Specification<DetailKajianEvaluasi> tujuanId, @Spec(path = "tujuan.id", params = "jabatanId", spec = Equal.class) Specification<DetailKajianEvaluasi> tujuanId,
@Spec(path = "id", params = "id", spec = Equal.class) Specification<DetailKajianEvaluasi> id) { @Spec(path = "id", params = "id", spec = Equal.class) Specification<DetailKajianEvaluasi> id) {
Map<String,Object> result = new HashMap<String, Object>();
Specification<DetailKajianEvaluasi> spec = Specifications.where(tglUsulan).and(tujuanId).and(noUsulan).and(id); Specification<DetailKajianEvaluasi> spec = Specifications.where(tglUsulan).and(tujuanId).and(noUsulan).and(id);
result = detailService.findAll(page, take, sort, dir, spec); Map<String, Object> result = detailService.findAll(page, take, sort, dir, spec);
return constructListPageResult(result); return constructListPageResult(result);
} }
@RequestMapping(value="/save/",method= RequestMethod.POST)
public ResponseEntity<Map<String,Object>> saveKajian(@Valid @RequestBody KajianEvaluasiVO vo,HttpServletRequest request){ @RequestMapping(value = "/save/", method = POST)
public ResponseEntity<Map<String, Object>> saveKajian(@Valid @RequestBody KajianEvaluasiVO vo,
HttpServletRequest request) {
try { try {
Map<String, Object> result = evaluasiService.saveKajian(vo); Map<String, Object> result = evaluasiService.saveKajian(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS,request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add kajian", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveKajian", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, e.getMessage());
e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add kajian", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveKajian", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
} }
} }
@RequestMapping(value="/update-kajian/",method= RequestMethod.POST) @RequestMapping(value = "/update-kajian/", method = POST)
public ResponseEntity<Map<String,Object>> updateKajian(@Valid @RequestBody List<DetailKajianEvaluasiVO> vos,HttpServletRequest request){ public ResponseEntity<Map<String, Object>> updateKajian(@Valid @RequestBody List<DetailKajianEvaluasiVO> vos,
HttpServletRequest request) {
try { try {
Map<String, Object> result = detailService.updateKajian(vos); Map<String, Object> result = detailService.updateKajian(vos);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS,request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when update kajian", e.getMessage()); LOGGER.error("Got ServiceVOException {} when updateKajian", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, e.getMessage());
e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update kajian", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when updateKajian", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
} }
} }
@RequestMapping(value = "/delete/", method = POST)
@RequestMapping(value="/delete/",method= RequestMethod.POST) public ResponseEntity<Map<String, Object>> deleteKajian(@Valid @RequestBody List<KajianEvaluasiVO> vos,
public ResponseEntity<Map<String,Object>> deleteKajian(@Valid @RequestBody List<KajianEvaluasiVO> vos,HttpServletRequest request){ HttpServletRequest request) {
try { try {
Map<String, Object> result = evaluasiService.deleteKajian(vos); Map<String, Object> result = evaluasiService.deleteKajian(vos);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS,request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when delete kajian", e.getMessage()); LOGGER.error("Got ServiceVOException {} when deleteKajian", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, e.getMessage());
e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when delete kajian", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when deleteKajian", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value="/generate-no-usulan/{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 = evaluasiService.generateNoUsulan(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);
} }
} }
} }

View File

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

View File

@ -1,60 +1,44 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.io.File; import com.jasamedika.medifirst2000.constants.MessageResource;
import java.io.FileInputStream; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import java.io.FileNotFoundException; import com.jasamedika.medifirst2000.exception.ServiceVOException;
import java.io.IOException; import com.jasamedika.medifirst2000.service.DetailAnggaranService;
import java.io.OutputStream; import com.jasamedika.medifirst2000.service.KartuPengendaliService;
import java.io.PrintWriter; import com.jasamedika.medifirst2000.vo.*;
import java.util.ArrayList; import org.slf4j.Logger;
import java.util.HashMap; import org.slf4j.LoggerFactory;
import java.util.List; import org.springframework.beans.factory.annotation.Autowired;
import java.util.Map; import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger; import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import org.slf4j.LoggerFactory; import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import org.springframework.beans.factory.annotation.Autowired; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import org.springframework.http.HttpStatus; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import org.springframework.http.MediaType; import static org.springframework.http.HttpStatus.*;
import org.springframework.http.ResponseEntity; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import org.springframework.orm.jpa.JpaSystemException; import static org.springframework.web.bind.annotation.RequestMethod.GET;
import org.springframework.web.bind.annotation.RequestBody; import static org.springframework.web.bind.annotation.RequestMethod.POST;
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.KartuPengendaliDetail;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.BaseAnggaranService;
import com.jasamedika.medifirst2000.service.DetailAnggaranService;
import com.jasamedika.medifirst2000.service.KartuPengendaliService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.DetailAnggaranVO;
import com.jasamedika.medifirst2000.vo.KartuPengendaliCustomVO;
import com.jasamedika.medifirst2000.vo.KartuPengendaliDetailVO;
import com.jasamedika.medifirst2000.vo.PenawaranHargaVO;
import com.jasamedika.medifirst2000.vo.RegistrasiPelayananVO;
import com.jasamedika.medifirst2000.vo.RekapPemenangUlpVO;
import com.jasamedika.medifirst2000.vo.UpdateJadwalVO;
import com.jasamedika.medifirst2000.vo.UploadVO;
import com.jasamedika.medifirst2000.vo.UploadExcelVO;
import com.jasamedika.medifirst2000.vo.VerifikasiKartuPengendaliDetailVO;
import com.jasamedika.medifirst2000.vo.VerifikasiKartuPengendaliHeaderVO;
@RestController @RestController
@RequestMapping("/kartu-pengendali") @RequestMapping("/kartu-pengendali")
public class KartuPengendaliController extends LocaleController<RegistrasiPelayananVO> { public class KartuPengendaliController extends LocaleController<KartuPengendaliVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(KartuPengendaliController.class);
@Autowired @Autowired
private KartuPengendaliService service; private KartuPengendaliService service;
@ -62,36 +46,25 @@ public class KartuPengendaliController extends LocaleController<RegistrasiPelaya
@Autowired @Autowired
private DetailAnggaranService detailAnggaranService; private DetailAnggaranService detailAnggaranService;
private static final Logger LOGGER = LoggerFactory.getLogger(KartuPengendaliController.class); @RequestMapping(value = "/save-kartu-pengendali", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
// save kartu Pengendali
@RequestMapping(value = "/save-kartu-pengendali", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveKartuPengendali(@Valid @RequestBody KartuPengendaliCustomVO vo, public ResponseEntity<Map<String, Object>> saveKartuPengendali(@Valid @RequestBody KartuPengendaliCustomVO vo,
HttpServletRequest request) { HttpServletRequest request) {
try { try {
Map<String, Object> result = service.saveKartuPengendali(vo); Map<String, Object> result = service.saveKartuPengendali(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, CREATED, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when saveKartuPengendali", e.getMessage()); LOGGER.error("Got ServiceVOException {} when saveKartuPengendali", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveKartuPengendali", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when saveKartuPengendali", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
} }
}
// Kartu Pengendai Paging
// Jika ANggaran maka kelompok User/isPpk null
// Jika Ppk Maka kelompok User / is Ppk=true
// Jika Ulp Maka is Ulp = true
@SuppressWarnings("unchecked")
@RequestMapping(value = "/kartu-pengendali-list") @RequestMapping(value = "/kartu-pengendali-list")
@ResponseBody @ResponseBody
public Map<String, Object> multipleCondition( public Map<String, Object> multipleCondition(
@ -105,14 +78,10 @@ public class KartuPengendaliController extends LocaleController<RegistrasiPelaya
@RequestParam(value = "kelompokUser", required = false) Boolean isPpk, @RequestParam(value = "kelompokUser", required = false) Boolean isPpk,
@RequestParam(value = "isUlp", required = false) Boolean isUlp, @RequestParam(value = "isUlp", required = false) Boolean isUlp,
@RequestParam(value = "isPp", required = false) Boolean isPp) { @RequestParam(value = "isPp", required = false) Boolean isPp) {
return service.kartuPengenDaliPAging(page, limit, sort, dir, dateStart, dateEnd, pengendaliId, isPpk, isUlp,
Map<String, Object> resultPageMap = service.kartuPengenDaliPAging(page, limit, sort, dir, dateStart, dateEnd, isPp);
pengendaliId, isPpk, isUlp,isPp);
return resultPageMap;
} }
@SuppressWarnings("unchecked")
@RequestMapping(value = "/kartu-pengendali-header-list") @RequestMapping(value = "/kartu-pengendali-header-list")
@ResponseBody @ResponseBody
public Map<String, Object> kartuPengendaliHeader( public Map<String, Object> kartuPengendaliHeader(
@ -129,15 +98,10 @@ public class KartuPengendaliController extends LocaleController<RegistrasiPelaya
@RequestParam(value = "isAnggaran", required = false) Boolean isAnggaran, @RequestParam(value = "isAnggaran", required = false) Boolean isAnggaran,
@RequestParam(value = "isPengendali", required = false) Boolean isPengendali, @RequestParam(value = "isPengendali", required = false) Boolean isPengendali,
@RequestParam(value = "isDirekturTerkait", required = false) Boolean isDirekturTerkait) { @RequestParam(value = "isDirekturTerkait", required = false) Boolean isDirekturTerkait) {
return service.kartuPengenDaliPagingHeader(page, limit, sort, dir, dateStart, dateEnd, pengendaliId, isPpk,
Map<String, Object> resultPageMap = service.kartuPengenDaliPagingHeader(page, limit, sort, dir, dateStart, isUlp, isPp, isAnggaran, isPengendali, isDirekturTerkait);
dateEnd, pengendaliId, isPpk, isUlp,isPp, isAnggaran, isPengendali, isDirekturTerkait);
return resultPageMap;
} }
@SuppressWarnings("unchecked")
@RequestMapping(value = "/pre-add-penerimaan") @RequestMapping(value = "/pre-add-penerimaan")
@ResponseBody @ResponseBody
public Map<String, Object> preAddPenerimaan( public Map<String, Object> preAddPenerimaan(
@ -148,37 +112,18 @@ public class KartuPengendaliController extends LocaleController<RegistrasiPelaya
@RequestParam(value = "dateStart", required = false) String dateStart, @RequestParam(value = "dateStart", required = false) String dateStart,
@RequestParam(value = "dateEnd", required = false) String dateEnd, @RequestParam(value = "dateEnd", required = false) String dateEnd,
@RequestParam(value = "supplierId", required = false) Integer supplierId) { @RequestParam(value = "supplierId", required = false) Integer supplierId) {
return service.preAddPenerimaan(page, limit, sort, dir, dateStart, dateEnd, supplierId);
Map<String, Object> resultPageMap = service.preAddPenerimaan(page, limit, sort, dir, dateStart,dateEnd, supplierId);
return resultPageMap;
} }
// Generate Template Excel
@SuppressWarnings("unchecked")
@RequestMapping(value = "/generate-template-exel") @RequestMapping(value = "/generate-template-exel")
@ResponseBody @ResponseBody
public Map<String, Object> generateTemplateExcel(@RequestParam(value = "noRec", required = false) String noRec,HttpServletResponse response) throws IOException { public void generateTemplateExcel(@RequestParam(value = "noRec", required = false) String noRec,
HttpServletResponse response) throws IOException {
String fileName = service.generateTemplateExcel(noRec); String fileName = service.generateTemplateExcel(noRec);
String fileType = "application/vnd.ms-excel"; String fileType = "application/vnd.ms-excel";
// Find this file id in database to get file name, and file type
// You must tell the browser the file type you are going to send
// for example application/pdf, text/plain, text/html, image/jpg
response.setContentType(fileType); response.setContentType(fileType);
// Make sure to show the download dialog
response.setHeader("Content-disposition", "attachment; filename=" + fileName); response.setHeader("Content-disposition", "attachment; filename=" + fileName);
// Assume file name is retrieved from database
// For example D:\\file\\test.pdf
File my_file = new File(fileName); File my_file = new File(fileName);
// This should send the file to browser
OutputStream out = response.getOutputStream(); OutputStream out = response.getOutputStream();
FileInputStream in = new FileInputStream(my_file); FileInputStream in = new FileInputStream(my_file);
byte[] buffer = new byte[4096]; byte[] buffer = new byte[4096];
@ -188,304 +133,247 @@ public class KartuPengendaliController extends LocaleController<RegistrasiPelaya
} }
in.close(); in.close();
out.flush(); out.flush();
return null;
} }
// verifikasi PPK @RequestMapping(value = "/save-verifikasi-spek-anggaran", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
@RequestMapping(value = "/save-verifikasi-spek-anggaran", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveVerifikasiKartuPengendaliDetail( public ResponseEntity<Map<String, Object>> saveVerifikasiKartuPengendaliDetail(
@Valid @RequestBody VerifikasiKartuPengendaliDetailVO vo, HttpServletRequest request) { @Valid @RequestBody VerifikasiKartuPengendaliDetailVO vo, HttpServletRequest request) {
try { try {
Map<String, Object> result = service.verifikasiPpk(vo); Map<String, Object> result = service.verifikasiPpk(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, CREATED, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when Kartu Pengendali Detail", e.getMessage()); LOGGER.error("Got ServiceVOException {} when verifikasiPpk", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when Kartu Pengendali Detail", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when verifikasiPpk", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
// Rekap Pemenang from Ppk @RequestMapping(value = "/rekap-pemenang", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
@RequestMapping(value = "/rekap-pemenang", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Map<String, Object>> rekapPemenang(@Valid @RequestBody VerifikasiKartuPengendaliDetailVO vo,
public ResponseEntity<Map<String, Object>> rekapPemenang( HttpServletRequest request) {
@Valid @RequestBody VerifikasiKartuPengendaliDetailVO vo, HttpServletRequest request) {
try { try {
Map<String, Object> result = service.rekapPemenang(vo); Map<String, Object> result = service.rekapPemenang(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, CREATED, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when Kartu Pengendali Detail", e.getMessage()); LOGGER.error("Got ServiceVOException {} when rekapPemenang", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when Kartu Pengendali Detail", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when rekapPemenang", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
// Rekap Pemenang from Ulp @RequestMapping(value = "/rekap-pemenang-from-ulp", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
@RequestMapping(value = "/rekap-pemenang-from-ulp", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Map<String, Object>> rekapPemenangFromUlp(@Valid @RequestBody RekapPemenangUlpVO vo,
public ResponseEntity<Map<String, Object>> rekapPemenangFromUlp(@Valid @RequestBody RekapPemenangUlpVO vo, HttpServletRequest request) { HttpServletRequest request) {
try { try {
Map<String, Object> result = service.rekapPemenangFromUlp(vo); Map<String, Object> result = service.rekapPemenangFromUlp(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS, request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when Kartu Pengendali Detail", e.getMessage()); LOGGER.error("Got ServiceVOException {} when rekapPemenangFromUlp", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when Kartu Pengendali Detail", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when rekapPemenangFromUlp", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
// Verifikasi by Anggaran By etail @RequestMapping(value = "/verifikasi-kartu-pengendali-by-anggaran", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
@RequestMapping(value = "/verifikasi-kartu-pengendali-by-anggaran", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> verifikasiKartuPengendaliByAnggaran( public ResponseEntity<Map<String, Object>> verifikasiKartuPengendaliByAnggaran(
@Valid @RequestBody VerifikasiKartuPengendaliDetailVO vo, HttpServletRequest request) { @Valid @RequestBody VerifikasiKartuPengendaliDetailVO vo, HttpServletRequest request) {
try { try {
Map<String, Object> result = service.verifikasiKartuPengendaliDetailByAnggaran(vo); Map<String, Object> result = service.verifikasiKartuPengendaliDetailByAnggaran(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, CREATED, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when saveKartuPengendali", e.getMessage()); LOGGER.error("Got ServiceVOException {} when verifikasiKartuPengendaliDetailByAnggaran", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when saveKartuPengendali", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when verifikasiKartuPengendaliDetailByAnggaran", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
} }
} @RequestMapping(value = "/verifikasi-kartu-pengendali-by-header", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
// Verifikasi by Anggaran By Header
@RequestMapping(value = "/verifikasi-kartu-pengendali-by-header", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> verifikasiKartuPengendaliHeadByAnggaran( public ResponseEntity<Map<String, Object>> verifikasiKartuPengendaliHeadByAnggaran(
@Valid @RequestBody VerifikasiKartuPengendaliHeaderVO vo, HttpServletRequest request) { @Valid @RequestBody VerifikasiKartuPengendaliHeaderVO vo, HttpServletRequest request) {
try { try {
Map<String, Object> result = service.verifikasiAnggaran(vo); Map<String, Object> result = service.verifikasiAnggaran(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, CREATED, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when Verif Kartu Pengendali", e.getMessage()); LOGGER.error("Got ServiceVOException {} when verifikasiAnggaran", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when Verif Kartu Pengendali", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when verifikasiAnggaran", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
} }
} @RequestMapping(value = "/verifikasi-kartu-pengendali-by-direktur", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
// Verifikasi by Direktur By Header
@RequestMapping(value = "/verifikasi-kartu-pengendali-by-direktur", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> verifikasiKartuPengendaliByDirektur( public ResponseEntity<Map<String, Object>> verifikasiKartuPengendaliByDirektur(
@Valid @RequestBody VerifikasiKartuPengendaliHeaderVO vo, HttpServletRequest request) { @Valid @RequestBody VerifikasiKartuPengendaliHeaderVO vo, HttpServletRequest request) {
try { try {
Map<String, Object> result = service.verfikasiDirekturTerkait(vo); Map<String, Object> result = service.verfikasiDirekturTerkait(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, CREATED, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when Verif Kartu Pengendali", e.getMessage()); LOGGER.error("Got ServiceVOException {} when verfikasiDirekturTerkait", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when Verif Kartu Pengendali", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when verfikasiDirekturTerkait", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
} }
} @RequestMapping(value = "/verifikasi-kartu-pengendali-by-pp", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
// Verifikasi by pp
@RequestMapping(value = "/verifikasi-kartu-pengendali-by-pp", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> verifikasiKartuPengendaliByPp( public ResponseEntity<Map<String, Object>> verifikasiKartuPengendaliByPp(
@Valid @RequestBody VerifikasiKartuPengendaliHeaderVO vo, HttpServletRequest request) { @Valid @RequestBody VerifikasiKartuPengendaliHeaderVO vo, HttpServletRequest request) {
try { try {
Map<String, Object> result = service.verfikasiPp(vo); Map<String, Object> result = service.verfikasiPp(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, CREATED, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when Verif Kartu Pengendali", e.getMessage()); LOGGER.error("Got ServiceVOException {} when verfikasiPp", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when Verif Kartu Pengendali", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when verfikasiPp", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
} }
} @RequestMapping(value = "/verifikasi-kartu-pengendali-by-ulp", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
// Verifikasi by pp
@RequestMapping(value = "/verifikasi-kartu-pengendali-by-ulp", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> verifikasiKartuPengendaliByUlp( public ResponseEntity<Map<String, Object>> verifikasiKartuPengendaliByUlp(
@Valid @RequestBody VerifikasiKartuPengendaliHeaderVO vo, HttpServletRequest request) { @Valid @RequestBody VerifikasiKartuPengendaliHeaderVO vo, HttpServletRequest request) {
try { try {
Map<String, Object> result = service.verfikasiULP(vo); Map<String, Object> result = service.verfikasiULP(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, CREATED, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when Verif Kartu Pengendali", e.getMessage()); LOGGER.error("Got ServiceVOException {} when verfikasiULP", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when Verif Kartu Pengendali", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when verfikasiULP", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
} }
} @RequestMapping(value = "/update-jadwal", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateJadwal(@Valid @RequestBody UpdateJadwalVO vo,
// Update Jadwal HttpServletRequest request) {
@RequestMapping(value = "/update-jadwal", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateJadwal(@Valid @RequestBody UpdateJadwalVO vo, HttpServletRequest request) {
try { try {
Map<String, Object> result = service.updateJadwal(vo); Map<String, Object> result = service.updateJadwal(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, CREATED, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when update jadwal", e.getMessage()); LOGGER.error("Got ServiceVOException {} when updateJadwal", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update jadwal", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when updateJadwal", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
} }
@RequestMapping(value = "/get-detail-kartu-pengendali-list/", method = GET, produces = APPLICATION_JSON_VALUE)
public List<Map<String, Object>> kartuPengendliDetailList(@RequestParam(value = "noRec") String noRec) {
return service.kartuPengendliDetailList(noRec);
} }
// Menampilkan Kartu Pengendali Berdasarkan Norec (array) @RequestMapping(value = "/get-kartu-pengendali-header-by-norec/", method = GET, produces = APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-detail-kartu-pengendali-list/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public Map<String, Object> getKartuPengendaliHeaderByNoRec(@RequestParam(value = "noRec") String noRec) {
public List<Map<String, Object>> kartuPengendliDetailList( return service.getKartuPengendaliHeaderByNoRec(noRec);
@RequestParam(value = "noRec", required = true) String noRec) {
List<Map<String, Object>> kartuPengendliDetailList = service.kartuPengendliDetailList(noRec);
return kartuPengendliDetailList;
} }
@RequestMapping(value = "/get-kartu-pengendali-header-by-norec/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/pre-rekap-pemenang/", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getKartuPengendaliHeaderByNoRec( public Map<String, Object> preRekapPemenang(@RequestParam(value = "noRec") String noRec) {
@RequestParam(value = "noRec", required = true) String noRec) { return service.preRekapPemenang(noRec);
Map<String, Object> kartuPengendliDetailList = service.getKartuPengendaliHeaderByNoRec(noRec);
return kartuPengendliDetailList;
} }
@RequestMapping(value = "/pre-rekap-pemenang/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/get-get-struk-rekap", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> preRekapPemenang( public Map<String, Object> getStrukRekap(@RequestParam(value = "noRec") String noRec) {
@RequestParam(value = "noRec", required = true) String noRec) { return service.getStrukRekap(noRec);
Map<String, Object> kartuPengendliDetailList = service.preRekapPemenang(noRec);
return kartuPengendliDetailList;
} }
@RequestMapping(value = "/pre-add-jadwal", method = GET, produces = APPLICATION_JSON_VALUE)
//getStrukRekap public Map<String, Object> preAddJadwal(@RequestParam(value = "noRec") String noRec) {
@RequestMapping(value = "/get-get-struk-rekap", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) return service.getPreAddJadwal(noRec);
public Map<String, Object> getStrukRekap(
@RequestParam(value = "noRec", required = true) String noRec) {
Map<String, Object> strukRekap = service.getStrukRekap(noRec);
return strukRekap;
} }
@RequestMapping(value = "/pre-add-jadwal", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/get-metode-pengadaan-detail", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> preAddJadwal( public Map<String, Object> getMetodePengadaanDetail(@RequestParam(value = "id") Integer id) {
@RequestParam(value = "noRec", required = true) String noRec) { return service.metodePengadaanDetail(id);
Map<String, Object> data = service.getPreAddJadwal(noRec);
return data;
} }
// Menampilkan Kartu Pengendali Berdasarkan Norec (array) @RequestMapping(value = "/upload-exel/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
@RequestMapping(value = "/get-metode-pengadaan-detail", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Map<String, Object>> upload(@Valid @RequestBody UploadExcelVO vo, HttpServletRequest request)
public Map<String, Object> getMetodePengadaanDetail( throws IOException {
@RequestParam(value = "id", required = true) Integer id) {
Map<String, Object> kartuPengendliDetailList = service.metodePengadaanDetail(id);
return kartuPengendliDetailList;
}
@RequestMapping(value = "/upload-exel/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> upload(@Valid @RequestBody UploadExcelVO vo,HttpServletRequest request) throws IOException {
try { try {
Map<String, Object> result = service.uploadExel(vo); Map<String, Object> result = service.uploadExel(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request )); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Agama", e.getMessage()); LOGGER.error("Got ServiceVOException {} when uploadExel", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, e.getMessage());
e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Agama", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when uploadExel", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, }
mapHeaderMessage);
} }
} @RequestMapping(value = "/save-penawaran-harga-supplier/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> savePenawaranHargaSupplier(@Valid @RequestBody PenawaranHargaVO vo,
HttpServletRequest request) throws IOException {
@RequestMapping(value = "/save-penawaran-harga-supplier/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> savePenawaranHargaSupplier(@Valid @RequestBody PenawaranHargaVO vo,HttpServletRequest request) throws IOException {
try { try {
Map<String, Object> result = service.savePenawaranHargaSupplier(vo); Map<String, Object> result = service.savePenawaranHargaSupplier(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request )); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Penawaran Harga", e.getMessage()); LOGGER.error("Got ServiceVOException {} when savePenawaranHargaSupplier", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Penawaran Harga", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when savePenawaranHargaSupplier", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
} }
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/list-kontrak-grid") @RequestMapping(value = "/list-kontrak-grid")
@ResponseBody @ResponseBody
public Map<String, Object> listKontrakGrid( public Map<String, Object> listKontrakGrid(
@ -497,43 +385,14 @@ public class KartuPengendaliController extends LocaleController<RegistrasiPelaya
@RequestParam(value = "dateEnd", required = false) String dateEnd, @RequestParam(value = "dateEnd", required = false) String dateEnd,
@RequestParam(value = "supplierId", required = false) Integer supplierId, @RequestParam(value = "supplierId", required = false) Integer supplierId,
@RequestParam(value = "tahun", required = false) Integer tahun) { @RequestParam(value = "tahun", required = false) Integer tahun) {
return service.listKontrakGrid(page, limit, sort, dir, dateStart, dateEnd, supplierId, tahun);
Map<String, Object> resultPageMap = service.listKontrakGrid(page, limit, sort, dir, dateStart, dateEnd, supplierId, tahun);
return resultPageMap;
} }
@RequestMapping(value = "/get-kelompok-user/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/get-kelompok-user/", method = GET, produces = APPLICATION_JSON_VALUE)
public Map<String, Object> getKelompokUser() { public Map<String, Object> getKelompokUser() {
Map<String, Object> result = new HashMap<String, Object>(); Map<String, Object> result = new HashMap<>();
result.put("kelompokUser", detailAnggaranService.getKelompokUserLogin()); result.put("kelompokUser", detailAnggaranService.getKelompokUserLogin());
return result; return result;
} }
/*
* @RequestMapping(value = "/verifikasi-kartu-pengendali", method =
* RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes
* = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Map<String,
* Object>> verifikasiKartuPengendali(@Valid @RequestBody
* KartuPengendaliDetailVO vo, HttpServletRequest request) { try {
* Map<String,Object> result = service.verifikasiKartuPengendaliDetail(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 verifikasi kartu Pengendali", 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 verifikasi kartu Pengendali", jse.getMessage());
* addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
* return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
* }
*
* }
*/
} }

View File

@ -1,17 +1,14 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.List; import com.jasamedika.medifirst2000.service.KartuStokService;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.service.KartuStokService; import java.util.List;
import java.util.Map;
@RestController @RestController
@RequestMapping("/kartu-stok") @RequestMapping("/kartu-stok")
@ -20,20 +17,12 @@ public class KartuStokController {
@Autowired @Autowired
private KartuStokService kartuStokService; private KartuStokService kartuStokService;
private static final Logger LOGGER = LoggerFactory.getLogger(KartuStokController.class);
@SuppressWarnings("unchecked")
@RequestMapping(value = "/get-kartu-stok") @RequestMapping(value = "/get-kartu-stok")
@ResponseBody @ResponseBody
public List<Map<String, Object>> preAddPenerimaan( public List<Map<String, Object>> preAddPenerimaan(@RequestParam(value = "dateStart") String dateStart,
@RequestParam(value = "dateStart", required = true) String dateStart, @RequestParam(value = "dateEnd") String dateEnd, @RequestParam(value = "ruanganId") Integer ruanganId,
@RequestParam(value = "dateEnd", required = true) String dateEnd, @RequestParam(value = "produkId") Integer produkId) {
@RequestParam(value = "ruanganId", required = true) Integer ruanganId, return kartuStokService.getKartuStok(ruanganId, produkId, dateStart, dateEnd);
@RequestParam(value = "produkId", required = true) Integer produkId) {
List<Map<String, Object>> resultPageMap = kartuStokService.getKartuStok( ruanganId,produkId,dateStart,dateEnd);
return resultPageMap;
} }
} }

View File

@ -1,97 +1,54 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.Collection; import com.jasamedika.medifirst2000.constants.MessageResource;
import java.util.List; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import java.util.Map; import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.KategoryProdukService;
import javax.servlet.http.HttpServletRequest; import com.jasamedika.medifirst2000.vo.KategoryProdukVO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; 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.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException; import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants; import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.MessageResource; import java.util.Map;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController; import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import com.jasamedika.medifirst2000.core.web.WebConstants; import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import com.jasamedika.medifirst2000.exception.ServiceVOException; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import com.jasamedika.medifirst2000.service.KategoryProdukService; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import com.jasamedika.medifirst2000.util.rest.RestUtil; import static org.springframework.http.HttpStatus.*;
import com.jasamedika.medifirst2000.vo.KategoryProdukVO; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
@RestController @RestController
@RequestMapping(value = "/kategory-produk") @RequestMapping(value = "/kategory-produk")
public class KategoryProdukController extends LocaleController<KategoryProdukVO> public class KategoryProdukController extends LocaleController<KategoryProdukVO> {
implements IBaseRestController<KategoryProdukVO>{
private static final Logger LOGGER = LoggerFactory.getLogger(KategoryProdukController.class);
@Autowired @Autowired
private KategoryProdukService kategoryProdukService; private KategoryProdukService kategoryProdukService;
private static final Logger LOGGER = LoggerFactory @RequestMapping(value = "/get-kategory-produk-gizi/", method = GET, produces = APPLICATION_JSON_VALUE)
.getLogger(IndikatorRensarController.class); public ResponseEntity<Map<String, Object>> getBentukGizi(HttpServletRequest request) {
@Override
public ResponseEntity<Collection<KategoryProdukVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<KategoryProdukVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(KategoryProdukVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(KategoryProdukVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<KategoryProdukVO>> getAllVO() {
return null;
}
@RequestMapping(value="/get-kategory-produk-gizi/", method= RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getBentukGizi(
HttpServletRequest request){
try { try {
Map<String, Object> result = kategoryProdukService.getKategoryProdukGizi(); Map<String, Object> result = kategoryProdukService.getKategoryProdukGizi();
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS,request)); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when get Kategory Produk Gizi", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getKategoryProdukGizi", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, e.getMessage());
e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get Kategory Produk Gizi", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getKategoryProdukGizi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, }
mapHeaderMessage);
} }
} }
}

View File

@ -1,37 +1,35 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.Collection; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.List; import com.jasamedika.medifirst2000.constants.MessageResource;
import java.util.Map; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.KebutuhanDasar;
import javax.servlet.http.HttpServletRequest; import com.jasamedika.medifirst2000.exception.ServiceVOException;
import javax.validation.Valid; import com.jasamedika.medifirst2000.service.KebutuhanDasarService;
import com.jasamedika.medifirst2000.vo.KebutuhanDasarVO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; 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.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException; 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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; 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.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.Constants; import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource; import java.util.Map;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController; import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import com.jasamedika.medifirst2000.core.web.WebConstants; import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_ERROR;
import com.jasamedika.medifirst2000.exception.ServiceVOException; import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import com.jasamedika.medifirst2000.service.KebutuhanDasarService; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import com.jasamedika.medifirst2000.util.DateUtil; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import com.jasamedika.medifirst2000.util.rest.RestUtil; import static org.springframework.http.HttpStatus.*;
import com.jasamedika.medifirst2000.vo.KebutuhanDasarVO; 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 KebutuhanDasarController * Controller class for KebutuhanDasarController
@ -41,87 +39,49 @@ import com.jasamedika.medifirst2000.vo.KebutuhanDasarVO;
@RestController @RestController
@RequestMapping("/kebutuhan-dasar") @RequestMapping("/kebutuhan-dasar")
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
public class KebutuhanDasarController extends LocaleController<KebutuhanDasarVO> implements public class KebutuhanDasarController extends LocaleController<KebutuhanDasarVO> {
IBaseRestController<KebutuhanDasarVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(KebutuhanDasarController.class); private static final Logger LOGGER = LoggerFactory.getLogger(KebutuhanDasarController.class);
@Autowired @Autowired
private KebutuhanDasarService kebutuhanDasarService; private KebutuhanDasarService<KebutuhanDasar> kebutuhanDasarService;
@RequestMapping(value = "/save-kebutuhan-dasar", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/save-kebutuhan-dasar", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody KebutuhanDasarVO vo,HttpServletRequest request) { public ResponseEntity<Map<String, Object>> save(@Valid @RequestBody KebutuhanDasarVO vo,
HttpServletRequest request) {
try { try {
Map<String, Object> result = kebutuhanDasarService.addKebutuhanDasar(vo); Map<String, Object> result = kebutuhanDasarService.addKebutuhanDasar(vo);
mapHeaderMessage.clear();
if (null != result) { if (null != result) {
mapHeaderMessage.clear(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
} else { } else {
mapHeaderMessage.clear(); mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
} }
SaveLog("Kebutuhan Dasar Perawat", "Perawat", request); SaveLog("Kebutuhan Dasar Perawat", "Perawat", request);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage); return getJsonResponse(result, CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add kebutuhan dasar", e.getMessage()); LOGGER.error("Got ServiceVOException {} when addKebutuhanDasar", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add kebutuhan dasar", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when addKebutuhanDasar", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
} }
} @RequestMapping(value = "/find-kebutuhan-dasar", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findByNoRec(@RequestParam("noRec") String noRec,
@RequestMapping(value = "/find-kebutuhan-dasar", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) HttpServletRequest request) {
public ResponseEntity<Map<String,Object>> findByNoRec(@RequestParam("noRec") String noRec,HttpServletRequest request) {
Map<String, Object> result = kebutuhanDasarService.findKebutuhanDasarByNoRec(noRec); Map<String, Object> result = kebutuhanDasarService.findKebutuhanDasarByNoRec(noRec);
Boolean dataFound=new Boolean((boolean) result.get("dataFound")); boolean dataFound = (boolean) result.get("dataFound");
mapHeaderMessage.clear();
if (dataFound) { if (dataFound) {
mapHeaderMessage.clear(); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
} else { } else {
mapHeaderMessage.clear(); mapHeaderMessage.put(LABEL_ERROR, getMessage(MessageResource.LABEL_ERROR, request));
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request )); }
return getJsonResponse(result, OK, mapHeaderMessage);
} }
return RestUtil.getJsonResponse(result, HttpStatus.OK,mapHeaderMessage);
}
@Override
public ResponseEntity<Collection<KebutuhanDasarVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<KebutuhanDasarVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(KebutuhanDasarVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(KebutuhanDasarVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<KebutuhanDasarVO>> getAllVO() {
return null;
}
} }

View File

@ -1,59 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.entities.Kecamatan;
import com.jasamedika.medifirst2000.service.KecamatanService;
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
@RestController
@RequestMapping("/kecamatan")
public class KecamatanController extends LocaleController {
@Autowired
private KecamatanService kecamatanService;
private static final Logger LOGGER = LoggerFactory
.getLogger(KecamatanController.class);
@RequestMapping("/kecamatanReport")
public ModelAndView generateReportMateri(ModelAndView m,@RequestParam(value = "format", required = false) String format){
Iterable<Kecamatan> data = kecamatanService.findAllKecamatan();
m.addObject("dataSource", data);
m.addObject("tanggalReport", new Date());
m.addObject("title", "Report Kecamatan");
m.addObject("format", "pdf");
if(format != null && !format.isEmpty()){
m.addObject("format", format);
}
return m;
}
}

View File

@ -1,98 +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.KegiatanService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.KegiatanVO;
@RestController
@RequestMapping("/kegiatan")
public class KegiatanController extends LocaleController<KegiatanVO> {
@Autowired
private KegiatanService kegiatanService;
private static final Logger LOGGER = LoggerFactory.getLogger(KegiatanController.class);
@RequestMapping(value = "/save-kegiatan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveKegiatan(@Valid @RequestBody KegiatanVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = kegiatanService.saveKegiatan(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Kegiatan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Kegiatan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-kegiatan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateKegiatan(@Valid @RequestBody KegiatanVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = kegiatanService.updateKegiatan(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 Kegiatan", 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 Kegiatan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-kegiatan", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findAllKegiatan(HttpServletRequest request) {
Map<String, Object> result=null;
try {
result = kegiatanService.findAllKgiatan();
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 ex){
ex.printStackTrace();
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
}

View File

@ -1,99 +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.KegiatanDetailService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.KegiatanDetailVO;
import com.jasamedika.medifirst2000.vo.KegiatanVO;
@RestController
@RequestMapping("/kegiatan-detail")
public class KegiatanDetailController extends LocaleController<KegiatanVO> {
@Autowired
private KegiatanDetailService kegiatanDetailService;
private static final Logger LOGGER = LoggerFactory.getLogger(KegiatanDetailController.class);
@RequestMapping(value = "/save-kegiatan-detail", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveKegiatanDetail(@Valid @RequestBody KegiatanDetailVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = kegiatanDetailService.saveKegiatanDetail(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when save Kegiatan Detail", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when save Kegiatan Detail", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/update-kegiatan-detail", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> updateKegiatanDetail(@Valid @RequestBody KegiatanDetailVO vo,
HttpServletRequest request) {
try {
Map<String, Object> result = kegiatanDetailService.updateKegiatanDetail(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 Kegiatan Detail", 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 Kegiatan Detail", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-kegiatan-detail", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findAllKegiatanDetail(HttpServletRequest request) {
Map<String, Object> result=null;
try {
result = kegiatanDetailService.findAllKgiatanDetail();
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 ex){
ex.printStackTrace();
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
}

View File

@ -1,112 +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.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.KehamilanSekarangService;
import com.jasamedika.medifirst2000.service.ThtService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.KehamilanSekarangVO;
/**
* Controller class for Pengakjian Awal KehamilanSekarangController
*
* @author Askur
*/
@RestController
@RequestMapping("/kehamilan-sekarang")
@JsonIgnoreProperties(ignoreUnknown = true)
public class KehamilanSekarangController extends LocaleController<KehamilanSekarangVO> implements
IBaseRestController<KehamilanSekarangVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(KehamilanSekarangController.class);
@Autowired
private KehamilanSekarangService riwayatKelahiranYangLaluService;
@Autowired
private ThtService thtService;
@RequestMapping(value = "/save-kehamilan-sekarang", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> save(@Valid @RequestBody KehamilanSekarangVO vo,HttpServletRequest request) {
try {
Map<String,Object> result = riwayatKelahiranYangLaluService.addKehamilanSekarang(vo);
if (null != result){
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
result.put("message", "Berhasil");
}else{
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_ERROR,getMessage(MessageResource.LABEL_ERROR,request ));
result.put("message", "Gagal");
}
return RestUtil.getJsonResponse(result, HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@Override
public ResponseEntity<Collection<KehamilanSekarangVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<KehamilanSekarangVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(KehamilanSekarangVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(KehamilanSekarangVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<KehamilanSekarangVO>> getAllVO() {
return null;
}
}

View File

@ -1,91 +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.KelahiranService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.KelahiranVO;
/**
* @author Teguh
*/
@RestController
@RequestMapping("/kelahiran")
public class KelahiranController extends LocaleController<KelahiranVO> {
@Autowired
private KelahiranService kelahiranService;
private static final Logger LOGGER = LoggerFactory
.getLogger(KelahiranController.class);
@RequestMapping(value = "/save-kelahiran/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody KelahiranVO vo,HttpServletRequest request) {
try{
Map<String, Object> result = kelahiranService.addKelahiran(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 Kelahiran", 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 Kelahiran", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/update-kelahiran/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody KelahiranVO vo,HttpServletRequest request) {
try{
Map<String, Object> result = kelahiranService.updateKelahiran(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 Kelahiran", 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 Kelahiran", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
}

View File

@ -1,192 +1,118 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.text.ParseException; import com.jasamedika.medifirst2000.constants.MessageResource;
import java.util.Collection; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import java.util.HashMap; import com.jasamedika.medifirst2000.entities.Kelas;
import java.util.List; import com.jasamedika.medifirst2000.exception.ServiceVOException;
import java.util.Map; import com.jasamedika.medifirst2000.service.KelasService;
import com.jasamedika.medifirst2000.vo.KelasVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException; import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; 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.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants; import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.MessageResource; import javax.validation.Valid;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController; import java.util.Map;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants; import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import com.jasamedika.medifirst2000.dao.KelasDao; import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import com.jasamedika.medifirst2000.exception.ServiceVOException; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import com.jasamedika.medifirst2000.service.KelasService; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import com.jasamedika.medifirst2000.util.rest.RestUtil; import static org.springframework.http.HttpStatus.*;
import com.jasamedika.medifirst2000.vo.KelasVO; 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 @RestController
@RequestMapping("/kelas") @RequestMapping("/kelas")
public class KelasController extends LocaleController<KelasVO> implements public class KelasController extends LocaleController<KelasVO> {
IBaseRestController<KelasVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(KelasController.class);
@Autowired @Autowired
private KelasService kelasService; private KelasService<Kelas> kelasService;
private static final Logger LOGGER = LoggerFactory @RequestMapping(value = "/save-kelas/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
.getLogger(KelasController.class);
@Override
public ResponseEntity<KelasVO> getVO(Integer id) {
return null;
}
@RequestMapping(value = "/save-kelas/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> addVO(@Valid @RequestBody KelasVO vo, HttpServletRequest request) { public ResponseEntity<String> addVO(@Valid @RequestBody KelasVO vo, HttpServletRequest request) {
try { try {
KelasVO result = (KelasVO) kelasService.add(vo); KelasVO result = kelasService.add(vo);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request )); mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse("", HttpStatus.CREATED,mapHeaderMessage); return getJsonResponse("", CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Kelas", e.getMessage()); LOGGER.error("Got ServiceVOException {} when add", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, e.getMessage());
e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Kelas", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when add", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, }
mapHeaderMessage);
} }
@RequestMapping(value = "/update-kelas/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
}
@RequestMapping(value = "/update-kelas/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> editVO(@Valid @RequestBody KelasVO vo) { public ResponseEntity<String> editVO(@Valid @RequestBody KelasVO vo) {
try { try {
KelasVO result = (KelasVO) kelasService.update(vo); KelasVO result = kelasService.update(vo);
if (null != result) if (null != result)
return RestUtil.getJsonResponse("", HttpStatus.CREATED); return getJsonResponse("", CREATED);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Kelas", e.getMessage()); LOGGER.error("Got ServiceVOException {} when update", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, e.getMessage());
e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Kelas", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when update", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, }
mapHeaderMessage); return getJsonHttpStatus(NOT_ACCEPTABLE);
} }
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE); @RequestMapping(value = "/delete-kelas/", method = GET, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
}
@RequestMapping(value = "/delete-kelas/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> deleteVO(@RequestParam(value = "id", required = false) Integer id) { public ResponseEntity<String> deleteVO(@RequestParam(value = "id", required = false) Integer id) {
try { try {
if (kelasService.delete(id) == true) if (kelasService.delete(id))
return RestUtil.getJsonResponse("", HttpStatus.CREATED); return getJsonResponse("", CREATED);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when delete Kelas", e.getMessage()); LOGGER.error("Got ServiceVOException {} when delete", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, e.getMessage());
e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when delete Kelas", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when delete", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
} catch (DataIntegrityViolationException ex) { } catch (DataIntegrityViolationException ex) {
LOGGER.error("Got DataIntegrityViolationException {} when delete", ex.getMessage());
LOGGER.error("Got exception {} when delete Ruangan", ex.getMessage()); addHeaderMessage(ERROR_MESSAGE, ex.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, }
ex.getMessage()); return getJsonHttpStatus(NOT_ACCEPTABLE);
} }
@RequestMapping(value = "/get-kelas-by-ruangan/", method = GET, produces = APPLICATION_JSON_VALUE)
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE); public ResponseEntity<Map<String, Object>> getKomposisiMakanan(
} @RequestParam(value = "ruanganId", required = false) Integer ruanganId, HttpServletRequest request) {
@Override
public ResponseEntity<List<KelasVO>> getAllVO() {
return null;
}
@Override
public ResponseEntity<Collection<KelasVO>> getAllVOWithQueryString(HttpServletRequest request, Integer page,
Integer limit, String sort, String dir) {
return null;
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/search-kelas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Collection<KelasVO>> getAllVOWithQueryString(
@RequestParam(value = "page", required = false ,defaultValue = "0") 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 = kelasService.findAllWithPageAndLimitAndSortByAndDirectionParameter(page,
limit, sort, dir);
return constructListPageResult(resultPageMap);
}
@Override
public ResponseEntity<String> addVO(KelasVO vo) {
return null;
}
@RequestMapping(value = "/get-kelas-by-ruangan/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getKomposisiMakanan(@RequestParam(value = "ruanganId", required = false) Integer ruanganId,
HttpServletRequest request) throws ParseException {
try { try {
Map<String, Object> result = kelasService.findKelasByRuangan(ruanganId); Map<String, Object> result = kelasService.findKelasByRuangan(ruanganId);
if (null != result) if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); SaveLog("Get kelas by ruangan", "Permintaan", request);
SaveLog("Order Farmasi", "Permintaan", request); return getJsonResponse(result, CREATED, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.CREATED, mapHeaderMessage);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add Pasien", e.getMessage()); LOGGER.error("Got ServiceVOException {} when findKelasByRuangan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pasien", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when findKelasByRuangan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
} }

View File

@ -1,134 +0,0 @@
package com.jasamedika.medifirst2000.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants;
import com.jasamedika.medifirst2000.entities.KelompokEvaluasi;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.KelompokEvaluasiService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.KelompokEvaluasiVO;
import com.jasamedika.medifirst2000.vo.KomponenEvaluasiVO;
@RestController
@RequestMapping("/kelompok-evaluasi")
public class KelompokEvaluasiController extends LocaleController<KelompokEvaluasiVO> {
@Autowired
private KelompokEvaluasiService kelompokEvaluasiService;
private static final Logger LOGGER = LoggerFactory
.getLogger(KelompokEvaluasiController.class);
@RequestMapping(value = "/save/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> addVO(@RequestBody KelompokEvaluasiVO vo,HttpServletRequest request) {
try {
KelompokEvaluasiVO result = kelompokEvaluasiService.add(vo);
if (null != result)
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,getMessage(MessageResource.LABEL_SUCCESS,request ));
return RestUtil.getJsonResponse("", HttpStatus.CREATED,mapHeaderMessage);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add KomponenEvaluasi", 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 KomponenEvaluasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/update/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> editVO(@Valid @RequestBody KelompokEvaluasiVO vo) {
try {
KelompokEvaluasiVO result = kelompokEvaluasiService.update(vo);
if (null != result)
return RestUtil.getJsonResponse("", HttpStatus.OK);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when update KomponenEvaluasi", 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 KomponenEvaluasi",
jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE);
}
@RequestMapping(value = "/delete/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> deleteVO(Integer id) {
try {
if (kelompokEvaluasiService.delete(id) == true)
return RestUtil.getJsonResponse("", HttpStatus.CREATED);
} catch (ServiceVOException e) {
LOGGER.error("Got exception {} when delete KomponenEvaluasi", 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 KomponenEvaluasi", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE);
}
@RequestMapping(value = "/get-all", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<KelompokEvaluasi>> getAllVO() {
List<KelompokEvaluasi> result = kelompokEvaluasiService.findAll();
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@SuppressWarnings("unchecked")
@RequestMapping(value = "/find-by-id", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<KelompokEvaluasi> getAllVOWithQueryString(@RequestParam(value = "id", required = true) Integer id){
KelompokEvaluasi result=kelompokEvaluasiService.findById(id);
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
}

View File

@ -1,36 +1,28 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.text.SimpleDateFormat; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import java.util.Collection; import com.jasamedika.medifirst2000.exception.ServiceVOException;
import java.util.List; import com.jasamedika.medifirst2000.service.KeluargaPegawaiService;
import java.util.Map; import com.jasamedika.medifirst2000.vo.KeluargaPegawaiVO;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; 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.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException; import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants; import javax.validation.Valid;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController; import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import com.jasamedika.medifirst2000.controller.base.LocaleController; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import com.jasamedika.medifirst2000.core.web.WebConstants; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import com.jasamedika.medifirst2000.exception.ServiceVOException; import static org.springframework.http.HttpStatus.*;
import com.jasamedika.medifirst2000.service.KeluargaPegawaiService; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import com.jasamedika.medifirst2000.util.rest.RestUtil; import static org.springframework.web.bind.annotation.RequestMethod.GET;
import com.jasamedika.medifirst2000.vo.KeluargaPegawaiVO; import static org.springframework.web.bind.annotation.RequestMethod.POST;
import com.jasamedika.medifirst2000.vo.PosisiLamaranVO;
/** /**
* Controller class for KeluargaPegawaiController * Controller class for KeluargaPegawaiController
@ -41,89 +33,35 @@ import com.jasamedika.medifirst2000.vo.PosisiLamaranVO;
*/ */
@RestController @RestController
@RequestMapping("/keluarga-pegawai") @RequestMapping("/keluarga-pegawai")
public class KeluargaPegawaiController extends public class KeluargaPegawaiController extends LocaleController<KeluargaPegawaiVO> {
LocaleController<KeluargaPegawaiVO> implements
IBaseRestController<KeluargaPegawaiVO> { private static final Logger LOGGER = LoggerFactory.getLogger(KeluargaPegawaiController.class);
@Autowired @Autowired
private KeluargaPegawaiService keluargaPegawaiService; private KeluargaPegawaiService keluargaPegawaiService;
private static final Logger LOGGER = LoggerFactory @RequestMapping(value = "/cari-alamat-id/{id}", method = GET)
.getLogger(KeluargaPegawaiController.class); public ResponseEntity<KeluargaPegawaiVO> getVO(@PathVariable("id") Integer id) {
KeluargaPegawaiVO keluargaPegawaiVO = keluargaPegawaiService.findById(id);
@RequestMapping(value = "/cari-alamat-id/{id}", method = RequestMethod.GET) return getJsonResponse(keluargaPegawaiVO, OK);
public ResponseEntity<KeluargaPegawaiVO> getVO(
@PathVariable("id") Integer id) {
KeluargaPegawaiVO keluargaPegawaiVO = keluargaPegawaiService
.findById(id);
return RestUtil.getJsonResponse(keluargaPegawaiVO, HttpStatus.OK);
}
@RequestMapping(value = "/get-all/", method = RequestMethod.GET)
public ResponseEntity<List> getAllKeluaraPegawai(
@PathVariable("id") Integer id) {
List keluargaPegawaiVO = keluargaPegawaiService
.findAll();
return RestUtil.getJsonResponse(keluargaPegawaiVO, HttpStatus.OK);
} }
@RequestMapping(value = "/cari-alamat-by-pasien-id/{id}", method = RequestMethod.GET) @RequestMapping(value = "/save-keluarga-pegawai", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<KeluargaPegawaiVO> getByPasienVO(
@PathVariable("id") Integer id) {
KeluargaPegawaiVO keluargaPegawaiVO = keluargaPegawaiService
.findById(id);
return RestUtil.getJsonResponse(keluargaPegawaiVO, HttpStatus.OK);
}
@Override
public ResponseEntity<Collection<KeluargaPegawaiVO>> getAllVOWithQueryString(
HttpServletRequest request, Integer page, Integer limit,
String sort, String dir) {
return null;
}
@RequestMapping(value = "/save-keluarga-pegawai", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<String> addVO(@Valid @RequestBody KeluargaPegawaiVO vo) { public ResponseEntity<String> addVO(@Valid @RequestBody KeluargaPegawaiVO vo) {
try { try {
KeluargaPegawaiVO result = keluargaPegawaiService.add(vo); KeluargaPegawaiVO result = keluargaPegawaiService.add(vo);
if (null != result) if (null != result)
return RestUtil.getJsonResponse("Success", HttpStatus.CREATED); return getJsonResponse("Success", CREATED);
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when add pegawai", e.getMessage()); LOGGER.error("Got ServiceVOException {} when add", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, e.getMessage());
e.getMessage()); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when add Pegawai", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when add", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
jse.getMessage()); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, }
mapHeaderMessage); return getJsonHttpStatus(NOT_ACCEPTABLE);
} }
return RestUtil.getJsonHttptatus(HttpStatus.NOT_ACCEPTABLE);
}
@Override
public ResponseEntity<String> editVO(KeluargaPegawaiVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<KeluargaPegawaiVO>> getAllVO() {
return null;
}
} }

View File

@ -1,185 +1,81 @@
package com.jasamedika.medifirst2000.controller; package com.jasamedika.medifirst2000.controller;
import java.util.Collection; import com.jasamedika.medifirst2000.constants.MessageResource;
import java.util.List; import com.jasamedika.medifirst2000.controller.base.LocaleController;
import java.util.Map; import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.KeluhanPelangganService;
import javax.servlet.http.HttpServletRequest; import com.jasamedika.medifirst2000.vo.KeluhanPelangganVO;
import javax.validation.Valid;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; 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.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException; import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; 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.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.jasamedika.medifirst2000.constants.Constants; import javax.servlet.http.HttpServletRequest;
import com.jasamedika.medifirst2000.constants.MessageResource; import javax.validation.Valid;
import com.jasamedika.medifirst2000.controller.base.IBaseRestController; import java.util.Map;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.core.web.WebConstants; import static com.jasamedika.medifirst2000.constants.Constants.MessageInfo.ERROR_MESSAGE;
import com.jasamedika.medifirst2000.exception.ServiceVOException; import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import com.jasamedika.medifirst2000.service.KeluhanPelangganService; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonHttpStatus;
import com.jasamedika.medifirst2000.util.rest.RestUtil; import static com.jasamedika.medifirst2000.util.rest.RestUtil.getJsonResponse;
import com.jasamedika.medifirst2000.vo.KeluhanPelangganVO; 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 @RestController
@RequestMapping("/keluhan-pelanggan") @RequestMapping("/keluhan-pelanggan")
public class KeluhanPelangganController extends LocaleController<KeluhanPelangganVO> implements IBaseRestController<KeluhanPelangganVO> { public class KeluhanPelangganController extends LocaleController<KeluhanPelangganVO> {
private static final Logger LOGGER = LoggerFactory.getLogger(KeluhanPelangganController.class);
@Autowired @Autowired
private KeluhanPelangganService keluhanPelangganService; private KeluhanPelangganService keluhanPelangganService;
private static final Logger LOGGER = LoggerFactory @RequestMapping(value = "/save-keluhan-pelanggan/", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
.getLogger(KeluhanPelangganController.class); public ResponseEntity<Map<String, Object>> addVO(@Valid @RequestBody KeluhanPelangganVO vo,
@RequestMapping(value = "/save-keluhan-pelanggan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> addVO(@Valid @RequestBody KeluhanPelangganVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=keluhanPelangganService.addKeluhanPelanggan(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 Keluhan Pelanggan", 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 Keluhan Pelanggan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/update-keluhan-pelanggan/", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> updateVO(@Valid @RequestBody KeluhanPelangganVO vo, HttpServletRequest request) {
try {
Map<String,Object> result=keluhanPelangganService.addKeluhanPelanggan(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 Keluhan Pelanggan", 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 Keluhan Pelanggan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-keluhan-pelanggan/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String,Object>> getAllVO(HttpServletRequest request) {
try {
Map<String,Object> result=keluhanPelangganService.findAllKeluhanPelanggan();
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 Keluhan Pelanggan", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR,
mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get all Keluhan Pelanggan", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE,
jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT,
mapHeaderMessage);
}
}
@RequestMapping(
value = "/get-keluhanpelanggan-by-period",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getKeluhanPelangganByPeriod(
@RequestParam(value = "bulan", required = true) Integer bulan,
@RequestParam(value = "tahun", required = true) Integer tahun,
HttpServletRequest request) { HttpServletRequest request) {
try {
Map<String, Object> result = keluhanPelangganService.addKeluhanPelanggan(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 addKeluhanPelanggan", e.getMessage());
addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got JpaSystemException {} when addKeluhanPelanggan", jse.getMessage());
addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/get-keluhanpelanggan-by-period", method = GET, produces = APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> getKeluhanPelangganByPeriod(@RequestParam(value = "bulan") Integer bulan,
@RequestParam(value = "tahun") Integer tahun, HttpServletRequest request) {
try { try {
Map<String, Object> result = this.keluhanPelangganService.getKeluhanPelangganByPeriod(bulan, tahun); Map<String, Object> result = this.keluhanPelangganService.getKeluhanPelangganByPeriod(bulan, tahun);
if (null != result) { if (null != result) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
getMessage(MessageResource.LABEL_SUCCESS, request)); return getJsonResponse(result, OK, mapHeaderMessage);
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
} else { } else {
return RestUtil.getJsonResponse(result, HttpStatus.NOT_FOUND, mapHeaderMessage); return getJsonResponse(null, NOT_FOUND, mapHeaderMessage);
} }
} catch (ServiceVOException e) { } catch (ServiceVOException e) {
LOGGER.error("Got exception {} when getKeluhanPelangganByPeriod", e.getMessage()); LOGGER.error("Got ServiceVOException {} when getKeluhanPelangganByPeriod", e.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, e.getMessage()); addHeaderMessage(ERROR_MESSAGE, e.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return getJsonHttpStatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when getKeluhanPelangganByPeriod", jse.getMessage()); LOGGER.error("Got JpaSystemException {} when getKeluhanPelangganByPeriod", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return getJsonHttpStatus(CONFLICT, mapHeaderMessage);
} }
} }
@RequestMapping(value="/get-pekerjaan",
method=RequestMethod.GET,
produces=MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> getPekerjaan(
@RequestParam("noRec")String noRec, HttpServletRequest request) {
Map<String, Object> result = this.keluhanPelangganService.getPekerjaan();
return result;
}
@Override
public ResponseEntity<Collection<KeluhanPelangganVO>> getAllVOWithQueryString(HttpServletRequest request,
Integer page, Integer limit, String sort, String dir) {
return null;
}
@Override
public ResponseEntity<KeluhanPelangganVO> getVO(Integer id) {
return null;
}
@Override
public ResponseEntity<String> addVO(KeluhanPelangganVO vo) {
return null;
}
@Override
public ResponseEntity<String> editVO(KeluhanPelangganVO vo) {
return null;
}
@Override
public ResponseEntity<String> deleteVO(Integer id) {
return null;
}
@Override
public ResponseEntity<List<KeluhanPelangganVO>> getAllVO() {
return null;
}
} }

View File

@ -1,95 +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.KemenLembService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.KemenLembVO;
@RestController
@RequestMapping("/kemen-lemb")
public class KemenLembController extends LocaleController<KemenLembVO>{
@Autowired
private KemenLembService kemenLembService;
private static final Logger LOGGER = LoggerFactory
.getLogger(KemenLembController.class);
@RequestMapping(value = "/save-kemen-lemb",
method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> saveKemenLemb(@Valid @RequestBody KemenLembVO vo, HttpServletRequest request) {
try {
Map<String,Object> result = kemenLembService.saveKemenLemb(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 saveKemenLemb", 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 saveKemenLemb", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
@RequestMapping(value = "/find-all-kemen-lemb", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findAllKemenLemb(HttpServletRequest request) {
Map<String, Object> result=null;
try {
result = kemenLembService.findAllKemenLemb();
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 ex){
ex.printStackTrace();
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
@RequestMapping(value = "/find-one-kemen-lemb", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, Object>> findOneKemenLemb(HttpServletRequest request) {
Map<String, Object> result=null;
try {
result = kemenLembService.findOneKemenLemb();
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 ex){
ex.printStackTrace();
}
return RestUtil.getJsonResponse(result, HttpStatus.OK);
}
}

View File

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