📄 shangjiaserviceimpl.java
字号:
package com.chinatech.cpmanage.service.impl;
/**
* Creation date: 12-06-2006
* author: 董明勇
*/
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.chinatech.cpmanage.common.BusinessException;
import com.chinatech.cpmanage.common.DAOException;
import com.chinatech.cpmanage.dao.ColumnDAO;
import com.chinatech.cpmanage.dao.OperDAO;
import com.chinatech.cpmanage.dao.OperLogDAO;
import com.chinatech.cpmanage.dao.TitleTreeDAO;
import com.chinatech.cpmanage.dao.ZoneDAO;
import com.chinatech.cpmanage.dto.ColumnDTO;
import com.chinatech.cpmanage.dto.SpShangjiaDTO;
import com.chinatech.cpmanage.hibernate.CpmanageOperator;
import com.chinatech.cpmanage.hibernate.CpmanageOperatorLog;
import com.chinatech.cpmanage.hibernate.CpmanageTitletree;
import com.chinatech.cpmanage.hibernate.NyxxwTitletree;
import com.chinatech.cpmanage.hibernate.NyxxwZone;
import com.chinatech.cpmanage.service.ShangjiaService;
public class ShangjiaServiceImpl implements ShangjiaService {
private OperDAO operDAO;
private ZoneDAO zoneDAO;
private ColumnDAO columnDAO;
private TitleTreeDAO titleTreeDAO;
private OperLogDAO operLogDAO;
// 根据页面条件查询SP商家数
public List getSPshangjiaByPage(String zone, String name, int startrow, int pageSize) throws BusinessException {
// TODO Auto-generated method stub
try{
List list= operDAO.getSPshangjiaByPage(zone, name, startrow, pageSize);
List shangjiaList=new ArrayList();
Iterator it=list.iterator();
while(it.hasNext()){
CpmanageOperator oper=(CpmanageOperator)it.next();
SpShangjiaDTO dto=new SpShangjiaDTO();
NyxxwZone zoneName=zoneDAO.getZoneByZone(oper.getAreaId());
dto.setAreaName(zoneName.getArea()); //地区名
dto.setId(oper.getId()); //商家ID
dto.setZone(oper.getAreaId()); //地区号
dto.setShangjiaName(oper.getOperName()); //商家名
dto.setStatus(oper.getStatus()); //状态
shangjiaList.add(dto);
}
return shangjiaList;
}catch(DAOException e){
throw new BusinessException("getSPshangjiaByPage()方法出错!"+e.getMessage());
}
}
// 根据页面条件查询SP商家数
public int getSPshangjiaCount(String zone, String name) throws BusinessException {
// TODO Auto-generated method stub
try{
return operDAO.getSPshangjiaCount(zone, name);
}catch(DAOException e){
throw new BusinessException("getSPshangjiaCount()方法出错!");
}
}
//改变商家状态
public void modifyStatus(String status, String id) throws BusinessException {
try{
operDAO.updateStatus(status, id);
}catch(DAOException e){
throw new BusinessException("changeStatus()方法出错!"+e.getMessage());
}
}
//删除指定商家
public void removeShangjiaByid(String id) throws BusinessException {
try{
operDAO.deleteOperByid(id);
}catch(DAOException e){
throw new BusinessException("deleteShangjia()方法出错!"+e.getMessage());
}
}
//得到所有一级栏目及以下的二级栏目
public List getAllonetitle() throws BusinessException {
try{
List onelist=columnDAO.getAllOneTitle();
List list=new ArrayList();
if(onelist!=null && onelist.size()>0){ //遍历一级栏目
for(int i=0;i<onelist.size();i++){
ColumnDTO dto=new ColumnDTO();
CpmanageTitletree onetitle=(CpmanageTitletree)onelist.get(i);
dto.setTitleId(onetitle.getTitleid());
dto.setTitleName(onetitle.getTitlename());
dto.setContestDes(onetitle.getContestdes());
dto.setCpcp_byfee(onetitle.getCpcpByfee());
dto.setCpcp_dbfee(onetitle.getCpcpDbfee());
dto.setCpcp_bybszm(onetitle.getCpcpBybszm());
dto.setCpcp_byqxbszm(onetitle.getCpcpByqxbszm());
dto.setCpcp_dbbszm(onetitle.getCpcpDbbszm());
dto.setServiceCode(onetitle.getServicecode());
dto.setGrade(onetitle.getGrade());
dto.setParentid(onetitle.getParentid());
dto.setIseffect(onetitle.getIseffect());
dto.setCpcpTitleid(onetitle.getCpcpTitleid());
dto.setIsLeafe(onetitle.getISLEAF()); //是否叶子节点
//该一级栏目下的二级栏目
List twoList=columnDAO.getTwoTitleByParentID(dto.getTitleId());
dto.setTwoTitileList(twoList);
list.add(dto);
}
}
return list;
}catch(DAOException e){
throw new BusinessException("getAllonetitle()方法出错!");
}
}
//得到指定一级栏目下的二级栏目
public List getTowtitleByParentId(String parentid) throws BusinessException {
try{
return columnDAO.getTwoTitleByParentID(parentid);
}catch(DAOException e){
throw new BusinessException("getTowtitleByParentId()方法出错!");
}
}
//增加商家
public void addShangjia(CpmanageOperator oper) throws BusinessException {
try{
operDAO.insertOper(oper);
}catch(DAOException e){
throw new BusinessException("addShangjia()方法出错!");
}
}
//注册商家时写老栏目表
public void addTitletree(NyxxwTitletree titletree) throws BusinessException {
try{
titleTreeDAO.insertTitleTree(titletree);
}catch(DAOException e){
throw new BusinessException("addTitletree()方法出错!");
}
}
//得到商家数
public long getMaxOperCount(String isSp) throws BusinessException {
try{
return operDAO.getMaxOperCount(isSp);
}catch(DAOException e){
throw new BusinessException("getOperCount()方法出错!");
}
}
//根据商家ID得到商家对象
public CpmanageOperator getShangjiaByID(String id) throws BusinessException {
try{
return operDAO.getOperById(id);
}catch(DAOException e){
throw new BusinessException("getShangjiaById()方法出错!");
}
}
public List getTitlesBytitleid(String titleid) throws BusinessException {
try{
return titleTreeDAO.getTitlesBytitleId(titleid);
}catch(DAOException e){
throw new BusinessException("getTitlesBytitleid()方法出错!");
}
}
public void removeTitletree(NyxxwTitletree titletree) throws BusinessException {
try{
titleTreeDAO.deleteTitle(titletree);
}catch(DAOException e){
throw new BusinessException("removeTitletree()方法出错!");
}
}
public void modifyShangjia(CpmanageOperator oper) throws BusinessException {
try{
operDAO.updateOper(oper);
}catch(DAOException e){
throw new BusinessException("modifyShangjia()方法出错!");
}
}
public NyxxwTitletree getTitletreeByTitleID(String titleid) throws BusinessException {
try{
titleTreeDAO.getTitletreeByTitleID(titleid);
}catch(DAOException e){
throw new BusinessException("getTitletreeByTitleID()方法出错!");
}
return null;
}
public void modifyTitletree(NyxxwTitletree titletree) throws BusinessException {
try{
titleTreeDAO.updateTitletree(titletree);
}catch(DAOException e){
throw new BusinessException("modifyTitletree()方法出错!");
}
}
//按地区统计商家数量
public List getShangjiaStatisticByAreaid(String areaid) throws BusinessException {
try{
List list=new ArrayList();
//得到该ID地区对象
NyxxwZone zone=zoneDAO.getZoneByZone(areaid); //该地区ID
String zoneName=zone.getArea(); //该地区名
int count=operDAO.getShangjiaTotalCountByAreaid(areaid); //该地区商家总数
SpShangjiaDTO dto=new SpShangjiaDTO();
dto.setZone(areaid);
dto.setAreaName(zoneName);
dto.setShangjiaCount(count);
list.add(dto);
List zonelist=zoneDAO.getZoneByParentID(areaid); //该ID地区的下属地区列表
if(zonelist!=null && zonelist.size()>0){
for(int i=0;i<zonelist.size();i++){
NyxxwZone zone1=(NyxxwZone)zonelist.get(i);
SpShangjiaDTO sdto=new SpShangjiaDTO();
sdto.setZone(zone1.getZone());
sdto.setAreaName(zone1.getArea());
int count1=operDAO.getShangjiaTotalCountByAreaid(zone1.getZone());
sdto.setShangjiaCount(count1);
list.add(sdto);
}
}
return list;
}catch(DAOException e){
throw new BusinessException("getShangjiaStatisticByAreaid()方法出错!");
}
}
//添加SP商家操作相关日志
public void addShangjiaOperLog(CpmanageOperatorLog operlog) throws BusinessException {
try{
operLogDAO.insertOperLog(operlog);
}catch(DAOException e){
throw new BusinessException("addShangjiaOperLog()方法出错!");
}
}
public void setColumnDAO(ColumnDAO columnDAO) {
this.columnDAO = columnDAO;
}
public void setTitleTreeDAO(TitleTreeDAO titleTreeDAO) {
this.titleTreeDAO = titleTreeDAO;
}
public void setOperDAO(OperDAO operDAO) {
this.operDAO = operDAO;
}
public void setZoneDAO(ZoneDAO zoneDAO) {
this.zoneDAO = zoneDAO;
}
public void setOperLogDAO(OperLogDAO operLogDAO) {
this.operLogDAO = operLogDAO;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -