Пример #1
0
  /**
   * 修改指定的通讯费信息
   *
   * @return String
   */
  public String comsPayCommunicationUpdate() {
    ComsPayCommunication ComsPayCommunication =
        (ComsPayCommunication) request.getSession().getAttribute("ComsPayCommunication");
    Authuser user = (Authuser) request.getSession().getAttribute("currentUser");

    ComsPayCommunication.setReimbursedNum(reimbursedNum);
    ComsPayCommunication.setReimbursedMoney(reimbursedMoney);
    ComsPayCommunication.setReimbursedType(reimbursedType);
    ComsPayCommunication.setInvoiceCode(invoiceCode);
    ComsPayCommunication.setTermid(termid);
    ComsPayCommunication.setTermno(termnos);
    ComsPayCommunication.setTermseq(termSeqs);
    ComsPayCommunication.setAddress(address);
    ComsPayCommunication.setItemUid(addItemUid); // 从终端表取得项目编号
    ComsPayCommunication.setCostTypeCode("100016");
    ComsPayCommunication.setRealCost(realCost);

    ComsPayCommunication.setOrgInnerCode01(orgInnerCode01);
    ComsPayCommunication.setOrgInnerCode02(orgInnerCode02);
    ComsPayCommunication.setOrgInnerCode03(orgInnerCode03);

    ComsPayCommunication.setRemark(remark);
    ComsPayCommunication.setPayState("1");
    ComsPayCommunication.setTransactionPerson(tsPerson);
    ComsPayCommunication.setUserid(user.getUserid());
    ComsPayCommunication.setSubmitDate(DateConvert.Date2String(new java.util.Date()));
    ComsPayCommunication.setCostDate(startCostDate);

    try {
      // 修改通讯费
      comsPayCommunicationService.updateComsPayCommunication(ComsPayCommunication);
      // 加上审计日志
      new LogAssistant(
              user.getUsername().trim(),
              request.getRemoteAddr() + ":" + TrackOpterationEnum.UPDATE.getOperation(),
              "修改通讯费[" + payUid + "]成功")
          .logUserOpt();
      this.message = "修改通讯费信息成功!";
    } catch (RuntimeException re) {
      message = "发生内部异常,修改通讯费[" + payUid + "]失败!请与管理员联系";
      log.error(message + ",Error Message:" + re.getMessage());
    }

    return SUCCESS;
  }
