首页>代码>SSH框架实现玖和财富宣传管理系统>/玖和财富/jhcf/src/com/jhcf/category/action/CategoryAction.java
package com.jhcf.category.action;

import java.util.ArrayList;

import javax.annotation.Resource;
import javax.smartcardio.ATR;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.jhcf.category.bean.Category;
import com.jhcf.category.services.ICategoryServices;
import com.jhcf.common.SubStringHtml;
import com.jhcf.contents.bean.Contents;
import com.jhcf.contents.services.IContentsServices;
import com.jhcf.news.bean.News;
import com.jhcf.news.services.INewsServices;
import com.jhcf.products.bean.Products;
import com.jhcf.products.services.IProductsServices;
import com.jhcf.ygfc.bean.Ygcf;
import com.jhcf.ygfc.services.IYgfcServices;

@Controller @Scope("prototype")
public class CategoryAction {
	
	@Resource(name="categoryServices")
	private ICategoryServices categoryServices;
	
	@Resource(name="contentsServices")
	private IContentsServices contentsServices;
	
	@Resource(name="newsServices")
	private INewsServices newsServices;
	
	@Resource(name="productsServices")
	private IProductsServices productsServices;
	
	@Resource(name="ygfcServices")
	private IYgfcServices ygfcServices; 
	
	private ArrayList<Products> listProducts;
	
	private ArrayList<News> listNews_xwzx;
	
	private ArrayList<News> listNews_jtxw;
	
	private ArrayList<News> listNews_xwzx_03;
	
	private ArrayList<News> listNews_xwzx_04;
	
	private Contents contents;
	
	private int currentPage=1;
	
	private int pageSize=4;
	
	private int count;
	
	private int sumPage;
	
	private int count_mtbd;
	
	private int sumPage_mtbd;
	
	private int count_ygfc;
	
	private int sumPage_ygfc;
	
	private int pageSize_ygfc=6;
	
	//公司简介
	private Contents contents_gsjj;
	
	//企业文化
	private Contents contents_qywh;
	
	//组织架构
	private Contents contents_zzjg;
	
	//员工风采
	private Contents contents_ygfc;
	
	//活动预约
	private Contents contents_hdyy;
	
	//业务介绍
	private Contents contents_ywjs;
	
	//玖和宝
	private Contents contents_jhb;
	
	//月月赢
	private Contents contents_yyy;
	
	//固定期限
	private Contents contents_gdqx;
	
	//理财方式及服务模式
	private Contents contents_lcfw;
	
	//新闻资讯
	private Contents contents_xwzx;
	
	private Contents contents_jtxw;

	
	//P2P理财模式
	private Contents contents_p2p;
	
	private Contents contents_lxwm;
	
	private Category category;
	
	private ArrayList<Category> listCategoey;
	
	private ArrayList<Contents> listContents;
	
	private ArrayList<Ygcf> listYgfc;
	
	private News news;
	
	private Ygcf ygfc;
	
	public String defaultNews(){
		//查询所有分类,还有下面的子类
		listCategoey= categoryServices.findAllCategory();
		news =newsServices.getNewsById(news.getId());
		if(news!=null){
			return "defaultNews";
		}else{
			return "defaultNews_error";
		}
	}
	

	public String getYgfcByIdTo_ygfc(){
		//查询所有分类,还有下面的子类
		listCategoey= categoryServices.findAllCategory();
		ygfc= ygfcServices.getYgfcById(ygfc.getId());
		if(ygfc!=null){
			return "getYgfcByIdTo_ygfc";
		}else{
			return "getYgfcByIdTo_ygfc_error";
		}
	}
	
	public String tiao_index(){
		//查询所有分类,还有下面的子类
		listCategoey= categoryServices.findAllCategory();
		//首页查询公司简介
		contents= contentsServices.getContentsByTitle("公司简介");
		contents.setCont(SubStringHtml.guoHtml(contents.getCont()));
		//新闻资讯
		listNews_xwzx= newsServices.getNewsByGroupname(0, 6, 1);
		//集团新闻
		listNews_jtxw=newsServices.getNewsByGroupname(0, 6, 2);
		return "tiao_index";
	}
	
	
	
