├── DeepinScrot-3030.png ├── README.md ├── pom.xml ├── src └── main │ └── resources │ └── META-INF │ └── persistence.xml ├── tomcatnewpath.png ├── yuanews-web ├── READWEB.md ├── pom.xml ├── src │ └── main │ │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ ├── api │ │ └── managerApi.jsp │ │ ├── error.jsp │ │ ├── html │ │ ├── css │ │ │ ├── DialogBySHF.css │ │ │ ├── base.css │ │ │ ├── default.css │ │ │ ├── detail.css │ │ │ ├── detailcss.css │ │ │ ├── global-base.css │ │ │ ├── iefixed.css │ │ │ ├── index.css │ │ │ ├── label.css │ │ │ ├── nalbase.css │ │ │ ├── normalize.css │ │ │ ├── nprogress.css │ │ │ └── simplePagination.css │ │ ├── detail.jsp │ │ ├── images │ │ │ ├── 5794.png │ │ │ ├── author2.png │ │ │ ├── date.png │ │ │ ├── datepng.png │ │ │ ├── ftlogo.png │ │ │ ├── icons.png │ │ │ ├── lanmbq.png │ │ │ ├── lct.png │ │ │ ├── loginreg-corner-ico.png │ │ │ ├── loginreg-title-bg.jpg │ │ │ ├── logo.png │ │ │ ├── newsbg01.png │ │ │ ├── newsbg02.png │ │ │ ├── newsbg03.png │ │ │ ├── newsbg04.png │ │ │ ├── ph2.png │ │ │ ├── return.png │ │ │ ├── silde-nav.png │ │ │ ├── slide-bg.png │ │ │ ├── vivo-head-ico.gif │ │ │ └── vivo-head-ico.png │ │ ├── index.jsp │ │ ├── js │ │ │ ├── DialogBySHF.js │ │ │ ├── global-base.css │ │ │ ├── html5.js │ │ │ ├── iefixed.css │ │ │ ├── jquery.min.js │ │ │ ├── modernizr.js │ │ │ ├── nalbase.js │ │ │ ├── nav.js │ │ │ ├── nprogress.js │ │ │ ├── prefixfree.min.js │ │ │ ├── simplePagination.js │ │ │ ├── sliders.js │ │ │ └── vivo-common.js │ │ ├── label.jsp │ │ ├── login │ │ │ ├── css │ │ │ │ ├── detail.css │ │ │ │ └── style.css │ │ │ ├── detail.jsp │ │ │ ├── images │ │ │ │ ├── adm.png │ │ │ │ ├── avtar.png │ │ │ │ ├── bg1.jpg │ │ │ │ ├── close.png │ │ │ │ ├── icon_exit.png │ │ │ │ ├── key.png │ │ │ │ └── pass.png │ │ │ ├── login.jsp │ │ │ └── register.jsp │ │ └── tuijian.jsp │ │ ├── images │ │ ├── 404_bg.png │ │ ├── db_tables.png │ │ ├── moren.jpg │ │ └── tomcat-learn.png │ │ ├── index.jsp │ │ └── manager │ │ ├── 403.jsp │ │ ├── 404.jsp │ │ ├── 500.jsp │ │ ├── CateManager.jsp │ │ ├── CommentManager.jsp │ │ ├── LikedManager.jsp │ │ ├── LoginManger.jsp │ │ ├── NewsManager.jsp │ │ ├── SourceManager.jsp │ │ ├── TasteManager.jsp │ │ ├── UserManager.jsp │ │ ├── aboutMe.jsp │ │ ├── css │ │ ├── font │ │ │ ├── adminthemes-webfont.eot │ │ │ ├── adminthemes-webfont.svg │ │ │ ├── adminthemes-webfont.ttf │ │ │ ├── adminthemes-webfont.woff │ │ │ └── adminthemes-webfont.woff2 │ │ ├── jquery.mCustomScrollbar.css │ │ ├── simplePagination.css │ │ └── style.css │ │ ├── images │ │ ├── 404_bg.png │ │ ├── admin_logo.png │ │ ├── icon │ │ │ ├── DefaultAvatar.jpg │ │ │ ├── apple-touch-icon-120x120-precomposed.png │ │ │ ├── apple-touch-icon-196x196-precomposed.png │ │ │ ├── apple-touch-icon-57x57-precomposed.png │ │ │ └── favicon.ico │ │ └── moren.jpg │ │ ├── index.html │ │ ├── index.jsp │ │ ├── js │ │ ├── Particleground.js │ │ ├── html5.js │ │ ├── jquery.js │ │ ├── jquery.mCustomScrollbar.concat.min.js │ │ ├── simplePagination.js │ │ └── verificationNumbers.js │ │ ├── managerApi.jsp │ │ └── managerPersent.jsp └── yuanews-web.iml ├── yuannews-common ├── READCOMMON.md ├── pom.xml ├── src │ └── main │ │ └── java │ │ └── yuan │ │ └── ssm │ │ └── common │ │ ├── config │ │ └── ConfigConstant.java │ │ ├── constant │ │ ├── ManagerConstant.java │ │ └── NewsStatusConstant.java │ │ ├── newsenum │ │ ├── NewsStatusEnum.java │ │ └── ServiceEnum.java │ │ ├── status │ │ ├── LoginStatus.java │ │ ├── ManagerConutStatus.java │ │ └── UpdateStatus.java │ │ └── util │ │ ├── DateUtil.java │ │ ├── FileTool.java │ │ ├── FontImageUtil.java │ │ ├── LoggerUtil.java │ │ └── StringUtil.java └── yuannews-common.iml ├── yuannews-config ├── READCONFOG.md ├── pom.xml ├── src │ └── main │ │ └── resources │ │ ├── CustomValidationMessage.properties │ │ ├── REDESQL.md │ │ ├── db.properties │ │ ├── log4j.properties │ │ ├── mybatis │ │ └── sqlmapConfig.xml │ │ └── spring │ │ ├── applicationContext-dao.xml │ │ ├── applicationContext-service.xml │ │ ├── applicationContext-transcation.xml │ │ └── springmvc.xml └── yuannews-config.iml ├── yuannews-controller ├── READCONTROLLER.md ├── pom.xml ├── src │ └── main │ │ └── java │ │ └── yuan │ │ └── ssm │ │ ├── controller │ │ ├── AndroidController.java │ │ ├── AndroidNController.java │ │ ├── CateController.java │ │ ├── CommentController.java │ │ ├── CustomerController.java │ │ ├── LikedController.java │ │ ├── MainContorller.java │ │ ├── ManagerController.java │ │ ├── NewsController.java │ │ ├── SourceController.java │ │ ├── TasteController.java │ │ └── UserController.java │ │ ├── exception │ │ ├── CustomException.java │ │ └── CustomExceptionResover.java │ │ └── filter │ │ └── LoginHandlerIntercepter.java └── yuannews-controller.iml ├── yuannews-dao ├── READDAO.md ├── pom.xml ├── src │ ├── main │ │ └── java │ │ │ └── yuan │ │ │ └── ssm │ │ │ └── dao │ │ │ ├── customer │ │ │ ├── CateNewsMapper.java │ │ │ ├── CateNewsMapper.xml │ │ │ ├── NewsMapper.java │ │ │ ├── NewsMapper.xml │ │ │ ├── SourceNewsMapper.java │ │ │ ├── SourceNewsMapper.xml │ │ │ ├── UserMapper.java │ │ │ └── UserMapper.xml │ │ │ └── manager │ │ │ ├── CateManagerMapper.java │ │ │ ├── CateManagerMapper.xml │ │ │ ├── CommentManagerMapper.java │ │ │ ├── CommentManagerMapper.xml │ │ │ ├── LikedManagerMapper.java │ │ │ ├── LikedManagerMapper.xml │ │ │ ├── ManagerCountMapper.java │ │ │ ├── ManagerCountMapper.xml │ │ │ ├── NewsManagerMapper.java │ │ │ ├── NewsManagerMapper.xml │ │ │ ├── SourceManagerMapper.java │ │ │ ├── SourceManagerMapper.xml │ │ │ ├── TasteManagerMapper.java │ │ │ ├── TasteManagerMapper.xml │ │ │ ├── UserManagerMapper.java │ │ │ └── UserManagerMapper.xml │ └── test │ │ └── java │ │ ├── common │ │ ├── ManagerBaseTest.java │ │ └── MapperContanst.java │ │ └── mapper │ │ ├── Customer │ │ ├── CustomerBaseTest.java │ │ ├── NewsMapperTest.java │ │ └── UserMapperTest.java │ │ └── manager │ │ ├── CateManagerTest.java │ │ ├── CommentManagerTest.java │ │ ├── LikedManagerTest.java │ │ ├── ManagerCountTest.java │ │ ├── NewsManagerTest.java │ │ ├── SourceManagerTest.java │ │ ├── TasteManagerTest.java │ │ └── UserManagerTest.java └── yuannews-dao.iml ├── yuannews-datacenter ├── REDEME.md ├── pom.xml ├── src │ └── main │ │ └── java │ │ └── yuan │ │ └── ssm │ │ └── datacenter │ │ ├── DataMain.java │ │ ├── DownUtil │ │ └── ImageDown.java │ │ ├── LoadUtil │ │ ├── ChinaNewsLoader.java │ │ ├── HuanQiuLoader.java │ │ └── HuxiuLoader.java │ │ ├── ParseUtil │ │ ├── ChinaNewsParser.java │ │ ├── HuanQiuParser.java │ │ ├── HuxiuParser.java │ │ └── ParseIndex.java │ │ ├── base │ │ ├── EncodeEnum.java │ │ ├── GetDataBase.java │ │ ├── LoaderBase.java │ │ ├── ParserBase.java │ │ ├── SourceEnum.java │ │ └── ThreadPoolHttpClient.java │ │ ├── common │ │ ├── CSCommon.java │ │ ├── IDataNotify.java │ │ └── UrlsContanst.java │ │ ├── data │ │ ├── ChinaNewsGetData.java │ │ ├── DataGetUtil.java │ │ ├── HuanQiuGetData.java │ │ └── HuxiuGetData.java │ │ └── datasource │ │ ├── ChinaNewsSource.java │ │ ├── HuanQiuSource.java │ │ └── HuxiuSource.java └── yuannews-datacenter.iml ├── yuannews-model ├── READMODEL.md ├── pom.xml ├── src │ └── main │ │ └── java │ │ └── yuan │ │ └── ssm │ │ ├── base │ │ ├── Cate.java │ │ ├── Comment.java │ │ ├── Liked.java │ │ ├── News.java │ │ ├── Source.java │ │ ├── Taste.java │ │ └── User.java │ │ ├── other │ │ ├── CommentJo.java │ │ ├── DataBean.java │ │ ├── PageJo.java │ │ ├── PageVo.java │ │ └── TuijianModel.java │ │ ├── pojo │ │ ├── CSCustom.java │ │ ├── CommentPo.java │ │ ├── LikedPo.java │ │ ├── NewsCustom.java │ │ ├── NewsPo.java │ │ ├── NewsPoCustom.java │ │ └── UserPo.java │ │ └── vo │ │ ├── CateVo.java │ │ ├── CommentVo.java │ │ ├── LikedVo.java │ │ ├── NewsVo.java │ │ ├── SourceVo.java │ │ ├── TasteVo.java │ │ └── UserVo.java └── yuannews-model.iml ├── yuannews-service ├── READSERVICE.md ├── pom.xml ├── src │ ├── main │ │ └── java │ │ │ └── yuan │ │ │ └── ssm │ │ │ └── service │ │ │ ├── base │ │ │ ├── ManagerBase.java │ │ │ └── ServiceBase.java │ │ │ ├── customer │ │ │ ├── NewsService.java │ │ │ ├── UserService.java │ │ │ └── impl │ │ │ │ ├── NewsServiceImpl.java │ │ │ │ └── UserServiceImpl.java │ │ │ ├── manager │ │ │ ├── CateManager.java │ │ │ ├── CommentManager.java │ │ │ ├── IndexManager.java │ │ │ ├── LikedManager.java │ │ │ ├── NewsManager.java │ │ │ ├── SourceManager.java │ │ │ ├── TasteManager.java │ │ │ ├── UserManager.java │ │ │ └── impl │ │ │ │ ├── CateManagerImpl.java │ │ │ │ ├── CommentManagerImpl.java │ │ │ │ ├── IndexManagerImpl.java │ │ │ │ ├── LikedManagerImpl.java │ │ │ │ ├── NewsManagerImpl.java │ │ │ │ ├── SourceManagerImpl.java │ │ │ │ ├── TasteManagerImpl.java │ │ │ │ └── UserManagerImpl.java │ │ │ └── mobile │ │ │ ├── NewsAppService.java │ │ │ ├── UserAppService.java │ │ │ └── impl │ │ │ ├── NewsAppServiceImpl.java │ │ │ └── UserAppServiceImpl.java │ └── test │ │ └── java │ │ ├── common │ │ ├── ServiceBaseTest.java │ │ └── ServiceConstant.java │ │ ├── custom │ │ └── CustomerTest.java │ │ └── manager │ │ └── UserManagerTest.java └── yuannews-service.iml ├── yuannews.sql └── 配置.png /DeepinScrot-3030.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/DeepinScrot-3030.png -------------------------------------------------------------------------------- /src/main/resources/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /tomcatnewpath.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/tomcatnewpath.png -------------------------------------------------------------------------------- /yuanews-web/READWEB.md: -------------------------------------------------------------------------------- 1 | #YuanNews - web : 记录添加的资源和页面 2 | 3 | #2016.04.07 4 | * 已经有后台管理页面,已经实现了管理登陆,和后台管理 jsp页面 ! 5 | * 分页实现方案 : JQuery Pagination -------------------------------------------------------------------------------- /yuanews-web/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 23 | 24 | yuannews 25 | cn.edu.hpu.yuannews 26 | 1.0-SNAPSHOT 27 | 28 | 29 | 4.0.0 30 | war 31 | 32 | yuanews-web 33 | yuanews-web 34 | 35 | 36 | 37 | cn.edu.hpu.yuannews 38 | yuannews-controller 39 | 1.0-SNAPSHOT 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/error.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: yuan 4 | Date: 16-4-17 5 | Time: 下午8:35 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | 出错了 12 | 13 | 14 | 15 |  

 so sorry , 发生了错误! 

