Ejemplo n.º 1
0
  @RequestMapping("AuthDtlSubmit")
  public String AuthDtlSubmit(Model model, FTZ210205Form form) {
    FtzInMsgCtl query_FtzInMsgCtl = new FtzInMsgCtl();
    query_FtzInMsgCtl.setMsgId(form.getSelected_msgId());
    FtzInMsgCtl result_FtzInMsgCtl = ftz210205Serv.queryFtzInMsgCtl(query_FtzInMsgCtl);
    if (CommonConst.FTZ_MSG_STATUS_INPUTING.equals(result_FtzInMsgCtl.getMsgStatus())) {
      model.addAttribute(ResultMessages.error().add("e.ftzmis.210101.0032"));
      return "forward:/FTZ210205/QryAuthDtl";
    }
    UserInf userInfo = ContextConst.getCurrentUser();
    if (userInfo.getUserid().equals(result_FtzInMsgCtl.getMakUserId())) {
      model.addAttribute(ResultMessages.error().add("e.ftzmis.210101.0025"));
      return "forward:/FTZ210205/QryAuthDtl";
    }
    FtzInTxnDtl query_FtzInTxnDtl = new FtzInTxnDtl();
    query_FtzInTxnDtl.setMsgId(form.getSelected_msgId());
    List<FtzInTxnDtl> ftzInTxnDtls = ftz210205Serv.queryFtzInTxnDtlList(query_FtzInTxnDtl);
    if (null == ftzInTxnDtls || ftzInTxnDtls.size() < 1) {
      FtzInMsgCtl update_FtzInMsgCtl = new FtzInMsgCtl();
      update_FtzInMsgCtl.setMsgId(form.getFtzInMsgCtl().getMsgId());
      update_FtzInMsgCtl.setMsgNo(CommonConst.MSG_NO_210205);
      update_FtzInMsgCtl.setMsgStatus(CommonConst.FTZ_MSG_STATUS_AUTH_SUCC);
      update_FtzInMsgCtl.setChkUserId(userInfo.getUserid());
      update_FtzInMsgCtl.setRsv1(
          DateUtil.getFormatDateTimeRemoveSpritAndColon(form.getFtzInMsgCtl().getMakDatetime()));
      update_FtzInMsgCtl.setRsv2(
          DateUtil.getFormatDateTimeRemoveSpritAndColon(form.getFtzInMsgCtl().getChkDatetime()));
      update_FtzInMsgCtl.setChkDatetime(DateUtil.getNowInputDateTime());
      int i = ftz210205Serv.updateFtzInMsgCtl(update_FtzInMsgCtl, null);
      if (i < 1) {
        model.addAttribute(ResultMessages.error().add("e.ftzmis.2103.0008"));
      } else {
        model.addAttribute(ResultMessages.success().add("i.ftzmis.210301.0005"));
        form.setAuthFinishFlag("1");
        return "forward:/FTZ210205/QryAuthDtl";
      }
    } else {
      int count_unAuth = 0;
      int count_authFail = 0;
      StringBuffer sb_unAuth = new StringBuffer();
      StringBuffer sb_authFail = new StringBuffer();
      for (FtzInTxnDtl ftzInTxnDtl : ftzInTxnDtls) {
        String chkStatus = ftzInTxnDtl.getChkStatus();
        if (chkStatus.equals(CommonConst.FTZ_MSG_STATUS_INPUT_COMPLETED)) {
          count_unAuth++;
          sb_unAuth.append(ftzInTxnDtl.getSeqNo().toString() + ",");
        }
        if (chkStatus.equals(CommonConst.FTZ_MSG_STATUS_AUTH_FAIL)) {
          count_authFail++;
          sb_authFail.append(ftzInTxnDtl.getSeqNo().toString() + ",");
        }
      }
      if (count_unAuth > 0) {
        model.addAttribute(ResultMessages.error().add("e.ftzmis.210310.0012"));
        return "forward:/FTZ210205/QryAuthDtl";
      }
      if (count_authFail > 0) {
        model.addAttribute(
            ResultMessages.error()
                .add("e.ftzmis.210101.0031", sb_unAuth.subSequence(0, sb_authFail.length() - 1)));
        return "forward:/FTZ210205/QryAuthDtl";
      }

      FtzInMsgCtl update_FtzInMsgCtl = new FtzInMsgCtl();
      update_FtzInMsgCtl.setMsgStatus(CommonConst.FTZ_MSG_STATUS_AUTH_SUCC);
      if (form.getFtzInMsgCtl().getMsgId() != null
          && !"".equals(form.getFtzInMsgCtl().getMsgId())) {

        update_FtzInMsgCtl.setMsgId(form.getFtzInMsgCtl().getMsgId());
      } else {
        update_FtzInMsgCtl.setMsgId(form.getSelected_msgId());
      }
      update_FtzInMsgCtl.setMsgNo(CommonConst.MSG_NO_210205);

      update_FtzInMsgCtl.setChkUserId(userInfo.getUserid());
      update_FtzInMsgCtl.setRsv2(update_FtzInMsgCtl.getChkDatetime());
      update_FtzInMsgCtl.setChkDatetime(DateUtil.getNowInputDateTime());
      update_FtzInMsgCtl.setChkDatetime(DateUtil.getNowInputDateTime());
      int i = ftz210205Serv.updateFtzInMsgCtl(update_FtzInMsgCtl, null);
      if (i < 1) {
        model.addAttribute(ResultMessages.error().add("e.ftzmis.210301.0008"));
      } else {
        model.addAttribute(ResultMessages.success().add("i.ftzmis.210301.0005"));
        form.setAuthFinishFlag("1");
        return "forward:/FTZ210205/QryAuthDtl";
      }
    }

    return "forward:/FTZ210205/QryAuthDtl";
  }
