void recordApplyView(Object[] args) {
JSONObject map = null;
for (Object o : args) {
if (o instanceof JSONObject) {
map = (JSONObject) o;
String applyId = (String) map.get("applyId");
String applyPersonList = (String) map.get("applyPersonList");
List<Trace> traces = new ArrayList<>();
JSONArray jsonArray = JSONArray.parseArray(applyPersonList);
for (int i = 0; i < jsonArray.size(); i++) {
Trace trace = new Trace();
trace.setId(snowflake.nextId());
trace.setProcessId(applyId);
trace.setOperationDate(new Date());
trace.setOperationTime(new Date());
String viewType = (String) map.get("$viewType");
trace.setIsElectronic("电子".equals(viewType) ? 1 : 0);
JSONObject jsonObject = jsonArray.getJSONObject(i);
String a0000 = jsonObject.getString("a0000");
trace.setA0000(a0000);
String a0101 = jsonObject.getString("a0101");
String a0184 = jsonObject.getString("a0184");
trace.setArchiveName(a0101 + a0184 + ".zip");
String applyName1 = (String) map.get("applyName1");
String applyName2 = (String) map.get("applyName2");
if ((!StringUtils.isBlank(applyName1) || !StringUtils.isBlank(applyName2)) && (trace.getIsElectronic().equals(1) || trace.getIsElectronic().equals(0))) {
trace.setOperation("查阅");
String viewReason = (String) map.get("$viewReason");
trace.setOperationDesc(a0101 + "的档案," + "被" + applyName1 + "和" + applyName2 + "," + "因" + viewReason + "查阅。");
} else {
trace.setOperation("借阅");
String borrowName = (String) map.get("borrowName");
String borrowReason = (String) map.get("$borrowReason");
trace.setOperationDesc(a0101 + "的档案," + "被" + borrowName + "," + "因" + borrowReason + "借阅。");
}
traces.add(trace);
}
traceService.saveBatch(traces);
}
}
}