Пример #1
0
 /**
  * 报销页面
  *
  * @return
  */
 @RequestMapping(
     value = "expenseView",
     method = {RequestMethod.GET, RequestMethod.POST})
 public ModelAndView createExpenseView(HttpServletRequest request) {
   ModelAndView modelView = createModelAndViewWithSign("expense", request);
   // 1、获取报销信息
   String id = HttpRequestUtil.getInst().getString("id");
   String corpId = HttpRequestUtil.getInst().getCurrentCorpId();
   if (!StringUtils.isEmpty(id)) {
     Expense expense = expenseService.getExpenseById(id);
     if (null == expense) {
       throw new VyiyunBusinessException("记录已被撤销或不存在!");
     }
     modelView.addObject("expenseInfo", expense);
     List<Accessory> accessoryList = accessoryService.getAccessoryByEntityId(id);
     if (!CollectionUtils.isEmpty(accessoryList)) {
       modelView.addObject("accessoryInfor", accessoryList);
     }
     ExpenseFee expenseFee = new ExpenseFee();
     expenseFee.setExpenseId(id);
     expenseFee.setCorpId(corpId);
     List<ExpenseFee> expenseFeeList = expenseFeeService.getExpenseFee(expenseFee);
     if (!CollectionUtils.isEmpty(expenseFeeList)) {
       List<Map<String, Object>> dataMap = new ArrayList<Map<String, Object>>();
       Map<String, Object> temp = null;
       SystemStatusCache<Object> systemStatusCache =
           SystemCacheUtil.getInstance().getSystemStatusCache();
       for (ExpenseFee ex : expenseFeeList) {
         temp = ex.getPersistentState();
         temp.put(
             "categoryDisplay",
             systemStatusCache.getSystemStatusValue(corpId, "CostCategory", ex.getCategory()));
         dataMap.add(temp);
       }
       modelView.addObject("expenseFeeList", dataMap);
     }
   } else {
     // 获取报销类别
     Expense expense = new Expense();
     WeixinUser weixinUser = HttpRequestUtil.getInst().getCurrentWeixinUser();
     WeixinContactCache<Object> weixinContactCache =
         (WeixinContactCache<Object>) SystemCacheUtil.getInstance().getWeixinContactCache();
     expense.setDepartment(weixinContactCache.getUserDept(weixinUser.getDepartment()));
     modelView.addObject("expenseInfo", expense);
   }
   List<SystemStatus> costCategoryList =
       (List<SystemStatus>)
           systemStatusService.getSystemStatus(corpId, Constants.COST_CATEGORY, true);
   // (List<SystemStatus>)
   // SystemCacheUtil.getInstance().getSystemStatusCache()
   // .getSystemStatus(corpId, "CostCategory");
   if (!CollectionUtils.isEmpty(costCategoryList)) {
     modelView.addObject("costCategoryList", costCategoryList);
   }
   return modelView;
 }
Пример #2
0
 /**
  * 普通审批 --发起审批
  *
  * @param model
  * @return
  */
 @RequestMapping(
     value = "relaunchExpenseView",
     method = {RequestMethod.GET, RequestMethod.POST})
 public ModelAndView relaunchApprovalView(HttpServletRequest request) {
   ModelAndView modelView = createModelAndViewWithSign("expense", request);
   String expenseId = HttpRequestUtil.getInst().getString("id");
   String corpId = HttpRequestUtil.getInst().getCurrentCorpId();
   // 删除审核人
   entityAccountService.deleteByEntityId(expenseId);
   // expenseFeeService.deleteExpenseFeeByExpenseId(expenseId);
   entityAccessoryService.deleteEntityAccessory(expenseId);
   if (!StringUtils.isEmpty(expenseId)) {
     Expense expense = expenseService.getExpenseById(expenseId);
     if (null == expense) {
       throw new VyiyunBusinessException("记录已被撤销或不存在!");
     }
     modelView.addObject("expenseInfo", expense);
     ExpenseFee expenseFee = new ExpenseFee();
     expenseFee.setExpenseId(expenseId);
     expenseFee.setCorpId(corpId);
     List<ExpenseFee> expenseFeeList = expenseFeeService.getExpenseFee(expenseFee);
     if (!CollectionUtils.isEmpty(expenseFeeList)) {
       List<Map<String, Object>> dataMap = new ArrayList<Map<String, Object>>();
       Map<String, Object> temp = null;
       SystemStatusCache<Object> systemStatusCache =
           SystemCacheUtil.getInstance().getSystemStatusCache();
       for (ExpenseFee ex : expenseFeeList) {
         temp = ex.getPersistentState();
         temp.put(
             "categoryDisplay",
             systemStatusCache.getSystemStatusValue(corpId, "CostCategory", ex.getCategory()));
         dataMap.add(temp);
       }
       modelView.addObject("expenseFeeList", dataMap);
     }
   }
   List<SystemStatus> costCategoryList =
       (List<SystemStatus>)
           systemStatusService.getSystemStatus(corpId, Constants.COST_CATEGORY, true);
   // (List<SystemStatus>)
   // SystemCacheUtil.getInstance().getSystemStatusCache()
   // .getSystemStatus(corpId, "CostCategory");
   if (!CollectionUtils.isEmpty(costCategoryList)) {
     modelView.addObject("costCategoryList", costCategoryList);
   }
   return modelView;
 }