收藏点赞不迷路 关注作者有好处
文末获取源码
项目编号:BS-XX-157
一,项目简介
这是一个生产管理ERP系统。依托科技计划重点项目“制造装备物联及生产管理系统研发”,主要包括:计划进度、设备管理、工艺监控、物料监控、人员监控、质量监控、系统管理7大模块。系统采用SSM框架开发实现,前端主要基于JQUERY-UI实现页面布局展示。
ERP(Enterprise Resource Planning,企业资源计划)系统,是进行物质资源、资金资源和信息资源集成一体化管理的企业信息管理系统,ERP统领企业全局,为管理层服务,重心在于企业决策,ERP对企业宏观管理,一个企业一套ERP,具有整合性、系统性、灵活性、实时控制性等显著特点。ERP 系统的供应链管理思想对企业提出了更高的要求,是企业在信息化社会、在知识经济时代繁荣发展的核心管理模式。
编辑
二,环境介绍
语言环境:Java: jdk1.8
数据库:Mysql: mysql5.7
应用服务器:Tomcat: tomcat8.5.31
开发工具:IDEA或eclipse
后台开发技术:SSM框架开发
前端开发技术:ajax+jquery+jquery-ui
三,系统展示
用户登陆:
编辑
计划进度管理:
编辑
计划进度管理-订单管理
编辑
计划进度管理-客户管理
编辑
计划进度管理-产品管理
编辑
计划进度管理-作业管理
编辑
计划进度管理-生产计划管理
编辑
计划进度管理-生产派工管理
编辑
设备管理—设备台账
编辑
设备管理—设备种类
编辑
设备管理—设备例检
编辑
设备管理—设备故障
编辑
设备管理—设备维修
编辑
工艺监控—工艺管理
编辑
物料监控—物料信息
编辑
系统管理—用户管理
编辑
系统管理—角色管理
编辑
编辑
四,核心代码展示
package com.megagao.production.ssm.controller; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import com.megagao.production.ssm.domain.customize.ActiveUser; import com.megagao.production.ssm.util.CollectionsFactory; import org.apache.shiro.SecurityUtils; import org.apache.shiro.subject.Subject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import static com.megagao.production.ssm.common.Constants.NO_PERMISSION; /** * * 权限判断controller * */ @RestController public class AuthorityJudgeController { private static final Logger logger = LoggerFactory.getLogger(AuthorityJudgeController.class); @RequestMapping("*/*_judge") public Map<String,Object> authorityJudge(HttpServletRequest request) throws Exception{ Subject subject = SecurityUtils.getSubject(); ActiveUser activeUser = (ActiveUser) subject.getPrincipal(); //根据uri,使用shiro判断相应权限 String uri = request.getRequestURI(); String[] names = uri.split("/"); String featureName = names[2]; String operateName = names[3].split("_")[0]; Map<String,Object> map = CollectionsFactory.newHashMap(); if(!activeUser.getUserStatus().equals("1")){ if (logger.isDebugEnabled()) { logger.debug(NO_PERMISSION, "账户已被锁定!"); } map.put("msg", "您的账户已被锁定,请切换账户登录!"); }else if(!activeUser.getRoleStatus().equals("1")){ if (logger.isDebugEnabled()) { logger.debug(NO_PERMISSION, "角色已被锁定!"); } map.put("msg", "当前角色已被锁定,请切换账户登录!"); }else{ if (logger.isDebugEnabled()) { logger.debug(NO_PERMISSION, "没有权限!"); } if(!subject.isPermitted(featureName+":"+operateName)){ map.put("msg", "您没有权限,请切换用户登录!"); } } return map; } }
package com.megagao.production.ssm.controller; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import javax.servlet.http.HttpServletResponse; import com.megagao.production.ssm.service.FileService; import com.megagao.production.ssm.util.DownloadUtil; import com.megagao.production.ssm.util.JsonUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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 org.springframework.web.multipart.MultipartHttpServletRequest; /** * * 上传图片处理 * */ @Controller public class FileController { @Autowired private FileService fileService; @RequestMapping(value="/file/upload", method=RequestMethod.POST) @ResponseBody public String handleFileUpload(MultipartHttpServletRequest request) throws Exception{ Iterator<String> iterator = request.getFileNames(); String json = null; while (iterator.hasNext()) { String fileName = iterator.next(); MultipartFile multipartFile = request.getFile(fileName); Map<String,Object> result = fileService.uploadFile(multipartFile); json = JsonUtils.objectToJson(result); } return json; } @RequestMapping(value="/file/delete") @ResponseBody public String handleFileDelete(@RequestParam String fileName) throws Exception{ fileService.deleteFile(fileName); Map<String,Object> result = new HashMap<String,Object>(); result.put("data", "success"); String json = JsonUtils.objectToJson(result); return json; } @RequestMapping(value="/file/download") public void handleFileDownload(@RequestParam String fileName, HttpServletResponse response) throws Exception{ fileName = fileName.substring(fileName.lastIndexOf("/")+1); String filePath = "D:\\upload\\temp\\file\\"+fileName; DownloadUtil du = new DownloadUtil(); du.download(filePath, fileName, response, false); } }
package com.megagao.production.ssm.controller; import com.megagao.production.ssm.util.CollectionsFactory; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.IncorrectCredentialsException; import org.apache.shiro.authc.UnknownAccountException; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.subject.Subject; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpSession; import java.util.Map; import static com.megagao.production.ssm.common.Constants.VALIDATE_CODE; @Controller public class LoginController { /** * shiro ajax登录 */ @RequestMapping(value = "/ajaxLogin") @ResponseBody public Map<String,Object> ajaxLogin(@RequestParam String username, @RequestParam String password, @RequestParam(required=false) String randomcode, HttpSession session) throws Exception{ Map<String,Object> map = CollectionsFactory.newHashMap(); if(randomcode !=null && !randomcode.equals("")){ //取出session的验证码(正确的验证码) String validateCode = (String)session.getAttribute(VALIDATE_CODE); //页面中输入的验证和session中的验证进行对比 if(validateCode!=null && !randomcode.equals(validateCode)){ //如果校验失败,将验证码错误失败信息放入map中 map.put("msg", "randomcode_error"); //直接返回,不再校验账号和密码 return map; } } Subject currentUser = SecurityUtils.getSubject(); if (!currentUser.isAuthenticated()) { UsernamePasswordToken token = new UsernamePasswordToken(username, password); try{ currentUser.login(token); }catch(UnknownAccountException ex){ map.put("msg", "account_error"); }catch(IncorrectCredentialsException ex){ map.put("msg", "password_error"); }catch(AuthenticationException ex){ map.put("msg", "authentication_error"); } } //返回json数据 return map; } }
package com.megagao.production.ssm.controller.system; import java.util.List; import com.megagao.production.ssm.domain.customize.CustomResult; import com.megagao.production.ssm.service.PermissionService; import com.megagao.production.ssm.domain.authority.SysRolePermission; import com.megagao.production.ssm.domain.customize.EUDataGridResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @Controller @RequestMapping("/permission") public class PermissionController { @Autowired private PermissionService permissionService; @RequestMapping("/get/{permissionId}") @ResponseBody public SysRolePermission getItemById(@PathVariable String permissionId) throws Exception{ SysRolePermission sysRolePermission = permissionService.get(permissionId); return sysRolePermission; } @RequestMapping("/find") public String find() throws Exception{ return "permission_list"; } @RequestMapping("/get_data") @ResponseBody public List<SysRolePermission> getData() throws Exception{ return permissionService.find(); } @RequestMapping("/get_permission") @ResponseBody public SysRolePermission getPermission(String roleId) throws Exception{ return permissionService.getByRoleId(roleId); } @RequestMapping("/add") public String add() throws Exception{ return "permission_add"; } @RequestMapping("/edit") public String edit() throws Exception{ return "permission_edit"; } @RequestMapping("/list") @ResponseBody public EUDataGridResult getItemList(Integer page, Integer rows, SysRolePermission sysRolePermission) throws Exception{ EUDataGridResult result = permissionService.getList(page, rows, sysRolePermission); return result; } @RequestMapping(value="/insert", method=RequestMethod.POST) @ResponseBody private CustomResult insert(SysRolePermission sysRolePermission) throws Exception { CustomResult result = permissionService.insert(sysRolePermission); return result; } @RequestMapping(value="/update") @ResponseBody private CustomResult update(SysRolePermission sysRolePermission) throws Exception { CustomResult result = permissionService.update(sysRolePermission); return result; } @RequestMapping(value="/update_by_roleid") @ResponseBody private CustomResult updateByRoleId(String roleId, String permission) throws Exception { CustomResult result = permissionService.updateByRoleId(roleId, permission); return result; } @RequestMapping(value="/update_all") @ResponseBody private CustomResult updateAll(SysRolePermission sysRolePermission) throws Exception { CustomResult result = permissionService.updateAll(sysRolePermission); return result; } @RequestMapping(value="/delete") @ResponseBody private CustomResult delete(String id) throws Exception { CustomResult result = permissionService.delete(id); return result; } }
package com.megagao.production.ssm.controller.system; import java.util.List; import com.megagao.production.ssm.domain.vo.RoleVO; import com.megagao.production.ssm.domain.customize.CustomResult; import com.megagao.production.ssm.domain.customize.EUDataGridResult; import com.megagao.production.ssm.domain.authority.SysRole; import com.megagao.production.ssm.service.RoleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.validation.Valid; @Controller @RequestMapping("/role") public class RoleController { @Autowired private RoleService roleService; @RequestMapping("/get/{roleId}") @ResponseBody public RoleVO getItemById(@PathVariable String roleId) throws Exception{ RoleVO sysRole = roleService.get(roleId); return sysRole; } @RequestMapping("/find") public String find() throws Exception{ return "role_list"; } @RequestMapping("/permission") public String permission() throws Exception{ return "role_permission"; } @RequestMapping("/get_data") @ResponseBody public List<RoleVO> getData() throws Exception{ return roleService.find(); } @RequestMapping("/add") public String add() throws Exception{ return "role_add"; } @RequestMapping("/edit") public String edit() throws Exception{ return "role_edit"; } @RequestMapping("/list") @ResponseBody public EUDataGridResult getItemList(Integer page, Integer rows, RoleVO role) throws Exception{ EUDataGridResult result = roleService.getList(page, rows, role); return result; } @RequestMapping(value="/insert", method=RequestMethod.POST) @ResponseBody private CustomResult insert(@Valid SysRole role, BindingResult bindingResult) throws Exception { CustomResult result; if(bindingResult.hasErrors()){ FieldError fieldError = bindingResult.getFieldError(); return CustomResult.build(100, fieldError.getDefaultMessage()); } if(roleService.findByRoleNameAndId(role.getRoleName(), role.getRoleId()).size()>0){ result = new CustomResult(0, "该角色名已经存在,请更换角色名!", null); }else if(roleService.get(role.getRoleId()) != null){ result = new CustomResult(0, "该角色编号已经存在,请更换角色编号!", null); }else{ result = roleService.insert(role); } return result; } @RequestMapping(value="/update") @ResponseBody private CustomResult update(SysRole role) throws Exception { CustomResult result = roleService.update(role); return result; } @RequestMapping(value="/update_all") @ResponseBody private CustomResult updateAll(@Valid SysRole role, BindingResult bindingResult) throws Exception { CustomResult result; if(bindingResult.hasErrors()){ FieldError fieldError = bindingResult.getFieldError(); return CustomResult.build(100, fieldError.getDefaultMessage()); } if(roleService.findByRoleNameAndId(role.getRoleName(), role.getRoleId()).size()>0){ result = new CustomResult(0, "该角色名已经存在,请更换角色名!", null); }else if(roleService.get(role.getRoleId()) != null){ result = new CustomResult(0, "该角色编号已经存在,请更换角色编号!", null); }else{ result = roleService.updateAll(role); } return result; } @RequestMapping(value="/delete") @ResponseBody private CustomResult delete(String id) throws Exception { CustomResult result = roleService.delete(id); return result; } @RequestMapping(value="/delete_batch") @ResponseBody private CustomResult deleteBatch(String[] ids) throws Exception { CustomResult result = roleService.deleteBatch(ids); return result; } //根据角色id查找 @RequestMapping("/search_role_by_roleId") @ResponseBody public EUDataGridResult searchRoleByRoleId(Integer page, Integer rows, String searchValue) throws Exception{ EUDataGridResult result = roleService.searchRoleByRoleId(page, rows, searchValue); return result; } //根据角色名查找 @RequestMapping("/search_role_by_roleName") @ResponseBody public EUDataGridResult searchRoleByRoleName(Integer page, Integer rows, String searchValue) throws Exception{ EUDataGridResult result = roleService.searchRoleByRoleName(page, rows, searchValue); return result; } }
五,项目总结
本项目功能齐全,前后端交互较好,完整的实现了一个企业ERP系统应用的相关模块。