基于javaweb的SpringBoot客户管理系统(java+springboot+maven+jsp+layui+jq+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

370023522402

380023522402

390023522402

400023522402

410023522402

420023522402

基于javaweb的SpringBoot客户管理系统(java+springboot+maven+jsp+layui+jq+mysql)

1
2
登录:
admin 123456

项目介绍

本项目为后管系统,主要功能包括:

登录、修改密码、客户模块、充值模块、消费模块、对账单模块等功能。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7版本;

技术栈

  1. 后端:SpringBoot+Mybatis

  2. 前端:JSP+LayUI+jQuery

使用说明
运行项目,输入http://localhost:8081/ 登录

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";
}

/**
* 登录
*
* @return
*/
@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);

//将用户信息存放在session中
SessionCache.setUser(request, loginVo);
request.getSession().setAttribute(Constant.SESSION_USER, loginVo);
return new JSONResult();
}

/**
* 登出
*
* @return
*/
@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();
}

/**
* 删除
*
* @return
*/
@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;

/**
* 进入客户类型列表页面
*
* @return
*/
@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";
}

}




/*
* 获取真实IP
*/
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();
}


项目链接:
https://javayms.github.io?id=301422312105200ij
https://javayms.pages.dev?id=301422312105200ij