penyesuaian file path untuk kategorisasi upload presensi setiap bulan
This commit is contained in:
parent
7b60c35188
commit
8021a0bb2a
@ -156,6 +156,24 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDirPath(String dirname) {
|
||||||
|
String result = "";
|
||||||
|
|
||||||
|
String your_os = System.getProperty("os.name").toLowerCase();
|
||||||
|
if (your_os.indexOf("win") >= 0) {
|
||||||
|
// if_windows
|
||||||
|
result = dirname + "\\";
|
||||||
|
} else if (your_os.indexOf("nix") >= 0 || your_os.indexOf("nux") >= 0 || your_os.indexOf("mac") >= 0) {
|
||||||
|
// if_unix_or_mac
|
||||||
|
result = dirname + "//";
|
||||||
|
} else {
|
||||||
|
// unknown_os?
|
||||||
|
result = dirname + "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public String getImageAbsoluteFilePath(String filename) {
|
public String getImageAbsoluteFilePath(String filename) {
|
||||||
String result = "";
|
String result = "";
|
||||||
|
|
||||||
@ -176,16 +194,26 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void uploadPhotoCapture(String imageURLData, String idFinger, Date trDate, Date trTime, Integer trNo) {
|
public void uploadPhotoCapture(String imageURLData, String idFinger, Date trDate, Date trTime, Integer trNo) {
|
||||||
|
DateFormat mf = new SimpleDateFormat("yyyyMM");
|
||||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
DateFormat tf = new SimpleDateFormat("HH.mm.ss");
|
DateFormat tf = new SimpleDateFormat("HH.mm.ss");
|
||||||
|
|
||||||
String filename = idFinger.toString() + "_" + df.format(trDate) + "_" + tf.format(trTime) + "#" + trNo + ".jpg";
|
String directory = getDirPath(mf.format(trDate));
|
||||||
|
String filename = directory + idFinger.toString() + "_" + df.format(trDate) + "_" + tf.format(trTime) + "#"
|
||||||
|
+ trNo + ".jpg";
|
||||||
|
|
||||||
String str = imageURLData;
|
String str = imageURLData;
|
||||||
byte[] imagedata = DatatypeConverter.parseBase64Binary(str.substring(str.indexOf(",") + 1));
|
byte[] imagedata = DatatypeConverter.parseBase64Binary(str.substring(str.indexOf(",") + 1));
|
||||||
try {
|
try {
|
||||||
BufferedImage bufferedImage = ImageIO.read(new ByteArrayInputStream(imagedata));
|
BufferedImage bufferedImage = ImageIO.read(new ByteArrayInputStream(imagedata));
|
||||||
ImageIO.write(bufferedImage, "jpg", new File(getImageAbsoluteFilePath(filename)));
|
|
||||||
|
File dire = new File(directory);
|
||||||
|
if (!dire.exists()) {
|
||||||
|
dire.mkdir();
|
||||||
|
}
|
||||||
|
|
||||||
|
File file = new File(getImageAbsoluteFilePath(filename));
|
||||||
|
ImageIO.write(bufferedImage, "jpg", file);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9086,6 +9086,7 @@ public class IndekKinerjaServiceImpl extends BaseVoServiceImpl implements IndekK
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// FFS : sudah tidak dipakai
|
||||||
if (CommonUtil.isNotNullOrEmpty(listData)) {
|
if (CommonUtil.isNotNullOrEmpty(listData)) {
|
||||||
if (pegawaiDao.getPegawaiByKategoryPegawai(Arrays.asList(Master.KategoryPegawai.DOKTER_LUAR))
|
if (pegawaiDao.getPegawaiByKategoryPegawai(Arrays.asList(Master.KategoryPegawai.DOKTER_LUAR))
|
||||||
.contains(idPegawai)) {
|
.contains(idPegawai)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user