Merge branch 'dev/integrasi/superapp' into dev/no-cron

This commit is contained in:
Salman Manoe 2024-07-03 11:06:16 +07:00
commit ec979efb8a

View File

@ -1,17 +1,16 @@
package com.jasamedika.medifirst2000.controller;
import com.jasamedika.medifirst2000.constants.MessageResource;
import com.jasamedika.medifirst2000.controller.base.LocaleController;
import com.jasamedika.medifirst2000.dto.superapp.request.EmailDto;
import com.jasamedika.medifirst2000.dto.superapp.response.AuthorizationDto;
import com.jasamedika.medifirst2000.exception.ServiceVOException;
import com.jasamedika.medifirst2000.service.MapPegawaiJabatanToUnitKerjaService;
import com.jasamedika.medifirst2000.service.PelayananPasienService;
import com.jasamedika.medifirst2000.util.rest.RestUtil;
import com.jasamedika.medifirst2000.vo.LogbookKinerjaVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.annotation.PathVariable;
@ -23,9 +22,8 @@ import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
import static com.jasamedika.medifirst2000.core.web.WebConstants.HttpHeaderInfo.LABEL_SUCCESS;
import static org.springframework.http.HttpStatus.CREATED;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
import static org.springframework.http.HttpStatus.OK;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
@ -48,29 +46,23 @@ public class RemunerasiController extends LocaleController<LogbookKinerjaVO> {
private MapPegawaiJabatanToUnitKerjaService mapPegawaiJabatanToUnitKerjaService;
@RequestMapping(value = "/logbook-tarif/{idPegawai}/{bulan}", method = GET)
public ResponseEntity<List<Map<String, Object>>> recap(HttpServletRequest request,
@PathVariable("idPegawai") Integer idPegawai, @PathVariable("bulan") String bulan) {
try {
List<Map<String, Object>> result = pelayananPasienService.rekapLogbook(idPegawai, bulan);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, OK, mapHeaderMessage);
} catch (ServiceVOException | JpaSystemException e) {
LOGGER.error("Got exception {} when get recap remun", e.getMessage());
public ResponseEntity<Object> recap(HttpServletRequest request, @PathVariable("idPegawai") Integer idPegawai,
@PathVariable("bulan") String bulan) {
LOGGER.error("Superapp requesting logbook tarif data id pegawai {} bulan {}", idPegawai, bulan);
return RestUtil.getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
}
List<Map<String, Object>> result = pelayananPasienService.rekapLogbook(idPegawai, bulan);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@RequestMapping(value = "/authorization", method = POST, produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE)
public ResponseEntity<Object> authorize(HttpServletRequest request, @RequestBody EmailDto dto) {
try {
AuthorizationDto result = mapPegawaiJabatanToUnitKerjaService.get(dto);
mapHeaderMessage.put(LABEL_SUCCESS, getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, OK, mapHeaderMessage);
return new ResponseEntity<>(result, CREATED);
} catch (ServiceVOException | JpaSystemException e) {
LOGGER.error("Got exception {} when get authorization for superapp", e.getMessage());
return RestUtil.getJsonHttptatus(INTERNAL_SERVER_ERROR, mapHeaderMessage);
return new ResponseEntity<>(null, INTERNAL_SERVER_ERROR);
}
}
}