package com.daowen.controller;
import java.text.MessageFormat;
import java.util.ArrayList;
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.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.*;
import com.daowen.entity.*;
import com.daowen.service.*;
import com.daowen.ssm.simplecrud.SimpleController;
import com.daowen.webcontrol.PagerMetal;
/**************************
*
* 资讯资讯控制
*
*/
@RestController
public class XinxiController extends SimpleController {
@Autowired
private XinxiService xinxiSrv = null;
@Autowired
private LanmuService lanmuSrv = null;
@Autowired
private AgreerecordService arSrv=null;
@RequestMapping(value="/admin/xinxi/agree")
public JsonResult agree() {
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;
}
@ResponseBody
@PostMapping("/admin/xinxi/recomment")
public JsonResult recomment(){
Huiyuan temhy=(Huiyuan)request.getSession().getAttribute("huiyuan");
if(temhy==null)
return JsonResult.success(1,"暂无相关信息推荐");
//获取用户浏览记录
List<XinxiVo> listRecomment=xinxiSrv.getRecomment(request,temhy);
return JsonResult.success(1,"猜你喜欢",listRecomment);
}
@RequestMapping(value="/admin/xinxi/against")
public JsonResult against() {
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;
}
@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);
}
@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);
}
@PostMapping("/admin/xinxi/mylanmu")
public JsonResult mylanmu(){
List<LanmuVo> listLanmu=xinxiSrv.getMyLanmus();
return JsonResult.success(1,"获取栏目",listLanmu);
}
@PostMapping("/admin/xinxi/cascadelanmu")
public JsonResult CascadeList(){
List<LanmuVo> listLanmu = xinxiSrv.getMyLanmus();
JSONArray jsonArray=new JSONArray();
if(listLanmu!=null)
listLanmu.forEach(c->{
JSONObject jsonObject=new JSONObject();
jsonObject.put("value",c.getId());
jsonObject.put("label",c.getName());
if(c.getSubtypes()!=null){
JSONArray array = new JSONArray();
c.getSubtypes().forEach(subtype->{
JSONObject cobj=new JSONObject();
cobj.put("label",subtype.getName());
cobj.put("value",subtype.getId());
array.add(cobj);
jsonObject.put("children",array);
});
}
jsonArray.add(jsonObject);
});
return JsonResult.success(1,"获取成功",jsonArray);
}
@PostMapping("/admin/xinxi/list")
public JsonResult list(){
String lmid=request.getParameter("lmid");
String title = request.getParameter("title");
String pubren= request.getParameter("pubren");
String tuijian=request.getParameter("tuijian");
String ispaged=request.getParameter("ispaged");
String subtypeid= request.getParameter("subtypeid");
HashMap<String ,Object> map=new HashMap();
if (title != null)
map.put("title",title);
if(!"0".equals(lmid))
map.put("lmid",lmid);
if(subtypeid!=null)
map.put("subtypeid",subtypeid);
if(pubren!=null)
map.put("pubren",pubren);
if(tuijian!=null)
map.put("tuijian",tuijian);
map.put("order"," order by id desc ");
//
int pageindex = 1;
int pagesize = 10;
// 获取当前分页
String currentpageindex = request.getParameter("currentpageindex");
// 当前页面尺寸
String currentpagesize = request.getParameter("pagesize");
// 设置当前页
if (currentpageindex != null)
pageindex = new Integer(currentpageindex);
// 设置当前页尺寸
if (currentpagesize != null)
pagesize = new Integer(currentpagesize);
if(!"-1".equals(ispaged)) {
PageHelper.startPage(pageindex, pagesize);
PageInfo<XinxiVo> pageInfo = new PageInfo<XinxiVo>( xinxiSrv.getEntityPlus(map));
return JsonResult.success(1, "获取成功", pageInfo);
}
return JsonResult.success(1,"获取成功",xinxiSrv.getEntityPlus(map));
}
@PostMapping("/admin/xinxi/hot")
public JsonResult hotxinxi(){
HashMap<String,Object> map=new HashMap<>();
map.put("tuijian",1);
map.
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【Springboot+MySQL】鲜花商城销售系统、鲜花商城、在线鲜花商城、鲜花销售、花店、商城.zip主要针对计算机相关专业的正在做课程设计和期末大作业的学生和需要项目实战练习的学习者。包含全部项目源码、该项目可以直接使用、项目都经过严格调试,下载即用确保可以运行! 【Springboot+MySQL】鲜花商城销售系统、鲜花商城、在线鲜花商城、鲜花销售、花店、商城.zip主要针对计算机相关专业的正在做课程设计和期末大作业的学生和需要项目实战练习的学习者。包含全部项目源码、该项目可以直接使用、项目都经过严格调试,下载即用确保可以运行! 【Springboot+MySQL】鲜花商城销售系统、鲜花商城、在线鲜花商城、鲜花销售、花店、商城.zip主要针对计算机相关专业的正在做课程设计和期末大作业的学生和需要项目实战练习的学习者。包含全部项目源码、该项目可以直接使用、项目都经过严格调试,下载即用确保可以运行! 【Springboot+MySQL】鲜花商城销售系统、鲜花商城、在线鲜花商城、鲜花销售、花店、商城.zip主要针对计算机相关专业的正在做课程设计和期末大作业的学生和需要项目实战练习
资源推荐
资源详情
资源评论
收起资源包目录
【Springboot+MySQL】鲜花商城销售系统、鲜花商城、在线鲜花商城、鲜花销售、花店、商城.zip (2000个子文件)
index.css 227KB
bootstrap.css 144KB
bootstrap.min.css 120KB
ionicons.css 56KB
box.css 55KB
list.css 50KB
ionicons.min.css 50KB
font-awesome.css 34KB
jquery-ui.css 31KB
jquery.treetable.theme.default.css 29KB
cascader.css 29KB
font-awesome.min.css 28KB
date-picker.css 28KB
transfer.css 27KB
jquery-ui.min.css 26KB
bootstrap-theme.css 26KB
jquery-ui.min.css 25KB
quill.bubble.css 25KB
col.css 25KB
video-js.css 24KB
quill.snow.css 24KB
index.css 23KB
custom.css 23KB
pagination.css 23KB
bootstrap-theme.min.css 23KB
table.css 22KB
message-box.css 21KB
time-picker.css 21KB
_all.css 21KB
select.css 18KB
slider.css 18KB
jquery.ui.theme.css 17KB
tabs.css 16KB
base.css 16KB
myplayer.css 16KB
_all.css 15KB
_all.css 15KB
dropdown.css 15KB
jquery.ui.theme.min.css 13KB
jquery-confirm.css 13KB
_all.css 13KB
time-select.css 13KB
table-column.css 13KB
video-js.min.css 13KB
cascader-panel.css 13KB
tree.css 13KB
upload.css 12KB
icon.css 12KB
calendar.css 12KB
style.css 11KB
jquery-confirm.min.css 11KB
dapper.css 11KB
autocomplete.css 10KB
button.css 10KB
input-number.css 10KB
normalize.css 9KB
menu.css 9KB
quill.core.css 9KB
jquery.orgchart.css 9KB
leaveword.css 8KB
green.css 8KB
black.css 8KB
blue.css 8KB
default.css 8KB
color-picker.css 7KB
checkbox.css 7KB
bootstrap-table.css 7KB
magnific-popup.css 7KB
opera.css 7KB
aero.css 7KB
idialog.css 7KB
input.css 7KB
chrome.css 6KB
twitter.css 6KB
simple.css 6KB
step.css 5KB
collapse.css 5KB
drawer.css 5KB
jquery.toast.css 5KB
tag.css 5KB
style.css 5KB
forgetpw.css 5KB
colorbox.css 4KB
carousel.css 4KB
easydropdown.flat.css 4KB
jquery.ui.datepicker.css 4KB
easydropdown.metro.css 4KB
image.css 3KB
owl.carousel.min.css 3KB
dwvuecontrol.css 3KB
radio.css 3KB
jquery.ui.datepicker.min.css 3KB
easydropdown.css 3KB
form.css 3KB
dialog.css 3KB
select-dropdown.css 3KB
tooltip.css 3KB
jquery.ui.button.css 2KB
carousel.css 2KB
login.css 2KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
- m0_748436842024-11-05发现一个超赞的资源,赶紧学习起来,大家一起进步,支持!
辣椒种子
- 粉丝: 4152
- 资源: 5814
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功