	public String erjiyemian(){
		int id=category.getId();
		//查询所有分类,还有下面的子类
		listCategoey= categoryServices.findAllCategory();
		if(id==1){
			listContents=contentsServices.getContentsByCid(id);
			return "shouye";
		}else if(id==2){
			listContents=contentsServices.getContentsByCid(id);
			if(contents==null){
				contents_gsjj=contentsServices.getContentsByTitle("公司简介");
				return "gsjj";
			}else{
				contents_qywh= contentsServices.getContentsById(contents.getId());
				contents_zzjg= contentsServices.getContentsById(contents.getId());			
				contents_gsjj=contentsServices.getContentsById(contents.getId());
				contents_ygfc=contentsServices.getContentsById(contents.getId());
				if("公司简介".equals(contents_gsjj.getTitle())){
					return "gsjj";
				}else if("企业文化".equals(contents_qywh.getTitle())){
					return "qywh";
				}else if("组织架构".equals(contents_zzjg.getTitle())){
					return "zzjg";
				}else if("员工风采".equals(contents_ygfc.getTitle())){
					count_ygfc=ygfcServices.count();
					sumPage_ygfc=ygfcServices.sumPage(pageSize_ygfc);
					listYgfc=ygfcServices.getAllYgfc(currentPage, pageSize_ygfc);					
					return "ygfc";
				}else{
					return "gsgk_error";
				}			
				
			}
		}else if(id==3){
			listContents=contentsServices.getContentsByCid(id);
			if(contents==null){
				count=newsServices.countGroupname_all(2);
				sumPage=newsServices.sumPageGroup(2, pageSize);
				listNews_xwzx_03=newsServices.getNewsByGroupname(0, 3, 2);
				for (News n : listNews_xwzx_03) {
					System.out.println(n.getCont());
					n.setCont(SubStringHtml.guoHtml(n.getCont()));
					System.out.println(n.getCont());
				}	
				listNews_jtxw=newsServices.getNewsByGroupname_all(currentPage, pageSize, 2);
				for (News n : listNews_jtxw) {
					System.out.println(n.getCont());
					n.setCont(SubStringHtml.guoHtml(n.getCont()));
					System.out.println(n.getCont());
				}	
				return "jtxw";
			}else{
				contents_xwzx=contentsServices.getContentsById(contents.getId());
				contents_jtxw=contentsServices.getContentsById(contents.getId());
				contents_hdyy=contentsServices.getContentsById(contents.getId());
				contents_ywjs=contentsServices.getContentsById(contents.getId());
				if("新闻资讯".equals(contents_xwzx.getTitle())){
					count_mtbd=newsServices.countGroupname_all(1);
					sumPage_mtbd=newsServices.sumPageGroup(1, pageSize);
					listNews_xwzx_04= newsServices.getNewsByGroupname_all(currentPage, pageSize, 1);
					for (News n : listNews_xwzx_04) {
						System.out.println(n.getCont());
						n.setCont(SubStringHtml.guoHtml(n.getCont()));
						System.out.println(n.getCont());
					}
					return "xwzx";
				}else if("集团新闻".equals(contents_jtxw.getTitle())){
					count=newsServices.countGroupname_all(2);
					sumPage=newsServices.sumPageGroup(2, pageSize);
					listNews_xwzx_03=newsServices.getNewsByGroupname(0, 3, 2);
					for (News n : listNews_xwzx_03) {
						System.out.println(n.getCont());
						n.setCont(SubStringHtml.guoHtml(n.getCont()));
						System.out.println(n.getCont());
					}	
					
					listNews_jtxw=newsServices.getNewsByGroupname_all(currentPage, pageSize, 2);
					for (News n : listNews_jtxw) {
						System.out.println(n.getCont());
						n.setCont(SubStringHtml.guoHtml(n.getCont()));
						System.out.println(n.getCont());
					}
					return "jtxw";
				}else if("活动预约".equals(contents_hdyy.getTitle())){
					return "hdyy";
				}else if("业务介绍".equals(contents_ywjs.getTitle())){
					return "ywjs";					
				}
				else{					
					return "jhdt_error";
				}
			}
		}else if(id==4){
			listContents=contentsServices.getContentsByCid(id);
			if(contents==null){
				contents_jhb=contentsServices.getContentsByTitle("玖和宝");
				return "jhb";
			}else{
				contents_jhb=contentsServices.getContentsById(contents.getId());
				contents_yyy=contentsServices.getContentsById(contents.getId());
				contents_gdqx=contentsServices.getContentsById(contents.getId());
				contents_lcfw=contentsServices.getContentsById(contents.getId());
				if("玖和宝".equals(contents_jhb.getTitle())){
					return "jhb";
				}else if("月月赢".equals(contents_yyy.getTitle())){
					return "yyy";
				}else if("固定期限".equals(contents_gdqx.getTitle())){
					listProducts=productsServices.getAllProducts(1, 4);
					return "gdqx";
				}else if("理财方式及服务模式".equals(contents_lcfw.getTitle())){
					return "lcfw";
				}else{						
					return "tzal_error";
				}
			}			
		}else if(id==5){
			listContents=contentsServices.getContentsByCid(id);
			contents_p2p=contentsServices.getContentsByTitle("P2P理财模式");
			return "cfgl";
		}else if(id==6){
			listContents=contentsServices.getContentsByCid(id);
			return "jhd";
		}else{
			listContents=contentsServices.getContentsByCid(id);
			contents_lxwm=contentsServices.getContentsByTitle("");
			return "lxwm";
		}
	}
	
