基于javaweb+mysql的ssm+maven企业绩效考核管理系统(java+ssm+jsp+bootstrap+jquery+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM+Maven企业绩效考核管理系统(java+ssm+jsp+bootstrap+jquery+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+bootstrap+jQuery
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ssm_qyjxkhsys
throw new RuntimeException("图片大小不能超出500k");
}
//如果名称不为“”,说明该文件存在,否则说明该文件不存在
if(myFileName.trim() !=""){
//重命名上传后的文件名
String fileName = UUID.randomUUID().toString()+"."+suffix.toLowerCase();
//文件夹路径
String filePath = root+"/ckeditor/";
File f = new File(filePath);
// 目录已存在创建文件夹
if (!f.exists()) {
f.mkdirs();// 目录不存在的情况下,会抛出异常
}
//定义上传路径
String path1 = filePath + fileName;
//创建文件
File localFile = new File(path1);
upload.transferTo(localFile);
path = "/ckeditor/"+fileName;
}
}
// 返回“图像”选项卡并显示图片
out.println("<script type=\"text/javascript\">");
out.println("window.parent.CKEDITOR.tools.callFunction(" + CKEditorFuncNum + ",'" + path + "','')");
out.println("</script>");
} catch (RuntimeException e) {
out.println("<script type=\"text/javascript\">");
out.println("window.parent.CKEDITOR.tools.callFunction(" + CKEditorFuncNum + ",'','" +e.getMessage()+ "');");
out.println("</script>");
}
}
}
}
}
/**
* 平台用户登录入口等
*/
@Controller
@RequestMapping("/")
public class SysUserController {
@Autowired
private SysUserService sysUserService;
@Autowired
private SysRoleService sysRoleService;
/**
* 平台用户的登录入口
*
* @return 返回界面
*/
@RequestMapping(method = RequestMethod.GET, value = "login")
public String toLogin() {
return "page/common/login";
}
/**
String ip = NetworkUtil.getIpAddress(request);
SysUser sysUser = this.sysUserService.sysUserLogin(name, password, ip);
session.setAttribute(SessionConstant.LOGINER, sysUser);
session.setAttribute(SessionConstant.LOGINER_ID, sysUser.getId());
session.setAttribute(SessionConstant.LOGINER_NAME, sysUser.getName());
} catch (CiBizException e) {
session.removeAttribute(SessionConstant.RANDOM_CODE);
throw e;
}
return ResultUtils.createNullResult();
}
/**
* 修改密码
*
* @param passwordOld 旧密码
* @param password 新密码
* @param passwordConfirm 确认密码
* @param session session
* @return
*/
@ResponseBody
@RequestMapping("changePassword")
public RemoteResult changePassword(String passwordOld, String password, String passwordConfirm, HttpSession session) {
SysUser loginer = (SysUser) session.getAttribute(SessionConstant.LOGINER);
if (loginer == null) {
return ResultUtils.createErrorResult("登录已失效,请刷新界面");
}
this.sysUserService.changePassword(loginer.getAccount(), passwordOld, password, passwordConfirm);
return ResultUtils.createNullResult();
}
/**
* 登出
*
* @return
*/
}
/**
* 数据列表
*
* @param query 分页数据
* @return 结果
*/
@ResponseBody
@RequestMapping("findSysRoles")
public RemoteResult findSysRole(SysRoleQuery query) {
Pagination pagination = this.sysRoleService.findSysRoles(query);
return ResultUtils.createDefResult(pagination);
}
/**
* 添加平台角色
*
* @param sysRole 平台角色
* @return
*/
@ResponseBody
@RequestMapping("createSysRole")
public RemoteResult createUser(SysRole sysRole) {
this.sysRoleService.createSysRole(sysRole);
return ResultUtils.createNullResult();
}
/**
* 修改平台角色
*
* @param sysRole 平台角色
* @return
*/
@ResponseBody
@RequestMapping("updateSysRole")
public RemoteResult updateSysRole(SysRole sysRole) {
if (sysRole.getId() == null) {
throw new CiBizException("请选择需要修改的平台角色");
}
this.sysRoleService.updateSysRole(sysRole);
return ResultUtils.createNullResult();
}
/**
* 删除平台角色
*
* @param ids 平台角色ID
* @return
public CompressRequestResponseBodyMethodProcessor(List<HttpMessageConverter<?>> messageConverters,
ContentNegotiationManager contentNegotiationManager, List<Object> responseBodyAdvice) {
super(messageConverters, contentNegotiationManager, responseBodyAdvice);
}
@Override
public boolean supportsParameter(MethodParameter parameter) {
return parameter.hasParameterAnnotation(CompressRespnseBody.class);
}
@Override
public boolean supportsReturnType(MethodParameter returnType) {
return (AnnotationUtils.findAnnotation(returnType.getContainingClass(), CompressRespnseBody.class) != null ||
returnType.getMethodAnnotation(CompressRespnseBody.class) != null);
}
/**
* @throws MethodArgumentNotValidException if validation fails
* @throws HttpMessageNotReadableException if {@link CompressRespnseBody#required()}
* is {@code true} and there is no body content or if there is no suitable
* converter to read the content with.
*/
@Override
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
Object argument = readWithMessageConverters(webRequest, parameter, parameter.getGenericParameterType());
String name = Conventions.getVariableNameForParameter(parameter);
WebDataBinder binder = binderFactory.createBinder(webRequest, argument, name);
if (argument != null) {
validate(binder, parameter);
}
mavContainer.addAttribute(BindingResult.MODEL_KEY_PREFIX + name, binder.getBindingResult());
return argument;
}
private void validate(WebDataBinder binder, MethodParameter parameter) throws Exception {
Annotation[] annotations = parameter.getParameterAnnotations();
for (Annotation ann : annotations) {
Validated validatedAnn = AnnotationUtils.getAnnotation(ann, Validated.class);
if (validatedAnn != null || ann.annotationType().getSimpleName().startsWith("Valid")) {
Object hints = (validatedAnn != null ? validatedAnn.value() : AnnotationUtils.getValue(ann));
Object[] validationHints = (hints instanceof Object[] ? (Object[]) hints : new Object[] {hints});
binder.validate(validationHints);
BindingResult bindingResult = binder.getBindingResult();
if (bindingResult.hasErrors()) {
if (isBindExceptionRequired(binder, parameter)) {
throw new MethodArgumentNotValidException(parameter, bindingResult);
}
}
@ResponseBody
@RequestMapping("deleteSysUser")
public RemoteResult deleteSysUser(@RequestParam(value = "ids[]") String[] ids) {
this.sysUserService.deleteSysUser(ids);
return ResultUtils.createNullResult();
}
/**
* 添加平台用户管理证件人
*
* @param sysUser 平台用户管理
* @return
*/
@ResponseBody
@RequestMapping("createSysUser")
public RemoteResult createSysUser(SysUser sysUser) {
this.sysUserService.createSysUser(sysUser);
return ResultUtils.createNullResult();
}
/**
* 修改平台用户管理证件人
*
* @param sysUser 平台用户管理
* @return
*/
@ResponseBody
@RequestMapping("updateSysUser")
public RemoteResult updateSysUser(SysUser sysUser) {
this.sysUserService.updateSysUser(sysUser);
return ResultUtils.createNullResult();
}
/**
* 重置平台用户管理密码
*
* @param sysUser 平台用户管理ID,PWD
* @return 结果
*/
@ResponseBody
@RequestMapping("resetPassword")
public RemoteResult resetPassword(SysUser sysUser) {
this.sysUserService.resetPassword(sysUser);
return ResultUtils.createNullResult();
}
/**
* 修改周报
*
* @param week 周报
* @return
*/
@ResponseBody
@RequestMapping("updateWeek")
public RemoteResult updateWeek(Week week) {
if (week.getId() == null) {
throw new CiBizException("请选择需要修改的周报");
}
this.weekService.updateWeek(week);
return ResultUtils.createNullResult();
}
/**
* 删除周报
*
* @param ids 周报ID
* @return
*/
@ResponseBody
@RequestMapping("deleteWeek")
public RemoteResult deleteWeek(@RequestParam(value = "ids[]") String[] ids) {
this.weekService.deleteWeek(ids);
return ResultUtils.createNullResult();
}
}
/**
/**
* 通用的界面入口
*/
@Controller
public class CommonController {
public static String [] suffixs = {"IMG","PNG","JPG","JPEG","GIF","BPM"};
/**
* 产生随机验证码
*/
@RequestMapping("/randomCode")
public void randNum(HttpSession session, HttpServletResponse response) {
//产生随机验证码生成对象
RandomNumUtil rdnum = RandomNumUtil.Instance();
//将产生的随机码存放在session
session.setAttribute(SessionConstant.RANDOM_CODE, rdnum.getString());
response.setContentType("image/jpg");
ByteArrayInputStream bi = rdnum.getImage();
try {
OutputStream out = response.getOutputStream();
int b = 0;
while ((b = bi.read()) != -1) {
out.write(b);
}
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
/**
* 平台用户登录入口等
*/
@Controller
@RequestMapping("/")
public class SysUserController {
@Autowired
private SysUserService sysUserService;
@Autowired
private SysRoleService sysRoleService;
/**
* 平台用户的登录入口
*
* @return 返回界面
*/
@RequestMapping(method = RequestMethod.GET, value = "login")
public String toLogin() {
return "page/common/login";
}
/**
* 平台用户登录验证
*
* @param name 账号证件人
* @param password 密码
* @param randomCode 验证码
* @param session session
* @return 结果
*/
@ResponseBody
@RequestMapping(method = RequestMethod.POST, value = "toLogin")
public RemoteResult login(String name, String password, String randomCode, HttpServletRequest request, HttpSession session) {
try {
// //先验证randomCode
// String currentRandomCode = (String) session.getAttribute(SessionConstant.RANDOM_CODE);
// if (!currentRandomCode.toUpperCase().equals(randomCode.toUpperCase())) {
// throw new CiBizException("验证码错误");
// }
//获取IP地址
/**
* 修改平台用户管理证件人
*
* @param sysUser 平台用户管理
* @return
*/
@ResponseBody
@RequestMapping("updateSysUser")
public RemoteResult updateSysUser(SysUser sysUser) {
this.sysUserService.updateSysUser(sysUser);
return ResultUtils.createNullResult();
}
/**
* 重置平台用户管理密码
*
* @param sysUser 平台用户管理ID,PWD
* @return 结果
*/
@ResponseBody
@RequestMapping("resetPassword")
public RemoteResult resetPassword(SysUser sysUser) {
this.sysUserService.resetPassword(sysUser);
return ResultUtils.createNullResult();
}
@RequestMapping("/print")
public String print(Model model, String id) {
model.addAttribute("user", this.sysUserDao.findSysUserById(id));
return "page/system/sysUserPrint";
}
}
/**
* 平台公告的controller
*/
@Controller
@RequestMapping("/notice")
public class NoticeController extends BaseController {
@Autowired
private NoticeService noticeService;
/**
* 系统管理=公告管理主界面
*
* @return
*/
@RequestMapping("/toList")
public String toNoticeList() {
return "page/jx/noticeList";
}
/**
* 数据列表
*
* @param query 分页数据
* @return 结果
*/
@ResponseBody
@RequestMapping("findNotices")
public RemoteResult findNotice(BaseQuery query) {
Pagination pagination = this.noticeService.findNotices(query);
return ResultUtils.createDefResult(pagination);
}
/**
* 添加平台公告
*
* @param notice 平台公告
* @return
*/
@ResponseBody
if (ex instanceof MissingServletRequestParameterException) {
logger.error(ex.getMessage());
return createParamErrorResult(ex.getMessage());
}
if (ex instanceof ConversionNotSupportedException) {
logger.error(ex.getMessage(), ex);
return createSysErrorResult(ex.getMessage());
}
if (ex instanceof HttpMediaTypeNotAcceptableException) {
logger.error(ex.getMessage(), ex);
return createSysErrorResult(ex.getMessage());
}
if (ex instanceof TypeMismatchException) {
logger.error(ex.getMessage());
return createSysErrorResult(ex.getMessage());
}
if (ex instanceof NoHandlerFoundException) {
logger.error(ex.getMessage(), ex);
return createSysErrorResult(ex.getMessage());
}
if (ex instanceof CiBizException) {
logger.error(ex.getMessage());
return createExceptionResult(ex.getMessage());
}
if (ex instanceof ParamException) {
logger.error(ex.getMessage());
return createParamErrorResult(ex.getMessage());
}
if (ex instanceof CiRuntimeException) {
logger.error(ex.getMessage(), ex);
return createExceptionResult(ex.getMessage());
}
if (ex instanceof GrantException) {
logger.error(ex.getMessage());
return createExceptionResult(ex.getMessage());
}
logger.error(ex.getMessage(), ex);
return createSysErrorResult(ResultStatus.SYSTEM_ERROR_MSG);
}
}
/**
* 添加部门指标
*
* @param json 部门指标
* @return
*/
@ResponseBody
@RequestMapping("save")
public RemoteResult save(String json, String dept) {
Gson gson = new Gson();
Type type = new TypeToken<List<DeptItem>>() {
}.getType();
List<DeptItem> itemList = gson.fromJson(json, type);
this.deptItemService.save(itemList, dept);
return ResultUtils.createNullResult();
}
/**
* 修改部门指标
*
* @param deptItem 部门指标
* @return
*/
@ResponseBody
@RequestMapping("updateDeptItem")
public RemoteResult updateDeptItem(DeptItem deptItem) {
if (deptItem.getId() == null) {
throw new CiBizException("请选择需要修改的部门指标");
}
this.deptItemService.updateDeptItem(deptItem);
return ResultUtils.createNullResult();
}
}
}.getType();
List<DeptItem> itemList = gson.fromJson(json, type);
this.deptItemService.save(itemList, dept);
return ResultUtils.createNullResult();
}
/**
* 修改部门指标
*
* @param deptItem 部门指标
* @return
*/
@ResponseBody
@RequestMapping("updateDeptItem")
public RemoteResult updateDeptItem(DeptItem deptItem) {
if (deptItem.getId() == null) {
throw new CiBizException("请选择需要修改的部门指标");
}
this.deptItemService.updateDeptItem(deptItem);
return ResultUtils.createNullResult();
}
}
/**
* 图片处理的相关工具类,包含图片压缩,旋转,将request图片保存到本地灯
*/
public class ImageUtils {
/**
*/
@RequestMapping("/toList")
public String toSysRoleList() {
return "page/system/sysRoleList";
}
/**
* 数据列表
*
* @param query 分页数据
* @return 结果
*/
@ResponseBody
@RequestMapping("findSysRoles")
public RemoteResult findSysRole(SysRoleQuery query) {
Pagination pagination = this.sysRoleService.findSysRoles(query);
return ResultUtils.createDefResult(pagination);
}
/**
* 添加平台角色
*
* @param sysRole 平台角色
* @return
*/
@ResponseBody
@RequestMapping("createSysRole")
public RemoteResult createUser(SysRole sysRole) {
this.sysRoleService.createSysRole(sysRole);
return ResultUtils.createNullResult();
}
/**
* 修改平台角色
*
* @param sysRole 平台角色
* @return
*/
@ResponseBody
@RequestMapping("updateSysRole")
public RemoteResult updateSysRole(SysRole sysRole) {
if (sysRole.getId() == null) {
throw new CiBizException("请选择需要修改的平台角色");
}
this.sysRoleService.updateSysRole(sysRole);
*/
@ResponseBody
@RequestMapping("createNotice")
public RemoteResult createUser(Notice notice) {
this.noticeService.createNotice(notice);
return ResultUtils.createNullResult();
}
/**
* 修改平台公告
*
* @param notice 平台公告
* @return
*/
@ResponseBody
@RequestMapping("updateNotice")
public RemoteResult updateNotice(Notice notice) {
if (notice.getId() == null) {
throw new CiBizException("请选择需要修改的平台公告");
}
this.noticeService.updateNotice(notice);
return ResultUtils.createNullResult();
}
/**
* 删除平台公告
*
* @param ids 平台公告ID
* @return
*/
@ResponseBody
@RequestMapping("deleteNotice")
public RemoteResult deleteNotice(@RequestParam(value = "ids[]") String[] ids) {
this.noticeService.deleteNotice(ids);
return ResultUtils.createNullResult();
}
}
/**
* 平台公告的controller
*/
@Controller
@RequestMapping("/notice")
public class NoticeController extends BaseController {
@Autowired
private NoticeService noticeService;
/**
* 系统管理=公告管理主界面
*
* @return
*/
@RequestMapping("/toList")
public String toNoticeList() {
return "page/jx/noticeList";
}
/**
* 数据列表
*
* @param query 分页数据
* @return 结果
*/
@ResponseBody
@RequestMapping("findNotices")
public RemoteResult findNotice(BaseQuery query) {
Pagination pagination = this.noticeService.findNotices(query);
return ResultUtils.createDefResult(pagination);