源码获取:俺的博客首页 "资源" 里下载!
项目介绍
本项目包含管理员、财务、用户、审核人员、外派人员等多种角色;
管理员角色包含以下功能:
管理员登陆,用户管理,理赔知识管理,理赔账单管理等功能。
财务角色包含以下功能:
财务登录,理赔发放等功能。
用户角色包含以下功能:
用户登录,我的保险,理赔知识查看,个人信息以及密码修改,提交的保单管理,理赔账单管理等功能。
审核人员角色包含以下功能:
事故认定审核,审核人员登录,理赔审核等功能。
外派人员角色包含以下功能:
外派人员登录,外派审核管理等功能。
PS:流程是用户提交理赔表单,审核人员审核,外派人员登录后认定结果,然后审核人员再次审核并给出赔偿金额,最后财务登录发放赔偿。
环境需要
1.运行环境:java jdk 7;注:本项目暂只支持jdk7,其它jdk版本暂不支持;。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.0;注:本项目暂只支持Tomcat 7.0,其它版本暂不支持;
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;
6.是否Maven项目:是;
技术栈
1. 后端:Spring+SpringMVC+Mybatis
2. 前端:JSP+CSS+JavaScript+jquery+bootstrap
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中db.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/ssm_insurance_sys 登录
用户管理控制层:
@Controller
@RequestMapping("/user")
public class UserController extends BaseController {
/**
* 依赖注入 start dao/service/===
*/
@Autowired
private UserService userService;
/**
* 分页查询 返回list对象(通过对By Sql)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findBySql")
public String findBySql(User user, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
String sql = "SELECT * FROM user WHERE 1=1 ";
if(!isEmpty(user.getUsername())){
sql += " and username like '%"+user.getUsername()+"%'";
}
if(!isEmpty(user.getPassword())){
sql += " and password like '%"+user.getPassword()+"%'";
}
if(!isEmpty(user.getPhone())){
sql += " and phone like '%"+user.getPhone()+"%'";
}
if(!isEmpty(user.getRole())){
sql += " and role like '%"+user.getRole()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<User> pagers = userService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", user);
return "user/user";
}
/**
* 分页查询 返回list对象(通过Map)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByMap")
public String findByMap(User user, Model model, HttpServletRequest request, HttpServletResponse response) {
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(user.getUsername())){
params.put("username", user.getUsername());
}
if(!isEmpty(user.getPassword())){
params.put("password", user.getPassword());
}
if(!isEmpty(user.getPhone())){
params.put("phone", user.getPhone());
}
if(!isEmpty(user.getRole())){
params.put("role", user.getRole());
}
//分页查询
Pager<User> pagers = userService.findByMap(params);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", user);
return "user/user";
}
/**********************************【增删改】******************************************************/
/**
* 跳至添加页面
* @return
*/
@RequestMapping(value = "/add")
public String add() {
return "user/add";
}
/**
* 跳至详情页面
* @return
*/
@RequestMapping(value = "/view")
public String view(Integer id,Model model,HttpServletRequest request) {
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/login.action";
}
Integer userId = Integer.valueOf(attribute.toString());
User obj = userService.load(userId);
model.addAttribute("obj",obj);
return "user/view";
}
/**
* 添加执行
* @return
*/
@RequestMapping(value = "/exAdd")
public String exAdd(User user, Model model, HttpServletRequest request, HttpServletResponse response) {
userService.insert(user);
return "redirect:/user/findBySql.action";
}
/**
* 跳至修改页面
* @return
*/
@RequestMapping(value = "/update")
public String update(Integer id,Model model) {
User obj = userService.load(id);
model.addAttribute("obj",obj);
return "user/update";
}
@RequestMapping(value = "/pass")
public String pass(Integer id,HttpServletRequest request,Model model) {
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/login";
}
Integer userId = Integer.valueOf(attribute.toString());
User byId = userService.getById(userId);
model.addAttribute("obj",byId);
return "user/pass";
}
/**
* 修改密码
* @param request
* @param password
* @return
*/
@RequestMapping("/upass")
@ResponseBody
public String upass(HttpServletRequest request,String password){
Object attribute = request.getSession().getAttribute("userId");
JSONObject j = new JSONObject();
if (attribute == null){
j.put("res", 0);
return j.toString();
}
Integer userId = Integer.valueOf(attribute.toString());
User byId = userService.getById(userId);
byId.setPassword(password);
userService.updateById(byId);
j.put("res", 1);
return j.toString();
}
@RequestMapping(value = "/exUpdate2")
public String exUpdate2(User user, Model model, HttpServletRequest request, HttpServletResponse response) {
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/login.action";
}
Integer userId = Integer.valueOf(attribute.toString());
//1.通过实体类修改,可以多传修改条件
user.setId(userId);
userService.updateById(user);
//2.通过主键id修改
//userService.updateById(user);
return "redirect:/user/view.action";
}
/**
* 添加修改
* @return
*/
@RequestMapping(value = "/exUpdate")
public String exUpdate(User user, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.通过实体类修改,可以多传修改条件
userService.updateById(user);
//2.通过主键id修改
//userService.updateById(user);
return "redirect:/user/findBySql.action";
}
/**
* 删除通过主键
* @return
*/
@RequestMapping(value = "/delete")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
///1.通过主键删除
userService.deleteById(id);
return "redirect:/user/findBySql.action";
}
}
登录管理控制层:
@Controller
@RequestMapping("/login")
public class LoginController extends BaseController{
@Autowired
private UserService userService;
/**
* 跳转登陆
* @return
*/
@RequestMapping("/login")
public String login(){
return "login/login";
}
@RequestMapping("/mtuichu")
public String mtuichu(HttpServletRequest request){
//request.getSession().invalidate();
return "login/mLogin";
}
@RequestMapping("/welcome")
private String welcome(){
return "login/welcome";
}
@RequestMapping("/utoLogin")
public String utoLogin(User manage, HttpServletRequest request, HttpServletResponse response){
User byEntity = userService.getByEntity(manage);
if(byEntity == null){
return "redirect:/login/login.action";
}else{
request.getSession().setAttribute("role", byEntity.getRole());
request.getSession().setAttribute("userId", byEntity.getId());
request.getSession().setAttribute("username", byEntity.getUsername());
}
return "login/index";
}
@RequestMapping("/pass")
public String pass(HttpServletRequest request){
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/uLogin.action";
}
Integer userId = Integer.valueOf(attribute.toString());
User load = userService.load(userId);
request.setAttribute("obj", load);
return "login/pass";
}
/*@RequestMapping("/upass")
@ResponseBody
public String upass(HttpServletRequest request,String password){
Object attribute = request.getSession().getAttribute("userId");
JSONObject j = new JSONObject();
if (attribute == null){
j.put("res", 0);
return j.toString();
}
Integer userId = Integer.valueOf(attribute.toString());
User load = userService.load(userId);
load.setPassWord(password);
userService.updateById(load);
j.put("res", 1);
return j.toString();
}*/
/**
* 退出
* @param request
* @param response
* @return
*/
@RequestMapping("/tuichu")
public String tuichu( HttpServletRequest request, HttpServletResponse response){
HttpSession session = request.getSession();
session.invalidate();
return "login/login";
}
@RequestMapping("/uTui")
public String uTui( HttpServletRequest request, HttpServletResponse response){
HttpSession session = request.getSession();
session.invalidate();
return "redirect:/login/uLogin.action";
}
@RequestMapping("/head")
private String head(){
return "inc/head";
}
@RequestMapping("/left")
private String left(){
return "inc/left";
}
@RequestMapping("/main")
private String main(HttpServletRequest request){
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/uLogin.action";
}
Integer userId = Integer.valueOf(attribute.toString());
User load = userService.load(userId);
request.setAttribute("user", load);
return "login/main";
}
@RequestMapping("/info")
private String info(HttpServletRequest request){
Object attribute = request.getSession().getAttribute("userId");
Integer userId = Integer.valueOf(attribute.toString());
User load = userService.load(userId);
request.setAttribute("user", load);
return "login/info";
}
}
保险管理控制层:
@Controller
@RequestMapping("/bx")
public class BxController extends BaseController {
/**
* 依赖注入 start dao/service/===
*/
@Autowired
private BxService bxService;
/**
* 分页查询 返回list对象(通过对By Sql)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findBySql")
public String findBySql(Bx bx, Model model, HttpServletRequest request, HttpServletResponse response) {
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/login.action";
}
Integer userId = Integer.valueOf(attribute.toString());
//分页查询
String sql = "SELECT * FROM bx WHERE 1=1 and userId = "+userId;
if(!isEmpty(bx.getUserId())){
sql += " and userId like '%"+bx.getUserId()+"%'";
}
if(!isEmpty(bx.getName())){
sql += " and name like '%"+bx.getName()+"%'";
}
if(!isEmpty(bx.getType())){
sql += " and type like '%"+bx.getType()+"%'";
}
if(!isEmpty(bx.getMoney())){
sql += " and money like '%"+bx.getMoney()+"%'";
}
if(!isEmpty(bx.getCode())){
sql += " and code like '%"+bx.getCode()+"%'";
}
if(!isEmpty(bx.getStartTime())){
sql += " and startTime like '%"+bx.getStartTime()+"%'";
}
if(!isEmpty(bx.getEndTime())){
sql += " and endTime like '%"+bx.getEndTime()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<Bx> pagers = bxService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", bx);
return "bx/bx";
}
/**
* 分页查询 返回list对象(通过Map)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByMap")
public String findByMap(Bx bx, Model model, HttpServletRequest request, HttpServletResponse response) {
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(bx.getUserId())){
params.put("userId", bx.getUserId());
}
if(!isEmpty(bx.getName())){
params.put("name", bx.getName());
}
if(!isEmpty(bx.getType())){
params.put("type", bx.getType());
}
if(!isEmpty(bx.getMoney())){
params.put("money", bx.getMoney());
}
if(!isEmpty(bx.getCode())){
params.put("code", bx.getCode());
}
if(!isEmpty(bx.getStartTime())){
params.put("startTime", bx.getStartTime());
}
if(!isEmpty(bx.getEndTime())){
params.put("endTime", bx.getEndTime());
}
//分页查询
Pager<Bx> pagers = bxService.findByMap(params);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", bx);
return "bx/bx";
}
/**********************************【增删改】******************************************************/
/**
* 跳至添加页面
* @return
*/
@RequestMapping(value = "/add")
public String add() {
return "bx/add";
}
/**
* 跳至详情页面
* @return
*/
@RequestMapping(value = "/view")
public String view(Integer id,Model model) {
Bx obj = bxService.load(id);
model.addAttribute("obj",obj);
return "bx/view";
}
/**
* 添加执行
* @return
*/
@RequestMapping(value = "/exAdd")
public String exAdd(Bx bx, Model model, HttpServletRequest request, HttpServletResponse response) {
bxService.insert(bx);
return "redirect:/bx/findBySql.action";
}
/**
* 跳至修改页面
* @return
*/
@RequestMapping(value = "/update")
public String update(Integer id,Model model) {
Bx obj = bxService.load(id);
model.addAttribute("obj",obj);
return "bx/update";
}
/**
* 添加修改
* @return
*/
@RequestMapping(value = "/exUpdate")
public String exUpdate(Bx bx, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.通过实体类修改,可以多传修改条件
bxService.updateById(bx);
//2.通过主键id修改
//bxService.updateById(bx);
return "redirect:/bx/findBySql.action";
}
/**
* 删除通过主键
* @return
*/
@RequestMapping(value = "/delete")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
///1.通过主键删除
bxService.deleteById(id);
return "redirect:/bx/findBySql.action";
}
}
源码获取:俺的博客首页 "资源" 里下载!