Update LogAccService
Penggunaan jsonobject untuk set request body put log presensi pegawai
This commit is contained in:
parent
bb2ed467af
commit
d45b91e6cb
@ -84,11 +84,19 @@ public class LogAccServiceImpl extends BaseVoServiceImpl implements LogAccServic
|
||||
con.setDoOutput(true);
|
||||
|
||||
OutputStream os = con.getOutputStream();
|
||||
String jsonOutputString = "{\"tr_no\":" + vo.getTr_no() + ",\"pegawaifk\":\"" + vo.getPegawai().getId()
|
||||
+ ",\"empl_code\":\"" + vo.getEmpl_code() + "\",\"ip_addr\":\"" + vo.getIp_addr()
|
||||
+ "\",\"client_ip_addr\":\"" + vo.getClientIPAddress() + "\"}";
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
try {
|
||||
jsonObject.put("tr_no", vo.getTr_no());
|
||||
jsonObject.put("pegawaifk",
|
||||
CommonUtil.isNotNullOrEmpty(vo.getPegawai()) ? vo.getPegawai().getId() : "");
|
||||
jsonObject.put("empl_code", vo.getEmpl_code());
|
||||
jsonObject.put("ip_addr", vo.getIp_addr());
|
||||
jsonObject.put("client_ip_addr", vo.getClientIPAddress());
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
byte[] requestBody = jsonOutputString.getBytes("UTF-8");
|
||||
byte[] requestBody = jsonObject.toString().getBytes("UTF-8");
|
||||
os.write(requestBody, 0, requestBody.length);
|
||||
|
||||
InputStream in = new BufferedInputStream(con.getInputStream());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user