Пример #2
0
  /**
   * 编辑指定的通讯费支付信息
   *
   * @return String
   */
  public String comsPayCommunicationEdit() {
    String batchNum = String.valueOf(request.getParameter("ComsPayCommunicationId"));

    Object[] comsPayCommunication = comsPayCommunicationService.findByBatchNum(batchNum);
    // 根据批次号得到终端信息列表
    if (comsPayCommunication != null && comsPayCommunication.length > 0) {
      if (comsPayCommunication[0] != null && !comsPayCommunication[0].equals("")) {
        this.costTypeCode = comsPayCommunication[0].toString();
      }
      if (comsPayCommunication[1] != null && !comsPayCommunication[1].equals("")) {
        this.payTotalMoney = Double.parseDouble(comsPayCommunication[1].toString());
      }
      if (comsPayCommunication[2] != null && !comsPayCommunication[2].equals("")) {
        this.startCostDate =
            DateConvert.convertAtoB(comsPayCommunication[2].toString(), "yyyyMM", "yyyy-MM");
      }
      if (comsPayCommunication[3] != null && !comsPayCommunication[3].equals("")) {
        this.endCostDate =
            DateConvert.convertAtoB(comsPayCommunication[3].toString(), "yyyyMM", "yyyy-MM");
      }
      if (comsPayCommunication[4] != null && !comsPayCommunication[4].equals("")) {
        this.reimbursedMoney = Double.parseDouble(comsPayCommunication[4].toString());
      }
      if (comsPayCommunication[5] != null && !comsPayCommunication[5].equals("")) {
        this.reimbursedNum = comsPayCommunication[5].toString();
      }
      if (comsPayCommunication[6] != null && !comsPayCommunication[6].equals("")) {
        this.reimbursedType = comsPayCommunication[6].toString();
      }
      if (comsPayCommunication[7] != null && !comsPayCommunication[7].equals("")) {
        this.remark = comsPayCommunication[7].toString();
      }
      if (comsPayCommunication[8] != null && !comsPayCommunication[8].equals("")) {
        this.tsPerson = comsPayCommunication[8].toString();
      }
      if (comsPayCommunication[9] != null && !comsPayCommunication[9].equals("")) {
        this.invoiceCode = comsPayCommunication[9].toString();
      }
    }
    this.termList = comsPayCommunicationService.findTermListByBatchNum(batchNum);

    /**
     * ComsPayCommunication ComsPayCommunication = comsPayCommunicationService.findById(id);
     * this.payUid = ComsPayCommunication.getPayUid(); this.address =
     * ComsPayCommunication.getAddress(); this.costTypeCode =
     * ComsPayCommunication.getCostTypeCode(); this.orgInnerCode01 =
     * ComsPayCommunication.getOrgInnerCode01(); this.orgInnerCode02 =
     * ComsPayCommunication.getOrgInnerCode02(); this.orgInnerCode03 =
     * ComsPayCommunication.getOrgInnerCode03(); this.addItemUid =
     * ComsPayCommunication.getItemUid(); this.termid = ComsPayCommunication.getTermid();
     * this.termnos = ComsPayCommunication.getTermno(); this.termSeqs =
     * ComsPayCommunication.getTermseq();
     *
     * <p>this.startCostDate = ComsPayCommunication.getCostDate(); this.endCostDate =
     * ComsPayCommunication.getCostDate(); this.invoiceCode =ComsPayCommunication.getInvoiceCode();
     * //this.itemUids = ComsPayCommunication.getItemUid(); ComsProject comsProject =
     * comsProjectDao.findById(ComsPayCommunication.getItemUid()); this.itemName =
     * comsProject.getItemName(); this.realCost = ComsPayCommunication.getRealCost();
     * this.reimbursedMoney = ComsPayCommunication.getReimbursedMoney(); this.reimbursedNum =
     * ComsPayCommunication.getReimbursedNum(); this.reimbursedType =
     * ComsPayCommunication.getReimbursedType(); this.remark = ComsPayCommunication.getRemark();
     * this.payState = ComsPayCommunication.getPayState(); this.tsPerson =
     * ComsPayCommunication.getTransactionPerson();
     *
     * <p>request.getSession().setAttribute("ComsPayCommunication", ComsPayCommunication);
     */
    return SUCCESS;
  }
