Update SkoringTindakanMedisService
Perbaikan service pengecekan data duplikat saat simpan edit skoring tindakan medis
This commit is contained in:
parent
81c867eeea
commit
3484b994c0
@ -101,27 +101,28 @@ public interface SkoringTindakanMedisDao extends PagingAndSortingRepository<Skor
|
||||
String strCekDupSkoring = "select stm.noRec " + "from SkoringTindakanMedis stm " + "inner join stm.produk pd "
|
||||
+ "where stm.statusEnabled is true "
|
||||
+ "and lower(regexp_replace(pd.namaProduk,:patternText,'','g')) = :namaProduk "
|
||||
+ "and stm.kelompokKerjaId = :kelompokKerjaId " + "and stm.skor = :skor "
|
||||
+ "and stm.kelompokKerjaId = :kelompokKerjaId "
|
||||
+ "and lower(regexp_replace(stm.detailProduk,:patternText,'','g')) = :detailProduk";
|
||||
|
||||
String skor = " and stm.skor = :skor";
|
||||
|
||||
String tglBerlaku = " and to_char(stm.tanggalMulaiBerlaku,'yyyy-MM-dd') = :tglMulaiBerlaku";
|
||||
|
||||
String idSkoring = " and stm.noRec <> :noRec";
|
||||
|
||||
String sortTglBerlaku = " order by stm.tanggalMulaiBerlaku desc";
|
||||
|
||||
@Query(strCekDupSkoring + sortTglBerlaku)
|
||||
@Query(strCekDupSkoring + skor + sortTglBerlaku)
|
||||
List<String> findLastDupSkoring(@Param("namaProduk") String namaProduk,
|
||||
@Param("kelompokKerjaId") Integer idKelompokKerja, @Param("skor") Double skor,
|
||||
@Param("patternText") String patternText, @Param("detailProduk") String detailProduk);
|
||||
|
||||
@Query(strCekDupSkoring + tglBerlaku)
|
||||
List<String> findDupSkoring(@Param("namaProduk") String namaProduk,
|
||||
@Param("kelompokKerjaId") Integer idKelompokKerja, @Param("skor") Double skor,
|
||||
@Param("tglMulaiBerlaku") String tglMulaiBerlaku, @Param("patternText") String patternText,
|
||||
@Param("detailProduk") String detailProduk);
|
||||
@Param("kelompokKerjaId") Integer idKelompokKerja, @Param("tglMulaiBerlaku") String tglMulaiBerlaku,
|
||||
@Param("patternText") String patternText, @Param("detailProduk") String detailProduk);
|
||||
|
||||
@Query(strCekDupSkoring + idSkoring + sortTglBerlaku)
|
||||
@Query(strCekDupSkoring + skor + idSkoring + sortTglBerlaku)
|
||||
List<String> findLastDupSkoring(@Param("namaProduk") String namaProduk,
|
||||
@Param("kelompokKerjaId") Integer idKelompokKerja, @Param("skor") Double skor,
|
||||
@Param("patternText") String patternText, @Param("detailProduk") String detailProduk,
|
||||
@ -129,9 +130,9 @@ public interface SkoringTindakanMedisDao extends PagingAndSortingRepository<Skor
|
||||
|
||||
@Query(strCekDupSkoring + tglBerlaku + idSkoring)
|
||||
List<String> findDupSkoring(@Param("namaProduk") String namaProduk,
|
||||
@Param("kelompokKerjaId") Integer idKelompokKerja, @Param("skor") Double skor,
|
||||
@Param("tglMulaiBerlaku") String tglMulaiBerlaku, @Param("patternText") String patternText,
|
||||
@Param("detailProduk") String detailProduk, @Param("noRec") String noRec);
|
||||
@Param("kelompokKerjaId") Integer idKelompokKerja, @Param("tglMulaiBerlaku") String tglMulaiBerlaku,
|
||||
@Param("patternText") String patternText, @Param("detailProduk") String detailProduk,
|
||||
@Param("noRec") String noRec);
|
||||
|
||||
@Query("select new Map(stm.noRec as noRec,stm.detailProduk as detailProduk) " + "from SkoringTindakanMedis stm "
|
||||
+ "where stm.statusEnabled is true " + "and stm.noRec in (:listNorec)")
|
||||
|
||||
@ -319,14 +319,14 @@ public class SkoringTindakanMedisServiceImpl extends BaseVoServiceImpl implement
|
||||
listNorec = skoringTindakanMedisDao.findLastDupSkoring(replacedNamaProduk, idKelompokKerja, skor,
|
||||
patternText, replacedDetailProduk, noRec);
|
||||
if (CommonUtil.isNullOrEmpty(listNorec)) {
|
||||
listNorec = skoringTindakanMedisDao.findDupSkoring(replacedNamaProduk, idKelompokKerja, skor,
|
||||
listNorec = skoringTindakanMedisDao.findDupSkoring(replacedNamaProduk, idKelompokKerja,
|
||||
df.format(new Date(tglMulaiBerlaku)), patternText, replacedDetailProduk, noRec);
|
||||
}
|
||||
} else {
|
||||
listNorec = skoringTindakanMedisDao.findLastDupSkoring(replacedNamaProduk, idKelompokKerja, skor,
|
||||
patternText, replacedDetailProduk);
|
||||
if (CommonUtil.isNullOrEmpty(listNorec)) {
|
||||
listNorec = skoringTindakanMedisDao.findDupSkoring(replacedNamaProduk, idKelompokKerja, skor,
|
||||
listNorec = skoringTindakanMedisDao.findDupSkoring(replacedNamaProduk, idKelompokKerja,
|
||||
df.format(new Date(tglMulaiBerlaku)), patternText, replacedDetailProduk);
|
||||
}
|
||||
}
|
||||
@ -569,7 +569,7 @@ public class SkoringTindakanMedisServiceImpl extends BaseVoServiceImpl implement
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
countDown.await();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user