/** * 通过request来进行交易对象的组装 * * @param request * @return */ private BizTransRecord buildBizTransRecord(HttpServletRequest request) { BizTransRecord record = new BizTransRecord(); String recordType = request.getParameter("recordType"); if (StringUtils.equals(recordType, BizTransRecordConstant.FIRST_RECORD_TYPE)) { String investTypeFirst = request.getParameter("investTypeFirst"); String importDateFirst = request.getParameter("importDateFirst"); String origionValueFirst = request.getParameter("origionValueFirst"); record.setInvestType(investTypeFirst); record.setImportDate(importDateFirst); long origionValue = Math.round(Double.parseDouble(origionValueFirst) * 100); record.setOrigionValue(origionValue); record.setCurrValue(origionValue); record.setRecordType(recordType); } else { String totleGainsAndLosses = request.getParameter("totleGainsAndLosses"); String investType = request.getParameter("investType"); String importDate = request.getParameter("importDate"); long fee = getLongValue(request, "fee"); long gainsAndLosses = getLongValue(request, "gainsAndLosses"); long currIncome = getLongValue(request, "currIncome"); long currOutcome = getLongValue(request, "currOutcome"); long currValue = getLongValue(request, "currValue"); long lastDayValue = getLongValue(request, "lastDayValue"); long origionValue = getLongValue(request, "origionValue"); record.setTotalGainsAndLosses(totleGainsAndLosses); record.setFee(fee); record.setGainsAndLosses(gainsAndLosses); record.setCurrIncome(currIncome); record.setCurrOutcome(currOutcome); record.setCurrValue(currValue); record.setLastDayValue(lastDayValue); record.setOrigionValue(origionValue); record.setInvestType(investType); record.setImportDate(importDate); } return record; }
/** * 组装交易对象 * * @param request * @return */ private BizTransRecord getRecord(HttpServletRequest request) { String id = request.getParameter("id"); if (StringUtils.isBlank(id)) { return null; } BizTransRecord record = transRecordService.get(Long.parseLong(id)); String fee = request.getParameter("fee"); String gainsAndLosses = request.getParameter("gainsAndLosses"); String currValue = request.getParameter("currValue"); String totleGainsAndLosses = request.getParameter("totleGainsAndLosses"); String currIncome = request.getParameter("currIncome"); String currOutcome = request.getParameter("currOutcome"); record.setFee(getRealLong(fee)); record.setCurrIncome(getRealLong(currIncome)); record.setCurrOutcome(getRealLong(currOutcome)); record.setTotalGainsAndLosses(totleGainsAndLosses); record.setGainsAndLosses(getRealLong(gainsAndLosses)); record.setCurrValue(getRealLong(currValue)); record.setGmtModified(DateUtil.getNowDate()); return record; }