@Override public Boolean SaveRecordedCase(GWTRecordedCase recordedCase, Integer loginLogId) { RecordedCase data = ModelToBean(recordedCase); String userId = OperationLogService.getLoginLogById(loginLogId).getUserId(); if (recordedCase.IsNew()) { data.setRecordTime(new Date()); data.setRecordUserId(Integer.parseInt(userId)); dataDao.Add(data); OperationLogService.writeOperationLog( OpType.RecordedCase, IDUType.Insert, data.getId(), data.getRequestMsg(), "memo", null, data.getRequestMsg(), loginLogId); } else { RecordedCase oldBean = dataDao.Get(Op.EQ("id", Integer.parseInt(recordedCase.getID()))); data.setLastModifiedTime(new Date()); data.setLastModifiedUserId(userId); try { OperationLogService.writeUpdateOperationLog( OpType.RecordedCase, RecordedCase.class, oldBean.getId(), "ID=" + recordedCase.getID(), oldBean, data, loginLogId); } catch (Exception e) { log.error(e, e); } dataDao.Edit(data); } return true; }
private GWTRecordedCase BeanToModel(RecordedCase data) { String userName = ""; if (data.getRecordUserId() >= 0) { userName = (new UserService()).GetUserNameByUserId(String.valueOf(data.getRecordUserId())); } return new GWTRecordedCase( data.getId(), data.getRequestMsg(), data.getResponseMsg(), String.valueOf(data.getSystemId()), data.getMemo(), data.getResponseFlag(), data.getIsCased(), data.getRecordUserId(), data.getRecordTime(), data.getCreateTime(), userName); }