——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明






基于javaweb的SpringBoot客户管理系统(java+springboot+maven+jsp+layui+jq+mysql)
项目介绍
本项目为后管系统,主要功能包括:
登录、修改密码、客户模块、充值模块、消费模块、对账单模块等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7版本;
技术栈
后端:SpringBoot+Mybatis
前端:JSP+LayUI+jQuery
使用说明
运行项目,输入http://localhost:8081/ 登录
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| * 进入登录页面 * * @return */ @RequestMapping(value = "/login", method = RequestMethod.GET) public String loginPage(HttpServletRequest request) { logger.debug("into /loginPage >>>>>>>>>>>>>>>>>>>>>>>");
LoginVo user = SessionCache.getUser(request); if (ObjectUtils.isNotEmpty(user)) { return "redirect:/"; } return "login"; }
@RequestMapping(value = "/login", method = RequestMethod.POST) @ResponseBody public Object login(LoginDto loginDto, HttpServletRequest request) { logger.info("into /login loginDto:{}", JsonUtils.toJson(loginDto)); LoginVo loginVo = userService.login(loginDto);
SessionCache.setUser(request, loginVo); request.getSession().setAttribute(Constant.SESSION_USER, loginVo); return new JSONResult(); }
@RequestMapping(value = "/logout", method = RequestMethod.GET) public Object logout(HttpServletRequest request) { logger.info("into /logout >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); SessionCache.removeUser(request); return "redirect:/login"; }
}
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| * * @return */ @RequestMapping(value = "/saveOrUpdate", method = RequestMethod.POST) @ResponseBody public JSONResult add(CustomerType customerType) { LOGGER.debug("into /customerType/saveOrUpdate >>>>>>>>>>>>>>>>>>>>>>>{}", JsonUtils.toJson(customerType)); EntityUtils.init(customerType); customerTypeService.saveOrUpdate(customerType); return new JSONResult(); }
@RequestMapping(value = "/del", method = RequestMethod.POST) @ResponseBody public JSONResult del(String id) { LOGGER.debug("into /customerType/del >>>>>>>>>>>>>>>>>>>>>>>{}", id); CustomerType customerType = customerTypeService.getById(id); if (customerType != null) { EntityUtils.init(customerType); customerType.setIsValid(YNEnum.N); customerTypeService.updateById(customerType); } return new JSONResult(); } }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| } if (e instanceof MultipartException) { LOGGER.debug("exception code:[{}],message:[{}]", Exceptions.System.SYSTEM_ERROR.getCode(), "上传文件大小不能超过10M"); return new JSONResult(Exceptions.System.SYSTEM_ERROR.getCode(), "上传文件大小不能超过10M"); } else { LOGGER.debug("exception code:[{}],message:[{}]", Exceptions.System.SYSTEM_ERROR.getCode(), e.getMessage()); return new JSONResult(Exceptions.System.SYSTEM_ERROR.getCode(), Exceptions.System.SYSTEM_ERROR.getDescription()); } } }
@Controller @RequestMapping("/customerType") public class CustomerTypeController extends BaseController { private static final Logger LOGGER = LoggerFactory.getLogger(CustomerTypeController.class);
@Autowired private ICustomerTypeService customerTypeService;
@RequestMapping(value = "/list", method = RequestMethod.GET) public String list() { LOGGER.debug("into /customerType/list >>>>>>>>>>>>>>>>>>>>>>>"); return "customer/type_list";
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| * 登录拦截器 */
public class LoginInterceptor implements HandlerInterceptor {
private final static Logger logger = LoggerFactory.getLogger(LoginInterceptor.class);
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { logger.debug("into LoginInterceptor >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); LoginVo loginVo = SessionCache.getUser(request); if (ObjectUtils.isEmpty(loginVo)) { response.sendRedirect(request.getContextPath() + "/login"); logger.error("您还未登录,请先登录!!!"); return false; } UserContext.setUserId(loginVo.getUser().getId()); return true; }
@Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
}
@Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { UserContext.remove(); }
}
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| logger.info("into /logout >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); SessionCache.removeUser(request); return "redirect:/login"; }
}
public class IpUtil {
private static final String N255 = "(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"; private static final Pattern PATTERN = Pattern.compile("^(?:" + N255 + "\\.){3}" + N255 + "$");
private IpUtil() {
}
private static String longToIpV4(long longIp) { int octet3 = (int) ((longIp >> 24) % 256); int octet2 = (int) ((longIp >> 16) % 256); int octet1 = (int) ((longIp >> 8) % 256); int octet0 = (int) ((longIp) % 256); return octet3 + "." + octet2 + "." + octet1 + "." + octet0; }
private static long ipV4ToLong(String ip) { String[] octets = ip.split("\\."); return (Long.parseLong(octets[0]) << 24) + (Integer.parseInt(octets[1]) << 16) + (Integer.parseInt(octets[2]) << 8) + Integer.parseInt(octets[3]); }
private static boolean isIPv4Private(String ip) { long longIp = ipV4ToLong(ip); return (longIp >= ipV4ToLong("10.0.0.0") && longIp <= ipV4ToLong("10.255.255.255")) || (longIp >= ipV4ToLong("172.16.0.0") && longIp <= ipV4ToLong("172.31.255.255")) || longIp >= ipV4ToLong("192.168.0.0") && longIp <= ipV4ToLong("192.168.255.255"); }
private static boolean isIPv4Valid(String ip) { return PATTERN.matcher(ip).matches(); }
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=301422312105200ij
https://javayms.pages.dev?id=301422312105200ij