package com.daowen.controller;
import java.text.MessageFormat;
import java.util.List;
import java.util.HashMap;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.daowen.util.JsonResult;
import com.daowen.vo.LanmuVo;
import com.daowen.vo.XinxiVo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.daowen.entity.*;
import com.daowen.service.*;
import com.daowen.ssm.simplecrud.SimpleController;
import com.daowen.webcontrol.PagerMetal;
import org.springframework.web.bind.annotation.ResponseBody;
/**************************
*
* 文章控制
*
*/
@Controller
public class XinxiController extends SimpleController {
@Autowired
private XinxiService xinxiSrv = null;
@Autowired
private LanmuService lanmuSrv = null;
@Autowired
private AgreerecordService arSrv=null;
@Override
@RequestMapping("/admin/xinximanager.do")
public void mapping(HttpServletRequest request, HttpServletResponse response) {
mappingMethod(request, response);
}
@RequestMapping(value="/admin/xinxi/agree")
@ResponseBody
public JsonResult agree(HttpServletRequest request, HttpServletResponse response) {
String targetid = request.getParameter("targetid");
String commentator = request.getParameter("commentator");
if (targetid == null || commentator == null) {
return JsonResult.error(-1, "参数异常");
}
Boolean hasExist = arSrv.isExist(MessageFormat.format(
" where targetid={0} and typename=''xinxi'' and commentator=''{1}'' ", targetid, commentator));
if (hasExist) {
return JsonResult.error(-2, "你已经操作过");
}
Xinxi xinxi = xinxiSrv.load("where id=" + targetid);
if (xinxi == null) {
return JsonResult.error(-3, "数据异常");
}
Agreerecord ar = new Agreerecord();
ar.setCommentator(commentator);
ar.setTargetid(targetid);
ar.setTypename("xinxi");
arSrv.save(ar);
xinxi.setAgreecount(xinxi.getAgreecount() + 1);
xinxiSrv.update(xinxi);
JsonResult jsonResult =JsonResult.success(1,"你赞了他");
HashMap<String,Integer> data= new HashMap<String,Integer>();
data.put("agreecount", xinxi.getAgreecount());
jsonResult.setData(data);
return jsonResult;
}
@RequestMapping(value="/admin/xinxi/against")
@ResponseBody
public JsonResult against(HttpServletRequest request, HttpServletResponse response) {
String targetid = request.getParameter("targetid");
String commentator = request.getParameter("commentator");
if (targetid == null || commentator == null) {
return JsonResult.error(-1, "参数异常");
}
Boolean hasExist = arSrv.isExist(MessageFormat.format(
" where targetid={0} and typename=''xinxi'' and commentator=''{1}'' ", targetid, commentator));
if (hasExist) {
return JsonResult.error(-2, "你已经操作过");
}
Xinxi xinxi = xinxiSrv.load("where id=" + targetid);
if (xinxi == null) {
return JsonResult.error(-3, "数据异常");
}
Agreerecord ar = new Agreerecord();
ar.setCommentator(commentator);
ar.setTargetid(targetid);
ar.setTypename("xinxi");
arSrv.save(ar);
xinxi.setAgainstcount(xinxi.getAgainstcount()+1);
xinxiSrv.update(xinxi);
JsonResult<HashMap<String,Integer>> jsonResult = JsonResult.success(1, "你赞了它");
HashMap<String,Integer> data= new HashMap<String,Integer>();
data.put("againstcount", xinxi.getAgainstcount());
jsonResult.setData(data);
return jsonResult;
}
@ResponseBody
@PostMapping("/admin/xinxi/clickstat")
public JsonResult clickcounttongji(){
String sql=" select lm.name as name,sum(clickcount) as value from xinxi x,lanmu lm where lm.id=x.lmid group by lm.id ,lm.name ";
List<HashMap<String,Object>> listXinxi=xinxiSrv.queryToMap(sql);
return JsonResult.success(1,"",listXinxi);
}
@ResponseBody
@PostMapping("/admin/xinxi/count")
public JsonResult counttongji(){
String sql=" select lm.name as name,count(*) as value from xinxi x,lanmu lm where lm.id=x.lmid group by lm.id ,lm.name ";
List<HashMap<String,Object>> listXinxi=xinxiSrv.queryToMap(sql);
return JsonResult.success(1,"",listXinxi);
}
@ResponseBody
@PostMapping("/admin/xinxi/list")
public JsonResult list(){
HashMap<String,Object> map=new HashMap<>();
String userid=request.getParameter("userid");
map.put("userid",userid);
List<XinxiVo> listXinxi=xinxiSrv.getEntityPlus(map);
return JsonResult.success(1,"获取信息",listXinxi);
}
@ResponseBody
@PostMapping("/admin/xinxi/mylanmu")
public JsonResult mylanmu(){
List<LanmuVo> listLanmu=xinxiSrv.getMyLanmus();
return JsonResult.success(1,"获取栏目",listLanmu);
}
@ResponseBody
@PostMapping("/admin/xinxi/hot")
public JsonResult hotxinxi(){
HashMap<String,Object> map=new HashMap<>();
map.put("order","order by clickcount desc");
map.put("topcount",10);
List<XinxiVo> listXinxi=xinxiSrv.getEntityPlus(map);
return JsonResult.success(1,"获取信息",listXinxi);
}
@ResponseBody
@PostMapping("/admin/xinxi/info")
public JsonResult info(){
String id=request.getParameter("id");
if(id==null)
return JsonResult.error(-1,"参数异常");
XinxiVo xinxi=xinxiSrv.loadPlus(Integer.parseInt(id));
return JsonResult.success(1,"获取信息",xinxi);
}
public void shenpi() {
String id = request.getParameter("id");
String forwardurl = request.getParameter("forwardurl");
String status = request.getParameter("state");
String reply = request.getParameter("reply");
String shenpiren = request.getParameter("shenpiren");
int statuscode = 3;
// 验证错误url
String errorurl = request.getParameter("errorurl");
if (id == null)
return;
Xinxi xinxi = xinxiSrv.load(" where id=" + id);
if (xinxi == null)
return;
if (status != null)
statuscode = Integer.parseInt(status);
xinxi.setState(statuscode);
xinxiSrv.update(xinxi);
if (forwardurl == null) {
forwardurl = "/admin/xinximanager.do?actiontype=get";
}
redirect(forwardurl);
}
@ResponseBody
@GetMapping("/admin/xinxi/related")
public JsonResult related(){
String id=request.getParameter("id");
if(id==null||id.equals(""))
return JsonResult.error(-1,"参数异常");
List<Xinxi> relateds = xinxiSrv.getRelated(Integer.parseInt(id));
return JsonResult.success(1,"",relateds);
}
/********************************************************
******************信息注销监听支持*****************************
*********************************************************/
public void delete() {
String[] ids = request.getParameterValues("ids");
if (ids == null)
return;
String spliter = ",";
String SQL = "
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Java项目实战-疾病科普知识网站的Java毕业设计(源码+演示视频+数据库).zip 【项目技术】 java+mysql 【实现功能】 前台主要面向的是普通用户和医生,其主要功能包括: (1) 登录/注册模块:通过密码、邮箱、手机号等对用户的信息进行核实校验。 (2) 首页展示模块:可以进行全局搜索。 (3)文章详情页展示模块:医生的个人信息,可以关注此医生、收藏此文章,以及下方评论互动 (4)发布模块: 用户和医生可以发布自己对某些疾病的建议和预防知识总结 (5)个人信息模块:展示自己关注的文章和作者发布的文章 (6)疾病种类大全模块:可以按照疾病种类进行分类查询, (7)权威发布模块。
资源推荐
资源详情
资源评论
收起资源包目录
Java项目实战-疾病科普知识网站的Java毕业设计(源码+演示视频+数据库).zip (2603个子文件)
50e22607-895e-455a-9956-2c2ad1607feb 201KB
HuiyuanController.class 13KB
XinxiController.class 13KB
PagesettingController.class 10KB
XinxiService.class 9KB
UsersController.class 9KB
TopicController.class 9KB
CommentBuilder.class 7KB
ForumBuilder.class 7KB
LanmuController.class 6KB
LeavewordController.class 6KB
SysroleController.class 6KB
StagController.class 6KB
RecursionTree.class 6KB
SysconfigitemController.class 6KB
UploadController.class 6KB
JiaodiantuController.class 6KB
NoticeController.class 6KB
SysconfigController.class 6KB
ShoucangController.class 6KB
BankuaiController.class 5KB
SitenavController.class 5KB
SubtypeController.class 5KB
FriendlinkController.class 5KB
SimpleStatistics.class 5KB
CommentController.class 5KB
Huiyuan.class 4KB
LeavewordBuilder.class 4KB
FocusgraphicBuilder.class 4KB
Srvorder.class 4KB
AdminUserController.class 4KB
SingleFileUpload.class 4KB
HttpUtil.class 4KB
LanmuService.class 4KB
Topic.class 4KB
MailUtil.class 4KB
FansController.class 4KB
Xinxi.class 4KB
Users.class 3KB
FileUtil.class 3KB
ForumService.class 3KB
SitenavBuilder.class 3KB
FileUploadBase.class 3KB
SitesearchController.class 3KB
ViewHistory.class 2KB
Comment.class 2KB
BeansUtil.class 2KB
LanmuContentVo.class 2KB
XinxiVo.class 2KB
PagesettingService.class 2KB
SequenceUtil.class 2KB
JsonResult.class 2KB
BankuaiService.class 2KB
Shoucang.class 2KB
Leaveword.class 2KB
SysroleService.class 2KB
CustomJsonDateConverter$2.class 2KB
MainApplication.class 2KB
NoticeBuilder.class 2KB
TopicService.class 2KB
Notice.class 2KB
CustomJsonDateConverter$1.class 2KB
Jiaodiantu.class 2KB
HTMLUtil.class 2KB
FriendlinkBuilder.class 2KB
ImageTextItem.class 2KB
StringUtil.class 2KB
Sysconfigitem.class 2KB
Bankuai.class 2KB
MainApplication$1.class 2KB
CustomJsonDateConverter.class 1KB
LeavewordService.class 1KB
StagService.class 1KB
Agreerecord.class 1KB
Sitenav.class 1KB
LeavewordVo.class 1KB
Lanmu.class 1KB
SearchVo.class 1KB
UploadController$UploadExpress.class 1KB
HuiyuanService.class 1KB
PageContentVo.class 1KB
LanmuVo.class 1KB
PageSettingVo.class 1KB
BankuaiVo.class 1KB
MimeMessageDescription.class 1KB
Friendlink.class 1KB
Fans.class 1KB
TopicVo.class 1KB
PsItemVo.class 1KB
Psitem.class 1KB
UsersService.class 1KB
DbConfig.class 1KB
Pagesetting.class 987B
Sysconfig.class 981B
Subtype.class 971B
GuanzhuVo.class 928B
PaperModule.class 926B
Sysrole.class 882B
NameUtil.class 765B
Stag.class 757B
共 2603 条
- 1
- 2
- 3
- 4
- 5
- 6
- 27
资源评论
岛上程序猿
- 粉丝: 5499
- 资源: 4237
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- electron-v32.2.5-win32-x64资源包
- 日历组件使用········
- java班级管理系统(java毕业设计源码).zip
- bochb_assist_2.0.0.apk
- java无线点餐系统源码数据库 MySQL源码类型 WebForm
- 简历模板嵌入式常用知识&面试题库200M
- 常用基础元件的PCB封装库SchLib/IntLib通用原理图库接插件-脚距3.96
- 常用基础元件的PCB封装库SchLib/IntLib通用原理图库STM32 F2系列单片机
- 常用基础元件的PCB封装库SchLib/IntLib通用原理图库PIC系列单片机
- java通用后台管理系统源码数据库 MySQL源码类型 WebForm
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功