📄 servicebizimpl.java
字号:
package com.t53.crm4.serve.biz.impl;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import org.apache.log4j.net.SyslogAppender;
import com.t53.crm4.common.PaginationBean;
import com.t53.crm4.common.entity.BasDict;
import com.t53.crm4.common.entity.CstCustomer;
import com.t53.crm4.common.entity.CstService;
import com.t53.crm4.common.entity.SysUser;
import com.t53.crm4.customer.dao.ICustomerDao;
import com.t53.crm4.popedom.dao.IUserDAO;
import com.t53.crm4.serve.biz.IServiceBiz;
import com.t53.crm4.serve.dao.IBasDictDao;
import com.t53.crm4.serve.dao.IServiceDao;
public class ServiceBizImpl implements IServiceBiz {
private IServiceDao serviceDao;
private IUserDAO userDao;
private IBasDictDao basDao;
private ICustomerDao custDao;
/**
* 添加服务
*/
public Long addService(CstService cstService) {
return serviceDao.addService(cstService);
}
/**
* 分页查询
*/
public List<CstService> findByPage(CstService cstService,
PaginationBean pageBean, String beforDate, String afterDate) {
if ("".equals(cstService.getSvrCustName())) {
cstService.setSvrCustName(null);
}
if ("".equals(cstService.getSvrTitle())) {
cstService.setSvrTitle(null);
}
if ("".equals(cstService.getSvrType())) {
cstService.setSvrType(null);
}
if ("".equals(cstService.getSvrDueTo())) {
cstService.setSvrDueTo(null);
}
int maxCount = serviceDao.countByPagination(cstService);
System.out.println(maxCount);
if (maxCount > 0) {
pageBean.countPageCount(maxCount);
if (!"".equals(beforDate) && beforDate != null
&& !"".equals(beforDate) && afterDate != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date1;
Date date2;
try {
date1 = sdf.parse((String) beforDate);
date2 = sdf.parse((String) afterDate);
return serviceDao.findByPagination(cstService, (pageBean
.getPageCount() - 1)
* pageBean.getPerCount(), pageBean.getPerCount(),
date1, date2);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
return serviceDao.findByPagination(cstService, (pageBean
.getPageCount() - 1)
* pageBean.getPerCount(), pageBean.getPerCount());
}
}
return null;
}
/**
* 获取所有服务类型
*/
public List<BasDict> findAllsvrType() {
return basDao.findServiceType();
}
/**
* 获取所有服务状态
* @return
*/
public List<CstService> findAllStatus(){
return serviceDao.findAll();
}
/**
* 获取所有客户经理
*
* @param id
* @return List<SysUser>
*/
public List<SysUser> findByRoleId(int id) {
return userDao.getUserByRoleId(id);
}
// public void updateTest(CstService cstService){
// Long id=cstService.getSvrId();
// CstService cstObj=serviceDao.get(id);
// if(cstObj.getSvrSatisfy()>=3){
// cstObj.setSvrStatus("已归档");
// }else{
// if(cstObj.getsvrd)
// }
//
// }
/**
* 更新被分配的服务条目
*/
public int update(CstService cstService) {
Object[] params = new Object[] { cstService.getSvrStatus(),
cstService.getSvrDueId(), cstService.getSvrDueTo(),
cstService.getSvrId() };
String hql = "update CstService cst set cst.svrStatus=?,cst.svrDueId=?,cst.svrDueTo=? where cst.svrId=?";
return this.serviceDao.bulkUpdate(hql, params);
}
/**
* 更新处理结果
*/
public int updateResult(CstService cstService) {
Object[] params = new Object[] { cstService.getSvrResult(),
cstService.getSvrSatisfy(), cstService.getSvrStatus(),
cstService.getSvrId() };
String hql = "update CstService cst set cst.svrResult=?,cst.svrSatisfy=?,cst.svrStatus=? where cst.svrId=?";
return serviceDao.bulkUpdate(hql, params);
}
public void deleteBySvrId(Long svrId) {
CstService cstService = serviceDao.get(svrId);
serviceDao.deleteBySvrId(cstService);
}
/**
* 根据Id查找服务条目
*/
public CstService findBySvrId(Long id) {
return serviceDao.findById(id);
}
public int modify(CstService cstService) {
Object[] params = new Object[] { cstService.getSvrStatus(),
cstService.getSvrDeal(), cstService.getSvrDealBy(),
cstService.getSvrDealDate(), cstService.getSvrDealId(),
cstService.getSvrId() };
String hql = "update CstService cst set cst.svrStatus=?, cst.svrDeal=?,cst.svrDealBy=?,cst.svrDealDate=?,cst.svrDealId=? where cst.svrId=?";
return serviceDao.bulkUpdate(hql, params);
}
/**
* 查找所有客户
*/
public List<CstCustomer> findAllCust() {
return custDao.findAll();
}
/**
* 注入
*
* @param userDao
*/
public void setUserDao(IUserDAO userDao) {
this.userDao = userDao;
}
public void setBasDao(IBasDictDao basDao) {
this.basDao = basDao;
}
public void setServiceDao(IServiceDao serviceDao) {
this.serviceDao = serviceDao;
}
public void setCustDao(ICustomerDao custDao) {
this.custDao = custDao;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -