项目描述
临近学期结束,还是毕业设计,你还在做java程序网络编程,期末作业,老师的作业要求觉得大了吗?不知道毕业设计该怎么办?网页功能的数量是否太多?没有合适的类型或系统?等等。这里根据疫情当下,你想解决的问题,今天给大家介绍一篇基于ssm的社区疫情返乡管控系统设计实现。
功能需求
截止到目前,无论是国内还是国外新冠病毒仍在肆虐,社区疫情防控趋势化越来越明显,以社区为单位进行疫情防控,毫无疑问能够对疫情防控取到很好的作用。社区疫情防控系统方便对社区疫情的信息管理,对居民健康信息、行程、以及疫情防控所需的活动进行系统化、信息化管理。例如居民每日健康填报,核酸检测记录、发放防控物资等。社区疫情防控管理系统的设计需要考虑两种角色,用户和系统管理员。
具备以下功能:
前端用户模块:用户登录注册、忘记密码、首页、关于我们、疫情新闻、信息记录、健康打卡等功能。
后端管理员模块:管理员登录、人员管理、工作人员管理、返乡信息录入、健康打卡管理、网站管理配置、用户留言板留言管理、修改密码、退出系统。
部分效果图
部分代码
@RequestMapping({ "/user/register.html" })
@ResponseBody
public Map<String, Object> reg(@Validated final Member member, final BindingResult result, @RequestParam("gender") final String gender, @RequestParam("repassword") final String repassword) {
final Map<String, Object> errorMap = new HashMap<String, Object>();
final List<String> errorList = new ArrayList<String>();
if (result.hasErrors() || !member.getMpassword().equals(repassword)) {
errorMap.put("status", "0");
if (!member.getMpassword().equals(repassword)) {
errorList.add("\u4e24\u6b21\u8f93\u5165\u5bc6\u7801\u4e0d\u4e00\u81f4");
}
final FieldError nameError = result.getFieldError("mname");
final FieldError mpasswordError = result.getFieldError("mpassword");
final FieldError midnoError = result.getFieldError("midno");
final FieldError mphoneError = result.getFieldError("mphone");
final FieldError memailError = result.getFieldError("memail");
if (nameError != null) {
errorList.add(nameError.getDefaultMessage());
}
if (mpasswordError != null) {
errorList.add(mpasswordError.getDefaultMessage());
}
if (midnoError != null) {
errorList.add(midnoError.getDefaultMessage());
}
if (mphoneError != null) {
errorList.add(mphoneError.getDefaultMessage());
}
if (memailError != null) {
errorList.add(memailError.getDefaultMessage());
}
errorMap.put("errorList", errorList);
}
else {
if (gender.equals("1")) {
member.setMgender(1);
}
else {
member.setMgender(0);
}
member.setMdate(new Date());
this.memberService.addMember(member);
errorMap.put("status", "1");
errorMap.put("msg", "\u6ce8\u518c\u6210\u529f\uff0c\u8bf7\u524d\u5f80\u767b\u5f55\uff01");
}
return errorMap;
}
@RequestMapping({ "/user/verifyemailandphone.html" })
@ResponseBody
public Map<String, Object> verifyEmailAndPhone(final String memail, final String mphone) {
final Map<String, Object> verifyMap = new HashMap<String, Object>();
if (memail != null && !memail.equals(" ")) {
final MemberExample memberExample1 = new MemberExample();
final MemberExample.Criteria criteria = memberExample1.createCriteria();
criteria.andMemailEqualTo(memail);
final long memailCount = this.memberService.countByExample(memberExample1);
if (memailCount > 0L) {
verifyMap.put("status", 0);
verifyMap.put("msg", "\u90ae\u7bb1\u5df2\u88ab\u6ce8\u518c");
return verifyMap;
}
}
if (mphone != null && !mphone.equals(" ")) {
final MemberExample memberExample2 = new MemberExample();
final MemberExample.Criteria criteria2 = memberExample2.createCriteria();
criteria2.andMphoneEqualTo(mphone);
final long mphoneCount = this.memberService.countByExample(memberExample2);
if (mphoneCount > 0L) {
verifyMap.put("status", 0);
verifyMap.put("msg", "\u624b\u673a\u53f7\u5df2\u88ab\u6ce8\u518c");
return verifyMap;
}
}
verifyMap.put("status", 1);
return verifyMap;
}
@RequestMapping({ "/login/captcha.html" })
public void captcha(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
final String capText = this.kaptcha.createText();
request.getSession().setAttribute("KAPTCHA_SESSION_KEY", (Object)capText);
final BufferedImage bi = this.kaptcha.createImage(capText);
final ServletOutputStream out = response.getOutputStream();
ImageIO.write(bi, "jpg", (OutputStream)out);
try {
out.flush();
}
finally {
out.close();
}
out.close();
}
@RequestMapping({ "/kaptchaverify.html" })
@ResponseBody
public Map<String, Object> verifyCode(final String code, final HttpServletResponse response, final HttpServletRequest request) {
final Map<String, Object> verifyMap = new HashMap<String, Object>();
final String codeText = (String)request.getSession().getAttribute("KAPTCHA_SESSION_KEY");
if (codeText.equals(code)) {
verifyMap.put("status", 1);
}
else {
verifyMap.put("status", 0);
verifyMap.put("msg", "\u9a8c\u8bc1\u7801\u9519\u8bef");
}
return verifyMap;
}
@RequestMapping({ "/user/resetpwd.html" })
@ResponseBody
public Map<String, Object> resetPwd(final String email) {
final Map<String, Object> map = new HashMap<String, Object>();
if (email != null && !email.equals(" ")) {
final MemberExample memberExample = new MemberExample();
final MemberExample.Criteria criteria = memberExample.createCriteria();
criteria.andMemailEqualTo(email);
final List<Member> members = this.memberService.selectByExample(memberExample);
if (members.size() > 0) {
if (SendMail.sendMail(email, members.get(0).getMname())) {
final String newPwd = Funcs.MD5("stern123456789");
members.get(0).setMpassword(newPwd);
this.memberService.updateByPrimaryKeySelective(members.get(0));
map.put("msg", "\u91cd\u7f6e\u6210\u529f\uff0c\u8bf7\u7528\u65b0\u5bc6\u7801\u767b\u5f55,\u5982\u679c\u6ca1\u6709\u67e5\u6536\u5230\u90ae\u4ef6\uff0c\u8bf7\u5230\u5783\u573e\u7bb1\u4e2d\u67e5\u770b\uff01");
}
else {
map.put("msg", "\u91cd\u7f6e\u5931\u8d25");
}
}
else if (members.size() == 0) {
map.put("msg", "\u8be5\u90ae\u7bb1\u6ca1\u6709\u88ab\u6ce8\u518c");
}
}
else {
map.put("msg", "\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u90ae\u7bb1");
}
return map;
}
@RequestMapping({ "/login.html" })
public String loginPage(final HttpServletRequest request, final Model model) throws IOException {
final Cookie[] cookies = request.getCookies();
String username = "";
String pwd = "";
if (cookies != null) {
Cookie[] array;
for (int length = (array = cookies).length, i = 0; i < length; ++i) {
final Cookie cookie = array[i];
if (cookie.getName().equals("user")) {
username = URLDecoder.decode(cookie.getValue().split("#")[0], "UTF-8");
pwd = cookie.getValue().split("#")[1];
break;
}
}
model.addAttribute("mname", (Object)username);
model.addAttribute("mpassword", (Object)pwd);
}
return "login";
}
@RequestMapping({ "/user/login.html" })
@ResponseBody
public Map<String, String> login(final String mname, final String mpassword, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
final Map<String, String> res = new HashMap<String, String>();
final Member member = this.memberService.selectMemberByNameAndPwd(mname, mpassword);
if (member != null) {
res.put("status", "1");
if (request.getParameter("isRemember") != null) {
final Cookie cookie = new Cookie("user", String.valueOf(URLEncoder.encode(mname, "utf-8")) + "#" + mpassword);
cookie.setPath("/");
cookie.setMaxAge(604800);
response.addCookie(cookie);
}
res.put("username", mname);
request.getSession().setAttribute("member", (Object)member);
}
else {
res.put("status", "0");
res.put("msg", "\u7528\u6237\u540d\u6216\u8005\u5bc6\u7801\u9519\u8bef\uff01");
}
return res;
}
@RequestMapping({ "/member/loginout.html" })
@ResponseBody
public Map<String, Object> loginout(final HttpServletRequest request) {
final Map<String, Object> loginoutMap = new HashMap<String, Object>();
request.getSession().removeAttribute("member");
request.getSession().invalidate();
loginoutMap.put("status", 1);
return loginoutMap;
}
@RequestMapping({ "admin/adminindex.html" })
public Object admin(final HttpServletRequest request, final HttpServletResponse response, final Model model) throws IOException {
final Member member = (Member)request.getSession().getAttribute("member");
if (!member.getMname().equals("admin")) {
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8;");
final PrintWriter writer = response.getWriter();
writer.print("<script>alert('\u6ca1\u6709\u8bbf\u95ee\u6743\u9650\uff01');parent.location.href='" + request.getContextPath() + "/index.html'</script>");
return false;
}
return String.valueOf(request.getContextPath()) + "/admin/adminindex";
}
@RequestMapping({ "/admin/memberlist.html" })
public String memberlistPage() {
return "admin/member/membermanage";
}
安装部署需求
eclipse、idea运行启动
系统部署
系统开发后,在生产环境配置项目运行环境,具体步骤如下:
安装linux或者windows10操作系统;
安装JDK1.8并配置环境变量;
安装MySQL5.7版本以上版本数据库,创建数据库并执行脚本创建表;
在eclipse中编辑进行打包;
下载并配置Tomcat8.0服务器,配置系统服务,上传项目打包文件
本项目用到的技术和框架
1.开发语言:Java
2.开发模式:B/S
3.数据库:MySQL
4.框架:jsp+SSM
本项目中的关键点
此系统的开发采用java语言开发,基于B/S结构,这些开发环境使系统更加完善。使用到的工具和技术都是开源免费的。
环境工具
开发工具 Eclipse/IDEA
语言 JDK1.8 、jsp、CSS、SSM
硬件:笔记本电脑;
软件:Tomcat8.0 Web服务器、Navicat数据库客户端、MySQL;
操作系统:Windows 10;
其它软件:截图工具、常用浏览器;
以上是本系统的部分功能展示,如果你的选题正好相符,那么可以做毕业设计或课程设计使用。