Create service json slip gaji

This commit is contained in:
Salman Manoe 2023-05-04 14:32:08 +07:00
parent fe1959156f
commit f0d4c37195
3 changed files with 39 additions and 2 deletions

View File

@ -132,4 +132,6 @@ public interface ReportService extends BaseVoService<Pasien, PasienVO, Integer>
Integer idRincianKegiatan);
Map<String, Object> defineSlipGajiDataSource(Integer pegawaiId, Long bulan);
List<Map<String, Object>> allSlipGajiDataSource(Long bulan);
}

View File

@ -49,6 +49,7 @@ import com.jasamedika.medifirst2000.dao.PencatatanSuhuMesinDao;
import com.jasamedika.medifirst2000.dao.PlanningPegawaiStatusDao;
import com.jasamedika.medifirst2000.dao.ReportingDao;
import com.jasamedika.medifirst2000.dao.SettingDataFixedDao;
import com.jasamedika.medifirst2000.dao.SlipGajiDao;
import com.jasamedika.medifirst2000.dao.StatusPegawaiDao;
import com.jasamedika.medifirst2000.dao.UnitKerjaDao;
import com.jasamedika.medifirst2000.dao.custom.LimbahB3MasukDaoCustom;
@ -164,6 +165,9 @@ public class ReportServiceImpl extends BaseVoServiceImpl implements ReportServic
@Autowired
private HistoriUsulanRincianKegiatanDao historiUsulanRincianKegiatanDao;
@Autowired
private SlipGajiDao slipGajiDao;
private static final String[] INDONESIAN_WEEK = new String[] { "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu",
"Minggu" };
@ -3521,4 +3525,17 @@ public class ReportServiceImpl extends BaseVoServiceImpl implements ReportServic
return result;
}
@Override
public List<Map<String, Object>> allSlipGajiDataSource(Long bulan) {
List<Map<String, Object>> result = new ArrayList<>();
Date month = new Date(bulan);
Date start = DateUtil.startMonth(month);
Date end = DateUtil.endMonth(month);
List<Integer> listIdPegawai = slipGajiDao.findPegawaiByBulan(start, end);
for (Integer idPegawai : listIdPegawai) {
result.add(this.defineSlipGajiDataSource(idPegawai, bulan));
}
return result;
}
}

View File

@ -7840,8 +7840,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
}
@RequestMapping("/slipGaji")
public ModelAndView getSlipGaji(ModelAndView m,
@RequestParam(value = "format", required = false) String format,
public ModelAndView getSlipGaji(ModelAndView m, @RequestParam(value = "format", required = false) String format,
@RequestParam(value = "bulan", required = true) Long bulan) {
List<Map<String, Object>> dataSource = new ArrayList<>();
LoginUser loginUser = loginUserService.getLoginUser();
@ -7856,4 +7855,23 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
return m;
}
@RequestMapping(value = "/slip-gaji/json", method = RequestMethod.GET)
public ResponseEntity<List<Map<String, Object>>> jsonSlipGaji(HttpServletRequest request,
@RequestParam(value = "bulan", required = true) Long bulan) {
try {
List<Map<String, Object>> result = reportService.allSlipGajiDataSource(bulan);
mapHeaderMessage.put(WebConstants.HttpHeaderInfo.LABEL_SUCCESS,
getMessage(MessageResource.LABEL_SUCCESS, request));
return RestUtil.getJsonResponse(result, HttpStatus.OK, mapHeaderMessage);
} catch (ServiceVOException sve) {
LOGGER.error("Got exception {} when get json slip gaji", sve.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, sve.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.INTERNAL_SERVER_ERROR, mapHeaderMessage);
} catch (JpaSystemException jse) {
LOGGER.error("Got exception {} when get json slip gaji", jse.getMessage());
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
}
}
}