销售管理系统技术介绍
1、技术框架
struts+appframe+dwr+jquery
2、appframe架构
与crm1的框架中struts+spring+ibatis中的区别,appframe使用的是使用soa的架构模式
bo和set可以自己看文档比较简单
3、service+dao+db的代码
EmployeeAction
package com.asiainfo.employee.action;
import com.ai.appframe2.common.SessionManager;
import com.ai.appframe2.service.ServiceFactory;
import com.asiainfo.common.BaseAction;
import com.asiainfo.core.user.UserBean;
import com.asiainfo.employee.bo.bean.AgencyBean;
import com.asiainfo.employee.bo.bean.EmployeeBean;
import com.asiainfo.employee.ivalues.bean.IAgencyValue;
import com.asiainfo.employee.service.interfaces.IEmployeeSV;
public class EmployeeAction extends BaseAction {
private EmployeeBean bean;
private AgencyBean agencyBean;
private long _EmployeeId;
public long get_EmployeeId() {
return _EmployeeId;
}
public void set_EmployeeId(long employeeId) {
_EmployeeId = employeeId;
}
public String inputEmp()throws Exception{
IEmployeeSV sv=(IEmployeeSV)ServiceFactory.getService(IEmployeeSV.class);
UserBean user = (UserBean)SessionManager.getUser();
this.set_EmployeeId(user.getEmployeeId());
bean=sv.getBean(this.get_EmployeeId());
IEmployeeSV svv=(IEmployeeSV)ServiceFactory.getService(IEmployeeSV.class);
IAgencyValue[] values= svv.getAgency(user.getDeptId());
if(values.length>0){
agencyBean=(AgencyBean)values[0];
}
return "inputEmp";
}
public EmployeeBean getBean() {
return bean;
}
public void setBean(EmployeeBean bean) {
this.bean = bean;
}
public AgencyBean getAgencyBean() {
return agencyBean;
}
public void setAgencyBean(AgencyBean agencyBean) {
this.agencyBean = agencyBean;
}
}
IEmployeeDAO
package com.asiainfo.employee.dao.interfaces;
import com.asiainfo.employee.bo.bean.EmployeeBean;
import com.asiainfo.employee.ivalues.bean.IAgencyValue;
import com.asiainfo.employee.ivalues.bean.IEmployeeValue;
public interface IEmployeeDAO {
/**
* 保存
* @param value
* @throws Exception
*/
public void save(IEmployeeValue[] value) throws Exception;
/**
* 查询记录
* @param condition
* @throws Exception
*/
public IEmployeeValue [] getData(String condition,int startIndex ,int endIndex)throws Exception;
/**
* 获取记录条数
* @param condition
* @return
* @throws Exception
*/
public int getCount(String condition)throws Exception;
/**
* 根据id查询对象
* @param _EmployeeId
* @return
* @throws Exception
*/
public EmployeeBean getBean(long _EmployeeId)throws Exception;
public IAgencyValue[] getAgency(String parm1)throws Exception;
/**
* 用户登录
* @param logname
* @param logpwd
* @return
* @throws Exception
*/
public EmployeeBean[] login(String logname,String logpwd)throws Exception;
}
EmployeeDAOImpl
package com.asiainfo.employee.dao.impl;
import java.util.HashMap;
import java.util.Map;
import com.asiainfo.employee.bo.bean.AgencyEngine;
import com.asiainfo.employee.bo.bean.EmployeeBean;
import com.asiainfo.employee.bo.bean.EmployeeEngine;
import com.asiainfo.employee.dao.interfaces.IEmployeeDAO;
import com.asiainfo.employee.ivalues.bean.IAgencyValue;
import com.asiainfo.employee.ivalues.bean.IEmployeeValue;
public class EmployeeDAOImpl implements IEmployeeDAO{
public int getCount(String condition) throws Exception {
// TODO Auto-generated method stub
return EmployeeEngine.getBeansCount(condition, null);
}
public IEmployeeValue[] getData(String condition, int startIndex, int endIndex) throws Exception {
// TODO Auto-generated method stub
return EmployeeEngine.getBeans(null, condition, null, startIndex, endIndex, false, null);
}
public void save(IEmployeeValue[] values) throws Exception {
for(int i=0;i<values.length;i++){
//如果是新增,则分配一个新的ID
if(values[i].isNew()){
values[i].setEmployeeId(EmployeeEngine.getNewId().longValue());
}
}
EmployeeEngine.save(values);
}
public EmployeeBean getBean(long employeeId) throws Exception {
// TODO Auto-generated method stub
return EmployeeEngine.getBean(employeeId);
}
public IAgencyValue[] getAgency(String parm1) throws Exception {
Map parameter = new HashMap();
parameter.put("param1", parm1);
String soureBO = "com.asiainfo.employee.bo.bean.Agency";
IAgencyValue[] agencyBeans= AgencyEngine.getBeansFromQueryBO(soureBO, parameter);
return agencyBeans;
}
public EmployeeBean[] login(String logname, String logpwd) throws Exception {
HashMap parameter = new HashMap();
parameter.put("parm1", logname);
parameter.put("parm12",logpwd);
String sql="select t.* from tab_employee t,tab_employee_pwd tp where t.employee_id=tp.employee_id and t.user_login_name=:parm1 and tp.login_pwd=:parm12";
EmployeeBean[] employeeBeans= null;
employeeBeans=EmployeeEngine.getBeansFromSql(sql, parameter);
return employeeBeans;
}
}
IEmployeeSV
package com.asiainfo.employee.service.interfaces;
import com.asiainfo.common.QueryResult;
import com.asiainfo.employee.bo.bean.EmployeeBean;
import com.asiainfo.employee.ivalues.bean.IAgencyValue;
import com.asiainfo.employee.ivalues.bean.IEmployeeValue;
public interface IEmployeeSV {
/**
* 保存
* @param value
* @throws Exception
*/
public void save(IEmployeeValue[] value) throws Exception;
/**
* 查询记录
* @param condition
* @throws Exception
*/
public IEmployeeValue [] getData(String condition,int startIndex ,int endIndex)throws Exception;
/**
* 获取记录条数
* @param condition
* @return
* @throws Exception
*/
public int getCount(String condition)throws Exception;
/**
* 获得分页数据
* @param condition 查询的条件
* @param firstindex 第一条记录
* @param maxresult 每页显示几条记录
* @return
* @throws Exception
*/
public QueryResult<IEmployeeValue> getScrollData(String condition, int firstindex, int maxresult)throws Exception;
/**
* 根据id查询对象
* @param _EmployeeId
* @return
* @throws Exception
*/
public EmployeeBean getBean(long _EmployeeId)throws Exception;
/**
* 查末梢所对应的网格经理信息
* @param parm1
* @return
* @throws Exception
*/
public IAgencyValue[] getAgency(String parm1)throws Exception;
/**
* 用户登录
* @param logname
* @param logpwd
* @return
* @throws Exception
*/
public EmployeeBean[] login(String logname,String logpwd)throws Exception;
}
EmployeeSVImpl
package com.asiainfo.employee.service.impl;
import com.ai.appframe2.service.ServiceFactory;
import com.asiainfo.common.QueryResult;
import com.asiainfo.common.StringtoArray;
import com.asiainfo.employee.bo.bean.EmployeeBean;
import com.asiainfo.employee.dao.interfaces.IEmployeeDAO;
import com.asiainfo.employee.ivalues.bean.IAgencyValue;
import com.asiainfo.employee.ivalues.bean.IEmployeeValue;
import com.asiainfo.employee.service.interfaces.IEmployeeSV;
public class EmployeeSVImpl implements IEmployeeSV{
public int getCount(String condition) throws Exception{
IEmployeeDAO dao = (IEmployeeDAO)ServiceFactory.getService(IEmployeeDAO.class);
return dao.getCount(condition);
}
public IEmployeeValue[] getData(String condition, int startIndex, int endIndex) throws Exception {
IEmployeeDAO dao = (IEmployeeDAO)ServiceFactory.getService(IEmployeeDAO.class);
return dao.getData(condition, startIndex, endIndex);
}
public QueryResult<IEmployeeValue> getScrollData(String condition, int firstindex, int maxresult)throws Exception {
IEmployeeDAO dao = (IEmployeeDAO)ServiceFactory.getService(IEmployeeDAO.class);
QueryResult<IEmployeeValue> qr = new QueryResult<IEmployeeValue>();
qr.setTotalrecord(dao.getCount(condition));//总页数
qr.setResultlist(new StringtoArray<IEmployeeValue>().StringtoArray(dao.getData(condition, firstindex, maxresult)));//获得结果集
return qr;
}
public void save(IEmployeeValue[] value) throws Exception {
IEmployeeDAO dao = (IEmployeeDAO)ServiceFactory.getService(IEmployeeDAO.class);
dao.save(value);
}
public EmployeeBean getBean(long employeeId) throws Exception {
IEmployeeDAO dao = (IEmployeeDAO)ServiceFactory.getService(IEmployeeDAO.class);
return dao.getBean(employeeId);
}
public IAgencyValue[] getAgency(String parm1) throws Exception {
IEmployeeDAO dao = (IEmployeeDAO)ServiceFactory.getService(IEmployeeDAO.class);
return dao.getAgency(parm1);
}
public EmployeeBean[] login(String logname, String logpwd) throws Exception {
IEmployeeDAO dao = (IEmployeeDAO)ServiceFactory.getService(IEmployeeDAO.class);
return dao.login(logname, logpwd);
}
}