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

📄 lostbizimpl.java

📁 主要实现管理客户以及客户信息和其公司的服务管理
💻 JAVA
字号:
package biz.lost.impl;

import java.util.Calendar;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;

import biz.lost.ILostBIZ;
import dao.customers.CustomersDAO;
import dao.lost.ILostDAO;
import entity.Customers;
import entity.Lost;
import entity.Measure;
import entity.Orders;

public class LostBIZImpl implements ILostBIZ {
	private ILostDAO ldao = null;
	private CustomersDAO cdao = null;

	public ILostDAO getLdao() {
		return ldao;
	}

	public void setLdao(ILostDAO ldao) {
		this.ldao = ldao;
	}
	
	/* (non-Javadoc)
	 * @see biz.lost.impl.ILostBIZ#addLost(entity.Orders)
	 */
	public void addLost(Orders order){
		Customers customers = order.getCustomers();
		customers.setCustomersStatus(2);
		cdao.update(customers);
		Lost lost = new Lost();
		lost.setCustomers(customers);
		lost.setLostLastOrderDatetime(order.getOrdersDatetime());
		ldao.save(lost);
	}
	/* (non-Javadoc)
	 * @see biz.lost.impl.ILostBIZ#searchByCondition(entity.Lost)
	 */
	public List searchByCondition(Lost lost){
		DetachedCriteria criteria = DetachedCriteria.forClass(Lost.class);
		if(null!=lost&&null!=lost.getCuscondition()&&""!=lost.getCuscondition()){
			criteria.createAlias("customers", "cus").add(Restrictions.like("cus.customersName", lost.getCuscondition()));
		}
		if(null!=lost&&null!=lost.getMancondition()&&""!=lost.getMancondition()){
			//criteria.add(Restrictions.eq("customers", lost.getCustomers()));
			criteria.add(Restrictions.in("customers", lost.getCondition()));
		}
		if(null!=lost&&null!=lost.getStatus()&&""!=lost.getStatus()){
			criteria.add(Restrictions.eq("lostStatus", Integer.parseInt(lost.getStatus())));
		}
		return ldao.search(criteria, Integer.parseInt(lost.getPageNo()), Integer.parseInt(lost.getMaxResults()));
	}
	/* (non-Javadoc)
	 * @see biz.lost.impl.ILostBIZ#getCount(entity.Lost)
	 */
	public int getCount(Lost lost){
		DetachedCriteria criteria = DetachedCriteria.forClass(Lost.class);
		if(null!=lost&&null!=lost.getCuscondition()&&""!=lost.getCuscondition()){
			criteria.createAlias("customers", "cus").add(Restrictions.like("cus.customersName", lost.getCuscondition()));
		}
		if(null!=lost&&null!=lost.getMancondition()&&""!=lost.getMancondition()){
			//criteria.add(Restrictions.eq("customers", lost.getCustomers()));
			criteria.add(Restrictions.in("customers", lost.getCondition()));
		}
		if(null!=lost&&null!=lost.getStatus()&&""!=lost.getStatus()){
			criteria.add(Restrictions.eq("lostStatus", Integer.parseInt(lost.getStatus())));
		}
		return ldao.getCount(criteria);
	}
	/* (non-Javadoc)
	 * @see biz.lost.impl.ILostBIZ#lostCustomer(int, java.lang.String)
	 */
	public void lostCustomer(int lostid,String cause){
		Lost lost = ldao.getById(lostid);
		Customers cus = lost.getCustomers();
		cus.setCustomersStatus(4);
		cdao.update(cus);
		lost.setLostCause(cause);
		lost.setLostStatus(3);
		Calendar now=Calendar.getInstance();
		lost.setLostDatetime(now.getTime());
		ldao.update(lost);
	}
	/* (non-Javadoc)
	 * @see biz.lost.impl.ILostBIZ#getMeasureByLostId(java.lang.Integer)
	 */	
	public List getMeasureByLostId(Integer id){
		DetachedCriteria criteria = DetachedCriteria.forClass(Measure.class);
		criteria.createAlias("lost", "lost").add(Restrictions.eq("lost.lostId", id));
		return ldao.search(criteria);
	}
	/* (non-Javadoc)
	 * @see biz.lost.impl.ILostBIZ#addMeasure(int, java.lang.String)
	 */
	public void addMeasure(int lostId,String measure){
		Lost lost = ldao.getById(lostId);
		lost.setLostStatus(2);
		Calendar now=Calendar.getInstance();
		lost.setLostDatetime(now.getTime());
		ldao.update(lost);
		Measure mea = new Measure();
		mea.setLost(lost);
		mea.setMeasureMethod(measure);
		ldao.save(mea);
	}
	public CustomersDAO getCdao() {
		return cdao;
	}

	public void setCdao(CustomersDAO cdao) {
		this.cdao = cdao;
	}

}

⌨️ 快捷键说明

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