a3fc3bf1a6db9cacab105ecdd22884975fbc8a92.svn-base 3.4 KB
package yxy.timer.webservice.interfaces.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;

import org.apache.commons.lang.StringUtils;

import yxy.timer.tool.DBUtil;
import yxy.timer.webservice.interfaces.LinkManWebservice;

@WebService(targetNamespace="http://LinkManWebservice.interfaces.webservice.timer.yxy/",serviceName="linkmanWebservice")
public class LinkManWebserviceImpl implements LinkManWebservice
{	
	@WebResult(name="result")
	@WebMethod
	public String updateLinkMan(@WebParam(name="id",targetNamespace="http://LinkManWebservice.interfaces.webservice.timer.yxy/")int id,
			@WebParam(name="full_name1",targetNamespace="http://LinkManWebservice.interfaces.webservice.timer.yxy/")String fullName1,
			@WebParam(name="email1",targetNamespace="http://LinkManWebservice.interfaces.webservice.timer.yxy/")String email1) 
	{
		Connection connection;
		
		PreparedStatement  pst;
		
		String result = "";
		
		int linkman_id = id;
		
		String full_name = fullName1;
		
		String email = email1;
		
		if(linkman_id == 0)
		{
			result = "error";
			
			return result;
		}
		
		if(null == full_name || full_name.equals(""))
		{
			result = "error";
			
			return result;
		}
		
		if(null == email || email.equals(""))
		{
			result = "error";
			
			return result;
		}
		
		try
		{
			//获取数据库的连接
			connection = DBUtil.getConnection("dataSource");
			
			String sql = "update yxy_customer_email set full_name='"+full_name+"',customer_email='"+email+"' where linkman_id="+linkman_id;
			
			pst = connection.prepareStatement(sql);
			
			pst.executeUpdate(sql);
			
			result = "success";
			
			return result;
		}
		
		catch(Exception e)
		{
			e.printStackTrace();
			
			result = "";
			
			return result;
		}
	}

	@WebResult(name="result")
	@WebMethod
	public String deleteLinkMan(@WebParam(name="id",targetNamespace="http://LinkManWebservice.interfaces.webservice.timer.yxy/")int id) 
	{
		Connection connection;
		
		PreparedStatement  pst;
		
		String result = "";
		
		int linkman_id = id;
		
		if(linkman_id == 0)
		{
			result = "error";
			
			return result;
		}
		
		try
		{
			//获取数据库的连接
			connection = DBUtil.getConnection("dataSource");
			
			String sql = "delete from yxy_customer_email where linkman_id="+linkman_id;
			
			pst = connection.prepareStatement(sql);
			
			pst.executeUpdate(sql);
			
			result = "success";
			
			return result;
		}
		
		catch(Exception e)
		{
			e.printStackTrace();
			
			result = "";
			
			return result;
		}
	}

	/**同步webmail的公海客户,多个以逗号隔开*/
	@WebResult(name="result")
	@WebMethod
	public String updateCustomerToPublic(@WebParam(name="customer_id",targetNamespace="http://LinkManWebservice.interfaces.webservice.timer.yxy/")String customer_id)
	{
		String result = "";
		
		if(StringUtils.isBlank(customer_id))
		{
			result = "error";
			
			return result;
		}
		
		try
		{
			Connection connection;
			
			PreparedStatement  pst;
			
			//获取数据库的连接
			connection = DBUtil.getConnection("dataSource");
			
			String sql = "update yxy_customer_email set customer_type=1 where customer_id in("+customer_id+")";
			
			pst = connection.prepareStatement(sql);
			
			pst.executeUpdate(sql);
			
			result = "success";
			
			return result;
		}
		
		catch(Exception e)
		{
			e.printStackTrace();
			
			result = "error";
			
			return result;
		}
	}
}