コード例 #1
0
 /**
  * 修改操作
  *
  * @param pageIndex
  * @param backUrl
  * @param monthRecord
  * @param result
  * @param model
  * @return
  */
 @RequestMapping(params = "method=modify", method = RequestMethod.POST)
 public String modify(
     Long pageIndex,
     String backUrl,
     MonthRecord monthRecord,
     BindingResult result,
     ModelMap model) {
   MonthRecord dbMonthRecord = monthRecordService.get(monthRecord.getRecordId());
   BeanUtils.copySpecialProperties(
       monthRecord, dbMonthRecord, "creator,createdTime,modifier,modifiedTime");
   model.addAttribute("monthRecord", monthRecord);
   try {
     monthRecordService.validateNotNull(monthRecord);
     monthRecordService.modify(monthRecord);
   } catch (OssRollbackCheckedException e) {
     log.error(e);
     if (null == e.getErrors() && e.getErrors().hasErrors()) {
       ValidatorUtils.convert2SpringError(e.getErrors(), result);
       model.addAttribute("message", MessageUtils.getInfoValue("FAIL_MODIFY"));
     } else {
       model.addAttribute(
           "message", MessageUtils.getInfoValue("FAIL_MODIFY") + "<br>" + e.getMessage());
     }
     model.addAttribute("backUrl", backUrl);
     model.addAttribute("pageIndex", pageIndex);
     return "month_record/modify";
   }
   return showList(pageIndex, model);
 }
コード例 #2
0
 /**
  * 查看
  *
  * @param recordId
  * @param backUrl
  * @param request
  * @param model
  * @return
  */
 @RequestMapping(params = "method=details", method = RequestMethod.GET)
 public String details(Long recordId, String backUrl, HttpServletRequest request, ModelMap model) {
   MonthRecord monthRecord = monthRecordService.get(recordId);
   model.addAttribute("monthRecord", monthRecord);
   model.addAttribute("backUrl", getBackUrl(backUrl, request));
   return "month_record/details";
 }
コード例 #3
0
 /**
  * 进入修改页面
  *
  * @param pageIndex
  * @param recordId
  * @param request
  * @param model
  * @return
  */
 @RequestMapping(params = "method=modify", method = RequestMethod.GET)
 public String modify(Long pageIndex, Long recordId, HttpServletRequest request, ModelMap model) {
   MonthRecord monthRecord = monthRecordService.get(recordId);
   model.addAttribute("monthRecord", monthRecord);
   model.addAttribute("backUrl", getBackUrl(null, request));
   model.addAttribute("pageIndex", pageIndex);
   return "month_record/modify";
 }
コード例 #4
0
 /**
  * 重新统计
  *
  * @param recordId
  * @param pageIndex
  * @param model
  * @return
  */
 @RequestMapping(params = "method=reCount", method = RequestMethod.GET)
 public String reCount(Long recordId, Long pageIndex, ModelMap model) {
   MonthRecord monthRecord = monthRecordService.get(recordId);
   try {
     monthRecordService.reStatistics(monthRecord.getMonthTime());
     model.addAttribute("message", MessageUtils.getInfoValue("SUCC_MODIFY"));
   } catch (OssRollbackCheckedException e) {
     log.error(e);
     model.addAttribute("message", MessageUtils.getInfoValue("FAIL_MODIFY"));
   }
   return showList(pageIndex, model);
 }