Merge branch 'dev/remun/kinerja/hapus' into dev/no-cron
This commit is contained in:
commit
f9b3e5c8c1
@ -9,10 +9,13 @@ import org.springframework.stereotype.Repository;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository("logbookKinerjaDao")
|
||||
public interface LogbookKinerjaDao extends JpaRepository<LogbookKinerja, String> {
|
||||
|
||||
Optional<LogbookKinerja> findByNoRec(String noRec);
|
||||
|
||||
@Query("select new Map(lk.noRec as noRec," + "pg.id as pegawaiId,pg.namaLengkap as namaPegawai,"
|
||||
+ "jb.id as jabatanId,jb.namaJabatan as namaJabatan,"
|
||||
+ "ik.id as indikatorId,ik.namaIndikator as namaIndikator,"
|
||||
|
||||
@ -27,6 +27,7 @@ import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
|
||||
import static com.jasamedika.medifirst2000.constants.Master.SatuanIndikator.PERCENTAGE;
|
||||
import static com.jasamedika.medifirst2000.enums.JenisLog.HAPUS;
|
||||
|
||||
@Service("LogbookKinerjaDetailService")
|
||||
@ -61,8 +62,8 @@ public class LogbookKinerjaDetailServiceImpl extends BaseVoServiceImpl implement
|
||||
* menghitung capaian indikator satuan yang harus dihitung secara
|
||||
* akumulatif
|
||||
*/
|
||||
List<Map<String, Object>> dataSatuanJumlah = logbookKinerjaDetailDao.findSumCapaianByKontrak(
|
||||
vo.getLogbookKinerja().getNoRec(), Arrays.asList(Master.SatuanIndikator.PERCENTAGE));
|
||||
List<Map<String, Object>> dataSatuanJumlah = logbookKinerjaDetailDao
|
||||
.findSumCapaianByKontrak(vo.getLogbookKinerja().getNoRec(), Arrays.asList(PERCENTAGE));
|
||||
if (CommonUtil.isNotNullOrEmpty(dataSatuanJumlah)) {
|
||||
List<LogbookKinerja> models = new ArrayList<>();
|
||||
for (Map<String, Object> map : dataSatuanJumlah) {
|
||||
@ -76,8 +77,8 @@ public class LogbookKinerjaDetailServiceImpl extends BaseVoServiceImpl implement
|
||||
* menghitung capaian indikator satuan yang harus dihitung secara
|
||||
* rata-rata
|
||||
*/
|
||||
List<Map<String, Object>> dataSatuanRatarata = logbookKinerjaDetailDao.findAvgCapaianByKontrak(
|
||||
vo.getLogbookKinerja().getNoRec(), Arrays.asList(Master.SatuanIndikator.PERCENTAGE));
|
||||
List<Map<String, Object>> dataSatuanRatarata = logbookKinerjaDetailDao
|
||||
.findAvgCapaianByKontrak(vo.getLogbookKinerja().getNoRec(), Arrays.asList(PERCENTAGE));
|
||||
if (CommonUtil.isNotNullOrEmpty(dataSatuanRatarata)) {
|
||||
List<LogbookKinerja> models = new ArrayList<>();
|
||||
for (Map<String, Object> map : dataSatuanRatarata) {
|
||||
@ -106,8 +107,8 @@ public class LogbookKinerjaDetailServiceImpl extends BaseVoServiceImpl implement
|
||||
* menghitung capaian indikator satuan yang harus dihitung secara
|
||||
* akumulatif
|
||||
*/
|
||||
List<Map<String, Object>> dataSatuanJumlah = logbookKinerjaDetailDao.findSumCapaianByKontrak(
|
||||
vo.getLogbookKinerja().getNoRec(), Arrays.asList(Master.SatuanIndikator.PERCENTAGE));
|
||||
List<Map<String, Object>> dataSatuanJumlah = logbookKinerjaDetailDao
|
||||
.findSumCapaianByKontrak(vo.getLogbookKinerja().getNoRec(), Arrays.asList(PERCENTAGE));
|
||||
if (CommonUtil.isNotNullOrEmpty(dataSatuanJumlah)) {
|
||||
List<LogbookKinerja> models = new ArrayList<>();
|
||||
for (Map<String, Object> map : dataSatuanJumlah) {
|
||||
@ -121,8 +122,8 @@ public class LogbookKinerjaDetailServiceImpl extends BaseVoServiceImpl implement
|
||||
* menghitung capaian indikator satuan yang harus dihitung secara
|
||||
* rata-rata
|
||||
*/
|
||||
List<Map<String, Object>> dataSatuanRatarata = logbookKinerjaDetailDao.findAvgCapaianByKontrak(
|
||||
vo.getLogbookKinerja().getNoRec(), Arrays.asList(Master.SatuanIndikator.PERCENTAGE));
|
||||
List<Map<String, Object>> dataSatuanRatarata = logbookKinerjaDetailDao
|
||||
.findAvgCapaianByKontrak(vo.getLogbookKinerja().getNoRec(), Arrays.asList(PERCENTAGE));
|
||||
if (CommonUtil.isNotNullOrEmpty(dataSatuanRatarata)) {
|
||||
List<LogbookKinerja> models = new ArrayList<>();
|
||||
for (Map<String, Object> map : dataSatuanRatarata) {
|
||||
@ -303,14 +304,40 @@ public class LogbookKinerjaDetailServiceImpl extends BaseVoServiceImpl implement
|
||||
@Override
|
||||
public void hapusCatatanKinerja(String norec) {
|
||||
Optional<LogbookKinerjaDetail> byNoRec = logbookKinerjaDetailDao.findByNoRec(norec);
|
||||
byNoRec.ifPresent(d -> {
|
||||
d.setStatusVerifikasi(false);
|
||||
d.setStatusEnabled(false);
|
||||
LogbookKinerjaDetailLogReqDto.LogbookKinerjaDetailLogReqDtoBuilder dtoBuilder = LogbookKinerjaDetailLogReqDto
|
||||
.builder();
|
||||
LogbookKinerjaDetailLogReqDto reqDto = dtoBuilder.catatanKinerjaId(norec).jenisLog(HAPUS).build();
|
||||
logbookKinerjaDetailDao.save(d);
|
||||
logCatatanKinerjaService.save(reqDto);
|
||||
byNoRec.ifPresent(catatanKinerja -> {
|
||||
{
|
||||
catatanKinerja.setStatusVerifikasi(false);
|
||||
catatanKinerja.setStatusEnabled(false);
|
||||
logbookKinerjaDetailDao.save(catatanKinerja);
|
||||
}
|
||||
{
|
||||
Optional<LogbookKinerja> byIdLogbook = logbookKinerjaDao
|
||||
.findByNoRec(catatanKinerja.getLogbookKinerjaId());
|
||||
byIdLogbook.ifPresent(logbookKinerja -> {
|
||||
if (Arrays.asList(PERCENTAGE)
|
||||
.contains(logbookKinerja.getIndikatorKinerja().getSatuanIndikatorId())) {
|
||||
List<Map<String, Object>> listCatatan = logbookKinerjaDetailDao
|
||||
.findAvgCapaianByKontrak(logbookKinerja.getNoRec(), Arrays.asList(PERCENTAGE));
|
||||
Optional<Map<String, Object>> catatan = listCatatan.stream()
|
||||
.filter(c -> logbookKinerja.getNoRec().equals(c.get("logbookId"))).findFirst();
|
||||
catatan.ifPresent(
|
||||
c -> logbookKinerja.setCapaian(Double.parseDouble(c.get("avgCapaian").toString())));
|
||||
} else {
|
||||
List<Map<String, Object>> listCatatan = logbookKinerjaDetailDao
|
||||
.findSumCapaianByKontrak(logbookKinerja.getNoRec(), Arrays.asList(PERCENTAGE));
|
||||
Optional<Map<String, Object>> catatan = listCatatan.stream()
|
||||
.filter(c -> logbookKinerja.getNoRec().equals(c.get("logbookId"))).findFirst();
|
||||
catatan.ifPresent(
|
||||
c -> logbookKinerja.setCapaian(Double.parseDouble(c.get("sumCapaian").toString())));
|
||||
}
|
||||
logbookKinerjaDao.save(logbookKinerja);
|
||||
});
|
||||
}
|
||||
{
|
||||
LogbookKinerjaDetailLogReqDto reqDto = LogbookKinerjaDetailLogReqDto.builder().catatanKinerjaId(norec)
|
||||
.jenisLog(HAPUS).build();
|
||||
logCatatanKinerjaService.save(reqDto);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -9,8 +9,6 @@ import javax.persistence.*;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
import static javax.persistence.FetchType.LAZY;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@ -40,7 +38,7 @@ public class LogbookKinerja extends BaseTransaction {
|
||||
@Caption(value = "Status Verifikasi")
|
||||
private Boolean statusVerifikasi;
|
||||
|
||||
@ManyToOne(fetch = LAZY)
|
||||
@ManyToOne
|
||||
@NotNull(message = "Pegawai tidak boleh kosong")
|
||||
@JoinColumn(name = "objectpegawaifk")
|
||||
@Caption(value = "Pegawai")
|
||||
@ -49,7 +47,7 @@ public class LogbookKinerja extends BaseTransaction {
|
||||
@Column(name = "objectpegawaifk", insertable = false, updatable = false)
|
||||
private Integer pegawaiId;
|
||||
|
||||
@ManyToOne(fetch = LAZY)
|
||||
@ManyToOne
|
||||
@NotNull(message = "Jabatan tidak boleh kosong")
|
||||
@JoinColumn(name = "objectjabatanfk")
|
||||
@Caption(value = "Jabatan")
|
||||
@ -58,7 +56,7 @@ public class LogbookKinerja extends BaseTransaction {
|
||||
@Column(name = "objectjabatanfk", insertable = false, updatable = false)
|
||||
private Integer jabatanId;
|
||||
|
||||
@ManyToOne(fetch = LAZY)
|
||||
@ManyToOne
|
||||
@NotNull(message = "Indikator kinerja tidak boleh kosong")
|
||||
@JoinColumn(name = "objectindikatorkinerjafk")
|
||||
@Caption(value = "Indikator Kinerja")
|
||||
|
||||
@ -9,8 +9,6 @@ import javax.persistence.*;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
import static javax.persistence.FetchType.LAZY;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@ -40,7 +38,7 @@ public class LogbookKinerjaDetail extends BaseTransaction {
|
||||
@Caption(value = "Status Verifikasi")
|
||||
private Boolean statusVerifikasi;
|
||||
|
||||
@ManyToOne(fetch = LAZY)
|
||||
@ManyToOne
|
||||
@NotNull(message = "Indikator kinerja tidak boleh kosong")
|
||||
@JoinColumn(name = "objectlogbookkinerjafk")
|
||||
@Caption(value = "Logbook Kinerja")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user