package com.sys.lawyer.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sys.lawyer.base.BaseController;
import com.sys.lawyer.po.*;
import com.sys.lawyer.service.*;
import com.sys.lawyer.utils.Base64Img;
import com.sys.lawyer.utils.CaptchaUtil;
import com.sys.lawyer.utils.Pager;
import com.sys.lawyer.vo.ApplyVo;
import com.sys.lawyer.vo.EvaluateVo;
import com.sys.lawyer.vo.ReleasesVo;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.annotations.Param;
import org.joda.time.DateTime;
import org.joda.time.Period;
import org.joda.time.PeriodType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author - - admin
* @ClassName:
* @Description:
* @date - 2018年10月17日 14时41分30秒
*/
@Controller
@RequestMapping("web")
public class HomeController extends BaseController {
/**
* 依赖注入 start dao/service/===
*/
@Autowired
private UsersService usersService;
@Autowired
private TypeService typeService;
@Autowired
private PhotoService photoService;
@Autowired
private ReleasesService releasesService;
@Autowired
private ApplyService applyService;
@Autowired
private EvaluateService evaluateService;
@Autowired
private MessageService messageService;
@RequestMapping(value = "getPhoto.json")
@ResponseBody
public String getPhoto() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("list", photoService.listAll());
return jsonObject.toJSONString();
}
@RequestMapping(value = "login.json")
@ResponseBody
public String login(Users users, String captcha, HttpServletRequest request) {
JSONObject jsonObject = new JSONObject();
users.setRole(null);
Users user = usersService.getByEntity(users);
String code = (String) request.getSession().getAttribute("randomString");
if (empty(captcha) || !code.toLowerCase().equals(captcha.toLowerCase())){
jsonObject.put("message", "验证码错误");
jsonObject.put("flag", false);
} else if (empty(user)){
jsonObject.put("message", "用户信息错误");
jsonObject.put("flag", false);
} else if (user != null && user.getRole() < 2){
jsonObject.put("message", "管理员不可登录");
jsonObject.put("flag", false);
} else if (user.getIsSh() == 0){
jsonObject.put("message", "账号未通过审核");
jsonObject.put("flag", false);
} else {
request.getSession().setAttribute("user", user);
jsonObject.put("flag", true);
}
return jsonObject.toJSONString();
}
@RequestMapping(value = "/listAll.json")
@ResponseBody
public String listAll(@Param(value="typeId")Integer typeId, HttpServletRequest request){
List<Users> list1 = usersService.findByTypeToEntity(typeId);
if (!CollectionUtils.isEmpty(list1)){
for (Users p : list1){
p.setPhoto(request.getContextPath()+p.getPhoto());
}
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("list", list1);
return jsonObject.toJSONString();
}
@RequestMapping(value = "home.do")
public String home(Model model) {
List<Photo> listAll = photoService.listAll();
model.addAttribute("list",listAll );
model.addAttribute("user", usersService.getUser());
model.addAttribute("types", typeService.listAll());
return "web/home";
}
@RequestMapping(value = "/")
public String homes(Model model) {
model.addAttribute("list", photoService.listAll());
model.addAttribute("user", usersService.getUser());
model.addAttribute("types", typeService.listAll());
return "web/home";
}
@RequestMapping(value = "grkj.do")
public String grkj() {
return "web/grkj";
}
@RequestMapping(value = "fbzw.do")
public String fbzw(Model model, HttpServletRequest request) {
Users users = usersService.getUser();
if (empty(users)){
return "redirect:/web/login.do";
}
users.setPhoto(request.getContextPath()+users.getPhoto());
model.addAttribute("user", users);
return "web/fbzw";
}
/**
* 个人空间参与职位
* @return
*/
@RequestMapping(value = "cyzw.json")
@ResponseBody
public String cyzw(){
JSONObject jsonObject = new JSONObject();
Users users = usersService.getUser();
if (empty(users)) {
jsonObject.put("flag", false);
jsonObject.put("message", "请登录");
} else {
Apply apply = new Apply();
apply.setSqr(users.getId());
Pager<Apply> pagers = applyService.findByEntity(apply);
List<ApplyVo> applyVos = new ArrayList<>();
for (Apply a : pagers.getDatas()){
ApplyVo applyVo = new ApplyVo();
Releases releases = releasesService.getById(a.getReleaseId());
a.setTypeName(typeService.getById(releases.getTypeId()).getName());
Apply apply1 = a;
applyVo.setApply(apply1);
applyVo.setReleases(releases);
applyVo.setUsers(usersService.getById(releases.getUsersId()));
Period p = new Period(new DateTime(releases.getZjTime()), new DateTime(releases.getFwTime()), PeriodType.days());
int days = p.getDays();
applyVo.setFwsc(days);
applyVos.add(applyVo);
}
jsonObject.put("page", pagers);
jsonObject.put("list", JSON.toJSONString(applyVos, SerializerFeature.DisableCircularReferenceDetect));
}
return jsonObject.toJSONString();
}
@RequestMapping(value = "yfblist.json")
@ResponseBody
public String yfblist(Releases releases, Integer pageIndex, Integer pageSize){
JSONObject jsonObject = new JSONObject();
Users users = usersService.getUser();
if (empty(users)) {
jsonObject.put("flag", false);
jsonObject.put("message", "请登录");
} else {
releases.setUsersId(users.getId());
List<Releases> pagers = releasesService.listAllByEntity(releases);
jsonObject.put("list", pagers);
}
return jsonObject.toJSONString();
}
@RequestMapping(value = "yfbEdit.do")
public String yfbEdit(Releases releases, Model model){
Users users = usersService.getUser();
if (empty(users)) {
model.addAttribute("flag", true);
} else {
model.addAttribute("bean", releasesService.getByEntity(releases));
model.addAttribute("types", typeService.listAll());
}
return "web/reEdit";
}
@RequestMapping(value
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
本人十余年JAVA架构设计经验,擅长JAVA高可用、分布式、高并发系统架构设计。有志于做JAVA系统性的技术提升的同学可与我联系,交个朋友哦~ 本人十余年JAVA架构设计经验,擅长JAVA高可用、分布式、高并发系统架构设计。有志于做JAVA系统性的技术提升的同学可与我联系,交个朋友哦~ 本人十余年JAVA架构设计经验,擅长JAVA高可用、分布式、高并发系统架构设计。有志于做JAVA系统性的技术提升的同学可与我联系,交个朋友哦~
资源推荐
资源详情
资源评论
收起资源包目录
《毕业设计&代码复用》--Maven基于SSM支教志愿者招聘管理系统毕业源码案例设计.zip (1116个子文件)
Upload.asp 5KB
Upload.aspx 106B
Upload.aspx 106B
.classpath 6KB
Upload.asp.cls 14KB
org.eclipse.wst.common.component 577B
org.eclipse.wst.jsdt.ui.superType.container 49B
Upload.aspx.cs 4KB
summernote-bs3.css 143KB
style.css 138KB
bootstrap.css 136KB
bootstrap.min.css 118KB
animate.css 74KB
animate.css 64KB
layui.css 52KB
theme.css 39KB
home.css 33KB
datepicker3.css 33KB
font-awesome.css 31KB
font-awesome.min.css 30KB
bootstrap-rtl.css 30KB
font-awesome.min.css 26KB
ambiance.css 25KB
style.min.css 25KB
icon.css 25KB
sweetalert.css 18KB
simditor.css 17KB
ui.jqgrid.css 16KB
layer.css 14KB
jasny-bootstrap.min.css 14KB
jquery-ui-1.10.4.custom.min.css 14KB
chosen.css 12KB
dropzone.css 11KB
layer.css 11KB
layim.css 11KB
fullcalendar.css 11KB
summernote.css 10KB
plyr.css 10KB
layui.mobile.css 10KB
style.css 9KB
style.css 9KB
webuploader-demo.css 8KB
laydate.css 7KB
style.css 7KB
codemirror.css 7KB
login.css 7KB
reg.css 7KB
blueimp-gallery.min.css 7KB
awesome-bootstrap-checkbox.css 7KB
toastr.min.css 7KB
zTreeStyle.css 6KB
laydate.css 6KB
blueimp-gallery.css 6KB
jquery.steps.css 6KB
bootstrap-table.min.css 5KB
footable.core.css 5KB
jquery.fancybox.css 5KB
dataTables.bootstrap.css 5KB
core.css 5KB
clockpicker.css 4KB
basic.css 4KB
style.css 4KB
bootstrap-colorpicker.min.css 3KB
laydate.css 3KB
cropper.min.css 3KB
ion.rangeSlider.css 3KB
slicknav.css 3KB
jquery.nouislider.css 3KB
layer.ext.css 3KB
jquery.bxslider.css 3KB
bootstrap-markdown.min.css 3KB
jquery.gritter.css 3KB
style.css 2KB
blueimp-gallery-video.css 2KB
login.css 2KB
reset.css 2KB
ion.rangeSlider.skinFlat.css 2KB
bootstrap-duallistbox.css 2KB
slick.css 2KB
blueimp-gallery-indicator.css 2KB
custom.css 1KB
bootstrap-multiselect.css 1KB
code.css 1KB
bootstrap-treeview.css 1KB
demo.css 867B
prettify.css 815B
fullcalendar.print.css 660B
switchery.css 611B
abp.css 595B
webuploader.css 515B
webuploader.css 515B
web_pop.css 485B
morris-0.4.3.min.css 443B
tiki.css 441B
abp.min.css 432B
ie10fix.css 222B
tiddlywiki.css 220B
abp.mixings.css 46B
abp.mixings.min.css 3B
Thumbs.db 27KB
共 1116 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12
资源评论
季风泯灭的季节
- 粉丝: 696
- 资源: 2920
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Python3实现基于ARIMA模型来预测茅台股票价格趋势(数据集+代码).rar
- 黑色简洁的PHP短网址短链接生成源码.rar
- dbeaver-ce-24.0.5-x86-64-setup.zip
- hfm (1).cpp
- 数据分析案例-数据科学相关岗位薪资可视化分析(数据集+代码).rar
- PSO-SDAE基于粒子群优化堆叠去噪自编码器的数据回归预测多变量回归预测(Matlab完整源码和数据)
- 基于卷积神经网络MobileNet 的情感识别源码.7z
- 一个很好的elasticsearchJavarest客户端 它以类似于mybatis的方式操作和访问elasticsearch
- student.sql
- 一个简单的卷积神经网络(Convolutional Neural Network, CNN)示例
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功