16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/css/DialogBySHF.css: -------------------------------------------------------------------------------- 1 | #DialogBySHFLayer 2 | { 3 | width:100%; 4 | height:100%; 5 | left:0; 6 | top:0; 7 | position:fixed; 8 | z-index:500; 9 | background-color:#333333; 10 | filter:alpha(Opacity=40); 11 | -moz-opacity:0.4; 12 | opacity: 0.4; 13 | 14 | } 15 | /*弹出的提示框*/ 16 | #DialogBySHF 17 | { 18 | position:absolute; 19 | border-radius:3px; 20 | box-shadow:0 0 8px rgba(0, 0, 0, .8); 21 | background-color:#f2f2f2; 22 | z-index:600; 23 | } 24 | #DialogBySHF #Title 25 | { 26 | margin:0; 27 | width:100%; 28 | height:35px; 29 | background-color:#19a97b; 30 | color:#FFFFFF; 31 | font-family: 'microsoft yahei'; 32 | font-size:18px; 33 | text-align:center; 34 | cursor:move; 35 | line-height:35px; 36 | border-radius:3px 3px 0 0; 37 | -moz-user-select:none; 38 | -webkit-user-select:none; 39 | user-select:none; 40 | } 41 | #DialogBySHF #Close 42 | { 43 | position:absolute; 44 | right:7px; 45 | top:6px; 46 | height:21px; 47 | line-height:21px; 48 | width:21px; 49 | cursor:pointer; 50 | display:block; 51 | border:1px solid #da8e02; 52 | box-shadow:0 0 4px rgba(255, 255, 255, .9); 53 | border-radius:3px; 54 | } 55 | #DialogBySHF #Container 56 | { 57 | padding:0px 5px 5px 5px; 58 | overflow-y:auto; 59 | /*width:390px; 60 | height:355px;*/ 61 | } 62 | #DialogBySHF #Container table,#DialogBySHF #Container iframe 63 | { 64 | width:100%; 65 | height:100%; 66 | 67 | } 68 | #DialogBySHF #Container table td 69 | { 70 | vertical-align:middle; 71 | } 72 | #DialogBySHF #Container table #TipLine 73 | { 74 | padding:0 30px; 75 | font-family: 'microsoft yahei'; 76 | } 77 | #DialogBySHF #Container table #BtnLine 78 | { 79 | height:60px; 80 | text-align:center; 81 | } 82 | #DialogBySHF #Container table #BtnLine input 83 | { 84 | margin:6px 11px; 85 | -moz-user-select: none; 86 | background-color:#F5F5F5; 87 | background-image: -moz-linear-gradient(center top , #F5F5F5, #F1F1F1); 88 | background-image:-ms-linear-gradient(rgb(245, 245, 245), rgb(241, 241, 241)); 89 | background-image:-webkit-linear-gradient(top,#f8f8f8,#f1f1f1); 90 | border:1px solid rgba(0,0,0,0.1); 91 | *border:1px solid #DDDDDD; 92 | border:1px solid #DDDDDD\0; 93 | border-radius:2px; 94 | font-family: 'microsoft yahei'; 95 | color:#666666; 96 | cursor:default; 97 | font-size:12px; 98 | font-weight:bold; 99 | height:29px; 100 | line-height:27px; 101 | min-width:54px; 102 | padding:0 8px; 103 | text-align:center; 104 | } 105 | #DialogBySHF #Container table #BtnLine input:hover 106 | { 107 | background-color: #F8F8F8; 108 | background-image: -moz-linear-gradient(center top , #F8F8F8, #F1F1F1); 109 | border: 1px solid #C6C6C6; 110 | box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); 111 | color: #333333; 112 | } 113 | #DialogBySHF #Container table #BtnLine input:focus 114 | { 115 | border: 1px solid #4D90FE; 116 | outline: medium none; 117 | } 118 | -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/css/default.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | body, html { font-size: 100%; padding: 0; margin: 0;} 3 | 4 | /* Reset */ 5 | *, 6 | *:after, 7 | *:before { 8 | -webkit-box-sizing: border-box; 9 | -moz-box-sizing: border-box; 10 | box-sizing: border-box; 11 | } 12 | 13 | /* Clearfix hack by Nicolas Gallagher: http://nicolasgallagher.com/micro-clearfix-hack/ */ 14 | .clearfix:before, 15 | .clearfix:after { 16 | content: " "; 17 | display: table; 18 | } 19 | 20 | .clearfix:after { 21 | clear: both; 22 | } 23 | 24 | body{ 25 | background: #f9f7f6; 26 | color: #404d5b; 27 | font-weight: 500; 28 | font-size: 0.8em; 29 | font-family: "Segoe UI", "Lucida Grande", Helvetica, Arial, "Microsoft YaHei", FreeSans, Arimo, "Droid Sans", "wenquanyi micro hei", "Hiragino Sans GB", "Hiragino Sans GB W3", "FontAwesome", sans-serif; 30 | } 31 | a{color: #2fa0ec;text-decoration: none;outline: none;} 32 | a:hover,a:focus{color:#74777b;} 33 | -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/css/detail.css: -------------------------------------------------------------------------------- 1 | .content_top{width: 100%;margin-top: 20px;} 2 | .content_top h1{width: 100%;text-align: center;} 3 | .content_top label{margin-left: 10px;} 4 | .content_top label a{text-decoration: none;color: #0c9c6e} 5 | 6 | .content_center{margin-top: 30px;text-align: center;} 7 | .content_center img{max-width: 90%;max-height: 250px;margin: 0px auto;} 8 | .content_center p{text-align: left;max-width: 90%;margin: 20px auto;font-size: 16px;} 9 | 10 | .content_bottom{margin-top: 30px;} 11 | .content_bottom .bottom_top{width: 100%;height: 100px;text-align: center;} 12 | .content_bottom .bottom_top img{width: 80px;height: 80px;margin: 0px auto;} 13 | .content_bottom .bottom_top img:hover{cursor: pointer;} 14 | .content_bottom .bottom_top label{color: #BBBBBB;margin-top: 10px;} 15 | .content_bottom .bottom_bottom{width: 50%;height: 80px;margin: 10px auto;text-align: center} 16 | .content_bottom .bottom_bottom img{margin-top: 10px;margin-left:10px;float: left;width: 30px;height: 30px;border-radius: 30px;border: 1px solid #0c9c6e;} 17 | 18 | .content_footer{margin-top: 30px;} 19 | .content_footer label{margin-left: 10px;} 20 | .content_footer .footer_item{width: 90%;max-height: 150px;margin: 20px auto;} 21 | .content_footer .footer_item img{float: left;width: 30px;height: 30px;border-radius: 30px;} 22 | .content_footer .footer_item span{margin-left: 15px;width: 80%;float: left} 23 | .content_footer .footer_item p{clear: both;width: 85%;margin: 10px auto} 24 | .content_footer .footer_item hr{clear: both;width: 100%;margin: 20px auto} 25 | .content_footer .paginationpage{float: right} 26 | 27 | .content_comment{clear: both;margin-top: 50px;} 28 | .content_comment label{margin-left: 10px;} 29 | .content_comment .comment_commit{width: 90%;height: 150px;margin: 10px auto} 30 | .content_comment .comment_commit textarea{width: 100%;height: 80px;} 31 | .content_comment .comment_commit .commit{background-color: #BBBBBB;color:#000000;border: 1px solid #c1c1c1;width: 100%;height: 40px;margin-top: 1px;text-align: center;line-height: 40px;} 32 | .content_comment .comment_commit .commit:hover{cursor: pointer;background-color: #0c9c6e;color: white;} -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/css/detailcss.css: -------------------------------------------------------------------------------- 1 | .newsdetail{ 2 | min-height: 500px; 3 | } 4 | .newsdetail h1{ 5 | border-bottom: 1px solid #19a97b; 6 | width: 100%; 7 | margin-left: 10px; 8 | } 9 | -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/css/iefixed.css: -------------------------------------------------------------------------------- 1 | /* 2 | Powered by uimix.com; 3 | date:2013-09-11; 4 | */ 5 | 6 | 7 | 8 | /* service */ 9 | .download-box .dl-wall a.funos span img.focus{display: none;} 10 | .download-box .dl-wall a.funos:hover span img.focus{display: block;} 11 | .download-box .dl-wall a.video span img.focus{display: none;} 12 | .download-box .dl-wall a.video:hover span img.focus{display: block;} 13 | 14 | .dl-mobile-slide a.prev,.dl-mobile-slide a.next{display: none;} 15 | .dl-mobile-slide a.prev.start,.dl-mobile-slide a.next.start{display: block;} 16 | .dl-service .dl-service ul li{float: left; width: 19%;} 17 | 18 | /* choose mobile */ 19 | .choose-mb-nav ul li{*border-top-style:expression(this.previousSibling==null?'none':'solid');} 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/css/label.css: -------------------------------------------------------------------------------- 1 | .label_top{margin: 20px auto;width: 100%;height: 100px;} 2 | .label_top label{margin-left: 10px;color: #0c9c6e;} 3 | .label_top h3{width: 100%;text-align: left;font-size: 18px;} 4 | 5 | .label_center{width: 90%;margin: 10px auto;text-align: center;} 6 | .label_center .center_item{float: left;width: 20%;height: 100px;margin-left:3%;margin-top: 20px;border: solid 1px white;text-align: center;padding: 1px;} 7 | .label_center .center_item:hover{border: 1px solid #0c9c6e;cursor: pointer;} 8 | .label_center .center_item label{display: block;width:100%;height: 60%; background-color: #2fa0ec;color: white;text-align: center;line-height: 60px;margin-bottom: 10px;} 9 | .label_center .center_item a{padding: 5px 15px 5px 15px;width: 40px;height: 15px;line-height:15px; color: #0c9c6e;text-decoration: none;border: 1px solid #0c9c6e;border-radius: 10px;} 10 | .label_center .center_item a:hover{border: 1px solid white;color: white;background-color: #0c9c6e;} 11 | .label_center .center_item label a{color: #0c9c6e;text-decoration: none;} 12 | 13 | .label_bottom{clear: both;margin-top: 20px;padding: 10px;} 14 | #paginationpage{float: right;} -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/css/nalbase.css: -------------------------------------------------------------------------------- 1 | /*nav styles*/ 2 | .nav ul { 3 | background: white; border-top: 6px solid #19a97b; 4 | width: 240px; margin: 10em auto; 5 | } 6 | .nav ul li { 7 | list-style-type: none; 8 | /*relative positioning for list items along with overflow hidden to contain the overflowing ripple*/ 9 | position: relative; 10 | overflow: hidden; 11 | border-bottom: 1px dashed #f9f7f6; 12 | } 13 | .nav ul li a { 14 | font: normal 14px/28px Montserrat; 15 | color: #19a97b; 16 | display: block; 17 | padding: 10px 15px; 18 | text-decoration: none; 19 | cursor: pointer; /*since the links are dummy without href values*/ 20 | /*prevent text selection*/ 21 | user-select: none; 22 | /*static positioned elements appear behind absolutely positioned siblings(.ink in this case) hence we will make the links relatively positioned to bring them above .ink*/ 23 | position: relative; 24 | } 25 | 26 | /*.ink styles - the elements which will create the ripple effect. The size and position of these elements will be set by the JS code. Initially these elements will be scaled down to 0% and later animated to large fading circles on user click.*/ 27 | .nav .ink { 28 | display: block; 29 | position: absolute; 30 | background: #19a97b; 31 | border-radius: 100%; 32 | transform: scale(0); 33 | } 34 | /*animation effect*/ 35 | .nav .ink.animate {animation: ripple 0.65s linear;} 36 | @keyframes ripple { 37 | /*scale the element to 250% to safely cover the entire link and fade it out*/ 38 | 100% {opacity: 0; transform: scale(2.5);} 39 | } 40 | -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/css/normalize.css: -------------------------------------------------------------------------------- 1 | article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block;}audio,canvas,video{display:inline-block;}audio:not([controls]){display:none;height:0;}[hidden]{display:none;}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;}body{margin:0;}a:focus{outline:thin dotted;}a:active,a:hover{outline:0;}h1{font-size:2em;margin:0.67em 0;}abbr[title]{border-bottom:1px dotted;}b,strong{font-weight:bold;}dfn{font-style:italic;}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0;}mark{background:#ff0;color:#000;}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em;}pre{white-space:pre-wrap;}q{quotes:"\201C" "\201D" "\2018" "\2019";}small{font-size:80%;}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}sup{top:-0.5em;}sub{bottom:-0.25em;}img{border:0;}svg:not(:root){overflow:hidden;}figure{margin:0;}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em;}legend{border:0;padding:0;}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0;}button,input{line-height:normal;}button,select{text-transform:none;}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;}button[disabled],html input[disabled]{cursor:default;}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none;}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}textarea{overflow:auto;vertical-align:top;}table{border-collapse:collapse;border-spacing:0;} -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/css/nprogress.css: -------------------------------------------------------------------------------- 1 | /* Make clicks pass-through */ 2 | #nprogress { 3 | pointer-events: none; 4 | } 5 | 6 | #nprogress .bar { 7 | background:#800080; 8 | 9 | position: fixed; 10 | z-index: 1031; 11 | top: 0; 12 | left: 0; 13 | 14 | width: 100%; 15 | height: 2px; 16 | } 17 | 18 | /* Fancy blur effect */ 19 | #nprogress .peg { 20 | display: block; 21 | position: absolute; 22 | right: 0px; 23 | width: 100px; 24 | height: 100%; 25 | box-shadow: 0 0 10px #800080, 0 0 5px #800080; 26 | opacity: 1.0; 27 | 28 | -webkit-transform: rotate(3deg) translate(0px, -4px); 29 | -ms-transform: rotate(3deg) translate(0px, -4px); 30 | transform: rotate(3deg) translate(0px, -4px); 31 | } 32 | 33 | /* Remove these to get rid of the spinner */ 34 | #nprogress .spinner { 35 | display: block; 36 | position: fixed; 37 | z-index: 1031; 38 | top: 15px; 39 | right: 15px; 40 | } 41 | 42 | #nprogress .spinner-icon { 43 | width: 18px; 44 | height: 18px; 45 | box-sizing: border-box; 46 | 47 | border: solid 2px transparent; 48 | border-top-color: #800080; 49 | border-left-color: #800080; 50 | border-radius: 50%; 51 | 52 | -webkit-animation: nprogress-spinner 400ms linear infinite; 53 | animation: nprogress-spinner 400ms linear infinite; 54 | } 55 | 56 | .nprogress-custom-parent { 57 | overflow: hidden; 58 | position: relative; 59 | } 60 | 61 | .nprogress-custom-parent #nprogress .spinner, 62 | .nprogress-custom-parent #nprogress .bar { 63 | position: absolute; 64 | } 65 | 66 | @-webkit-keyframes nprogress-spinner { 67 | 0% { -webkit-transform: rotate(0deg); } 68 | 100% { -webkit-transform: rotate(360deg); } 69 | } 70 | @keyframes nprogress-spinner { 71 | 0% { transform: rotate(0deg); } 72 | 100% { transform: rotate(360deg); } 73 | } 74 | -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/5794.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/5794.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/author2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/author2.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/date.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/date.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/datepng.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/datepng.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/ftlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/ftlogo.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/icons.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/lanmbq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/lanmbq.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/lct.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/lct.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/loginreg-corner-ico.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/loginreg-corner-ico.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/loginreg-title-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/loginreg-title-bg.jpg -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/logo.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/newsbg01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/newsbg01.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/newsbg02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/newsbg02.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/newsbg03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/newsbg03.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/newsbg04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/newsbg04.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/ph2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/ph2.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/return.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/return.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/silde-nav.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/silde-nav.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/slide-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/slide-bg.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/vivo-head-ico.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/vivo-head-ico.gif -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/images/vivo-head-ico.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/images/vivo-head-ico.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/js/html5.js: -------------------------------------------------------------------------------- 1 | /* 2 | HTML5 Shiv v3.7.0 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 3 | */ 4 | (function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag(); 5 | a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x"; 6 | c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode|| 7 | "undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f); 8 | if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d"); 8 | 9 | ink = parent.find(".ink"); 10 | //incase of quick double clicks stop the previous animation 11 | ink.removeClass("animate"); 12 | 13 | //set size of .ink 14 | if(!ink.height() && !ink.width()) 15 | { 16 | //use parent's width or height whichever is larger for the diameter to make a circle which can cover the entire element. 17 | d = Math.max(parent.outerWidth(), parent.outerHeight()); 18 | ink.css({height: d, width: d}); 19 | } 20 | 21 | //get click coordinates 22 | //logic = click coordinates relative to page - parent's position relative to page - half of self height/width to make it controllable from the center; 23 | x = e.pageX - parent.offset().left - ink.width()/2; 24 | y = e.pageY - parent.offset().top - ink.height()/2; 25 | 26 | //set the position and add class .animate 27 | ink.css({top: y+'px', left: x+'px'}).addClass("animate"); 28 | }) 29 | -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/js/nav.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/js/nav.js -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/js/vivo-common.js: -------------------------------------------------------------------------------- 1 | VIVO_UIMIX = { 2 | init : function(){ 3 | var headBox=$("#vivo-head"), 4 | navBox=headBox.find(".vivo-nav"), 5 | searchBox=headBox.find(".vivo-search"), 6 | searchInput=searchBox.find("input"), 7 | searchBtn=navBox.find(".search-user a.search"), 8 | closeSearchBtn=searchBox.find("a.close"), 9 | isSearchClose=true, 10 | isMenuEnter=isCommEnter=false; 11 | 12 | closeSearchBtn.css({opacity:0}); 13 | searchBox.on({ 14 | mouseenter : function(){ 15 | closeSearchBtn.animate({opacity:1},300); 16 | }, 17 | mouseleave : function(){ 18 | closeSearchBtn.animate({opacity:0},300); 19 | } 20 | }); 21 | 22 | searchBtn.on("click",function(){ 23 | if(isSearchClose){ 24 | searchBox.children().css({opacity:0}); 25 | searchBox.css({display:"block",height:0}).stop().animate({height:80},300); 26 | searchBox.children().stop().delay(300).animate({opacity:1},500); 27 | searchInput.focus().val(""); 28 | $(this).addClass("current"); 29 | isSearchClose=false; 30 | }else{ 31 | searchBox.stop().animate({height:0},300,function(){ 32 | $(this).css({display:"none"}); 33 | isSearchClose=true; 34 | }); 35 | $(this).removeClass("current"); 36 | } 37 | return false; 38 | }); 39 | closeSearchBtn.on("click",function(){ 40 | searchBtn.click(); 41 | return false; 42 | }); 43 | 44 | } 45 | }; 46 | 47 | $(document).ready(function() {VIVO_UIMIX.init()}); 48 | -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/login/css/detail.css: -------------------------------------------------------------------------------- 1 | body{ 2 | background-color: #f8f9fa; 3 | overflow:auto; 4 | } 5 | .content{width: 80%;height: 500px;margin: 2% auto;padding: 10px; } 6 | .content .content_top{width: 100%;height: 90%;margin: auto;} 7 | 8 | .top_left{width: 40%;height:100%;float: left;border-radius: 30px;background-color: white;} 9 | .top_right{width: 55%;height:100%;float: right;border-radius: 40px;background-color: white;} 10 | 11 | .top_left h3{width: 100%;text-align: center;border-bottom: solid 1px #0c9c6e} 12 | .left_img{width: 40%;height:100%;padding: 2%; text-align: center;float: left;} 13 | .left_img img{width:80px;height:80px;border-radius:80px;border: 1px solid #f8f9fa;margin: 10px auto; } 14 | .left_img h3{width:100%;font-size: 18px;font-style: oblique;border-bottom: solid 1px white} 15 | .left_img input{width:80px;background-color: #0c9c6e;color: white;border: 1px solid white;} 16 | .left_img input:hover{cursor: pointer;} 17 | .left_ifo{width: 55%;float: right;margin-top: 5%;} 18 | .left_ifo a{width:80px;background-color: #0c9c6e;font-size:12px;color: white;border: 1px solid white;text-decoration: none;padding: 5px;} 19 | .left_ifo a:hover{cursor: pointer;} 20 | 21 | 22 | .top_right .label_left{width: 100%;height: 100%;} 23 | .top_right .label_left h3{width: 100%;text-align: center;border-bottom: solid 1px #0c9c6e} 24 | .top_right .label_left h3 .ha1{font-size: 12px;float: right;margin-right: 20px;text-decoration: none;} 25 | .top_right .label_left h3 .ha2{font-size: 20px;float: left;margin-left: 20px;text-decoration: none;} 26 | 27 | .top_right .label_left .labels{padding: 20px;} 28 | .top_right .label_left .labels label{display: inline-block;margin: 6px;min-height: 8px;min-width: 20px;background-color: #2fa0ec;border-radius: 20px;padding: 8px;color: white;} 29 | .top_right .label_left .labels label img{width: 15px;height: 15px;position: relative;top: -18px;right: -10px;display:none} 30 | .top_right .label_left .labels label img:hover{cursor: pointer} 31 | 32 | .add{position: absolute; top:20%;left: 40%;right: 30%;color: black;display:none;} 33 | -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/login/images/adm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/login/images/adm.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/login/images/avtar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/login/images/avtar.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/login/images/bg1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/login/images/bg1.jpg -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/login/images/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/login/images/close.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/login/images/icon_exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/login/images/icon_exit.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/login/images/key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/login/images/key.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/html/login/images/pass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/html/login/images/pass.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/images/404_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/images/404_bg.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/images/db_tables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/images/db_tables.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/images/moren.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/images/moren.jpg -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/images/tomcat-learn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/images/tomcat-learn.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: yuan 4 | Date: 16-3-30 5 | Time: 下午7:30 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | <% String projectPath=request.getContextPath();%> 10 | 11 | 12 | 主页 13 | 14 | 15 | Hi , 原!
16 | 当前工程: <%=projectPath%>
17 | 后台管理

18 | 接口地址 19 |

20 | 主页 21 | 22 | 23 | -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/manager/403.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: yuan 4 | Date: 16-3-31 5 | Time: 上午9:34 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | 12 | 13 | 403 - 这个.. 页面没有找到!!! 14 | 15 | 26 | 27 | 28 | 29 | 30 | 31 |
32 |
33 |
34 |

Sorry..页面没有找到!

35 |

36 | 似乎你所寻找的网页已移动或丢失了。 37 |

或者也许你只是键入错误了一些东西。

38 | 请不要担心,这没事。如果该资源对你很重要,请与管理员联系。 39 |

40 | 41 |

42 | 火星不太安全,我可以免费送你回地球 43 |

44 |
45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 |
53 |
54 | 55 | 56 | -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/manager/404.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: yuan 4 | Date: 16-3-31 5 | Time: 上午9:35 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | 12 | 13 | 404 - 这个.. 页面没有找到!!! 14 | 15 | 26 | 27 | 28 | 29 | 30 | 31 |
32 |
33 |
34 |

Sorry..页面没有找到!

35 |

36 | 似乎你所寻找的网页已移动或丢失了。 37 |

或者也许你只是键入错误了一些东西。

38 | 请不要担心,这没事。如果该资源对你很重要,请与管理员联系。 39 |

40 | 41 |

42 | 火星不太安全,我可以免费送你回地球 43 |

44 |
45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 |
53 |
54 | 55 | 56 | -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/manager/500.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: yuan 4 | Date: 16-3-31 5 | Time: 上午9:35 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | 12 | 13 | 500 - 这个.. 页面没有找到!!! 14 | 15 | 26 | 27 | 28 | 29 | 30 | 31 |
32 |
33 |
34 |

Sorry..页面没有找到!

35 |

36 | 似乎你所寻找的网页已移动或丢失了。 37 |

或者也许你只是键入错误了一些东西。

38 | 请不要担心,这没事。如果该资源对你很重要,请与管理员联系。 39 |

40 | 41 |

42 | 火星不太安全,我可以免费送你回地球 43 |

44 |
45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 |
53 |
54 | 55 | -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/manager/css/font/adminthemes-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/manager/css/font/adminthemes-webfont.eot -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/manager/css/font/adminthemes-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/manager/css/font/adminthemes-webfont.ttf -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/manager/css/font/adminthemes-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/manager/css/font/adminthemes-webfont.woff -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/manager/css/font/adminthemes-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/manager/css/font/adminthemes-webfont.woff2 -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/manager/images/404_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/manager/images/404_bg.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/manager/images/admin_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/manager/images/admin_logo.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/manager/images/icon/DefaultAvatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/manager/images/icon/DefaultAvatar.jpg -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/manager/images/icon/apple-touch-icon-120x120-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/manager/images/icon/apple-touch-icon-120x120-precomposed.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/manager/images/icon/apple-touch-icon-196x196-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/manager/images/icon/apple-touch-icon-196x196-precomposed.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/manager/images/icon/apple-touch-icon-57x57-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/manager/images/icon/apple-touch-icon-57x57-precomposed.png -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/manager/images/icon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/manager/images/icon/favicon.ico -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/manager/images/moren.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/yuanews-web/src/main/webapp/manager/images/moren.jpg -------------------------------------------------------------------------------- /yuanews-web/src/main/webapp/manager/js/html5.js: -------------------------------------------------------------------------------- 1 | // Html5 JavaScript Document 2 | (function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag(); 3 | a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x"; 4 | c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode|| 5 | "undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f); 6 | if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d 2 | 5 | 6 | yuannews 7 | cn.edu.hpu.yuannews 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | yuannews-common 13 | jar 14 | 15 | 16 | -------------------------------------------------------------------------------- /yuannews-common/src/main/java/yuan/ssm/common/config/ConfigConstant.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.common.config; 2 | 3 | /** 4 | * ================================================== 5 | *

6 | * 版权: 软件工程.net12-1 原明卓 7 | *

8 | * 项目: 基于用户兴趣标签的新闻推荐系统 9 | *

10 | * 作者: 原明卓 11 | *

12 | * 版本: 1.0 13 | *

14 | * 创建日期: 16-4-14 上午11:47 15 | *

16 | * 功能描述: 17 | * TODO : 如果需要的切换环境的话,需要进行配置的地方! 18 | *

19 | *

20 | * 功能更新历史: 21 | *

