?? shangjiaserviceimpl.java
字號(hào):
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;
// 根據(jù)頁(yè)面條件查詢(xún)SP商家數(shù)
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()); //地區(qū)名
dto.setId(oper.getId()); //商家ID
dto.setZone(oper.getAreaId()); //地區(qū)號(hào)
dto.setShangjiaName(oper.getOperName()); //商家名
dto.setStatus(oper.getStatus()); //狀態(tài)
shangjiaList.add(dto);
}
return shangjiaList;
}catch(DAOException e){
throw new BusinessException("getSPshangjiaByPage()方法出錯(cuò)!"+e.getMessage());
}
}
// 根據(jù)頁(yè)面條件查詢(xún)SP商家數(shù)
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()方法出錯(cuò)!");
}
}
//改變商家狀態(tài)
public void modifyStatus(String status, String id) throws BusinessException {
try{
operDAO.updateStatus(status, id);
}catch(DAOException e){
throw new BusinessException("changeStatus()方法出錯(cuò)!"+e.getMessage());
}
}
//刪除指定商家
public void removeShangjiaByid(String id) throws BusinessException {
try{
operDAO.deleteOperByid(id);
}catch(DAOException e){
throw new BusinessException("deleteShangjia()方法出錯(cuò)!"+e.getMessage());
}
}
//得到所有一級(jí)欄目及以下的二級(jí)欄目
public List getAllonetitle() throws BusinessException {
try{
List onelist=columnDAO.getAllOneTitle();
List list=new ArrayList();
if(onelist!=null && onelist.size()>0){ //遍歷一級(jí)欄目
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()); //是否葉子節(jié)點(diǎn)
//該一級(jí)欄目下的二級(jí)欄目
List twoList=columnDAO.getTwoTitleByParentID(dto.getTitleId());
dto.setTwoTitileList(twoList);
list.add(dto);
}
}
return list;
}catch(DAOException e){
throw new BusinessException("getAllonetitle()方法出錯(cuò)!");
}
}
//得到指定一級(jí)欄目下的二級(jí)欄目
public List getTowtitleByParentId(String parentid) throws BusinessException {
try{
return columnDAO.getTwoTitleByParentID(parentid);
}catch(DAOException e){
throw new BusinessException("getTowtitleByParentId()方法出錯(cuò)!");
}
}
//增加商家
public void addShangjia(CpmanageOperator oper) throws BusinessException {
try{
operDAO.insertOper(oper);
}catch(DAOException e){
throw new BusinessException("addShangjia()方法出錯(cuò)!");
}
}
//注冊(cè)商家時(shí)寫(xiě)老欄目表
public void addTitletree(NyxxwTitletree titletree) throws BusinessException {
try{
titleTreeDAO.insertTitleTree(titletree);
}catch(DAOException e){
throw new BusinessException("addTitletree()方法出錯(cuò)!");
}
}
//得到商家數(shù)
public long getMaxOperCount(String isSp) throws BusinessException {
try{
return operDAO.getMaxOperCount(isSp);
}catch(DAOException e){
throw new BusinessException("getOperCount()方法出錯(cuò)!");
}
}
//根據(jù)商家ID得到商家對(duì)象
public CpmanageOperator getShangjiaByID(String id) throws BusinessException {
try{
return operDAO.getOperById(id);
}catch(DAOException e){
throw new BusinessException("getShangjiaById()方法出錯(cuò)!");
}
}
public List getTitlesBytitleid(String titleid) throws BusinessException {
try{
return titleTreeDAO.getTitlesBytitleId(titleid);
}catch(DAOException e){
throw new BusinessException("getTitlesBytitleid()方法出錯(cuò)!");
}
}
public void removeTitletree(NyxxwTitletree titletree) throws BusinessException {
try{
titleTreeDAO.deleteTitle(titletree);
}catch(DAOException e){
throw new BusinessException("removeTitletree()方法出錯(cuò)!");
}
}
public void modifyShangjia(CpmanageOperator oper) throws BusinessException {
try{
operDAO.updateOper(oper);
}catch(DAOException e){
throw new BusinessException("modifyShangjia()方法出錯(cuò)!");
}
}
public NyxxwTitletree getTitletreeByTitleID(String titleid) throws BusinessException {
try{
titleTreeDAO.getTitletreeByTitleID(titleid);
}catch(DAOException e){
throw new BusinessException("getTitletreeByTitleID()方法出錯(cuò)!");
}
return null;
}
public void modifyTitletree(NyxxwTitletree titletree) throws BusinessException {
try{
titleTreeDAO.updateTitletree(titletree);
}catch(DAOException e){
throw new BusinessException("modifyTitletree()方法出錯(cuò)!");
}
}
//按地區(qū)統(tǒng)計(jì)商家數(shù)量
public List getShangjiaStatisticByAreaid(String areaid) throws BusinessException {
try{
List list=new ArrayList();
//得到該ID地區(qū)對(duì)象
NyxxwZone zone=zoneDAO.getZoneByZone(areaid); //該地區(qū)ID
String zoneName=zone.getArea(); //該地區(qū)名
int count=operDAO.getShangjiaTotalCountByAreaid(areaid); //該地區(qū)商家總數(shù)
SpShangjiaDTO dto=new SpShangjiaDTO();
dto.setZone(areaid);
dto.setAreaName(zoneName);
dto.setShangjiaCount(count);
list.add(dto);
List zonelist=zoneDAO.getZoneByParentID(areaid); //該ID地區(qū)的下屬地區(qū)列表
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()方法出錯(cuò)!");
}
}
//添加SP商家操作相關(guān)日志
public void addShangjiaOperLog(CpmanageOperatorLog operlog) throws BusinessException {
try{
operLogDAO.insertOperLog(operlog);
}catch(DAOException e){
throw new BusinessException("addShangjiaOperLog()方法出錯(cuò)!");
}
}
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;
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -