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

📄 storageinfoserviceimpl.java

📁 一个关于物流的管理系统
💻 JAVA
字号:
package com.shunshi.ssh.service;

import java.util.List;

import org.extremecomponents.table.limit.Limit;

import com.shunshi.ssh.dao.IAllInfoDao;
import com.shunshi.ssh.dao.IStorageinfoDao;
import com.shunshi.ssh.entity.Agent;
import com.shunshi.ssh.entity.AllInfo;
import com.shunshi.ssh.entity.Page;
import com.shunshi.ssh.entity.StorageInfo;
import com.shunshi.ssh.exception.AgentDaoException;
import com.shunshi.ssh.exception.AgentServiceException;
import com.shunshi.ssh.exception.StorageinfoDaoException;
import com.shunshi.ssh.exception.StorageinfoServiceException;

public class StorageinfoServiceImpl implements IStorageinfoService {
	private IStorageinfoDao dao;
	private IAllInfoDao allInfoDao;
	public IStorageinfoDao getDao() {
		return dao;
	}

	public IAllInfoDao getAllInfoDao() {
		return allInfoDao;
	}

	public void setAllInfoDao(IAllInfoDao allInfoDao) {
		this.allInfoDao = allInfoDao;
	}

	public void setDao(IStorageinfoDao dao) {
		this.dao = dao;
	}

	public void addStorageinfo(StorageInfo Storageinfo) throws StorageinfoServiceException {
				try {
					dao.add(Storageinfo);
				} catch (StorageinfoDaoException e) {
					throw new StorageinfoServiceException();
				}

	}

	public void delete(int[] id) throws StorageinfoServiceException {
		for(int i:id){
			try {
				dao.delete(i);
			} catch (StorageinfoDaoException e) {
				
				throw new StorageinfoServiceException();
			}
		}
	}

	public List findAll() throws StorageinfoServiceException {
		try {
			return dao.findAll();
		} catch (StorageinfoDaoException e) {
			throw new StorageinfoServiceException();
		}
	}

	public StorageInfo findById(int id) throws StorageinfoServiceException {
		try {
			return dao.findById(id);
		} catch (StorageinfoDaoException e) {
			throw new StorageinfoServiceException();
		}
	}

	public List findByUser(int id) throws StorageinfoServiceException {
		
		try {
			return dao.findByUserId(id);
		} catch (StorageinfoDaoException e) {
			throw new StorageinfoServiceException();
		}
	}

	public void updateState(int[] id, int[] state) throws StorageinfoServiceException {
		for(int i=0;i<id.length;i++){
			try {
				dao.updateState(i, state[i]);
			} catch (StorageinfoDaoException e) {
				throw new StorageinfoServiceException();
			}
		}
	}

	public void updateStorageinfo(StorageInfo s) throws StorageinfoServiceException {
		try {
			dao.updateStorageinfo(s);
		} catch (StorageinfoDaoException e) {
			throw new StorageinfoServiceException();
		}

	}

	public Page findByState(int state, Limit size, int totalRows)
			throws StorageinfoServiceException {
		try{
			if (totalRows < 0) {
			totalRows = dao.getTotalRowsByState(state).intValue();
		}
			size.setRowAttributes(totalRows, Page.DEFAULT_PAGE_SIZE);	
		int[] startAndEnd= new int[]{size.getRowStart(),size.getCurrentRowsDisplayed()};
		
		List l=dao.findByState(state, startAndEnd[0],startAndEnd[1]);
		Page page = new Page(size.getRowStart(),totalRows,size.getPage(),l);
		return page;
		} catch (StorageinfoDaoException e) {
			throw new StorageinfoServiceException(e.getMessage());
		}
		
	}

	public AllInfo getAllInfo() throws StorageinfoServiceException {
		StorageInfo si=null;
		try {
			si = dao.findByMaxId();
		} catch (StorageinfoDaoException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		AllInfo info=new AllInfo();
		info.setName(si.getTitle());
		info.setType("仓储提供信息");
		info.setClassType("storageinfo");
		info.setUserId(si.getUserId().longValue());
		info.setBid(si.getId().longValue());
		return info;
	}

	public void saveAllInfo(AllInfo allInfo) throws StorageinfoServiceException {
		allInfoDao.addInfo(allInfo);
		
	}

	public void deleteAllInfo(StorageInfo si)
			throws StorageinfoServiceException {
		allInfoDao.deleteObject(si);
		
	}

}

⌨️ 快捷键说明

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