diff --git a/src/main/java/com/example/jieyue/JieyueApplication.java b/src/main/java/com/example/jieyue/JieyueApplication.java index ce5b63a..d724c34 100644 --- a/src/main/java/com/example/jieyue/JieyueApplication.java +++ b/src/main/java/com/example/jieyue/JieyueApplication.java @@ -12,10 +12,15 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer import org.springframework.context.annotation.Bean; import org.springframework.scheduling.annotation.EnableScheduling; -@MapperScan("com.example.jieyue.common.mapper")// mapper扫描 +/** + *
启动类
+ * @author Bosen + * @date 2021/8/9 23:07 + */ +@MapperScan("com.example.jieyue.common.mapper") @SpringBootApplication @ServletComponentScan -@EnableScheduling// 定时任务 +@EnableScheduling public class JieyueApplication extends SpringBootServletInitializer { public static void main(String[] args) { @@ -27,8 +32,8 @@ public class JieyueApplication extends SpringBootServletInitializer { return builder.sources(JieyueApplication.class); } - /* - * 处理文件过大上传失败的问题 + /** + *处理文件过大上传失败的问题
*/ @Bean public TomcatServletWebServerFactory containerFactory() { diff --git a/src/main/java/com/example/jieyue/admin/controller/AdminHomeController.java b/src/main/java/com/example/jieyue/admin/controller/AdminHomeController.java index 8651580..4840d69 100644 --- a/src/main/java/com/example/jieyue/admin/controller/AdminHomeController.java +++ b/src/main/java/com/example/jieyue/admin/controller/AdminHomeController.java @@ -22,8 +22,11 @@ public class AdminHomeController { @Autowired SysUserMapper userMapper; + /** + *登录页面
+ */ @RequestMapping("/admin/home") - public ModelAndView index(ModelAndView modelAndView){ + public ModelAndView index(ModelAndView modelAndView) { float profit = orderMapper.websiteProfitCount(); int orderCount = orderMapper.payCount(); int goodsCount = goodsMapper.allGoodsCount(); diff --git a/src/main/java/com/example/jieyue/admin/controller/AdminLoginController.java b/src/main/java/com/example/jieyue/admin/controller/AdminLoginController.java index 712bcd7..8c7e047 100644 --- a/src/main/java/com/example/jieyue/admin/controller/AdminLoginController.java +++ b/src/main/java/com/example/jieyue/admin/controller/AdminLoginController.java @@ -8,7 +8,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; -import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** @@ -21,8 +20,9 @@ import javax.servlet.http.HttpSession; public class AdminLoginController { @Autowired AdminLoginService service; - /* - * 登陆页面 + + /** + *登陆页面
*/ @RequestMapping({"login",""}) public ModelAndView index(ModelAndView modelAndView){ @@ -30,11 +30,11 @@ public class AdminLoginController { return modelAndView; } - /* - * 登陆处理 + /** + *登录处理
*/ @RequestMapping("do-login") - public ModelAndView doLogin(HttpSession session, ModelAndView modelAndView,String email, String password){ + public ModelAndView doLogin(HttpSession session, ModelAndView modelAndView, String email, String password){ int result = service.doLogin(email,password); if (result==1){ // 登陆成功 @@ -57,22 +57,22 @@ public class AdminLoginController { } return modelAndView; } - - /* - * 退出登录 + + /** + *退出登录
*/ @RequestMapping("logout") - public ModelAndView logout(ModelAndView modelAndView,HttpSession session){ + public ModelAndView logout(ModelAndView modelAndView, HttpSession session){ session.setAttribute("merchant",null); modelAndView.setViewName("redirect:/admin/login"); return modelAndView; } - /* - * 注册请求 + /** + *注册请求
*/ @RequestMapping("sign-up") - public String signUp(String name,String email,String password){ + public String signUp(String name, String email, String password){ int result = service.singup(email,name,password); if (result==0){ return "必填信息不能为空!"; @@ -95,11 +95,11 @@ public class AdminLoginController { return null; } - /* - * 验证邮件确认注册 + /** + *验证邮件,确认注册
*/ @RequestMapping("sign-check") - public ModelAndView singCheck(ModelAndView modelAndView,@Param("email") String email){ + public ModelAndView singCheck(ModelAndView modelAndView, @Param("email") String email){ int res = service.singCheck(email); if (res==-1){ modelAndView.setViewName("redirect:/error"); diff --git a/src/main/java/com/example/jieyue/admin/controller/AdminMerchantController.java b/src/main/java/com/example/jieyue/admin/controller/AdminMerchantController.java index 70ae479..c25a98a 100644 --- a/src/main/java/com/example/jieyue/admin/controller/AdminMerchantController.java +++ b/src/main/java/com/example/jieyue/admin/controller/AdminMerchantController.java @@ -24,8 +24,11 @@ public class AdminMerchantController { @Autowired SysMtMapper merchantMapper; + /** + *商户模块主页
+ */ @RequestMapping("") - public ModelAndView index(ModelAndView modelAndView, HttpServletRequest request){ + public ModelAndView index(ModelAndView modelAndView, HttpServletRequest request) { modelAndView.setViewName("/admin/merchant/index"); int pageSize = 10; @@ -33,22 +36,22 @@ public class AdminMerchantController { int num = 1; int preNum = 1; int nextNum = 1; - if (request.getParameter("num")!=null){ + if (request.getParameter("num")!=null) { num = Integer.parseInt(request.getParameter("num")); } - if (num <= 1){ + if (num <= 1) { preNum = 1; nextNum = 2; }else{ - preNum = num-1; - if (num>=pageCount-1){ + preNum = num - 1; + if (num>=pageCount - 1) { nextNum = pageCount; }else{ nextNum = num+1; } } List修改费率
+ */ @RequestMapping("update-ratio") - public ModelAndView updateRatio(ModelAndView modelAndView,String ratio,int id){ + public ModelAndView updateRatio(ModelAndView modelAndView,String ratio,int id) { try { float ratioFloat = Float.valueOf(ratio); if (ratioFloat > 1.0 || ratioFloat < 0.1 || !checkFloat(ratioFloat)){ modelAndView.addObject("msg","费率应在0.1~1.0之间(一位小数)"); }else{ - if (merchantMapper.updateRatio(id,ratioFloat)==1){ + if (merchantMapper.updateRatio(id,ratioFloat) == 1){ modelAndView.addObject("msg","修改成功"); }else{ modelAndView.addObject("msg","修改失败"); @@ -81,11 +87,11 @@ public class AdminMerchantController { return modelAndView; } - /* - * 删除商户 + /** + *删除商户
*/ @RequestMapping("delete-merchant") - public ModelAndView deleteMerchant(ModelAndView modelAndView,int id){ + public ModelAndView deleteMerchant(ModelAndView modelAndView,int id) { if (merchantService.deleteMerchant(id)==1){ modelAndView.addObject("msg","删除商户成功!"); }else{ @@ -95,11 +101,11 @@ public class AdminMerchantController { return modelAndView; } - /* - * 修改商户状态 + /** + *修改商户状态
*/ @RequestMapping("update-merchant") - public ModelAndView updateMerchant(ModelAndView modelAndView,String email,int state){ + public ModelAndView updateMerchant(ModelAndView modelAndView,String email,int state) { if (merchantService.updateMerchantState(email,state)==1){ modelAndView.addObject("msg","操作成功!"); }else{ @@ -109,8 +115,8 @@ public class AdminMerchantController { return modelAndView; } - /* - * 检查费率是否超过了一位小数 + /** + *检查费率是否超过了一位小数
*/ public boolean checkFloat(float ratio){ char[] c = String.valueOf(ratio).split(".")[1].toCharArray(); diff --git a/src/main/java/com/example/jieyue/admin/controller/AdminNoticeController.java b/src/main/java/com/example/jieyue/admin/controller/AdminNoticeController.java index 319318d..85d451f 100644 --- a/src/main/java/com/example/jieyue/admin/controller/AdminNoticeController.java +++ b/src/main/java/com/example/jieyue/admin/controller/AdminNoticeController.java @@ -7,6 +7,11 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; +/** + *后台群发控制器
+ * @author Bosen + * @date 2021/8/9 22:24 + */ @RestController public class AdminNoticeController { @Autowired @@ -15,20 +20,25 @@ public class AdminNoticeController { IsEmptyUtil isEmptyUtil; @RequestMapping("/admin/notice") - public ModelAndView index(ModelAndView modelAndView){ + public ModelAndView index(ModelAndView modelAndView) { modelAndView.setViewName("admin/notice/index"); return modelAndView; } - /* - * 系统消息发送 利用redis异步发送 + /** + *系统消息发送 利用redis异步发送
*/ @RequestMapping("/admin/send-notice") - public ModelAndView sendNotice(ModelAndView modelAndView,String title,String context,int type){ + public ModelAndView sendNotice(ModelAndView modelAndView, String title, String context, int type) { if (isEmptyUtil.strings(title,context)){ modelAndView.addObject("msg","必填信息不能为空"); }else{ - noticeService.sendByRabbitMQ(title,context,type); + // 发送至redis + noticeService.sendByRedis(title, context, type); + + // 发送至RabbitMQ + // noticeService.sendByRabbitMQ(title, context, type); + modelAndView.addObject("msg","系统消息发送成功"); } modelAndView.setViewName("redirect:/admin/notice"); diff --git a/src/main/java/com/example/jieyue/admin/controller/AdminOrderController.java b/src/main/java/com/example/jieyue/admin/controller/AdminOrderController.java index e4a89e2..861bbef 100644 --- a/src/main/java/com/example/jieyue/admin/controller/AdminOrderController.java +++ b/src/main/java/com/example/jieyue/admin/controller/AdminOrderController.java @@ -21,7 +21,7 @@ public class AdminOrderController { AdminOrderService orderService; @RequestMapping("/admin/order") - public ModelAndView index(ModelAndView modelAndView,@RequestParam(defaultValue = "2")int flag, @RequestParam(defaultValue = "1")int page){ + public ModelAndView index(ModelAndView modelAndView,@RequestParam(defaultValue = "2")int flag, @RequestParam(defaultValue = "1")int page) { // 获取订单信息 List后台模块RBAC权限管理控制器
+ * @author Bosen + * @date 2021/8/9 23:20 + */ @RestController public class AdminRbacController { @Autowired @@ -55,23 +59,27 @@ public class AdminRbacController { return modelAndView; } + /** + *权限不足时需要跳转的页面
+ */ @RequestMapping("/admin/alert") public ModelAndView adminAlert(ModelAndView modelAndView) { modelAndView.setViewName("admin/rbac/alert"); return modelAndView; } - /* - * 编辑管理员的角色页面 + /** + *编辑管理员的角色页面
*/ @RequestMapping("/admin/rbac/update-admin-role") - public ModelAndView updateAdminRole(ModelAndView modelAndView, HttpServletRequest request, int admin, @RequestParam(defaultValue = "0") int role) { + public ModelAndView updateAdminRole(ModelAndView modelAndView, int admin, @RequestParam(defaultValue = "0") int role) { modelAndView.setViewName("redirect:/admin/rbac"); if (role == 0) { modelAndView.addObject("msg","未对管理员角色进行修改"); return modelAndView; } - int sql = 0;// sql执行结果接收变量 + // sql执行结果接收变量 + int sql = 0; if (adminRoleMapper.countByAdminId(admin) == 0) { // 此管理员还未设置角色 sql = adminRoleMapper.insert(admin, role); @@ -87,8 +95,8 @@ public class AdminRbacController { return modelAndView; } - /* - * 添加角色 + /** + *添加角色
*/ @RequestMapping("/admin/add-role") public ModelAndView addRole(ModelAndView modelAndView,String name){ @@ -107,8 +115,8 @@ public class AdminRbacController { return modelAndView; } - /* - * 添加权限 + /** + *添加权限
*/ @RequestMapping("/admin/add-access") public ModelAndView addAccess(ModelAndView modelAndView,String name,String url){ @@ -164,11 +172,11 @@ public class AdminRbacController { return modelAndView; } - /* - * 停用管理员 + /** + *停用管理员
*/ @RequestMapping("/admin/off-admin") - public ModelAndView offAdmin(ModelAndView modelAndView,int id){ + public ModelAndView offAdmin(ModelAndView modelAndView, int id){ modelAndView.setViewName("redirect:/admin/rbac"); if (id==1){ modelAndView.addObject("无法停用此管理员!"); @@ -182,8 +190,8 @@ public class AdminRbacController { return modelAndView; } - /* - * 启用管理员 + /** + *启用管理员
*/ @RequestMapping("/admin/on-admin") public ModelAndView onAdmin(ModelAndView modelAndView,int id){ @@ -196,8 +204,8 @@ public class AdminRbacController { return modelAndView; } - /* - * 停用角色 + /** + *停用角色
*/ @RequestMapping("/admin/off-role") public ModelAndView offRole(ModelAndView modelAndView,int id){ @@ -210,8 +218,8 @@ public class AdminRbacController { return modelAndView; } - /* - * 启用角色 + /** + *启用角色
*/ @RequestMapping("/admin/on-role") public ModelAndView onRole(ModelAndView modelAndView,int id){ @@ -224,8 +232,8 @@ public class AdminRbacController { return modelAndView; } - /* - * 启用权限 + /** + *启用权限
*/ @RequestMapping("/admin/on-access") public ModelAndView onAccess(ModelAndView modelAndView,int id){ @@ -238,8 +246,8 @@ public class AdminRbacController { return modelAndView; } - /* - * 停用权限 + /** + *停用权限
*/ @RequestMapping("/admin/off-access") public ModelAndView offAccess(ModelAndView modelAndView,int id){ @@ -252,8 +260,8 @@ public class AdminRbacController { return modelAndView; } - /* - * 修改权限信息 + /** + *修改权限信息
*/ @RequestMapping("/admin/update-access") public ModelAndView updateAccess(ModelAndView modelAndView,int id,String name,String url){ @@ -266,8 +274,8 @@ public class AdminRbacController { return modelAndView; } - /* - * 修改角儿权限信息页面 + /** + *修改角儿权限信息页面
*/ @RequestMapping("/admin/role-access") public ModelAndView roleAccessIndex(ModelAndView modelAndView,int id){ @@ -290,8 +298,8 @@ public class AdminRbacController { return modelAndView; } - /* - * 修改角色的权限 + /** + *修改角色的权限
*/ @RequestMapping("/admin/role-access/action") public ModelAndView action(ModelAndView modelAndView,int role,int ... ids){ diff --git a/src/main/java/com/example/jieyue/admin/controller/AdminUiController.java b/src/main/java/com/example/jieyue/admin/controller/AdminUiController.java index 4a6a78e..30d8c75 100644 --- a/src/main/java/com/example/jieyue/admin/controller/AdminUiController.java +++ b/src/main/java/com/example/jieyue/admin/controller/AdminUiController.java @@ -35,8 +35,6 @@ public class AdminUiController { /** *文件上传操作
- * @author Bosen - * 2020/11/5 18:56 */ @RequestMapping("/admin/up-image") public ModelAndView upImage(ModelAndView modelAndView, MultipartFile file, RedirectAttributes redirectAttributes, HttpServletRequest request,int width,int height){ @@ -55,8 +53,8 @@ public class AdminUiController { return modelAndView; } - /* - * 删除海报 + /** + *删除海报
*/ @RequestMapping("/admin/del-image") public ModelAndView delImg(ModelAndView modelAndView,int width,int height){ diff --git a/src/main/java/com/example/jieyue/admin/controller/AdminUserController.java b/src/main/java/com/example/jieyue/admin/controller/AdminUserController.java index 821a1fe..1ccea16 100644 --- a/src/main/java/com/example/jieyue/admin/controller/AdminUserController.java +++ b/src/main/java/com/example/jieyue/admin/controller/AdminUserController.java @@ -10,6 +10,11 @@ import org.springframework.web.servlet.ModelAndView; import java.util.List; +/** + *后台用户列表控制器
+ * @author Bosen + * @date 2021/8/9 22:34 + */ @RestController public class AdminUserController { @Autowired diff --git a/src/main/java/com/example/jieyue/admin/service/AdminLoginService.java b/src/main/java/com/example/jieyue/admin/service/AdminLoginService.java index c0b95cc..78e5824 100644 --- a/src/main/java/com/example/jieyue/admin/service/AdminLoginService.java +++ b/src/main/java/com/example/jieyue/admin/service/AdminLoginService.java @@ -1,17 +1,14 @@ package com.example.jieyue.admin.service; import com.example.jieyue.common.entity.SysAdmin; -import com.example.jieyue.common.entity.SysMt; import com.example.jieyue.common.mapper.SysAdminMapper; import com.example.jieyue.common.mapper.SysAdminRoleMapper; import com.example.jieyue.common.service.MailService; -import com.example.jieyue.common.service.SysUserService; import com.example.jieyue.common.utils.IsEmptyUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.util.DigestUtils; /** @@ -23,15 +20,18 @@ import org.springframework.util.DigestUtils; public class AdminLoginService { @Autowired SysAdminMapper adminMapper; + @Autowired MailService mailService; + @Autowired SysAdminRoleMapper adminRoleMapper; + @Value("${site-url}") String sitrUrl; - // 判空工具类 IsEmptyUtil isEmptyUtil = IsEmptyUtil.getInstance(); + /** *登陆验证逻辑处理
* @return int @@ -59,8 +59,8 @@ public class AdminLoginService { } } - /* - * 返回用户信息 + /** + *返回用户信息
*/ public SysAdmin adminInfo(String email){ return adminMapper.getAdminInfo(email); diff --git a/src/main/java/com/example/jieyue/admin/service/AdminMerchantService.java b/src/main/java/com/example/jieyue/admin/service/AdminMerchantService.java index a7232f3..1afbf3d 100644 --- a/src/main/java/com/example/jieyue/admin/service/AdminMerchantService.java +++ b/src/main/java/com/example/jieyue/admin/service/AdminMerchantService.java @@ -11,9 +11,9 @@ import java.util.List; public class AdminMerchantService { @Autowired SysMtMapper mtMapper; + /** *获取用户的信息
- * * @param curPage 当前页数 * @param pageSize 一页的条数 */ @@ -22,8 +22,8 @@ public class AdminMerchantService { return mtMapper.findPage(curRow,pageSize); } - /* - * 删除商户 + /** + *删除商户
*/ public int deleteMerchant(int merchantId){ if (mtMapper.deleteById(merchantId)==1){ @@ -32,8 +32,8 @@ public class AdminMerchantService { return -1; } - /* - * 修改用户状态 + /** + *修改用户状态
*/ public int updateMerchantState(String email,int state){ if (mtMapper.updateState(email,state)==1){ @@ -42,8 +42,8 @@ public class AdminMerchantService { return -1; } - /* - * 获取商户列表总页数 + /** + *获取商户列表总页数
*/ public int getMtPage(int pageSize){ if (mtMapper.count()==0){ @@ -52,8 +52,4 @@ public class AdminMerchantService { return (int)Math.ceil((double)mtMapper.count()/pageSize); } } - - public int updateRatio(float ratio,int id){ - return 1; - } } diff --git a/src/main/java/com/example/jieyue/admin/service/AdminNoticeService.java b/src/main/java/com/example/jieyue/admin/service/AdminNoticeService.java index d3b57cd..fe70269 100644 --- a/src/main/java/com/example/jieyue/admin/service/AdminNoticeService.java +++ b/src/main/java/com/example/jieyue/admin/service/AdminNoticeService.java @@ -34,8 +34,8 @@ public class AdminNoticeService { @Autowired RabbitTemplate rabbitTemplate; - /* - * 将要发送的消息存入redis消息队列 + /** + *将要发送的消息存入redis消息队列
*/ public void sendByRedis(String title,String context,int type){ Map将要发送的消息存入rabbitMQ消息队列
+ */ public void sendByRabbitMQ(String title,String context,int type){ switch (type){ case 0: diff --git a/src/main/java/com/example/jieyue/admin/service/AdminOrderService.java b/src/main/java/com/example/jieyue/admin/service/AdminOrderService.java index a74ca7e..cbcb6d0 100644 --- a/src/main/java/com/example/jieyue/admin/service/AdminOrderService.java +++ b/src/main/java/com/example/jieyue/admin/service/AdminOrderService.java @@ -13,23 +13,28 @@ public class AdminOrderService { @Autowired SysOrderMapper orderMapper; - /* - * 获取订单信息 + /** + *获取订单信息
*/ public List通过订单号查找
*/ public List获取总页数
*/ public int getAllPage(int flag,int num){ switch (flag){ @@ -53,6 +58,8 @@ public class AdminOrderService { return (int)Math.ceil((double)orderMapper.orderCount()/(double)num); case 3: return 1; + default: + break; } return 1; } diff --git a/src/main/java/com/example/jieyue/admin/service/AdminRbacService.java b/src/main/java/com/example/jieyue/admin/service/AdminRbacService.java index b07fa4c..54f0722 100644 --- a/src/main/java/com/example/jieyue/admin/service/AdminRbacService.java +++ b/src/main/java/com/example/jieyue/admin/service/AdminRbacService.java @@ -13,19 +13,7 @@ public class AdminRbacService { SysRoleAccessMapper roleAccessMapper; /** - *修改管理员的角色
- * @return 1 成功 -1 失败 - * @author Bosen - * 2020/12/30 5:19 - * TODO TODO TODO TODO - */ - public int updateAdminRoleAction(int adminId,String roles){ - // 对使用json封装的js数组进行解析 - return -1; - } - - /* - * 修改角色的权限 + *修改角色的权限
*/ @Transactional public boolean setRoleAccess(int role,int[] ids){ @@ -39,6 +27,4 @@ public class AdminRbacService { } return true; } - - } diff --git a/src/main/java/com/example/jieyue/admin/service/AdminUiService.java b/src/main/java/com/example/jieyue/admin/service/AdminUiService.java index 8a65586..80f9db3 100644 --- a/src/main/java/com/example/jieyue/admin/service/AdminUiService.java +++ b/src/main/java/com/example/jieyue/admin/service/AdminUiService.java @@ -19,15 +19,15 @@ public class AdminUiService { DateUtil dateUtil; @Autowired SysUiMapper uiMapper; + /** - * 文件上传逻辑处理 - * + *文件上传逻辑处理
* @return * null 上传失败 * 文件名 上传成功 */ - public String upImage(MultipartFile file,RedirectAttributes redirectAttributes, - HttpServletRequest request,String url,int weight,int height) { + public String upImage(MultipartFile file, RedirectAttributes redirectAttributes, + HttpServletRequest request, String url,int weight,int height) { // 设置filename 文件名由年月日时分秒以及六位随机数组成 String filename = dateUtil.getNMDHIS()+Math.round(Math.random()*(999999-100000)+100000); // 接收文件工具类返回的文件位置 @@ -60,8 +60,8 @@ public class AdminUiService { } } - /* - * 删除海报逻辑处理 + /** + *删除海报逻辑处理
*/ public boolean delImg(int width,int height){ if (uiMapper.findByMark(width,height)==null){ @@ -71,10 +71,8 @@ public class AdminUiService { int delResult = uiMapper.deleteByMark(width,height); if (delResult == 1) { return true; - } else { - // sql语句执行失败 - return false; } + return false; } } } diff --git a/src/main/java/com/example/jieyue/admin/service/AdminUserService.java b/src/main/java/com/example/jieyue/admin/service/AdminUserService.java index acae6ee..b491c84 100644 --- a/src/main/java/com/example/jieyue/admin/service/AdminUserService.java +++ b/src/main/java/com/example/jieyue/admin/service/AdminUserService.java @@ -12,15 +12,15 @@ public class AdminUserService { @Autowired SysUserMapper userMapper; - /* - * 获取用户信息 + /** + *获取用户信息
*/ public List获取总页数
*/ public int getAllPage(int num){ return (int)Math.ceil((double)userMapper.userCount()/(double)num); diff --git a/src/main/java/com/example/jieyue/common/component/LoginHandlerInterceptor.java b/src/main/java/com/example/jieyue/common/component/LoginHandlerInterceptor.java index b5db551..169c67b 100644 --- a/src/main/java/com/example/jieyue/common/component/LoginHandlerInterceptor.java +++ b/src/main/java/com/example/jieyue/common/component/LoginHandlerInterceptor.java @@ -1,17 +1,11 @@ package com.example.jieyue.common.component; -import com.example.jieyue.common.entity.*; -import com.example.jieyue.common.mapper.*; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import java.util.List; -import java.util.regex.Matcher; import java.util.regex.Pattern; /** diff --git a/src/main/java/com/example/jieyue/common/component/RBACHandlerInterceptor.java b/src/main/java/com/example/jieyue/common/component/RBACHandlerInterceptor.java index bcdb47e..e2bd092 100644 --- a/src/main/java/com/example/jieyue/common/component/RBACHandlerInterceptor.java +++ b/src/main/java/com/example/jieyue/common/component/RBACHandlerInterceptor.java @@ -10,11 +10,14 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.List; +/** + *权限检查拦截器
+ * @author Bosen + * @date 2021/8/9 22:40 + */ @Component public class RBACHandlerInterceptor implements HandlerInterceptor { - - private static SysAdminMapper adminMapper; - + private static SysRoleMapper roleMapper; private static SysAccessMapper accessMapper; @@ -23,11 +26,6 @@ public class RBACHandlerInterceptor implements HandlerInterceptor { private static SysRoleAccessMapper roleAccessMapper; - @Autowired - public void setAdminMapper(SysAdminMapper adminMapper) { - RBACHandlerInterceptor.adminMapper = adminMapper; - } - @Autowired public void setRoleMapper(SysRoleMapper roleMapper) { RBACHandlerInterceptor.roleMapper = roleMapper; @@ -69,8 +67,9 @@ public class RBACHandlerInterceptor implements HandlerInterceptor { } return true; } - /* - * 检查权限 + + /** + *检查权限
*/ public boolean checkRbac(HttpServletRequest request) { try { diff --git a/src/main/java/com/example/jieyue/common/config/AdminWebMvcConfigurer.java b/src/main/java/com/example/jieyue/common/config/AdminWebMvcConfigurer.java index f240d0a..6cb4c4f 100644 --- a/src/main/java/com/example/jieyue/common/config/AdminWebMvcConfigurer.java +++ b/src/main/java/com/example/jieyue/common/config/AdminWebMvcConfigurer.java @@ -21,9 +21,7 @@ public class AdminWebMvcConfigurer implements WebMvcConfigurer { @Override public void addInterceptors(InterceptorRegistry registry) { - /* - * 网站主页,静态资源,网站作者页面,以及登陆注册所需页面外,未登录时的访问 统一跳转至登陆注册页面 - */ + // 登录拦截 registry.addInterceptor(new LoginHandlerInterceptor()) .addPathPatterns("/admin/**") .excludePathPatterns( @@ -31,6 +29,8 @@ public class AdminWebMvcConfigurer implements WebMvcConfigurer { "/css/**","/js/**","/image/**","/fonts/**","/mapping/**","/data/**", "/lib/*/*/**" ); + + // 权限拦截 registry.addInterceptor(new RBACHandlerInterceptor()) .addPathPatterns("/admin/**") .excludePathPatterns( diff --git a/src/main/java/com/example/jieyue/common/config/MerchantWebMvcConfigurer.java b/src/main/java/com/example/jieyue/common/config/MerchantWebMvcConfigurer.java index 15828da..72b459b 100644 --- a/src/main/java/com/example/jieyue/common/config/MerchantWebMvcConfigurer.java +++ b/src/main/java/com/example/jieyue/common/config/MerchantWebMvcConfigurer.java @@ -20,9 +20,7 @@ public class MerchantWebMvcConfigurer implements WebMvcConfigurer { @Override public void addInterceptors(InterceptorRegistry registry) { - /* - * 网站主页,静态资源,网站作者页面,以及登陆注册所需页面外,未登录时的访问 统一跳转至登陆注册页面 - */ + // 登录拦截 registry.addInterceptor(new LoginHandlerInterceptor()) .addPathPatterns("/mer*/**") .excludePathPatterns( diff --git a/src/main/java/com/example/jieyue/common/config/TransactionManagerConfiguration.java b/src/main/java/com/example/jieyue/common/config/TransactionManagerConfiguration.java index 182715c..3b21178 100644 --- a/src/main/java/com/example/jieyue/common/config/TransactionManagerConfiguration.java +++ b/src/main/java/com/example/jieyue/common/config/TransactionManagerConfiguration.java @@ -8,6 +8,10 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; import javax.sql.DataSource; +/** + * @author Bosen + * @date 2021/8/9 22:42 + */ @EnableTransactionManagement @Configuration public class TransactionManagerConfiguration { diff --git a/src/main/java/com/example/jieyue/common/config/UserWebMvcConfigurer.java b/src/main/java/com/example/jieyue/common/config/UserWebMvcConfigurer.java index 662f9c1..fe24e9d 100644 --- a/src/main/java/com/example/jieyue/common/config/UserWebMvcConfigurer.java +++ b/src/main/java/com/example/jieyue/common/config/UserWebMvcConfigurer.java @@ -20,9 +20,7 @@ public class UserWebMvcConfigurer implements WebMvcConfigurer { @Override public void addInterceptors(InterceptorRegistry registry) { - /* - * 网站主页,静态资源,网站作者页面,以及登陆注册所需页面外,未登录时的访问 统一跳转至登陆注册页面 - */ + // 登录拦截 registry.addInterceptor(new LoginHandlerInterceptor()) .addPathPatterns("/user/**") .excludePathPatterns( diff --git a/src/main/java/com/example/jieyue/common/controller/TestController.java b/src/main/java/com/example/jieyue/common/controller/TestController.java deleted file mode 100644 index 73180c6..0000000 --- a/src/main/java/com/example/jieyue/common/controller/TestController.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.example.jieyue.common.controller; - -import org.springframework.web.bind.annotation.RestController; - -@RestController -public class TestController { - -} diff --git a/src/main/java/com/example/jieyue/common/entity/SysAccess.java b/src/main/java/com/example/jieyue/common/entity/SysAccess.java index c167981..299cb46 100644 --- a/src/main/java/com/example/jieyue/common/entity/SysAccess.java +++ b/src/main/java/com/example/jieyue/common/entity/SysAccess.java @@ -1,40 +1,20 @@ package com.example.jieyue.common.entity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *数据库表的映射类
+ * @author Bosen + * @date 2021/8/9 22:47 + */ +@AllArgsConstructor +@NoArgsConstructor +@Data public class SysAccess { private int id; private String name; private String url; private int status; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } } diff --git a/src/main/java/com/example/jieyue/common/entity/SysAdmin.java b/src/main/java/com/example/jieyue/common/entity/SysAdmin.java index 6c60b75..3508195 100644 --- a/src/main/java/com/example/jieyue/common/entity/SysAdmin.java +++ b/src/main/java/com/example/jieyue/common/entity/SysAdmin.java @@ -1,60 +1,21 @@ package com.example.jieyue.common.entity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *数据库表的映射类
+ * @author Bosen + * @date 2021/8/9 22:46 + */ +@AllArgsConstructor +@NoArgsConstructor +@Data public class SysAdmin { private int id; private String name; private String password; private String email; private int mark; - - @Override - public String toString() { - return "SysAdmin{" + - "id=" + id + - ", name='" + name + '\'' + - ", password='" + password + '\'' + - ", email='" + email + '\'' + - ", mark=" + mark + - '}'; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public int getMark() { - return mark; - } - - public void setMark(int mark) { - this.mark = mark; - } } diff --git a/src/main/java/com/example/jieyue/common/entity/SysAdminRole.java b/src/main/java/com/example/jieyue/common/entity/SysAdminRole.java index 0e9e3e5..d512663 100644 --- a/src/main/java/com/example/jieyue/common/entity/SysAdminRole.java +++ b/src/main/java/com/example/jieyue/common/entity/SysAdminRole.java @@ -1,40 +1,20 @@ package com.example.jieyue.common.entity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *数据库表的映射类
+ * @author Bosen + * @date 2021/8/9 22:46 + */ +@AllArgsConstructor +@NoArgsConstructor +@Data public class SysAdminRole { private int id; private int adminId; private int roleId; private int status; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getAdminId() { - return adminId; - } - - public void setAdminId(int adminId) { - this.adminId = adminId; - } - - public int getRoleId() { - return roleId; - } - - public void setRoleId(int roleId) { - this.roleId = roleId; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } } diff --git a/src/main/java/com/example/jieyue/common/entity/SysCart.java b/src/main/java/com/example/jieyue/common/entity/SysCart.java index f1afe62..0c4a089 100644 --- a/src/main/java/com/example/jieyue/common/entity/SysCart.java +++ b/src/main/java/com/example/jieyue/common/entity/SysCart.java @@ -1,40 +1,20 @@ package com.example.jieyue.common.entity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *数据库表的映射类
+ * @author Bosen + * @date 2021/8/9 22:46 + */ +@AllArgsConstructor +@NoArgsConstructor +@Data public class SysCart { private int id; private int goodsId; private int userId; private int goodsNum; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getGoodsId() { - return goodsId; - } - - public void setGoodsId(int goodsId) { - this.goodsId = goodsId; - } - - public int getUserId() { - return userId; - } - - public void setUserId(int userId) { - this.userId = userId; - } - - public int getGoodsNum() { - return goodsNum; - } - - public void setGoodsNum(int goodsNum) { - this.goodsNum = goodsNum; - } } diff --git a/src/main/java/com/example/jieyue/common/entity/SysComment.java b/src/main/java/com/example/jieyue/common/entity/SysComment.java index 0a3cb0d..0dfc265 100644 --- a/src/main/java/com/example/jieyue/common/entity/SysComment.java +++ b/src/main/java/com/example/jieyue/common/entity/SysComment.java @@ -1,5 +1,17 @@ package com.example.jieyue.common.entity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *数据库表的映射类
+ * @author Bosen + * @date 2021/8/9 22:46 + */ +@AllArgsConstructor +@NoArgsConstructor +@Data public class SysComment { private int id; private int user; @@ -7,52 +19,4 @@ public class SysComment { private int merchant; private String context; private long createTime; - - public int getMerchant() { - return merchant; - } - - public void setMerchant(int merchant) { - this.merchant = merchant; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getUser() { - return user; - } - - public void setUser(int user) { - this.user = user; - } - - public int getGoods() { - return goods; - } - - public void setGoods(int goods) { - this.goods = goods; - } - - public String getContext() { - return context; - } - - public void setContext(String context) { - this.context = context; - } - - public long getCreateTime() { - return createTime; - } - - public void setCreateTime(long createTime) { - this.createTime = createTime; - } } diff --git a/src/main/java/com/example/jieyue/common/entity/SysGoods.java b/src/main/java/com/example/jieyue/common/entity/SysGoods.java index 31bf0e3..206bd44 100644 --- a/src/main/java/com/example/jieyue/common/entity/SysGoods.java +++ b/src/main/java/com/example/jieyue/common/entity/SysGoods.java @@ -1,7 +1,19 @@ package com.example.jieyue.common.entity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + import java.math.BigDecimal; +/** + *数据库表的映射类
+ * @author Bosen + * @date 2021/8/9 22:46 + */ +@AllArgsConstructor +@NoArgsConstructor +@Data public class SysGoods { private int id; private String name; @@ -11,81 +23,4 @@ public class SysGoods { private int state; private int merchant; private int stock; - - @Override - public String toString() { - return "SysGoods{" + - "id=" + id + - ", name='" + name + '\'' + - ", describe='" + describe + '\'' + - ", img='" + img + '\'' + - ", price=" + price + - ", state=" + state + - ", merchant=" + merchant + - '}'; - } - - public int getStock() { - return stock; - } - - public void setStock(int stock) { - this.stock = stock; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescribe() { - return describe; - } - - public void setDescribe(String describe) { - this.describe = describe; - } - - public String getImg() { - return img; - } - - public void setImg(String img) { - this.img = img; - } - - public BigDecimal getPrice() { - return price; - } - - public void setPrice(BigDecimal price) { - this.price = price; - } - - public int getState() { - return state; - } - - public void setState(int state) { - this.state = state; - } - - public int getMerchant() { - return merchant; - } - - public void setMerchant(int merchant) { - this.merchant = merchant; - } } diff --git a/src/main/java/com/example/jieyue/common/entity/SysMt.java b/src/main/java/com/example/jieyue/common/entity/SysMt.java index a80cc4b..68e6779 100644 --- a/src/main/java/com/example/jieyue/common/entity/SysMt.java +++ b/src/main/java/com/example/jieyue/common/entity/SysMt.java @@ -1,5 +1,17 @@ package com.example.jieyue.common.entity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *数据库表的映射类
+ * @author Bosen + * @date 2021/8/9 22:46 + */ +@AllArgsConstructor +@NoArgsConstructor +@Data public class SysMt { private int id; private String name; @@ -8,60 +20,4 @@ public class SysMt { private float ratio; private int state; private String header; - - public String getHeader() { - return header; - } - - public void setHeader(String header) { - this.header = header; - } - - public int getState() { - return state; - } - - public void setState(int state) { - this.state = state; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public float getRatio() { - return ratio; - } - - public void setRatio(float ratio) { - this.ratio = ratio; - } } diff --git a/src/main/java/com/example/jieyue/common/entity/SysMtUi.java b/src/main/java/com/example/jieyue/common/entity/SysMtUi.java index 2375604..33ef504 100644 --- a/src/main/java/com/example/jieyue/common/entity/SysMtUi.java +++ b/src/main/java/com/example/jieyue/common/entity/SysMtUi.java @@ -1,61 +1,21 @@ package com.example.jieyue.common.entity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *数据库表的映射类
+ * @author Bosen + * @date 2021/8/9 22:46 + */ +@AllArgsConstructor +@NoArgsConstructor +@Data public class SysMtUi { private int id; private String url; private int width; private int height; private int merchant; - - @Override - public String toString() { - return "SysMtUi{" + - "id=" + id + - ", url='" + url + '\'' + - ", width=" + width + - ", height=" + height + - ", merchant=" + merchant + - '}'; - } - - public int getWidth() { - return width; - } - - public void setWidth(int width) { - this.width = width; - } - - public int getHeight() { - return height; - } - - public void setHeight(int height) { - this.height = height; - } - - public int getMerchant() { - return merchant; - } - - public void setMerchant(int merchant) { - this.merchant = merchant; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - } diff --git a/src/main/java/com/example/jieyue/common/entity/SysNotice.java b/src/main/java/com/example/jieyue/common/entity/SysNotice.java index deb030a..6e41e4e 100644 --- a/src/main/java/com/example/jieyue/common/entity/SysNotice.java +++ b/src/main/java/com/example/jieyue/common/entity/SysNotice.java @@ -6,6 +6,11 @@ import lombok.NoArgsConstructor; import java.io.Serializable; +/** + *数据库表的映射类
+ * @author Bosen + * @date 2021/8/9 22:46 + */ @AllArgsConstructor @NoArgsConstructor @Data @@ -16,52 +21,4 @@ public class SysNotice implements Serializable { private String context; private int receive; private long createTime; - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getContext() { - return context; - } - - public void setContext(String context) { - this.context = context; - } - - public int getReceive() { - return receive; - } - - public void setReceive(int receive) { - this.receive = receive; - } - - public long getCreateTime() { - return createTime; - } - - public void setCreateTime(long createTime) { - this.createTime = createTime; - } } diff --git a/src/main/java/com/example/jieyue/common/entity/SysOrder.java b/src/main/java/com/example/jieyue/common/entity/SysOrder.java index 0785d06..2a973a4 100644 --- a/src/main/java/com/example/jieyue/common/entity/SysOrder.java +++ b/src/main/java/com/example/jieyue/common/entity/SysOrder.java @@ -1,7 +1,19 @@ package com.example.jieyue.common.entity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + import java.math.BigDecimal; +/** + *数据库表的映射类
+ * @author Bosen + * @date 2021/8/9 22:46 + */ +@AllArgsConstructor +@NoArgsConstructor +@Data public class SysOrder { private int id; private String orderId; @@ -22,166 +34,5 @@ public class SysOrder { private String payCodeUrl; private int cartId; private float merchantRatio; - - public float getMerchantRatio() { - return merchantRatio; - } - - public void setMerchantRatio(float merchantRatio) { - this.merchantRatio = merchantRatio; - } - - public int getCartId() { - return cartId; - } - - public void setCartId(int cartId) { - this.cartId = cartId; - } - - public String getPayCodeUrl() { - return payCodeUrl; - } - - public void setPayCodeUrl(String payCodeUrl) { - this.payCodeUrl = payCodeUrl; - } - - public int getPayWay() { - return payWay; - } - - public void setPayWay(int payWay) { - this.payWay = payWay; - } - - public String getCouponCode() { - return couponCode; - } - - public void setCouponCode(String couponCode) { - this.couponCode = couponCode; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getOrderId() { - return orderId; - } - - public void setOrderId(String orderId) { - this.orderId = orderId; - } - - public long getCreateTime() { - return createTime; - } - - public void setCreateTime(long createTime) { - this.createTime = createTime; - } - - public long getPayTime() { - return payTime; - } - - public void setPayTime(long payTime) { - this.payTime = payTime; - } - - public int getGoodsNum() { - return goodsNum; - } - - public void setGoodsNum(int goodsNum) { - this.goodsNum = goodsNum; - } - - public int getOrderState() { - return orderState; - } - - public void setOrderState(int orderState) { - this.orderState = orderState; - } - - public String getOrderMark() { - return orderMark; - } - - public void setOrderMark(String orderMark) { - this.orderMark = orderMark; - } - - public int getOrderMerchant() { - return orderMerchant; - } - - public void setOrderMerchant(int orderMerchant) { - this.orderMerchant = orderMerchant; - } - - public int getOrderUser() { - return orderUser; - } - - public void setOrderUser(int orderUser) { - this.orderUser = orderUser; - } - - public int getGoodsId() { - return goodsId; - } - - public void setGoodsId(int goodsId) { - this.goodsId = goodsId; - } - - public BigDecimal getOrderPrice() { - return orderPrice; - } - - public void setOrderPrice(BigDecimal orderPrice) { - this.orderPrice = orderPrice; - } - - public String getOrderNotes() { - return orderNotes; - } - - public void setOrderNotes(String orderNotes) { - this.orderNotes = orderNotes; - } - - public String getUserAddress() { - return userAddress; - } - - public void setUserAddress(String userAddress) { - this.userAddress = userAddress; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getUserPhone() { - return userPhone; - } - - public void setUserPhone(String userPhone) { - this.userPhone = userPhone; - } - private String userPhone; } \ No newline at end of file diff --git a/src/main/java/com/example/jieyue/common/entity/SysRole.java b/src/main/java/com/example/jieyue/common/entity/SysRole.java index c2f0d13..896ca37 100644 --- a/src/main/java/com/example/jieyue/common/entity/SysRole.java +++ b/src/main/java/com/example/jieyue/common/entity/SysRole.java @@ -1,31 +1,19 @@ package com.example.jieyue.common.entity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *数据库表的映射类
+ * @author Bosen + * @date 2021/8/9 22:46 + */ +@AllArgsConstructor +@NoArgsConstructor +@Data public class SysRole { private int id; private String name; private int status; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } } diff --git a/src/main/java/com/example/jieyue/common/entity/SysRoleAccess.java b/src/main/java/com/example/jieyue/common/entity/SysRoleAccess.java index d97fa8b..1e25851 100644 --- a/src/main/java/com/example/jieyue/common/entity/SysRoleAccess.java +++ b/src/main/java/com/example/jieyue/common/entity/SysRoleAccess.java @@ -1,40 +1,20 @@ package com.example.jieyue.common.entity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *数据库表的映射类
+ * @author Bosen + * @date 2021/8/9 22:46 + */ +@AllArgsConstructor +@NoArgsConstructor +@Data public class SysRoleAccess { private int id; private int roleId; private int accessId; private int status; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public int getRoleId() { - return roleId; - } - - public void setRoleId(int roleId) { - this.roleId = roleId; - } - - public int getAccessId() { - return accessId; - } - - public void setAccessId(int accessId) { - this.accessId = accessId; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } } diff --git a/src/main/java/com/example/jieyue/common/entity/SysUi.java b/src/main/java/com/example/jieyue/common/entity/SysUi.java index 0c40031..97ef61d 100644 --- a/src/main/java/com/example/jieyue/common/entity/SysUi.java +++ b/src/main/java/com/example/jieyue/common/entity/SysUi.java @@ -1,35 +1,20 @@ package com.example.jieyue.common.entity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *数据库表的映射类
+ * @author Bosen + * @date 2021/8/9 22:46 + */ +@AllArgsConstructor +@NoArgsConstructor +@Data public class SysUi { private int id; private String url; private int width; private int height; - - @Override - public String toString() { - return "SysUi{" + - "id=" + id + - ", url='" + url + '\'' + - ", width=" + width + - ", height=" + height + - '}'; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - } diff --git a/src/main/java/com/example/jieyue/common/entity/SysUser.java b/src/main/java/com/example/jieyue/common/entity/SysUser.java index fcb8439..935f178 100644 --- a/src/main/java/com/example/jieyue/common/entity/SysUser.java +++ b/src/main/java/com/example/jieyue/common/entity/SysUser.java @@ -1,5 +1,17 @@ package com.example.jieyue.common.entity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + *数据库表的映射类
+ * @author Bosen + * @date 2021/8/9 22:46 + */ +@AllArgsConstructor +@NoArgsConstructor +@Data public class SysUser { private int id; private String username; @@ -7,64 +19,4 @@ public class SysUser { private String email; private int mark; private String header; - - @Override - public String toString() { - return "SysUser{" + - "id=" + id + - ", username='" + username + '\'' + - ", password='" + password + '\'' + - ", email='" + email + '\'' + - ", mark=" + mark + - ", header='" + header + '\'' + - '}'; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public int getMark() { - return mark; - } - - public void setMark(int mark) { - this.mark = mark; - } - - public String getHeader() { - return header; - } - - public void setHeader(String header) { - this.header = header; - } } diff --git a/src/main/java/com/example/jieyue/common/mapper/SysAdminMapper.java b/src/main/java/com/example/jieyue/common/mapper/SysAdminMapper.java index 92894aa..be9739d 100644 --- a/src/main/java/com/example/jieyue/common/mapper/SysAdminMapper.java +++ b/src/main/java/com/example/jieyue/common/mapper/SysAdminMapper.java @@ -9,12 +9,19 @@ import java.util.List; @Repository public interface SysAdminMapper { ListSpring Boot 提供了一个发送邮件的简单抽象,使用的是下面这个接口,这里直接注入即可使用
*/ @Autowired private JavaMailSender mailSender; /** - * 配置文件中我的qq邮箱 + *配置文件中我的qq邮箱
*/ @Value("${spring.mail.from}") private String from; /** - * 简单文本邮件 + *简单文本邮件
* @param to 收件人 * @param subject 主题 * @param content 内容 @@ -54,7 +54,7 @@ public class MailService { } /** - * html邮件 + *html邮件
* @param to 收件人 * @param subject 主题 * @param content 内容 @@ -85,7 +85,7 @@ public class MailService { } /** - * 带附件的邮件 + *带附件的邮件
* @param to 收件人 * @param subject 主题 * @param content 内容 @@ -111,8 +111,8 @@ public class MailService { } } - /* - * 邮箱格式验证 + /** + *邮箱格式验证
*/ public boolean checkEmail(String email){ String check = "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$"; diff --git a/src/main/java/com/example/jieyue/common/service/SysUserService.java b/src/main/java/com/example/jieyue/common/service/SysUserService.java index 6dfc0a3..c72163e 100644 --- a/src/main/java/com/example/jieyue/common/service/SysUserService.java +++ b/src/main/java/com/example/jieyue/common/service/SysUserService.java @@ -7,6 +7,10 @@ import org.springframework.stereotype.Service; import java.util.List; +/** + * @author Bosen + * @date 2021/8/9 22:51 + */ @Service public class SysUserService { @Autowired diff --git a/src/main/java/com/example/jieyue/common/task/SchedulerTask.java b/src/main/java/com/example/jieyue/common/task/SchedulerTask.java index 1b3ec92..942d665 100644 --- a/src/main/java/com/example/jieyue/common/task/SchedulerTask.java +++ b/src/main/java/com/example/jieyue/common/task/SchedulerTask.java @@ -37,8 +37,8 @@ public class SchedulerTask { @Autowired MailService mailService; - /* - * 每分钟执行一次,检查是否有过期的订单,若过期将其删除,并恢复库存 + /** + *每分钟执行一次,检查是否有过期的订单,若过期将其删除,并恢复库存
*/ @Scheduled(cron="0 0/1 * * * ?") @Transactional @@ -57,8 +57,8 @@ public class SchedulerTask { } } - /* - * 每分钟执行一次,对已创建了两小时订单的二维码进行删除 + /** + *每分钟执行一次,对已创建了两小时订单的二维码进行删除
*/ @Scheduled(cron="0 0/1 * * * ?") public void delQRCode(){ @@ -71,8 +71,8 @@ public class SchedulerTask { } } - /* - * 每分钟执行一次,对消息队列的消息执行发送 + /** + *每分钟执行一次,对redis消息队列的消息执行发送
*/ @Scheduled(cron="0 0/1 * * * ?") public void sendNotice(){ @@ -93,12 +93,14 @@ public class SchedulerTask { case 2: noticeMapper.insert(title,context,type,receive,createTime); break; + default: + break; } } } - /* - * 每分钟执行一次,邮箱发送队列的执行发送 + /** + *每分钟执行一次,邮箱发送队列的执行发送
*/ @Scheduled(cron="0 0/1 * * * ?") public void sendEmail(){ @@ -107,5 +109,4 @@ public class SchedulerTask { mailService.sendHtmlMail(map.get("email"),map.get("title"),map.get("context")); } } - } diff --git a/src/main/java/com/example/jieyue/common/utils/DateUtil.java b/src/main/java/com/example/jieyue/common/utils/DateUtil.java index b1430a1..d9d9e99 100644 --- a/src/main/java/com/example/jieyue/common/utils/DateUtil.java +++ b/src/main/java/com/example/jieyue/common/utils/DateUtil.java @@ -12,8 +12,8 @@ import java.util.Date; */ @Component public class DateUtil { - /* - * 获取纯年月日时分秒的字符串 + /** + *获取纯年月日时分秒的字符串
*/ public String getNMDHIS(){ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); diff --git a/src/main/java/com/example/jieyue/common/utils/FileUtil.java b/src/main/java/com/example/jieyue/common/utils/FileUtil.java index 668efb7..5e4e5d5 100644 --- a/src/main/java/com/example/jieyue/common/utils/FileUtil.java +++ b/src/main/java/com/example/jieyue/common/utils/FileUtil.java @@ -25,8 +25,7 @@ public class FileUtil { } /** - * 文件上传逻辑处理 - * + *文件上传逻辑处理
* @return * null 上传失败 * 文件名 上传成功 @@ -59,8 +58,8 @@ public class FileUtil { return url+filename+"."+suffix; } - /* - * 获取文件后缀名 + /** + *获取文件后缀名
*/ public String getSuffixName(String filename){ String[] strArray = filename.split("\\."); @@ -68,8 +67,8 @@ public class FileUtil { return strArray[suffixIndex]; } - /* - * 删除文件 + /** + *删除文件
*/ public void deleteFile(String url){ File file1 = new File(classpath+url); diff --git a/src/main/java/com/example/jieyue/common/utils/IsEmptyUtil.java b/src/main/java/com/example/jieyue/common/utils/IsEmptyUtil.java index be8c18d..a0d208b 100644 --- a/src/main/java/com/example/jieyue/common/utils/IsEmptyUtil.java +++ b/src/main/java/com/example/jieyue/common/utils/IsEmptyUtil.java @@ -9,8 +9,9 @@ import org.springframework.stereotype.Component; */ @Component public class IsEmptyUtil { - /* - * 单例模式 + + /** + *单例模式
*/ private static class IsEmptyUtilHoler{ private static IsEmptyUtil INSTANCE = new IsEmptyUtil(); @@ -20,8 +21,8 @@ public class IsEmptyUtil { return IsEmptyUtilHoler.INSTANCE; } - /* - * 多个字符串判空操作,当存在有空字符时返回true + /** + *多个字符串判空操作,当存在有空字符时返回true
*/ public boolean strings(String ... strings){ for (String string : strings) { @@ -32,8 +33,8 @@ public class IsEmptyUtil { return false; } - /* - * 单个字符串判空操作 + /** + *单个字符串判空操作
*/ public boolean string(String string){ if (string==null || string.equals("")){ @@ -43,8 +44,8 @@ public class IsEmptyUtil { } } - /* - * 单个对象判空操作 + /** + *单个对象判空操作
*/ public boolean object(Object object){ if (object==null){ @@ -54,8 +55,8 @@ public class IsEmptyUtil { } } - /* - * 多个对象判空操作,当存在有null对象时返回true + /** + *多个对象判空操作,当存在有null对象时返回true
*/ public boolean objects(Object ... objects){ for (Object object : objects) { diff --git a/src/main/java/com/example/jieyue/common/utils/JsonUtil.java b/src/main/java/com/example/jieyue/common/utils/JsonUtil.java index 51df419..fb56850 100644 --- a/src/main/java/com/example/jieyue/common/utils/JsonUtil.java +++ b/src/main/java/com/example/jieyue/common/utils/JsonUtil.java @@ -6,9 +6,9 @@ import org.springframework.stereotype.Component; @Component public class JsonUtil { + /** * 字符串转整数型数组 - * todo */ public int[] jsonToIntArray(String json){ JSONArray jsonArray = JSON.parseArray(json); diff --git a/src/main/java/com/example/jieyue/merchant/controller/MerchantGoodsController.java b/src/main/java/com/example/jieyue/merchant/controller/MerchantGoodsController.java index 81bfed9..cf37c66 100644 --- a/src/main/java/com/example/jieyue/merchant/controller/MerchantGoodsController.java +++ b/src/main/java/com/example/jieyue/merchant/controller/MerchantGoodsController.java @@ -2,7 +2,6 @@ package com.example.jieyue.merchant.controller; import com.example.jieyue.common.entity.SysGoods; import com.example.jieyue.common.entity.SysMt; -import com.example.jieyue.common.mapper.SysGoodsMapper; import com.example.jieyue.merchant.service.MerchantGoodsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; @@ -27,8 +26,8 @@ public class MerchantGoodsController { @Autowired MerchantGoodsService goodsService; - /* - * 商品管理页面 + /** + *商品管理页面
*/ @RequestMapping("/merchant/goods") public ModelAndView index(ModelAndView modelAndView, HttpSession session, @RequestParam(defaultValue = "1")int page){ @@ -44,8 +43,8 @@ public class MerchantGoodsController { return modelAndView; } - /* - * 增加商品 + /** + *增加商品
*/ @RequestMapping("/merchant/add-goods") public ModelAndView addGoods(ModelAndView modelAndView, String name, String describe, @@ -82,13 +81,15 @@ public class MerchantGoodsController { case 2: modelAndView.addObject("msg","必填信息不能为空"); break; + default: + break; } modelAndView.setViewName("redirect:goods"); return modelAndView; } - /* - * 通过id值删除商品 + /** + *通过id值删除商品
*/ @RequestMapping("/merchant/del-goods") public ModelAndView delGoods(ModelAndView modelAndView,int id){ @@ -102,8 +103,8 @@ public class MerchantGoodsController { return modelAndView; } - /* - * 上架商品 + /** + *上架商品
*/ @RequestMapping("/merchant/put-goods") public ModelAndView putGoods(ModelAndView modelAndView,int id){ @@ -116,8 +117,8 @@ public class MerchantGoodsController { return modelAndView; } - /* - * 下架商品 + /** + *下架商品
*/ @RequestMapping("/merchant/off-goods") public ModelAndView OffGoods(ModelAndView modelAndView,int id){ @@ -130,8 +131,8 @@ public class MerchantGoodsController { return modelAndView; } - /* - * 修改商品信息 + /** + *修改商品信息
*/ @RequestMapping("/merchant/update-goods") public ModelAndView updateGoods(ModelAndView modelAndView, String name, String describe, @@ -152,7 +153,6 @@ public class MerchantGoodsController { modelAndView.setViewName("redirect:goods"); return modelAndView; } - // 修改商品信息 int res = goodsService.updateGoods(name, describe,priceRes,img,redirectAttributes,stockTemp,request,id); switch (res){ @@ -168,8 +168,9 @@ public class MerchantGoodsController { case 2: modelAndView.addObject("msg","必填信息不能为空"); break; + default: + break; } - modelAndView.setViewName("redirect:goods"); return modelAndView; } diff --git a/src/main/java/com/example/jieyue/merchant/controller/MerchantLoginController.java b/src/main/java/com/example/jieyue/merchant/controller/MerchantLoginController.java index d2c0110..223e709 100644 --- a/src/main/java/com/example/jieyue/merchant/controller/MerchantLoginController.java +++ b/src/main/java/com/example/jieyue/merchant/controller/MerchantLoginController.java @@ -28,8 +28,8 @@ public class MerchantLoginController { return modelAndView; } - /* - * 登录 + /** + *登录
*/ @RequestMapping("do-login") public ModelAndView doLogin(ModelAndView modelAndView, String email, String password, HttpSession session){ @@ -52,13 +52,15 @@ public class MerchantLoginController { } session.setAttribute("merchant",merchant); break; + default: + break; } modelAndView.setViewName("redirect:/merchant/home"); return modelAndView; } - /* - * 退出登录 + /** + *退出登录
*/ @RequestMapping("logout") public ModelAndView logout(ModelAndView modelAndView,HttpServletRequest request){ @@ -67,8 +69,8 @@ public class MerchantLoginController { return modelAndView; } - /* - * 注册 + /** + *注册
*/ @RequestMapping("sign-up") public String signUp(String email,String name,String password){ @@ -84,12 +86,14 @@ public class MerchantLoginController { return "该邮箱已被注册"; case 3: return "邮箱格式不正确"; + default: + break; } return null; } - /* - * 邮箱验证 + /** + *邮箱验证
*/ @RequestMapping("sign-check") public ModelAndView singCheck(ModelAndView modelAndView,String email){ @@ -106,6 +110,8 @@ public class MerchantLoginController { modelAndView.setViewName("redirect:/merchant/login"); modelAndView.addObject("msg","注册成功,请等待管理员的审核"); break; + default: + break; } return modelAndView; } diff --git a/src/main/java/com/example/jieyue/merchant/controller/MerchantUiController.java b/src/main/java/com/example/jieyue/merchant/controller/MerchantUiController.java index ae38b8f..1e9b007 100644 --- a/src/main/java/com/example/jieyue/merchant/controller/MerchantUiController.java +++ b/src/main/java/com/example/jieyue/merchant/controller/MerchantUiController.java @@ -1,6 +1,5 @@ package com.example.jieyue.merchant.controller; -import com.example.jieyue.common.entity.SysMt; import com.example.jieyue.common.entity.SysMtUi; import com.example.jieyue.merchant.service.MerchantUiService; import org.springframework.beans.factory.annotation.Autowired; @@ -34,8 +33,8 @@ public class MerchantUiController { return modelAndView; } - /* - * 删除 + /** + *删除
*/ @RequestMapping("/merchant/del-home-img") public ModelAndView delHomeImg(ModelAndView modelAndView,int id){ @@ -47,13 +46,15 @@ public class MerchantUiController { case 0: modelAndView.addObject("msg","图片删除失败"); break; + default: + break; } modelAndView.setViewName("redirect:ui"); return modelAndView; } - /* - * 修改或添加商户在商城主页的宣传海报 + /** + *修改或添加商户在商城主页的宣传海报
*/ @RequestMapping("/merchant/update-home-img") public ModelAndView updateHomeImg(ModelAndView modelAndView, HttpServletRequest request, MultipartFile img, RedirectAttributes redirectAttributes,int width,int height){ @@ -66,13 +67,15 @@ public class MerchantUiController { case 0: modelAndView.addObject("msg","图片修改失败"); break; + default: + break; } modelAndView.setViewName("redirect:ui"); return modelAndView; } - /* - * 修改用户头像 + /** + *修改用户头像
*/ @RequestMapping("/merchant/update-header") public ModelAndView updateHeader(RedirectAttributes redirectAttributes,HttpServletRequest request,ModelAndView modelAndView,MultipartFile img){ diff --git a/src/main/java/com/example/jieyue/merchant/service/MerchantGoodsService.java b/src/main/java/com/example/jieyue/merchant/service/MerchantGoodsService.java index c01f0a4..c1ee4e1 100644 --- a/src/main/java/com/example/jieyue/merchant/service/MerchantGoodsService.java +++ b/src/main/java/com/example/jieyue/merchant/service/MerchantGoodsService.java @@ -27,25 +27,25 @@ public class MerchantGoodsService { FileUtil fileUtil; @Autowired DateUtil dateUtil; - + @Autowired IsEmptyUtil isEmptyUtil = new IsEmptyUtil(); - /* - * 获取全部商品 + /** + *获取全部商品
*/ public List通过id获取商品
*/ public SysGoods getGoodsById(int id){ return goodsMapper.findById(id); } - /* - * 获取当前商户的商品列表 + /** + *获取当前商户的商品列表
*/ public List添加商品
- * * @return *-1 图片上传失败 * 0 sql语句执行失败 @@ -106,7 +105,6 @@ public class MerchantGoodsService { /** *通过id值删除商品逻辑处理
- * * @return *-1 删除失败 * 1 删除成功 @@ -128,22 +126,22 @@ public class MerchantGoodsService { } } - /* - * 获取总页数 + /** + *获取总页数
*/ public int getAllPage(int num,SysMt merchant){ return (int)Math.ceil((double)goodsMapper.goodsCount(merchant.getId())/(double)num); } - /* - * 上架商品 + /** + *上架商品
*/ public boolean putGoods(int goodId){ return goodsMapper.updateState(goodId, 1) == 1; } - /* - * 下架商品 + /** + *下架商品
*/ public boolean OffGoods(int goodId){ return goodsMapper.updateState(goodId, 0) == 1; @@ -151,7 +149,6 @@ public class MerchantGoodsService { /** *修改商品信息
- * * @return *-1 图片上传失败 * 0 sql语句执行失败 diff --git a/src/main/java/com/example/jieyue/merchant/service/MerchantLoginService.java b/src/main/java/com/example/jieyue/merchant/service/MerchantLoginService.java index 0e9f0e6..8f5a648 100644 --- a/src/main/java/com/example/jieyue/merchant/service/MerchantLoginService.java +++ b/src/main/java/com/example/jieyue/merchant/service/MerchantLoginService.java @@ -21,7 +21,7 @@ public class MerchantLoginService { String sitrUrl; /** - * 登录逻辑处理 + *登录逻辑处理
* @return * 0 必填信息不能为空 *-1 邮箱或密码错误 @@ -46,7 +46,7 @@ public class MerchantLoginService { } /** - * 注册逻辑处理 + *注册逻辑处理
* @return * 0 必填信息不能为空 *-1 验证邮件发送失败,请重试 @@ -92,7 +92,7 @@ public class MerchantLoginService { } /** - * 验证邮件确认注册 + *验证邮件确认注册
* @return int *-1 404页面 * 0 网络超时请重试 @@ -112,8 +112,8 @@ public class MerchantLoginService { } } - /* - * 获取商户信息 + /** + *获取商户信息
*/ public SysMt getMerchantInfo(String email){ return mtMapper.findByEmail(email); diff --git a/src/main/java/com/example/jieyue/merchant/service/MerchantOrderService.java b/src/main/java/com/example/jieyue/merchant/service/MerchantOrderService.java index a120303..516b374 100644 --- a/src/main/java/com/example/jieyue/merchant/service/MerchantOrderService.java +++ b/src/main/java/com/example/jieyue/merchant/service/MerchantOrderService.java @@ -13,8 +13,8 @@ public class MerchantOrderService { @Autowired SysOrderMapper orderMapper; - /* - * 获取订单信息 + /** + *获取订单信息
*/ public List获取总页数
*/ public int getAllPage(int merchantId,int flag,int num){ switch (flag){ @@ -43,8 +43,8 @@ public class MerchantOrderService { return 1; } - /* - * 通过订单号查找 + /** + *通过订单号查找
*/ public List获取当前商户的id值
- * * @return * -1 无用户的session信息 */ @@ -39,15 +38,15 @@ public class MerchantUiService { return mtUi.getId(); } - /* - * 获取商户用于商城首页宣传的海报图片对象 + /** + *获取商户用于商城首页宣传的海报图片对象
*/ public SysMtUi getHomeImg(int width,int height,HttpSession session){ return mtUiMapper.findByMark(width,height,getMtId(session)); } - /* - * 删除 + /** + *删除
*/ public int delHomeImg(int id){ String url = mtUiMapper.findById(id).getUrl(); @@ -60,8 +59,8 @@ public class MerchantUiService { } } - /* - * 商户商城首页的宣传海报 + /** + *商户商城首页的宣传海报
*/ public int updateHomeImg(int width, int height, HttpSession session, MultipartFile img,RedirectAttributes redirectAttributes, HttpServletRequest request){ @@ -93,15 +92,15 @@ public class MerchantUiService { } } - /* - * 增加商户商城首页的宣传海报 + /** + *增加商户商城首页的宣传海报
*/ public int addHomeImg(String url,int width, int height,int id){ return mtUiMapper.insert(url,width,height,id); } - /* - * 修改商户头像 + /** + *修改商户头像
*/ public int updateHeard(RedirectAttributes redirectAttributes,HttpServletRequest request, MultipartFile img){ // 获取商户信息 diff --git a/src/main/java/com/example/jieyue/merchant/service/MerchantUserService.java b/src/main/java/com/example/jieyue/merchant/service/MerchantUserService.java index d7a0c6b..90d2bbb 100644 --- a/src/main/java/com/example/jieyue/merchant/service/MerchantUserService.java +++ b/src/main/java/com/example/jieyue/merchant/service/MerchantUserService.java @@ -12,15 +12,15 @@ public class MerchantUserService { @Autowired SysUserMapper userMapper; - /* - * 获取用户信息 + /** + *获取用户信息
*/ public List获取总页数
*/ public int getAllPage(int num){ return (int)Math.ceil((double)userMapper.userCount()/(double)num); diff --git a/src/main/java/com/example/jieyue/user/controller/UserCartController.java b/src/main/java/com/example/jieyue/user/controller/UserCartController.java index e91b54a..4aba730 100644 --- a/src/main/java/com/example/jieyue/user/controller/UserCartController.java +++ b/src/main/java/com/example/jieyue/user/controller/UserCartController.java @@ -33,8 +33,8 @@ public class UserCartController { return modelAndView; } - /* - * 添加至购物车 + /** + *添加至购物车
*/ @RequestMapping("/user/add-cart") public ModelAndView addCart(ModelAndView modelAndView, String id, @RequestParam(defaultValue = "1") int num, HttpServletRequest request){ @@ -56,8 +56,8 @@ public class UserCartController { return modelAndView; } - /* - * 移除购物车商品 + /** + *移除购物车商品
*/ @RequestMapping("/user/del-cart") public ModelAndView delCart(ModelAndView modelAndView,int id){ diff --git a/src/main/java/com/example/jieyue/user/controller/UserInfoController.java b/src/main/java/com/example/jieyue/user/controller/UserInfoController.java index 5f5eafc..15a746e 100644 --- a/src/main/java/com/example/jieyue/user/controller/UserInfoController.java +++ b/src/main/java/com/example/jieyue/user/controller/UserInfoController.java @@ -51,6 +51,8 @@ public class UserInfoController { case 4: modelAndView.addObject("msg","两次输入的密码不一致"); break; + default: + break; } modelAndView.setViewName("redirect:/user/info"); return modelAndView; diff --git a/src/main/java/com/example/jieyue/user/controller/UserLoginController.java b/src/main/java/com/example/jieyue/user/controller/UserLoginController.java index f995681..47be45a 100644 --- a/src/main/java/com/example/jieyue/user/controller/UserLoginController.java +++ b/src/main/java/com/example/jieyue/user/controller/UserLoginController.java @@ -22,8 +22,9 @@ import javax.servlet.http.HttpSession; public class UserLoginController { @Autowired private UserLoginService service; - /* - * 登陆页面 + + /** + *登陆页面
*/ @RequestMapping("login") public ModelAndView index(ModelAndView modelAndView){ @@ -31,8 +32,8 @@ public class UserLoginController { return modelAndView; } - /* - * 退出登陆 + /** + *退出登陆
*/ @RequestMapping("logout") public ModelAndView logout(ModelAndView modelAndView,HttpServletRequest request){ @@ -41,8 +42,8 @@ public class UserLoginController { return modelAndView; } - /* - * 登陆请求 + /** + *登陆请求
*/ @RequestMapping("do-login") public ModelAndView doLogin(HttpSession session, ModelAndView modelAndView, String email, String password){ @@ -64,8 +65,8 @@ public class UserLoginController { return modelAndView; } - /* - * 注册请求 + /** + *注册请求
*/ @RequestMapping("sign-up") public String signUp(String email,String username,String password,String repwd){ @@ -91,8 +92,8 @@ public class UserLoginController { return "网络出现错误!!"; } - /* - * 验证邮件确认注册 + /** + *验证邮件确认注册
*/ @RequestMapping("sign-check") public ModelAndView singCheck(ModelAndView modelAndView,@Param("email") String email){ diff --git a/src/main/java/com/example/jieyue/user/controller/UserNoticeController.java b/src/main/java/com/example/jieyue/user/controller/UserNoticeController.java index 61e44b6..8d8500e 100644 --- a/src/main/java/com/example/jieyue/user/controller/UserNoticeController.java +++ b/src/main/java/com/example/jieyue/user/controller/UserNoticeController.java @@ -29,8 +29,8 @@ public class UserNoticeController { return modelAndView; } - /* - * 删除通知信息 + /** + *删除通知信息
*/ @RequestMapping("/user/del-notice") public ModelAndView delNotice(ModelAndView modelAndView,int id){ diff --git a/src/main/java/com/example/jieyue/user/controller/UserPayController.java b/src/main/java/com/example/jieyue/user/controller/UserPayController.java index 06acf88..c0f46f2 100644 --- a/src/main/java/com/example/jieyue/user/controller/UserPayController.java +++ b/src/main/java/com/example/jieyue/user/controller/UserPayController.java @@ -24,8 +24,8 @@ public class UserPayController { @Autowired SysOrderMapper orderMapper; - /* - * 微信支付 + /** + *微信支付
*/ @RequestMapping("/user/pay/wx") public ModelAndView wx(ModelAndView modelAndView, String nums, String users, String merchants, String goods, String prices, @@ -51,8 +51,8 @@ public class UserPayController { return wxPayService.wxNotify(request); } - /* - * 检查订单状态 + /** + *检查订单状态
*/ @RequestMapping("/user/check-order-status") public boolean checkOrderStatus(String orderMark){ @@ -69,8 +69,8 @@ public class UserPayController { } } - /* - * 订单未支付,重新显示二维码给用户支付 + /** + *订单未支付,重新显示二维码给用户支付
*/ @RequestMapping("/user/wxpay/index") public ModelAndView wxNotify(ModelAndView modelAndView,String mark) { @@ -83,42 +83,41 @@ public class UserPayController { return modelAndView; } - /* - * 订单并发安全测试 - */ - @Autowired - SysGoodsMapper goodsMapper; - @Autowired - SysMtMapper merchantMapper; - @RequestMapping("/user/pay/test") - @Transactional - public String test() { - // 用于测试商品的id值 - int goodsId = 44; - SysGoods goods = goodsMapper.findById(goodsId); - if (goods.getStock() > 0){ - // 生成orderMark - String orderMark = wxPayService.getOrderId(); - // 生成订单号 - String orderId = wxPayService.getOrderId(); - // 获取商户信息 - SysMt merchant = merchantMapper.findById(goods.getMerchant()); - // 执行sql语句 - int sql = orderMapper.insert1(orderId, System.currentTimeMillis(), 1, orderMark, 99, - goods.getMerchant(), goods.getPrice(), goodsId, "test", "test", - "test", "123456", "test", 0,merchant.getRatio()); - - // 将商品库存做相应的减少 - int delStock = goodsMapper.delStock(goodsId,1); - - // 库存检查,库存少于零时回滚 - if (sql != 1 || delStock != 1 || goodsMapper.findById(goodsId).getStock() < 0){ - TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); - } - - return "SUCCESS This is /user/pay/test"; - } - return "ERROR This is /user/pay/test"; - - } +// /** +// *订单并发安全测试
+// */ +// @Autowired +// SysGoodsMapper goodsMapper; +// @Autowired +// SysMtMapper merchantMapper; +// @RequestMapping("/user/pay/test") +// @Transactional +// public String test() { +// // 用于测试商品的id值 +// int goodsId = 44; +// SysGoods goods = goodsMapper.findById(goodsId); +// if (goods.getStock() > 0){ +// // 生成orderMark +// String orderMark = wxPayService.getOrderId(); +// // 生成订单号 +// String orderId = wxPayService.getOrderId(); +// // 获取商户信息 +// SysMt merchant = merchantMapper.findById(goods.getMerchant()); +// // 执行sql语句 +// int sql = orderMapper.insert1(orderId, System.currentTimeMillis(), 1, orderMark, 99, +// goods.getMerchant(), goods.getPrice(), goodsId, "test", "test", +// "test", "123456", "test", 0,merchant.getRatio()); +// +// // 将商品库存做相应的减少 +// int delStock = goodsMapper.delStock(goodsId,1); +// +// // 库存检查,库存少于零时回滚 +// if (sql != 1 || delStock != 1 || goodsMapper.findById(goodsId).getStock() < 0){ +// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); +// } +// +// return "SUCCESS This is /user/pay/test"; +// } +// return "ERROR This is /user/pay/test"; +// } } diff --git a/src/main/java/com/example/jieyue/user/controller/UserProductController.java b/src/main/java/com/example/jieyue/user/controller/UserProductController.java index 80c2c28..131db24 100644 --- a/src/main/java/com/example/jieyue/user/controller/UserProductController.java +++ b/src/main/java/com/example/jieyue/user/controller/UserProductController.java @@ -1,6 +1,5 @@ package com.example.jieyue.user.controller; -import com.example.jieyue.common.entity.SysComment; import com.example.jieyue.common.entity.SysGoods; import com.example.jieyue.common.mapper.SysCommentMapper; import com.example.jieyue.user.service.UserHomeService; @@ -50,8 +49,8 @@ public class UserProductController { return modelAndView; } - /* - * 添加评论 + /** + *添加评论
*/ @RequestMapping("/user/product/add-comment") public ModelAndView addComment(ModelAndView modelAndView,int goods,int merchant,String context,HttpServletRequest request){ @@ -70,8 +69,8 @@ public class UserProductController { return modelAndView; } - /* - * 删除评论 + /** + *删除评论
*/ @RequestMapping("/user/product/del-comment") public ModelAndView delComment(ModelAndView modelAndView,int id,int goods){ diff --git a/src/main/java/com/example/jieyue/user/controller/UserSearchController.java b/src/main/java/com/example/jieyue/user/controller/UserSearchController.java index 561673a..427a9e2 100644 --- a/src/main/java/com/example/jieyue/user/controller/UserSearchController.java +++ b/src/main/java/com/example/jieyue/user/controller/UserSearchController.java @@ -22,10 +22,13 @@ public class UserSearchController { @RequestMapping("/user/search") public ModelAndView index(ModelAndView modelAndView,String keyword){ - // 获取返回的商品列表 - List店铺首页
*/ @RequestMapping("/user/shop") public ModelAndView index(ModelAndView modelAndView,int id,@RequestParam(defaultValue = "1") int page){ diff --git a/src/main/java/com/example/jieyue/user/service/UserCartService.java b/src/main/java/com/example/jieyue/user/service/UserCartService.java index fb1aea7..5ef3577 100644 --- a/src/main/java/com/example/jieyue/user/service/UserCartService.java +++ b/src/main/java/com/example/jieyue/user/service/UserCartService.java @@ -51,8 +51,8 @@ public class UserCartService { return -1; } - /* - * 整合购物车完整信息 + /** + *整合购物车完整信息
*/ public List