规范代码和注释规范
parent
171f0e5089
commit
8354d0b7dc
|
@ -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扫描
|
||||
/**
|
||||
* <p>启动类</p>
|
||||
* @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);
|
||||
}
|
||||
|
||||
/*
|
||||
* 处理文件过大上传失败的问题
|
||||
/**
|
||||
* <p>处理文件过大上传失败的问题</p>
|
||||
*/
|
||||
@Bean
|
||||
public TomcatServletWebServerFactory containerFactory() {
|
||||
|
|
|
@ -22,8 +22,11 @@ public class AdminHomeController {
|
|||
@Autowired
|
||||
SysUserMapper userMapper;
|
||||
|
||||
/**
|
||||
* <p>登录页面</p>
|
||||
*/
|
||||
@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();
|
||||
|
|
|
@ -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;
|
||||
/*
|
||||
* 登陆页面
|
||||
|
||||
/**
|
||||
* <p>登陆页面</p>
|
||||
*/
|
||||
@RequestMapping({"login",""})
|
||||
public ModelAndView index(ModelAndView modelAndView){
|
||||
|
@ -30,11 +30,11 @@ public class AdminLoginController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 登陆处理
|
||||
/**
|
||||
* <p>登录处理</p>
|
||||
*/
|
||||
@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){
|
||||
// 登陆成功
|
||||
|
@ -58,21 +58,21 @@ public class AdminLoginController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 退出登录
|
||||
/**
|
||||
* <p>退出登录</p>
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 注册请求
|
||||
/**
|
||||
* <p>注册请求</p>
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 验证邮件确认注册
|
||||
/**
|
||||
* <p>验证邮件,确认注册</p>
|
||||
*/
|
||||
@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");
|
||||
|
|
|
@ -24,8 +24,11 @@ public class AdminMerchantController {
|
|||
@Autowired
|
||||
SysMtMapper merchantMapper;
|
||||
|
||||
/**
|
||||
* <p>商户模块主页</p>
|
||||
*/
|
||||
@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<SysMt> 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>修改费率</p>
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 删除商户
|
||||
/**
|
||||
* <p>删除商户</p>
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 修改商户状态
|
||||
/**
|
||||
* <p>修改商户状态</p>
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 检查费率是否超过了一位小数
|
||||
/**
|
||||
* <p>检查费率是否超过了一位小数</p>
|
||||
*/
|
||||
public boolean checkFloat(float ratio){
|
||||
char[] c = String.valueOf(ratio).split(".")[1].toCharArray();
|
||||
|
|
|
@ -7,6 +7,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* <p>后台群发控制器</p>
|
||||
* @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异步发送
|
||||
/**
|
||||
* <p>系统消息发送 利用redis异步发送</p>
|
||||
*/
|
||||
@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");
|
||||
|
|
|
@ -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<SysOrder> 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<SysOrder> orderList = orderService.getOrderById(order);
|
||||
modelAndView.addObject("orderList",orderList);
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* <p>后台模块RBAC权限管理控制器</p>
|
||||
* @author Bosen
|
||||
* @date 2021/8/9 23:20
|
||||
*/
|
||||
@RestController
|
||||
public class AdminRbacController {
|
||||
@Autowired
|
||||
|
@ -55,23 +59,27 @@ public class AdminRbacController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>权限不足时需要跳转的页面</p>
|
||||
*/
|
||||
@RequestMapping("/admin/alert")
|
||||
public ModelAndView adminAlert(ModelAndView modelAndView) {
|
||||
modelAndView.setViewName("admin/rbac/alert");
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 编辑管理员的角色页面
|
||||
/**
|
||||
* <p>编辑管理员的角色页面</p>
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 添加角色
|
||||
/**
|
||||
* <p>添加角色</p>
|
||||
*/
|
||||
@RequestMapping("/admin/add-role")
|
||||
public ModelAndView addRole(ModelAndView modelAndView,String name){
|
||||
|
@ -107,8 +115,8 @@ public class AdminRbacController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 添加权限
|
||||
/**
|
||||
* <p>添加权限</p>
|
||||
*/
|
||||
@RequestMapping("/admin/add-access")
|
||||
public ModelAndView addAccess(ModelAndView modelAndView,String name,String url){
|
||||
|
@ -164,11 +172,11 @@ public class AdminRbacController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 停用管理员
|
||||
/**
|
||||
* <p>停用管理员</p>
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 启用管理员
|
||||
/**
|
||||
* <p>启用管理员</p>
|
||||
*/
|
||||
@RequestMapping("/admin/on-admin")
|
||||
public ModelAndView onAdmin(ModelAndView modelAndView,int id){
|
||||
|
@ -196,8 +204,8 @@ public class AdminRbacController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 停用角色
|
||||
/**
|
||||
* <p>停用角色</p>
|
||||
*/
|
||||
@RequestMapping("/admin/off-role")
|
||||
public ModelAndView offRole(ModelAndView modelAndView,int id){
|
||||
|
@ -210,8 +218,8 @@ public class AdminRbacController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 启用角色
|
||||
/**
|
||||
* <p>启用角色</p>
|
||||
*/
|
||||
@RequestMapping("/admin/on-role")
|
||||
public ModelAndView onRole(ModelAndView modelAndView,int id){
|
||||
|
@ -224,8 +232,8 @@ public class AdminRbacController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 启用权限
|
||||
/**
|
||||
* <p>启用权限</p>
|
||||
*/
|
||||
@RequestMapping("/admin/on-access")
|
||||
public ModelAndView onAccess(ModelAndView modelAndView,int id){
|
||||
|
@ -238,8 +246,8 @@ public class AdminRbacController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 停用权限
|
||||
/**
|
||||
* <p>停用权限</p>
|
||||
*/
|
||||
@RequestMapping("/admin/off-access")
|
||||
public ModelAndView offAccess(ModelAndView modelAndView,int id){
|
||||
|
@ -252,8 +260,8 @@ public class AdminRbacController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 修改权限信息
|
||||
/**
|
||||
* <p>修改权限信息</p>
|
||||
*/
|
||||
@RequestMapping("/admin/update-access")
|
||||
public ModelAndView updateAccess(ModelAndView modelAndView,int id,String name,String url){
|
||||
|
@ -266,8 +274,8 @@ public class AdminRbacController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 修改角儿权限信息页面
|
||||
/**
|
||||
* <p>修改角儿权限信息页面</p>
|
||||
*/
|
||||
@RequestMapping("/admin/role-access")
|
||||
public ModelAndView roleAccessIndex(ModelAndView modelAndView,int id){
|
||||
|
@ -290,8 +298,8 @@ public class AdminRbacController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 修改角色的权限
|
||||
/**
|
||||
* <p>修改角色的权限</p>
|
||||
*/
|
||||
@RequestMapping("/admin/role-access/action")
|
||||
public ModelAndView action(ModelAndView modelAndView,int role,int ... ids){
|
||||
|
|
|
@ -35,8 +35,6 @@ public class AdminUiController {
|
|||
|
||||
/**
|
||||
* <p>文件上传操作</p>
|
||||
* @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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 删除海报
|
||||
/**
|
||||
* <p>删除海报</p>
|
||||
*/
|
||||
@RequestMapping("/admin/del-image")
|
||||
public ModelAndView delImg(ModelAndView modelAndView,int width,int height){
|
||||
|
|
|
@ -10,6 +10,11 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>后台用户列表控制器</p>
|
||||
* @author Bosen
|
||||
* @date 2021/8/9 22:34
|
||||
*/
|
||||
@RestController
|
||||
public class AdminUserController {
|
||||
@Autowired
|
||||
|
|
|
@ -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();
|
||||
|
||||
/**
|
||||
* <p>登陆验证逻辑处理</p>
|
||||
* @return int
|
||||
|
@ -59,8 +59,8 @@ public class AdminLoginService {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 返回用户信息
|
||||
/**
|
||||
* <p>返回用户信息</p>
|
||||
*/
|
||||
public SysAdmin adminInfo(String email){
|
||||
return adminMapper.getAdminInfo(email);
|
||||
|
|
|
@ -11,9 +11,9 @@ import java.util.List;
|
|||
public class AdminMerchantService {
|
||||
@Autowired
|
||||
SysMtMapper mtMapper;
|
||||
|
||||
/**
|
||||
* <p>获取用户的信息</p>
|
||||
*
|
||||
* @param curPage 当前页数
|
||||
* @param pageSize 一页的条数
|
||||
*/
|
||||
|
@ -22,8 +22,8 @@ public class AdminMerchantService {
|
|||
return mtMapper.findPage(curRow,pageSize);
|
||||
}
|
||||
|
||||
/*
|
||||
* 删除商户
|
||||
/**
|
||||
* <p>删除商户</p>
|
||||
*/
|
||||
public int deleteMerchant(int merchantId){
|
||||
if (mtMapper.deleteById(merchantId)==1){
|
||||
|
@ -32,8 +32,8 @@ public class AdminMerchantService {
|
|||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* 修改用户状态
|
||||
/**
|
||||
* <p>修改用户状态</p>
|
||||
*/
|
||||
public int updateMerchantState(String email,int state){
|
||||
if (mtMapper.updateState(email,state)==1){
|
||||
|
@ -42,8 +42,8 @@ public class AdminMerchantService {
|
|||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取商户列表总页数
|
||||
/**
|
||||
* <p>获取商户列表总页数</p>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@ public class AdminNoticeService {
|
|||
@Autowired
|
||||
RabbitTemplate rabbitTemplate;
|
||||
|
||||
/*
|
||||
* 将要发送的消息存入redis消息队列
|
||||
/**
|
||||
* <p>将要发送的消息存入redis消息队列</p>
|
||||
*/
|
||||
public void sendByRedis(String title,String context,int type){
|
||||
Map<String,String> map = new HashMap<>();
|
||||
|
@ -73,9 +73,14 @@ public class AdminNoticeService {
|
|||
redisTemplate.opsForList().leftPush("notice",map);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>将要发送的消息存入rabbitMQ消息队列</p>
|
||||
*/
|
||||
public void sendByRabbitMQ(String title,String context,int type){
|
||||
switch (type){
|
||||
case 0:
|
||||
|
|
|
@ -13,23 +13,28 @@ public class AdminOrderService {
|
|||
@Autowired
|
||||
SysOrderMapper orderMapper;
|
||||
|
||||
/*
|
||||
* 获取订单信息
|
||||
/**
|
||||
* <p>获取订单信息</p>
|
||||
*/
|
||||
public List<SysOrder> 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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 通过订单号查找
|
||||
/**
|
||||
* <p>通过订单号查找</p>
|
||||
*/
|
||||
public List<SysOrder> getOrderById(String orderId){
|
||||
SysOrder order = orderMapper.findByOrderId(orderId);
|
||||
|
@ -40,8 +45,8 @@ public class AdminOrderService {
|
|||
return list;
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取总页数
|
||||
/**
|
||||
* <p>获取总页数</p>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -13,19 +13,7 @@ public class AdminRbacService {
|
|||
SysRoleAccessMapper roleAccessMapper;
|
||||
|
||||
/**
|
||||
* <p>修改管理员的角色</p>
|
||||
* @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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 修改角色的权限
|
||||
* <p>修改角色的权限</p>
|
||||
*/
|
||||
@Transactional
|
||||
public boolean setRoleAccess(int role,int[] ids){
|
||||
|
@ -39,6 +27,4 @@ public class AdminRbacService {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -19,15 +19,15 @@ public class AdminUiService {
|
|||
DateUtil dateUtil;
|
||||
@Autowired
|
||||
SysUiMapper uiMapper;
|
||||
|
||||
/**
|
||||
* 文件上传逻辑处理
|
||||
*
|
||||
* <p>文件上传逻辑处理</p>
|
||||
* @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 {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 删除海报逻辑处理
|
||||
/**
|
||||
* <p>删除海报逻辑处理</p>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,15 +12,15 @@ public class AdminUserService {
|
|||
@Autowired
|
||||
SysUserMapper userMapper;
|
||||
|
||||
/*
|
||||
* 获取用户信息
|
||||
/**
|
||||
* <p>获取用户信息</p>
|
||||
*/
|
||||
public List<SysUser> getUserList(int page, int num){
|
||||
return userMapper.findLimit((page-1)*num,num);
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取总页数
|
||||
/**
|
||||
* <p>获取总页数</p>
|
||||
*/
|
||||
public int getAllPage(int num){
|
||||
return (int)Math.ceil((double)userMapper.userCount()/(double)num);
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,11 +10,14 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>权限检查拦截器</p>
|
||||
* @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;
|
||||
}
|
||||
/*
|
||||
* 检查权限
|
||||
|
||||
/**
|
||||
* <p>检查权限</p>
|
||||
*/
|
||||
public boolean checkRbac(HttpServletRequest request) {
|
||||
try {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -20,9 +20,7 @@ public class MerchantWebMvcConfigurer implements WebMvcConfigurer {
|
|||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
/*
|
||||
* 网站主页,静态资源,网站作者页面,以及登陆注册所需页面外,未登录时的访问 统一跳转至登陆注册页面
|
||||
*/
|
||||
// 登录拦截
|
||||
registry.addInterceptor(new LoginHandlerInterceptor())
|
||||
.addPathPatterns("/mer*/**")
|
||||
.excludePathPatterns(
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -20,9 +20,7 @@ public class UserWebMvcConfigurer implements WebMvcConfigurer {
|
|||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
/*
|
||||
* 网站主页,静态资源,网站作者页面,以及登陆注册所需页面外,未登录时的访问 统一跳转至登陆注册页面
|
||||
*/
|
||||
// 登录拦截
|
||||
registry.addInterceptor(new LoginHandlerInterceptor())
|
||||
.addPathPatterns("/user/**")
|
||||
.excludePathPatterns(
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
package com.example.jieyue.common.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class TestController {
|
||||
|
||||
}
|
|
@ -1,40 +1,20 @@
|
|||
package com.example.jieyue.common.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <p>数据库表的映射类</p>
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,60 +1,21 @@
|
|||
package com.example.jieyue.common.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <p>数据库表的映射类</p>
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,40 +1,20 @@
|
|||
package com.example.jieyue.common.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <p>数据库表的映射类</p>
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,40 +1,20 @@
|
|||
package com.example.jieyue.common.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <p>数据库表的映射类</p>
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
package com.example.jieyue.common.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <p>数据库表的映射类</p>
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,19 @@
|
|||
package com.example.jieyue.common.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>数据库表的映射类</p>
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
package com.example.jieyue.common.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <p>数据库表的映射类</p>
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,61 +1,21 @@
|
|||
package com.example.jieyue.common.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <p>数据库表的映射类</p>
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,11 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>数据库表的映射类</p>
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,19 @@
|
|||
package com.example.jieyue.common.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>数据库表的映射类</p>
|
||||
* @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;
|
||||
}
|
|
@ -1,31 +1,19 @@
|
|||
package com.example.jieyue.common.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <p>数据库表的映射类</p>
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,40 +1,20 @@
|
|||
package com.example.jieyue.common.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <p>数据库表的映射类</p>
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,35 +1,20 @@
|
|||
package com.example.jieyue.common.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <p>数据库表的映射类</p>
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
package com.example.jieyue.common.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <p>数据库表的映射类</p>
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,12 +9,19 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface SysAdminMapper {
|
||||
List<SysAdmin> 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);
|
||||
}
|
||||
|
|
|
@ -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<SysComment> findByGoodsLimit(int goods,int preNum,int sufNum);
|
||||
|
|
|
@ -9,24 +9,44 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface SysGoodsMapper {
|
||||
SysGoods findById(int id);
|
||||
|
||||
List<SysGoods> findByMt(int merchant);
|
||||
|
||||
List<SysGoods> findByMtLimit(int merchant,int preNum,int sufNum);
|
||||
|
||||
List<SysGoods> findAll();
|
||||
|
||||
List<SysGoods> findLimitByMt(int merchant,int preNum,int sufNum);
|
||||
|
||||
List<SysGoods> findAllEsc(int num);
|
||||
|
||||
List<SysGoods> findRand(int num);
|
||||
|
||||
List<SysGoods> findMerchantRand(int merchant,int num);
|
||||
|
||||
List<SysGoods> findAllDesc(int num);
|
||||
|
||||
List<SysGoods> 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);
|
||||
}
|
||||
|
|
|
@ -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<SysMt> findPage(int curRow,int pageSize);
|
||||
|
||||
List<SysMt> 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);
|
||||
}
|
||||
|
|
|
@ -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<SysMtUi> 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);
|
||||
}
|
||||
|
|
|
@ -9,28 +9,43 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface SysOrderMapper {
|
||||
List<SysOrder> findLimit(int preNum,int sufNum);
|
||||
|
||||
List<SysOrder> findPayLimit(int preNum,int sufNum);
|
||||
|
||||
List<SysOrder> findNotPayLimit(int preNum,int sufNum);
|
||||
|
||||
List<SysOrder> findLimitByMt(int merchantId,int preNum,int sufNum);
|
||||
|
||||
List<SysOrder> findPayLimitByMt(int merchantId,int preNum,int sufNum);
|
||||
|
||||
List<SysOrder> findNotPayLimitByMt(int merchantId,int preNum,int sufNum);
|
||||
|
||||
List<SysOrder> findAll();
|
||||
|
||||
List<SysOrder> findByUser(int user,int preNum,int sufNum);
|
||||
|
||||
List<SysOrder> findByMerchant(int merchant,int num);
|
||||
|
||||
List<SysOrder> findByState(int state);
|
||||
|
||||
SysOrder findByOrderId(String orderId);
|
||||
|
||||
SysOrder findByOrderIdAndMt(String orderId,int merchant);
|
||||
|
||||
List<SysOrder> 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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -9,15 +9,25 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface SysUserMapper {
|
||||
SysUser selectById(int id);
|
||||
|
||||
List<SysUser> findLimit(int preNum,int sufNum);
|
||||
|
||||
int userCount();
|
||||
|
||||
List<SysUser> findAll();
|
||||
|
||||
List<Integer> 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);
|
||||
}
|
||||
|
|
|
@ -21,19 +21,19 @@ public class MailService {
|
|||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
/**
|
||||
* Spring Boot 提供了一个发送邮件的简单抽象,使用的是下面这个接口,这里直接注入即可使用
|
||||
* <p>Spring Boot 提供了一个发送邮件的简单抽象,使用的是下面这个接口,这里直接注入即可使用</p>
|
||||
*/
|
||||
@Autowired
|
||||
private JavaMailSender mailSender;
|
||||
|
||||
/**
|
||||
* 配置文件中我的qq邮箱
|
||||
* <p>配置文件中我的qq邮箱</p>
|
||||
*/
|
||||
@Value("${spring.mail.from}")
|
||||
private String from;
|
||||
|
||||
/**
|
||||
* 简单文本邮件
|
||||
* <p>简单文本邮件</p>
|
||||
* @param to 收件人
|
||||
* @param subject 主题
|
||||
* @param content 内容
|
||||
|
@ -54,7 +54,7 @@ public class MailService {
|
|||
}
|
||||
|
||||
/**
|
||||
* html邮件
|
||||
* <p>html邮件</p>
|
||||
* @param to 收件人
|
||||
* @param subject 主题
|
||||
* @param content 内容
|
||||
|
@ -85,7 +85,7 @@ public class MailService {
|
|||
}
|
||||
|
||||
/**
|
||||
* 带附件的邮件
|
||||
* <p>带附件的邮件</p>
|
||||
* @param to 收件人
|
||||
* @param subject 主题
|
||||
* @param content 内容
|
||||
|
@ -111,8 +111,8 @@ public class MailService {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 邮箱格式验证
|
||||
/**
|
||||
* <p>邮箱格式验证</p>
|
||||
*/
|
||||
public boolean checkEmail(String email){
|
||||
String check = "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$";
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -37,8 +37,8 @@ public class SchedulerTask {
|
|||
@Autowired
|
||||
MailService mailService;
|
||||
|
||||
/*
|
||||
* 每分钟执行一次,检查是否有过期的订单,若过期将其删除,并恢复库存
|
||||
/**
|
||||
* <p>每分钟执行一次,检查是否有过期的订单,若过期将其删除,并恢复库存</p>
|
||||
*/
|
||||
@Scheduled(cron="0 0/1 * * * ?")
|
||||
@Transactional
|
||||
|
@ -57,8 +57,8 @@ public class SchedulerTask {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 每分钟执行一次,对已创建了两小时订单的二维码进行删除
|
||||
/**
|
||||
* <p>每分钟执行一次,对已创建了两小时订单的二维码进行删除</p>
|
||||
*/
|
||||
@Scheduled(cron="0 0/1 * * * ?")
|
||||
public void delQRCode(){
|
||||
|
@ -71,8 +71,8 @@ public class SchedulerTask {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 每分钟执行一次,对消息队列的消息执行发送
|
||||
/**
|
||||
* <p>每分钟执行一次,对redis消息队列的消息执行发送</p>
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 每分钟执行一次,邮箱发送队列的执行发送
|
||||
/**
|
||||
* <p>每分钟执行一次,邮箱发送队列的执行发送</p>
|
||||
*/
|
||||
@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"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ import java.util.Date;
|
|||
*/
|
||||
@Component
|
||||
public class DateUtil {
|
||||
/*
|
||||
* 获取纯年月日时分秒的字符串
|
||||
/**
|
||||
* <p>获取纯年月日时分秒的字符串</p>
|
||||
*/
|
||||
public String getNMDHIS(){
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
|
|
|
@ -25,8 +25,7 @@ public class FileUtil {
|
|||
}
|
||||
|
||||
/**
|
||||
* 文件上传逻辑处理
|
||||
*
|
||||
* <p>文件上传逻辑处理</p>
|
||||
* @return
|
||||
* null 上传失败
|
||||
* 文件名 上传成功
|
||||
|
@ -59,8 +58,8 @@ public class FileUtil {
|
|||
return url+filename+"."+suffix;
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取文件后缀名
|
||||
/**
|
||||
* <p>获取文件后缀名</p>
|
||||
*/
|
||||
public String getSuffixName(String filename){
|
||||
String[] strArray = filename.split("\\.");
|
||||
|
@ -68,8 +67,8 @@ public class FileUtil {
|
|||
return strArray[suffixIndex];
|
||||
}
|
||||
|
||||
/*
|
||||
* 删除文件
|
||||
/**
|
||||
* <p>删除文件</p>
|
||||
*/
|
||||
public void deleteFile(String url){
|
||||
File file1 = new File(classpath+url);
|
||||
|
|
|
@ -9,8 +9,9 @@ import org.springframework.stereotype.Component;
|
|||
*/
|
||||
@Component
|
||||
public class IsEmptyUtil {
|
||||
/*
|
||||
* 单例模式
|
||||
|
||||
/**
|
||||
* <p>单例模式</p>
|
||||
*/
|
||||
private static class IsEmptyUtilHoler{
|
||||
private static IsEmptyUtil INSTANCE = new IsEmptyUtil();
|
||||
|
@ -20,8 +21,8 @@ public class IsEmptyUtil {
|
|||
return IsEmptyUtilHoler.INSTANCE;
|
||||
}
|
||||
|
||||
/*
|
||||
* 多个字符串判空操作,当存在有空字符时返回true
|
||||
/**
|
||||
* <p>多个字符串判空操作,当存在有空字符时返回true</p>
|
||||
*/
|
||||
public boolean strings(String ... strings){
|
||||
for (String string : strings) {
|
||||
|
@ -32,8 +33,8 @@ public class IsEmptyUtil {
|
|||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* 单个字符串判空操作
|
||||
/**
|
||||
* <p>单个字符串判空操作</p>
|
||||
*/
|
||||
public boolean string(String string){
|
||||
if (string==null || string.equals("")){
|
||||
|
@ -43,8 +44,8 @@ public class IsEmptyUtil {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 单个对象判空操作
|
||||
/**
|
||||
* <p>单个对象判空操作</p>
|
||||
*/
|
||||
public boolean object(Object object){
|
||||
if (object==null){
|
||||
|
@ -54,8 +55,8 @@ public class IsEmptyUtil {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 多个对象判空操作,当存在有null对象时返回true
|
||||
/**
|
||||
* <p>多个对象判空操作,当存在有null对象时返回true</p>
|
||||
*/
|
||||
public boolean objects(Object ... objects){
|
||||
for (Object object : objects) {
|
||||
|
|
|
@ -6,9 +6,9 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
@Component
|
||||
public class JsonUtil {
|
||||
|
||||
/**
|
||||
* 字符串转整数型数组
|
||||
* todo
|
||||
*/
|
||||
public int[] jsonToIntArray(String json){
|
||||
JSONArray jsonArray = JSON.parseArray(json);
|
||||
|
|
|
@ -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;
|
||||
|
||||
/*
|
||||
* 商品管理页面
|
||||
/**
|
||||
* <p>商品管理页面</p>
|
||||
*/
|
||||
@RequestMapping("/merchant/goods")
|
||||
public ModelAndView index(ModelAndView modelAndView, HttpSession session, @RequestParam(defaultValue = "1")int page){
|
||||
|
@ -44,8 +43,8 @@ public class MerchantGoodsController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 增加商品
|
||||
/**
|
||||
* <p>增加商品</p>
|
||||
*/
|
||||
@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值删除商品
|
||||
/**
|
||||
* <p>通过id值删除商品</p>
|
||||
*/
|
||||
@RequestMapping("/merchant/del-goods")
|
||||
public ModelAndView delGoods(ModelAndView modelAndView,int id){
|
||||
|
@ -102,8 +103,8 @@ public class MerchantGoodsController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 上架商品
|
||||
/**
|
||||
* <p>上架商品</p>
|
||||
*/
|
||||
@RequestMapping("/merchant/put-goods")
|
||||
public ModelAndView putGoods(ModelAndView modelAndView,int id){
|
||||
|
@ -116,8 +117,8 @@ public class MerchantGoodsController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 下架商品
|
||||
/**
|
||||
* <p>下架商品</p>
|
||||
*/
|
||||
@RequestMapping("/merchant/off-goods")
|
||||
public ModelAndView OffGoods(ModelAndView modelAndView,int id){
|
||||
|
@ -130,8 +131,8 @@ public class MerchantGoodsController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 修改商品信息
|
||||
/**
|
||||
* <p>修改商品信息</p>
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ public class MerchantLoginController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 登录
|
||||
/**
|
||||
* <p>登录</p>
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 退出登录
|
||||
/**
|
||||
* <p>退出登录</p>
|
||||
*/
|
||||
@RequestMapping("logout")
|
||||
public ModelAndView logout(ModelAndView modelAndView,HttpServletRequest request){
|
||||
|
@ -67,8 +69,8 @@ public class MerchantLoginController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 注册
|
||||
/**
|
||||
* <p>注册</p>
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 邮箱验证
|
||||
/**
|
||||
* <p>邮箱验证</p>
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 删除
|
||||
/**
|
||||
* <p>删除</p>
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 修改或添加商户在商城主页的宣传海报
|
||||
/**
|
||||
* <p>修改或添加商户在商城主页的宣传海报</p>
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 修改用户头像
|
||||
/**
|
||||
* <p>修改用户头像</p>
|
||||
*/
|
||||
@RequestMapping("/merchant/update-header")
|
||||
public ModelAndView updateHeader(RedirectAttributes redirectAttributes,HttpServletRequest request,ModelAndView modelAndView,MultipartFile img){
|
||||
|
|
|
@ -27,25 +27,25 @@ public class MerchantGoodsService {
|
|||
FileUtil fileUtil;
|
||||
@Autowired
|
||||
DateUtil dateUtil;
|
||||
|
||||
@Autowired
|
||||
IsEmptyUtil isEmptyUtil = new IsEmptyUtil();
|
||||
|
||||
/*
|
||||
* 获取全部商品
|
||||
/**
|
||||
* <p>获取全部商品</p>
|
||||
*/
|
||||
public List<SysGoods> getAllGoods(){
|
||||
return goodsMapper.findAll();
|
||||
}
|
||||
|
||||
/*
|
||||
* 通过id获取商品
|
||||
/**
|
||||
* <p>通过id获取商品</p>
|
||||
*/
|
||||
public SysGoods getGoodsById(int id){
|
||||
return goodsMapper.findById(id);
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取当前商户的商品列表
|
||||
/**
|
||||
* <p>获取当前商户的商品列表</p>
|
||||
*/
|
||||
public List<SysGoods> getMtGoods(HttpSession session,int page,int num){
|
||||
SysMt sysMt = (SysMt) session.getAttribute("merchant");
|
||||
|
@ -54,7 +54,6 @@ public class MerchantGoodsService {
|
|||
|
||||
/**
|
||||
* <p>添加商品</p>
|
||||
*
|
||||
* @return
|
||||
*-1 图片上传失败
|
||||
* 0 sql语句执行失败
|
||||
|
@ -106,7 +105,6 @@ public class MerchantGoodsService {
|
|||
|
||||
/**
|
||||
* <p>通过id值删除商品逻辑处理</p>
|
||||
*
|
||||
* @return
|
||||
*-1 删除失败
|
||||
* 1 删除成功
|
||||
|
@ -128,22 +126,22 @@ public class MerchantGoodsService {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取总页数
|
||||
/**
|
||||
* <p>获取总页数</p>
|
||||
*/
|
||||
public int getAllPage(int num,SysMt merchant){
|
||||
return (int)Math.ceil((double)goodsMapper.goodsCount(merchant.getId())/(double)num);
|
||||
}
|
||||
|
||||
/*
|
||||
* 上架商品
|
||||
/**
|
||||
* <p>上架商品</p>
|
||||
*/
|
||||
public boolean putGoods(int goodId){
|
||||
return goodsMapper.updateState(goodId, 1) == 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* 下架商品
|
||||
/**
|
||||
* <p>下架商品</p>
|
||||
*/
|
||||
public boolean OffGoods(int goodId){
|
||||
return goodsMapper.updateState(goodId, 0) == 1;
|
||||
|
@ -151,7 +149,6 @@ public class MerchantGoodsService {
|
|||
|
||||
/**
|
||||
* <p>修改商品信息</p>
|
||||
*
|
||||
* @return
|
||||
*-1 图片上传失败
|
||||
* 0 sql语句执行失败
|
||||
|
|
|
@ -21,7 +21,7 @@ public class MerchantLoginService {
|
|||
String sitrUrl;
|
||||
|
||||
/**
|
||||
* 登录逻辑处理
|
||||
* <p>登录逻辑处理</p>
|
||||
* @return
|
||||
* 0 必填信息不能为空
|
||||
*-1 邮箱或密码错误
|
||||
|
@ -46,7 +46,7 @@ public class MerchantLoginService {
|
|||
}
|
||||
|
||||
/**
|
||||
* 注册逻辑处理
|
||||
* <p>注册逻辑处理</p>
|
||||
* @return
|
||||
* 0 必填信息不能为空
|
||||
*-1 验证邮件发送失败,请重试
|
||||
|
@ -92,7 +92,7 @@ public class MerchantLoginService {
|
|||
}
|
||||
|
||||
/**
|
||||
* 验证邮件确认注册
|
||||
* <p>验证邮件确认注册</p>
|
||||
* @return int
|
||||
*-1 404页面
|
||||
* 0 网络超时请重试
|
||||
|
@ -112,8 +112,8 @@ public class MerchantLoginService {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取商户信息
|
||||
/**
|
||||
* <p>获取商户信息</p>
|
||||
*/
|
||||
public SysMt getMerchantInfo(String email){
|
||||
return mtMapper.findByEmail(email);
|
||||
|
|
|
@ -13,8 +13,8 @@ public class MerchantOrderService {
|
|||
@Autowired
|
||||
SysOrderMapper orderMapper;
|
||||
|
||||
/*
|
||||
* 获取订单信息
|
||||
/**
|
||||
* <p>获取订单信息</p>
|
||||
*/
|
||||
public List<SysOrder> getOrderList(int merchantId,int page, int num, int flag){
|
||||
switch (flag){
|
||||
|
@ -28,8 +28,8 @@ public class MerchantOrderService {
|
|||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取总页数
|
||||
/**
|
||||
* <p>获取总页数</p>
|
||||
*/
|
||||
public int getAllPage(int merchantId,int flag,int num){
|
||||
switch (flag){
|
||||
|
@ -43,8 +43,8 @@ public class MerchantOrderService {
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* 通过订单号查找
|
||||
/**
|
||||
* <p>通过订单号查找</p>
|
||||
*/
|
||||
public List<SysOrder> getOrderById(String orderId,int merchant){
|
||||
SysOrder order = orderMapper.findByOrderIdAndMt(orderId,merchant);
|
||||
|
|
|
@ -27,7 +27,6 @@ public class MerchantUiService {
|
|||
|
||||
/**
|
||||
* <p>获取当前商户的id值</p>
|
||||
*
|
||||
* @return
|
||||
* -1 无用户的session信息
|
||||
*/
|
||||
|
@ -39,15 +38,15 @@ public class MerchantUiService {
|
|||
return mtUi.getId();
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取商户用于商城首页宣传的海报图片对象
|
||||
/**
|
||||
* <p>获取商户用于商城首页宣传的海报图片对象</p>
|
||||
*/
|
||||
public SysMtUi getHomeImg(int width,int height,HttpSession session){
|
||||
return mtUiMapper.findByMark(width,height,getMtId(session));
|
||||
}
|
||||
|
||||
/*
|
||||
* 删除
|
||||
/**
|
||||
* <p>删除</p>
|
||||
*/
|
||||
public int delHomeImg(int id){
|
||||
String url = mtUiMapper.findById(id).getUrl();
|
||||
|
@ -60,8 +59,8 @@ public class MerchantUiService {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 商户商城首页的宣传海报
|
||||
/**
|
||||
* <p>商户商城首页的宣传海报</p>
|
||||
*/
|
||||
public int updateHomeImg(int width, int height, HttpSession session, MultipartFile img,RedirectAttributes redirectAttributes,
|
||||
HttpServletRequest request){
|
||||
|
@ -93,15 +92,15 @@ public class MerchantUiService {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 增加商户商城首页的宣传海报
|
||||
/**
|
||||
* <p>增加商户商城首页的宣传海报</p>
|
||||
*/
|
||||
public int addHomeImg(String url,int width, int height,int id){
|
||||
return mtUiMapper.insert(url,width,height,id);
|
||||
}
|
||||
|
||||
/*
|
||||
* 修改商户头像
|
||||
/**
|
||||
* <p>修改商户头像</p>
|
||||
*/
|
||||
public int updateHeard(RedirectAttributes redirectAttributes,HttpServletRequest request, MultipartFile img){
|
||||
// 获取商户信息
|
||||
|
|
|
@ -12,15 +12,15 @@ public class MerchantUserService {
|
|||
@Autowired
|
||||
SysUserMapper userMapper;
|
||||
|
||||
/*
|
||||
* 获取用户信息
|
||||
/**
|
||||
* <p>获取用户信息</p>
|
||||
*/
|
||||
public List<SysUser> getUserList(int page, int num){
|
||||
return userMapper.findLimit((page-1)*num,num);
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取总页数
|
||||
/**
|
||||
* <p>获取总页数</p>
|
||||
*/
|
||||
public int getAllPage(int num){
|
||||
return (int)Math.ceil((double)userMapper.userCount()/(double)num);
|
||||
|
|
|
@ -33,8 +33,8 @@ public class UserCartController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 添加至购物车
|
||||
/**
|
||||
* <p>添加至购物车</p>
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 移除购物车商品
|
||||
/**
|
||||
* <p>移除购物车商品</p>
|
||||
*/
|
||||
@RequestMapping("/user/del-cart")
|
||||
public ModelAndView delCart(ModelAndView modelAndView,int id){
|
||||
|
|
|
@ -51,6 +51,8 @@ public class UserInfoController {
|
|||
case 4:
|
||||
modelAndView.addObject("msg","两次输入的密码不一致");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
modelAndView.setViewName("redirect:/user/info");
|
||||
return modelAndView;
|
||||
|
|
|
@ -22,8 +22,9 @@ import javax.servlet.http.HttpSession;
|
|||
public class UserLoginController {
|
||||
@Autowired
|
||||
private UserLoginService service;
|
||||
/*
|
||||
* 登陆页面
|
||||
|
||||
/**
|
||||
* <p>登陆页面</p>
|
||||
*/
|
||||
@RequestMapping("login")
|
||||
public ModelAndView index(ModelAndView modelAndView){
|
||||
|
@ -31,8 +32,8 @@ public class UserLoginController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 退出登陆
|
||||
/**
|
||||
* <p>退出登陆</p>
|
||||
*/
|
||||
@RequestMapping("logout")
|
||||
public ModelAndView logout(ModelAndView modelAndView,HttpServletRequest request){
|
||||
|
@ -41,8 +42,8 @@ public class UserLoginController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 登陆请求
|
||||
/**
|
||||
* <p>登陆请求</p>
|
||||
*/
|
||||
@RequestMapping("do-login")
|
||||
public ModelAndView doLogin(HttpSession session, ModelAndView modelAndView, String email, String password){
|
||||
|
@ -64,8 +65,8 @@ public class UserLoginController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 注册请求
|
||||
/**
|
||||
* <p>注册请求</p>
|
||||
*/
|
||||
@RequestMapping("sign-up")
|
||||
public String signUp(String email,String username,String password,String repwd){
|
||||
|
@ -91,8 +92,8 @@ public class UserLoginController {
|
|||
return "网络出现错误!!";
|
||||
}
|
||||
|
||||
/*
|
||||
* 验证邮件确认注册
|
||||
/**
|
||||
* <p>验证邮件确认注册</p>
|
||||
*/
|
||||
@RequestMapping("sign-check")
|
||||
public ModelAndView singCheck(ModelAndView modelAndView,@Param("email") String email){
|
||||
|
|
|
@ -29,8 +29,8 @@ public class UserNoticeController {
|
|||
return modelAndView;
|
||||
}
|
||||
|
||||
/*
|
||||
* 删除通知信息
|
||||
/**
|
||||
* <p>删除通知信息</p>
|
||||
*/
|
||||
@RequestMapping("/user/del-notice")
|
||||
public ModelAndView delNotice(ModelAndView modelAndView,int id){
|
||||
|
|
|
@ -24,8 +24,8 @@ public class UserPayController {
|
|||
@Autowired
|
||||
SysOrderMapper orderMapper;
|
||||
|
||||
/*
|
||||
* 微信支付
|
||||
/**
|
||||
* <p>微信支付</p>
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
/*
|
||||
* 检查订单状态
|
||||
/**
|
||||
* <p>检查订单状态</p>
|
||||
*/
|
||||
@RequestMapping("/user/check-order-status")
|
||||
public boolean checkOrderStatus(String orderMark){
|
||||
|
@ -69,8 +69,8 @@ public class UserPayController {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 订单未支付,重新显示二维码给用户支付
|
||||
/**
|
||||
* <p>订单未支付,重新显示二维码给用户支付</p>
|
||||
*/
|
||||
@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";
|
||||
|
||||
}
|
||||
// /**
|
||||
// * <p>订单并发安全测试</p>
|
||||
// */
|
||||
// @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";
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 添加评论
|
||||
/**
|
||||
* <p>添加评论</p>
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 删除评论
|
||||
/**
|
||||
* <p>删除评论</p>
|
||||
*/
|
||||
@RequestMapping("/user/product/del-comment")
|
||||
public ModelAndView delComment(ModelAndView modelAndView,int id,int goods){
|
||||
|
|
|
@ -22,10 +22,13 @@ public class UserSearchController {
|
|||
|
||||
@RequestMapping("/user/search")
|
||||
public ModelAndView index(ModelAndView modelAndView,String keyword){
|
||||
// 获取返回的商品列表
|
||||
List<GoodsIndex> goodsList = searchService.esSearchGoods(keyword);
|
||||
modelAndView.addObject("goodsList",goodsList);
|
||||
// 使用mysql获取返回的商品列表
|
||||
List<SysGoods> goodsList = searchService.mysqlSearchGoods(keyword);
|
||||
|
||||
// 使用es获取返回的商品列表
|
||||
// List<GoodsIndex> goodsList = searchService.esSearchGoods(keyword);
|
||||
|
||||
modelAndView.addObject("goodsList",goodsList);
|
||||
modelAndView.setViewName("user/search/index");
|
||||
return modelAndView;
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@ public class UserShopController {
|
|||
@Autowired
|
||||
UserShopService shopService;
|
||||
|
||||
/*
|
||||
* 店铺首页
|
||||
/**
|
||||
* <p>店铺首页</p>
|
||||
*/
|
||||
@RequestMapping("/user/shop")
|
||||
public ModelAndView index(ModelAndView modelAndView,int id,@RequestParam(defaultValue = "1") int page){
|
||||
|
|
|
@ -51,8 +51,8 @@ public class UserCartService {
|
|||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* 整合购物车完整信息
|
||||
/**
|
||||
* <p>整合购物车完整信息</p>
|
||||
*/
|
||||
public List<Map> getCartList(HttpServletRequest request){
|
||||
// 获取用户信息
|
||||
|
|
|
@ -16,8 +16,8 @@ public class UserCheckOutService {
|
|||
@Autowired
|
||||
SysGoodsMapper goodsMapper;
|
||||
|
||||
/*
|
||||
* 获取商品信息
|
||||
/**
|
||||
* <p>获取商品信息</p>
|
||||
*/
|
||||
public Map<SysGoods,Integer> getGoodsInfo(String ids){
|
||||
Map<SysGoods,Integer> map = new HashMap<>();
|
||||
|
@ -28,8 +28,8 @@ public class UserCheckOutService {
|
|||
return map;
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取总金额
|
||||
/**
|
||||
* <p>获取总金额</p>
|
||||
*/
|
||||
public BigDecimal getGoodsNumPrice(Map<SysGoods,Integer> goodsMap){
|
||||
BigDecimal allPrice = new BigDecimal(0.00);
|
||||
|
@ -39,8 +39,8 @@ public class UserCheckOutService {
|
|||
return allPrice;
|
||||
}
|
||||
|
||||
/*
|
||||
* 将前端发送的ids字符串切割为哈希表
|
||||
/**
|
||||
* <p>将前端发送的ids字符串切割为哈希表</p>
|
||||
*/
|
||||
public Map<Integer,Integer> getIdsMap(String ids){
|
||||
String[] idsAndNumArray = ids.split(",");
|
||||
|
@ -54,8 +54,8 @@ public class UserCheckOutService {
|
|||
return map;
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取对应的cart id
|
||||
/**
|
||||
* <p>获取对应的cart id</p>
|
||||
*/
|
||||
public List<Integer> getCartIds(String ids){
|
||||
String[] idsAndNumArray = ids.split(",");
|
||||
|
|
|
@ -28,8 +28,8 @@ public class UserHomeService {
|
|||
@Autowired
|
||||
SysMtUiMapper mtUiMapper;
|
||||
|
||||
/*
|
||||
* 设置缓存 十分钟内有效
|
||||
/**
|
||||
* <p>设置缓存 十分钟内有效</p>
|
||||
*/
|
||||
public void setHomeCache(ModelAndView modelAndView){
|
||||
redisTemplate.opsForHash().put("homePageCache","imgMap",modelAndView.getModelMap().get("imgMap"));
|
||||
|
|
|
@ -31,7 +31,6 @@ public class UserInfoService {
|
|||
|
||||
/**
|
||||
* <p>修改用户信息</p>
|
||||
*
|
||||
* @return
|
||||
*-1 修改信息失败
|
||||
* 1 修改信息成功
|
||||
|
|
|
@ -24,8 +24,8 @@ public class UserLoginService {
|
|||
@Autowired
|
||||
RedisTemplate redisTemplate;
|
||||
|
||||
// 判空工具类
|
||||
IsEmptyUtil isEmptyUtil = IsEmptyUtil.getInstance();
|
||||
|
||||
/**
|
||||
* <p>登陆验证逻辑处理</p>
|
||||
* @return int
|
||||
|
@ -53,8 +53,8 @@ public class UserLoginService {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 返回用户信息
|
||||
/**
|
||||
* <p>返回用户信息</p>
|
||||
*/
|
||||
public SysUser userInfo(String email){
|
||||
return service.getUserInfo(email);
|
||||
|
@ -115,7 +115,7 @@ public class UserLoginService {
|
|||
}
|
||||
|
||||
/**
|
||||
* 验证邮件确认注册
|
||||
* <p>验证邮件确认注册</p>
|
||||
* @return int
|
||||
*-1 404页面
|
||||
* 0 网络超时请重试
|
||||
|
|
|
@ -17,15 +17,15 @@ public class UserOrderService {
|
|||
@Autowired
|
||||
SysGoodsMapper goodsMapper;
|
||||
|
||||
/*
|
||||
* 获取用户订单
|
||||
/**
|
||||
* <p>获取用户订单</p>
|
||||
*/
|
||||
public List<SysOrder> getOrderList(int userId,int page,int num){
|
||||
return orderMapper.findByUser(userId,(page-1)*num,num);
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取订单中的商品信息
|
||||
/**
|
||||
* <p>获取订单中的商品信息</p>
|
||||
*/
|
||||
public List<SysGoods> getGoodsList(List<SysOrder> orderList){
|
||||
List<SysGoods> list = new ArrayList<>();
|
||||
|
@ -35,8 +35,8 @@ public class UserOrderService {
|
|||
return list;
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取总页数
|
||||
/**
|
||||
* <p>获取总页数</p>
|
||||
*/
|
||||
public int getAllPage(int userId,int num){
|
||||
return (int)Math.ceil((double)orderMapper.orderCountByUser(userId)/(double)num);
|
||||
|
|
|
@ -22,8 +22,8 @@ public class UserProductService {
|
|||
@Autowired
|
||||
SysUserMapper userMapper;
|
||||
|
||||
/*
|
||||
* 整合用户信息和评论信息
|
||||
/**
|
||||
* <p>整合用户信息和评论信息</p>
|
||||
*/
|
||||
public List<Map> getCommentList(int goods, int page, int num){
|
||||
List<SysComment> commentInfo = getCommentInfo(goods,page,num);
|
||||
|
@ -44,16 +44,16 @@ public class UserProductService {
|
|||
return list;
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取当前商品总评论页数
|
||||
/**
|
||||
* <p>获取当前商品总评论页数</p>
|
||||
*/
|
||||
public int getAllCountPage(int goods,int num){
|
||||
int count = commentMapper.getAllCountByGoods(goods);
|
||||
return (int)Math.ceil((double)count/(double)num);
|
||||
}
|
||||
|
||||
/*
|
||||
* 通过id值获取商品对象
|
||||
/**
|
||||
* <p>通过id值获取商品对象</p>
|
||||
*/
|
||||
public SysGoods getGoods(int id){
|
||||
return goodsMapper.findById(id);
|
||||
|
@ -61,7 +61,6 @@ public class UserProductService {
|
|||
|
||||
/**
|
||||
* <p>获取商品评论列表</p>
|
||||
*
|
||||
* @param goods 商品id
|
||||
* @param page 评论的页数
|
||||
* @param num 一页评论的条数
|
||||
|
@ -70,8 +69,8 @@ public class UserProductService {
|
|||
return commentMapper.findByGoodsLimit(goods,(page-1)*num,page*num);
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取评论对应的商户信息
|
||||
/**
|
||||
* <p>获取评论对应的商户信息</p>
|
||||
*/
|
||||
public SysUser getUserInfo(int userId){
|
||||
return userMapper.selectById(userId);
|
||||
|
@ -79,13 +78,9 @@ public class UserProductService {
|
|||
|
||||
/**
|
||||
* <p>添加商品评论</p>
|
||||
*
|
||||
* @return
|
||||
*-1 添加失败
|
||||
* 1 添加成功
|
||||
*
|
||||
* @author Bosen
|
||||
* 2020/11/28 14:32
|
||||
*/
|
||||
public int addComment(int goodsId,int merchant,String context,HttpServletRequest request){
|
||||
// 获取发表评论的用户信息
|
||||
|
|
|
@ -20,7 +20,7 @@ public class UserSearchService {
|
|||
/**
|
||||
* <p>mysql通过关键字模糊查找商品</p>
|
||||
*/
|
||||
public List<SysGoods> searchGoods(String keyword){
|
||||
public List<SysGoods> mysqlSearchGoods(String keyword){
|
||||
return goodsMapper.search(keyword);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,15 +18,15 @@ public class UserShopService {
|
|||
@Autowired
|
||||
SysGoodsMapper goodsMapper;
|
||||
|
||||
/*
|
||||
* 获取商户信息
|
||||
/**
|
||||
* <p>获取商户信息</p>
|
||||
*/
|
||||
public SysMt getMerchantInfo(int merchantId){
|
||||
return merchantMapper.findById(merchantId);
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取商户商品信息
|
||||
/**
|
||||
* <p>获取商户商品信息</p>
|
||||
*/
|
||||
public Map<Integer,SysGoods> getGoodsList(int merchantId, int page, int num){
|
||||
List<SysGoods> list = goodsMapper.findByMtLimit(merchantId,(page-1)*num,page*num);
|
||||
|
@ -37,8 +37,8 @@ public class UserShopService {
|
|||
return map;
|
||||
}
|
||||
|
||||
/*
|
||||
* 随机获取商品
|
||||
/**
|
||||
* <p>随机获取商品</p>
|
||||
*/
|
||||
public Map<Integer,SysGoods> getRandGoodsMap(int merchant,int num){
|
||||
List<SysGoods> list = goodsMapper.findMerchantRand(merchant,num);
|
||||
|
@ -49,8 +49,8 @@ public class UserShopService {
|
|||
return map;
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取总页数
|
||||
/**
|
||||
* <p>获取总页数</p>
|
||||
*/
|
||||
public int getAllPage(int merchantId,int num){
|
||||
int all = goodsMapper.countByMerchant(merchantId);
|
||||
|
|
|
@ -63,8 +63,7 @@ public class WxPayService {
|
|||
}
|
||||
|
||||
/**
|
||||
* 添加订单
|
||||
*
|
||||
* <p>添加订单</p>
|
||||
* @return
|
||||
*-1 sql语句执行失败
|
||||
* 0 必填信息不能为空
|
||||
|
@ -114,16 +113,16 @@ public class WxPayService {
|
|||
return wxCodeUrl(mark,allPrice);
|
||||
}
|
||||
|
||||
/*
|
||||
* 分割js传递的数组
|
||||
/**
|
||||
* <p>分割js传递的数组</p>
|
||||
*/
|
||||
public String[] getStringArray(String array){
|
||||
List<String> list = new ArrayList<>();
|
||||
return array.split(",");
|
||||
}
|
||||
|
||||
/*
|
||||
* 总金额运算
|
||||
/**
|
||||
* <p>总金额运算</p>
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
/*
|
||||
* 生成二维码
|
||||
/**
|
||||
* <p>生成二维码</p>
|
||||
*/
|
||||
public String wxCodeUrl(String orderMark,String price){
|
||||
Map<String, String> data = new HashMap<>();
|
||||
|
@ -164,10 +163,8 @@ public class WxPayService {
|
|||
return codeUrl;
|
||||
}
|
||||
|
||||
/*
|
||||
* 生成订单号
|
||||
*
|
||||
* 由三位字母十四位的日期数六位随机数组成
|
||||
/**
|
||||
* <p>生成订单号</p>
|
||||
*/
|
||||
public String getOrderId(){
|
||||
String s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
@ -193,7 +190,7 @@ public class WxPayService {
|
|||
}
|
||||
|
||||
/**
|
||||
* 微信支付异步通知验证签名
|
||||
* <p>微信支付异步通知验证签名</p>
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
|
@ -231,8 +228,7 @@ public class WxPayService {
|
|||
}
|
||||
|
||||
/**
|
||||
* 从流中读取微信返回的xml数据
|
||||
*
|
||||
* <p>从流中读取微信返回的xml数据</p>
|
||||
* @param httpServletRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
|
@ -255,8 +251,7 @@ public class WxPayService {
|
|||
}
|
||||
|
||||
/**
|
||||
* 设置返回给微信服务器的xml信息
|
||||
*
|
||||
* <p>设置返回给微信服务器的xml信息</p>
|
||||
* @param returnCode
|
||||
* @param returnMsg
|
||||
* @return
|
||||
|
|
Loading…
Reference in New Issue