Update AbsensiPegawaiService
Pembuatan API untuk kelngkapan data NIK pegawai di service presensi pegawai
This commit is contained in:
parent
529c604236
commit
74f90cd46c
@ -32,7 +32,7 @@ public interface HabsenDao extends PagingAndSortingRepository<Habsen, Integer> {
|
||||
Map<String, Object> getJadwalPegawai(@Param("idPegawai") Integer idPegawai,
|
||||
@Param("tanggalJadwal") String tanggalJadwal);
|
||||
|
||||
@Query("select new Map(" + "pg.namaLengkap as namaLengkap," + "pg.idFinger as idFinger, "
|
||||
@Query("select new Map(pg.noIdentitas as noIdentitas," + "pg.namaLengkap as namaLengkap," + "pg.idFinger as idFinger, "
|
||||
+ "to_char(now(), 'yyyy-MM-dd') as tanggal, " + "to_char(now(), 'HH24:MI:SS') as jam) " + "from Pegawai pg "
|
||||
+ "where pg.id = :idPegawai")
|
||||
Map<String, Object> getPegawai(@Param("idPegawai") Integer idPegawai);
|
||||
|
||||
@ -4,6 +4,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.jasamedika.medifirst2000.dto.PegawaiDto;
|
||||
import com.jasamedika.medifirst2000.entities.Pegawai;
|
||||
import com.jasamedika.medifirst2000.vo.PegawaiVO;
|
||||
import com.jasamedika.medifirst2000.vo.RegistrasiPegawaiMobileVO;
|
||||
@ -176,4 +177,5 @@ public interface PegawaiService extends BaseVoService<Pegawai, PegawaiVO, Intege
|
||||
|
||||
String findAvatar(Integer idPegawai);
|
||||
|
||||
void completeDataPegawai(PegawaiDto dto);
|
||||
}
|
||||
|
||||
@ -316,32 +316,34 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
|
||||
@Override
|
||||
public Map<String, Object> findJadwalPegawai(Integer idPegawai) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String today = sdf.format(new Date());
|
||||
|
||||
result = habsensiDao.getPegawai(idPegawai);
|
||||
|
||||
String jadwal = habsensiDao.getPegawaiJadwal(idPegawai, today);
|
||||
if (CommonUtil.isNotNullOrEmpty(jadwal)) {
|
||||
result.put("jadwal", "-");
|
||||
if (CommonUtil.isNotNullOrEmpty(jadwal))
|
||||
result.put("jadwal", jadwal);
|
||||
} else {
|
||||
result.put("jadwal", "-");
|
||||
}
|
||||
|
||||
List<Integer> wfhStatus = habsensiDao.getWfhStatusByApp(idPegawai, today);
|
||||
if (CommonUtil.isNotNullOrEmpty(wfhStatus)) {
|
||||
result.put("isWFH", false);
|
||||
if (CommonUtil.isNotNullOrEmpty(wfhStatus))
|
||||
for (Integer i : wfhStatus) {
|
||||
if (i == 1) {
|
||||
result.put("isWFH", false);
|
||||
if (i == 1)
|
||||
result.put("isWFH", true);
|
||||
} else {
|
||||
result.put("isWFH", false);
|
||||
}
|
||||
{
|
||||
result.put("isComplete", false);
|
||||
if (CommonUtil.isNotNullOrEmpty(result.get("noIdentitas"))) {
|
||||
String noIdentitas = result.get("noIdentitas").toString().trim();
|
||||
try {
|
||||
Integer.valueOf(noIdentitas);
|
||||
result.put("isComplete", true);
|
||||
} catch (NumberFormatException ex) {
|
||||
result.put("isComplete", false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result.put("isWFH", false);
|
||||
result.remove("noIdentitas");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -57,6 +57,7 @@ import com.jasamedika.medifirst2000.dao.StatusPerkawinanDao;
|
||||
import com.jasamedika.medifirst2000.dao.SukuDao;
|
||||
import com.jasamedika.medifirst2000.dao.TypePegawaiDao;
|
||||
import com.jasamedika.medifirst2000.dao.custom.PegawaiDaoCustom;
|
||||
import com.jasamedika.medifirst2000.dto.PegawaiDto;
|
||||
import com.jasamedika.medifirst2000.entities.Jabatan;
|
||||
import com.jasamedika.medifirst2000.entities.JadwalDokter;
|
||||
import com.jasamedika.medifirst2000.entities.JadwalPraktek;
|
||||
@ -2453,4 +2454,12 @@ public class PegawaiServiceImpl extends BaseVoServiceImpl implements PegawaiServ
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void completeDataPegawai(PegawaiDto dto) {
|
||||
Pegawai pegawai = pegawaiDao.findById(dto.getId());
|
||||
if (CommonUtil.isNotNullOrEmpty(pegawai)) {
|
||||
pegawai.setNoIdentitas(dto.getNoIdentitas());
|
||||
pegawaiDao.save(pegawai);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
package com.jasamedika.medifirst2000.dto;
|
||||
|
||||
import com.jasamedika.medifirst2000.helper.Caption;
|
||||
|
||||
/**
|
||||
* @author salmanoe
|
||||
* @since Feb 24, 2023
|
||||
*/
|
||||
public class PegawaiDto {
|
||||
@Caption(value = "ID Pegawai")
|
||||
private Integer id;
|
||||
|
||||
@Caption(value = "NIK Pegawai")
|
||||
private String noIdentitas;
|
||||
|
||||
public PegawaiDto() {
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getNoIdentitas() {
|
||||
return noIdentitas;
|
||||
}
|
||||
|
||||
public void setNoIdentitas(String noIdentitas) {
|
||||
this.noIdentitas = noIdentitas;
|
||||
}
|
||||
}
|
||||
@ -33,6 +33,7 @@ import com.jasamedika.medifirst2000.core.web.WebConstants;
|
||||
import com.jasamedika.medifirst2000.dao.MapJabatanToUraianTugasDao;
|
||||
import com.jasamedika.medifirst2000.dao.MapUraianTugasToRincianKegiatanDao;
|
||||
import com.jasamedika.medifirst2000.dto.EditPegawaiDTO;
|
||||
import com.jasamedika.medifirst2000.dto.PegawaiDto;
|
||||
import com.jasamedika.medifirst2000.entities.LoginUser;
|
||||
import com.jasamedika.medifirst2000.entities.Pegawai;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
@ -1469,4 +1470,20 @@ public class PegawaiController extends LocaleController<PegawaiVO> implements IB
|
||||
return RestUtil.getJsonResponse(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/kelengkapan", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<Boolean> completePegawai(@RequestBody PegawaiDto dto) {
|
||||
try {
|
||||
pegawaiService.completeDataPegawai(dto);
|
||||
return RestUtil.getJsonResponse(true, HttpStatus.CREATED);
|
||||
} catch (ServiceVOException e) {
|
||||
LOGGER.error("Got exception {} when complete data pegawai", 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 complete data Pegawai", jse.getMessage());
|
||||
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user