22 | * ================================================== 23 | */ 24 | public interface ConfigConstant { 25 | 26 | /** 27 | * 根据文字生成图片,存放的基础路径,跟随着tomcat的变化而变化 28 | * 详见: tomcat_home/conf/server.xml - Context 29 | */ 30 | String FONT_IMAGE_BASE_PATH="/mnt/JAVA/tomcatImageServer/head/"; 31 | 32 | /** 33 | * 推荐的新闻id存储绝对路径 34 | */ 35 | String JSON_IDS_BASE_PATH="/mnt/JAVA/tomcatImageServer/ids/"; 36 | 37 | /** 38 | * 用户管理页面,每页加载的数量 39 | */ 40 | Integer MAGAGER_USER_PAGE_NUM=8; 41 | 42 | /** 43 | * 兴趣管理页面,每页加载的数量 44 | */ 45 | Integer MANAGER_TASTE_PAGE_NUM=10; 46 | 47 | /** 48 | * 新闻来源管理页面,每页加载的数量 49 | */ 50 | Integer MANAGER_SOURCE_PAGE_NUM=10; 51 | 52 | /** 53 | * 点赞每页显示的数量 54 | */ 55 | Integer MANAGER_LIKED_PAGE_NUM=10; 56 | 57 | /** 58 | * 评论每页显示数量 59 | */ 60 | Integer MANAGER_COMMENT_PAGE_NUM=8; 61 | 62 | /** 63 | * 新闻页面显示数量 64 | */ 65 | Integer MANAGER_NEWS_PAGE_NUM=8; 66 | 67 | 68 | } 69 | -------------------------------------------------------------------------------- /yuannews-common/src/main/java/yuan/ssm/common/constant/ManagerConstant.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.common.constant; 2 | 3 | /** 4 | * Created by yuan on 16-4-5. 5 | * 控制器-后台管理-放置常量 6 | * 注意:核心类,配置后台管理各个页面(jsp) 7 | */ 8 | public interface ManagerConstant { 9 | 10 | String LOG_MANAGER_CONTROLLER="controller/ManagerController";//后台管理-log位置标示 11 | 12 | String MANAGER_INDEX="manager/index"; //后台管理-主页 13 | 14 | String SESSION_ATTRIBUTE_KEY="uid"; //HttpSession 的 key 15 | 16 | String MANAGER_REDRICT_LOGIN="redirect:LoginManger.jsp"; //重定向url到登陆界面 17 | 18 | String MANAGER_INDEX_MV_KEY="userVo"; 19 | 20 | String MAGAGER_USER_PAGE="manager/UserManager"; //用户管理页面 21 | 22 | String MANAGER_USER_NAME="usernick"; 23 | 24 | String MANAGER_TASTE_PAGE="manager/TasteManager"; //兴趣管理页面 25 | 26 | String MANAGER_SOURCE_PAGR="manager/SourceManager"; //新闻来源管理页面 27 | 28 | String MANAGER_CATE_PAGE="manager/CateManager"; //新闻分类管理页面 29 | 30 | String MANAGER_LIKED_PAGE="manager/LikedManager"; //点赞管理页面 31 | 32 | String MANAGER_COMMENT_PAGR="manager/CommentManager";//评论管理页面 33 | 34 | String MANAGER_NEWS_PAGE="manager/NewsManager";//新闻管理页面 35 | 36 | } 37 | -------------------------------------------------------------------------------- /yuannews-common/src/main/java/yuan/ssm/common/constant/NewsStatusConstant.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.common.constant; 2 | 3 | /** 4 | * Created by yuan on 16-4-6. 5 | * 核心常量 - 配置-公用  6 | */ 7 | public interface NewsStatusConstant { 8 | } 9 | -------------------------------------------------------------------------------- /yuannews-common/src/main/java/yuan/ssm/common/newsenum/NewsStatusEnum.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.common.newsenum; 2 | 3 | /** 4 | * Created by yuan on 16-4-6. 5 | * 新闻中的状态-枚举类 6 | */ 7 | public class NewsStatusEnum { 8 | } 9 | -------------------------------------------------------------------------------- /yuannews-common/src/main/java/yuan/ssm/common/newsenum/ServiceEnum.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.common.newsenum; 2 | 3 | /** 4 | * ================================================== 5 | *

6 | * 版权: 软件工程.net12-1 原明卓 7 | *

8 | * 项目: 基于用户兴趣标签的新闻推荐系统 9 | *

10 | * 作者: 原明卓 11 | *

12 | * 版本: 1.0 13 | *

14 | * 创建日期: 16-4-26 下午11:23 15 | *

16 | * 功能描述: 当前查询的数据类型,枚举 17 | *

18 | *

19 | * 功能更新历史: 20 | *

21 | * ================================================== 22 | */ 23 | public enum ServiceEnum { 24 | normal,cate,source 25 | } 26 | -------------------------------------------------------------------------------- /yuannews-common/src/main/java/yuan/ssm/common/status/LoginStatus.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.common.status; 2 | 3 | /** 4 | * Created by yuan on 16-4-5. 5 | * 用户登陆/管理员登陆 登陆状态 6 | */ 7 | public interface LoginStatus { 8 | 9 | //密码错误 10 | Integer PASS_ERROR=-1; 11 | 12 | //账号不存在 13 | Integer UNUM_NOT_HAVE=-2; 14 | 15 | //登陆失败 16 | Integer Login_ERROR=-3; 17 | } 18 | -------------------------------------------------------------------------------- /yuannews-common/src/main/java/yuan/ssm/common/status/ManagerConutStatus.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.common.status; 2 | 3 | /** 4 | * Created by yuan on 16-4-12. 5 | * 查询数量,不同的类型查询不同的数量 6 | */ 7 | public interface ManagerConutStatus { 8 | 9 | //用户类型 10 | Integer MANAGER_USER_COUNT_TYPE=1; 11 | 12 | //新闻类型 13 | Integer MANAGER_NEWS_COUNT_TYPE=2; 14 | 15 | //评论类型 16 | Integer MANAGER_COMMENT_COUNT_TYPE=3; 17 | 18 | //点赞类型 19 | Integer MANAGER_LIKED_COUNT_TYPE=4; 20 | 21 | //爱好类型 22 | Integer MANAGER_TASTE_COUNT_TYPE=5; 23 | 24 | //新闻来源类型 25 | Integer MANAGER_SOURCE_COUNT_TYPE=6; 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /yuannews-common/src/main/java/yuan/ssm/common/status/UpdateStatus.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.common.status; 2 | 3 | /** 4 | * ================================================== 5 | *

6 | * 版权: 软件工程.net12-1 原明卓 7 | *

8 | * 项目: 基于用户兴趣标签的新闻推荐系统 9 | *

10 | * 作者: 原明卓 11 | *

12 | * 版本: 1.0 13 | *

14 | * 创建日期: 16-4-14 上午11:24 15 | *

16 | * 功能描述: 修改信息状态 17 | *

18 | *

19 | * 功能更新历史: 20 | *

21 | * ================================================== 22 | */ 23 | public interface UpdateStatus { 24 | 25 | Integer UPDATE_SUCCESS=1; //修改成功 26 | 27 | Integer UPDATE_FAIL=-1; //修改失败 28 | 29 | Integer UPDATE_ID_ZORE=-2; //id小于等于0 30 | 31 | } 32 | -------------------------------------------------------------------------------- /yuannews-common/src/main/java/yuan/ssm/common/util/DateUtil.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.common.util; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | /** 7 | * Created by yuan on 16-4-6. 8 | * 新闻核心工具类 - 日期工具类 9 | */ 10 | 11 | public class DateUtil { 12 | 13 | 14 | /** 15 | * 工具类-生成日期作为图片文件名称 16 | * @return 17 | */ 18 | public static String getDateFileName(){ 19 | Date dt = new Date(System.currentTimeMillis()); 20 | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); 21 | return sdf.format(dt); 22 | } 23 | 24 | /** 25 | * 获取时间 26 | * @return 27 | */ 28 | public static String getDate(){ 29 | Date dt = new Date(System.currentTimeMillis()); 30 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 31 | return sdf.format(dt); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /yuannews-common/src/main/java/yuan/ssm/common/util/LoggerUtil.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.common.util; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | /** 6 | * Created by yuan on 16-4-5. 7 | * 控制台日志打印 - 工具类 8 | */ 9 | public class LoggerUtil { 10 | 11 | 12 | /** 13 | * 可拓展性 14 | * 当不需要打印log的时候,注释 printf()方法即可 15 | * @param params 16 | */ 17 | public static void print(Object... params){ 18 | printf(params); 19 | } 20 | 21 | /** 22 | * 打印json数据 23 | * @param params 24 | */ 25 | public static void printJSON(Object... params){ 26 | printfJSON(params); 27 | } 28 | 29 | private static void printf(Object... params){ 30 | Object[] objects = params.clone(); 31 | System.out.println("+++++++++++++++++++++++++++++++++++++++"); 32 | System.out.println("++"); 33 | for(int i=0;i 6 | * 版权: 软件工程.net12-1 原明卓 7 | *

8 | * 项目: 基于用户兴趣标签的新闻推荐系统 9 | *

10 | * 作者: 原明卓 11 | *

12 | * 版本: 1.0 13 | *

14 | * 创建日期: 16-4-14 下午9:55 15 | *

16 | * 功能描述: 字符串处理类 17 | *

18 | *

19 | * 功能更新历史: 20 | *

21 | * ================================================== 22 | */ 23 | public class StringUtil { 24 | 25 | private static final String ENGLISH_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 26 | 27 | /** 28 | * 获取首字母或汉字来,用来进行绘制头像 29 | * @param nick 30 | * @return 31 | */ 32 | public static String getCharString(String nick){ 33 | 34 | if(nick==null){ 35 | return String.valueOf(ENGLISH_CHARS.charAt((int)(Math.random() * 26))); 36 | } 37 | 38 | char[] chars = nick.toCharArray(); 39 | if(chars.length>0){ 40 | char c=chars[0]; 41 | if(Character.isLetter(c)){ 42 | //是字母 43 | if(Character.isLowerCase(c)){ 44 | //是否是小写字母 45 | c=Character.toUpperCase(c); 46 | return String.valueOf(c); 47 | }else { 48 | return String.valueOf(c); 49 | } 50 | }else{ 51 | //不是字母返回 52 | return String.valueOf(c); 53 | } 54 | } 55 | return String.valueOf(ENGLISH_CHARS.charAt((int)(Math.random() * 26))); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /yuannews-config/READCONFOG.md: -------------------------------------------------------------------------------- 1 | #YuanNews - config 需实现 2 | 3 | #2016.04.07 4 | * 基本已经配置完毕,在使用 service的时候,需要配置 5 | * spring/applicationContext-service.xml 中配置service相关接口实现类的bean! 6 | * db.properties中配置数据库相关信息 -------------------------------------------------------------------------------- /yuannews-config/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | yuannews 7 | cn.edu.hpu.yuannews 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | yuannews-config 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /yuannews-config/src/main/resources/CustomValidationMessage.properties: -------------------------------------------------------------------------------- 1 | item.name.length.error=1~30 2 | item.born_date.isNull=日期格式是空的 3 | -------------------------------------------------------------------------------- /yuannews-config/src/main/resources/REDESQL.md: -------------------------------------------------------------------------------- 1 | #记录sql语句 2 | 3 | 4 | #2016.04.04 5 |  评论表的查询sql : 6 | ``` 7 | SELECT c.id as id, 8 | c.content AS content, 9 | c.uid AS uid, 10 | c.nid AS nid, 11 | u.nick AS nick, 12 | u.head AS head, 13 | n.title AS title 14 | FROM 15 | comment AS c, 16 | user AS u , 17 | news AS n 18 | WHERE 19 | c.uid=u.id 20 | AND 21 | c.nid=n.id 22 | AND 23 | c.id=#{0} 24 | AND 25 | c.status=0 26 | 27 | ``` 28 | 29 | #2016.04.03 数据库总结第一版 30 | 总共7个表 : 31 | * user 用户表 32 | * taste 兴趣表 33 | * cate 分类表 34 | * source 新闻来源表 35 | * news 新闻表 36 | * liked 点赞表 37 | * comment 评论表 38 | 39 | #用户sql 40 | * 根据用户id查询用户信息 41 | ``` 42 | select * from user WHERE id=1 43 | 44 | ``` 45 | 46 | * 从0开始获取2条记录,并通过id排序后倒序输出 47 | ``` 48 | select * from user order by id desc limit 0,2; 49 | 50 | ``` 51 | 52 | * 修改某个用户的状态 53 | ``` 54 | update user set status=1 where id=1; 55 | 56 | ``` 57 | 58 | * 修改的sql 59 | ``` 60 | update user set head='/imgage/type.jpg' where id=1; 61 | update user set pass=111111 where id = 1; 62 | update user set sex=1 where id=1; 63 | 64 | ``` 65 | 66 | * 多条件查询 67 | ``` 68 | SELECT id,unum,head,nick,sex,status from user where unum='150365186579' AND pass='123456'; 69 | ``` 70 | 71 | 72 | #类别sql 73 | #兴趣sql 74 | #新闻sql -------------------------------------------------------------------------------- /yuannews-config/src/main/resources/db.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc:mysql://localhost:3306/newssysdb?useUnicode=true&characterEncoding=utf8 3 | jdbc.name=root 4 | jdbc.pass=yuan -------------------------------------------------------------------------------- /yuannews-config/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Global logging configuration 2 | # 3 | log4j.rootLogger=DEBUG, stdout 4 | # MyBatis logging configuration... 5 | log4j.logger.org.mybatis.example.BlogMapper=TRACE 6 | # Console output... 7 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 8 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n -------------------------------------------------------------------------------- /yuannews-config/src/main/resources/mybatis/sqlmapConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /yuannews-config/src/main/resources/spring/applicationContext-dao.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /yuannews-config/src/main/resources/spring/applicationContext-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /yuannews-config/src/main/resources/spring/applicationContext-transcation.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /yuannews-controller/READCONTROLLER.md: -------------------------------------------------------------------------------- 1 | #YuanNews - Controller 需实现 2 | 3 | #2016.04.07 4 |  * 已经实现了后台管理-管理登陆/后台主页业务 -------------------------------------------------------------------------------- /yuannews-controller/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | yuannews 7 | cn.edu.hpu.yuannews 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | yuannews-controller 13 | jar 14 | 15 | 16 | cn.edu.hpu.yuannews 17 | yuannews-service 18 | 1.0-SNAPSHOT 19 | 20 | 21 | cn.edu.hpu.yuannews 22 | yuannews-model 23 | 1.0-SNAPSHOT 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /yuannews-controller/src/main/java/yuan/ssm/controller/CateController.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.*; 6 | import org.springframework.web.servlet.ModelAndView; 7 | import yuan.ssm.common.constant.ManagerConstant; 8 | import yuan.ssm.common.util.LoggerUtil; 9 | import yuan.ssm.service.manager.CateManager; 10 | import yuan.ssm.vo.CateVo; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * ================================================== 16 | *

17 | * 版权: 软件工程.net12-1 原明卓 18 | *

19 | * 项目: 基于用户兴趣标签的新闻推荐系统 20 | *

21 | * 作者: 原明卓 22 | *

23 | * 版本: 1.0 24 | *

25 | * 创建日期: 16-4-17 上午11:25 26 | *

27 | * 功能描述: 分类管理控制器 28 | * 功能:分类管理页面实现,增删改查实现 29 | *

30 | *

31 | * 功能更新历史: 32 | *

33 | * ================================================== 34 | */ 35 | @Controller 36 | @RequestMapping("/manager") 37 | public class CateController { 38 | 39 | 40 | @Autowired 41 | private CateManager cateManager; 42 | 43 | /** 44 | * 分类信息管理页面 45 | * @return 数据,页面 46 | */ 47 | @RequestMapping("/managerCatePage") 48 | public ModelAndView managerCatePage() throws Exception { 49 | List cateVos = cateManager.managerFindList(0, 0); 50 | LoggerUtil.print(cateVos); 51 | ModelAndView mav=new ModelAndView(); 52 | mav.setViewName(ManagerConstant.MANAGER_CATE_PAGE); 53 | mav.addObject("cateVos",cateVos); 54 | return mav; 55 | } 56 | 57 | /** 58 | * 添加新闻来源 59 | * @return 60 | */ 61 | @RequestMapping(value = "/managerCateInsert",method = RequestMethod.POST) 62 | public @ResponseBody 63 | Integer managerCateInsert(@ModelAttribute CateVo cateVo) throws Exception { 64 | return cateManager.managerInsertOne(cateVo); 65 | } 66 | 67 | /** 68 | * 修改新闻来源信息 69 | * @return 70 | * @throws Exception 71 | */ 72 | @RequestMapping(value = "/managerCateUpdate",method = RequestMethod.POST) 73 | public @ResponseBody Integer managerCateUpdate(@ModelAttribute CateVo cateVo) throws Exception { 74 | return cateManager.managerUpdateOne(cateVo); 75 | } 76 | 77 | /** 78 | * 删除 新闻来源 79 | */ 80 | @RequestMapping(value = "/managerCateDelete") 81 | public @ResponseBody Integer managerCateDelete(@RequestParam Integer id) throws Exception { 82 | return cateManager.managerDeleteOne(id); 83 | } 84 | 85 | 86 | /** 87 | * 88 | * @param id 89 | * @return 90 | * @throws Exception 91 | */ 92 | @RequestMapping(value = "/managerCateFind") 93 | public @ResponseBody CateVo managerCateFind(@RequestParam Integer id) throws Exception { 94 | return cateManager.managerFindOne(id); 95 | } 96 | 97 | 98 | } 99 | -------------------------------------------------------------------------------- /yuannews-controller/src/main/java/yuan/ssm/controller/CommentController.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RequestParam; 7 | import org.springframework.web.bind.annotation.ResponseBody; 8 | import org.springframework.web.servlet.ModelAndView; 9 | import yuan.ssm.common.config.ConfigConstant; 10 | import yuan.ssm.common.constant.ManagerConstant; 11 | import yuan.ssm.other.PageJo; 12 | import yuan.ssm.pojo.CommentPo; 13 | import yuan.ssm.service.manager.CommentManager; 14 | 15 | import java.util.List; 16 | 17 | /** 18 | * ================================================== 19 | *

20 | * 版权: 软件工程.net12-1 原明卓 21 | *

22 | * 项目: 基于用户兴趣标签的新闻推荐系统 23 | *

24 | * 作者: 原明卓 25 | *

26 | * 版本: 1.0 27 | *

28 | * 创建日期: 16-4-17 上午11:27 29 | *

30 | * 功能描述: 评论信息管理 31 | * 功能: 评论管理页面,分页查询,删除,修改等 32 | *

33 | *

34 | * 功能更新历史: 35 | *

36 | * ================================================== 37 | */ 38 | @Controller 39 | @RequestMapping("/manager") 40 | public class CommentController { 41 | 42 | @Autowired 43 | private CommentManager commentManager; 44 | 45 | private int pageNum=ConfigConstant.MANAGER_COMMENT_PAGE_NUM; 46 | 47 | /** 48 | * 评论管理主页 49 | * @param p 分页 50 | * @return 51 | */ 52 | @RequestMapping("/managerCommentPage") 53 | public ModelAndView managerCommentPage(Integer p) throws Exception { 54 | if(p<0){ 55 | p=1; 56 | } 57 | int currentPage=p; 58 | p=pageNum*(p-1); 59 | List commentPos = commentManager.managerFindList(p, pageNum); 60 | PageJo pageJo = commentManager.managerFindCount(); 61 | ModelAndView mav=new ModelAndView(); 62 | mav.addObject("commentPos",commentPos); 63 | mav.addObject("count",pageJo.getAllCount()); 64 | mav.addObject("currentPage",currentPage); 65 | mav.setViewName(ManagerConstant.MANAGER_COMMENT_PAGR); 66 | return mav; 67 | } 68 | 69 | /** 70 | * 删除评论 71 | * @param id 评论id 72 | * @return 73 | * @throws Exception 74 | */ 75 | @RequestMapping("/managerDeleteComment") 76 | public @ResponseBody Integer managerDeleteComment(@RequestParam Integer id) throws Exception{ 77 | return commentManager.managerDeleteOne(id); 78 | } 79 | 80 | 81 | /** 82 | * 获得单条评论信息 83 | * @param id 84 | * @return 85 | * @throws Exception 86 | */ 87 | @RequestMapping("/managerCommentFind") 88 | public @ResponseBody CommentPo managerCommentFind(@RequestParam Integer id) throws Exception{ 89 | return commentManager.managerFindOne(id); 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /yuannews-controller/src/main/java/yuan/ssm/controller/LikedController.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RequestMethod; 7 | import org.springframework.web.bind.annotation.RequestParam; 8 | import org.springframework.web.bind.annotation.ResponseBody; 9 | import org.springframework.web.servlet.ModelAndView; 10 | import yuan.ssm.common.config.ConfigConstant; 11 | import yuan.ssm.common.constant.ManagerConstant; 12 | import yuan.ssm.other.PageJo; 13 | import yuan.ssm.pojo.LikedPo; 14 | import yuan.ssm.service.manager.LikedManager; 15 | 16 | import java.util.List; 17 | 18 | /** 19 | * ================================================== 20 | *

21 | * 版权: 软件工程.net12-1 原明卓 22 | *

23 | * 项目: 基于用户兴趣标签的新闻推荐系统 24 | *

25 | * 作者: 原明卓 26 | *

27 | * 版本: 1.0 28 | *

29 | * 创建日期: 16-4-17 上午11:23 30 | *

31 | * 功能描述: 点赞管理控制器,实现点赞的管理功能 32 | * 功能:主页分页加载,删除点赞 33 | *

34 | *

35 | * 功能更新历史: 36 | *

37 | * ================================================== 38 | */ 39 | @Controller 40 | @RequestMapping("/manager") 41 | public class LikedController { 42 | 43 | 44 | @Autowired 45 | private LikedManager likedManager; 46 | 47 | private int pageNum= ConfigConstant.MANAGER_LIKED_PAGE_NUM; 48 | 49 | /** 50 | * 点赞管理主页 51 | * 数据: list , 当前页,总数 52 | * @param p 页数 53 | * @return 54 | */ 55 | @RequestMapping("/managerLikedPage") 56 | public ModelAndView managerLikedPage(@RequestParam Integer p) throws Exception { 57 | if(p<0){ 58 | p=1; 59 | } 60 | int currPage=p; 61 | p=pageNum*(p-1); 62 | ModelAndView mav=new ModelAndView(); 63 | List likedPos = likedManager.managerFindList(p, pageNum); 64 | PageJo pageJo = likedManager.managerFindCount(); 65 | mav.addObject("likedPos",likedPos); 66 | mav.addObject("currentPage",currPage); 67 | mav.addObject("count",pageJo.getAllCount()); 68 | mav.setViewName(ManagerConstant.MANAGER_LIKED_PAGE); 69 | return mav; 70 | } 71 | 72 | /** 73 | * 删除点赞信息 74 | * @param id 点赞id 75 | * @return 76 | * @throws Exception 77 | */ 78 | @RequestMapping(value = "/managerDeleteLiked",method = RequestMethod.POST) 79 | public @ResponseBody Integer managerDeleteLiked(@RequestParam Integer id) throws Exception{ 80 | return likedManager.managerDeleteOne(id); 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /yuannews-controller/src/main/java/yuan/ssm/controller/MainContorller.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.controller; 2 | 3 | 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RequestMethod; 7 | 8 | /** 9 | * Created by yuan on 16-3-30. 10 | * 用户端 - 主页控制器-主页 11 | * 功能: 主页显示,主页内容请求等 12 | */ 13 | 14 | @Controller 15 | public class MainContorller { 16 | 17 | @RequestMapping(value = "/",method = RequestMethod.GET) 18 | public String Index(){ 19 | return "index"; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /yuannews-controller/src/main/java/yuan/ssm/controller/ManagerController.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | /** 7 | * ================================================== 8 | *

9 | * 版权: 软件工程.net12-1 原明卓 10 | *

11 | * 项目: 基于用户兴趣标签的新闻推荐系统 12 | *

13 | * 作者: 原明卓 14 | *

15 | * 版本: 1.0 16 | *

17 | * 创建日期: 16-4-17 上午11:32 18 | *

19 | * 功能描述: 后台管理主页控制器 20 | * 功能:实现统计查询等业务 21 | * 注意:管理主页面在UserController中,因为和登陆相关,所以就不迁移了! 22 | *

23 | *

24 | * 功能更新历史: 25 | *

26 | * ================================================== 27 | */ 28 | @Controller 29 | @RequestMapping("/manager") 30 | public class ManagerController { 31 | 32 | 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /yuannews-controller/src/main/java/yuan/ssm/exception/CustomException.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.exception; 2 | 3 | /** 4 | * Created by yuan on 16-3-30. 5 | * 配置异常统一处理拦截实体类 6 | */ 7 | public class CustomException extends Exception { 8 | 9 | private String msg; 10 | 11 | public CustomException(String msg) { 12 | super(msg); 13 | this.msg=msg; 14 | } 15 | 16 | public String getMsg() { 17 | return msg; 18 | } 19 | 20 | public void setMsg(String msg) { 21 | this.msg = msg; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /yuannews-controller/src/main/java/yuan/ssm/exception/CustomExceptionResover.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.exception; 2 | 3 | import org.springframework.web.servlet.HandlerExceptionResolver; 4 | import org.springframework.web.servlet.ModelAndView; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | 9 | /** 10 | * Created by yuan on 16-3-30. 11 | * 配置异常统一处理拦截类 12 | */ 13 | public class CustomExceptionResover implements HandlerExceptionResolver{ 14 | 15 | public ModelAndView resolveException(HttpServletRequest arg0, 16 | HttpServletResponse arg1, Object arg2, Exception ex) { 17 | // 解析出异常类型; 18 | // 如果该异常类型是系统自定义的异常,直接取出异常信息并展示; 19 | // 如果该异常类型不是自定义的异常,则构造一个自定义的异常类型信息; 20 | CustomException customException=null; 21 | if(ex instanceof CustomException){ 22 | //是自定义异常类 23 | customException=(CustomException) ex; 24 | }else{ 25 | customException=new CustomException("未知错误:"+ex.getMessage()); 26 | } 27 | String msg=customException.getMsg(); 28 | ModelAndView andView = new ModelAndView(); 29 | andView.addObject("msg", msg); 30 | andView.setViewName("/error"); 31 | return andView; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /yuannews-controller/src/main/java/yuan/ssm/filter/LoginHandlerIntercepter.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.filter; 2 | 3 | import org.springframework.web.servlet.HandlerInterceptor; 4 | import org.springframework.web.servlet.ModelAndView; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | import javax.servlet.http.HttpSession; 9 | 10 | /** 11 | * Created by yuan on 16-3-30. 12 | * 过滤拦截器示例 13 | * 14 | * 作用 : 用户在访问后台主页的时候,进行登陆判断 15 | *      如果登陆过,直接进行主页,否则转向登陆页,让其登陆 16 | */ 17 | public class LoginHandlerIntercepter implements HandlerInterceptor { 18 | 19 | private static final String INTERCEPTER_ACTION="managerIndex.action"; 20 | private static final String INRERCEPTER_FORWARD="/manager/LoginManger.jsp"; 21 | private static final String SESSION_ATTRIBUTE_KEY="uid"; 22 | 23 | public void afterCompletion(HttpServletRequest request, 24 | HttpServletResponse response, Object arg2, Exception arg3) 25 | throws Exception { 26 | } 27 | 28 | public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1, 29 | Object arg2, ModelAndView arg3) throws Exception { 30 | // TODO Auto-generated method stub 31 | } 32 | 33 | public boolean preHandle(HttpServletRequest request, HttpServletResponse arg1, 34 | Object arg2) throws Exception { 35 | String requestURI = request.getRequestURI(); 36 | if(requestURI.indexOf(INTERCEPTER_ACTION)>0){ 37 | //访问后台主页 38 | HttpSession session = request.getSession(); 39 | Integer uid = (Integer) session.getAttribute(SESSION_ATTRIBUTE_KEY); 40 | if(uid!=null){ 41 | //登陆成功的用户 42 | return true; 43 | }else{ 44 | //没有登陆,转向登陆界面 45 | // request.getRequestDispatcher(INRERCEPTER_FORWARD).forward(request,arg1); 46 | arg1.sendRedirect(request.getContextPath()+INRERCEPTER_FORWARD); 47 | return false; 48 | } 49 | }else{ 50 | return true; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /yuannews-dao/READDAO.md: -------------------------------------------------------------------------------- 1 | #YuanNews - Dao 层 需实现 2 | 3 | 4 | #2016.04.07 5 | * 统计相关的查询,用于分页等相关统计操作 6 | * 用户端 - 用户dao实现 7 | * 用户端 - 新闻dao实现 -------------------------------------------------------------------------------- /yuannews-dao/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | yuannews 7 | cn.edu.hpu.yuannews 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | yuannews-dao 13 | jar 14 | 15 | 16 | 17 | 18 | 19 | 20 | cn.edu.hpu.yuannews 21 | yuannews-model 22 | 1.0-SNAPSHOT 23 | 24 | 25 | 26 | cn.edu.hpu.yuannews 27 | yuannews-config 28 | 1.0-SNAPSHOT 29 | 30 | 31 | 32 | cn.edu.hpu.yuannews 33 | yuannews-common 34 | 1.0-SNAPSHOT 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /yuannews-dao/src/main/java/yuan/ssm/dao/customer/CateNewsMapper.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.dao.customer; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import yuan.ssm.pojo.NewsCustom; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * ================================================== 10 | *

11 | * 版权: 软件工程.net12-1 原明卓 12 | *

13 | * 项目: 基于用户兴趣标签的新闻推荐系统 14 | *

15 | * 作者: 原明卓 16 | *

17 | * 版本: 1.0 18 | *

19 | * 创建日期: 16-4-25 下午11:41 20 | *

21 | * 功能描述: 实现分类信息查询显示 22 | * 1.分类id 倒序排序输出 23 | * 2.点赞从高到底 24 | * 3.评论从高到底 25 | * 4.阅读量从高到底排序 26 | *

27 | *

28 | * 功能更新历史: 29 | *

30 | * ================================================== 31 | */ 32 | public interface CateNewsMapper { 33 | 34 | 35 | /** 36 | * 根据分类,查询新闻信息,id倒序输出 37 | * @param start 开始 38 | * @param num 数量 39 | * @param cate 分类 40 | * @return 新闻信息集合 41 | * @throws Exception 42 | */ 43 | List findNewsByCateId(@Param("start") Integer start, @Param("num") Integer num,@Param("cate") String cate) throws Exception; 44 | 45 | 46 | /** 47 | * 根据分类,查询新闻信息,点赞倒序输出 48 | * @param start 开始 49 | * @param num 数量 50 | * @param cate 分类 51 | * @return 新闻信息集合 52 | * @throws Exception 53 | */ 54 | List findNewsByCateZan(@Param("start") Integer start, @Param("num") Integer num,@Param("cate") String cate) throws Exception; 55 | 56 | 57 | /** 58 | * 根据分类,查询新闻信息,评论数倒序输出 59 | * @param start 开始 60 | * @param num 数量 61 | * @param cate 分类 62 | * @return 新闻信息集合 63 | * @throws Exception 64 | */ 65 | List findNewsByCateComment(@Param("start") Integer start, @Param("num") Integer num,@Param("cate") String cate) throws Exception; 66 | 67 | 68 | /** 69 | * 根据分类,查询新闻信息,阅读量倒序输出 70 | * @param start 开始 71 | * @param num 数量 72 | * @param cate 分类 73 | * @return 新闻信息集合 74 | * @throws Exception 75 | */ 76 | List findNewsByCateRnum(@Param("start") Integer start, @Param("num") Integer num,@Param("cate") String cate) throws Exception; 77 | 78 | 79 | } 80 | -------------------------------------------------------------------------------- /yuannews-dao/src/main/java/yuan/ssm/dao/customer/SourceNewsMapper.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.dao.customer; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import yuan.ssm.pojo.NewsCustom; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * ================================================== 10 | *

11 | * 版权: 软件工程.net12-1 原明卓 12 | *

13 | * 项目: 基于用户兴趣标签的新闻推荐系统 14 | *

15 | * 作者: 原明卓 16 | *

17 | * 版本: 1.0 18 | *

19 | * 创建日期: 16-4-25 下午11:44 20 | *

21 | * 功能描述: 实现来源新闻信息查询 22 | * 1.id 23 | * 2.点赞 24 | * 3.评论 25 | * 4.阅读 26 | *

27 | *

28 | * 功能更新历史: 29 | *

30 | * ================================================== 31 | */ 32 | public interface SourceNewsMapper { 33 | 34 | /** 35 | * 根据来源,查询新闻信息,id倒序输出 36 | * @param start 开始 37 | * @param num 数量 38 | * @param source 来源 39 | * @return 新闻信息集合 40 | * @throws Exception 41 | */ 42 | List findNewsBySourceId(@Param("start") Integer start, @Param("num") Integer num, @Param("source") String source) throws Exception; 43 | 44 | 45 | /** 46 | * 根据来源,查询新闻信息,点赞倒序输出 47 | * @param start 开始 48 | * @param num 数量 49 | * @param source 来源 50 | * @return 新闻信息集合 51 | * @throws Exception 52 | */ 53 | List findNewsBySourceZan(@Param("start") Integer start, @Param("num") Integer num, @Param("source") String source) throws Exception; 54 | 55 | /** 56 | * 根据来源,查询新闻信息,评论倒序输出 57 | * @param start 开始 58 | * @param num 数量 59 | * @param source 来源 60 | * @return 新闻信息集合 61 | * @throws Exception 62 | */ 63 | List findNewsBySourceComment(@Param("start") Integer start, @Param("num") Integer num, @Param("source") String source) throws Exception; 64 | 65 | 66 | /** 67 | * 根据来源,查询新闻信息,阅读量倒序输出 68 | * @param start 开始 69 | * @param num 数量 70 | * @param source 来源 71 | * @return 新闻信息集合 72 | * @throws Exception 73 | */ 74 | List findNewsBySourceRnum(@Param("start") Integer start, @Param("num") Integer num, @Param("source") String source) throws Exception; 75 | 76 | 77 | 78 | 79 | } 80 | -------------------------------------------------------------------------------- /yuannews-dao/src/main/java/yuan/ssm/dao/customer/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 16 | 17 | 27 | 28 | 29 | INSERT INTO user(nick,unum,pass,head) VALUES (#{nick},#{unum},#{pass},#{head}) 30 | 31 | 32 | 33 | 43 | 44 | 45 | 46 | INSERT INTO taste(label, uid) VALUES (#{label},#{id}) 47 | 48 | 49 | 50 | 53 | 54 | 62 | 63 | 74 | 75 | 76 | INSERT INTO liked(uid,nid,status) VALUES (#{uid},#{nid},1) 77 | 78 | 79 | 80 | UPDATE liked SET status=2 WHERE uid=#{uid} AND nid=#{nid} 81 | 82 | 83 | 84 | INSERT INTO comment(uid,nid,content) VALUES (#{uid},#{nid},#{content}) 85 | 86 | 87 | 88 | 89 | DELETE FROM taste WHERE id=#{tid} 90 | 91 | 92 | 102 | 103 | -------------------------------------------------------------------------------- /yuannews-dao/src/main/java/yuan/ssm/dao/manager/CateManagerMapper.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.dao.manager; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import yuan.ssm.vo.CateVo; 5 | import java.util.List; 6 | 7 | 8 | /** 9 | * Created by yuan on 16-4-1. 10 | * 数据访问层 - 分类管理 11 | */ 12 | public interface CateManagerMapper { 13 | 14 | //根据分类id,查询分类信息 15 | CateVo findCateById(Integer id) throws Exception; 16 | 17 | //获取全部分类信息 18 | List findCates() throws Exception; 19 | 20 | //修改分类信息 21 | Integer updateCate(@Param("id") Integer id,@Param("content") String content) throws Exception; 22 | 23 | //删除分类信息 : 管理的时候需要先判断是否存在正在使用的分类信息(在新闻中判断该分类下的新闻) 24 | Integer deleteCate(Integer id) throws Exception; 25 | 26 | //添加分类信息 27 | Integer insertCate(String content) throws Exception; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /yuannews-dao/src/main/java/yuan/ssm/dao/manager/CateManagerMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 10 | 11 | 14 | 15 | 16 | UPDATE cate SET content=#{content} WHERE id=#{id} 17 | 18 | 19 | 20 | DELETE FROM cate WHERE id=#{id} 21 | 22 | 23 | 24 | INSERT INTO cate(content) VALUES (#{content}) 25 | 26 | 27 | -------------------------------------------------------------------------------- /yuannews-dao/src/main/java/yuan/ssm/dao/manager/CommentManagerMapper.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.dao.manager; 2 | 3 | import yuan.ssm.pojo.CommentPo; 4 | import java.util.List; 5 | 6 | /** 7 | * Created by yuan on 16-4-3. 8 | * 后台管理 - 评论管理 - Mapper 9 | */ 10 | public interface CommentManagerMapper { 11 | 12 | /** 13 | * ---------------------------------- 14 | * 查询 15 | */ 16 | //根据id 查询评论信息 17 | CommentPo findCommentById(Integer id) throws Exception; 18 | 19 | //分页查询,评论信息,id 倒序输出 20 | List findComments(Integer start, Integer num) throws Exception; 21 | //分页查询,根据新闻id , 查询评论信息 ,id倒序输出 22 | List findCommentsByNid(Integer start,Integer num,Integer nid) throws Exception; 23 | //分页查询,根据用户id , 查询评论信息 ,id倒序输出 24 | List findCommentsByUid(Integer start,Integer num,Integer uid) throws Exception; 25 | 26 | 27 | /** 28 | * ---------------------------------- 29 | * 删除 30 | */ 31 | //伪删除:修改评论status=1 32 | Integer updateCommentStatus(Integer id,Integer status) throws Exception; 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /yuannews-dao/src/main/java/yuan/ssm/dao/manager/LikedManagerMapper.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.dao.manager; 2 | 3 | import yuan.ssm.pojo.LikedPo; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Created by yuan on 16-4-3. 9 | * 后台管理 - 点赞管理 - mapper 10 | */ 11 | public interface LikedManagerMapper { 12 | 13 | //分页查询- id排序 倒序输出  14 | List findLikeds(Integer start, Integer num) throws Exception; 15 | //分页查询- 根据用户id查询 - id排序 倒序输出 16 | List findLikedsByUid(Integer start,Integer num,Integer uid) throws Exception; 17 | //分页查询- 根据新闻id查询 - id排序 倒序输出 18 | List findLikedsByNid(Integer start,Integer num,Integer nid) throws Exception; 19 | 20 | //删除该条点赞 21 | Integer deleteLikeds(Integer id) throws Exception; 22 | 23 | //判断是否点过赞 24 | Integer findLikedByNidUid(Integer uid,Integer nid) throws Exception; 25 | } 26 | -------------------------------------------------------------------------------- /yuannews-dao/src/main/java/yuan/ssm/dao/manager/ManagerCountMapper.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.dao.manager; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import yuan.ssm.other.PageJo; 5 | 6 | /** 7 | * Created by yuan on 16-4-7. 8 | * 数据层-后台管理-统计相关的mapper 9 | */ 10 | public interface ManagerCountMapper { 11 | 12 | /** 13 | * 分页信息:  14 | * 用户,新闻,评论,点赞,兴趣 : 15 | * 目前: 查询总数即可,后续需要拓展的话,编写PageJo类和mapper.xml 16 | * type : 17 | * 1. User 18 | * 2. News 19 | * 3. Comment 20 | * 4. Liked 21 | * 5. Taste 22 | * 6. 新闻来源 source 23 | */ 24 | PageJo findCount(@Param("type") Integer type) throws Exception; 25 | 26 | /** 27 | * ...... 28 | */ 29 | } 30 | -------------------------------------------------------------------------------- /yuannews-dao/src/main/java/yuan/ssm/dao/manager/ManagerCountMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 35 | 36 | -------------------------------------------------------------------------------- /yuannews-dao/src/main/java/yuan/ssm/dao/manager/NewsManagerMapper.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.dao.manager; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import yuan.ssm.pojo.NewsPo; 5 | import yuan.ssm.vo.NewsVo; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by yuan on 16-4-1. 11 | * 后台管理 - 新闻管理 - mapper接口 12 | */ 13 | public interface NewsManagerMapper { 14 | 15 | 16 | /** 17 | * -------------------------------------- 18 | * 查询 19 | */ 20 | //根据新闻id,查询新闻(不要内容) 21 | NewsPo findNewsById(Integer id) throws Exception; 22 | //分页查询新闻 (不要内容): 以id倒序排列 23 | List findNews(Integer start, Integer num) throws Exception; 24 | //根据新闻id , 查询新闻内容 25 | String findNewsContentById(Integer id) throws Exception; 26 | //根据分类,分页查询新闻(不要内容) 27 | List findNewsByCate(Integer start, Integer num,Integer cid) throws Exception; 28 | //根据来源,分页查询新闻(不要内容) 29 | List findNewsBySource(Integer start, Integer num,Integer sid) throws Exception; 30 | 31 | 32 | /** 33 | * -------------------------------------- 34 | * 修改 35 | */ 36 | 37 | //根据新闻id , 修改新闻阅读量 38 | Integer updateNewsRnum(Integer id,Integer rnum) throws Exception; 39 | //根据新闻id,修改新闻标题 40 | Integer updateNewsTitle(@Param("id") Integer id, @Param("title") String title) throws Exception; 41 | //根据新闻id, 修改新闻来源 42 | Integer updateNewsSource(Integer id,Integer sid) throws Exception; 43 | //根据新闻id,修改新闻图片 44 | Integer updateNewsImg(@Param("id") Integer id,@Param("img") String img) throws Exception; 45 | //根据新闻id,修改新闻时间 46 | Integer updateNewsTime(@Param("id") Integer id,@Param("dt") String dt) throws Exception; 47 | //根据新闻id,修改分类 48 | Integer updateNewsCate(Integer id,Integer cid) throws Exception; 49 | 50 | 51 | /** 52 | * -------------------------------------- 53 | * 删除 54 | */ 55 | //根据新闻id,删除新闻 56 | Integer deleteNewsById(Integer id) throws Exception; 57 | 58 | 59 | 60 | /** 61 | * -------------------------------------- 62 | * 添加 63 | */ 64 | //手动添加新闻(前期) 65 | Integer insertNews(NewsVo newsVo) throws Exception; 66 | 67 | } 68 | -------------------------------------------------------------------------------- /yuannews-dao/src/main/java/yuan/ssm/dao/manager/SourceManagerMapper.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.dao.manager; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import yuan.ssm.vo.SourceVo; 5 | import java.util.List; 6 | 7 | /** 8 | * Created by yuan on 16-4-3. 9 | * 后台管理 - 新闻来源管理 - mapper 10 | */ 11 | public interface SourceManagerMapper { 12 | 13 | //分页查询 - 新闻来源管理 - id 倒序输出 14 | List findSources(Integer start, Integer num) throws Exception; 15 | 16 | //修改 - 新闻来源内容 17 | Integer updateSourceContent(@Param("id") Integer id, @Param("content") String content) throws Exception; 18 | 19 | //删除 - 新闻来源内容 20 | Integer deleteSourceContent(Integer id) throws Exception; 21 | 22 | //新增 - 新闻来源 23 | Integer insertSource(String content) throws Exception; 24 | 25 | //查询 - 一条来源信息 26 | SourceVo findSourceOne(Integer id) throws Exception; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /yuannews-dao/src/main/java/yuan/ssm/dao/manager/SourceManagerMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 10 | 11 | 12 | UPDATE source SET source=#{content} WHERE id=#{id} 13 | 14 | 15 | 16 | INSERT INTO source(source) VALUES (#{0}) 17 | 18 | 19 | 20 | DELETE FROM source WHERE id=#{0} 21 | 22 | 23 | 26 | 27 | -------------------------------------------------------------------------------- /yuannews-dao/src/main/java/yuan/ssm/dao/manager/TasteManagerMapper.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.dao.manager; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import yuan.ssm.vo.TasteVo; 5 | 6 | import java.util.List; 7 | import java.util.Set; 8 | 9 | /** 10 | * Created by yuan on 16-4-1. 11 | * 用户兴趣管理 12 | * 13 | * 批量操作待定 14 | */ 15 | public interface TasteManagerMapper { 16 | 17 | /** 18 | * ----------------------------------- 19 | * 查询 20 | */ 21 | 22 | //根据兴趣id 查询 兴趣信息 23 | TasteVo findTasteById(Integer id) throws Exception; 24 | //根据用户id 查询 兴趣信息 25 | List findTastesByUid(Integer id) throws Exception; 26 | //分页查询所有兴趣信息 27 | List findTasteList(Integer start, Integer num) throws Exception; 28 | //根据兴趣查询 兴趣信息 返回多个用户id , id 进行从小到大排序 29 | Set findTasteByLabel(@Param("label") String label) throws Exception; 30 | //根据兴趣信息和用户id 查询是否具有改兴趣 , 查询id即可 31 | Integer findTasteByUidAndLabel(@Param("label") String label,@Param("uid") Integer uid) throws Exception; 32 | 33 | /** 34 | * ---------------------------------- 35 | * 添加 36 | */ 37 | //根据用户兴趣和用户id 进行添加 38 | Integer insertTasteByUidAndLabel(@Param("label") String label,@Param("uid") Integer uid) throws Exception; 39 | 40 | /** 41 | * ---------------------------------- 42 | * 修改 43 | */ 44 | //根据兴趣id 进行修改兴趣信息 45 | Integer updateTasteById(@Param("label") String label,@Param("id") Integer id) throws Exception; 46 | 47 | /** 48 | * ---------------------------------- 49 | * 删除 50 | */ 51 | //根据兴趣id , 删除改兴趣 ,直接删除 52 | Integer deleteTasteById(Integer id) throws Exception; 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /yuannews-dao/src/main/java/yuan/ssm/dao/manager/TasteManagerMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 21 | 22 | 25 | 26 | 39 | 40 | 43 | 44 | 47 | 48 | 49 | 50 | INSERT INTO taste(label,uid) VALUES (#{label},#{uid}) 51 | 52 | 53 | 54 | UPDATE taste SET label=#{label} WHERE id=#{id} 55 | 56 | 57 | 58 | DELETE FROM taste WHERE id=#{id} 59 | 60 | 61 | -------------------------------------------------------------------------------- /yuannews-dao/src/main/java/yuan/ssm/dao/manager/UserManagerMapper.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.dao.manager; 2 | 3 | import org.apache.ibatis.annotations.Param; 4 | import yuan.ssm.vo.UserVo; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by yuan on 16-3-30. 10 | * 用户管理 : mapper 11 | */ 12 | public interface UserManagerMapper { 13 | 14 | 15 | 16 | 17 | /** 18 | * --------------------------------------------------------------- 19 | * 查询 20 | */ 21 | 22 | //根据用户id,获得用户信息 23 | UserVo findUserById(Integer id) throws Exception; 24 | //分页查询,用户所有信息 25 | List findPageIndexUsers(Integer pageIndex, Integer pageNum) throws Exception; 26 | //登陆查询 ,查询账号是否存在 27 | Integer findUserByUnum(@Param("unum") String unum) throws Exception; 28 | //登陆查询 ,根据账号查询密码 29 | UserVo findUserByUnumPass(@Param("unum") String unum,@Param("pass") String pass) throws Exception; 30 | 31 | /** 32 | * --------------------------------------------------------------- 33 | * 修改 34 | */ 35 | //修改用户的状态 0: 用户 ; 1 :管理员 , 2: xxx 36 | Integer updateUserStatus(Integer id,Integer status) throws Exception; 37 | //修改用户性别 0: 男 ,1 :女 , 2:未知 38 | Integer updateUserSex(Integer id,Integer sex) throws Exception; 39 | //修改用户头像 40 | Integer updateUserHead(@Param("id") Integer id,@Param("img") String img) throws Exception; 41 | //修改密码 42 | Integer updateUserPass(@Param("id") Integer id,@Param("pass") String pass) throws Exception; 43 | //修改昵称 44 | Integer updateUserNick(@Param("id") Integer id,@Param("nick") String nick) throws Exception; 45 | 46 | /** 47 | * --------------------------------------------------------------- 48 | * 删除 49 | */ 50 | 51 | //删除用户 : 修改 status 状态为 -1 ; 52 | Integer deleteUserById(Integer id,Integer status) throws Exception; 53 | 54 | /** 55 | * --------------------------------------------------------------- 56 | * 添加 57 | */ 58 | Integer insertUser(UserVo user) throws Exception; 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /yuannews-dao/src/main/java/yuan/ssm/dao/manager/UserManagerMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 16 | 17 | 18 | 21 | 22 | 25 | 26 | 27 | update user set status=#{1} where id=#{0} 28 | 29 | 30 | 31 | update user set sex=#{1} where id=#{0} 32 | 33 | 34 | 35 | update user set head=#{img} where id=${id} 36 | 37 | 38 | 39 | update user set pass=#{pass} where id =${id} 40 | 41 | 42 | 43 | update user set nick=#{nick} WHERE id =#{id} 44 | 45 | 46 | 47 | update user set status=#{1} where id=#{0}; 48 | 49 | 50 | 51 | insert into user(unum,pass,nick,head) VALUES (#{unum},#{pass},#{nick},#{head}) 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /yuannews-dao/src/test/java/common/ManagerBaseTest.java: -------------------------------------------------------------------------------- 1 | package common; 2 | 3 | import org.junit.Before; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.support.ClassPathXmlApplicationContext; 6 | 7 | /** 8 | * Created by yuan on 16-4-4. 9 | * 初始化 base类 10 | */ 11 | public class ManagerBaseTest { 12 | 13 | public ApplicationContext context; 14 | 15 | @Before 16 | public void setUp(){ 17 | context=new ClassPathXmlApplicationContext(MapperContanst.APPLIACTION_CONTEXT_LOCATION); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /yuannews-dao/src/test/java/common/MapperContanst.java: -------------------------------------------------------------------------------- 1 | package common; 2 | 3 | /** 4 | * Created by yuan on 16-4-1. 5 | * mapper 测试常量类 6 | */ 7 | public interface MapperContanst { 8 | 9 | String APPLIACTION_CONTEXT_LOCATION="classpath:spring/applicationContext-dao.xml"; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /yuannews-dao/src/test/java/mapper/Customer/CustomerBaseTest.java: -------------------------------------------------------------------------------- 1 | package mapper.Customer; 2 | 3 | import common.ManagerBaseTest; 4 | import yuan.ssm.dao.customer.CateNewsMapper; 5 | import yuan.ssm.dao.customer.NewsMapper; 6 | import yuan.ssm.dao.customer.SourceNewsMapper; 7 | import yuan.ssm.dao.customer.UserMapper; 8 | 9 | 10 | /** 11 | * Create by yuanmingzhuo on 16/04/25 12 | * 创建测试客户基础类,用来创建bean 13 | * */ 14 | public class CustomerBaseTest extends ManagerBaseTest{ 15 | 16 | protected NewsMapper newsMapper; 17 | protected UserMapper userMapper; 18 | protected CateNewsMapper cateNewsMapper; 19 | protected SourceNewsMapper sourceNewsMapper; 20 | 21 | @Override 22 | public void setUp() { 23 | super.setUp(); 24 | newsMapper= (NewsMapper) super.context.getBean("newsMapper"); 25 | userMapper= (UserMapper) super.context.getBean("userMapper"); 26 | cateNewsMapper= (CateNewsMapper) super.context.getBean("cateNewsMapper"); 27 | sourceNewsMapper= (SourceNewsMapper) super.context.getBean("sourceNewsMapper"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /yuannews-dao/src/test/java/mapper/manager/CateManagerTest.java: -------------------------------------------------------------------------------- 1 | package mapper.manager; 2 | 3 | 4 | import common.ManagerBaseTest; 5 | import org.junit.Before; 6 | import org.junit.Test; 7 | import yuan.ssm.dao.manager.CateManagerMapper; 8 | import yuan.ssm.vo.CateVo; 9 | import java.util.List; 10 | 11 | /** 12 | * Created by yuan on 16-4-1. 13 | * 分类信息管理 - 单元测试 实现 14 | */ 15 | public class CateManagerTest extends ManagerBaseTest { 16 | 17 | private CateManagerMapper managerMapper; 18 | 19 | @Before 20 | public void setUp() { 21 | super.setUp(); 22 | managerMapper= (CateManagerMapper) super.context.getBean("cateManagerMapper"); 23 | } 24 | 25 | /** 26 | * 通过id,查询分类信息 27 | */ 28 | @Test 29 | public void findCateById() throws Exception{ 30 | CateVo cateById = managerMapper.findCateById(1); 31 | System.out.printf("分类测试结果 : "+cateById); 32 | } 33 | 34 | 35 | /** 36 | * 查询所有的分类信息 37 | */ 38 | @Test 39 | public void findCates() throws Exception{ 40 | List cates = managerMapper.findCates(); 41 | System.out.printf("分类测试结果 : "+cates.toString()); 42 | } 43 | 44 | /** 45 | * 修改分类信息,没有的话 返回 0 46 | */ 47 | @Test 48 | public void updateCate() throws Exception{ 49 | Integer result = managerMapper.updateCate(3, "笑话"); 50 | System.out.printf("分类测试结果 : "+result + (result>0?"成功":"失败")); 51 | } 52 | 53 | /** 54 | * 删除分类 ,直接删除 ,找不到 返回 0 ,删除成功为 1 55 | */ 56 | @Test 57 | public void deleteCate() throws Exception{ 58 | Integer result = managerMapper.deleteCate(6); 59 | System.out.printf("分类测试结果 : "+result + (result>0?"成功":"失败")); 60 | } 61 | 62 | /** 63 | * 添加分类信息 64 | */ 65 | @Test 66 | public void insertCate() throws Exception{ 67 | Integer result = managerMapper.insertCate("我是测试专家"); 68 | System.out.printf("分类测试结果 : "+result + (result>0?"成功":"失败")); 69 | } 70 | 71 | 72 | 73 | 74 | 75 | 76 | } 77 | -------------------------------------------------------------------------------- /yuannews-dao/src/test/java/mapper/manager/CommentManagerTest.java: -------------------------------------------------------------------------------- 1 | package mapper.manager; 2 | 3 | import common.ManagerBaseTest; 4 | import common.MapperContanst; 5 | import org.junit.Before; 6 | import org.junit.Test; 7 | import org.springframework.context.support.ClassPathXmlApplicationContext; 8 | import yuan.ssm.dao.manager.CommentManagerMapper; 9 | import yuan.ssm.pojo.CommentPo; 10 | 11 | /** 12 | * Created by yuan on 16-4-4. 13 | * 评论管理- 单元测试 14 | */ 15 | public class CommentManagerTest extends ManagerBaseTest{ 16 | 17 | private CommentManagerMapper commentManagerMapper; 18 | 19 | @Before 20 | public void setUp(){ 21 | super.setUp(); 22 | commentManagerMapper= (CommentManagerMapper) super.context.getBean("commentManagerMapper"); 23 | } 24 | 25 | /** 26 | * 根据id , 查询评论 27 | */ 28 | @Test 29 | public void findCommentById() throws Exception{ 30 | CommentPo commentPo = commentManagerMapper.findCommentById(1); 31 | System.out.printf("评论管理测试 : "+commentPo); 32 | } 33 | 34 | /** 35 | * 修改评论状态 36 | */ 37 | @Test 38 | public void updateCommentStatus() throws Exception{ 39 | Integer status = commentManagerMapper.updateCommentStatus(1, 0); 40 | System.out.printf("评论管理测试 : "+status +(status>0?"成功":"失败")); 41 | } 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /yuannews-dao/src/test/java/mapper/manager/LikedManagerTest.java: -------------------------------------------------------------------------------- 1 | package mapper.manager; 2 | 3 | import common.ManagerBaseTest; 4 | import org.junit.Before; 5 | import org.junit.Test; 6 | import yuan.ssm.dao.manager.LikedManagerMapper; 7 | import yuan.ssm.pojo.LikedPo; 8 | import java.util.List; 9 | 10 | /** 11 | * Created by yuan on 16-4-4. 12 | * 后台管理 - 点赞管理 - 单元测试 13 | */ 14 | public class LikedManagerTest extends ManagerBaseTest { 15 | 16 | private LikedManagerMapper likedManagerMapper; 17 | 18 | @Before 19 | public void setUp(){ 20 | super.setUp(); 21 | likedManagerMapper= (LikedManagerMapper) context.getBean("likedManagerMapper"); 22 | } 23 | 24 | /** 25 | * 分页查询 26 | */ 27 | @Test 28 | public void findLikeds() throws Exception{ 29 | List likeds = likedManagerMapper.findLikeds(0, 2); 30 | System.out.printf("点赞测试结果 :"+likeds); 31 | } 32 | 33 | /** 34 | * 查询不到 null, 查询结果为id 35 | */ 36 | @Test 37 | public void findLikedByNidUid() throws Exception{ 38 | Integer id = likedManagerMapper.findLikedByNidUid(1, 2); 39 | System.out.printf("点赞测试结果 :"+id); 40 | } 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /yuannews-dao/src/test/java/mapper/manager/ManagerCountTest.java: -------------------------------------------------------------------------------- 1 | package mapper.manager; 2 | 3 | import common.ManagerBaseTest; 4 | import org.junit.Before; 5 | import org.junit.Test; 6 | import yuan.ssm.dao.manager.ManagerCountMapper; 7 | import yuan.ssm.other.PageJo; 8 | 9 | /** 10 | * Created by yuan on 16-4-7. 11 | * 后台管理-统计相关-测试类 12 | */ 13 | public class ManagerCountTest extends ManagerBaseTest{ 14 | 15 | 16 | private ManagerCountMapper managerCountMapper; 17 | 18 | @Before 19 | public void setUp(){ 20 | super.setUp(); 21 | managerCountMapper= (ManagerCountMapper) context.getBean("managerCountMapper"); 22 | } 23 | 24 | @Test 25 | public void findUserCount() throws Exception { 26 | PageJo pageJo = managerCountMapper.findCount(3); 27 | System.out.println("查询结果为 : "+pageJo.getAllCount()); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /yuannews-dao/src/test/java/mapper/manager/SourceManagerTest.java: -------------------------------------------------------------------------------- 1 | package mapper.manager; 2 | 3 | 4 | import common.ManagerBaseTest; 5 | import org.junit.Test; 6 | import yuan.ssm.dao.manager.SourceManagerMapper; 7 | import yuan.ssm.vo.SourceVo; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by yuan on 16-4-4. 13 | * 后台管理-来源管理-单元测试 14 | */ 15 | public class SourceManagerTest extends ManagerBaseTest { 16 | 17 | private SourceManagerMapper sourceManagerMapper; 18 | 19 | @Override 20 | public void setUp() { 21 | super.setUp(); 22 | sourceManagerMapper= (SourceManagerMapper) super.context.getBean("sourceManagerMapper"); 23 | } 24 | 25 | @Test 26 | public void findSources() throws Exception { 27 | List sources = sourceManagerMapper.findSources(0, 4); 28 | System.out.printf("来源测试 : "+sources); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /yuannews-datacenter/REDEME.md: -------------------------------------------------------------------------------- 1 | #datacenter 使用方法 2 | 3 | #新添加数据源实现流程 4 | * 1.实现LoadUtil类 继承 LoaderBase基类; 5 | * 2.实现ParseUtil类 继承 ParserBase基类; 6 | * 3.实现data类 继承 GetDataBase基类; 7 | * 4.ParseIndex类中,实现主页url解析方法; 8 | 9 | * 5.执行方法:三步即可 10 | ``` 11 | //1.实现主页加载类 12 | HuxiuLoader huxiuLoader=new HuxiuLoader(IndexUrl); 13 | 14 | //2.实现线程池 15 | ThreadPoolHttpClient threadPoolHttpClient=new ThreadPoolHttpClient(huxiuLoader); 16 | 17 | //3.执行开始操作 18 | threadPoolHttpClient.start(); 19 | ``` -------------------------------------------------------------------------------- /yuannews-datacenter/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | yuannews 7 | cn.edu.hpu.yuannews 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | 13 | yuannews-datacenter 14 | jar 15 | 16 | 17 | 18 | 19 | org.jsoup 20 | jsoup 21 | 1.9.1 22 | 23 | 24 | 25 | org.apache.httpcomponents 26 | httpclient 27 | 4.2 28 | 29 | 30 | 31 | cn.edu.hpu.yuannews 32 | yuannews-dao 33 | 1.0-SNAPSHOT 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/DataMain.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter; 2 | 3 | import yuan.ssm.datacenter.LoadUtil.ChinaNewsLoader; 4 | import yuan.ssm.datacenter.LoadUtil.HuanQiuLoader; 5 | import yuan.ssm.datacenter.LoadUtil.HuxiuLoader; 6 | import yuan.ssm.datacenter.base.ThreadPoolHttpClient; 7 | import yuan.ssm.datacenter.datasource.HuanQiuSource; 8 | import yuan.ssm.datacenter.datasource.HuxiuSource; 9 | 10 | import java.io.IOException; 11 | 12 | /** 13 | * ================================================== 14 | *

15 | * 版权: 软件工程.net12-1 原明卓 16 | *

17 | * 项目: 基于用户兴趣标签的新闻推荐系统 18 | *

19 | * 作者: 原明卓 20 | *

21 | * 版本: 1.0 22 | *

23 | * 创建日期: 16-5-4 上午9:59 24 | *

25 | * 功能描述: TODO 总执行操作类 26 | *

27 | *

28 | * 功能更新历史: 29 | *

30 | * ================================================== 31 | */ 32 | public class DataMain { 33 | 34 | 35 | 36 | 37 | public static void main(String[] args) throws IOException, InterruptedException { 38 | 39 | // getChinaNewsData(ChinaNewsSource.getChinaNewsPageIndex(),"中国新闻网主页");//中国新闻网主页爬去 40 | 41 | // 42 | getHuanQiuData(HuanQiuSource.getHuanQiuIndexUrl(),"环球网主页"); //环球网主页爬取 43 | 44 | Thread.sleep(2000); 45 | 46 | getHuXiuData(HuxiuSource.getHuxiuIndexUrl(),"虎嗅主页");//虎嗅主页爬取 47 | 48 | // HuanQiuSource.testHuanQiuIndexPage(); 49 | 50 | } 51 | 52 | /** 53 | * 虎嗅的数据爬去方法 54 | * @param url 55 | */ 56 | private static synchronized void getChinaNewsData(String url, String source) { 57 | //1.实现主页加载类 58 | 59 | ChinaNewsLoader chinaNewsLoader=new ChinaNewsLoader(url); 60 | 61 | //2.实现线程池 62 | ThreadPoolHttpClient threadPoolHttpClient=new ThreadPoolHttpClient(chinaNewsLoader,source); 63 | 64 | //3.执行开始操作 65 | threadPoolHttpClient.start(); 66 | } 67 | 68 | 69 | /** 70 | * 虎嗅的数据爬去方法 71 | * @param url 72 | */ 73 | private static synchronized void getHuXiuData(String url,String source) { 74 | //1.实现主页加载类 75 | HuxiuLoader huxiuLoader=new HuxiuLoader(url); 76 | 77 | //2.实现线程池 78 | ThreadPoolHttpClient threadPoolHttpClient=new ThreadPoolHttpClient(huxiuLoader,source); 79 | 80 | //3.执行开始操作 81 | threadPoolHttpClient.start(); 82 | } 83 | 84 | 85 | /** 86 | * 环球的数据爬去方法 87 | * @param url 88 | * @param source 89 | */ 90 | private static synchronized void getHuanQiuData(String url,String source) { 91 | //1.实现主页加载类 92 | HuanQiuLoader huanQiuLoader=new HuanQiuLoader(url); 93 | 94 | //2.实现线程池 95 | ThreadPoolHttpClient threadPoolHttpClient=new ThreadPoolHttpClient(huanQiuLoader,source); 96 | 97 | //3.执行开始操作 98 | threadPoolHttpClient.start(); 99 | } 100 | 101 | 102 | } 103 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/LoadUtil/ChinaNewsLoader.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.LoadUtil; 2 | 3 | import yuan.ssm.datacenter.ParseUtil.ParseIndex; 4 | import yuan.ssm.datacenter.base.LoaderBase; 5 | import yuan.ssm.datacenter.base.SourceEnum; 6 | 7 | import java.util.Set; 8 | 9 | /** 10 | * ================================================== 11 | *

12 | * 版权: 软件工程.net12-1 原明卓 13 | *

14 | * 项目: 基于用户兴趣标签的新闻推荐系统 15 | *

16 | * 作者: 原明卓 17 | *

18 | * 版本: 1.0 19 | *

20 | * 创建日期: 16-5-6 上午10:40 21 | *

22 | * 功能描述: ChinaNews 中国新闻网,主页加载类 23 | * (1)数据类型 24 | * (2)返回url 25 | *

26 | *

27 | * 功能更新历史: 28 | *

29 | * ================================================== 30 | */ 31 | public class ChinaNewsLoader extends LoaderBase{ 32 | 33 | public ChinaNewsLoader(String url) { 34 | super(url); 35 | } 36 | 37 | /** 38 | * 一定要要在返回的时候,cleanurls,不然会重复数据 39 | * @return 40 | */ 41 | protected Set getUrls() { 42 | return cleanUrls(ParseIndex.getChinaNewsUrls(getDoc()),getType().toString()); 43 | } 44 | 45 | protected SourceEnum getType() { 46 | return SourceEnum.chinanews; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/LoadUtil/HuanQiuLoader.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.LoadUtil; 2 | 3 | import yuan.ssm.datacenter.ParseUtil.ParseIndex; 4 | import yuan.ssm.datacenter.base.LoaderBase; 5 | import yuan.ssm.datacenter.base.SourceEnum; 6 | 7 | import java.util.Set; 8 | 9 | /** 10 | * ================================================== 11 | *

12 | * 版权: 软件工程.net12-1 原明卓 13 | *

14 | * 项目: 基于用户兴趣标签的新闻推荐系统 15 | *

16 | * 作者: 原明卓 17 | *

18 | * 版本: 1.0 19 | *

20 | * 创建日期: 16-5-4 上午9:57 21 | *

22 | * 功能描述:环球新闻主页加载类,返回urls 23 | *

24 | *

25 | * 功能更新历史: 26 | *

27 | * ================================================== 28 | */ 29 | public class HuanQiuLoader extends LoaderBase { 30 | 31 | 32 | public HuanQiuLoader(String url) { 33 | super(url); 34 | } 35 | 36 | protected Set getUrls() { 37 | return cleanUrls(ParseIndex.getHuanQiuUrls(super.getDoc()), SourceEnum.huanqiu.toString()); 38 | } 39 | 40 | protected SourceEnum getType() { 41 | return SourceEnum.huanqiu; 42 | } 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/LoadUtil/HuxiuLoader.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.LoadUtil; 2 | 3 | import yuan.ssm.datacenter.ParseUtil.ParseIndex; 4 | import yuan.ssm.datacenter.base.LoaderBase; 5 | import yuan.ssm.datacenter.base.SourceEnum; 6 | 7 | import java.util.Set; 8 | 9 | /** 10 | * ================================================== 11 | *

12 | * 版权: 软件工程.net12-1 原明卓 13 | *

14 | * 项目: 基于用户兴趣标签的新闻推荐系统 15 | *

16 | * 作者: 原明卓 17 | *

18 | * 版本: 1.0 19 | *

20 | * 创建日期: 16-5-4 下午2:03 21 | *

22 | * 功能描述: 虎嗅数据加载 23 | * 1.使用 24 | *

25 | *

26 | * 功能更新历史: 27 | *

28 | * ================================================== 29 | */ 30 | public class HuxiuLoader extends LoaderBase{ 31 | 32 | 33 | public HuxiuLoader(String url) { 34 | super(url); 35 | } 36 | 37 | /** 38 | * 注意,在进行返回url的时候,需求去重复的url,防止多余的爬虫和数据 39 | * @return 40 | */ 41 | protected Set getUrls() { 42 | //调式urls本地存储方式 43 | // Set stringSet = cleanUrls(ParseIndex.getHuXiuPageUrls(super.getDoc()), SourceEnum.huxiu.toString()); 44 | // LoggerUtil.printJSON(stringSet); 45 | // return null; 46 | return cleanUrls(ParseIndex.getHuXiuPageUrls(super.getDoc()),SourceEnum.huxiu.toString()); 47 | } 48 | 49 | protected SourceEnum getType() { 50 | return SourceEnum.huxiu; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/ParseUtil/ChinaNewsParser.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.ParseUtil; 2 | 3 | import org.jsoup.nodes.Element; 4 | import org.jsoup.select.Elements; 5 | import yuan.ssm.common.util.DateUtil; 6 | import yuan.ssm.datacenter.base.EncodeEnum; 7 | import yuan.ssm.datacenter.base.ParserBase; 8 | import yuan.ssm.datacenter.base.SourceEnum; 9 | import yuan.ssm.datacenter.common.CSCommon; 10 | import yuan.ssm.datacenter.common.UrlsContanst; 11 | import yuan.ssm.vo.NewsVo; 12 | 13 | import java.io.InputStream; 14 | 15 | /** 16 | * ================================================== 17 | *

18 | * 版权: 软件工程.net12-1 原明卓 19 | *

20 | * 项目: 基于用户兴趣标签的新闻推荐系统 21 | *

22 | * 作者: 原明卓 23 | *

24 | * 版本: 1.0 25 | *

26 | * 创建日期: 16-5-6 上午10:37 27 | *

28 | * 功能描述: ChinaNews详情页解析类 29 | *

30 | *

31 | * 功能更新历史: 32 | *

33 | * ================================================== 34 | */ 35 | public class ChinaNewsParser extends ParserBase{ 36 | 37 | 38 | public ChinaNewsParser(InputStream inputStream, String url) { 39 | super(inputStream, url); 40 | } 41 | 42 | //解析详情页 43 | protected NewsVo parserDetailPage() { 44 | NewsVo newsVo=new NewsVo(); 45 | 46 | String time="2016年05月06日 13:16"; 47 | 48 | String title = doc.select("h1").get(0).text();//标题 49 | String dt= DateUtil.getDate(); //时间 50 | Elements select = doc.select(".left-t"); 51 | for(Element element:select){ 52 | if(element.text().contains("年")){ 53 | dt=element.text().trim().substring(0,time.length()); 54 | break; 55 | } 56 | } 57 | String img=""; 58 | Elements imgs = doc.select("img"); 59 | for (Element element:imgs){ 60 | img=element.attr("src"); 61 | if(!img.contains("http:") && !img.startsWith("/fileftp")){ 62 | break; 63 | } 64 | } 65 | 66 | String content = doc.select(".left_zw").get(0).text(); 67 | 68 | newsVo.setSid(CSCommon.getSourceId(getType())); 69 | newsVo.setCid(CSCommon.getCateId()); 70 | newsVo.setDt(dt); 71 | newsVo.setRnum(121); 72 | newsVo.setTitle(title); 73 | newsVo.setContent(content); 74 | newsVo.setImg(UrlsContanst.CHINA_BASE_URL+img); 75 | 76 | return newsVo; 77 | } 78 | 79 | protected SourceEnum getType() { 80 | return SourceEnum.chinanews; 81 | } 82 | 83 | protected EncodeEnum getEncode() { 84 | return EncodeEnum.gbk; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/ParseUtil/HuanQiuParser.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.ParseUtil; 2 | 3 | import org.jsoup.nodes.Element; 4 | import org.jsoup.select.Elements; 5 | import yuan.ssm.datacenter.base.EncodeEnum; 6 | import yuan.ssm.datacenter.base.ParserBase; 7 | import yuan.ssm.datacenter.base.SourceEnum; 8 | import yuan.ssm.datacenter.common.CSCommon; 9 | import yuan.ssm.vo.NewsVo; 10 | 11 | import java.io.InputStream; 12 | 13 | 14 | /** 15 | * ================================================== 16 | *

17 | * 版权: 软件工程.net12-1 原明卓 18 | *

19 | * 项目: 基于用户兴趣标签的新闻推荐系统 20 | *

21 | * 作者: 原明卓 22 | *

23 | * 版本: 1.0 24 | *

25 | * 创建日期: 16-5-4 上午9:57 26 | *

27 | * 功能描述: 环球网新闻解析类 28 | * 29 | *

30 | *

31 | * 功能更新历史: 32 | *

33 | * ================================================== 34 | */ 35 | public class HuanQiuParser extends ParserBase{ 36 | 37 | public HuanQiuParser(InputStream inputStream, String url) { 38 | super(inputStream, url); 39 | } 40 | 41 | protected NewsVo parserDetailPage() { 42 | 43 | String title=doc.select("h1").get(0).text(); 44 | String dt=doc.select("#pubtime_baidu").text(); 45 | String img=""; 46 | Elements imgs = doc.select("img"); 47 | for(Element i : imgs){ 48 | img=i.attr("src"); 49 | if(img.contains("huanqiu.com")){ 50 | break; 51 | } 52 | } 53 | StringBuffer buffer=new StringBuffer(); 54 | Elements elements = doc.select("#text p"); 55 | for(Element element : elements){ 56 | buffer.append("  " + element.text()+" \n "); 57 | } 58 | 59 | String content=buffer.toString(); 60 | if(content.length()==0){ 61 | content=doc.select("#text").text(); 62 | } 63 | 64 | NewsVo newsVo=new NewsVo(); 65 | newsVo.setImg(img); 66 | newsVo.setRnum(102); 67 | newsVo.setContent(content); 68 | newsVo.setDt(dt); 69 | newsVo.setTitle(title); 70 | newsVo.setCid(CSCommon.getCateId()); 71 | newsVo.setSid(CSCommon.getSourceId(getType())); 72 | 73 | return newsVo; 74 | } 75 | 76 | protected SourceEnum getType() { 77 | return SourceEnum.huanqiu; 78 | } 79 | 80 | protected EncodeEnum getEncode() { 81 | return EncodeEnum.utf; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/ParseUtil/HuxiuParser.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.ParseUtil; 2 | 3 | import org.jsoup.nodes.Element; 4 | import org.jsoup.select.Elements; 5 | import yuan.ssm.datacenter.base.EncodeEnum; 6 | import yuan.ssm.datacenter.base.ParserBase; 7 | import yuan.ssm.datacenter.base.SourceEnum; 8 | import yuan.ssm.datacenter.common.CSCommon; 9 | import yuan.ssm.vo.NewsVo; 10 | 11 | import java.io.InputStream; 12 | 13 | /** 14 | * ================================================== 15 | *

16 | * 版权: 软件工程.net12-1 原明卓 17 | *

18 | * 项目: 基于用户兴趣标签的新闻推荐系统 19 | *

20 | * 作者: 原明卓 21 | *

22 | * 版本: 1.0 23 | *

24 | * 创建日期: 16-5-4 下午1:52 25 | *

26 | * 功能描述: 虎嗅网内容解析类 27 | * 1.解析主页 28 | * 2.解析内容页 29 | *

30 | *

31 | * 功能更新历史: 32 | *

33 | * ================================================== 34 | */ 35 | public class HuxiuParser extends ParserBase{ 36 | 37 | /** 38 | * 初始化 39 | * @param inputStream 数据流 40 | * @param url 当前url 41 | */ 42 | public HuxiuParser(InputStream inputStream, String url) { 43 | super(inputStream, url); 44 | } 45 | 46 | /** 47 | * 解析操作 48 | * @return 49 | */ 50 | protected NewsVo parserDetailPage() { 51 | 52 | NewsVo newsVo=new NewsVo(); 53 | 54 | Elements title= doc.select("title");//主题 55 | String str = title.first().text().replace("-看点-@虎嗅网", ""). 56 | replace("-观点-@虎嗅网", "").replace("-读点-@虎嗅网", ""); 57 | String dt=doc.select(".article-time").text(); // 发帖时间 58 | String content= doc.select("#article_content").get(0).text();//内容 59 | String img=""; 60 | 61 | String cate = doc.select(".column-link").get(0).text(); 62 | 63 | Elements imgs = doc.select("img"); 64 | 65 | for (Element element:imgs){ 66 | String attr = element.attr("src"); 67 | if(attr.contains("w/800/h/450")){ 68 | img=attr; 69 | } 70 | } 71 | newsVo.setTitle(str); 72 | newsVo.setDt(dt); 73 | newsVo.setImg(img); 74 | newsVo.setContent(content); 75 | newsVo.setRnum(100); 76 | newsVo.setCid(CSCommon.getCateId(cate)); 77 | newsVo.setSid(CSCommon.getSourceId(SourceEnum.huxiu)); 78 | 79 | return newsVo; 80 | } 81 | 82 | protected SourceEnum getType() { 83 | return SourceEnum.huxiu; 84 | } 85 | 86 | protected EncodeEnum getEncode() { 87 | return EncodeEnum.utf; 88 | } 89 | 90 | 91 | } 92 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/base/EncodeEnum.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.base; 2 | 3 | /** 4 | * ================================================== 5 | *

6 | * 版权: 软件工程.net12-1 原明卓 7 | *

8 | * 项目: 基于用户兴趣标签的新闻推荐系统 9 | *

10 | * 作者: 原明卓 11 | *

12 | * 版本: 1.0 13 | *

14 | * 创建日期: 16-5-6 上午11:31 15 | *

16 | * 功能描述:请求下来的网页,指定编码 17 | *

18 | *

19 | * 功能更新历史: 20 | *

21 | * ================================================== 22 | */ 23 | public enum EncodeEnum { 24 | utf,gbk 25 | } 26 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/base/GetDataBase.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.base; 2 | 3 | import org.apache.http.HttpEntity; 4 | import org.apache.http.HttpResponse; 5 | import org.apache.http.client.HttpClient; 6 | import org.apache.http.client.methods.HttpGet; 7 | import org.apache.http.protocol.BasicHttpContext; 8 | import org.apache.http.protocol.HttpContext; 9 | import org.apache.http.util.EntityUtils; 10 | import yuan.ssm.common.util.LoggerUtil; 11 | 12 | import java.io.InputStream; 13 | 14 | 15 | /** 16 | * ================================================== 17 | *

18 | * 版权: 软件工程.net12-1 原明卓 19 | *

20 | * 项目: 基于用户兴趣标签的新闻推荐系统 21 | *

22 | * 作者: 原明卓 23 | *

24 | * 版本: 1.0 25 | *

26 | * 创建日期: 16-5-4 下午1:35 27 | *

28 | * 功能描述:详情请求类: 抽象出请求类,添加解析抽象方法 29 | *

30 | *

31 | * 功能更新历史: 32 | *

33 | * ================================================== 34 | */ 35 | public abstract class GetDataBase implements Runnable{ 36 | 37 | private final int SUCCESS_CODE=200; 38 | private final HttpClient httpClient; 39 | private final HttpContext context; 40 | private final HttpGet httpget; 41 | 42 | public GetDataBase(HttpClient httpClient, HttpGet httpget) { 43 | this.httpClient = httpClient; 44 | this.context = new BasicHttpContext(); 45 | this.httpget = httpget; 46 | } 47 | public void run(){ 48 | try { 49 | Thread.sleep(5000); 50 | } catch (InterruptedException e) { 51 | LoggerUtil.printJSON("HuanQiuGetData Thread.sleep Exception"); 52 | e.printStackTrace(); 53 | } 54 | get(); 55 | } 56 | 57 | public void get() { 58 | try { 59 | HttpResponse response = this.httpClient.execute(this.httpget, this.context); 60 | HttpEntity entity = response.getEntity(); 61 | if (entity != null) { 62 | LoggerUtil.printJSON(this.httpget.getURI()+": status"+response.getStatusLine().toString()); 63 | if(response.getStatusLine().getStatusCode()==SUCCESS_CODE){ 64 | //执行解析:传入解析类对象 65 | parserDetailToDb(parserDetailMethod(entity.getContent(),this.httpget.getURI().toString())); 66 | }else { 67 | LoggerUtil.printJSON(this.httpget.getURI()+": response code : "+response.getStatusLine().getStatusCode()); 68 | } 69 | }else { 70 | LoggerUtil.printJSON(this.httpget.getURI()+": HttpEntity is null"); 71 | } 72 | // 回收 73 | EntityUtils.consume(entity); 74 | } catch (Exception ex) { 75 | this.httpget.abort(); 76 | }finally{ 77 | httpget.releaseConnection(); 78 | } 79 | } 80 | 81 | /** 82 | * 执行的存储操作,多种存储方式 83 | * @param parserBase 解析基类 84 | */ 85 | protected abstract void parserDetailToDb(ParserBase parserBase); 86 | 87 | /** 88 | * 详情请求类是公共类,所以提供抽象方法,让用户自己提供解析方法 89 | * @param stream 数据流 90 | * @param url 当前地址 91 | * @return 92 | */ 93 | protected abstract ParserBase parserDetailMethod(InputStream stream,String url); 94 | 95 | } 96 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/base/SourceEnum.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.base; 2 | 3 | /** 4 | * ================================================== 5 | *

6 | * 版权: 软件工程.net12-1 原明卓 7 | *

8 | * 项目: 基于用户兴趣标签的新闻推荐系统 9 | *

10 | * 作者: 原明卓 11 | *

12 | * 版本: 1.0 13 | *

14 | * 创建日期: 16-5-4 下午1:19 15 | *

16 | * 功能描述: 来源枚举类型 17 | * 如果需要更新,需要更新这里,否则无法进行爬取 18 | *

19 | *

20 | * 功能更新历史: 21 | *

22 | * ================================================== 23 | */ 24 | public enum SourceEnum { 25 | huanqiu,chinanews,huxiu 26 | } 27 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/common/CSCommon.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.common; 2 | 3 | import yuan.ssm.datacenter.base.SourceEnum; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | import java.util.Random; 8 | 9 | /** 10 | * ================================================== 11 | *

12 | * 版权: 软件工程.net12-1 原明卓 13 | *

14 | * 项目: 基于用户兴趣标签的新闻推荐系统 15 | *

16 | * 作者: 原明卓 17 | *

18 | * 版本: 1.0 19 | *

20 | * 创建日期: 16-5-4 下午4:02 21 | *

22 | * 功能描述: 分类工具类 23 | * 1.虎嗅 24 | * 2.环球 25 | * 3. 26 | *

27 | *

28 | * 功能更新历史: 29 | *

30 | * ================================================== 31 | */ 32 | public class CSCommon { 33 | 34 | private static Random random=new Random(); 35 | private static Map cates=new HashMap(); 36 | 37 | static { 38 | cates.put("24小时",14); 39 | cates.put("车与出行",16); 40 | cates.put("娱乐淘金",17); 41 | cates.put("创业维艰",18); 42 | cates.put("生活腔调",19); 43 | cates.put("社会百科",20); 44 | cates.put("时局政治",21); 45 | cates.put("科技先行",22); 46 | cates.put("体育先锋",23); 47 | random=new Random(); 48 | } 49 | 50 | /** 51 | * 得到来源信息 52 | * @param word 53 | * @return 54 | */ 55 | public static int getSourceId(SourceEnum word){ 56 | switch (word){ 57 | case huxiu: 58 | return 8; 59 | case huanqiu: 60 | return 9; 61 | case chinanews: 62 | return 10; 63 | default: 64 | return 0; 65 | } 66 | } 67 | 68 | //得到分类信息 69 | public static int getCateId(String cate){ 70 | Integer cateId=cates.get(cate); 71 | if(cateId==null){ 72 | return 20; //默认分类为社会百科 73 | } 74 | return cateId; 75 | } 76 | 77 | public static int getCateId(){ 78 | return random.nextInt(8)+16; 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/common/IDataNotify.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.common; 2 | 3 | /** 4 | * ================================================== 5 | *

6 | * 版权: 软件工程.net12-1 原明卓 7 | *

8 | * 项目: 基于用户兴趣标签的新闻推荐系统 9 | *

10 | * 作者: 原明卓 11 | *

12 | * 版本: 1.0 13 | *

14 | * 创建日期: 16-5-4 下午11:54 15 | *

16 | * 功能描述: 执行完毕后执行,通知main函数,执行下一个任务 17 | *

18 | *

19 | * 功能更新历史: 20 | *

21 | * ================================================== 22 | */ 23 | public interface IDataNotify { 24 | 25 | void notifyMain(); 26 | } 27 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/common/UrlsContanst.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.common; 2 | 3 | /** 4 | * ================================================== 5 | *

6 | * 版权: 软件工程.net12-1 原明卓 7 | *

8 | * 项目: 基于用户兴趣标签的新闻推荐系统 9 | *

10 | * 作者: 原明卓 11 | *

12 | * 版本: 1.0 13 | *

14 | * 创建日期: 16-5-4 下午4:05 15 | *

16 | * 功能描述: url常量类 : 固定下来的常量,添加后不要修改,动态在datasource包下 17 | *

18 | *

19 | * 功能更新历史: 20 | *

21 | * ================================================== 22 | */ 23 | public interface UrlsContanst { 24 | 25 | /** 26 | * 虎嗅网基地址 最后不填加 斜杠 27 | */ 28 | String HUXIU_BASE_URL="http://www.huxiu.com"; 29 | 30 | /** 31 | * 中国新闻网地址 最后不添加 斜杠 32 | */ 33 | String CHINA_BASE_URL="http://www.chinanews.com"; 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/data/ChinaNewsGetData.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.data; 2 | 3 | import org.apache.http.client.HttpClient; 4 | import org.apache.http.client.methods.HttpGet; 5 | import yuan.ssm.datacenter.ParseUtil.ChinaNewsParser; 6 | import yuan.ssm.datacenter.base.GetDataBase; 7 | import yuan.ssm.datacenter.base.ParserBase; 8 | 9 | import java.io.InputStream; 10 | 11 | /** 12 | * ================================================== 13 | *

14 | * 版权: 软件工程.net12-1 原明卓 15 | *

16 | * 项目: 基于用户兴趣标签的新闻推荐系统 17 | *

18 | * 作者: 原明卓 19 | *

20 | * 版本: 1.0 21 | *

22 | * 创建日期: 16-5-6 上午10:35 23 | *

24 | * 功能描述: ChinaNews详情页获取-解析-操作类 25 | *

26 | *

27 | * 功能更新历史: 28 | *

29 | * ================================================== 30 | */ 31 | public class ChinaNewsGetData extends GetDataBase{ 32 | 33 | 34 | public ChinaNewsGetData(HttpClient httpClient, HttpGet httpget) { 35 | super(httpClient, httpget); 36 | } 37 | 38 | //解析后的操作 39 | protected void parserDetailToDb(ParserBase parserBase) { 40 | parserBase.toMysql(); 41 | parserBase.toLogPrint();//日志打印 42 | } 43 | 44 | //详情页解析类 45 | protected ParserBase parserDetailMethod(InputStream stream, String url) { 46 | return new ChinaNewsParser(stream,url); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/data/DataGetUtil.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.data; 2 | 3 | import org.apache.http.client.HttpClient; 4 | import org.apache.http.client.methods.HttpGet; 5 | import yuan.ssm.datacenter.base.SourceEnum; 6 | 7 | /** 8 | * ================================================== 9 | *

10 | * 版权: 软件工程.net12-1 原明卓 11 | *

12 | * 项目: 基于用户兴趣标签的新闻推荐系统 13 | *

14 | * 作者: 原明卓 15 | *

16 | * 版本: 1.0 17 | *

18 | * 创建日期: 16-5-4 下午1:22 19 | *

20 | * 功能描述: 根据来源创建 runnable对象,用来添加到线程池中 21 | * 1.添加其他来源需要更新这里 22 | *

23 | *

24 | * 功能更新历史: 25 | *

26 | * ================================================== 27 | */ 28 | public class DataGetUtil { 29 | 30 | public synchronized static Runnable getRunnable(HttpClient httpClient, HttpGet httpget, SourceEnum sourceEnum){ 31 | switch (sourceEnum){ 32 | case huanqiu: 33 | return new HuanQiuGetData(httpClient, httpget); 34 | case chinanews: 35 | return new ChinaNewsGetData(httpClient, httpget); 36 | case huxiu: 37 | return new HuxiuGetData(httpClient, httpget); 38 | default: 39 | return null; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/data/HuanQiuGetData.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.data; 2 | 3 | import org.apache.http.client.HttpClient; 4 | import org.apache.http.client.methods.HttpGet; 5 | import yuan.ssm.datacenter.ParseUtil.HuanQiuParser; 6 | import yuan.ssm.datacenter.base.GetDataBase; 7 | import yuan.ssm.datacenter.base.ParserBase; 8 | 9 | import java.io.InputStream; 10 | 11 | /** 12 | * ================================================== 13 | *

14 | * 版权: 软件工程.net12-1 原明卓 15 | *

16 | * 项目: 基于用户兴趣标签的新闻推荐系统 17 | *

18 | * 作者: 原明卓 19 | *

20 | * 版本: 1.0 21 | *

22 | * 创建日期: 16-5-4 上午9:52 23 | *

24 | * 功能描述:环球网新闻爬去数据执行类 25 | *

26 | *

27 | * 功能更新历史: 28 | *

29 | * ================================================== 30 | */ 31 | public class HuanQiuGetData extends GetDataBase{ 32 | 33 | 34 | public HuanQiuGetData(HttpClient httpClient, HttpGet httpget) { 35 | super(httpClient, httpget); 36 | } 37 | 38 | /** 39 | * 目前测试阶段,使用toLogPrint方法,控制台查看 40 | * @param parserBase 解析基类 41 | */ 42 | protected void parserDetailToDb(ParserBase parserBase) { 43 | parserBase.toMysql();//存数据库 44 | parserBase.toLogPrint();//日志打印 45 | } 46 | 47 | /** 48 | * 返回一个详情页解析类,进行解析操作 49 | * @param stream 数据流 50 | * @param url 当前地址 51 | * @return 52 | */ 53 | protected ParserBase parserDetailMethod(InputStream stream, String url) { 54 | return new HuanQiuParser(stream,url); 55 | } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/data/HuxiuGetData.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.data; 2 | 3 | import org.apache.http.client.HttpClient; 4 | import org.apache.http.client.methods.HttpGet; 5 | import yuan.ssm.datacenter.ParseUtil.HuxiuParser; 6 | import yuan.ssm.datacenter.base.GetDataBase; 7 | import yuan.ssm.datacenter.base.ParserBase; 8 | 9 | import java.io.InputStream; 10 | 11 | /** 12 | * ================================================== 13 | *

14 | * 版权: 软件工程.net12-1 原明卓 15 | *

16 | * 项目: 基于用户兴趣标签的新闻推荐系统 17 | *

18 | * 作者: 原明卓 19 | *

20 | * 版本: 1.0 21 | *

22 | * 创建日期: 16-5-4 下午1:49 23 | *

24 | * 功能描述: 虎嗅网数据获取类,返回虎嗅网详情页内容 25 | *

26 | *

27 | * 功能更新历史: 28 | *

29 | * ================================================== 30 | */ 31 | public class HuxiuGetData extends GetDataBase{ 32 | 33 | public HuxiuGetData(HttpClient httpClient, HttpGet httpget) { 34 | super(httpClient, httpget); 35 | } 36 | 37 | //初始化解析类 38 | protected ParserBase parserDetailMethod(InputStream stream, String url) { 39 | return new HuxiuParser(stream,url); 40 | } 41 | 42 | protected void parserDetailToDb(ParserBase parserBase) { 43 | parserBase.toMysql(); 44 | } 45 | 46 | 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/datasource/ChinaNewsSource.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.datasource; 2 | 3 | /** 4 | * ================================================== 5 | *

6 | * 版权: 软件工程.net12-1 原明卓 7 | *

8 | * 项目: 基于用户兴趣标签的新闻推荐系统 9 | *

10 | * 作者: 原明卓 11 | *

12 | * 版本: 1.0 13 | *

14 | * 创建日期: 16-5-6 上午10:33 15 | *

16 | * 功能描述: ChinaNews来源链接封装类 17 | *

18 | *

19 | * 功能更新历史: 20 | *

21 | * ================================================== 22 | */ 23 | public class ChinaNewsSource { 24 | 25 | private static final String CHINA_NEWS_URL="http://www.chinanews.com/"; 26 | 27 | /** 28 | * 得到主页 29 | * @return 30 | */ 31 | public static String getChinaNewsPageIndex(){ 32 | return CHINA_NEWS_URL; 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/datasource/HuanQiuSource.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.datasource; 2 | 3 | import org.jsoup.Jsoup; 4 | import org.jsoup.nodes.Document; 5 | import yuan.ssm.common.util.LoggerUtil; 6 | import yuan.ssm.datacenter.ParseUtil.ParseIndex; 7 | 8 | import java.io.IOException; 9 | import java.util.Set; 10 | 11 | /** 12 | * ================================================== 13 | *

14 | * 版权: 软件工程.net12-1 原明卓 15 | *

16 | * 项目: 基于用户兴趣标签的新闻推荐系统 17 | *

18 | * 作者: 原明卓 19 | *

20 | * 版本: 1.0 21 | *

22 | * 创建日期: 16-5-5 下午1:33 23 | *

24 | * 功能描述: 环球url数据与测试 25 | *

26 | *

27 | * 功能更新历史: 28 | *

29 | * ================================================== 30 | */ 31 | public class HuanQiuSource { 32 | 33 | 34 | //环球网:主页 35 | private static final String HuanQiuUrl="http://huanqiu.com"; 36 | 37 | public static String getHuanQiuIndexUrl(){ 38 | return HuanQiuUrl; 39 | } 40 | 41 | public static void testHuanQiuIndexPage() throws IOException { 42 | Document doc = Jsoup.connect(HuanQiuUrl).timeout(100000).get(); 43 | Set qiuUrls = ParseIndex.getHuanQiuUrls(doc); 44 | LoggerUtil.printJSON(qiuUrls); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /yuannews-datacenter/src/main/java/yuan/ssm/datacenter/datasource/HuxiuSource.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.datacenter.datasource; 2 | 3 | import org.jsoup.Jsoup; 4 | import org.jsoup.nodes.Document; 5 | import org.jsoup.nodes.Element; 6 | import org.jsoup.select.Elements; 7 | import yuan.ssm.common.util.LoggerUtil; 8 | import yuan.ssm.datacenter.common.UrlsContanst; 9 | 10 | import java.io.IOException; 11 | import java.util.ArrayList; 12 | import java.util.HashSet; 13 | import java.util.List; 14 | import java.util.Set; 15 | 16 | /** 17 | * ================================================== 18 | *

19 | * 版权: 软件工程.net12-1 原明卓 20 | *

21 | * 项目: 基于用户兴趣标签的新闻推荐系统 22 | *

23 | * 作者: 原明卓 24 | *

25 | * 版本: 1.0 26 | *

27 | * 创建日期: 16-5-5 下午12:46 28 | *

29 | * 功能描述: 虎嗅-来源 30 | *

31 | *

32 | * 功能更新历史: 33 | *

34 | * ================================================== 35 | */ 36 | public class HuxiuSource { 37 | 38 | //虎嗅网 39 | private static final String HUXIUURL="http://www.huxiu.com";//主页 40 | 41 | //虎嗅-车行 42 | private static final String HUXIUURL_CAR="http://www.huxiu.com/mobility.html";//车与出行 43 | 44 | //虎嗅-24小时 45 | private static final String HUXIU_TIME="http://www.huxiu.com/whatsnew.html";//24小时 46 | 47 | //虎嗅-娱乐影视 48 | private static final String HUXIU_YU="http://www.huxiu.com/entertainment.html";//娱乐淘金 49 | 50 | //虎嗅-创业 51 | private static final String HUXIU_CHUANG="http://www.huxiu.com/startups.html";//创业维艰 52 | 53 | //虎嗅-生活 54 | private static final String HUXIU_SHUENGHUO="http://www.huxiu.com/lifestyle.html";//生活腔调 55 | 56 | private static List ulrs=new ArrayList(); 57 | 58 | 59 | /** 60 | * 虎嗅-首次爬去,可以爬取分类信息 61 | * @return 分类url 62 | */ 63 | public static List getCateUlrs(){ 64 | ulrs.add(HUXIUURL_CAR); 65 | ulrs.add(HUXIU_TIME); 66 | ulrs.add(HUXIU_YU); 67 | ulrs.add(HUXIU_CHUANG); 68 | ulrs.add(HUXIU_SHUENGHUO); 69 | return ulrs; 70 | } 71 | 72 | 73 | /** 74 | * 主页url 75 | * @return 76 | */ 77 | public static String getHuxiuIndexUrl(){ 78 | return HUXIUURL; 79 | } 80 | 81 | 82 | /** 83 | * 测试主页爬去url 84 | * @throws IOException 85 | */ 86 | private static void testHuXiuIndexPage() throws IOException { 87 | Document doc = Jsoup.connect(HUXIUURL).timeout(100000).get(); 88 | Set urls=new HashSet(); 89 | Elements as = doc.select("a"); 90 | for (Element a : as) { 91 | String href = a.attr("href"); 92 | if(href.contains("/1.html")){ 93 | String url= UrlsContanst.HUXIU_BASE_URL+href; 94 | urls.add(url); 95 | } 96 | } 97 | LoggerUtil.printJSON(urls); 98 | } 99 | 100 | 101 | } 102 | -------------------------------------------------------------------------------- /yuannews-model/READMODEL.md: -------------------------------------------------------------------------------- 1 | #YuanNews - Model 添加记录 2 | 3 | #2016.04.07 4 | 已经添加的model有 : 5 | * base - 最基本的包 6 | * Cate .....分类 7 | * Comment .....评论 8 | * Liked .....点赞 9 | * News .....新闻 10 | * Source .....新闻来源 11 | * Taste .....兴趣 12 | * User .....用户/管理员 13 | 14 | * pojo - 基本包装类 15 | * vo - base的拓展类,如果base 进行修改,而使用vo的地方就不需要修改了,建议使用vo包下的拓展类! -------------------------------------------------------------------------------- /yuannews-model/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | yuannews 7 | cn.edu.hpu.yuannews 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | yuannews-model 13 | jar 14 | 15 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/base/Cate.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.base; 2 | 3 | import javax.persistence.Basic; 4 | import javax.persistence.Column; 5 | import javax.persistence.Entity; 6 | import javax.persistence.Id; 7 | 8 | /** 9 | * Created by yuan on 16-4-1. 10 | */ 11 | @Entity 12 | public class Cate { 13 | private int id; 14 | private String content; 15 | 16 | @Id 17 | @Column(name = "id") 18 | public int getId() { 19 | return id; 20 | } 21 | 22 | public void setId(int id) { 23 | this.id = id; 24 | } 25 | 26 | @Basic 27 | @Column(name = "content") 28 | public String getContent() { 29 | return content; 30 | } 31 | 32 | public void setContent(String content) { 33 | this.content = content; 34 | } 35 | 36 | @Override 37 | public boolean equals(Object o) { 38 | if (this == o) return true; 39 | if (o == null || getClass() != o.getClass()) return false; 40 | 41 | Cate cate = (Cate) o; 42 | 43 | if (id != cate.id) return false; 44 | if (content != null ? !content.equals(cate.content) : cate.content != null) return false; 45 | 46 | return true; 47 | } 48 | 49 | @Override 50 | public int hashCode() { 51 | int result = id; 52 | result = 31 * result + (content != null ? content.hashCode() : 0); 53 | return result; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return "Cate{" + 59 | "id=" + id + 60 | ", content='" + content + '\'' + 61 | '}'; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/base/Comment.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.base; 2 | 3 | import javax.persistence.Basic; 4 | import javax.persistence.Column; 5 | import javax.persistence.Entity; 6 | import javax.persistence.Id; 7 | 8 | /** 9 | * Created by yuan on 16-4-3. 10 | */ 11 | @Entity 12 | public class Comment { 13 | private int id; 14 | private String content; 15 | private int status; 16 | 17 | @Id 18 | @Column(name = "id") 19 | public int getId() { 20 | return id; 21 | } 22 | 23 | public void setId(int id) { 24 | this.id = id; 25 | } 26 | 27 | @Basic 28 | @Column(name = "content") 29 | public String getContent() { 30 | return content; 31 | } 32 | 33 | public void setContent(String content) { 34 | this.content = content; 35 | } 36 | 37 | @Basic 38 | @Column(name = "status") 39 | public int getStatus() { 40 | return status; 41 | } 42 | 43 | public void setStatus(int status) { 44 | this.status = status; 45 | } 46 | 47 | @Override 48 | public boolean equals(Object o) { 49 | if (this == o) return true; 50 | if (o == null || getClass() != o.getClass()) return false; 51 | 52 | Comment comment = (Comment) o; 53 | 54 | if (id != comment.id) return false; 55 | if (status != comment.status) return false; 56 | if (content != null ? !content.equals(comment.content) : comment.content != null) return false; 57 | 58 | return true; 59 | } 60 | 61 | @Override 62 | public int hashCode() { 63 | int result = id; 64 | result = 31 * result + (content != null ? content.hashCode() : 0); 65 | result = 31 * result + status; 66 | return result; 67 | } 68 | 69 | @Override 70 | public String toString() { 71 | return "Comment{" + 72 | "id=" + id + 73 | ", content='" + content + '\'' + 74 | ", status=" + status + 75 | '}'; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/base/Liked.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.base; 2 | 3 | import javax.persistence.Basic; 4 | import javax.persistence.Column; 5 | import javax.persistence.Entity; 6 | import javax.persistence.Id; 7 | 8 | /** 9 | * Created by yuan on 16-4-3. 10 | */ 11 | @Entity 12 | public class Liked { 13 | private int id; 14 | private int status; 15 | 16 | @Id 17 | @Column(name = "id") 18 | public int getId() { 19 | return id; 20 | } 21 | 22 | public void setId(int id) { 23 | this.id = id; 24 | } 25 | 26 | @Basic 27 | @Column(name = "status") 28 | public int getStatus() { 29 | return status; 30 | } 31 | 32 | public void setStatus(int status) { 33 | this.status = status; 34 | } 35 | 36 | @Override 37 | public boolean equals(Object o) { 38 | if (this == o) return true; 39 | if (o == null || getClass() != o.getClass()) return false; 40 | 41 | Liked liked = (Liked) o; 42 | 43 | if (id != liked.id) return false; 44 | if (status != liked.status) return false; 45 | 46 | return true; 47 | } 48 | 49 | @Override 50 | public int hashCode() { 51 | int result = id; 52 | result = 31 * result + status; 53 | return result; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return "Liked{" + 59 | "id=" + id + 60 | ", status=" + status + 61 | '}'; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/base/Source.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.base; 2 | 3 | import javax.persistence.Basic; 4 | import javax.persistence.Column; 5 | import javax.persistence.Entity; 6 | import javax.persistence.Id; 7 | 8 | /** 9 | * Created by yuan on 16-4-1. 10 | */ 11 | @Entity 12 | public class Source { 13 | private int id; 14 | private String source; 15 | 16 | @Id 17 | @Column(name = "id") 18 | public int getId() { 19 | return id; 20 | } 21 | 22 | public void setId(int id) { 23 | this.id = id; 24 | } 25 | 26 | @Basic 27 | @Column(name = "source") 28 | public String getSource() { 29 | return source; 30 | } 31 | 32 | public void setSource(String source) { 33 | this.source = source; 34 | } 35 | 36 | @Override 37 | public boolean equals(Object o) { 38 | if (this == o) return true; 39 | if (o == null || getClass() != o.getClass()) return false; 40 | 41 | Source source1 = (Source) o; 42 | 43 | if (id != source1.id) return false; 44 | if (source != null ? !source.equals(source1.source) : source1.source != null) return false; 45 | 46 | return true; 47 | } 48 | 49 | @Override 50 | public int hashCode() { 51 | int result = id; 52 | result = 31 * result + (source != null ? source.hashCode() : 0); 53 | return result; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return "Source{" + 59 | "id=" + id + 60 | ", source='" + source + '\'' + 61 | '}'; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/base/Taste.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.base; 2 | 3 | import javax.persistence.Basic; 4 | import javax.persistence.Column; 5 | import javax.persistence.Entity; 6 | import javax.persistence.Id; 7 | 8 | /** 9 | * Created by yuan on 16-4-1. 10 | */ 11 | @Entity 12 | public class Taste { 13 | private int id; 14 | private String label; 15 | 16 | @Id 17 | @Column(name = "id") 18 | public int getId() { 19 | return id; 20 | } 21 | 22 | public void setId(int id) { 23 | this.id = id; 24 | } 25 | 26 | @Basic 27 | @Column(name = "label") 28 | public String getLabel() { 29 | return label; 30 | } 31 | 32 | public void setLabel(String label) { 33 | this.label = label; 34 | } 35 | 36 | @Override 37 | public boolean equals(Object o) { 38 | if (this == o) return true; 39 | if (o == null || getClass() != o.getClass()) return false; 40 | 41 | Taste taste = (Taste) o; 42 | 43 | if (id != taste.id) return false; 44 | if (label != null ? !label.equals(taste.label) : taste.label != null) return false; 45 | 46 | return true; 47 | } 48 | 49 | @Override 50 | public int hashCode() { 51 | int result = id; 52 | result = 31 * result + (label != null ? label.hashCode() : 0); 53 | return result; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return "Taste{" + 59 | "id=" + id + 60 | ", label='" + label + '\'' + 61 | '}'; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/other/CommentJo.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.other; 2 | 3 | import yuan.ssm.base.Comment; 4 | 5 | /** 6 | * ================================================== 7 | *

8 | * 版权: 软件工程.net12-1 原明卓 9 | *

10 | * 项目: 基于用户兴趣标签的新闻推荐系统 11 | *

12 | * 作者: 原明卓 13 | *

14 | * 版本: 1.0 15 | *

16 | * 创建日期: 16-5-2 下午8:40 17 | *

18 | * 功能描述:用户端新闻评论的实体对象 19 | *

20 | *

21 | * 功能更新历史: 22 | *

23 | * ================================================== 24 | */ 25 | public class CommentJo extends Comment{ 26 | 27 | private Integer uid; 28 | private String nick;//昵称 29 | private String head;//头像 30 | 31 | public Integer getUid() { 32 | return uid; 33 | } 34 | 35 | public void setUid(Integer uid) { 36 | this.uid = uid; 37 | } 38 | 39 | public String getNick() { 40 | return nick; 41 | } 42 | 43 | public void setNick(String nick) { 44 | this.nick = nick; 45 | } 46 | 47 | public String getHead() { 48 | return head; 49 | } 50 | 51 | public void setHead(String head) { 52 | this.head = head; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/other/DataBean.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.other; 2 | 3 | /** 4 | * ================================================== 5 | *

6 | * 版权: 软件工程.net12-1 原明卓 7 | *

8 | * 项目: 基于用户兴趣标签的新闻推荐系统 9 | *

10 | * 作者: 原明卓 11 | *

12 | * 版本: 1.0 13 | *

14 | * 创建日期: 16-5-5 下午3:45 15 | *

16 | * 功能描述: 数据封装bean:返回有状态码,响应信息,和数据的bean 17 | *

18 | *

19 | * 功能更新历史: 20 | *

21 | * ================================================== 22 | */ 23 | public class DataBean { 24 | 25 | private int code; 26 | private String msg="成功"; 27 | private T data; 28 | 29 | public int getCode() { 30 | return code; 31 | } 32 | 33 | public void setCode(int code) { 34 | this.code = code; 35 | } 36 | 37 | public String getMsg() { 38 | return msg; 39 | } 40 | 41 | public void setMsg(String msg) { 42 | this.msg = msg; 43 | } 44 | 45 | public T getData() { 46 | return data; 47 | } 48 | 49 | public void setData(T data) { 50 | this.data = data; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/other/PageJo.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.other; 2 | 3 | /** 4 | * Created by yuan on 16-4-7. 5 | * 分页所需要的属性,可拓展性 6 | */ 7 | public class PageJo { 8 | 9 | private Integer allCount; //总数 10 | 11 | public Integer getAllCount() { 12 | return allCount; 13 | } 14 | 15 | public void setAllCount(Integer allCount) { 16 | this.allCount = allCount; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/other/PageVo.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.other; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * ================================================== 7 | *

8 | * 版权: 软件工程.net12-1 原明卓 9 | *

10 | * 项目: 基于用户兴趣标签的新闻推荐系统 11 | *

12 | * 作者: 原明卓 13 | *

14 | * 版本: 1.0 15 | *

16 | * 创建日期: 16-5-1 下午2:47 17 | *

18 | * 功能描述: 用户端,分页对象 19 | *

20 | *

21 | * 功能更新历史: 22 | *

23 | * ================================================== 24 | */ 25 | public class PageVo { 26 | 27 | private Integer start; //开始 28 | private Integer num; //数量 29 | private Integer p; //分页 30 | private Integer type; //操作类型 31 | private String title; //title 32 | private Integer nType; //新闻类型,normal,cata,source 33 | private List nids; //新闻id 34 | 35 | public List getNids() { 36 | return nids; 37 | } 38 | 39 | public void setNids(List nids) { 40 | this.nids = nids; 41 | } 42 | 43 | public Integer getnType() { 44 | return nType; 45 | } 46 | 47 | public void setnType(Integer nType) { 48 | this.nType = nType; 49 | } 50 | 51 | public Integer getStart() { 52 | return start; 53 | } 54 | 55 | public void setStart(Integer start) { 56 | this.start = start; 57 | } 58 | 59 | public Integer getNum() { 60 | return num; 61 | } 62 | 63 | public void setNum(Integer num) { 64 | this.num = num; 65 | } 66 | 67 | public Integer getP() { 68 | return p; 69 | } 70 | 71 | public void setP(Integer p) { 72 | if(p<0){ 73 | p=1; //添加判断 74 | } 75 | this.p = p; 76 | } 77 | 78 | public Integer getType() { 79 | return type; 80 | } 81 | 82 | public void setType(Integer type) { 83 | this.type = type; 84 | } 85 | 86 | public String getTitle() { 87 | return title; 88 | } 89 | 90 | public void setTitle(String title) { 91 | this.title = title; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/other/TuijianModel.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.other; 2 | 3 | import yuan.ssm.pojo.NewsCustom; 4 | 5 | /** 6 | * ================================================== 7 | *

8 | * 版权: 软件工程.net12-1 原明卓 9 | *

10 | * 项目: 基于用户兴趣标签的新闻推荐系统 11 | *

12 | * 作者: 原明卓 13 | *

14 | * 版本: 1.0 15 | *

16 | * 创建日期: 16-5-14 上午10:13 17 | *

18 | * 功能描述: 推荐新闻Model 19 | * 包括: 20 | * 1.推荐新闻总数; 21 | * 2.一天新闻信息; 22 | * 3.可拓展性高; 23 | *

24 | *

25 | * 功能更新历史: 26 | *

27 | * ================================================== 28 | */ 29 | public class TuijianModel { 30 | 31 | private Integer count; 32 | 33 | private NewsCustom newsCustom; 34 | 35 | public Integer getCount() { 36 | return count; 37 | } 38 | 39 | public void setCount(Integer count) { 40 | this.count = count; 41 | } 42 | 43 | public NewsCustom getNewsCustom() { 44 | return newsCustom; 45 | } 46 | 47 | public void setNewsCustom(NewsCustom newsCustom) { 48 | this.newsCustom = newsCustom; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/pojo/CSCustom.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.pojo; 2 | 3 | import yuan.ssm.vo.CateVo; 4 | import yuan.ssm.vo.SourceVo; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * ================================================== 10 | *

11 | * 版权: 软件工程.net12-1 原明卓 12 | *

13 | * 项目: 基于用户兴趣标签的新闻推荐系统 14 | *

15 | * 作者: 原明卓 16 | *

17 | * 版本: 1.0 18 | *

19 | * 创建日期: 16-4-25 下午5:20 20 | *

21 | * 功能描述:分类信息和来源信息,用来显示菜单使用 22 | *

23 | *

24 | * 功能更新历史: 25 | *

26 | * ================================================== 27 | */ 28 | public class CSCustom { 29 | 30 | private List cateVos; 31 | private List sourceVos; 32 | 33 | public List getCateVos() { 34 | return cateVos; 35 | } 36 | 37 | public void setCateVos(List cateVos) { 38 | this.cateVos = cateVos; 39 | } 40 | 41 | public List getSourceVos() { 42 | return sourceVos; 43 | } 44 | 45 | public void setSourceVos(List sourceVos) { 46 | this.sourceVos = sourceVos; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/pojo/CommentPo.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.pojo; 2 | 3 | import yuan.ssm.vo.CommentVo; 4 | import yuan.ssm.vo.NewsVo; 5 | import yuan.ssm.vo.UserVo; 6 | 7 | /** 8 | * Created by yuan on 16-4-4. 9 | * 新闻-评论-po实体 10 | */ 11 | public class CommentPo extends CommentVo { 12 | 13 | private UserVo userVo; 14 | private NewsVo newsVo; 15 | 16 | public UserVo getUserVo() { 17 | return userVo; 18 | } 19 | 20 | public void setUserVo(UserVo userVo) { 21 | this.userVo = userVo; 22 | } 23 | 24 | public NewsVo getNewsVo() { 25 | return newsVo; 26 | } 27 | 28 | public void setNewsVo(NewsVo newsVo) { 29 | this.newsVo = newsVo; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return super.toString()+"CommentPo{" + 35 | "userVo=" + userVo + 36 | ", newsVo=" + newsVo + 37 | '}'; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/pojo/LikedPo.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.pojo; 2 | 3 | 4 | import yuan.ssm.vo.LikedVo; 5 | import yuan.ssm.vo.NewsVo; 6 | import yuan.ssm.vo.UserVo; 7 | 8 | /** 9 | * Created by yuan on 16-4-4. 10 | * 后台管理-点赞管理-点赞拓展类 11 | */ 12 | public class LikedPo extends LikedVo { 13 | private UserVo userVo; 14 | private NewsVo newsVo; 15 | 16 | public UserVo getUserVo() { 17 | return userVo; 18 | } 19 | 20 | public void setUserVo(UserVo userVo) { 21 | this.userVo = userVo; 22 | } 23 | 24 | public NewsVo getNewsVo() { 25 | return newsVo; 26 | } 27 | 28 | public void setNewsVo(NewsVo newsVo) { 29 | this.newsVo = newsVo; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return super.toString()+"LikedPo{" + 35 | "userVo=" + userVo + 36 | ", newsVo=" + newsVo + 37 | '}'; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/pojo/NewsCustom.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.pojo; 2 | 3 | import yuan.ssm.vo.NewsVo; 4 | 5 | /** 6 | * ================================================== 7 | *

8 | * 版权: 软件工程.net12-1 原明卓 9 | *

10 | * 项目: 基于用户兴趣标签的新闻推荐系统 11 | *

12 | * 作者: 原明卓 13 | *

14 | * 版本: 1.0 15 | *

16 | * 创建日期: 16-4-13 下午3:53 17 | *

18 | * 功能描述: 新闻item实体类 19 | *

20 | *

21 | * 功能更新历史: 22 | * 客户端:主界面新闻展示的数据 包括阅读数量,分类信息,新闻信息 23 | *

24 | * ================================================== 25 | */ 26 | public class NewsCustom extends NewsVo{ 27 | 28 | private Integer cnum;//评论总数 29 | 30 | private String ccont;//分类信息 31 | 32 | private Integer znum;//点赞总数 33 | 34 | private String scont; 35 | 36 | public Integer getCnum() { 37 | return cnum; 38 | } 39 | 40 | public void setCnum(Integer cnum) { 41 | this.cnum = cnum; 42 | } 43 | 44 | public String getCcont() { 45 | return ccont; 46 | } 47 | 48 | public void setCcont(String ccont) { 49 | this.ccont = ccont; 50 | } 51 | 52 | public Integer getZnum() { 53 | return znum; 54 | } 55 | 56 | public void setZnum(Integer znum) { 57 | this.znum = znum; 58 | } 59 | 60 | public String getScont() { 61 | return scont; 62 | } 63 | 64 | public void setScont(String scont) { 65 | this.scont = scont; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/pojo/NewsPo.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.pojo; 2 | 3 | 4 | import yuan.ssm.vo.NewsVo; 5 | 6 | /** 7 | * Created by yuan on 16-4-1. 8 | * 新闻的 pojo -> 直接 查询到NewsPo中 9 | */ 10 | public class NewsPo extends NewsVo { 11 | 12 | private String cateStr; 13 | private String sourceStr; 14 | 15 | public String getCateStr() { 16 | return cateStr; 17 | } 18 | 19 | public void setCateStr(String cateStr) { 20 | this.cateStr = cateStr; 21 | } 22 | 23 | public String getSourceStr() { 24 | return sourceStr; 25 | } 26 | 27 | public void setSourceStr(String sourceStr) { 28 | this.sourceStr = sourceStr; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | return super.toString()+"NewsPo{" + 34 | "cateStr=" + cateStr + 35 | ", sourceStr=" + sourceStr + 36 | '}'; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/pojo/NewsPoCustom.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.pojo; 2 | 3 | import yuan.ssm.vo.CateVo; 4 | import yuan.ssm.vo.SourceVo; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * ================================================== 10 | *

11 | * 版权: 软件工程.net12-1 原明卓 12 | *

13 | * 项目: 基于用户兴趣标签的新闻推荐系统 14 | *

15 | * 作者: 原明卓 16 | *

17 | * 版本: 1.0 18 | *

19 | * 创建日期: 16-4-17 下午7:08 20 | *

21 | * 功能描述: 后台新闻管理,修改的时候,加载单条数据,还要包括分类所有信息和来源信息 22 | * 从而进行初始哈修改页面; 23 | *

24 | *

25 | * 功能更新历史: 26 | *

27 | * ================================================== 28 | */ 29 | public class NewsPoCustom { 30 | 31 | private NewsPo newsPo; 32 | private List cates; 33 | private List sourceVos; 34 | 35 | public NewsPo getNewsPo() { 36 | return newsPo; 37 | } 38 | 39 | public void setNewsPo(NewsPo newsPo) { 40 | this.newsPo = newsPo; 41 | } 42 | 43 | public List getCates() { 44 | return cates; 45 | } 46 | 47 | public void setCates(List cates) { 48 | this.cates = cates; 49 | } 50 | 51 | public List getSourceVos() { 52 | return sourceVos; 53 | } 54 | 55 | public void setSourceVos(List sourceVos) { 56 | this.sourceVos = sourceVos; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/pojo/UserPo.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.pojo; 2 | 3 | /** 4 | * Created by yuan on 16-3-30. 5 | * 用户与界面交互的po实体类 6 | */ 7 | public class UserPo { 8 | } 9 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/vo/CateVo.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.vo; 2 | 3 | import yuan.ssm.base.Cate; 4 | 5 | /** 6 | * Created by yuan on 16-4-1. 7 | * 分类拓展类 8 | */ 9 | public class CateVo extends Cate { 10 | 11 | @Override 12 | public String toString() { 13 | return super.toString(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/vo/CommentVo.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.vo; 2 | 3 | import yuan.ssm.base.Comment; 4 | 5 | /** 6 | * Created by yuan on 16-4-3. 7 | * 留言拓展类 8 | */ 9 | public class CommentVo extends Comment{ 10 | 11 | @Override 12 | public String toString() { 13 | return super.toString(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/vo/LikedVo.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.vo; 2 | import yuan.ssm.base.Liked; 3 | 4 | /** 5 | * Created by yuan on 16-4-3. 6 | * 留言拓展类 7 | */ 8 | public class LikedVo extends Liked{ 9 | 10 | private Integer uid; 11 | private String head; 12 | private String nick; 13 | 14 | public Integer getUid() { 15 | return uid; 16 | } 17 | 18 | public void setUid(Integer uid) { 19 | this.uid = uid; 20 | } 21 | 22 | public String getHead() { 23 | return head; 24 | } 25 | 26 | public void setHead(String head) { 27 | this.head = head; 28 | } 29 | 30 | public String getNick() { 31 | return nick; 32 | } 33 | 34 | public void setNick(String nick) { 35 | this.nick = nick; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/vo/NewsVo.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.vo; 2 | 3 | import yuan.ssm.base.News; 4 | 5 | /** 6 | * Created by yuan on 16-3-30. 7 | * 客户实体类 8 | */ 9 | public class NewsVo extends News { 10 | 11 | private Integer cid; 12 | private Integer sid; 13 | 14 | public Integer getCid() { 15 | return cid; 16 | } 17 | 18 | public void setCid(Integer cid) { 19 | this.cid = cid; 20 | } 21 | 22 | public Integer getSid() { 23 | return sid; 24 | } 25 | 26 | public void setSid(Integer sid) { 27 | this.sid = sid; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return super.toString(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/vo/SourceVo.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.vo; 2 | 3 | import yuan.ssm.base.Source; 4 | 5 | /** 6 | * Created by yuan on 16-4-1. 7 | * 来源数据 拓展对象 8 | */ 9 | public class SourceVo extends Source { 10 | 11 | @Override 12 | public String toString() { 13 | return super.toString(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/vo/TasteVo.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.vo; 2 | 3 | import yuan.ssm.base.Taste; 4 | 5 | /** 6 | * Created by yuan on 16-4-1. 7 | * 兴趣拓展类 8 | */ 9 | public class TasteVo extends Taste { 10 | 11 | private Integer uid; 12 | private String nick; 13 | 14 | public Integer getUid() { 15 | return uid; 16 | } 17 | 18 | public void setUid(Integer uid) { 19 | this.uid = uid; 20 | } 21 | 22 | public String getNick() { 23 | return nick; 24 | } 25 | 26 | public void setNick(String nick) { 27 | this.nick = nick; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return super.toString()+"TasteVo{" + 33 | "uid=" + uid + 34 | ", nick='" + nick + '\'' + 35 | '}'; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /yuannews-model/src/main/java/yuan/ssm/vo/UserVo.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.vo; 2 | 3 | import yuan.ssm.base.User; 4 | 5 | /** 6 | * Created by yuan on 16-3-30. 7 | * 用户拓展实体类 8 | */ 9 | public class UserVo extends User { 10 | 11 | @Override 12 | public String toString() { 13 | return super.toString(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /yuannews-service/READSERVICE.md: -------------------------------------------------------------------------------- 1 | #YuanNews - Service 层 需实现 2 | 3 | #2016.04.xx - 2016.04.xx 4 | * 后台管理  5 | * 实现用户管理相关业务,包括分页等 6 | * 实现分类管理相关业务,无需分页 7 | * 实现来源管理相关业务,无需分页 8 | * ...... -------------------------------------------------------------------------------- /yuannews-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | yuannews 7 | cn.edu.hpu.yuannews 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | yuannews-service 13 | jar 14 | 15 | 16 | cn.edu.hpu.yuannews 17 | yuannews-model 18 | 1.0-SNAPSHOT 19 | 20 | 21 | cn.edu.hpu.yuannews 22 | yuannews-dao 23 | 1.0-SNAPSHOT 24 | 25 | 26 | cn.edu.hpu.yuannews 27 | yuannews-common 28 | 1.0-SNAPSHOT 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/base/ManagerBase.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.base; 2 | 3 | import yuan.ssm.other.PageJo; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * ================================================== 9 | *

10 | * 版权: 软件工程.net12-1 原明卓 11 | *

12 | * 项目: 基于用户兴趣标签的新闻推荐系统 13 | *

14 | * 作者: 原明卓 15 | *

16 | * 版本: 1.0 17 | *

18 | * 创建日期: 16-4-15 下午11:05 19 | *

20 | * 功能描述: 基础类: 提供接口,为每个接口提供方法,减少代码量 21 | * 开始实施: 后台管理处理用户管理和兴趣管理没有使用,前者未能进行重构; 22 | * 业务层 : 核心类        23 | *

24 | *

25 | * 功能更新历史: 26 | *

27 | * ================================================== 28 | */ 29 | public interface ManagerBase { 30 | 31 | 32 | /** 33 | * 分页查询数据 34 | * @param start 开始位置 35 | * @param num 数量 36 | * @return 数据列表 37 | * @throws Exception  38 | */ 39 | List managerFindList(Integer start, Integer num) throws Exception; 40 | 41 | /** 42 | * 查询单条信息 43 | * @param id 查询的id 44 | * @return 单条数据 45 | * @throws Exception 46 | */ 47 | T managerFindOne(Integer id) throws Exception; 48 | 49 | /** 50 | * 添加单条信息 51 | * @param t 添加的数据 52 | * @return 0,1 53 | * @throws Exception 54 | */ 55 | Integer managerInsertOne(T t) throws Exception; 56 | 57 | /** 58 | * 修改单条信息 59 | * @param t 修改的数据 60 | * @return 0,1 61 | * @throws Exception 62 | */ 63 | Integer managerUpdateOne(T t) throws Exception; 64 | 65 | /** 66 | * 删除单条信息 67 | * @param id 删除的信息id 68 | * @return 69 | * @throws Exception 70 | */ 71 | Integer managerDeleteOne(Integer id) throws Exception; 72 | 73 | 74 | /** 75 | * 获得总数 76 | * @return 77 | * @throws Exception 78 | */ 79 | PageJo managerFindCount() throws Exception; 80 | 81 | } 82 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/base/ServiceBase.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.base; 2 | 3 | import yuan.ssm.common.newsenum.ServiceEnum; 4 | import yuan.ssm.pojo.CSCustom; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * ================================================== 10 | *

11 | * 版权: 软件工程.net12-1 原明卓 12 | *

13 | * 项目: 基于用户兴趣标签的新闻推荐系统 14 | *

15 | * 作者: 原明卓 16 | *

17 | * 版本: 1.0 18 | *

19 | * 创建日期: 16-4-26 下午11:00 20 | *

21 | * 功能描述: 用户端service基类 22 | * 共同的方法提取 23 | *

24 | *

25 | * 功能更新历史: 26 | *

27 | * ================================================== 28 | */ 29 | public interface ServiceBase { 30 | 31 | /** 32 | * 查询分类和来源信息 33 | * @return 34 | * @throws Exception 35 | */ 36 | CSCustom findCateSourceIfo() throws Exception; 37 | 38 | 39 | /** 40 | * 根据id查询 41 | * @param start 开始 42 | * @param num 数量 43 | * @param cs 条件/分类或来源 44 | * @return 数据 45 | * @throws Exception 46 | */ 47 | List findCustomById(Integer start, Integer num, String cs, ServiceEnum type) throws Exception; 48 | 49 | 50 | /** 51 | * 根据id查询 52 | * @param start 开始 53 | * @param num 数量 54 | * @param cs 条件/分类或来源 55 | * @return 数据 56 | * @throws Exception 57 | */ 58 | List findCustomByZan(Integer start,Integer num,String cs,ServiceEnum type) throws Exception; 59 | 60 | 61 | /** 62 | * 根据id查询 63 | * @param start 开始 64 | * @param num 数量 65 | * @param cs 条件/分类或来源 66 | * @return 数据 67 | * @throws Exception 68 | */ 69 | List findCustomByComment(Integer start,Integer num,String cs,ServiceEnum type) throws Exception; 70 | 71 | 72 | /** 73 | * 根据id查询 74 | * @param start 开始 75 | * @param num 数量 76 | * @param cs 条件/分类或来源 77 | * @return 数据 78 | * @throws Exception 79 | */ 80 | List findCustomByRnum(Integer start,Integer num,String cs,ServiceEnum type) throws Exception; 81 | 82 | } 83 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/customer/NewsService.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.customer; 2 | 3 | import yuan.ssm.other.PageJo; 4 | import yuan.ssm.other.PageVo; 5 | import yuan.ssm.pojo.NewsCustom; 6 | import yuan.ssm.service.base.ServiceBase; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by yuan on 16-4-4. 12 | * 业务层-用户端-新闻服务接口 13 | */ 14 | public interface NewsService extends ServiceBase { 15 | 16 | /** 17 | * 其他拓展在此实现 : 18 | * 1.搜索 19 | * 2.详情页 20 | */ 21 | 22 | /** 23 | * 普通点赞 24 | * @param pageVo 25 | * @return 26 | * @throws Exception 27 | */ 28 | List getIdNews(PageVo pageVo) throws Exception; 29 | 30 | /** 31 | * 阅读 32 | * @param pageVo 33 | * @return 34 | * @throws Exception 35 | */ 36 | List getRnumNews(PageVo pageVo) throws Exception; 37 | 38 | /** 39 | * 评论 40 | * @param pageVo 41 | * @return 42 | * @throws Exception 43 | */ 44 | List getCommentNews(PageVo pageVo) throws Exception; 45 | 46 | /** 47 | * 点赞 48 | * @param pageVo 49 | * @return 50 | * @throws Exception 51 | */ 52 | List getZanNews(PageVo pageVo) throws Exception; 53 | 54 | /** 55 | * 总数 56 | * @return 57 | * @throws Exception 58 | */ 59 | PageJo getNewsCount() throws Exception; 60 | 61 | /** 62 | * 某个新闻的阅读量+1 63 | * @param nid 新闻id 64 | * @return 65 | * @throws Exception 66 | */ 67 | Integer updateNewsRnum(Integer nid) throws Exception; 68 | 69 | 70 | /** 71 | * 根据新闻的id进行批量查询 72 | * @param nids 73 | * @return 74 | * @throws Exception 75 | */ 76 | List getNidsNews(List nids,Integer type ) throws Exception; 77 | 78 | 79 | } 80 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/manager/CateManager.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.manager; 2 | 3 | import yuan.ssm.service.base.ManagerBase; 4 | import yuan.ssm.vo.CateVo; 5 | 6 | /** 7 | * Created by yuan on 16-4-4. 8 | * 业务层-后台管理- 分类管理接口 9 | */ 10 | public interface CateManager extends ManagerBase{ 11 | 12 | /** 13 | * 其他业务方法在此拓展实现 14 | */ 15 | 16 | } 17 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/manager/CommentManager.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.manager; 2 | 3 | import yuan.ssm.pojo.CommentPo; 4 | import yuan.ssm.service.base.ManagerBase; 5 | 6 | /** 7 | * Created by yuan on 16-4-4. 8 | * 业务层-后台管理-评论管理接口添加 9 | */ 10 | public interface CommentManager extends ManagerBase{ 11 | 12 | /** 13 | * 其他业务方法在此拓展实现 14 | */ 15 | 16 | } 17 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/manager/IndexManager.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.manager; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by yuan on 16-4-4. 7 | * 业务层 - 后台管理-主页业务层 8 | * 管理主页显示:  9 | * 1.用户总数,新闻总数,留言总数,兴趣总数统计 10 | * 2.最新的爬虫Log 11 | */ 12 | public interface IndexManager { 13 | 14 | 15 | /** 16 | * 获取总数 17 | * @param type 18 | * @return 19 | * @throws Exception 20 | */ 21 | Integer getCount(Integer type) throws Exception; 22 | 23 | /** 24 | * 获取爬虫的日志信息 25 | * @return 26 | * @throws Exception 27 | */ 28 | List getLogs() throws Exception; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/manager/LikedManager.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.manager; 2 | 3 | import yuan.ssm.pojo.LikedPo; 4 | import yuan.ssm.service.base.ManagerBase; 5 | 6 | /** 7 | * Created by yuan on 16-4-4. 8 | * 业务层-后台管理-点赞管理添加 9 | */ 10 | public interface LikedManager extends ManagerBase{ 11 | 12 | /** 13 | * 其他业务方法在此拓展实现 14 | */ 15 | 16 | } 17 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/manager/NewsManager.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.manager; 2 | 3 | import yuan.ssm.pojo.NewsPo; 4 | import yuan.ssm.pojo.NewsPoCustom; 5 | import yuan.ssm.service.base.ManagerBase; 6 | import yuan.ssm.vo.NewsVo; 7 | 8 | /** 9 | * Created by yuan on 16-4-4. 10 | * 业务层 - 后台管理- 新闻管理 11 | */ 12 | public interface NewsManager extends ManagerBase{ 13 | 14 | /** 15 | * 其他业务方法在此拓展实现 16 | */ 17 | 18 | //添加新闻信息 19 | Integer managerInsertNews(NewsVo newsVo) throws Exception; 20 | 21 | //根据新闻id,查询新闻内容 22 | String managerFindNewsContent(Integer id) throws Exception; 23 | 24 | //返回单条新闻内容,包括分类(id,content),来源(id,source) 25 | NewsPoCustom managerFindNews(Integer id) throws Exception; 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/manager/SourceManager.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.manager; 2 | 3 | import yuan.ssm.service.base.ManagerBase; 4 | import yuan.ssm.vo.SourceVo; 5 | 6 | /** 7 | * Created by yuan on 16-4-4. 8 | * 业务层-后台管理- 新闻来源接口 9 | */ 10 | public interface SourceManager extends ManagerBase{ 11 | 12 | /** 13 | * 其他业务方法在此拓展实现 14 | */ 15 | 16 | } 17 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/manager/TasteManager.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.manager; 2 | 3 | import yuan.ssm.other.PageJo; 4 | import yuan.ssm.vo.TasteVo; 5 | import java.util.List; 6 | 7 | /** 8 | * Created by yuan on 16-4-4. 9 | * 业务层-后台管理-兴趣接口添加 10 | */ 11 | public interface TasteManager { 12 | 13 | //分页查询 14 | List managerTasteList(Integer start, Integer num) throws Exception; 15 | 16 | //查询单个 17 | TasteVo managerTaste(Integer id) throws Exception; 18 | 19 | //添加兴趣 20 | Integer managerInsertTaste(String label,Integer uid) throws Exception; 21 | 22 | //删除兴趣 23 | Integer managerDeleteTaste(Integer id) throws Exception; 24 | 25 | //修改兴趣 26 | Integer managerUpdateTaste(String label,Integer id) throws Exception; 27 | 28 | //获得兴趣总数 29 | PageJo managerTasteCount() throws Exception; 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/manager/UserManager.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.manager; 2 | 3 | 4 | 5 | import yuan.ssm.other.PageJo; 6 | import yuan.ssm.vo.UserVo; 7 | import java.util.List; 8 | 9 | /** 10 | * Created by yuan on 16-4-4. 11 | * 业务层 - 后台管理- 用户管理 12 | */ 13 | public interface UserManager { 14 | 15 | //管理员登陆 16 | Integer managerLogin(String unum,String pass) throws Exception; 17 | //获取用户信息 18 | UserVo managerFindUserIfo(Integer uid) throws Exception; 19 | //获取多个用户 20 | List managerFindUserList(Integer start,Integer num) throws Exception; 21 | //获取用户总数 22 | PageJo managerFindUserCount() throws Exception; 23 | 24 | //修改用户信息 25 | Integer managerUpdateUserIfo(UserVo userVo) throws Exception; 26 | 27 | //添加用户信息 28 | Integer managerInsertUserIfo(UserVo userVo) throws Exception; 29 | 30 | //删除用户信息 31 | Integer managerDeleteUserIfo(Integer id) throws Exception; 32 | 33 | //恢复用户信息 34 | Integer managerSettingUserIfo(Integer id) throws Exception; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/manager/impl/CateManagerImpl.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.manager.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import yuan.ssm.common.status.UpdateStatus; 5 | import yuan.ssm.dao.manager.CateManagerMapper; 6 | import yuan.ssm.dao.manager.ManagerCountMapper; 7 | import yuan.ssm.other.PageJo; 8 | import yuan.ssm.service.manager.CateManager; 9 | import yuan.ssm.vo.CateVo; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Created by yuan on 16-4-4. 15 | * 业务层 - 后台管理 - 分类管理 - 接口实现 16 | */ 17 | public class CateManagerImpl implements CateManager { 18 | 19 | 20 | @Autowired 21 | private CateManagerMapper cateManagerMapper; 22 | 23 | /** 24 | * 分类查询 - 全部分类信息,没有分页 25 | * @param start 开始位置 26 | * @param num 数量 27 | * @return 28 | * @throws Exception 29 | */ 30 | public List managerFindList(Integer start, Integer num) throws Exception { 31 | return cateManagerMapper.findCates(); 32 | } 33 | 34 | /** 35 | * 查询单条分类信息 36 | * @param id 查询的id 37 | * @return 38 | * @throws Exception 39 | */ 40 | public CateVo managerFindOne(Integer id) throws Exception { 41 | return cateManagerMapper.findCateById(id); 42 | } 43 | 44 | /** 45 | * 46 | * @param cateVo 47 | * @return 48 | * @throws Exception 49 | */ 50 | public Integer managerInsertOne(CateVo cateVo) throws Exception { 51 | if(cateVo.getContent()==null){ 52 | return UpdateStatus.UPDATE_FAIL; 53 | } 54 | return cateManagerMapper.insertCate(cateVo.getContent()); 55 | } 56 | 57 | /** 58 | * 更新一个 59 | * @param cateVo 分类实体 60 | * @return 61 | * @throws Exception 62 | */ 63 | public Integer managerUpdateOne(CateVo cateVo) throws Exception { 64 | if (cateVo.getId()<=0){ 65 | return UpdateStatus.UPDATE_ID_ZORE; 66 | } 67 | 68 | if(cateVo.getContent()==null){ 69 | return UpdateStatus.UPDATE_FAIL; 70 | } 71 | return cateManagerMapper.updateCate(cateVo.getId(),cateVo.getContent()); 72 | } 73 | 74 | /** 75 | * 分类删除实现 76 | * @param id 删除的信息id 77 | * @return 78 | * @throws Exception 79 | */ 80 | public Integer managerDeleteOne(Integer id) throws Exception { 81 | return cateManagerMapper.deleteCate(id); 82 | } 83 | 84 | /** 85 | * 查询总数 86 | * @return 87 | * @throws Exception 88 | * @deprecated 业务不需要,没必要实现 89 | * @see CateManagerMapper 90 | */ 91 | public PageJo managerFindCount() throws Exception { 92 | return null; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/manager/impl/CommentManagerImpl.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.manager.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import yuan.ssm.common.status.ManagerConutStatus; 5 | import yuan.ssm.dao.manager.CommentManagerMapper; 6 | import yuan.ssm.dao.manager.ManagerCountMapper; 7 | import yuan.ssm.other.PageJo; 8 | import yuan.ssm.pojo.CommentPo; 9 | import yuan.ssm.service.manager.CommentManager; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Created by yuan on 16-4-4. 15 | * 业务层 - 后台管理 - 评论管理 - 接口实现 16 | */ 17 | public class CommentManagerImpl implements CommentManager{ 18 | 19 | 20 | @Autowired 21 | private CommentManagerMapper commentManagerMapper; 22 | 23 | @Autowired 24 | private ManagerCountMapper managerCountMapper; 25 | 26 | /** 27 | * 最简单的分页实现 28 | * @param start 开始位置 29 | * @param num 数量 30 | * @return 31 | * @throws Exception 32 | */ 33 | public List managerFindList(Integer start, Integer num) throws Exception { 34 | return commentManagerMapper.findComments(start,num); 35 | } 36 | 37 | /** 38 | * 查询单条评论信息 39 | * @param id 查询的id 40 | * @return 41 | * @throws Exception 42 | */ 43 | public CommentPo managerFindOne(Integer id) throws Exception { 44 | return commentManagerMapper.findCommentById(id); 45 | } 46 | 47 | /** 48 | * @deprecated 业务不需要 49 | * @param commentPo 50 | * @return 51 | * @throws Exception 52 | */ 53 | public Integer managerInsertOne(CommentPo commentPo) throws Exception { 54 | return null; 55 | } 56 | 57 | /** 58 | * @deprecated 业务不需要 59 | * @param commentPo 60 | * @return 61 | * @throws Exception 62 | */ 63 | public Integer managerUpdateOne(CommentPo commentPo) throws Exception { 64 | return null; 65 | } 66 | 67 | /** 68 | * 伪删除,修改评论status为1 69 | * @param id 删除的信息id 70 | * @return 71 | * @throws Exception 72 | */ 73 | public Integer managerDeleteOne(Integer id) throws Exception { 74 | return commentManagerMapper.updateCommentStatus(id,1); 75 | } 76 | 77 | /** 78 | * 得到评论总数 79 | * @return 80 | * @throws Exception 81 | */ 82 | public PageJo managerFindCount() throws Exception { 83 | return managerCountMapper.findCount(ManagerConutStatus.MANAGER_COMMENT_COUNT_TYPE); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/manager/impl/IndexManagerImpl.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.manager.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import yuan.ssm.common.util.FileTool; 5 | import yuan.ssm.dao.manager.ManagerCountMapper; 6 | import yuan.ssm.service.manager.IndexManager; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by yuan on 16-4-4. 12 | * 业务层 - 后台管理 - 主页业务层 - 接口实现 13 | */ 14 | public class IndexManagerImpl implements IndexManager{ 15 | 16 | 17 | @Autowired 18 | private ManagerCountMapper managerCountMapper; 19 | 20 | /** 21 | * 得到总数 22 | * @param type 23 | * @return 24 | * @throws Exception 25 | */ 26 | public Integer getCount(Integer type) throws Exception { 27 | switch (type){ 28 | case 2: 29 | return managerCountMapper.findCount(2).getAllCount(); //新闻 30 | case 5: 31 | return managerCountMapper.findCount(5).getAllCount(); //兴趣标签 32 | case 3: 33 | return managerCountMapper.findCount(3).getAllCount(); //评论总数 34 | case 1: 35 | return managerCountMapper.findCount(1).getAllCount();//用户总数 36 | default: 37 | return managerCountMapper.findCount(2).getAllCount(); 38 | } 39 | } 40 | 41 | /** 42 | * 得到日志集合 43 | * @return 44 | * @throws Exception 45 | */ 46 | public List getLogs() throws Exception { 47 | return FileTool.readData(); 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/manager/impl/LikedManagerImpl.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.manager.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import yuan.ssm.common.status.ManagerConutStatus; 5 | import yuan.ssm.common.util.LoggerUtil; 6 | import yuan.ssm.dao.manager.LikedManagerMapper; 7 | import yuan.ssm.dao.manager.ManagerCountMapper; 8 | import yuan.ssm.other.PageJo; 9 | import yuan.ssm.pojo.LikedPo; 10 | import yuan.ssm.service.manager.LikedManager; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * Created by yuan on 16-4-4. 16 | * 业务层 - 后台管理 - 点赞管理 - 接口实现 17 | */ 18 | public class LikedManagerImpl implements LikedManager { 19 | 20 | @Autowired 21 | private LikedManagerMapper likedManagerMapper; 22 | 23 | @Autowired 24 | private ManagerCountMapper managerCountMapper; 25 | 26 | 27 | /** 28 | * 点赞,分页查询 29 | * @param start 开始位置 30 | * @param num 数量 31 | * @return 32 | * @throws Exception 33 | */ 34 | public List managerFindList(Integer start, Integer num) throws Exception { 35 | return likedManagerMapper.findLikeds(start,num); 36 | } 37 | 38 | 39 | /** 40 | * 删除某个点赞信息 41 | * @param id 删除的信息id 42 | * @return 43 | * @throws Exception 44 | */ 45 | public Integer managerDeleteOne(Integer id) throws Exception { 46 | Integer likeds = likedManagerMapper.deleteLikeds(id); 47 | LoggerUtil.print(likeds); 48 | return likeds; 49 | } 50 | 51 | /** 52 | * 点赞总数 53 | * @return 54 | * @throws Exception 55 | */ 56 | public PageJo managerFindCount() throws Exception { 57 | return managerCountMapper.findCount(ManagerConutStatus.MANAGER_LIKED_COUNT_TYPE); 58 | } 59 | 60 | /** 61 | * 下面的方法没有使用,业务需求不需要 62 | * @deprecated 63 | * @param id 查询的id 64 | * @return 65 | * @throws Exception 66 | */ 67 | public LikedPo managerFindOne(Integer id) throws Exception { 68 | return null; 69 | } 70 | 71 | /** 72 | * @deprecated 业务不需要 73 | * @param likedPo 74 | * @return 75 | * @throws Exception 76 | */ 77 | public Integer managerInsertOne(LikedPo likedPo) throws Exception { 78 | return null; 79 | } 80 | 81 | /** 82 | * @deprecated 业务不需要 83 | * @param likedPo 84 | * @return 85 | * @throws Exception 86 | */ 87 | public Integer managerUpdateOne(LikedPo likedPo) throws Exception { 88 | return null; 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/manager/impl/SourceManagerImpl.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.manager.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import yuan.ssm.common.status.ManagerConutStatus; 5 | import yuan.ssm.common.status.UpdateStatus; 6 | import yuan.ssm.dao.manager.ManagerCountMapper; 7 | import yuan.ssm.dao.manager.SourceManagerMapper; 8 | import yuan.ssm.other.PageJo; 9 | import yuan.ssm.service.manager.SourceManager; 10 | import yuan.ssm.vo.SourceVo; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * Created by yuan on 16-4-4. 16 | * 业务层 - 后台管理 - 来源管理 - 接口实现 17 | */ 18 | public class SourceManagerImpl implements SourceManager{ 19 | 20 | 21 | @Autowired 22 | private SourceManagerMapper sourceManagerMapper; 23 | 24 | @Autowired 25 | private ManagerCountMapper managerCountMapper; 26 | 27 | 28 | /** 29 | * 新闻来源 分页查询, 30 | * @param start 开始位置 31 | * @param num 数量 32 | * @return 33 | * @throws Exception 34 | */ 35 | public List managerFindList(Integer start, Integer num) throws Exception { 36 | return sourceManagerMapper.findSources(start,num); 37 | } 38 | 39 | /** 40 | * 查询单个来源信息 41 | * @param id 查询的id 42 | * @return 43 | * @throws Exception 44 | */ 45 | public SourceVo managerFindOne(Integer id) throws Exception { 46 | if(id<0){ 47 | id=1; 48 | } 49 | return sourceManagerMapper.findSourceOne(id); 50 | } 51 | 52 | /** 53 | * 新添加一个来源信息 54 | * @param sourceVo 来源信息模型 55 | * @return 56 | * @throws Exception 57 | */ 58 | public Integer managerInsertOne(SourceVo sourceVo) throws Exception { 59 | if(sourceVo==null){ 60 | return UpdateStatus.UPDATE_FAIL; 61 | } 62 | return sourceManagerMapper.insertSource(sourceVo.getSource()); 63 | } 64 | 65 | /** 66 | * 修改信息 67 | * @param sourceVo 来源信息模型 68 | * @return 69 | * @throws Exception 70 | */ 71 | public Integer managerUpdateOne(SourceVo sourceVo) throws Exception { 72 | if(sourceVo==null){ 73 | return UpdateStatus.UPDATE_FAIL; 74 | } 75 | return sourceManagerMapper.updateSourceContent(sourceVo.getId(),sourceVo.getSource()); 76 | } 77 | 78 | /** 79 | * 删除信息 80 | * @param id 删除的信息id 81 | * @return 82 | * @throws Exception 83 | */ 84 | public Integer managerDeleteOne(Integer id) throws Exception { 85 | if(id<0){ 86 | return id; 87 | } 88 | return sourceManagerMapper.deleteSourceContent(id); 89 | } 90 | 91 | /** 92 | * 更改需求:查询来源信息总数,用来分页实现 93 | * @return 94 | * @throws Exception 95 | */ 96 | public PageJo managerFindCount() throws Exception { 97 | return managerCountMapper.findCount(ManagerConutStatus.MANAGER_SOURCE_COUNT_TYPE); 98 | } 99 | 100 | 101 | } 102 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/manager/impl/TasteManagerImpl.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.manager.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import yuan.ssm.common.status.ManagerConutStatus; 5 | import yuan.ssm.dao.manager.ManagerCountMapper; 6 | import yuan.ssm.dao.manager.TasteManagerMapper; 7 | import yuan.ssm.other.PageJo; 8 | import yuan.ssm.service.manager.TasteManager; 9 | import yuan.ssm.vo.TasteVo; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Created by yuan on 16-4-4. 15 | * 业务层 - 后台管理 - 兴趣管理 - 接口实现 16 | */ 17 | public class TasteManagerImpl implements TasteManager{ 18 | 19 | 20 | @Autowired 21 | private TasteManagerMapper tasteManagerMapper; 22 | 23 | @Autowired 24 | private ManagerCountMapper managerCountMapper; 25 | 26 | 27 | /** 28 | * 分页获得 29 | * @param start 开始 30 | * @param num 总数 31 | * @return 32 | * @throws Exception 33 | */ 34 | public List managerTasteList(Integer start, Integer num) throws Exception { 35 | return tasteManagerMapper.findTasteList(start,num); 36 | } 37 | 38 | /** 39 | * 获取单个兴趣信息 40 | * @param id 兴趣id 41 | * @return 兴趣实体 42 | * @throws Exception 43 | */ 44 | public TasteVo managerTaste(Integer id) throws Exception { 45 | return tasteManagerMapper.findTasteById(id); 46 | } 47 | 48 | /** 49 | * 添加兴趣信息 50 | * @param label 兴趣内容 51 | * @param uid  用户id 52 | * @return 1,0 53 | * @throws Exception 54 | */ 55 | public Integer managerInsertTaste(String label, Integer uid) throws Exception { 56 | return tasteManagerMapper.insertTasteByUidAndLabel(label,uid); 57 | } 58 | 59 | /** 60 | * 删除兴趣id 61 | * @param id 兴趣id 62 | * @return 1,0 63 | * @throws Exception 64 | */ 65 | public Integer managerDeleteTaste(Integer id) throws Exception { 66 | return tasteManagerMapper.deleteTasteById(id); 67 | } 68 | 69 | /** 70 | * 更新兴趣 71 | * @param label 兴趣内容 72 | * @param id 1,0 73 | * @return 1,0 74 | */ 75 | public Integer managerUpdateTaste(String label, Integer id) throws Exception{ 76 | return tasteManagerMapper.updateTasteById(label,id); 77 | } 78 | 79 | /** 80 | * 查询请求总数 81 | * @return 82 | * @throws Exception 83 | */ 84 | public PageJo managerTasteCount() throws Exception{ 85 | return managerCountMapper.findCount(ManagerConutStatus.MANAGER_TASTE_COUNT_TYPE); 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/mobile/NewsAppService.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.mobile; 2 | 3 | /** 4 | * Created by yuan on 16-4-4. 5 | * 服务层 - 移动端 - 新闻接口 6 | */ 7 | public interface NewsAppService { 8 | } 9 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/mobile/UserAppService.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.mobile; 2 | 3 | import yuan.ssm.vo.LikedVo; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Created by yuan on 16-4-4. 9 | * 服务层 - 移动端 - 用户接口 10 | */ 11 | public interface UserAppService { 12 | 13 | //修改密码 14 | Integer updateUserPass(Integer id,String newPass) throws Exception; 15 | 16 | //修改头像 17 | Integer updateUserHead(Integer id,String newHead) throws Exception; 18 | 19 | //获取新闻点赞人的信息 20 | List getLikedUserIfo(Integer nid) throws Exception; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/mobile/impl/NewsAppServiceImpl.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.mobile.impl; 2 | 3 | import yuan.ssm.service.mobile.NewsAppService; 4 | 5 | /** 6 | * Created by yuan on 16-4-4. 7 | * 服务层 - 移动端 - 新闻接口 - 接口实现 8 | */ 9 | public class NewsAppServiceImpl implements NewsAppService{ 10 | } 11 | -------------------------------------------------------------------------------- /yuannews-service/src/main/java/yuan/ssm/service/mobile/impl/UserAppServiceImpl.java: -------------------------------------------------------------------------------- 1 | package yuan.ssm.service.mobile.impl; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import yuan.ssm.common.util.DateUtil; 5 | import yuan.ssm.common.util.FontImageUtil; 6 | import yuan.ssm.common.util.StringUtil; 7 | import yuan.ssm.dao.customer.NewsMapper; 8 | import yuan.ssm.dao.manager.UserManagerMapper; 9 | import yuan.ssm.service.mobile.UserAppService; 10 | import yuan.ssm.vo.LikedVo; 11 | 12 | import java.util.List; 13 | import java.util.UUID; 14 | 15 | /** 16 | * Created by yuan on 16-4-4. 17 | * 服务层 - 移动端 - 用户接口 - 接口实现 18 | */ 19 | public class UserAppServiceImpl implements UserAppService{ 20 | 21 | 22 | @Autowired 23 | private UserManagerMapper userManagerMapper; 24 | 25 | @Autowired 26 | private NewsMapper newsMapper; 27 | 28 | /** 29 | * 修改用户密码 30 | * @param id 31 | * @param newPass 32 | * @return 33 | * @throws Exception 34 | */ 35 | public Integer updateUserPass(Integer id, String newPass) throws Exception { 36 | return userManagerMapper.updateUserPass(id,newPass); 37 | } 38 | 39 | /** 40 | * 修改用户头像 41 | * @param id 用户id 42 | * @param newHead 新头像 43 | * @return 状态 44 | * @throws Exception 45 | */ 46 | public Integer updateUserHead(Integer id, String newHead) throws Exception { 47 | return userManagerMapper.updateUserHead(id,newHead); 48 | } 49 | 50 | /** 51 | * 查询 52 | * @param nid 新闻id 53 | * @return list 54 | * @throws Exception 55 | */ 56 | public List getLikedUserIfo(Integer nid) throws Exception { 57 | return newsMapper.findLikedNid(nid); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /yuannews-service/src/test/java/common/ServiceBaseTest.java: -------------------------------------------------------------------------------- 1 | package common; 2 | 3 | import org.junit.Before; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.support.ClassPathXmlApplicationContext; 6 | 7 | /** 8 | * Created by yuan on 16-4-7 9 | * 基础工具类 10 | */ 11 | public class ServiceBaseTest { 12 | 13 | 14 | public ApplicationContext context; 15 | 16 | @Before 17 | public void setUp(){ 18 | context=new ClassPathXmlApplicationContext(ServiceConstant.SERVICE_APPLICATION); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /yuannews-service/src/test/java/common/ServiceConstant.java: -------------------------------------------------------------------------------- 1 | package common; 2 | 3 | /** 4 | * Created by yuan on 16-4-7. 5 | */ 6 | public interface ServiceConstant { 7 | 8 | String SERVICE_APPLICATION="classpath:spring/applicationContext-*.xml"; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /yuannews-service/src/test/java/custom/CustomerTest.java: -------------------------------------------------------------------------------- 1 | package custom; 2 | 3 | import common.ServiceBaseTest; 4 | import org.junit.Test; 5 | import yuan.ssm.common.newsenum.ServiceEnum; 6 | import yuan.ssm.common.util.LoggerUtil; 7 | import yuan.ssm.pojo.CSCustom; 8 | import yuan.ssm.pojo.NewsCustom; 9 | import yuan.ssm.service.customer.NewsService; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * ================================================== 15 | *

16 | * 版权: 软件工程.net12-1 原明卓 17 | *

18 | * 项目: 基于用户兴趣标签的新闻推荐系统 19 | *

20 | * 作者: 原明卓 21 | *

22 | * 版本: 1.0 23 | *

24 | * 创建日期: 16-4-26 下午11:41 25 | *

26 | * 功能描述: newsservice测试类 27 | *

28 | *

29 | * 功能更新历史: 30 | *

31 | * ================================================== 32 | */ 33 | public class CustomerTest extends ServiceBaseTest{ 34 | 35 | private NewsService newsService; 36 | @Override 37 | public void setUp() { 38 | super.setUp(); 39 | newsService= (NewsService) super.context.getBean("newsServiceImpl"); 40 | } 41 | 42 | @Test 43 | public void testfindCustomById() throws Exception { 44 | List customById = newsService.findCustomById(0, 10, "", ServiceEnum.normal); 45 | LoggerUtil.printJSON(customById); 46 | } 47 | 48 | @Test 49 | public void testfindCustomByZan() throws Exception { 50 | List customById = newsService.findCustomByZan(0, 10, "社会", ServiceEnum.cate); 51 | LoggerUtil.printJSON(customById); 52 | } 53 | 54 | @Test 55 | public void findCateSourceIfoTest() throws Exception { 56 | CSCustom cateSourceIfo = newsService.findCateSourceIfo(); 57 | LoggerUtil.printJSON(cateSourceIfo); 58 | } 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /yuannews-service/src/test/java/manager/UserManagerTest.java: -------------------------------------------------------------------------------- 1 | package manager; 2 | 3 | import common.ServiceBaseTest; 4 | import org.junit.Before; 5 | import org.junit.Test; 6 | import yuan.ssm.dao.manager.UserManagerMapper; 7 | import yuan.ssm.other.PageJo; 8 | import yuan.ssm.service.manager.UserManager; 9 | import yuan.ssm.service.manager.impl.UserManagerImpl; 10 | import yuan.ssm.vo.UserVo; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * Created by yuan on 16-4-7. 16 | * 服务端测试类实现 17 | */ 18 | public class UserManagerTest extends ServiceBaseTest{ 19 | 20 | private UserManager userManager; 21 | 22 | @Before 23 | public void setUp(){ 24 | super.setUp(); 25 | userManager= (UserManager) context.getBean("userManagerImpl"); 26 | } 27 | 28 | @Test 29 | public void managerFindUserList() throws Exception { 30 | List userVos = userManager.managerFindUserList(0, 3); 31 | System.out.println(" 服务端测试结果 :  "+userVos); 32 | } 33 | 34 | @Test 35 | public void managerFindUserCount() throws Exception { 36 | PageJo pageJo = userManager.managerFindUserCount(); 37 | System.out.println(" 服务端测试结果 :  "+pageJo.getAllCount()); 38 | } 39 | 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /配置.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LABELNET/YuanNews/2e8d56a7a3085794b013b3e1a9f3f7a053d7e6c3/配置.png --------------------------------------------------------------------------------