Example #1
0
  /**
   * 保存付款登记.
   *
   * <p><b>创建人:</b><br>
   * &nbsp;&nbsp; 陈荣盛 2014年10月28日 下午12:49:05<br>
   *
   * <p><b>修改人:</b><br>
   * &nbsp;&nbsp; 2014年10月28日 下午12:49:05<br>
   *
   * <p><b>修改说明:</b><br>
   * &nbsp;&nbsp;<br>
   *
   * @param sklius 收费json字串
   * @return ajax对象
   */
  @RequestMapping(value = "/saveFkliuList")
  @ResponseBody
  public AjaxMessage saveFkliuList(HttpServletRequest request, String fklius, boolean autono) {

    // 取得登录用户信息
    Oper loginUser = (Oper) request.getSession().getAttribute(Constants.LOGINUSER_SESSION);
    if (null == loginUser) {
      return new AjaxMessage(false, "登录超时,请重新登录后再操作!");
    }

    // 将费用预算json字符串转换成费用预算对象列表
    List<Fkliu> fkList = JsonUtil.toObjectList(fklius, Fkliu.class);

    if (null == fkList || 0 == fkList.size()) {
      return new AjaxMessage(false, "付款登记保存失败!!!");
    }

    // 获取参数
    Setup s = setupService2.getSetup("nkamountday");

    int i = 1;
    for (Fkliu fk : fkList) {
      if (1 == CheckFlowDate.checkFlowDate(fk.getDatex(), s)) {
        return new AjaxMessage(false, "第" + i + "行付款日期错误,该月已结账!");
      }
      //			fk.setDatex(new Date());
      fk.setIsheadoffice('0');
    }

    int result = 1;
    String msg = "付款登记保存失败!!!";
    // 保存费用预算
    result = this.fkliuService.saveFkliu(fkList, autono, 0, loginUser);

    if (2 == result) {
      msg = "发票号不可用";
    }

    return new AjaxMessage(0 == result ? true : false, msg);
  }
Example #2
0
  @RequestMapping(value = "/saveFkliu")
  @ResponseBody
  public AjaxMessage saveSkliu(
      HttpServletRequest request,
      String groupno,
      String scode,
      String amount,
      String cy,
      String rate,
      Character yf,
      String cashbank,
      String invno,
      String xdate,
      String note,
      boolean autono)
      throws ParseException {

    // 取得登录用户信息
    Oper loginUser = (Oper) request.getSession().getAttribute(Constants.LOGINUSER_SESSION);
    if (null == loginUser) {
      return new AjaxMessage(false, "登录超时,请重新登录后再操作!");
    }

    // 根据银行账号获取部门
    Dept dept = this.deptService.getDeptByAcNo(cashbank);
    if (null == dept) return new AjaxMessage(false, "获取银行账户部门失败!");
    // 判断是否超预算
    StringBuffer str = new StringBuffer();
    if (0 == this.personlstService.checkCredit(dept, str, Double.parseDouble(amount)))
      return new AjaxMessage(false, str.toString());

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String nowTime = sdf.format(new Date());
    xdate = xdate + nowTime.substring(10);

    Fkliu sk = new Fkliu();
    sk.setAcNo(cashbank);
    sk.setAmount(new BigDecimal(amount));
    sk.setSheetno(invno);
    sk.setDatex(sdf.parse(xdate));
    sk.setScode(scode);
    sk.setCy(cy);
    sk.setRate(new BigDecimal(rate));
    sk.setNote(note);
    sk.setYf(yf);
    sk.setMaker(loginUser.getName());
    sk.setGroupno(groupno);
    sk.setIsheadoffice('0');

    // 获取参数
    Setup s = setupService2.getSetup("nkamountday");

    if (1 == CheckFlowDate.checkFlowDate(sk.getDatex(), s)) {
      return new AjaxMessage(false, "该月已结账,收款日期错误!");
    }

    int result = 1;
    String msg = "付款登记保存失败!!!";
    List<Fkliu> skList = new ArrayList<Fkliu>();
    skList.add(sk);
    // 保存费用预算
    result = this.fkliuService.saveFkliu(skList, autono, 1, loginUser);

    if (2 == result) {
      msg = "付款单号不可用";
    }

    return new AjaxMessage(0 == result ? true : false, msg);
  }