基于javaweb+mysql的ssm+maven健身房俱乐部管理系统(java+ssm+jsp+bootstrap+layui+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM+Maven健身房俱乐部管理系统(java+ssm+jsp+bootstrap+layui+mysql)
项目介绍
本项目包含前后台,分为普通用户与管理员两种角色,前台为普通用户登录,后台为管理员登录;
管理员角色包含以下功能: 登录,会员管理-增删改查,员工管理-增删改查,课程管理,网站新闻管理,新闻添加编辑,留言管理等功能。
用户角色包含以下功能: 查看首页,查看关于我们,查看新闻,课程简介,会员注册,会员登录,查看新闻活动,登录后留言,查看留言等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本; 6.是否Maven项目:是;
技术栈
- 后端:Spring+SpringMVC+Mybatis 2. 前端:JSP+CSS+JavaScript+Layui+bootstrap+jquery
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中db.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
map.put("msg","重置失败");
}
}else if(members.size() == 0){
map.put("msg","该邮箱没有被注册");
}
}else{
map.put("msg","请输入正确的邮箱");
}
return map;
}
/**
* 前台跳转到登录界面
* @param request
* @param model
* @return
* @throws UnsupportedEncodingException
*/
@RequestMapping("/login.html")
public String loginPage(HttpServletRequest request,Model model) throws IOException {
//判断是否用户登录时选择了记住密码,即cookie中有没有信息
Cookie[] cookies = request.getCookies();
String username = "";
String pwd = "";
if(cookies != null){
for (Cookie cookie : cookies) {
if(cookie.getName().equals("user")){
username = URLDecoder.decode(cookie.getValue().split("#")[0],"UTF-8");
pwd = cookie.getValue().split("#")[1];
break;
}
}
model.addAttribute("mname",username);
model.addAttribute("mpassword",pwd);
}
return "login";
}
/**
* 用户登录
* @param mname
* @param mpassword
* @param request
* @param response
* @return
* @throws Exception
*/
@RequestMapping("/user/login.html")
@ResponseBody
public Map<String, String> login(String mname, String mpassword, HttpServletRequest request, HttpServletResponse response) throws Exception{
@RequestMapping("/admin/employee/goaddorupdate.html")
public String goUpdate(Model model,String eid){
//查询所有职务
List<Post> posts = postService.selectByExample(new PostExample());
model.addAttribute("posts",posts);
//eid不为null,就进行更新,根据员工id查询员工
if(eid!=null&&!eid.equals(" ")){
Employee employee = employeeService.selectByPrimaryKey(Integer.parseInt(eid));
model.addAttribute("employee",employee);
}
return "admin/employee/employeeedit";
}
@RequestMapping("/admin/employee/doaddorupdate.html")
@ResponseBody
public Map<String,Object> doaddorupdate(Employee employee,String time){
Map<String,Object> updateMap = new HashMap<String,Object>();
int i = 0;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date date = sdf.parse(time);
employee.setEhire(date);
} catch (ParseException e) {
e.printStackTrace();
}
if(employee.getEid()==null){//没有eid则是添加员工
i = employeeService.insertSelective(employee);
if(i>0){
updateMap.put("msg","添加成功");
updateMap.put("status",1);
}else{
updateMap.put("msg","添加失败");
updateMap.put("status",0);
}
}else{
i = employeeService.updateByPrimaryKeySelective(employee);
if(i>0){
updateMap.put("msg","更新成功");
updateMap.put("status",1);
}else{
updateMap.put("msg","更新失败");
updateMap.put("status",0);
}
}
return updateMap;
}
model.addAttribute("news",news);
//查询所有课程类型
List<Newskinds> newskinds = newsKindsService.selectByExample(new NewskindsExample());
model.addAttribute("newskinds",newskinds);
return "admin/news/newsinfo";
}
@RequestMapping("/admin/news/del.html")
@ResponseBody
public Map<String,Object> newsDel(String nid){
int i = newsService.deleteByPrimaryKey(Integer.parseInt(nid));
Map<String ,Object> delMap = new HashMap<String,Object>();
if(i>0){//删除成功
delMap.put("status",1);
}else{
delMap.put("status",0);
}
return delMap;
}
/**
* 富文本编辑器中上传图片组件
* @param file
* @return
*/
@RequestMapping("/admin/news/upload.html")
@ResponseBody
public Map<String,Object> uploadImg(MultipartFile file){
String extName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
String fileName = System.currentTimeMillis()+extName;
File newFile = new File(Thread.currentThread().getContextClassLoader().getResource("").getPath().substring(0,Thread.currentThread().getContextClassLoader().getResource("").getPath().length()-16)+"/sterngymimages/"+fileName);
try {
file.transferTo(newFile);
} catch (IOException e) {
e.printStackTrace();
}
Map<String,Object> uploadMap = new HashMap<String,Object>();
Map<String,String> srcMap = new HashMap<String, String>();
srcMap.put("src","http://localhost:8080/sterngymimages/"+fileName);
uploadMap.put("code",0);
uploadMap.put("msg","");
uploadMap.put("data",srcMap);
return uploadMap;
}
sendMsgMap.put("msg","留言成功");
}else{
sendMsgMap.put("status",0);
sendMsgMap.put("msg","留言失败");
}
return sendMsgMap;
}
}
/**
* 前台 用户查看留言
* @param request
* @param model
* @return
*/
@RequestMapping("/message.html")
public String memberCenter(HttpServletRequest request, Model model){
Member member = (Member)request.getSession().getAttribute("member");
List<Message> messages = messageService.selectMessageWithReply(member.getMid());
model.addAttribute("messages",messages);
return "membermessage";
}
/**
* 前台 用户查看订购
* @param request
* @param model
* @return
*/
@RequestMapping("/dinggou.html")
public String dinggou(HttpServletRequest request, Model model){
Member member = (Member)request.getSession().getAttribute("member");
if(member.getDaoqi() != null) {
request.getSession().setAttribute("huiyuan", member.getHuiyuan());
Date date = member.getDaoqi();
String strDateFormat = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
request.getSession().setAttribute("daoqi", sdf.format(date));
}
TblOrderExample tblOrderExample = new TblOrderExample();
TblOrderExample.Criteria criteria = tblOrderExample.createCriteria();
criteria.andMemberIdEqualTo(member.getMid());
List<TblOrder> orders = orderService.selectByExample(tblOrderExample);
List<Order> list = new ArrayList<Order>();
int i = 1;
for(TblOrder tblOrder:orders) {
Order order = new Order();
order.setTblOrder(tblOrder);
order.setId(i);
public String newsInfo(Model model,String nid){
//查询所有新闻类型
List<Newskinds> newskinds = newsKindsService.selectByExample(new NewskindsExample());
model.addAttribute("newskinds",newskinds);
News news = newsService.selectByPrimaryKey(Integer.parseInt(nid));
model.addAttribute("news",news);
return "newsinfo";
}
/**
* 后台管理跳转到网站管理界面
*
* @return
*/
@RequestMapping("/admin/news.html")
public String adminnews(Model model) {
//查询所有新闻类型
List<Newskinds> newskinds = newsKindsService.selectByExample(new NewskindsExample());
model.addAttribute("newskinds", newskinds);
return "admin/news/newslist";
}
/**
* 新闻列表
*
* @param page
* @param limit
* @param model
* @param ntitle
* @return
*/
@RequestMapping("/admin/newslist.html")
@ResponseBody
public Map<String, Object> newslistPage(String page, String limit, Model model, String ntitle) {
//查询所有新闻类型
List<Newskinds> newskinds = newsKindsService.selectByExample(new NewskindsExample());
model.addAttribute("newskinds", newskinds);
//查询所有新闻
NewsExample newsExample = new NewsExample();
NewsExample.Criteria criteria = newsExample.createCriteria();
if (ntitle != null && !ntitle.equals("")) {
criteria.andNtitleLike("%"+ntitle+"%");
}
PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(limit));
List<News> news = newsService.selectByExampleWithBLOBs(newsExample);
PageInfo<News> pageInfo = new PageInfo<News>(news);
Map<String, Object> pageMap = new HashMap<String, Object>();
pageMap.put("code", 0);
pageMap.put("msg", "");
pageMap.put("count", pageInfo.getTotal());
pageMap.put("data", pageInfo.getList());
*/
@RequestMapping("admin/adminindex.html")
public Object admin(HttpServletRequest request,HttpServletResponse response,Model model) throws IOException{
Member member = (Member)request.getSession().getAttribute("member");
if(!member.getMname().equals("admin")){
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8;");
PrintWriter writer = response.getWriter();
return false;
}
return request.getContextPath()+"/admin/adminindex";
}
/**
* 后台跳转到会员管理
* @return
*/
@RequestMapping("/admin/memberlist.html")
public String memberlistPage(){
return "admin/member/membermanage";
}
/**
* 后台会员管理分页
* @param page
* @param limit
* @param mname
* @return
*/
@RequestMapping("/admin/userlist.html")
@ResponseBody
public Map<String,Object> userlistPage(String page,String limit,String mname){
MemberExample memberExample = new MemberExample();
if(mname != null && !mname.equals("")){
MemberExample.Criteria criteria = memberExample.createCriteria();
criteria.andMnameLike("%"+mname+"%");
}
PageHelper.startPage(Integer.parseInt(page),Integer.parseInt(limit));
List<Member> members = memberService.selectByExample(memberExample);
PageInfo<Member> pageInfo = new PageInfo<Member>(members);
Map<String,Object> pageMap = new HashMap<String,Object >();
map.put("msg","重置成功,请用新密码登录,如果没有查收到邮件,请到垃圾箱中查看!");
}else{
map.put("msg","重置失败");
}
}else if(members.size() == 0){
map.put("msg","该邮箱没有被注册");
}
}else{
map.put("msg","请输入正确的邮箱");
}
return map;
}
/**
* 前台跳转到登录界面
* @param request
* @param model
* @return
* @throws UnsupportedEncodingException
*/
@RequestMapping("/login.html")
public String loginPage(HttpServletRequest request,Model model) throws IOException {
//判断是否用户登录时选择了记住密码,即cookie中有没有信息
Cookie[] cookies = request.getCookies();
String username = "";
String pwd = "";
if(cookies != null){
for (Cookie cookie : cookies) {
if(cookie.getName().equals("user")){
username = URLDecoder.decode(cookie.getValue().split("#")[0],"UTF-8");
pwd = cookie.getValue().split("#")[1];
break;
}
}
model.addAttribute("mname",username);
model.addAttribute("mpassword",pwd);
}
return "login";
}
/**
* 用户登录
* @param mname
* 预订
* @param classId
* @return
*/
@RequestMapping("/class/order.html")
@ResponseBody
public Map<String,Object> orderCourse(String classId, HttpServletRequest request){
Map<String,Object> orderMap = new HashMap<String,Object>();
TblOrder order = new TblOrder();
Member member = (Member) request.getSession().getAttribute("member");
order.setMemberId(member.getMid());
order.setOcreatetime(new Date());
order.setOstatus(1);
order.setClassId(Integer.parseInt(classId));
TblOrderExample tblOrderExample = new TblOrderExample();
TblOrderExample.Criteria criteria = tblOrderExample.createCriteria();
criteria.andMemberIdEqualTo(member.getMid());
criteria.andClassIdEqualTo(Integer.parseInt(classId));
List<TblOrder> tblOrders = orderService.selectByExample(tblOrderExample);
if(!tblOrders.isEmpty()){//不为null说明已经预订
orderMap.put("msg","您已经预订过该课程,不可重复预订");
}else{
//判断是否已经满员
//1、先根据课程id查询课程的容量
TblOrderExample tblOrderExample2 = new TblOrderExample();
Class clazz = classService.selectByPrimaryKey(Integer.parseInt(classId));
TblOrderExample.Criteria criteria2 = tblOrderExample2.createCriteria();
criteria2.andClassIdEqualTo(Integer.parseInt(classId));
long haveOrder = orderService.countByExample(tblOrderExample2);
//2、已经预订人数和容量比较
if(new Long(haveOrder).intValue() == clazz.getClassvolume() ){
orderMap.put("msg","班级已经满员");
}else{
int i = orderService.insertSelective(order);
if(i>0){
orderMap.put("msg","预订成功");
}else {
orderMap.put("msg","预订失败");
}
}
}
return orderMap;
}
@RequestMapping("/admin/order/del.html")
@ResponseBody
public Map<String,Object> delOrder(String oid){
Map<String,Object> delMap = new HashMap<String,Object>();
int i = orderService.deleteByPrimaryKey(Integer.parseInt(oid));
if(i>0){
delMap.put("status",1);
}else{
delMap.put("status",0);
}
return delMap;
date = new Date();
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MONTH, 24);// 24小时制
date = cal.getTime();
member.setDaoqi(date);
}else {
date = member.getDaoqi();
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MONTH, 24);// 24小时制
date = cal.getTime();
member.setDaoqi(date);
}
}
member.setHuiyuan(name);
memberService.updateByPrimaryKeySelective(member);
request.getSession().setAttribute("member", member);
verifyMap.put("status",1);
return verifyMap;
}
/**
* 点击验证码重新生成新的验证码
*/
@RequestMapping("/login/captcha.html")
public void captcha(HttpServletRequest request, HttpServletResponse response)
throws Exception {
String capText = kaptcha.createText();
request.getSession().setAttribute(
com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY, capText);
BufferedImage bi = kaptcha.createImage(capText);
ServletOutputStream out = response.getOutputStream();
ImageIO.write(bi, "jpg", out);
try {
out.flush();
} finally {
out.close();
}
}
/**
* 验证码校验
*/
@RequestMapping("/kaptchaverify.html")
@ResponseBody
public Map<String,Object> verifyCode(String code,HttpServletResponse response,HttpServletRequest request){
Map<String,Object> verifyMap = new HashMap<String,Object>();
String codeText = (String)request.getSession().getAttribute(Constants.KAPTCHA_SESSION_KEY);
if(codeText.equals(code)){
verifyMap.put("status",1);
}else{
* 更新或者添加新闻
* @param news
* @return
*/
@RequestMapping("/admin/news/addorupdate.html")
public String adminAddorupdatePage(News news,String time){
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date date=sdf.parse(time);
news.setNcreatetime(date);
} catch (ParseException e) {
e.printStackTrace();
}
if(news.getNid() == null){//添加
newsService.insertSelective(news);
}else{//更新
newsService.updateByPrimaryKeySelective(news);
}
return "forward:/admin/news.html";
}
/**
* 后台查看新闻详情
* @param model
* @param nid
* @return
*/
@RequestMapping("/admin/newsinfo.html")
public String adminNewsInfo(Model model,String nid){
News news = newsService.selectByPrimaryKey(Integer.parseInt(nid));
model.addAttribute("news",news);
//查询所有课程类型
List<Newskinds> newskinds = newsKindsService.selectByExample(new NewskindsExample());
model.addAttribute("newskinds",newskinds);
return "admin/news/newsinfo";
}
@RequestMapping("/admin/news/del.html")
@ResponseBody
public Map<String,Object> newsDel(String nid){
int i = newsService.deleteByPrimaryKey(Integer.parseInt(nid));
Map<String ,Object> delMap = new HashMap<String,Object>();
if(i>0){//删除成功
delMap.put("status",1);
}else{
delMap.put("status",0);
}
return delMap;
}
/**
* 富文本编辑器中上传图片组件
* @param file
* @return
return verifyMap;
}
/**
* 点击验证码重新生成新的验证码
*/
@RequestMapping("/login/captcha.html")
public void captcha(HttpServletRequest request, HttpServletResponse response)
throws Exception {
String capText = kaptcha.createText();
request.getSession().setAttribute(
com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY, capText);
BufferedImage bi = kaptcha.createImage(capText);
ServletOutputStream out = response.getOutputStream();
ImageIO.write(bi, "jpg", out);
try {
out.flush();
} finally {
out.close();
}
}
/**
* 验证码校验
*/
@RequestMapping("/kaptchaverify.html")
@ResponseBody
public Map<String,Object> verifyCode(String code,HttpServletResponse response,HttpServletRequest request){
Map<String,Object> verifyMap = new HashMap<String,Object>();
String codeText = (String)request.getSession().getAttribute(Constants.KAPTCHA_SESSION_KEY);
if(codeText.equals(code)){
verifyMap.put("status",1);
}else{
verifyMap.put("status",0);
verifyMap.put("msg","验证码错误");
}
return verifyMap;
}
/**
* 忘记密码 -重置密码
*/
@RequestMapping("/user/resetpwd.html")
@ResponseBody
public Map<String,Object> resetPwd(String email){
Map<String,Object> map = new HashMap<String,Object>();
if(email!=null&&!email.equals(" ")){
MemberExample memberExample = new MemberExample();
MemberExample.Criteria criteria = memberExample.createCriteria();
PageInfo<Employee> employeePageInfo = new PageInfo<Employee>(employees);
employeeMap.put("code",0);
employeeMap.put("msg","");
employeeMap.put("count",employeePageInfo.getTotal());
employeeMap.put("data",employeePageInfo.getList());
return employeeMap;
}
@RequestMapping("/admin/employee/goaddorupdate.html")
public String goUpdate(Model model,String eid){
//查询所有职务
List<Post> posts = postService.selectByExample(new PostExample());
model.addAttribute("posts",posts);
//eid不为null,就进行更新,根据员工id查询员工
if(eid!=null&&!eid.equals(" ")){
Employee employee = employeeService.selectByPrimaryKey(Integer.parseInt(eid));
model.addAttribute("employee",employee);
}
return "admin/employee/employeeedit";
}
@RequestMapping("/admin/employee/doaddorupdate.html")
@ResponseBody
public Map<String,Object> doaddorupdate(Employee employee,String time){
Map<String,Object> updateMap = new HashMap<String,Object>();
int i = 0;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date date = sdf.parse(time);
employee.setEhire(date);
} catch (ParseException e) {
e.printStackTrace();
}
if(employee.getEid()==null){//没有eid则是添加员工
i = employeeService.insertSelective(employee);
if(i>0){
updateMap.put("msg","添加成功");
updateMap.put("status",1);
}else{
updateMap.put("msg","添加失败");
updateMap.put("status",0);
}
}else{
i = employeeService.updateByPrimaryKeySelective(employee);
if(i>0){
updateMap.put("msg","更新成功");
updateMap.put("status",1);
}else{
trainerMap.put("msg","更新失败");
trainerMap.put("res",0);
}
}else{
i = employeeService.insertSelective(employee);
if(i>0){
trainerMap.put("msg","添加成功");
trainerMap.put("res",1);
}else{
trainerMap.put("msg","添加失败");
trainerMap.put("res",0);
}
}
return trainerMap;
}
/**
* 教练删除
*/
@RequestMapping("/admin/trainer/del.html")
@ResponseBody
public Map<String,Object> delTrainer(String eid){
Map<String,Object> delMap = new HashMap<String,Object>();
int i = employeeService.deleteByPrimaryKey(Integer.parseInt(eid));
if(i>0){
delMap.put("status",1);
}else {
delMap.put("status",0);
}
return delMap;
}
}
CoursefunctionExample.Criteria criteria2 = coursefunctionExample.createCriteria();
if(cate!=null&&!cate.equals("全部")){
criteria1.andCateNameEqualTo(cate);
List<Coursecategory> coursecategories1 = coursecategoryService.selectByExample(coursecategoryExample);
criteria.andCcateIdEqualTo(coursecategories1.get(0).getCateId());
}
if (func!=null&&!func.equals("全部")){
criteria2.andFnameEqualTo(func);
List<Coursefunction> coursefunctions1 = coursefunctionService.selectByExample(coursefunctionExample);
criteria.andCfunctionIdEqualTo(coursefunctions1.get(0).getFid());
}
PageHelper.startPage(_page,6);
List<Course> courses = courseService.selectByExampleWithBLOBs(courseExample);
PageInfo<Course> pageInfo = new PageInfo<Course>(courses);
int totalPages = pageInfo.getPages();
model.addAttribute("totalPages",totalPages);
model.addAttribute("currentPage",_page);
model.addAttribute("courses",courses);
model.addAttribute("cate",cate);
model.addAttribute("func",func);
Sheet sheet = courseService.selectSheetByPrimaryKey(1);
if(sheet!=null){
model.addAttribute("sheetsrc",sheet.getSsrc());
}
return "course";
}
/**
* 前台课程详情页面
* @param model
* @param cid
* @return
*/
@RequestMapping("/courseinfo.html")
public String coursePage(Model model,String cid){
Course course = courseService.selectByPrimaryKey(Integer.parseInt(cid));
model.addAttribute("course",course);
//如果是cid为8(游泳)或者18(瑜伽)就查询所有开设班级
ClassExample classExample = new ClassExample();
ClassExample.Criteria criteria = classExample.createCriteria();
criteria.andCourseIdEqualTo(Integer.parseInt(cid));
List<Class> classes = classService.selectByExample(classExample);
* 更新或者添加新闻
* @param model
* @param nid
* @return
*/
@RequestMapping("/admin/news/goaddorupdate.html")
public String adminGoaddorupdatePage(Model model, @RequestParam(required = false) String nid) {
//查询所有新闻类型
List<Newskinds> newskinds = newsKindsService.selectByExample(new NewskindsExample());
model.addAttribute("newskinds", newskinds);
//如果是要更新,根据新闻id查询新闻
if (nid != null && !nid.equals("")) {
News news = newsService.selectByPrimaryKey(Integer.parseInt(nid));
model.addAttribute("news", news);
}
return "admin/news/newsaddorupdate";
}
/**
* 更新或者添加新闻
* @param news
* @return
*/
@RequestMapping("/admin/news/addorupdate.html")
public String adminAddorupdatePage(News news,String time){
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date date=sdf.parse(time);
news.setNcreatetime(date);
} catch (ParseException e) {
e.printStackTrace();
}
if(news.getNid() == null){//添加
newsService.insertSelective(news);
}else{//更新
newsService.updateByPrimaryKeySelective(news);
}
return "forward:/admin/news.html";
}
/**
* 后台查看新闻详情
* @param model
* @param nid
* @return
*/
@RequestMapping("/admin/newsinfo.html")
public String adminNewsInfo(Model model,String nid){
News news = newsService.selectByPrimaryKey(Integer.parseInt(nid));
model.addAttribute("news",news);
//查询所有课程类型
List<Newskinds> newskinds = newsKindsService.selectByExample(new NewskindsExample());
model.addAttribute("newskinds",newskinds);
String extName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
String fileName = System.currentTimeMillis()+extName;
File newFile = new File(Thread.currentThread().getContextClassLoader().getResource("").getPath().substring(0,Thread.currentThread().getContextClassLoader().getResource("").getPath().length()-16)+"/sterngymimages/"+fileName);
try {
file.transferTo(newFile);
} catch (IOException e) {
e.printStackTrace();
}
Map<String,Object> uploadMap = new HashMap<String,Object>();
Map<String,String> srcMap = new HashMap<String, String>();
srcMap.put("src","http://localhost:8080/sterngymimages/"+fileName);
uploadMap.put("code",0);
uploadMap.put("msg","");
uploadMap.put("data",srcMap);
return uploadMap;
}
}
/**
* 员工 -控制层
*/
Date date = member.getDaoqi();
String strDateFormat = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
request.getSession().setAttribute("daoqi", sdf.format(date));
}
TblOrderExample tblOrderExample = new TblOrderExample();
TblOrderExample.Criteria criteria = tblOrderExample.createCriteria();
criteria.andMemberIdEqualTo(member.getMid());
List<TblOrder> orders = orderService.selectByExample(tblOrderExample);
List<Order> list = new ArrayList<Order>();
int i = 1;
for(TblOrder tblOrder:orders) {
Order order = new Order();
order.setTblOrder(tblOrder);
order.setId(i);
com.stern.pojo.Class class1 = classService.selectByPrimaryKey(tblOrder.getClassId());
Course course = courseService.selectByPrimaryKey(class1.getCourseId());
Employee employee = employeeService.selectByPrimaryKey(course.getTrainerId());
if(course != null) {
order.setName(course.getCname());
}
if(class1 != null) {
order.setShijian(class1.getClasstime());
}
if(employee != null) {
order.setJiaolian(employee.getEname());
}else {
order.setJiaolian("未分配");
}
list.add(order);
i++;
}
model.addAttribute("orders",orders);
model.addAttribute("result",list);
List<Message> messages = messageService.selectMessageWithReply(member.getMid());
model.addAttribute("messages",messages);
return "dinggou";
}
/**
* 后台 跳转到留言管理页面
*/
@RequestMapping("/admin/message.html")
public String adminMsg(){
return "admin/message/messagelist";
}
/**
* 后台 留言管理分页