Пример #3
0
  /**
   * 查询通讯费支付信息
   *
   * @return String
   */
  public String comsPayCommunicationSearch() {
    // 需要先取得pageBean实例
    pageBean = (PageBean) request.getSession().getAttribute("pageBean");
    if (pageBean == null) {
      pageBean = new PageBean();
      request.getSession().setAttribute("pageBean", pageBean);
    }
    String sql = "";
    if (this.getPageNo() <= 0) pageBean.setCurrentPage(1);
    else pageBean.setCurrentPage(this.getPageNo());

    if (getItemUids() != null
        && (!getItemUids().trim().equals(""))
        && (!getItemUids().trim().equals(AppCommonVarRegiter.ALL_VALUE_TAG))
        && (!getItemUids().trim().equals(AppCommonVarRegiter.NULL_VALUE_TAG))) {
      sql += " and v.itemUid like '" + getItemUids().trim() + "%'";
    }

    if (getOrgCode() != null && !getOrgCode().trim().equals("")) {
      Organization orgSelected = orgDao.findByOrgId(getOrgCode());
      String innercodeSelected = (String) orgDao.getOrgInnerInfo(orgSelected)[0];
      if (orgSelected.getOrgType().trim().equals("00"))
        sql += " and v.orgInnerCode01 like '" + innercodeSelected + "%'";
      else if (orgSelected.getOrgType().trim().equals("01"))
        sql += " and v.orgInnerCode02 like '" + innercodeSelected + "%'";
      else if (orgSelected.getOrgType().trim().equals("02"))
        sql += " and v.orgInnerCode03 like '" + innercodeSelected + "%'";
    }
    if (getTermSeqs() != null
        && (!getTermSeqs().trim().equals(""))
        && (!getTermSeqs().trim().equals(AppCommonVarRegiter.ALL_VALUE_TAG))
        && (!getTermSeqs().trim().equals(AppCommonVarRegiter.NULL_VALUE_TAG))) {
      sql += " and v.termseq = '" + getTermSeqs().trim() + "'";
    }
    if (getTermnos() != null
        && (!getTermnos().trim().equals(""))
        && (!getTermnos().trim().equals(AppCommonVarRegiter.ALL_VALUE_TAG))
        && (!getTermnos().trim().equals(AppCommonVarRegiter.NULL_VALUE_TAG))) {
      sql += " and v.termno = '" + getTermnos().trim() + "'";
    }
    if (this.getSearchStartDate() != null && !getSearchStartDate().equals("")) {
      sql =
          sql
              + " and v.costDate >='"
              + DateConvert.convertAtoB(getSearchStartDate(), "yyyy-MM", "yyyyMM")
              + "'";
    }
    if (this.getSearchEndDate() != null && !getSearchEndDate().equals("")) {
      sql =
          sql
              + " and v.costDate <='"
              + DateConvert.convertAtoB(getSearchEndDate(), "yyyy-MM", "yyyyMM")
              + "'";
    }
    String state = this.getSearchPayState();
    if (state != null && !state.equals("")) {
      if (state != "0" && !state.equals("0")) {
        sql = sql + " and v.payState ='" + state + "'";
      }
    }

    // 构造查询
    String queryStr =
        " select max(v.batchNum) as batchNum,max(v.termno) as termno,"
            + " max(v.termseq) as termseq,max(v.address) as address,max(v.payTotalMoney) as money,"
            + "(select min(f.costDate) from  ComsPayCommunication f where f.termBatchNum = v.termBatchNum) as startCostDate,"
            + "(select max(f.costDate) from  ComsPayCommunication f where f.termBatchNum = v.termBatchNum) as endCostDate "
            + "from ComsPayCommunication v where 1=1 ";
    queryStr = queryStr + sql + " group by v.termBatchNum order by max(v.batchNum)";

    String countStr =
        " select count(distinct v.termBatchNum) from ComsPayCommunication v where 1=1  ";
    countStr = countStr + sql;

    payList =
        (List<Object[]>) comsPayCommunicationDao.findByPageSupport(countStr, queryStr, pageBean);

    if (payList.size() > 0) {
      for (Object[] cpf : payList) {
        String startCostDate = cpf[5].toString();
        String endCostDate = cpf[6].toString();
        cpf[5] = DateConvert.convertAtoB(startCostDate, "yyyyMM", "yyyy-MM");
        cpf[6] = DateConvert.convertAtoB(endCostDate, "yyyyMM", "yyyy-MM");
      }
    }

    return SUCCESS;
  }
