- pembuatan service cek duplikat mapping skoring tindakan medis
- perbaikan file not found exception saat get detail presensi
This commit is contained in:
parent
752679c5cb
commit
3d3ece6c53
@ -95,4 +95,25 @@ public interface SkoringTindakanMedisDao extends PagingAndSortingRepository<Skor
|
|||||||
@Param("detailProduk") String detailProduk, @Param("tglMulaiBerlaku") Date tglMulaiBerlaku,
|
@Param("detailProduk") String detailProduk, @Param("tglMulaiBerlaku") Date tglMulaiBerlaku,
|
||||||
@Param("isStatusVerifikasi") Boolean statusVerifikasi);
|
@Param("isStatusVerifikasi") Boolean statusVerifikasi);
|
||||||
|
|
||||||
|
String strCekDupSkoring = "select stm.noRec " + "from SkoringTindakanMedis stm "
|
||||||
|
+ "where stm.statusEnabled is true " + "and stm.produkId = :produkId "
|
||||||
|
+ "and stm.kelompokKerjaId = :kelompokKerjaId " + "and stm.skor = :skor "
|
||||||
|
+ "and lower(regexp_replace(stm.detailProduk,:patternText,'','g')) = :detailProduk";
|
||||||
|
|
||||||
|
String idSkoring = " and stm.noRec <> :noRec";
|
||||||
|
|
||||||
|
@Query(strCekDupSkoring)
|
||||||
|
List<String> findDupSkoring(@Param("produkId") Integer idProduk, @Param("kelompokKerjaId") Integer idKelompokKerja,
|
||||||
|
@Param("skor") Double skor, @Param("patternText") String patternText,
|
||||||
|
@Param("detailProduk") String detailProduk);
|
||||||
|
|
||||||
|
@Query(strCekDupSkoring + idSkoring)
|
||||||
|
List<String> findDupSkoring(@Param("produkId") Integer idProduk, @Param("kelompokKerjaId") Integer idKelompokKerja,
|
||||||
|
@Param("skor") Double skor, @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)")
|
||||||
|
List<Map<String, Object>> findAllDup(@Param("listNorec") List<String> listNorec);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,8 @@ package com.jasamedika.medifirst2000.service;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.springframework.orm.jpa.JpaSystemException;
|
||||||
|
|
||||||
import com.jasamedika.medifirst2000.entities.SkoringTindakanMedis;
|
import com.jasamedika.medifirst2000.entities.SkoringTindakanMedis;
|
||||||
import com.jasamedika.medifirst2000.vo.SkoringTindakanMedisVO;
|
import com.jasamedika.medifirst2000.vo.SkoringTindakanMedisVO;
|
||||||
|
|
||||||
@ -10,8 +12,11 @@ public interface SkoringTindakanMedisService
|
|||||||
extends BaseVoService<SkoringTindakanMedis, SkoringTindakanMedisVO, String> {
|
extends BaseVoService<SkoringTindakanMedis, SkoringTindakanMedisVO, String> {
|
||||||
|
|
||||||
List<Map<String, Object>> findAllEnabled(Integer idUnitKerja, Integer idKelompokKerja, Integer idProduk,
|
List<Map<String, Object>> findAllEnabled(Integer idUnitKerja, Integer idKelompokKerja, Integer idProduk,
|
||||||
String detailProduk, Long tglMulaiBerlaku, Boolean statusVerifikasi);
|
String detailProduk, Long tglMulaiBerlaku, Boolean statusVerifikasi) throws JpaSystemException;
|
||||||
|
|
||||||
List<Map<String, Object>> findDaftarInputTindakanByRuanganKelas(Integer idRuangan);
|
List<Map<String, Object>> findDaftarInputTindakanByRuanganKelas(Integer idRuangan) throws JpaSystemException;
|
||||||
|
|
||||||
|
List<Map<String, Object>> findDuplicateSkoring(Integer idProduk, Integer idKelompokKerja, Double skor,
|
||||||
|
String detailProduk, String noRec) throws JpaSystemException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -181,41 +181,49 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String encodeFileToBase64Binary(File file) throws Exception {
|
private static String encodeFileToBase64Binary(File file) {
|
||||||
|
String result = "";
|
||||||
|
try {
|
||||||
FileInputStream fileInputStreamReader = new FileInputStream(file);
|
FileInputStream fileInputStreamReader = new FileInputStream(file);
|
||||||
byte[] bytes = new byte[(int) file.length()];
|
byte[] bytes = new byte[(int) file.length()];
|
||||||
fileInputStreamReader.read(bytes);
|
fileInputStreamReader.read(bytes);
|
||||||
String result = new String(org.apache.commons.codec.binary.Base64.encodeBase64(bytes), "UTF-8");
|
result = new String(org.apache.commons.codec.binary.Base64.encodeBase64(bytes), "UTF-8");
|
||||||
|
|
||||||
fileInputStreamReader.close();
|
fileInputStreamReader.close();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> findDetailPresensi(List<Integer> listTrNo) {
|
public List<Map<String, Object>> findDetailPresensi(List<Integer> listTrNo) {
|
||||||
List<Map<String, Object>> result = new ArrayList<>();
|
List<Map<String, Object>> result = new ArrayList<>();
|
||||||
try {
|
|
||||||
List<Map<String, Object>> data = habsensiDao.getDetailPresensi(listTrNo);
|
List<Map<String, Object>> data = habsensiDao.getDetailPresensi(listTrNo);
|
||||||
for (Map<String, Object> map : data) {
|
for (Map<String, Object> map : data) {
|
||||||
Map<String, Object> mapRs = new HashMap<>();
|
Map<String, Object> mapRs = new HashMap<>();
|
||||||
String imageURLData = "data:image/jpg;base64,"
|
String imageURLData = "";
|
||||||
+ encodeFileToBase64Binary(new File(getImageAbsoluteFilePath(map.get("filePath").toString())));
|
String encodeRs = encodeFileToBase64Binary(
|
||||||
|
new File(getImageAbsoluteFilePath(map.get("filePath").toString())));
|
||||||
|
if (CommonUtil.isNotNullOrEmpty(encodeRs)) {
|
||||||
|
imageURLData = "data:image/jpg;base64," + encodeRs;
|
||||||
|
}
|
||||||
|
|
||||||
if (CommonUtil.isNotNullOrEmpty(map.get("filePath")) && CommonUtil.isNotNullOrEmpty(map.get("akurasi"))
|
if (CommonUtil.isNotNullOrEmpty(encodeRs) && CommonUtil.isNotNullOrEmpty(map.get("akurasi"))
|
||||||
&& CommonUtil.isNotNullOrEmpty(map.get("lokasi"))) {
|
&& CommonUtil.isNotNullOrEmpty(map.get("lokasi"))) {
|
||||||
mapRs.put("imageURLData", imageURLData);
|
mapRs.put("imageURLData", imageURLData);
|
||||||
mapRs.put("date", map.get("tanggal"));
|
mapRs.put("date", map.get("tanggal"));
|
||||||
mapRs.put("accuracy", map.get("akurasi").toString());
|
mapRs.put("accuracy", map.get("akurasi").toString());
|
||||||
mapRs.put("location", map.get("lokasi"));
|
mapRs.put("location", map.get("lokasi"));
|
||||||
} else if (CommonUtil.isNullOrEmpty(map.get("filePath"))
|
} else if (CommonUtil.isNullOrEmpty(encodeRs) && CommonUtil.isNotNullOrEmpty(map.get("akurasi"))
|
||||||
&& CommonUtil.isNotNullOrEmpty(map.get("akurasi"))
|
|
||||||
&& CommonUtil.isNotNullOrEmpty(map.get("lokasi"))) {
|
&& CommonUtil.isNotNullOrEmpty(map.get("lokasi"))) {
|
||||||
mapRs.put("imageURLData", "");
|
mapRs.put("imageURLData", "");
|
||||||
mapRs.put("date", map.get("tanggal"));
|
mapRs.put("date", map.get("tanggal"));
|
||||||
mapRs.put("accuracy", map.get("akurasi").toString());
|
mapRs.put("accuracy", map.get("akurasi").toString());
|
||||||
mapRs.put("location", map.get("lokasi"));
|
mapRs.put("location", map.get("lokasi"));
|
||||||
} else if (CommonUtil.isNotNullOrEmpty(map.get("filePath"))
|
} else if (CommonUtil.isNotNullOrEmpty(encodeRs) && CommonUtil.isNullOrEmpty(map.get("akurasi"))
|
||||||
&& CommonUtil.isNullOrEmpty(map.get("akurasi"))
|
|
||||||
&& CommonUtil.isNullOrEmpty(map.get("lokasi"))) {
|
&& CommonUtil.isNullOrEmpty(map.get("lokasi"))) {
|
||||||
mapRs.put("imageURLData", imageURLData);
|
mapRs.put("imageURLData", imageURLData);
|
||||||
mapRs.put("date", map.get("tanggal"));
|
mapRs.put("date", map.get("tanggal"));
|
||||||
@ -230,9 +238,6 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
|
|||||||
|
|
||||||
result.add(mapRs);
|
result.add(mapRs);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -145,7 +145,7 @@ public class IndikatorKinerjaServiceImpl extends BaseVoServiceImpl implements In
|
|||||||
List<Map<String, Object>> result = new ArrayList<>();
|
List<Map<String, Object>> result = new ArrayList<>();
|
||||||
List<Integer> listIdDup = new ArrayList<>();
|
List<Integer> listIdDup = new ArrayList<>();
|
||||||
|
|
||||||
String patternText = settingDataFixedDao.getSettingDataFixed("patternTextProduk");
|
String patternText = settingDataFixedDao.getSettingDataFixed("patternTextDuplicate");
|
||||||
String replacedNamaIndikator = namaIndikator.replaceAll(patternText, "").toLowerCase();
|
String replacedNamaIndikator = namaIndikator.replaceAll(patternText, "").toLowerCase();
|
||||||
if (CommonUtil.isNotNullOrEmpty(idIndikator)) {
|
if (CommonUtil.isNotNullOrEmpty(idIndikator)) {
|
||||||
listIdDup = indikatorKinerjaDao.findDupByName(patternText, idIndikator, replacedNamaIndikator);
|
listIdDup = indikatorKinerjaDao.findDupByName(patternText, idIndikator, replacedNamaIndikator);
|
||||||
|
|||||||
@ -1171,7 +1171,7 @@ public class ProdukServiceImpl extends BaseAngaranServiceImpl implements ProdukS
|
|||||||
public Map<String, Object> validateNamaProduk(Integer idProduk, String namaProduk) {
|
public Map<String, Object> validateNamaProduk(Integer idProduk, String namaProduk) {
|
||||||
Map<String, Object> result = new HashMap<>();
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
|
||||||
String patternText = settingDataFixedDao.getSettingDataFixed("patternTextProduk");
|
String patternText = settingDataFixedDao.getSettingDataFixed("patternTextDuplicate");
|
||||||
String replacedNamaProduk = namaProduk.replaceAll(patternText, "").toLowerCase();
|
String replacedNamaProduk = namaProduk.replaceAll(patternText, "").toLowerCase();
|
||||||
if (CommonUtil.isNotNullOrEmpty(idProduk)) {
|
if (CommonUtil.isNotNullOrEmpty(idProduk)) {
|
||||||
List<Map<String, Object>> listNamaProduk = produkDao.checkNamaProdukLama(patternText, idProduk,
|
List<Map<String, Object>> listNamaProduk = produkDao.checkNamaProdukLama(patternText, idProduk,
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import com.jasamedika.medifirst2000.converter.BaseConverterImpl;
|
import com.jasamedika.medifirst2000.converter.BaseConverterImpl;
|
||||||
import com.jasamedika.medifirst2000.dao.ProdukDao;
|
import com.jasamedika.medifirst2000.dao.ProdukDao;
|
||||||
|
import com.jasamedika.medifirst2000.dao.SettingDataFixedDao;
|
||||||
import com.jasamedika.medifirst2000.dao.SkoringTindakanMedisDao;
|
import com.jasamedika.medifirst2000.dao.SkoringTindakanMedisDao;
|
||||||
import com.jasamedika.medifirst2000.entities.Produk;
|
import com.jasamedika.medifirst2000.entities.Produk;
|
||||||
import com.jasamedika.medifirst2000.entities.SkoringTindakanMedis;
|
import com.jasamedika.medifirst2000.entities.SkoringTindakanMedis;
|
||||||
@ -40,6 +41,9 @@ public class SkoringTindakanMedisServiceImpl extends BaseVoServiceImpl implement
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ProdukDao produkDao;
|
private ProdukDao produkDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SettingDataFixedDao settingDataFixedDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SkoringTindakanMedisVO add(SkoringTindakanMedisVO vo) throws JpaSystemException, ServiceVOException {
|
public SkoringTindakanMedisVO add(SkoringTindakanMedisVO vo) throws JpaSystemException, ServiceVOException {
|
||||||
Produk produk = produkConverter.transferVOToModel(vo.getProduk(), new Produk());
|
Produk produk = produkConverter.transferVOToModel(vo.getProduk(), new Produk());
|
||||||
@ -117,7 +121,7 @@ public class SkoringTindakanMedisServiceImpl extends BaseVoServiceImpl implement
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> findAllEnabled(Integer idUnitKerja, Integer idKelompokKerja, Integer idProduk,
|
public List<Map<String, Object>> findAllEnabled(Integer idUnitKerja, Integer idKelompokKerja, Integer idProduk,
|
||||||
String detailProduk, Long tglMulaiBerlaku, Boolean statusVerifikasi) {
|
String detailProduk, Long tglMulaiBerlaku, Boolean statusVerifikasi) throws JpaSystemException {
|
||||||
List<Map<String, Object>> result = new ArrayList<>();
|
List<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
|
||||||
if (CommonUtil.isNullOrEmpty(idUnitKerja) && CommonUtil.isNullOrEmpty(idKelompokKerja)
|
if (CommonUtil.isNullOrEmpty(idUnitKerja) && CommonUtil.isNullOrEmpty(idKelompokKerja)
|
||||||
@ -186,10 +190,34 @@ public class SkoringTindakanMedisServiceImpl extends BaseVoServiceImpl implement
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> findDaftarInputTindakanByRuanganKelas(Integer idRuangan) {
|
public List<Map<String, Object>> findDaftarInputTindakanByRuanganKelas(Integer idRuangan)
|
||||||
|
throws JpaSystemException {
|
||||||
List<Map<String, Object>> result = produkDao.findDaftarInputTindakanByRuangan(idRuangan);
|
List<Map<String, Object>> result = produkDao.findDaftarInputTindakanByRuangan(idRuangan);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> findDuplicateSkoring(Integer idProduk, Integer idKelompokKerja, Double skor,
|
||||||
|
String detailProduk, String noRec) throws JpaSystemException {
|
||||||
|
List<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
List<String> listNorec = new ArrayList<>();
|
||||||
|
|
||||||
|
String patternText = settingDataFixedDao.getSettingDataFixed("patternTextDuplicate");
|
||||||
|
String replacedDetailProduk = detailProduk.replaceAll(patternText, "").toLowerCase();
|
||||||
|
if (CommonUtil.isNotNullOrEmpty(noRec)) {
|
||||||
|
listNorec = skoringTindakanMedisDao.findDupSkoring(idProduk, idKelompokKerja, skor, patternText,
|
||||||
|
replacedDetailProduk, noRec);
|
||||||
|
} else {
|
||||||
|
listNorec = skoringTindakanMedisDao.findDupSkoring(idProduk, idKelompokKerja, skor, patternText,
|
||||||
|
replacedDetailProduk);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CommonUtil.isNotNullOrEmpty(listNorec)) {
|
||||||
|
result = skoringTindakanMedisDao.findAllDup(listNorec);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -405,6 +405,30 @@ public class IkiDanRemunerasiController extends LocaleController<IkiDanRemuneras
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/get-duplicate-skoring-tindakan-medis", method = RequestMethod.GET)
|
||||||
|
public ResponseEntity<List<Map<String, Object>>> getDuplicateSkoringTindakanMedis(HttpServletRequest request,
|
||||||
|
@RequestParam(value = "noRec", required = false) String noRec,
|
||||||
|
@RequestParam(value = "produkId", required = true) Integer idProduk,
|
||||||
|
@RequestParam(value = "kelompokKerjaId", required = true) Integer idKelompokKerja,
|
||||||
|
@RequestParam(value = "detailProduk", required = true) String detailProduk,
|
||||||
|
@RequestParam(value = "skor", required = true) Double skor) throws ParseException {
|
||||||
|
try {
|
||||||
|
List<Map<String, Object>> result = skoringTindakanMedisService.findDuplicateSkoring(idProduk,
|
||||||
|
idKelompokKerja, skor, detailProduk, noRec);
|
||||||
|
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 duplikat skoring tindakan medis", 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 duplikat skoring tindakan medis", jse.getMessage());
|
||||||
|
addHeaderMessage(Constants.MessageInfo.ERROR_MESSAGE, jse.getMessage());
|
||||||
|
return RestUtil.getJsonHttptatus(HttpStatus.CONFLICT, mapHeaderMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/save-kontrak-kinerja", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "/save-kontrak-kinerja", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public ResponseEntity<LogbookKinerjaVO> saveKontrakKinerja(HttpServletRequest request,
|
public ResponseEntity<LogbookKinerjaVO> saveKontrakKinerja(HttpServletRequest request,
|
||||||
@Valid @RequestBody LogbookKinerjaVO vo) {
|
@Valid @RequestBody LogbookKinerjaVO vo) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user