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









基于javaweb的SpringBoot在线学习平台课程学习(java+springboot+maven+mysql+freemarker)
前台用户(t_account表):
http://localhost:8081/home/index/index
小张 123456
小王 123456
二狗 123456
猫蛋 123456
后台管理员(t_user表):
http://localhost:8081/system/login
admin 123456
基于springboot脚手架的在线课程学习平台系统,该系统除脚手架功能外又添加了一个前台,具体的功能如下:
用户:
学习课程、提交课程试题、上传分享资料、下载其他人的资料、收藏课程、个人中心、课程评价、资料讨论等
老师:
除用户功能外(添加 课程管理、视频管理、试题管理、批改试题管理、查看评价、回复评价)等
后台管理员:
审核前台用户认证信息、查看所有用户、订单、发布文章、发布常见问题等。
运行环境:jdk1.8、mysql5.x、eclipse/idea、maven3.5/3.6
特色功能:发布课程、学习课程、分享资料、资料讨论等
——————————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
| SessionUtil.set(SessionConstant.SESSION_USER_LOGIN_KEY, loginedUser); return Result.success(true); }
@RequestMapping(value = "/operator_log_list") public String operatorLogList(Model model, OperaterLog operaterLog, PageBean<OperaterLog> pageBean) { model.addAttribute("pageBean", operaterLogService.findList(operaterLog, pageBean)); model.addAttribute("operator", operaterLog.getOperator()); model.addAttribute("title", "日志列表"); return "admin/system/operator_log_list"; }
@RequestMapping(value = "/delete_operator_log", method = RequestMethod.POST) @ResponseBody public Result<Boolean> delete(String ids) { if (!StringUtils.isEmpty(ids)) { String[] splitIds = ids.split(","); for (String id : splitIds) { operaterLogService.delete(Long.valueOf(id)); } } return Result.success(true); }
@RequestMapping(value = "/delete_all_operator_log", method = RequestMethod.POST)
|
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
| }
@ResponseBody @PostMapping("/edit") public Result<Boolean> edit(DiscountCode discountCode){ CodeMsg validate = ValidateEntityUtil.validate(discountCode); if(validate.getCode() != CodeMsg.SUCCESS.getCode()){ return Result.error(validate); } DiscountCode discountCode1 = discountCodeService.find(discountCode.getId()); discountCode1.setPrice(discountCode.getPrice()); discountCode1.setEndDate(discountCode.getEndDate()); if(discountCodeService.save(discountCode1)==null){ return Result.error(CodeMsg.HOME_CODE_EDIT_ERROR); } return Result.success(true); }
@ResponseBody @PostMapping("/delete") public Result<Boolean> delete(@RequestParam(name = "id")Long id){ try { discountCodeService.delete(id); }catch (Exception e){ return Result.error(CodeMsg.HOME_CODE_DELETE_ERROR); } return Result.success(true); }
}
|
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
| Account loginedAccount = SessionUtil.getLoginedAccount(); if(loginedAccount.getPayPassword()==null){ return Result.error(CodeMsg.HOME_PERSONAL_PAY_PASSWORD_NOT_ERROR); } if (!loginedAccount.getPayPassword().equals(payPassword)) { return Result.error(CodeMsg.HOME_PERSONAL_PAY_PASSWORD_ERROR); } RechargeRecord rechargeRecord = new RechargeRecord(); BigDecimal balance = loginedAccount.getBalance(); rechargeRecord.setAccount(loginedAccount); rechargeRecord.setPrice(price); rechargeRecord.setOldPrice(balance); rechargeRecord.setFinalPrice(price.add(balance)); loginedAccount.setBalance(balance.add(price)); if (!rechargeRecordService.save(rechargeRecord)) { return Result.error(CodeMsg.HOME_RECHARGE_ADD_ERROR); } return Result.success(true); }
@ResponseBody @PostMapping("/charge_delete") public Result<Boolean> chargeDelete(@RequestParam(name = "id") Long id) { try { rechargeRecordService.delete(id); } catch (Exception e) { return Result.error(CodeMsg.HOME_RECHARGE_DELETE_ERROR); } return Result.success(true); }
@GetMapping("/my_learn_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 39 40 41 42
|
@RequestMapping(value="/edit",method=RequestMethod.POST) @ResponseBody public Result<Boolean> edit(User user){ CodeMsg validate = ValidateEntityUtil.validate(user); if(validate.getCode() != CodeMsg.SUCCESS.getCode()){ return Result.error(validate); } if(user.getRole() == null || user.getRole().getId() == null){ return Result.error(CodeMsg.ADMIN_USER_ROLE_EMPTY); } if(user.getId() == null || user.getId().longValue() <= 0){ return Result.error(CodeMsg.ADMIN_USE_NO_EXIST); } if(userService.isExistUsername(user.getUsername(), user.getId())){ return Result.error(CodeMsg.ADMIN_USERNAME_EXIST); } User findById = userService.find(user.getId()); BeanUtils.copyProperties(user, findById, "id","createTime","updateTime"); if(userService.save(findById) == null){ return Result.error(CodeMsg.ADMIN_USE_EDIT_ERROR); } operaterLogService.add("编辑用户,用户名:" + user.getUsername()); return Result.success(true); }
@RequestMapping(value="/delete",method=RequestMethod.POST) @ResponseBody public Result<Boolean> delete(@RequestParam(name="id",required=true)Long id){ try {
|
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
|
@RequestMapping("/home/discount_code") @Controller public class DiscountCodeController {
@Value("${code.max}") private int codeMax;
@Autowired private DiscountCodeService discountCodeService;
@GetMapping("/list") public String courseTestList(Model model, DiscountCode discountCode, PageBean<DiscountCode> pageBean) { Account loginedAccount = SessionUtil.getLoginedAccount(); discountCode.setAccount(loginedAccount); model.addAttribute("title", "优惠码列表"); model.addAttribute("active", "courseCodeList"); model.addAttribute("pageBean", discountCodeService.findList(discountCode, pageBean)); return "/home/personal/coupons_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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
@GetMapping("/forget_pwd") public String forgetPassword(){ return "/home/index/forget_pwd"; }
@ResponseBody @PostMapping("/get_email") public Result<Long> getEmail(Account account){ Account byEmailAndPhone = accountService.findByEmailAndPhone(account.getEmail(), account.getPhone()); if(byEmailAndPhone==null){ return Result.error(CodeMsg.HOME_ACCOUNT_EMAIL_AND_PHONE_ERROR); } return Result.success(byEmailAndPhone.getId()); }
@GetMapping("/set_pwd") public String setPwd(@RequestParam(name = "id")Long id,Model model){ model.addAttribute("id",id); return "/home/index/set_pwd"; }
@ResponseBody @PostMapping("/set_pwd") public Result<Boolean> setPwd(Account account){ String password = account.getPassword(); if(StringUtils.isEmpty(password)){ return Result.error(CodeMsg.HOME_ACCOUNT_PASSWORD_NOT_EXIST_ERROR); } Account account1 = accountService.find(account.getId()); account1.setPassword(password); if(accountService.save(account1)==null){ return Result.error(CodeMsg.HOME_ACCOUNT_SET_PASSWORD_ERROR); } return Result.success(true);
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=041923222309201ey
https://javayms.pages.dev?id=041923222309201ey