⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 preservice.java

📁 本套系统采用了业界当前最为流行的beanAction组件
💻 JAVA
字号:
package teleReport.service;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;

import com.ibatis.dao.client.DaoManager;
import commons.persistence.DaoConfig;
import commons.service.BaseService;

import teleReport.domain.CardInfo;
import teleReport.domain.ChargeType;
import teleReport.domain.City;
import teleReport.domain.OrderInfo;
import teleReport.domain.PreInfo;
import teleReport.domain.Product;
import teleReport.persistence.iface.PreDAO;

;

public class PreService extends BaseService {
	private static final int PAGENUM = 10;
	DaoManager daoManager = null;
	private PreDAO preDAO = null;
	List<PreInfo> totalList;

	public PreService() {
		daoManager = DaoConfig.getDaoManager();
		preDAO = (PreDAO) daoManager.getDao(PreDAO.class);
	}

	public PreService(PreDAO dao) {
		preDAO = dao;
	}

	// *********************
	// 浠ヤ笅涓庡垎椤垫湁鍏�
	public List<PreInfo> showCardInputer(PreInfo preInfo) {
		totalList = preDAO.getPreInfoInputer(preInfo);

		return totalList;
	}

	// 脤酶脳陋脝盲脣没脪鲁脙忙
	public List<PreInfo> preGoNextPage(PreInfo preInfo,
			List<PreInfo> preInfoList) {
		List<PreInfo> tempPagePayoutList = new ArrayList<PreInfo>();
		int curPage = Integer.parseInt(preInfo.getCurrentPage());
		int sumPage;// =Integer.parseInt(payoutInfo.getPageSum());
		if (preInfoList.size() % PAGENUM == 0) {
			sumPage = preInfoList.size() / PAGENUM;
		} else {
			sumPage = preInfoList.size() / PAGENUM + 1;
		}
		if (sumPage >= curPage) {
			for (int i = (curPage - 1) * PAGENUM; i < curPage * PAGENUM
					&& i <= preInfoList.size() - 1; i++) {
				PreInfo tempPayoutInfo = new PreInfo();
				tempPayoutInfo = preInfoList.get(i);
				tempPagePayoutList.add(tempPayoutInfo);
			}

			preInfo.setCurrentPage(Integer.toString(curPage));
			preInfo.setTotalPage(Integer.toString(sumPage));
			return tempPagePayoutList;
		} else {
			return tempPagePayoutList;
		}
	}

	// 脗录脠毛脥篓脰陋碌楼脨脜脧垄拢卢路碌禄脴脰梅录眉
	public Long insertPre(PreInfo preInfo) {
		Long pk = null;
		try {
			daoManager.startTransaction();
			pk = preDAO.insertPre(preInfo);
			daoManager.commitTransaction();
		} finally {
			daoManager.endTransaction();
		}
		return pk;
	}

	// 脪脭脧脗脫毛脧脗脌颅卤铆碌楼脧脭脢戮脛脷脠脻脫脨鹿脴

	public List<ChargeType> getChargeType() {

		return preDAO.getChargeType();

	}

	public List<Product> getProduct() {
		return preDAO.getProduct();
	}

	public List<City> getCity() {
		return preDAO.getCity();
	}

	public PreInfo getPreById(String preid) {
		return preDAO.getPreById(preid);
	}

	// 脡戮鲁媒脥篓脰陋碌楼脨脜脧垄
	public void deletePre(String preid) {
		preDAO.deletePre(preid);
	}

	// 脗录脠毛脮脽赂眉脨脗脥篓脰陋碌楼脨脜脧垄
	public PreInfo updateAll(PreInfo preInfo) {
		return preDAO.updateAllPre(preInfo);
	}

	// 禄眉潞脣脮脽赂眉脨脗脥篓脰陋碌楼脳麓脤卢
	public PreInfo updateState(PreInfo preInfo) {

		return preDAO.updatePreState(preInfo);
	}

	// 脗录脠毛脮脽虏茅脩炉脨脜脧垄
	public List<PreInfo> searchPreInputer(PreInfo preInfo) {
		return preDAO.getPreInfoInputer(preInfo);
	}

	public List<PreInfo> goHeadpage(PreInfo preInfo, List<PreInfo> pageInfoList) {
		List<PreInfo> tempPagePayoutList = new ArrayList<PreInfo>();

		for (int i = 0; i < PAGENUM && i <= pageInfoList.size() - 1; i++) {
			PreInfo tempPayoutInfo = new PreInfo();
			tempPayoutInfo = pageInfoList.get(i);
			tempPagePayoutList.add(tempPayoutInfo);
		}
		return tempPagePayoutList;
	}

	public List<PreInfo> goEndPage(PreInfo preInfo, List<PreInfo> preInfoList) {
		List<PreInfo> tempPagePayoutList = new ArrayList<PreInfo>();
		int sumPage = Integer.parseInt(preInfo.getTotalPage());
		if (sumPage > 0) {
			for (int i = (sumPage - 1) * PAGENUM; i <= preInfoList.size() - 1; i++) {
				PreInfo tempPayoutInfo = new PreInfo();
				tempPayoutInfo = preInfoList.get(i);
				tempPagePayoutList.add(tempPayoutInfo);
			}
			preInfo.setCurrentPage(Integer.toString(sumPage));
		} else {
			preInfo.setCurrentPage("1");
		}

		return tempPagePayoutList;
	}

	public List<PreInfo> goToNextPage(PreInfo cardInfo,
			List<PreInfo> preInfoList) {
		List<PreInfo> tempPagePayoutList = new ArrayList<PreInfo>();
		int curPage = Integer.parseInt(cardInfo.getCurrentPage());
		int sumPage = Integer.parseInt(cardInfo.getTotalPage());

		if (sumPage > curPage) {
			curPage++;
		}
		for (int i = (curPage - 1) * PAGENUM; i < curPage * PAGENUM
				&& i <= preInfoList.size() - 1; i++) {
			PreInfo tempPayoutInfo = new PreInfo();
			tempPayoutInfo = preInfoList.get(i);
			tempPagePayoutList.add(tempPayoutInfo);
		}

		cardInfo.setCurrentPage(Integer.toString(curPage));

		return tempPagePayoutList;
	}

	public List<PreInfo> goToLastPage(PreInfo preInfo, List<PreInfo> preInfoList) {
		List<PreInfo> tempPagePayoutList = new ArrayList<PreInfo>();
		int curPage = Integer.parseInt(preInfo.getCurrentPage());

		if (curPage > 1) {
			curPage--;
		}
		for (int i = (curPage - 1) * PAGENUM; i < curPage * PAGENUM
				&& i <= preInfoList.size() - 1; i++) {
			PreInfo tempPayoutInfo = new PreInfo();
			tempPayoutInfo = preInfoList.get(i);
			tempPagePayoutList.add(tempPayoutInfo);
		}
		preInfo.setCurrentPage(Integer.toString(curPage));
		return tempPagePayoutList;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -