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 mtList = merchantService.getMtInfo(num,pageSize); - if (mtList.size()<=10){ + if (mtList.size() <= 10) { nextNum = num; } modelAndView.addObject("mtList",mtList); @@ -60,14 +63,17 @@ public class AdminMerchantController { return modelAndView; } + /** + *

修改费率

+ */ @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 orderList = orderService.getOrderList(page,18,flag); modelAndView.addObject("orderList",orderList); @@ -37,7 +37,7 @@ public class AdminOrderController { } @RequestMapping("/admin/search-order") - public ModelAndView searchOrder(ModelAndView modelAndView,String order){ + public ModelAndView searchOrder(ModelAndView modelAndView,String order) { // 获取订单信息 List orderList = orderService.getOrderById(order); modelAndView.addObject("orderList",orderList); diff --git a/src/main/java/com/example/jieyue/admin/controller/AdminRbacController.java b/src/main/java/com/example/jieyue/admin/controller/AdminRbacController.java index 8deff0b..f331e3e 100644 --- a/src/main/java/com/example/jieyue/admin/controller/AdminRbacController.java +++ b/src/main/java/com/example/jieyue/admin/controller/AdminRbacController.java @@ -10,11 +10,15 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; -import javax.servlet.http.HttpServletRequest; import java.util.HashMap; import java.util.List; import java.util.Map; +/** + *

后台模块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 map = new HashMap<>(); @@ -73,9 +73,14 @@ public class AdminNoticeService { redisTemplate.opsForList().leftPush("notice",map); } break; + default: + break; } } + /** + *

将要发送的消息存入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 getOrderList(int page,int num,int flag){ switch (flag){ - case 0:// 未支付 + // 未支付 + case 0: return orderMapper.findNotPayLimit((page-1)*num,num); - case 1:// 已支付 + // 已支付 + case 1: return orderMapper.findPayLimit((page-1)*num,num); - case 2:// 全部订单 + // 全部订单 + case 2: return orderMapper.findLimit((page-1)*num,num); + default: + break; } return null; } - /* - * 通过订单号查找 + /** + *

通过订单号查找

*/ public List getOrderById(String orderId){ SysOrder order = orderMapper.findByOrderId(orderId); @@ -40,8 +45,8 @@ public class AdminOrderService { return 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 getUserList(int page, int num){ return userMapper.findLimit((page-1)*num,num); } - /* - * 获取总页数 + /** + *

获取总页数

*/ 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 { List findAll(); + int insert(@Param("name") String name, @Param("password") String password, @Param("email") String email, @Param("mark") int mark); + SysAdmin selectByEmail(String email); + SysAdmin getAdminInfo(String email); + int deleteById(int id); + int updateMark(int mark,String email); + int updateMarkById(int id,int mark); + int update(String name,String password,String email); } diff --git a/src/main/java/com/example/jieyue/common/mapper/SysCommentMapper.java b/src/main/java/com/example/jieyue/common/mapper/SysCommentMapper.java index 346a358..4d1e2ba 100644 --- a/src/main/java/com/example/jieyue/common/mapper/SysCommentMapper.java +++ b/src/main/java/com/example/jieyue/common/mapper/SysCommentMapper.java @@ -9,7 +9,9 @@ import java.util.List; @Repository public interface SysCommentMapper { SysComment findById(int id); + int getAllCountByGoods(int id); + int getAllCountByMt(int merchant); List findByGoodsLimit(int goods,int preNum,int sufNum); diff --git a/src/main/java/com/example/jieyue/common/mapper/SysGoodsMapper.java b/src/main/java/com/example/jieyue/common/mapper/SysGoodsMapper.java index 721766d..d40f968 100644 --- a/src/main/java/com/example/jieyue/common/mapper/SysGoodsMapper.java +++ b/src/main/java/com/example/jieyue/common/mapper/SysGoodsMapper.java @@ -9,24 +9,44 @@ import java.util.List; @Repository public interface SysGoodsMapper { SysGoods findById(int id); + List findByMt(int merchant); + List findByMtLimit(int merchant,int preNum,int sufNum); + List findAll(); + List findLimitByMt(int merchant,int preNum,int sufNum); + List findAllEsc(int num); + List findRand(int num); + List findMerchantRand(int merchant,int num); + List findAllDesc(int num); + List search(String keyword); + int goodsCount(int merchant); + int allGoodsCount(); + int countByMerchant(int merchant); + int deleteById(int id); + int addStock(int id,int stock); + int delStock(int id,int stock); + int updateState(int id,int state); + int updateGoods1(String name,String describe,BigDecimal price,int merchant,int stock,int id); + int updateGoods2(String name,String describe,BigDecimal price,int merchant,int stock,int id,String imgUrl); + int insert1(String name,String describe,BigDecimal price,int merchant,int stock); + int insert2(String name, String describe, BigDecimal price, int merchant,int stock, String img); } diff --git a/src/main/java/com/example/jieyue/common/mapper/SysMtMapper.java b/src/main/java/com/example/jieyue/common/mapper/SysMtMapper.java index ac6abbe..cc9955b 100644 --- a/src/main/java/com/example/jieyue/common/mapper/SysMtMapper.java +++ b/src/main/java/com/example/jieyue/common/mapper/SysMtMapper.java @@ -9,13 +9,17 @@ import java.util.List; @Repository public interface SysMtMapper { int insert(String name,String email,String password,float ratio,int state); + SysMt findByEmail(String email); + SysMt findById(int id); int count(); List findPage(int curRow,int pageSize); + List findAll(); + int deleteById(int id); int updateRatio(int id,float ratio); @@ -25,7 +29,6 @@ public interface SysMtMapper { int updateHeader(int id,String header); int update(String name,String password,String email); - // todo - int updateName(String name); + int updateName(String name); } diff --git a/src/main/java/com/example/jieyue/common/mapper/SysMtUiMapper.java b/src/main/java/com/example/jieyue/common/mapper/SysMtUiMapper.java index 3e7401a..d4563f5 100644 --- a/src/main/java/com/example/jieyue/common/mapper/SysMtUiMapper.java +++ b/src/main/java/com/example/jieyue/common/mapper/SysMtUiMapper.java @@ -8,10 +8,16 @@ import java.util.List; @Repository public interface SysMtUiMapper { SysMtUi findByMark(int width, int height, int merchant); + SysMtUi findById(int id); + List findLimit(int width, int height, int num); + int updateUrl(String url, int width, int height,int merchant); + int insert(String url, int width, int height,int merchant); + int deleteByMark(int width, int height,int merchant); + int deleteById(int id); } diff --git a/src/main/java/com/example/jieyue/common/mapper/SysOrderMapper.java b/src/main/java/com/example/jieyue/common/mapper/SysOrderMapper.java index 565a700..0c0efa3 100644 --- a/src/main/java/com/example/jieyue/common/mapper/SysOrderMapper.java +++ b/src/main/java/com/example/jieyue/common/mapper/SysOrderMapper.java @@ -9,28 +9,43 @@ import java.util.List; @Repository public interface SysOrderMapper { List findLimit(int preNum,int sufNum); + List findPayLimit(int preNum,int sufNum); + List findNotPayLimit(int preNum,int sufNum); List findLimitByMt(int merchantId,int preNum,int sufNum); + List findPayLimitByMt(int merchantId,int preNum,int sufNum); + List findNotPayLimitByMt(int merchantId,int preNum,int sufNum); List findAll(); + List findByUser(int user,int preNum,int sufNum); + List findByMerchant(int merchant,int num); + List findByState(int state); + SysOrder findByOrderId(String orderId); + SysOrder findByOrderIdAndMt(String orderId,int merchant); + List findByOrderMark(String orderMark); int orderCount(); + int payCount(); + int notPayCount(); int orderCountByUser(int userId); + int orderCountByMt(int merchantId); + int payCountByMt(int merchantId); + int notPayCountByMt(int merchantId); // 修改订单状态 @@ -50,5 +65,6 @@ public interface SysOrderMapper { // 收益 float websiteProfitCount(); + Float merchantProfitCount(int merchantId); } diff --git a/src/main/java/com/example/jieyue/common/mapper/SysUiMapper.java b/src/main/java/com/example/jieyue/common/mapper/SysUiMapper.java index 854b588..8bcf5ab 100644 --- a/src/main/java/com/example/jieyue/common/mapper/SysUiMapper.java +++ b/src/main/java/com/example/jieyue/common/mapper/SysUiMapper.java @@ -6,7 +6,10 @@ import org.springframework.stereotype.Repository; @Repository public interface SysUiMapper { SysUi findByMark(int width,int height); + int updateUrl(String url,int width,int height); + int insert(String url,int width,int height); + int deleteByMark(int width,int height); } diff --git a/src/main/java/com/example/jieyue/common/mapper/SysUserMapper.java b/src/main/java/com/example/jieyue/common/mapper/SysUserMapper.java index 3278240..480f6fa 100644 --- a/src/main/java/com/example/jieyue/common/mapper/SysUserMapper.java +++ b/src/main/java/com/example/jieyue/common/mapper/SysUserMapper.java @@ -9,15 +9,25 @@ import java.util.List; @Repository public interface SysUserMapper { SysUser selectById(int id); + List findLimit(int preNum,int sufNum); + int userCount(); + List findAll(); + List getAllId(); + int insert(@Param("username") String username,@Param("password") String password, @Param("email") String email,@Param("mark") int mark); + SysUser selectByEmail(String email); + SysUser getUserInfo(String email); + int updateMark(int mark,String email); + int update(String username,String password,String email); + int updateById(String username,String password,String header,String email,int id); } diff --git a/src/main/java/com/example/jieyue/common/service/MailService.java b/src/main/java/com/example/jieyue/common/service/MailService.java index 8271726..16e4b78 100644 --- a/src/main/java/com/example/jieyue/common/service/MailService.java +++ b/src/main/java/com/example/jieyue/common/service/MailService.java @@ -21,19 +21,19 @@ public class MailService { private final Logger logger = LoggerFactory.getLogger(this.getClass()); /** - * Spring Boot 提供了一个发送邮件的简单抽象,使用的是下面这个接口,这里直接注入即可使用 + *

Spring 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 getAllGoods(){ return goodsMapper.findAll(); } - /* - * 通过id获取商品 + /** + *

通过id获取商品

*/ public SysGoods getGoodsById(int id){ return goodsMapper.findById(id); } - /* - * 获取当前商户的商品列表 + /** + *

获取当前商户的商品列表

*/ public List getMtGoods(HttpSession session,int page,int num){ SysMt sysMt = (SysMt) session.getAttribute("merchant"); @@ -54,7 +54,6 @@ public class MerchantGoodsService { /** *

添加商品

- * * @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 getOrderList(int merchantId,int page, int num, int flag){ switch (flag){ @@ -28,8 +28,8 @@ public class MerchantOrderService { return null; } - /* - * 获取总页数 + /** + *

获取总页数

*/ public int getAllPage(int merchantId,int flag,int num){ switch (flag){ @@ -43,8 +43,8 @@ public class MerchantOrderService { return 1; } - /* - * 通过订单号查找 + /** + *

通过订单号查找

*/ public List getOrderById(String orderId,int merchant){ SysOrder order = orderMapper.findByOrderIdAndMt(orderId,merchant); diff --git a/src/main/java/com/example/jieyue/merchant/service/MerchantUiService.java b/src/main/java/com/example/jieyue/merchant/service/MerchantUiService.java index a233989..af141b2 100644 --- a/src/main/java/com/example/jieyue/merchant/service/MerchantUiService.java +++ b/src/main/java/com/example/jieyue/merchant/service/MerchantUiService.java @@ -27,7 +27,6 @@ public class MerchantUiService { /** *

获取当前商户的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 getUserList(int page, int num){ return userMapper.findLimit((page-1)*num,num); } - /* - * 获取总页数 + /** + *

获取总页数

*/ 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 goodsList = searchService.esSearchGoods(keyword); - modelAndView.addObject("goodsList",goodsList); + // 使用mysql获取返回的商品列表 + List goodsList = searchService.mysqlSearchGoods(keyword); + // 使用es获取返回的商品列表 + // List goodsList = searchService.esSearchGoods(keyword); + + modelAndView.addObject("goodsList",goodsList); modelAndView.setViewName("user/search/index"); return modelAndView; } diff --git a/src/main/java/com/example/jieyue/user/controller/UserShopController.java b/src/main/java/com/example/jieyue/user/controller/UserShopController.java index a8363ca..5ad4642 100644 --- a/src/main/java/com/example/jieyue/user/controller/UserShopController.java +++ b/src/main/java/com/example/jieyue/user/controller/UserShopController.java @@ -22,8 +22,8 @@ public class UserShopController { @Autowired UserShopService shopService; - /* - * 店铺首页 + /** + *

店铺首页

*/ @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 getCartList(HttpServletRequest request){ // 获取用户信息 diff --git a/src/main/java/com/example/jieyue/user/service/UserCheckOutService.java b/src/main/java/com/example/jieyue/user/service/UserCheckOutService.java index 3743b10..0d955ff 100644 --- a/src/main/java/com/example/jieyue/user/service/UserCheckOutService.java +++ b/src/main/java/com/example/jieyue/user/service/UserCheckOutService.java @@ -16,8 +16,8 @@ public class UserCheckOutService { @Autowired SysGoodsMapper goodsMapper; - /* - * 获取商品信息 + /** + *

获取商品信息

*/ public Map getGoodsInfo(String ids){ Map map = new HashMap<>(); @@ -28,8 +28,8 @@ public class UserCheckOutService { return map; } - /* - * 获取总金额 + /** + *

获取总金额

*/ public BigDecimal getGoodsNumPrice(Map goodsMap){ BigDecimal allPrice = new BigDecimal(0.00); @@ -39,8 +39,8 @@ public class UserCheckOutService { return allPrice; } - /* - * 将前端发送的ids字符串切割为哈希表 + /** + *

将前端发送的ids字符串切割为哈希表

*/ public Map getIdsMap(String ids){ String[] idsAndNumArray = ids.split(","); @@ -54,8 +54,8 @@ public class UserCheckOutService { return map; } - /* - * 获取对应的cart id + /** + *

获取对应的cart id

*/ public List getCartIds(String ids){ String[] idsAndNumArray = ids.split(","); diff --git a/src/main/java/com/example/jieyue/user/service/UserHomeService.java b/src/main/java/com/example/jieyue/user/service/UserHomeService.java index 71602ef..67e498c 100644 --- a/src/main/java/com/example/jieyue/user/service/UserHomeService.java +++ b/src/main/java/com/example/jieyue/user/service/UserHomeService.java @@ -28,8 +28,8 @@ public class UserHomeService { @Autowired SysMtUiMapper mtUiMapper; - /* - * 设置缓存 十分钟内有效 + /** + *

设置缓存 十分钟内有效

*/ public void setHomeCache(ModelAndView modelAndView){ redisTemplate.opsForHash().put("homePageCache","imgMap",modelAndView.getModelMap().get("imgMap")); diff --git a/src/main/java/com/example/jieyue/user/service/UserInfoService.java b/src/main/java/com/example/jieyue/user/service/UserInfoService.java index 8e52832..905f97e 100644 --- a/src/main/java/com/example/jieyue/user/service/UserInfoService.java +++ b/src/main/java/com/example/jieyue/user/service/UserInfoService.java @@ -31,7 +31,6 @@ public class UserInfoService { /** *

修改用户信息

- * * @return *-1 修改信息失败 * 1 修改信息成功 diff --git a/src/main/java/com/example/jieyue/user/service/UserLoginService.java b/src/main/java/com/example/jieyue/user/service/UserLoginService.java index 9a8ba64..f8b0b28 100644 --- a/src/main/java/com/example/jieyue/user/service/UserLoginService.java +++ b/src/main/java/com/example/jieyue/user/service/UserLoginService.java @@ -24,8 +24,8 @@ public class UserLoginService { @Autowired RedisTemplate redisTemplate; - // 判空工具类 IsEmptyUtil isEmptyUtil = IsEmptyUtil.getInstance(); + /** *

登陆验证逻辑处理

* @return int @@ -53,8 +53,8 @@ public class UserLoginService { } } - /* - * 返回用户信息 + /** + *

返回用户信息

*/ public SysUser userInfo(String email){ return service.getUserInfo(email); @@ -115,7 +115,7 @@ public class UserLoginService { } /** - * 验证邮件确认注册 + *

验证邮件确认注册

* @return int *-1 404页面 * 0 网络超时请重试 diff --git a/src/main/java/com/example/jieyue/user/service/UserOrderService.java b/src/main/java/com/example/jieyue/user/service/UserOrderService.java index 8ba9a52..cd23245 100644 --- a/src/main/java/com/example/jieyue/user/service/UserOrderService.java +++ b/src/main/java/com/example/jieyue/user/service/UserOrderService.java @@ -17,15 +17,15 @@ public class UserOrderService { @Autowired SysGoodsMapper goodsMapper; - /* - * 获取用户订单 + /** + *

获取用户订单

*/ public List getOrderList(int userId,int page,int num){ return orderMapper.findByUser(userId,(page-1)*num,num); } - /* - * 获取订单中的商品信息 + /** + *

获取订单中的商品信息

*/ public List getGoodsList(List orderList){ List list = new ArrayList<>(); @@ -35,8 +35,8 @@ public class UserOrderService { return list; } - /* - * 获取总页数 + /** + *

获取总页数

*/ public int getAllPage(int userId,int num){ return (int)Math.ceil((double)orderMapper.orderCountByUser(userId)/(double)num); diff --git a/src/main/java/com/example/jieyue/user/service/UserProductService.java b/src/main/java/com/example/jieyue/user/service/UserProductService.java index 2072537..8166f90 100644 --- a/src/main/java/com/example/jieyue/user/service/UserProductService.java +++ b/src/main/java/com/example/jieyue/user/service/UserProductService.java @@ -22,8 +22,8 @@ public class UserProductService { @Autowired SysUserMapper userMapper; - /* - * 整合用户信息和评论信息 + /** + *

整合用户信息和评论信息

*/ public List getCommentList(int goods, int page, int num){ List commentInfo = getCommentInfo(goods,page,num); @@ -44,16 +44,16 @@ public class UserProductService { return list; } - /* - * 获取当前商品总评论页数 + /** + *

获取当前商品总评论页数

*/ public int getAllCountPage(int goods,int num){ int count = commentMapper.getAllCountByGoods(goods); return (int)Math.ceil((double)count/(double)num); } - /* - * 通过id值获取商品对象 + /** + *

通过id值获取商品对象

*/ public SysGoods getGoods(int id){ return goodsMapper.findById(id); @@ -61,7 +61,6 @@ public class UserProductService { /** *

获取商品评论列表

- * * @param goods 商品id * @param page 评论的页数 * @param num 一页评论的条数 @@ -70,8 +69,8 @@ public class UserProductService { return commentMapper.findByGoodsLimit(goods,(page-1)*num,page*num); } - /* - * 获取评论对应的商户信息 + /** + *

获取评论对应的商户信息

*/ public SysUser getUserInfo(int userId){ return userMapper.selectById(userId); @@ -79,13 +78,9 @@ public class UserProductService { /** *

添加商品评论

- * * @return *-1 添加失败 * 1 添加成功 - * - * @author Bosen - * 2020/11/28 14:32 */ public int addComment(int goodsId,int merchant,String context,HttpServletRequest request){ // 获取发表评论的用户信息 diff --git a/src/main/java/com/example/jieyue/user/service/UserSearchService.java b/src/main/java/com/example/jieyue/user/service/UserSearchService.java index 3088ea2..b8ed25f 100644 --- a/src/main/java/com/example/jieyue/user/service/UserSearchService.java +++ b/src/main/java/com/example/jieyue/user/service/UserSearchService.java @@ -20,7 +20,7 @@ public class UserSearchService { /** *

mysql通过关键字模糊查找商品

*/ - public List searchGoods(String keyword){ + public List mysqlSearchGoods(String keyword){ return goodsMapper.search(keyword); } diff --git a/src/main/java/com/example/jieyue/user/service/UserShopService.java b/src/main/java/com/example/jieyue/user/service/UserShopService.java index eabdbfb..9da8932 100644 --- a/src/main/java/com/example/jieyue/user/service/UserShopService.java +++ b/src/main/java/com/example/jieyue/user/service/UserShopService.java @@ -18,15 +18,15 @@ public class UserShopService { @Autowired SysGoodsMapper goodsMapper; - /* - * 获取商户信息 + /** + *

获取商户信息

*/ public SysMt getMerchantInfo(int merchantId){ return merchantMapper.findById(merchantId); } - /* - * 获取商户商品信息 + /** + *

获取商户商品信息

*/ public Map getGoodsList(int merchantId, int page, int num){ List list = goodsMapper.findByMtLimit(merchantId,(page-1)*num,page*num); @@ -37,8 +37,8 @@ public class UserShopService { return map; } - /* - * 随机获取商品 + /** + *

随机获取商品

*/ public Map getRandGoodsMap(int merchant,int num){ List list = goodsMapper.findMerchantRand(merchant,num); @@ -49,8 +49,8 @@ public class UserShopService { return map; } - /* - * 获取总页数 + /** + *

获取总页数

*/ public int getAllPage(int merchantId,int num){ int all = goodsMapper.countByMerchant(merchantId); diff --git a/src/main/java/com/example/jieyue/user/service/WxPayService.java b/src/main/java/com/example/jieyue/user/service/WxPayService.java index bea542f..085813d 100644 --- a/src/main/java/com/example/jieyue/user/service/WxPayService.java +++ b/src/main/java/com/example/jieyue/user/service/WxPayService.java @@ -63,8 +63,7 @@ public class WxPayService { } /** - * 添加订单 - * + *

添加订单

* @return *-1 sql语句执行失败 * 0 必填信息不能为空 @@ -114,16 +113,16 @@ public class WxPayService { return wxCodeUrl(mark,allPrice); } - /* - * 分割js传递的数组 + /** + *

分割js传递的数组

*/ public String[] getStringArray(String array){ List list = new ArrayList<>(); return array.split(","); } - /* - * 总金额运算 + /** + *

总金额运算

*/ public String getAllPrice(String[] prices,String[] nums){ DecimalFormat dfPrice = new DecimalFormat("#.00"); @@ -138,8 +137,8 @@ public class WxPayService { return allPrice.multiply(new BigDecimal(100)).stripTrailingZeros().toPlainString(); } - /* - * 生成二维码 + /** + *

生成二维码

*/ public String wxCodeUrl(String orderMark,String price){ Map data = new HashMap<>(); @@ -164,10 +163,8 @@ public class WxPayService { return codeUrl; } - /* - * 生成订单号 - * - * 由三位字母十四位的日期数六位随机数组成 + /** + *

生成订单号

*/ public String getOrderId(){ String s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; @@ -193,7 +190,7 @@ public class WxPayService { } /** - * 微信支付异步通知验证签名 + *

微信支付异步通知验证签名

* @param request * @return */ @@ -231,8 +228,7 @@ public class WxPayService { } /** - * 从流中读取微信返回的xml数据 - * + *

从流中读取微信返回的xml数据

* @param httpServletRequest * @return * @throws IOException @@ -255,8 +251,7 @@ public class WxPayService { } /** - * 设置返回给微信服务器的xml信息 - * + *

设置返回给微信服务器的xml信息

* @param returnCode * @param returnMsg * @return