HttpServletResponse response) throws Exception {
String currentUserName = null;
try {
currentUserName = UserUtil.getCurrentUserName(request);
JSONObject jsonObject = readJson(request);
FinanceMoneyDetail financeMoney = new FinanceMoneyDetail();
financeMoney.setCreatorId(new Integer(UserUtil.getCurrentUserId(request)));
financeMoney.setCreateDate(new java.util.Date());
financeMoney.setLoanDate(StringUtil.getSqlDate(jsonObject.getString("loanDate"), "date"));
financeMoney.setFallinDate(StringUtil.getSqlDate(jsonObject.getString("fallinDate"), "date"));
financeMoney.setFinanceType(jsonObject.getString("financeType"));// 设置借入标志
financeMoney.setDebtType(jsonObject.getString("debtType"));
financeMoney.setTotalArrearage(jsonObject.getDouble("totalArrearage"));
financeMoney.setRequitedArrearage(0.0d);
financeMoney.setRemark(jsonObject.getString("remark"));
// 设置借入/出人员
String borrowUserId = jsonObject.getString("borrowUser");
if (borrowUserId == null) {
print(response, "债务人不能为空");
throw new Exception("债务人不能为空");
}
Iouser borrowUser = (Iouser) getBaseManager().get(Iouser.class, Long.parseLong(borrowUserId));
financeMoney.setBorrowUser(borrowUser);
getBaseManager().save(financeMoney);
print(response, RESBONSE_SUCCESS + "|" + financeMoney.getId());
log.info(currentUserName + ">增加借入款项[" + financeMoney + "]");
} catch (JSONException je) {
je.printStackTrace();
log.error(currentUserName + ">增加借入款项>解析JSON数据出错:" + je.getMessage());
} catch (Exception ex) {