Ejemplo n.º 2
0
  @RequestMapping("AddDtlDtlSubmit")
  public String AddDtlDtlSubmit(Model model, FTZ210205Form form, BindingResult result) {

    FtzInTxnDtl issert_FtzInTxnDtl = form.getFtzInTxnDtl();
    // 开始校验
    ResultMessages resultMessages = ResultMessages.error();

    // 出/入账标志
    if (null == issert_FtzInTxnDtl.getCdFlag()
        || "".equals(issert_FtzInTxnDtl.getCdFlag().trim())) {
      ResultMessage resultMessage = ResultMessage.fromCode("e.ftzmis.210101.0013");
      resultMessages.add(resultMessage);
    }

    if ("3".equals(issert_FtzInTxnDtl.getCdFlag().trim())
        || "4".equals(issert_FtzInTxnDtl.getCdFlag().trim())) {
      if (null == issert_FtzInTxnDtl.getOrgTranDate()
          || "".equals(issert_FtzInTxnDtl.getOrgTranDate().trim())
          || ((null != issert_FtzInTxnDtl.getTranDate())
              && DateUtil.getFormatDateRemoveSprit(issert_FtzInTxnDtl.getTranDate())
                      .compareToIgnoreCase(
                          DateUtil.getFormatDateRemoveSprit(issert_FtzInTxnDtl.getOrgTranDate()))
                  < 0)) {
        ResultMessage resultMessage = ResultMessage.fromCode("e.ftzmis.210101.0027");
        resultMessages.add(resultMessage);
      }
    }

    // 记帐日期
    if (null == issert_FtzInTxnDtl.getTranDate()
        || "".equals(issert_FtzInTxnDtl.getTranDate().trim())) {
      ResultMessage resultMessage = ResultMessage.fromCode("e.ftzmis.210101.0014");
      resultMessages.add(resultMessage);
    }
    // 金额
    if (null == issert_FtzInTxnDtl.getAmount()) {
      ResultMessage resultMessage = ResultMessage.fromCode("e.ftzmis.210101.0015");
      resultMessages.add(resultMessage);
    } else {
      if (!Validator.CheckAmount(issert_FtzInTxnDtl.getAmount())) {
        ResultMessage resultMessage = ResultMessage.fromCode("e.ftzmis.210303.0013");
        resultMessages.add(resultMessage);
      }
    }

    // 国别代码
    if (null == issert_FtzInTxnDtl.getCountryCode()
        || "".equals(issert_FtzInTxnDtl.getCountryCode().trim())) {
      ResultMessage resultMessage = ResultMessage.fromCode("e.ftzmis.210101.0016");
      resultMessages.add(resultMessage);
    }

    // 交易性质
    if (null == issert_FtzInTxnDtl.getTranType()
        || "".equals(issert_FtzInTxnDtl.getTranType().trim())) {
      ResultMessage resultMessage = ResultMessage.fromCode("e.ftzmis.210101.0017");
      resultMessages.add(resultMessage);
    }
    // 正常出账或入账时必输
    if ("1".equals(issert_FtzInTxnDtl.getCdFlag().trim())
        || "2".equals(issert_FtzInTxnDtl.getCdFlag().trim())) {
      if (null == issert_FtzInTxnDtl.getOppAccount()
          || "".equals(issert_FtzInTxnDtl.getOppAccount().trim())) {
        ResultMessage resultMessage = ResultMessage.fromCode("e.ftzmis.210205.0001");
        resultMessages.add(resultMessage);
      }
    }
    // 正常出账或者入账时用户名必输
    if ("1".equals(issert_FtzInTxnDtl.getCdFlag().trim())
        || "2".equals(issert_FtzInTxnDtl.getCdFlag().trim())) {
      if (null == issert_FtzInTxnDtl.getOppName()
          || "".equals(issert_FtzInTxnDtl.getOppName().trim())) {
        ResultMessage resultMessage = ResultMessage.fromCode("e.ftzmis.210205.0006");
        resultMessages.add(resultMessage);
      }
    }
    //		//对方客户性质
    if (null == issert_FtzInTxnDtl.getOppCusType()
        || "".equals(issert_FtzInTxnDtl.getOppCusType().trim())) {
      ResultMessage resultMessage = ResultMessage.fromCode("e.ftzmis.210205.0002");
      resultMessages.add(resultMessage);
    }

    if (resultMessages.isNotEmpty()) {
      model.addAttribute(resultMessages);
      return "ftzmis/FTZ210205_Input_Dtl_Dtl";
    }

    FtzInTxnDtl query_FtzInTxnDtl = new FtzInTxnDtl();
    query_FtzInTxnDtl.setMsgId(issert_FtzInTxnDtl.getMsgId());
    List<FtzInTxnDtl> ftzInTxnDtls = ftz210205Serv.queryFtzInTxnDtlList(query_FtzInTxnDtl);
    if (null == ftzInTxnDtls || ftzInTxnDtls.size() == 0) {
      issert_FtzInTxnDtl.setSeqNo(StringUtil.addZeroForNum("1", 6));
    } else {
      FtzInTxnDtl ftzInTxnDtl_tmp = ftzInTxnDtls.get(ftzInTxnDtls.size() - 1);
      String seqNo = Integer.parseInt(ftzInTxnDtl_tmp.getSeqNo()) + 1 + "";
      issert_FtzInTxnDtl.setSeqNo(StringUtil.addZeroForNum(seqNo, 6));
    }

    issert_FtzInTxnDtl.setTranDate(
        DateUtil.getFormatDateRemoveSprit(issert_FtzInTxnDtl.getTranDate()));
    issert_FtzInTxnDtl.setValueDate(
        DateUtil.getFormatDateRemoveSprit(issert_FtzInTxnDtl.getValueDate()));
    issert_FtzInTxnDtl.setOrgTranDate(
        DateUtil.getFormatDateRemoveSprit(issert_FtzInTxnDtl.getOrgTranDate()));
    issert_FtzInTxnDtl.setExpireDate(
        DateUtil.getFormatDateRemoveSprit(issert_FtzInTxnDtl.getExpireDate()));
    UserInf userInfo = ContextConst.getCurrentUser();
    issert_FtzInTxnDtl.setMakUserId(userInfo.getUserid());
    issert_FtzInTxnDtl.setMakDatetime(DateUtil.getNowInputDateTime());
    issert_FtzInTxnDtl.setChkStatus(CommonConst.FTZ_MSG_STATUS_INPUT_COMPLETED);
    int i = ftz210205Serv.insertFtzInTxnDtl(issert_FtzInTxnDtl);
    if (i < 1) {
      model.addAttribute(ResultMessages.error().add("e.sysrunner.0006"));
    } else {
      model.addAttribute(ResultMessages.success().add("i.ftzmis.210210.0003"));
      model.addAttribute("uptFlag", "1");
    }
    form.getFtzInTxnDtl()
        .setTranDate(DateUtil.getFormatDateAddSprit(form.getFtzInTxnDtl().getTranDate()));
    form.getFtzInTxnDtl()
        .setOrgTranDate(DateUtil.getFormatDateAddSprit(form.getFtzInTxnDtl().getOrgTranDate()));
    form.getFtzInTxnDtl()
        .setExpireDate(DateUtil.getFormatDateAddSprit(form.getFtzInTxnDtl().getExpireDate()));
    form.getFtzInTxnDtl()
        .setMakDatetime(
            DateUtil.getFormatDateTimeAddSpritAndColon(form.getFtzInTxnDtl().getMakDatetime()));
    form.getFtzInTxnDtl()
        .setChkDatetime(
            DateUtil.getFormatDateTimeAddSpritAndColon(form.getFtzInTxnDtl().getChkDatetime()));
    return "ftzmis/FTZ210205_Input_Dtl_Dtl";
  }