Пример #4
0
  /**
   * 添加通讯费支付信息
   *
   * @return String
   */
  public String comsPayCommunicationAdd() {
    Authuser user = (Authuser) request.getSession().getAttribute("currentUser");
    /** 得到支付期间 */
    Date startDate = DateConvert.Convert(startCostDate + "-01");
    Date endDate = DateConvert.Convert(endCostDate + "-01");

    int months = AppCommonVarRegiter.countMonthSpace(startDate, endDate);
    double realPayCost = 0;
    // 如果有多个月份需要平分支付金额
    if (payTotalMoney != 0 && months != 0 && (sTermNo != null && sTermNo.length > 0)) {
      realPayCost = payTotalMoney / (months * sTermNo.length);
    }
    String batchNum = UUID.randomUUID().toString();
    List<ComsPayCommunication> addList = new ArrayList<ComsPayCommunication>();

    if (sTermNo != null && sTermNo.length > 0) {
      for (int j = 0; j < sTermNo.length; j++) {
        String termBatchNum = UUID.randomUUID().toString();
        for (int i = 0; i < months; i++) {
          String date = DateConvert.getNextMonth(startDate, i, "yyyyMM");
          ComsPayCommunication ComsPayCommunication = new ComsPayCommunication();
          ComsPayCommunication.setReimbursedNum(reimbursedNum);
          ComsPayCommunication.setReimbursedMoney(reimbursedMoney);
          ComsPayCommunication.setReimbursedType(reimbursedType);
          ComsPayCommunication.setInvoiceCode(invoiceCode);
          ComsPayCommunication.setTermid(Integer.parseInt(sTermInfoId[j].trim()));
          ComsPayCommunication.setTermno(sTermNo[j].trim());
          ComsPayCommunication.setTermseq(sTermSeq[j].trim());
          ComsPayCommunication.setAddress(sAddress[j].trim());
          ComsPayCommunication.setItemUid(sItemUid[j].trim()); // 从终端表取得项目编号
          ComsPayCommunication.setOrgInnerCode01(sOrgInnerCode01[j]);
          ComsPayCommunication.setOrgInnerCode02(sOrgInnerCode02[j]);
          ComsPayCommunication.setOrgInnerCode03(sOrgInnerCode03[j]);
          ComsPayCommunication.setRemark(remark);
          ComsPayCommunication.setCostTypeCode("100016");
          ComsPayCommunication.setPayState("1");
          ComsPayCommunication.setTransactionPerson(tsPerson);
          ComsPayCommunication.setUserid(user.getUserid());
          ComsPayCommunication.setSubmitDate(DateConvert.Date2String(new java.util.Date()));
          ComsPayCommunication.setCostDate(date);
          ComsPayCommunication.setRealCost(realPayCost);
          ComsPayCommunication.setPayTotalMoney(payTotalMoney);
          ComsPayCommunication.setBatchNum(batchNum);
          ComsPayCommunication.setTermBatchNum(termBatchNum);
          addList.add(ComsPayCommunication);
        }
      }
    }
    // 添加通讯费支付
    String errMessage = comsPayCommunicationService.batchSave(addList);
    // 加上审计日志
    if (errMessage != null) {
      this.setErrMessage(errMessage);
      return INPUT;
    } else {
      String msg =
          "添加通讯费支付终端号为["
              + termnos
              + "],终端序列号为["
              + termSeqs
              + "],"
              + "支付成本期从["
              + startCostDate
              + "]到["
              + endCostDate
              + "] 成功";
      new LogAssistant(
              user.getUsername().trim(),
              request.getRemoteAddr() + ":" + TrackOpterationEnum.ADD.getOperation(),
              msg)
          .logUserOpt();
      this.message = "添加通讯费支付登记成功!";
    }

    return SUCCESS;
  }
