package com.ruituo.controller; import java.util.Date; import java.util.List; import com.ruituo.common.WebController; import com.ruituo.model.Aadvice; import com.ruituo.model.Column; import com.ruituo.model.Message; import com.ruituo.model.News; import com.ruituo.model.Product; import com.ruituo.model.Resume; import com.ruituo.model.Theme; import com.ruituo.model.Video; import com.ruituo.util.PageBean; import com.ruituo.util.PageBeanUtil; public class IndexController extends WebController{ /** * 首页 */ public void index(){ getWebData(); //产品服务模块内容 Column productCol = Column.dao.findById(76); setAttr("productCol", productCol); List<Column> productColumnList = Column.dao.getColumnByUppidTop10(76); setAttr("productColumnList", productColumnList); List<Product> productList = Product.dao.getProductListByColumnUppid(76); setAttr("productList", productList); //小广告 Theme adLogo = Theme.dao.getThemeByColumnId(107); setAttr("adLogo", adLogo); //关于泉鑫模块内容 Column aboutCol = Column.dao.findById(80); setAttr("aboutCol", aboutCol); News aboutUs = News.dao.getNewsByColumnId(80); setAttr("aboutUs", aboutUs); List<News> renwenlist = News.dao.getNewsListByColumnId(80); setAttr("renwenlist", renwenlist); String imglist = "["; if(renwenlist != null && renwenlist.size() > 0){ for(int i = 0;i < renwenlist.size();i++){ if(i < renwenlist.size()-1){ imglist += "'" + renwenlist.get(i).getStr("news_img") + "'" + ","; }else{ imglist += "'" + renwenlist.get(i).getStr("news_img") + "'"; } } } imglist += "]"; setAttr("imglist", imglist); //资质荣誉 // Column zizhiCol = Column.dao.findById(85); // setAttr("zizhiCol", zizhiCol); // List<News> zizhilist = News.dao.getNewsListByColumnId(85); // setAttr("zizhilist", zizhilist); //新闻中心 //Column newsCol = Column.dao.findById(88); Column newsCol = Column.dao.findById(88); setAttr("newsCol", newsCol); //List<News> newslist = News.dao.getNewsListByColumnUppid(75); List<News> newslist = News.dao.getNewsListByColumnId(88); setAttr("newslist", newslist); Column newsCol1 = Column.dao.findById(89); setAttr("newsCol1", newsCol1); List<News> newslist1 = News.dao.getNewsListByColumnId(89); setAttr("newslist1", newslist1); Column newsCol2 = Column.dao.findById(90); setAttr("newsCol2", newsCol2); List<News> newslist2 = News.dao.getNewsListByColumnId(90); setAttr("newslist2", newslist2); render("/web/index.html"); } /** * 首页新闻列表 */ public void newsListIndex(){ getWebData(); Integer columnid = getParaToInt("columnId"); if(getParaToInt("columnId") != null){ columnid = getParaToInt("columnId"); } if (columnid == null){ columnid = 84; } Column oneCol = Column.dao.getColumnById(columnid); setAttr("oneCol", oneCol); Column twoCol = Column.dao.getColumnById(oneCol.getInt("uppid")); setAttr("twoCol", twoCol); List<Column> twoColumnList = Column.dao.getColumnByUppid(oneCol.getInt("uppid")); setAttr("twoColumnList", twoColumnList); int nowPage = 1; //当前页数 if(getPara("pageNum")!=null){ nowPage=Integer.parseInt(getPara("pageNum")); } int pageSize = 9 ; int allCount = News.dao.countNewsList(columnid); String pageName = "/newsListIndex"; String parameters = "&columnId="+columnid; if(getPara("parameters")!= null){ parameters = getPara("parameters"); } List<News> newsList = News.dao.getNewsListByColumnId(columnid,PageBeanUtil.getStartRecord(nowPage,pageSize),pageSize); PageBean pageBean=PageBeanUtil.wrapperToPageBean(nowPage,pageSize,allCount); setAttr("parameters", parameters); setAttr("pageName", pageName); setAttr("pageBean", pageBean); setAttr("newsList", newsList); render("/web/news.html"); } /** * 首页导航新闻详情 */ public void newsDateilIndex(){ getWebData(); Integer columnid = getParaToInt("columnId"); Column oneCol = Column.dao.getColumnById(columnid); setAttr("oneCol", oneCol); Column twoCol = Column.dao.getColumnById(oneCol.getInt("uppid")); setAttr("twoCol", twoCol); List<Column> twoColumnList = Column.dao.getColumnByUppid(oneCol.getInt("uppid")); setAttr("twoColumnList", twoColumnList); News news = News.dao.getNewsByColumnId(columnid); setAttr("news", news); render("/web/newsdetails.html"); } /** * 首页荣誉列表 */ public void honorListIndex(){ getWebData(); Integer columnid = getParaToInt("columnId"); if(getParaToInt("columnId") != null){ columnid = getParaToInt("columnId"); } Column oneCol = Column.dao.getColumnById(columnid); setAttr("oneCol", oneCol); Column twoCol = Column.dao.getColumnById(oneCol.getInt("uppid")); setAttr("twoCol", twoCol); List<Column> twoColumnList = Column.dao.getColumnByUppid(oneCol.getInt("uppid")); setAttr("twoColumnList", twoColumnList); int nowPage = 1; //当前页数 if(getPara("pageNum")!=null){ nowPage=Integer.parseInt(getPara("pageNum")); } int pageSize = 9; int allCount = News.dao.countNewsList(columnid); String pageName = "/honorListIndex"; String parameters = "&columnId="+columnid; if(getPara("parameters")!= null){ parameters = getPara("parameters"); } List<News> newsList = News.dao.getNewsListByColumnId(columnid,PageBeanUtil.getStartRecord(nowPage,pageSize),pageSize); PageBean pageBean=PageBeanUtil.wrapperToPageBean(nowPage,pageSize,allCount); setAttr("parameters", parameters); setAttr("pageName", pageName); setAttr("pageBean", pageBean); setAttr("newsList", newsList); render("/web/newslist.html"); } /** * 人文 */ public void newsList(){ getWebData(); Integer columnid = getParaToInt("columnId"); if(getParaToInt("columnId") != null){ columnid = getParaToInt("columnId"); } Column oneCol = Column.dao.getColumnById(columnid); setAttr("oneCol", oneCol); Column twoCol = Column.dao.getColumnById(oneCol.getInt("uppid")); setAttr("twoCol", twoCol); List<Column> twoColumnList = Column.dao.getColumnByUppid(oneCol.getInt("uppid")); setAttr("twoColumnList", twoColumnList); int nowPage = 1; //当前页数 if(getPara("pageNum")!=null){ nowPage=Integer.parseInt(getPara("pageNum")); } int pageSize = 9; int allCount = News.dao.countNewsList(columnid); String pageName = "/newsList"; String parameters = "&columnId="+columnid; if(getPara("parameters")!= null){ parameters = getPara("parameters"); } List<News> newsList = News.dao.getNewsListByColumnId(columnid,PageBeanUtil.getStartRecord(nowPage,pageSize),pageSize); PageBean pageBean=PageBeanUtil.wrapperToPageBean(nowPage,pageSize,allCount); setAttr("parameters", parameters); setAttr("pageName", pageName); setAttr("pageBean", pageBean); setAttr("newsList", newsList); render("/web/renwen.html"); } /** * 首页产品列表 */ public void productListIndex(){ getWebData(); Integer columnid = getParaToInt("columnId"); if(getParaToInt("columnId") != null){ columnid = getParaToInt("columnId"); } Column oneCol = Column.dao.getColumnById(columnid); setAttr("oneCol", oneCol); Column twoCol = Column.dao.getColumnById(oneCol.getInt("uppid")); setAttr("twoCol", twoCol); List<Column> twoColumnList = Column.dao.getColumnByUppid(oneCol.getInt("uppid")); setAttr("twoColumnList", twoColumnList); int nowPage = 1; //当前页数 if(getPara("pageNum")!=null){ nowPage=Integer.parseInt(getPara("pageNum")); } int pageSize = 9; int allCount = Product.dao.countProductListByColumnId(columnid); String pageName = "/productListIndex"; String parameters = "&columnId="+columnid; if(getPara("parameters")!= null){ parameters = getPara("parameters"); } List<Product> productList = Product.dao.getProductListByColumnId(columnid,PageBeanUtil.getStartRecord(nowPage,pageSize),pageSize); PageBean pageBean=PageBeanUtil.wrapperToPageBean(nowPage,pageSize,allCount); setAttr("parameters", parameters); setAttr("pageName", pageName); setAttr("pageBean", pageBean); setAttr("productList", productList); render("/web/product.html"); } /** * 产品详情 */ public void productDateils(){ getWebData(); Integer id = getParaToInt("id"); Product product = Product.dao.findById(id); setAttr("product", product); Column oneCol = Column.dao.getColumnById(product.getInt("columnid")); setAttr("oneCol", oneCol); Column twoCol = Column.dao.getColumnById(oneCol.getInt("uppid")); setAttr("twoCol", twoCol); List<Column> twoColumnList = Column.dao.getColumnByUppid(oneCol.getInt("uppid")); setAttr("twoColumnList", twoColumnList); render("/web/productDetails.html"); } /** * 留言 */ public void messageIndex(){ getWebData(); Integer columnid = getParaToInt("columnId"); Column oneCol = Column.dao.getColumnById(columnid); setAttr("oneCol", oneCol); Column twoCol = Column.dao.getColumnById(oneCol.getInt("uppid")); setAttr("twoCol", twoCol); List<Column> twoColumnList = Column.dao.getColumnByUppid(oneCol.getInt("uppid")); setAttr("twoColumnList", twoColumnList); render("/web/message.html"); } /** * 投递简历 */ public void resumeIndex(){ getWebData(); Integer columnid = getParaToInt("columnId"); Column oneCol = Column.dao.getColumnById(columnid); setAttr("oneCol", oneCol); Column twoCol = Column.dao.getColumnById(oneCol.getInt("uppid")); setAttr("twoCol", twoCol); List<Column> twoColumnList = Column.dao.getColumnByUppid(oneCol.getInt("uppid")); setAttr("twoColumnList", twoColumnList); render("/web/resume.html"); } /** * 投诉建议 */ public void aadviceIndex(){ getWebData(); Integer columnid = getParaToInt("columnId"); Column oneCol = Column.dao.getColumnById(columnid); setAttr("oneCol", oneCol); Column twoCol = Column.dao.getColumnById(oneCol.getInt("uppid")); setAttr("twoCol", twoCol); List<Column> twoColumnList = Column.dao.getColumnByUppid(oneCol.getInt("uppid")); setAttr("twoColumnList", twoColumnList); render("/web/aadvice.html"); } /** * 保存简历 */ public void saveResume(){ String username = getPara("username"); String graduates = getPara("graduates"); String national = getPara("national"); String marriage = getPara("marriage"); String age = getPara("age"); String sex = getPara("sex"); String position = getPara("position"); String birthday = getPara("birthday"); String phone = getPara("phone"); String salary = getPara("salary"); String universities = getPara("universities"); String email = getPara("email"); String address = getPara("address"); String skills = getPara("skills"); String experience = getPara("experience"); String assessment = getPara("assessment"); Resume resume = new Resume(); resume.set("username", username); resume.set("graduates", graduates); resume.set("national", national); resume.set("marriage", marriage); resume.set("age", age); resume.set("sex", sex); resume.set("position", position); resume.set("birthday", birthday); resume.set("phone", phone); resume.set("salary", salary); resume.set("address", address); resume.set("email", email); resume.set("universities", universities); resume.set("experience", experience); resume.set("skills", skills); resume.set("assessment", assessment); resume.set("addtime", new Date()); if(resume.save()){ renderJson(1); }else{ renderJson(2); } } /** * 保留投诉建议 */ public void saveAadvice(){ String userName = getPara("userName"); String qq = getPara("qq"); String phone = getPara("phone"); String email = getPara("email"); String address = getPara("address"); String context = getPara("context"); Aadvice aadv = new Aadvice(); aadv.set("adv_name", userName); aadv.set("adv_phone", phone); aadv.set("adv_qq", qq); aadv.set("adv_context", context); aadv.set("adv_email", email); aadv.set("adv_ads", address); aadv.set("addtime", new Date()); if(aadv.save()){ renderJson(1); }else{ renderJson(2); } } /** * 保存留言信息 */ public void saveMessage(){ String userName = getPara("userName"); String qq = getPara("qq"); String phone = getPara("phone"); String email = getPara("email"); String address = getPara("address"); String context = getPara("context"); Message mess = new Message(); mess.set("mess_name", userName); mess.set("mess_phone", phone); mess.set("mess_qq", qq); mess.set("mess_context", context); mess.set("mess_email", email); mess.set("mess_ads", address); mess.set("addtime", new Date()); if(mess.save()){ renderJson(1); }else{ renderJson(2); } } /** * 新闻详情 */ public void newsDateil(){ getWebData(); Integer id = getParaToInt("id"); News news = News.dao.findById(id); setAttr("news", news); Column oneCol = Column.dao.getColumnById(news.getInt("columnid")); setAttr("oneCol", oneCol); Column twoCol = Column.dao.getColumnById(oneCol.getInt("uppid")); setAttr("twoCol", twoCol); List<Column> twoColumnList = Column.dao.getColumnByUppid(oneCol.getInt("uppid")); setAttr("twoColumnList", twoColumnList); render("/web/newsdetails.html"); } /** * 视频列表 */ public void videoList(){ getWebData(); Integer columnid = getParaToInt("columnId"); if(getParaToInt("columnId") != null){ columnid = getParaToInt("columnId"); } Column oneCol = Column.dao.getColumnById(columnid); setAttr("oneCol", oneCol); Column twoCol = Column.dao.getColumnById(oneCol.getInt("uppid")); setAttr("twoCol", twoCol); List<Column> twoColumnList = Column.dao.getColumnByUppid(oneCol.getInt("uppid")); setAttr("twoColumnList", twoColumnList); int nowPage = 1; //当前页数 if(getPara("pageNum")!=null){ nowPage=Integer.parseInt(getPara("pageNum")); } int pageSize = 3; int allCount = Video.dao.countVideoListIndex(); String pageName = "/videoList"; String parameters = "&columnId="+columnid; if(getPara("parameters")!= null){ parameters = getPara("parameters"); } List<Video> videoList = Video.dao.getVideoListIndex(PageBeanUtil.getStartRecord(nowPage,pageSize),pageSize); PageBean pageBean=PageBeanUtil.wrapperToPageBean(nowPage,pageSize,allCount); setAttr("parameters", parameters); setAttr("pageName", pageName); setAttr("pageBean", pageBean); setAttr("videoList", videoList); render("/web/video.html"); } /** * 产品搜索 */ public void searchPro(){ getWebData(); String searchname = getPara("searchname"); List<Product> productList = Product.dao.getProductList(searchname); setAttr("productList", productList); render("/web/black.html"); } /** * 产品查询 */ public void searchTypePro(){ getWebData(); String columnid = getPara("columnid"); List<Product> productList = Product.dao.getProductTypeList(columnid); setAttr("productList", productList); render("/web/black.html"); } // /** // * 图片 // */ // public void gotoimg(){ // getWebData(); // render("/test.html"); // } }
最近下载更多