	/**
	 * 跳转添加页面
	 * @return
	 */
	public String tiaoAdd(){		
		return "tiaoAdd";
	}
	
	/**
	 * 添加分类
	 * @return
	 */
	public String addCategory(){
		return categoryServices.addCatrgory(category);
	}
	
	/**
	 * 查询所有分类
	 * @return
	 */
	public String findAllCategory(){
		listCategoey= categoryServices.findAllCategory();
		return listCategoey!=null?"findAllCategory":"findAll_error";
	}
	
	/**
	 * 通过id查找单个对象
	 * @return
	 */
	public String findCategoryById(){
		category= categoryServices.findCategoryById(category.getId());
		if(category!=null){
			return "findCategoryById";
		}else{
			return "findCategoryById_error";
		}
	}
	
	public String updateCategory(){
		return categoryServices.updateCategory(category);
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	public ArrayList<Category> getListCategoey() {
		return listCategoey;
	}

	public void setListCategoey(ArrayList<Category> listCategoey) {
		this.listCategoey = listCategoey;
	}

	public Contents getContents() {
		return contents;
	}

	public void setContents(Contents contents) {
		this.contents = contents;
	}

	public ArrayList<News> getListNews_xwzx() {
		return listNews_xwzx;
	}

	public void setListNews_xwzx(ArrayList<News> listNewsXwzx) {
		listNews_xwzx = listNewsXwzx;
	}

	public ArrayList<News> getListNews_jtxw() {
		return listNews_jtxw;
	}

	public void setListNews_jtxw(ArrayList<News> listNewsJtxw) {
		listNews_jtxw = listNewsJtxw;
	}

	public ArrayList<Contents> getListContents() {
		return listContents;
	}

	public void setListContents(ArrayList<Contents> listContents) {
		this.listContents = listContents;
	}

	public Contents getContents_gsjj() {
		return contents_gsjj;
	}

	public void setContents_gsjj(Contents contentsGsjj) {
		contents_gsjj = contentsGsjj;
	}

	public Contents getContents_qywh() {
		return contents_qywh;
	}

	public void setContents_qywh(Contents contentsQywh) {
		contents_qywh = contentsQywh;
	}

	public Contents getContents_zzjg() {
		return contents_zzjg;
	}

	public void setContents_zzjg(Contents contentsZzjg) {
		contents_zzjg = contentsZzjg;
	}

	public Contents getContents_ygfc() {
		return contents_ygfc;
	}

	public void setContents_ygfc(Contents contentsYgfc) {
		contents_ygfc = contentsYgfc;
	}

	public ArrayList<News> getListNews_xwzx_03() {
		return listNews_xwzx_03;
	}

	public void setListNews_xwzx_03(ArrayList<News> listNewsXwzx_03) {
		listNews_xwzx_03 = listNewsXwzx_03;
	}

	public ArrayList<News> getListNews_xwzx_04() {
		return listNews_xwzx_04;
	}

	public void setListNews_xwzx_04(ArrayList<News> listNewsXwzx_04) {
		listNews_xwzx_04 = listNewsXwzx_04;
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public int getSumPage() {
		return sumPage;
	}

	public void setSumPage(int sumPage) {
		this.sumPage = sumPage;
	}

	public Contents getContents_hdyy() {
		return contents_hdyy;
	}

	public void setContents_hdyy(Contents contentsHdyy) {
		contents_hdyy = contentsHdyy;
	}

	public Contents getContents_ywjs() {
		return contents_ywjs;
	}

	public void setContents_ywjs(Contents contentsYwjs) {
		contents_ywjs = contentsYwjs;
	}

	public int getCount_mtbd() {
		return count_mtbd;
	}

	public void setCount_mtbd(int countMtbd) {
		count_mtbd = countMtbd;
	}

	public int getSumPage_mtbd() {
		return sumPage_mtbd;
	}

	public void setSumPage_mtbd(int sumPageMtbd) {
		sumPage_mtbd = sumPageMtbd;
	}

	public Contents getContents_jhb() {
		return contents_jhb;
	}

	public void setContents_jhb(Contents contentsJhb) {
		contents_jhb = contentsJhb;
	}

	public Contents getContents_yyy() {
		return contents_yyy;
	}

	public void setContents_yyy(Contents contentsYyy) {
		contents_yyy = contentsYyy;
	}

	public Contents getContents_gdqx() {
		return contents_gdqx;
	}

	public void setContents_gdqx(Contents contentsGdqx) {
		contents_gdqx = contentsGdqx;
	}

	public Contents getContents_lcfw() {
		return contents_lcfw;
	}

	public void setContents_lcfw(Contents contentsLcfw) {
		contents_lcfw = contentsLcfw;
	}

	public ArrayList<Products> getListProducts() {
		return listProducts;
	}

	public void setListProducts(ArrayList<Products> listProducts) {
		this.listProducts = listProducts;
	}

	public Contents getContents_p2p() {
		return contents_p2p;
	}

	public void setContents_p2p(Contents contentsP2p) {
		contents_p2p = contentsP2p;
	}

	public Contents getContents_lxwm() {
		return contents_lxwm;
	}

	public void setContents_lxwm(Contents contentsLxwm) {
		contents_lxwm = contentsLxwm;
	}

	public News getNews() {
		return news;
	}

	public void setNews(News news) {
		this.news = news;
	}

	public ArrayList<Ygcf> getListYgfc() {
		return listYgfc;
	}

	public void setListYgfc(ArrayList<Ygcf> listYgfc) {
		this.listYgfc = listYgfc;
	}

	public int getCount_ygfc() {
		return count_ygfc;
	}

	public void setCount_ygfc(int countYgfc) {
		count_ygfc = countYgfc;
	}

	public int getSumPage_ygfc() {
		return sumPage_ygfc;
	}

	public void setSumPage_ygfc(int sumPageYgfc) {
		sumPage_ygfc = sumPageYgfc;
	}

	public int getPageSize_ygfc() {
		return pageSize_ygfc;
	}

	public void setPageSize_ygfc(int pageSizeYgfc) {
		pageSize_ygfc = pageSizeYgfc;
	}

	public Contents getContents_xwzx() {
		return contents_xwzx;
	}

	public void setContents_xwzx(Contents contentsXwzx) {
		contents_xwzx = contentsXwzx;
	}

	public Contents getContents_jtxw() {
		return contents_jtxw;
	}

	public void setContents_jtxw(Contents contentsJtxw) {
		contents_jtxw = contentsJtxw;
	}


	public Ygcf getYgfc() {
		return ygfc;
	}


	public void setYgfc(Ygcf ygfc) {
		this.ygfc = ygfc;
	}

	

}
最近下载更多
178174qasw  LV10 2021年8月19日
1528280504  LV3 2021年3月4日
qingyan163  LV4 2020年8月7日
1729990558  LV3 2020年5月13日
ommmly  LV5 2020年4月18日
沉醉不知归wd  LV6 2020年3月31日
biminghua  LV6 2020年3月12日
不停的奔跑  LV20 2020年2月8日
Lcovde  LV19 2019年12月12日
p13994295637  LV7 2019年12月12日
最近浏览更多
weilaizhisheng  LV21 2023年12月26日
爱吃零食  LV1 2023年11月2日
小屁孩  LV7 2023年6月2日
泓鼎168  LV19 2023年4月11日
彩色天空  LV5 2023年4月8日
Aiu44628  LV1 2022年12月19日
2386443441  LV1 2022年9月27日
Aniana  LV1 2022年4月30日
PrinceChu  LV2 2022年4月2日
zhaoyangwfd  LV17 2022年3月29日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友