Пример #5
0
  @SuppressWarnings("unchecked")
  public String makeReport() {
    String sql = "";
    if (getItemUids() != null
        && (!getItemUids().trim().equals(""))
        && (!getItemUids().trim().equals(AppCommonVarRegiter.ALL_VALUE_TAG))
        && (!getItemUids().trim().equals(AppCommonVarRegiter.NULL_VALUE_TAG))) {
      sql += " and v.itemUid like '" + getItemUids().trim() + "%'";
    }
    Organization orgSelected = null;
    if (getOrgCode() != null && !getOrgCode().trim().equals("")) {
      orgSelected = orgDao.findByOrgId(getOrgCode());
      String innercodeSelected = (String) orgDao.getOrgInnerInfo(orgSelected)[0];
      if (orgSelected.getOrgType().trim().equals("00"))
        sql += " and v.orgInnerCode01 like '" + innercodeSelected + "%'";
      else if (orgSelected.getOrgType().trim().equals("01"))
        sql += " and v.orgInnerCode02 like '" + innercodeSelected + "%'";
      else if (orgSelected.getOrgType().trim().equals("02"))
        sql += " and v.orgInnerCode03 like '" + innercodeSelected + "%'";
    }
    if (getTermSeqs() != null
        && (!getTermSeqs().trim().equals(""))
        && (!getTermSeqs().trim().equals(AppCommonVarRegiter.ALL_VALUE_TAG))
        && (!getTermSeqs().trim().equals(AppCommonVarRegiter.NULL_VALUE_TAG))) {
      sql += " and v.termseq = '" + getTermSeqs().trim() + "'";
    }
    if (getTermnos() != null
        && (!getTermnos().trim().equals(""))
        && (!getTermnos().trim().equals(AppCommonVarRegiter.ALL_VALUE_TAG))
        && (!getTermnos().trim().equals(AppCommonVarRegiter.NULL_VALUE_TAG))) {
      sql += " and v.termno = '" + getTermnos().trim() + "'";
    }
    if (this.getSearchStartDate() != null && !getSearchStartDate().equals("")) {
      sql =
          sql
              + " and v.costDate >='"
              + DateConvert.convertAtoB(getSearchStartDate(), "yyyy-MM", "yyyyMM")
              + "'";
    }
    if (this.getSearchEndDate() != null && !getSearchEndDate().equals("")) {
      sql =
          sql
              + " and v.costDate <='"
              + DateConvert.convertAtoB(getSearchEndDate(), "yyyy-MM", "yyyyMM")
              + "'";
    }
    String state = this.getSearchPayState();
    if (state != null && !state.equals("")) {
      if (state != "0" && !state.equals("0")) {
        sql = sql + " and v.payState ='" + state + "'";
      }
    }

    // 构造查询
    String queryStr =
        " select v from ComsPayCommunication v where 1=1 " + sql + " order by v.termno,v.costDate";
    List<ComsPayCommunication> dataList = new ArrayList<ComsPayCommunication>();
    dataList.addAll(comsPayCommunicationDao.getAllDataByQuery(queryStr));
    if (dataList != null && dataList.size() > 0) {
      // 翻译
      for (ComsPayCommunication pay : dataList) {
        pay.setCostDate(
            AppCommonVarRegiter.changeTimeStyle("yyyyMM", pay.getCostDate(), "yyyy-MM"));
        // 运营机构
        pay.setOrgInnerCode01(orgDao.findByInnerCode(pay.getOrgInnerCode01()).getOrgNameCn());
        // 项目
        pay.setItemUid(comsProjectDao.findById(pay.getItemUid()).getItemName());
      }
      Authuser authuser = (Authuser) request.getSession().getAttribute("currentUser");
      filename = "通讯费支付历史明细报表.xls";

      Map beans = new HashMap();
      beans.put("orgName", orgSelected.getOrgNameCn());
      beans.put("authorUser", authuser.getRealName());
      Date createDate = new Date();
      beans.put("createDate", createDate);
      beans.put("dataList", dataList);
      HSSFWorkbook wb = new HSSFWorkbook();
      Configuration config = new Configuration();
      XLSTransformer transformer = new XLSTransformer(config);
      InputStream is = null;
      try {
        is = new FileInputStream(request.getRealPath("/WEB-INF") + filepath);
        wb = transformer.transformXLS(is, beans);
        // 产生POI输出流
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        wb.write(os);
        excelStream = new ByteArrayInputStream(os.toByteArray());
      } catch (IOException e) {
        e.printStackTrace();
      }
      message = "生成报表:" + filename;
      new LogAssistant(
              authuser.getUsername().trim(),
              request.getRemoteAddr() + ":" + TrackOpterationEnum.MAKEREPORT.getOperation(),
              message)
          .logUserOpt();
      return "excel";
    } else {
      message = "没有通讯费支付记录!";
    }
    return SUCCESS;
  }