Compare commits
122 Commits
dev/integr
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b65c492cf | ||
|
|
a0cc1cd482 | ||
|
|
77eb8f3672 | ||
|
|
b7139f2851 | ||
|
|
8c617702eb | ||
|
|
0c753e9c22 | ||
|
|
248bc1cad7 | ||
|
|
db25c0aef9 | ||
|
|
82b84d2fb9 | ||
|
|
eb7b2f91ad | ||
|
|
e816f1f2e4 | ||
|
|
406ed896a9 | ||
|
|
9197ad56ce | ||
|
|
79f93d8f1e | ||
|
|
ae1e575d73 | ||
|
|
4d528f86bc | ||
|
|
a9a123cbf3 | ||
|
|
a705fc4c3b | ||
|
|
d1455fc1cf | ||
|
|
69df61e369 | ||
|
|
838739b0e1 | ||
|
|
4d73c1cbbe | ||
|
|
e6d47716ea | ||
|
|
74ca1b4cfa | ||
|
|
f5fd2a5831 | ||
|
|
f152385e55 | ||
|
|
f10373891e | ||
|
|
fbec23b80f | ||
|
|
d8de068b74 | ||
|
|
8e21f0b7cf | ||
|
|
f9d2af743f | ||
|
|
749fb0fb53 | ||
|
|
cf0e09ae01 | ||
|
|
e3dc3c5807 | ||
|
|
143bfa458e | ||
|
|
8b3a574ce1 | ||
|
|
9948599436 | ||
|
|
e6107dae92 | ||
|
|
d554375789 | ||
|
|
ef9ed72c64 | ||
|
|
b8ed331571 | ||
|
|
623f945859 | ||
|
|
ef48f2649c | ||
|
|
26e4dbb777 | ||
|
|
36eb745812 | ||
|
|
6b2df06b20 | ||
|
|
2481546942 | ||
|
|
12f5c633f2 | ||
|
|
2d83b9a91c | ||
|
|
31d07e10ce | ||
|
|
243a90e2c7 | ||
|
|
c44d5799f3 | ||
|
|
960b9af314 | ||
|
|
43d105de37 | ||
|
|
e6002e44e8 | ||
|
|
bda56b5f44 | ||
|
|
b1206442bb | ||
|
|
71391fb198 | ||
|
|
78699b5eee | ||
|
|
34ed82a346 | ||
|
|
69f37af283 | ||
|
|
5bbefc913d | ||
|
|
991b15464e | ||
|
|
3fb671e4f9 | ||
|
|
9c3f7924bc | ||
|
|
a1490efe43 | ||
|
|
b50c271d21 | ||
|
|
39796f393a | ||
|
|
389147e756 | ||
|
|
3582e22fed | ||
|
|
852325485b | ||
|
|
e2ac3cb803 | ||
|
|
1a21be43ab | ||
|
|
9a6ff8d2b8 | ||
|
|
a4b51b2ecb | ||
|
|
543b41dffa | ||
|
|
6dba53aee0 | ||
|
|
a4aa2ad173 | ||
|
|
d83566d8d5 | ||
|
|
6cd22af4b6 | ||
|
|
33bcd7b313 | ||
|
|
3947da84fc | ||
|
|
aa0f1ad5ae | ||
|
|
b239c18f9e | ||
|
|
07ced4ffc7 | ||
|
|
7f6474fb8a | ||
|
|
280cf73993 | ||
|
|
f03a842dd2 | ||
|
|
482731fafa | ||
|
|
eb71199dd7 | ||
|
|
5969617896 | ||
|
|
cb6b91f1ed | ||
|
|
c3688c9422 | ||
|
|
2c22512271 | ||
|
|
06aaa550d2 | ||
|
|
ad368f7946 | ||
|
|
8df79fac35 | ||
|
|
e2f9e92ecb | ||
|
|
9d054afeb5 | ||
|
|
a4dde9dd13 | ||
|
|
f092607ec4 | ||
|
|
8c1f6a1825 | ||
|
|
d24bbfb260 | ||
|
|
79fe30ff4b | ||
|
|
a4db6562b9 | ||
|
|
7750dc974e | ||
|
|
ac5e379b28 | ||
|
|
dd485a8a5a | ||
|
|
bdd2db96cc | ||
|
|
bda8841f7f | ||
|
|
d231af1cd1 | ||
|
|
27abc1bc75 | ||
|
|
d185736401 | ||
|
|
172c1a0539 | ||
|
|
82e77209e6 | ||
|
|
ec685312cf | ||
|
|
96abf3cdab | ||
|
|
4178405fd4 | ||
|
|
aace5f33b0 | ||
|
|
fc2d017850 | ||
|
|
321e87b6f9 | ||
|
|
d4f3cc414d |
@ -15,7 +15,7 @@
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>spring.profiles.default</param-name>
|
||||
<param-value>localhost</param-value>
|
||||
<param-value>bridging</param-value>
|
||||
</context-param>
|
||||
|
||||
<listener>
|
||||
|
||||
@ -283,25 +283,6 @@
|
||||
<version>${commons-io.version}</version>
|
||||
</dependency>
|
||||
<!-- End Lukman -->
|
||||
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
<version>8.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.9.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>31.0-jre</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
<organization>
|
||||
<name>Jasa Medika</name>
|
||||
|
||||
@ -11,25 +11,21 @@ import com.jasamedika.medifirst2000.entities.AbsensiPegawai;
|
||||
import com.jasamedika.medifirst2000.entities.Habsen;
|
||||
import com.jasamedika.medifirst2000.entities.JadwalDokter;
|
||||
import com.jasamedika.medifirst2000.entities.ShiftKerja;
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import com.jasamedika.medifirst2000.service.AbsensiPegawaiService;
|
||||
import com.jasamedika.medifirst2000.service.LogAccService;
|
||||
import com.jasamedika.medifirst2000.util.CommonUtil;
|
||||
import com.jasamedika.medifirst2000.util.ImageUtil;
|
||||
import com.jasamedika.medifirst2000.util.minio.MinioClientUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AbsensiPegawaiVO;
|
||||
import com.jasamedika.medifirst2000.vo.HabsenVO;
|
||||
import io.minio.PutObjectArgs;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.text.DateFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -69,7 +65,7 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
|
||||
|
||||
@Override
|
||||
public Map<String, Object> saveAbsensiPegawai(AbsensiPegawaiVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
AbsensiPegawai model = new AbsensiPegawai();
|
||||
model = absensiPegawaiConverter.transferVOToModel(vo, model);
|
||||
|
||||
@ -96,7 +92,13 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
|
||||
|
||||
@Override
|
||||
public Map<String, Object> findByName(String nama) {
|
||||
return new HashMap<>();
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
try {
|
||||
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -112,7 +114,7 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
|
||||
|
||||
@Override
|
||||
public Map<String, Object> saveHabsensiPegawai(HabsenVO vo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
|
||||
Habsen model = presensiConverter.transferVOToModel(vo, new Habsen());
|
||||
|
||||
@ -123,7 +125,7 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
|
||||
model.setRemoteno(Master.PresensiPegawai.SMART_REMOTE_NO);
|
||||
model.setAcc_code(Master.PresensiPegawai.DEFAULT_ACC_CODE);
|
||||
|
||||
/*
|
||||
/**
|
||||
* automatic reverse geocoding was disabled due to too many request to
|
||||
* nominatim.openstreetmap.org
|
||||
*/
|
||||
@ -167,35 +169,28 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
|
||||
}
|
||||
|
||||
public void uploadPhotoCapture(String imageURLData, String idFinger, Date trDate, Date trTime, Integer trNo) {
|
||||
byte[] imageData = Base64.decodeBase64(imageURLData.substring(imageURLData.indexOf(",") + 1));
|
||||
if (trDate.after(new Date(MinioClientUtil.CUTOFF_TIMESTAMP))) {
|
||||
uploadToMinio(imageData, idFinger, trDate, trTime, trNo);
|
||||
} else {
|
||||
try {
|
||||
DateFormat mf = new SimpleDateFormat("yyyyMM");
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
DateFormat tf = new SimpleDateFormat("HH.mm.ss");
|
||||
String directory = getDirPathPresensiPegawai(mf.format(trDate));
|
||||
String filename = directory + idFinger + "_" + df.format(trDate) + "_" + tf.format(trTime) + "#" + trNo
|
||||
+ ".jpg";
|
||||
File outputFile = new File(filename);
|
||||
OutputStream stream = Files.newOutputStream(outputFile.toPath());
|
||||
stream.write(imageData);
|
||||
stream.close();
|
||||
} catch (IOException e) {
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void uploadToMinio(byte[] imageData, String idFinger, Date trDate, Date trTime, Integer trNo) {
|
||||
ByteArrayInputStream inputStream = new ByteArrayInputStream(imageData);
|
||||
DateFormat mf = new SimpleDateFormat("yyyyMM");
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
DateFormat tf = new SimpleDateFormat("HH.mm.ss");
|
||||
String filename = idFinger + "_" + df.format(trDate) + "_" + tf.format(trTime) + "#" + trNo + ".jpg";
|
||||
PutObjectArgs objectArgs = PutObjectArgs.builder().bucket("presensi-pegawai").object(filename)
|
||||
.stream(inputStream, imageData.length, -1).contentType("image/jpeg").build();
|
||||
MinioClientUtil.upload(objectArgs);
|
||||
|
||||
String directory = getDirPathPresensiPegawai(mf.format(trDate));
|
||||
String filename = directory + idFinger.toString() + "_" + df.format(trDate) + "_" + tf.format(trTime) + "#"
|
||||
+ trNo + ".jpg";
|
||||
|
||||
String str = imageURLData;
|
||||
|
||||
byte[] imagedata = Base64.decodeBase64(str.substring(str.indexOf(",") + 1));
|
||||
try {
|
||||
File dire = new File(directory);
|
||||
if (!dire.exists())
|
||||
dire.mkdirs();
|
||||
File outputFile = new File(filename);
|
||||
OutputStream stream = new FileOutputStream(outputFile);
|
||||
stream.write(imagedata);
|
||||
stream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private Double getDecimal(Double n) {
|
||||
@ -212,13 +207,13 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
|
||||
nf.setMaximumFractionDigits(2);
|
||||
String latSecStr = nf.format(getDecimal(getDecimal(Math.abs(latitude)) * 60) * 60);
|
||||
|
||||
String latStr;
|
||||
String latStr = "";
|
||||
if (latitude < 0) {
|
||||
latStr = latDegStr + "°" + latMinStr + "′" + latSecStr + "″ LS";
|
||||
latStr = latDegStr + "\u00B0" + latMinStr + "\u2032" + latSecStr + "\u2033 LS";
|
||||
} else if (latitude > 0) {
|
||||
latStr = latDegStr + "°" + latMinStr + "′" + latSecStr + "″ LU";
|
||||
latStr = latDegStr + "\u00B0" + latMinStr + "\u2032" + latSecStr + "\u2033 LU";
|
||||
} else {
|
||||
latStr = latDegStr + "°" + latMinStr + "′" + latSecStr + "″";
|
||||
latStr = latDegStr + "\u00B0" + latMinStr + "\u2032" + latSecStr + "\u2033";
|
||||
}
|
||||
|
||||
nf.setMaximumFractionDigits(0);
|
||||
@ -228,13 +223,13 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
|
||||
nf.setMaximumFractionDigits(2);
|
||||
String longSecStr = nf.format(getDecimal(getDecimal(Math.abs(longitude)) * 60) * 60);
|
||||
|
||||
String longStr;
|
||||
String longStr = "";
|
||||
if (longitude < 0) {
|
||||
longStr = longDegStr + "°" + longMinStr + "′" + longSecStr + "″ BB";
|
||||
longStr = longDegStr + "\u00B0" + longMinStr + "\u2032" + longSecStr + "\u2033 BB";
|
||||
} else if (longitude > 0) {
|
||||
longStr = longDegStr + "°" + longMinStr + "′" + longSecStr + "″ BT";
|
||||
longStr = longDegStr + "\u00B0" + longMinStr + "\u2032" + longSecStr + "\u2033 BT";
|
||||
} else {
|
||||
longStr = longDegStr + "°" + longMinStr + "′" + longSecStr + "″";
|
||||
longStr = longDegStr + "\u00B0" + longMinStr + "\u2032" + longSecStr + "\u2033";
|
||||
}
|
||||
|
||||
return latStr + ", " + longStr;
|
||||
@ -303,7 +298,7 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
|
||||
|
||||
@Override
|
||||
public Map<String, Object> findJadwalPegawai(Integer idPegawai) {
|
||||
Map<String, Object> result;
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String today = sdf.format(new Date());
|
||||
result = habsensiDao.getPegawai(idPegawai);
|
||||
@ -337,7 +332,7 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> findHistoriPresensi(Integer idPegawai) {
|
||||
List<Map<String, Object>> result;
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String today = sdf.format(new Date());
|
||||
@ -353,7 +348,7 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
|
||||
} else {
|
||||
map.put("processtatus", "WFO");
|
||||
}
|
||||
if (vpnIPList.contains(map.get("ip_addr").toString())) {
|
||||
if (vpnIPList.contains(map.get("ip_addr"))) {
|
||||
boolean isAksesLuar = false;
|
||||
for (String vpnIPX : vpnIPXList)
|
||||
if (map.get("client_ip_addr").toString().startsWith(vpnIPX)) {
|
||||
@ -366,7 +361,7 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
|
||||
map.put("ip_addr", "menggunakan jaringan internet RSAB");
|
||||
|
||||
} else {
|
||||
if (listIp.contains(map.get("ip_addr").toString())) {
|
||||
if (listIp.contains(map.get("ip_addr"))) {
|
||||
map.put("ip_addr", "menggunakan jaringan internet RSAB");
|
||||
} else if (CommonUtil.isNullOrEmpty(map.get("ip_addr"))) {
|
||||
map.put("ip_addr", "jaringan internet tidak terdeteksi");
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.util.minio;
|
||||
|
||||
import com.jasamedika.medifirst2000.exception.ServiceVOException;
|
||||
import io.minio.MinioClient;
|
||||
import io.minio.PutObjectArgs;
|
||||
import io.minio.errors.MinioException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
/**
|
||||
* @author salmanoe
|
||||
* @version 1.0.0
|
||||
* @since 20/11/2024
|
||||
*/
|
||||
public final class MinioClientUtil {
|
||||
|
||||
public static final long CUTOFF_TIMESTAMP = 1732035599000L;
|
||||
|
||||
public static void upload(PutObjectArgs objectArgs) {
|
||||
MinioClient minioClient;
|
||||
try {
|
||||
minioClient = MinioClientWrapper.minioClient();
|
||||
minioClient.putObject(objectArgs);
|
||||
} catch (IOException | MinioException | InvalidKeyException | NoSuchAlgorithmException e) {
|
||||
throw new ServiceVOException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.util.minio;
|
||||
|
||||
import io.minio.MinioClient;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author salmanoe
|
||||
* @version 1.0.0
|
||||
* @since 19/11/2024
|
||||
*/
|
||||
public class MinioClientWrapper {
|
||||
|
||||
private static final String ENDPOINT = "https://minio-2.rsabhk.co.id:90";
|
||||
private static final String ACCESS_KEY = "6QLQ3GNgQFf2ax8PJXuu";
|
||||
private static final String SECRET_KEY = "nPrfuFezKLd36mI2qqGJ5djLiKxhNExIrPr3j4oq";
|
||||
|
||||
public static MinioClient minioClient() throws IOException {
|
||||
return MinioClient.builder().endpoint(ENDPOINT).credentials(ACCESS_KEY, SECRET_KEY).build();
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user