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

📄 clienservice.java

📁 J2EE客户关系管理系统!!!!!!!!!!!!!!!!!!!!
💻 JAVA
字号:
package com.accp.service;

import java.util.List;

import com.accp.po.CstServiceDAO;
import com.accp.po.CstService;

public class ClienService {
	
	CstServiceDAO serverdao = null;
	
	public CstServiceDAO getServerdao() {
		return serverdao;
	}

	public void setServerdao(CstServiceDAO serverdao) {
		this.serverdao = serverdao;
	}
	//按 id 查询	
	public CstService doFind(Long svrid)
	{	
		CstService cs =serverdao.findById(svrid);
		return cs;
	}
	//查询出最后一条服务的编号
	public Long getNo(){
		List lst = serverdao.findAll();
		CstService service = (CstService)lst.get(lst.size()-1);
		return service.getSvrId();
	}
	
	//插入数据
	public boolean saveService(CstService service,String date)
	{
		try {
			service.setCreateDate(date);
			serverdao.save(service);	   
		    return true;
		} catch(Exception e)
		{
			System.out.println("Exception");
			e.printStackTrace();
			return false;
		}
	}
	//修改数据
	
	public boolean checkDue(CstService service){
		CstService cs = serverdao.findById(service.getSvrId());
		if(cs!=null)
	    { 	
	      if(null != cs.getSvrDueId() && !"".equals(cs.getSvrDueId())){
	    	  return true;
	      }
	    }
		return false;
	}
	public String updateDue(CstService service,String s)
	{
		try {
			CstService cs = serverdao.findById(service.getSvrId());
		    if(cs!=null)
		    { 	
		       cs.setSvrStatus("已分配");
		       cs.setSvrDueId(service.getSvrDueId());
		       cs.setSvrDueTo(service.getSvrDueTo());
		       cs.setDueDate(s);
		       serverdao.merge(cs);
		    }
		    else 
		    {
		    	serverdao.save(service);
		    }
		    return "已成功";
		} catch(Exception e)
		{
			e.printStackTrace();
			return "已失败";
		}
	}
	
	public String updateDeal(CstService service, String date)
	{
		try {
			CstService cs = serverdao.findById(service.getSvrId());
		    if(cs!=null)
		    { 
		       cs.setSvrStatus("已处理");
		       cs.setSvrDeal(service.getSvrDeal()); 
		       cs.setSvrDealId(service.getSvrDealId());
		       cs.setSvrDealBy(service.getSvrDealBy());
		       System.out.println("处理时间  "+ date);
		       cs.setDealDate(date);
		       serverdao.merge(cs);
		    }
		    else 
		    {
		    	  //说明是新增操作
		    	serverdao.save(service);
		    }
		    return "已成功";
		} catch(Exception e)
		{
			e.printStackTrace();
			return "已失败";
		}
	}
	
	
	
	public String updateFeed(CstService service)
	{
		try {
			CstService cs = serverdao.findById(service.getSvrId());
		    if(cs!=null)
		    { 	
		       if(service.getSvrSatisfy()>=3)
		       {cs.setSvrStatus("已归档");}
		       else{cs.setSvrStatus("已分配");}
		       cs.setSvrResult(service.getSvrResult());
		       cs.setSvrSatisfy(service.getSvrSatisfy());
		       serverdao.merge(cs);
		    }
		    else 
		    {
		    	serverdao.save(service);
		    }
		    return "已成功";
		} catch(Exception e)
		{
			e.printStackTrace();
			return "已失败";
		}
	}
	
	public CstService Service(Long id)
	{
		return serverdao.findById(id);
	}
	
	public String deleteFilert(Long svrId)
	{
		try{
			serverdao.delete(Service(svrId));
			return "删除成功!";
		}catch(Exception e){
			e.printStackTrace();
			return "删除失败!";
		}

		
	}
}

⌨️ 快捷键说明

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