📄 lostbiz.java
字号:
package org.jb.y272.team0.biz;
import java.io.Serializable;
import org.jb.common.biz.BaseBiz;
import org.jb.common.util.PageResult;
import org.jb.y272.team0.entity.CstCustomer;
import org.jb.y272.team0.entity.CstLost;
/**
* 客户流失 管理业务逻辑类
* @author hailong.liu
*/
public class LostBiz extends BaseBiz {
/* 复杂业务方法 */
/**
* 检查是否有已经超过6个月没有下订单的客户,插入流失警告记录
*/
public void checkLost(){
System.out.println("Check lost ... ");
this.getCommonDAO().execProc("Check_Lost");
}
public void confirm(CstLost lst) {
CstLost item = this.get(lst.getLstId());
item.setLstReason(lst.getLstReason());
item.setLstLostDate(new java.sql.Date(new java.util.Date().getTime()));
item.setLstStatus("3");//确认流失
//Hibernate.initialize(item.getCstCustomer());
CstCustomer cust = item.getCstCustomer();
cust.setCustStatus("2");//流失
this.getCommonDAO().update(cust);
this.update(item);
}
public void relay(CstLost lst) {
CstLost item = this.get(lst.getLstId());
item.setLstDelay(item.getLstDelay()+"<br />" +lst.getLstDelay());
item.setLstStatus("2");//暂缓流失
this.update(item);
}
/* 简单业务方法 */
/**
* 加载 客户流失
*/
public CstLost get(Serializable id){
CstLost ret = (CstLost)this.getCommonDAO().get(CstLost.class, id);
return ret;
}
/**
* 添加 客户流失
*/
public boolean add(CstLost item){
this.getCommonDAO().add(item);
return true;
}
/**
* 删除 客户流失
*/
public boolean del(Serializable id){
this.getCommonDAO().del(CstLost.class, id);
return true;
}
/**
* 修改 客户流失
*/
public boolean update(CstLost item){
this.getCommonDAO().update(item);
return true;
}
/**
* 查询 客户流失
*/
public void search(CstLost condition, PageResult pageResult) {
String hql = "select o from CstLost o where 1=1 ";
if (null!=condition){
if (isNotNullOrEmpty(condition.getLstCustName())){
hql += "and o.lstCustName like '%"
+condition.getLstCustName()+"%' ";
}
if (isNotNullOrEmpty(condition.getLstCustManagerName())){
hql += "and o.lstCustManagerName like '%"
+condition.getLstCustManagerName()+"%' ";
}
if (isNotNullOrEmpty(condition.getLstDelay())){
hql += "and o.lstDelay like '%"
+condition.getLstDelay()+"%' ";
}
if (isNotNullOrEmpty(condition.getLstReason())){
hql += "and o.lstReason like '%"
+condition.getLstReason()+"%' ";
}
}
if (isNotNullOrEmpty(pageResult.getOrderBy())){
String sort = pageResult.getSort();
hql += "order by " + pageResult.getOrderBy() + " " +sort;
if ("asc".equals(sort)){
pageResult.setSort("desc");
}else{
pageResult.setSort("asc");
}
}else{
hql += "order by o.lstId desc";
}
this.getCommonDAO().listByPage(hql,pageResult);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -