Update IkiDanRemunerasiController

Perubahan service update target skor dokter juga bisa simpan target skor baru
This commit is contained in:
Salman Manoe 2022-01-14 08:04:02 +07:00
parent 44b5c0ce4d
commit d0a8669621

View File

@ -2112,11 +2112,16 @@ public class IkiDanRemunerasiController extends LocaleController<IkiDanRemuneras
} }
} }
@RequestMapping(value = "/update-target-skor-dokter", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/save-target-skor-dokter", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<TargetSkorDokterVO> updateTargetSkorDokter(HttpServletRequest request, public ResponseEntity<TargetSkorDokterVO> saveTargetSkorDokter(HttpServletRequest request,
@Valid @RequestBody TargetSkorDokterVO vo) { @Valid @RequestBody TargetSkorDokterVO vo) {
try { try {
TargetSkorDokterVO result = targetSkorDokterService.update(vo); TargetSkorDokterVO result = new TargetSkorDokterVO();
if (CommonUtil.isNotNullOrEmpty(vo.getNoRec())) {
result = targetSkorDokterService.update(vo);
} else {
result = targetSkorDokterService.add(vo);
}
if (CommonUtil.isNotNullOrEmpty(result)) { if (CommonUtil.isNotNullOrEmpty(result)) {
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS, mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request)); getMessage(MessageResource.LABEL_SUCCESS, request));
@ -2125,11 +2130,11 @@ public class IkiDanRemunerasiController extends LocaleController<IkiDanRemuneras
return RestUtil.getJsonHttptatus(HttpStatus.NO_CONTENT); return RestUtil.getJsonHttptatus(HttpStatus.NO_CONTENT);
} }
} catch (ServiceVOException sve) { } catch (ServiceVOException sve) {
LOGGER.error("Got exception {} when update target skor dokter", sve.getMessage()); LOGGER.error("Got exception {} when add/update target skor dokter", sve.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, sve.getMessage()); addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, sve.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage); return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) { } catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when update target skor dokter", jse.getMessage()); LOGGER.error("Got exception {} when add/update target skor dokter", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage()); addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage); return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
} }