规范代码和注释规范

master
Bosen 2021-08-09 23:27:58 +08:00
parent 171f0e5089
commit 8354d0b7dc
78 changed files with 650 additions and 1138 deletions

View File

@ -12,10 +12,15 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling; 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 @SpringBootApplication
@ServletComponentScan @ServletComponentScan
@EnableScheduling// 定时任务 @EnableScheduling
public class JieyueApplication extends SpringBootServletInitializer { public class JieyueApplication extends SpringBootServletInitializer {
public static void main(String[] args) { public static void main(String[] args) {
@ -27,8 +32,8 @@ public class JieyueApplication extends SpringBootServletInitializer {
return builder.sources(JieyueApplication.class); return builder.sources(JieyueApplication.class);
} }
/* /**
* * <p></p>
*/ */
@Bean @Bean
public TomcatServletWebServerFactory containerFactory() { public TomcatServletWebServerFactory containerFactory() {

View File

@ -22,8 +22,11 @@ public class AdminHomeController {
@Autowired @Autowired
SysUserMapper userMapper; SysUserMapper userMapper;
/**
* <p></p>
*/
@RequestMapping("/admin/home") @RequestMapping("/admin/home")
public ModelAndView index(ModelAndView modelAndView){ public ModelAndView index(ModelAndView modelAndView) {
float profit = orderMapper.websiteProfitCount(); float profit = orderMapper.websiteProfitCount();
int orderCount = orderMapper.payCount(); int orderCount = orderMapper.payCount();
int goodsCount = goodsMapper.allGoodsCount(); int goodsCount = goodsMapper.allGoodsCount();

View File

@ -8,7 +8,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
/** /**
@ -21,8 +20,9 @@ import javax.servlet.http.HttpSession;
public class AdminLoginController { public class AdminLoginController {
@Autowired @Autowired
AdminLoginService service; AdminLoginService service;
/*
* /**
* <p></p>
*/ */
@RequestMapping({"login",""}) @RequestMapping({"login",""})
public ModelAndView index(ModelAndView modelAndView){ public ModelAndView index(ModelAndView modelAndView){
@ -30,11 +30,11 @@ public class AdminLoginController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("do-login") @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); int result = service.doLogin(email,password);
if (result==1){ if (result==1){
// 登陆成功 // 登陆成功
@ -57,22 +57,22 @@ public class AdminLoginController {
} }
return modelAndView; return modelAndView;
} }
/* /**
* 退 * <p>退</p>
*/ */
@RequestMapping("logout") @RequestMapping("logout")
public ModelAndView logout(ModelAndView modelAndView,HttpSession session){ public ModelAndView logout(ModelAndView modelAndView, HttpSession session){
session.setAttribute("merchant",null); session.setAttribute("merchant",null);
modelAndView.setViewName("redirect:/admin/login"); modelAndView.setViewName("redirect:/admin/login");
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("sign-up") @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); int result = service.singup(email,name,password);
if (result==0){ if (result==0){
return "必填信息不能为空!"; return "必填信息不能为空!";
@ -95,11 +95,11 @@ public class AdminLoginController {
return null; return null;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("sign-check") @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); int res = service.singCheck(email);
if (res==-1){ if (res==-1){
modelAndView.setViewName("redirect:/error"); modelAndView.setViewName("redirect:/error");

View File

@ -24,8 +24,11 @@ public class AdminMerchantController {
@Autowired @Autowired
SysMtMapper merchantMapper; SysMtMapper merchantMapper;
/**
* <p></p>
*/
@RequestMapping("") @RequestMapping("")
public ModelAndView index(ModelAndView modelAndView, HttpServletRequest request){ public ModelAndView index(ModelAndView modelAndView, HttpServletRequest request) {
modelAndView.setViewName("/admin/merchant/index"); modelAndView.setViewName("/admin/merchant/index");
int pageSize = 10; int pageSize = 10;
@ -33,22 +36,22 @@ public class AdminMerchantController {
int num = 1; int num = 1;
int preNum = 1; int preNum = 1;
int nextNum = 1; int nextNum = 1;
if (request.getParameter("num")!=null){ if (request.getParameter("num")!=null) {
num = Integer.parseInt(request.getParameter("num")); num = Integer.parseInt(request.getParameter("num"));
} }
if (num <= 1){ if (num <= 1) {
preNum = 1; preNum = 1;
nextNum = 2; nextNum = 2;
}else{ }else{
preNum = num-1; preNum = num - 1;
if (num>=pageCount-1){ if (num>=pageCount - 1) {
nextNum = pageCount; nextNum = pageCount;
}else{ }else{
nextNum = num+1; nextNum = num+1;
} }
} }
List<SysMt> mtList = merchantService.getMtInfo(num,pageSize); List<SysMt> mtList = merchantService.getMtInfo(num,pageSize);
if (mtList.size()<=10){ if (mtList.size() <= 10) {
nextNum = num; nextNum = num;
} }
modelAndView.addObject("mtList",mtList); modelAndView.addObject("mtList",mtList);
@ -60,14 +63,17 @@ public class AdminMerchantController {
return modelAndView; return modelAndView;
} }
/**
* <p></p>
*/
@RequestMapping("update-ratio") @RequestMapping("update-ratio")
public ModelAndView updateRatio(ModelAndView modelAndView,String ratio,int id){ public ModelAndView updateRatio(ModelAndView modelAndView,String ratio,int id) {
try { try {
float ratioFloat = Float.valueOf(ratio); float ratioFloat = Float.valueOf(ratio);
if (ratioFloat > 1.0 || ratioFloat < 0.1 || !checkFloat(ratioFloat)){ if (ratioFloat > 1.0 || ratioFloat < 0.1 || !checkFloat(ratioFloat)){
modelAndView.addObject("msg","费率应在0.1~1.0之间(一位小数)"); modelAndView.addObject("msg","费率应在0.1~1.0之间(一位小数)");
}else{ }else{
if (merchantMapper.updateRatio(id,ratioFloat)==1){ if (merchantMapper.updateRatio(id,ratioFloat) == 1){
modelAndView.addObject("msg","修改成功"); modelAndView.addObject("msg","修改成功");
}else{ }else{
modelAndView.addObject("msg","修改失败"); modelAndView.addObject("msg","修改失败");
@ -81,11 +87,11 @@ public class AdminMerchantController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("delete-merchant") @RequestMapping("delete-merchant")
public ModelAndView deleteMerchant(ModelAndView modelAndView,int id){ public ModelAndView deleteMerchant(ModelAndView modelAndView,int id) {
if (merchantService.deleteMerchant(id)==1){ if (merchantService.deleteMerchant(id)==1){
modelAndView.addObject("msg","删除商户成功!"); modelAndView.addObject("msg","删除商户成功!");
}else{ }else{
@ -95,11 +101,11 @@ public class AdminMerchantController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("update-merchant") @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){ if (merchantService.updateMerchantState(email,state)==1){
modelAndView.addObject("msg","操作成功!"); modelAndView.addObject("msg","操作成功!");
}else{ }else{
@ -109,8 +115,8 @@ public class AdminMerchantController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
public boolean checkFloat(float ratio){ public boolean checkFloat(float ratio){
char[] c = String.valueOf(ratio).split(".")[1].toCharArray(); char[] c = String.valueOf(ratio).split(".")[1].toCharArray();

View File

@ -7,6 +7,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:24
*/
@RestController @RestController
public class AdminNoticeController { public class AdminNoticeController {
@Autowired @Autowired
@ -15,20 +20,25 @@ public class AdminNoticeController {
IsEmptyUtil isEmptyUtil; IsEmptyUtil isEmptyUtil;
@RequestMapping("/admin/notice") @RequestMapping("/admin/notice")
public ModelAndView index(ModelAndView modelAndView){ public ModelAndView index(ModelAndView modelAndView) {
modelAndView.setViewName("admin/notice/index"); modelAndView.setViewName("admin/notice/index");
return modelAndView; return modelAndView;
} }
/* /**
* redis * <p> redis</p>
*/ */
@RequestMapping("/admin/send-notice") @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)){ if (isEmptyUtil.strings(title,context)){
modelAndView.addObject("msg","必填信息不能为空"); modelAndView.addObject("msg","必填信息不能为空");
}else{ }else{
noticeService.sendByRabbitMQ(title,context,type); // 发送至redis
noticeService.sendByRedis(title, context, type);
// 发送至RabbitMQ
// noticeService.sendByRabbitMQ(title, context, type);
modelAndView.addObject("msg","系统消息发送成功"); modelAndView.addObject("msg","系统消息发送成功");
} }
modelAndView.setViewName("redirect:/admin/notice"); modelAndView.setViewName("redirect:/admin/notice");

View File

@ -21,7 +21,7 @@ public class AdminOrderController {
AdminOrderService orderService; AdminOrderService orderService;
@RequestMapping("/admin/order") @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); List<SysOrder> orderList = orderService.getOrderList(page,18,flag);
modelAndView.addObject("orderList",orderList); modelAndView.addObject("orderList",orderList);
@ -37,7 +37,7 @@ public class AdminOrderController {
} }
@RequestMapping("/admin/search-order") @RequestMapping("/admin/search-order")
public ModelAndView searchOrder(ModelAndView modelAndView,String order){ public ModelAndView searchOrder(ModelAndView modelAndView,String order) {
// 获取订单信息 // 获取订单信息
List<SysOrder> orderList = orderService.getOrderById(order); List<SysOrder> orderList = orderService.getOrderById(order);
modelAndView.addObject("orderList",orderList); modelAndView.addObject("orderList",orderList);

View File

@ -10,11 +10,15 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* <p>RBAC</p>
* @author Bosen
* @date 2021/8/9 23:20
*/
@RestController @RestController
public class AdminRbacController { public class AdminRbacController {
@Autowired @Autowired
@ -55,23 +59,27 @@ public class AdminRbacController {
return modelAndView; return modelAndView;
} }
/**
* <p></p>
*/
@RequestMapping("/admin/alert") @RequestMapping("/admin/alert")
public ModelAndView adminAlert(ModelAndView modelAndView) { public ModelAndView adminAlert(ModelAndView modelAndView) {
modelAndView.setViewName("admin/rbac/alert"); modelAndView.setViewName("admin/rbac/alert");
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/admin/rbac/update-admin-role") @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"); modelAndView.setViewName("redirect:/admin/rbac");
if (role == 0) { if (role == 0) {
modelAndView.addObject("msg","未对管理员角色进行修改"); modelAndView.addObject("msg","未对管理员角色进行修改");
return modelAndView; return modelAndView;
} }
int sql = 0;// sql执行结果接收变量 // sql执行结果接收变量
int sql = 0;
if (adminRoleMapper.countByAdminId(admin) == 0) { if (adminRoleMapper.countByAdminId(admin) == 0) {
// 此管理员还未设置角色 // 此管理员还未设置角色
sql = adminRoleMapper.insert(admin, role); sql = adminRoleMapper.insert(admin, role);
@ -87,8 +95,8 @@ public class AdminRbacController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/admin/add-role") @RequestMapping("/admin/add-role")
public ModelAndView addRole(ModelAndView modelAndView,String name){ public ModelAndView addRole(ModelAndView modelAndView,String name){
@ -107,8 +115,8 @@ public class AdminRbacController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/admin/add-access") @RequestMapping("/admin/add-access")
public ModelAndView addAccess(ModelAndView modelAndView,String name,String url){ public ModelAndView addAccess(ModelAndView modelAndView,String name,String url){
@ -164,11 +172,11 @@ public class AdminRbacController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/admin/off-admin") @RequestMapping("/admin/off-admin")
public ModelAndView offAdmin(ModelAndView modelAndView,int id){ public ModelAndView offAdmin(ModelAndView modelAndView, int id){
modelAndView.setViewName("redirect:/admin/rbac"); modelAndView.setViewName("redirect:/admin/rbac");
if (id==1){ if (id==1){
modelAndView.addObject("无法停用此管理员!"); modelAndView.addObject("无法停用此管理员!");
@ -182,8 +190,8 @@ public class AdminRbacController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/admin/on-admin") @RequestMapping("/admin/on-admin")
public ModelAndView onAdmin(ModelAndView modelAndView,int id){ public ModelAndView onAdmin(ModelAndView modelAndView,int id){
@ -196,8 +204,8 @@ public class AdminRbacController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/admin/off-role") @RequestMapping("/admin/off-role")
public ModelAndView offRole(ModelAndView modelAndView,int id){ public ModelAndView offRole(ModelAndView modelAndView,int id){
@ -210,8 +218,8 @@ public class AdminRbacController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/admin/on-role") @RequestMapping("/admin/on-role")
public ModelAndView onRole(ModelAndView modelAndView,int id){ public ModelAndView onRole(ModelAndView modelAndView,int id){
@ -224,8 +232,8 @@ public class AdminRbacController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/admin/on-access") @RequestMapping("/admin/on-access")
public ModelAndView onAccess(ModelAndView modelAndView,int id){ public ModelAndView onAccess(ModelAndView modelAndView,int id){
@ -238,8 +246,8 @@ public class AdminRbacController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/admin/off-access") @RequestMapping("/admin/off-access")
public ModelAndView offAccess(ModelAndView modelAndView,int id){ public ModelAndView offAccess(ModelAndView modelAndView,int id){
@ -252,8 +260,8 @@ public class AdminRbacController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/admin/update-access") @RequestMapping("/admin/update-access")
public ModelAndView updateAccess(ModelAndView modelAndView,int id,String name,String url){ public ModelAndView updateAccess(ModelAndView modelAndView,int id,String name,String url){
@ -266,8 +274,8 @@ public class AdminRbacController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/admin/role-access") @RequestMapping("/admin/role-access")
public ModelAndView roleAccessIndex(ModelAndView modelAndView,int id){ public ModelAndView roleAccessIndex(ModelAndView modelAndView,int id){
@ -290,8 +298,8 @@ public class AdminRbacController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/admin/role-access/action") @RequestMapping("/admin/role-access/action")
public ModelAndView action(ModelAndView modelAndView,int role,int ... ids){ public ModelAndView action(ModelAndView modelAndView,int role,int ... ids){

View File

@ -35,8 +35,6 @@ public class AdminUiController {
/** /**
* <p></p> * <p></p>
* @author Bosen
* 2020/11/5 18:56
*/ */
@RequestMapping("/admin/up-image") @RequestMapping("/admin/up-image")
public ModelAndView upImage(ModelAndView modelAndView, MultipartFile file, RedirectAttributes redirectAttributes, HttpServletRequest request,int width,int height){ public ModelAndView upImage(ModelAndView modelAndView, MultipartFile file, RedirectAttributes redirectAttributes, HttpServletRequest request,int width,int height){
@ -55,8 +53,8 @@ public class AdminUiController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/admin/del-image") @RequestMapping("/admin/del-image")
public ModelAndView delImg(ModelAndView modelAndView,int width,int height){ public ModelAndView delImg(ModelAndView modelAndView,int width,int height){

View File

@ -10,6 +10,11 @@ import org.springframework.web.servlet.ModelAndView;
import java.util.List; import java.util.List;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:34
*/
@RestController @RestController
public class AdminUserController { public class AdminUserController {
@Autowired @Autowired

View File

@ -1,17 +1,14 @@
package com.example.jieyue.admin.service; package com.example.jieyue.admin.service;
import com.example.jieyue.common.entity.SysAdmin; 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.SysAdminMapper;
import com.example.jieyue.common.mapper.SysAdminRoleMapper; import com.example.jieyue.common.mapper.SysAdminRoleMapper;
import com.example.jieyue.common.service.MailService; import com.example.jieyue.common.service.MailService;
import com.example.jieyue.common.service.SysUserService;
import com.example.jieyue.common.utils.IsEmptyUtil; import com.example.jieyue.common.utils.IsEmptyUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.DigestUtils; import org.springframework.util.DigestUtils;
/** /**
@ -23,15 +20,18 @@ import org.springframework.util.DigestUtils;
public class AdminLoginService { public class AdminLoginService {
@Autowired @Autowired
SysAdminMapper adminMapper; SysAdminMapper adminMapper;
@Autowired @Autowired
MailService mailService; MailService mailService;
@Autowired @Autowired
SysAdminRoleMapper adminRoleMapper; SysAdminRoleMapper adminRoleMapper;
@Value("${site-url}") @Value("${site-url}")
String sitrUrl; String sitrUrl;
// 判空工具类
IsEmptyUtil isEmptyUtil = IsEmptyUtil.getInstance(); IsEmptyUtil isEmptyUtil = IsEmptyUtil.getInstance();
/** /**
* <p></p> * <p></p>
* @return int * @return int
@ -59,8 +59,8 @@ public class AdminLoginService {
} }
} }
/* /**
* * <p></p>
*/ */
public SysAdmin adminInfo(String email){ public SysAdmin adminInfo(String email){
return adminMapper.getAdminInfo(email); return adminMapper.getAdminInfo(email);

View File

@ -11,9 +11,9 @@ import java.util.List;
public class AdminMerchantService { public class AdminMerchantService {
@Autowired @Autowired
SysMtMapper mtMapper; SysMtMapper mtMapper;
/** /**
* <p></p> * <p></p>
*
* @param curPage * @param curPage
* @param pageSize * @param pageSize
*/ */
@ -22,8 +22,8 @@ public class AdminMerchantService {
return mtMapper.findPage(curRow,pageSize); return mtMapper.findPage(curRow,pageSize);
} }
/* /**
* * <p></p>
*/ */
public int deleteMerchant(int merchantId){ public int deleteMerchant(int merchantId){
if (mtMapper.deleteById(merchantId)==1){ if (mtMapper.deleteById(merchantId)==1){
@ -32,8 +32,8 @@ public class AdminMerchantService {
return -1; return -1;
} }
/* /**
* * <p></p>
*/ */
public int updateMerchantState(String email,int state){ public int updateMerchantState(String email,int state){
if (mtMapper.updateState(email,state)==1){ if (mtMapper.updateState(email,state)==1){
@ -42,8 +42,8 @@ public class AdminMerchantService {
return -1; return -1;
} }
/* /**
* * <p></p>
*/ */
public int getMtPage(int pageSize){ public int getMtPage(int pageSize){
if (mtMapper.count()==0){ if (mtMapper.count()==0){
@ -52,8 +52,4 @@ public class AdminMerchantService {
return (int)Math.ceil((double)mtMapper.count()/pageSize); return (int)Math.ceil((double)mtMapper.count()/pageSize);
} }
} }
public int updateRatio(float ratio,int id){
return 1;
}
} }

View File

@ -34,8 +34,8 @@ public class AdminNoticeService {
@Autowired @Autowired
RabbitTemplate rabbitTemplate; RabbitTemplate rabbitTemplate;
/* /**
* redis * <p>redis</p>
*/ */
public void sendByRedis(String title,String context,int type){ public void sendByRedis(String title,String context,int type){
Map<String,String> map = new HashMap<>(); Map<String,String> map = new HashMap<>();
@ -73,9 +73,14 @@ public class AdminNoticeService {
redisTemplate.opsForList().leftPush("notice",map); redisTemplate.opsForList().leftPush("notice",map);
} }
break; break;
default:
break;
} }
} }
/**
* <p>rabbitMQ</p>
*/
public void sendByRabbitMQ(String title,String context,int type){ public void sendByRabbitMQ(String title,String context,int type){
switch (type){ switch (type){
case 0: case 0:

View File

@ -13,23 +13,28 @@ public class AdminOrderService {
@Autowired @Autowired
SysOrderMapper orderMapper; SysOrderMapper orderMapper;
/* /**
* * <p></p>
*/ */
public List<SysOrder> getOrderList(int page,int num,int flag){ public List<SysOrder> getOrderList(int page,int num,int flag){
switch (flag){ switch (flag){
case 0:// 未支付 // 未支付
case 0:
return orderMapper.findNotPayLimit((page-1)*num,num); return orderMapper.findNotPayLimit((page-1)*num,num);
case 1:// 已支付 // 已支付
case 1:
return orderMapper.findPayLimit((page-1)*num,num); return orderMapper.findPayLimit((page-1)*num,num);
case 2:// 全部订单 // 全部订单
case 2:
return orderMapper.findLimit((page-1)*num,num); return orderMapper.findLimit((page-1)*num,num);
default:
break;
} }
return null; return null;
} }
/* /**
* * <p></p>
*/ */
public List<SysOrder> getOrderById(String orderId){ public List<SysOrder> getOrderById(String orderId){
SysOrder order = orderMapper.findByOrderId(orderId); SysOrder order = orderMapper.findByOrderId(orderId);
@ -40,8 +45,8 @@ public class AdminOrderService {
return list; return list;
} }
/* /**
* * <p></p>
*/ */
public int getAllPage(int flag,int num){ public int getAllPage(int flag,int num){
switch (flag){ switch (flag){
@ -53,6 +58,8 @@ public class AdminOrderService {
return (int)Math.ceil((double)orderMapper.orderCount()/(double)num); return (int)Math.ceil((double)orderMapper.orderCount()/(double)num);
case 3: case 3:
return 1; return 1;
default:
break;
} }
return 1; return 1;
} }

View File

@ -13,19 +13,7 @@ public class AdminRbacService {
SysRoleAccessMapper roleAccessMapper; SysRoleAccessMapper roleAccessMapper;
/** /**
* <p></p> * <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;
}
/*
*
*/ */
@Transactional @Transactional
public boolean setRoleAccess(int role,int[] ids){ public boolean setRoleAccess(int role,int[] ids){
@ -39,6 +27,4 @@ public class AdminRbacService {
} }
return true; return true;
} }
} }

View File

@ -19,15 +19,15 @@ public class AdminUiService {
DateUtil dateUtil; DateUtil dateUtil;
@Autowired @Autowired
SysUiMapper uiMapper; SysUiMapper uiMapper;
/** /**
* * <p></p>
*
* @return * @return
* null * null
* *
*/ */
public String upImage(MultipartFile file,RedirectAttributes redirectAttributes, public String upImage(MultipartFile file, RedirectAttributes redirectAttributes,
HttpServletRequest request,String url,int weight,int height) { HttpServletRequest request, String url,int weight,int height) {
// 设置filename 文件名由年月日时分秒以及六位随机数组成 // 设置filename 文件名由年月日时分秒以及六位随机数组成
String filename = dateUtil.getNMDHIS()+Math.round(Math.random()*(999999-100000)+100000); 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){ public boolean delImg(int width,int height){
if (uiMapper.findByMark(width,height)==null){ if (uiMapper.findByMark(width,height)==null){
@ -71,10 +71,8 @@ public class AdminUiService {
int delResult = uiMapper.deleteByMark(width,height); int delResult = uiMapper.deleteByMark(width,height);
if (delResult == 1) { if (delResult == 1) {
return true; return true;
} else {
// sql语句执行失败
return false;
} }
return false;
} }
} }
} }

View File

@ -12,15 +12,15 @@ public class AdminUserService {
@Autowired @Autowired
SysUserMapper userMapper; SysUserMapper userMapper;
/* /**
* * <p></p>
*/ */
public List<SysUser> getUserList(int page, int num){ public List<SysUser> getUserList(int page, int num){
return userMapper.findLimit((page-1)*num,num); return userMapper.findLimit((page-1)*num,num);
} }
/* /**
* * <p></p>
*/ */
public int getAllPage(int num){ public int getAllPage(int num){
return (int)Math.ceil((double)userMapper.userCount()/(double)num); return (int)Math.ceil((double)userMapper.userCount()/(double)num);

View File

@ -1,17 +1,11 @@
package com.example.jieyue.common.component; 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.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**

View File

@ -10,11 +10,14 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:40
*/
@Component @Component
public class RBACHandlerInterceptor implements HandlerInterceptor { public class RBACHandlerInterceptor implements HandlerInterceptor {
private static SysAdminMapper adminMapper;
private static SysRoleMapper roleMapper; private static SysRoleMapper roleMapper;
private static SysAccessMapper accessMapper; private static SysAccessMapper accessMapper;
@ -23,11 +26,6 @@ public class RBACHandlerInterceptor implements HandlerInterceptor {
private static SysRoleAccessMapper roleAccessMapper; private static SysRoleAccessMapper roleAccessMapper;
@Autowired
public void setAdminMapper(SysAdminMapper adminMapper) {
RBACHandlerInterceptor.adminMapper = adminMapper;
}
@Autowired @Autowired
public void setRoleMapper(SysRoleMapper roleMapper) { public void setRoleMapper(SysRoleMapper roleMapper) {
RBACHandlerInterceptor.roleMapper = roleMapper; RBACHandlerInterceptor.roleMapper = roleMapper;
@ -69,8 +67,9 @@ public class RBACHandlerInterceptor implements HandlerInterceptor {
} }
return true; return true;
} }
/*
* /**
* <p></p>
*/ */
public boolean checkRbac(HttpServletRequest request) { public boolean checkRbac(HttpServletRequest request) {
try { try {

View File

@ -21,9 +21,7 @@ public class AdminWebMvcConfigurer implements WebMvcConfigurer {
@Override @Override
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
/* // 登录拦截
* 访
*/
registry.addInterceptor(new LoginHandlerInterceptor()) registry.addInterceptor(new LoginHandlerInterceptor())
.addPathPatterns("/admin/**") .addPathPatterns("/admin/**")
.excludePathPatterns( .excludePathPatterns(
@ -31,6 +29,8 @@ public class AdminWebMvcConfigurer implements WebMvcConfigurer {
"/css/**","/js/**","/image/**","/fonts/**","/mapping/**","/data/**", "/css/**","/js/**","/image/**","/fonts/**","/mapping/**","/data/**",
"/lib/*/*/**" "/lib/*/*/**"
); );
// 权限拦截
registry.addInterceptor(new RBACHandlerInterceptor()) registry.addInterceptor(new RBACHandlerInterceptor())
.addPathPatterns("/admin/**") .addPathPatterns("/admin/**")
.excludePathPatterns( .excludePathPatterns(

View File

@ -20,9 +20,7 @@ public class MerchantWebMvcConfigurer implements WebMvcConfigurer {
@Override @Override
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
/* // 登录拦截
* 访
*/
registry.addInterceptor(new LoginHandlerInterceptor()) registry.addInterceptor(new LoginHandlerInterceptor())
.addPathPatterns("/mer*/**") .addPathPatterns("/mer*/**")
.excludePathPatterns( .excludePathPatterns(

View File

@ -8,6 +8,10 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.sql.DataSource; import javax.sql.DataSource;
/**
* @author Bosen
* @date 2021/8/9 22:42
*/
@EnableTransactionManagement @EnableTransactionManagement
@Configuration @Configuration
public class TransactionManagerConfiguration { public class TransactionManagerConfiguration {

View File

@ -20,9 +20,7 @@ public class UserWebMvcConfigurer implements WebMvcConfigurer {
@Override @Override
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
/* // 登录拦截
* 访
*/
registry.addInterceptor(new LoginHandlerInterceptor()) registry.addInterceptor(new LoginHandlerInterceptor())
.addPathPatterns("/user/**") .addPathPatterns("/user/**")
.excludePathPatterns( .excludePathPatterns(

View File

@ -1,8 +0,0 @@
package com.example.jieyue.common.controller;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class TestController {
}

View File

@ -1,40 +1,20 @@
package com.example.jieyue.common.entity; 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 { public class SysAccess {
private int id; private int id;
private String name; private String name;
private String url; private String url;
private int status; 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;
}
} }

View File

@ -1,60 +1,21 @@
package com.example.jieyue.common.entity; 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 { public class SysAdmin {
private int id; private int id;
private String name; private String name;
private String password; private String password;
private String email; private String email;
private int mark; 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;
}
} }

View File

@ -1,40 +1,20 @@
package com.example.jieyue.common.entity; 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 { public class SysAdminRole {
private int id; private int id;
private int adminId; private int adminId;
private int roleId; private int roleId;
private int status; 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;
}
} }

View File

@ -1,40 +1,20 @@
package com.example.jieyue.common.entity; 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 { public class SysCart {
private int id; private int id;
private int goodsId; private int goodsId;
private int userId; private int userId;
private int goodsNum; 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;
}
} }

View File

@ -1,5 +1,17 @@
package com.example.jieyue.common.entity; 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 { public class SysComment {
private int id; private int id;
private int user; private int user;
@ -7,52 +19,4 @@ public class SysComment {
private int merchant; private int merchant;
private String context; private String context;
private long createTime; 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;
}
} }

View File

@ -1,7 +1,19 @@
package com.example.jieyue.common.entity; package com.example.jieyue.common.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal; import java.math.BigDecimal;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:46
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SysGoods { public class SysGoods {
private int id; private int id;
private String name; private String name;
@ -11,81 +23,4 @@ public class SysGoods {
private int state; private int state;
private int merchant; private int merchant;
private int stock; 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;
}
} }

View File

@ -1,5 +1,17 @@
package com.example.jieyue.common.entity; 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 { public class SysMt {
private int id; private int id;
private String name; private String name;
@ -8,60 +20,4 @@ public class SysMt {
private float ratio; private float ratio;
private int state; private int state;
private String header; 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;
}
} }

View File

@ -1,61 +1,21 @@
package com.example.jieyue.common.entity; 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 { public class SysMtUi {
private int id; private int id;
private String url; private String url;
private int width; private int width;
private int height; private int height;
private int merchant; 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;
}
} }

View File

@ -6,6 +6,11 @@ import lombok.NoArgsConstructor;
import java.io.Serializable; import java.io.Serializable;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:46
*/
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@Data @Data
@ -16,52 +21,4 @@ public class SysNotice implements Serializable {
private String context; private String context;
private int receive; private int receive;
private long createTime; 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;
}
} }

View File

@ -1,7 +1,19 @@
package com.example.jieyue.common.entity; package com.example.jieyue.common.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal; import java.math.BigDecimal;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:46
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SysOrder { public class SysOrder {
private int id; private int id;
private String orderId; private String orderId;
@ -22,166 +34,5 @@ public class SysOrder {
private String payCodeUrl; private String payCodeUrl;
private int cartId; private int cartId;
private float merchantRatio; 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; private String userPhone;
} }

View File

@ -1,31 +1,19 @@
package com.example.jieyue.common.entity; 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 { public class SysRole {
private int id; private int id;
private String name; private String name;
private int status; 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;
}
} }

View File

@ -1,40 +1,20 @@
package com.example.jieyue.common.entity; 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 { public class SysRoleAccess {
private int id; private int id;
private int roleId; private int roleId;
private int accessId; private int accessId;
private int status; 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;
}
} }

View File

@ -1,35 +1,20 @@
package com.example.jieyue.common.entity; 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 { public class SysUi {
private int id; private int id;
private String url; private String url;
private int width; private int width;
private int height; 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;
}
} }

View File

@ -1,5 +1,17 @@
package com.example.jieyue.common.entity; 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 { public class SysUser {
private int id; private int id;
private String username; private String username;
@ -7,64 +19,4 @@ public class SysUser {
private String email; private String email;
private int mark; private int mark;
private String header; 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;
}
} }

View File

@ -9,12 +9,19 @@ import java.util.List;
@Repository @Repository
public interface SysAdminMapper { public interface SysAdminMapper {
List<SysAdmin> findAll(); List<SysAdmin> findAll();
int insert(@Param("name") String name, @Param("password") String password, int insert(@Param("name") String name, @Param("password") String password,
@Param("email") String email, @Param("mark") int mark); @Param("email") String email, @Param("mark") int mark);
SysAdmin selectByEmail(String email); SysAdmin selectByEmail(String email);
SysAdmin getAdminInfo(String email); SysAdmin getAdminInfo(String email);
int deleteById(int id); int deleteById(int id);
int updateMark(int mark,String email); int updateMark(int mark,String email);
int updateMarkById(int id,int mark); int updateMarkById(int id,int mark);
int update(String name,String password,String email); int update(String name,String password,String email);
} }

View File

@ -9,7 +9,9 @@ import java.util.List;
@Repository @Repository
public interface SysCommentMapper { public interface SysCommentMapper {
SysComment findById(int id); SysComment findById(int id);
int getAllCountByGoods(int id); int getAllCountByGoods(int id);
int getAllCountByMt(int merchant); int getAllCountByMt(int merchant);
List<SysComment> findByGoodsLimit(int goods,int preNum,int sufNum); List<SysComment> findByGoodsLimit(int goods,int preNum,int sufNum);

View File

@ -9,24 +9,44 @@ import java.util.List;
@Repository @Repository
public interface SysGoodsMapper { public interface SysGoodsMapper {
SysGoods findById(int id); SysGoods findById(int id);
List<SysGoods> findByMt(int merchant); List<SysGoods> findByMt(int merchant);
List<SysGoods> findByMtLimit(int merchant,int preNum,int sufNum); List<SysGoods> findByMtLimit(int merchant,int preNum,int sufNum);
List<SysGoods> findAll(); List<SysGoods> findAll();
List<SysGoods> findLimitByMt(int merchant,int preNum,int sufNum); List<SysGoods> findLimitByMt(int merchant,int preNum,int sufNum);
List<SysGoods> findAllEsc(int num); List<SysGoods> findAllEsc(int num);
List<SysGoods> findRand(int num); List<SysGoods> findRand(int num);
List<SysGoods> findMerchantRand(int merchant,int num); List<SysGoods> findMerchantRand(int merchant,int num);
List<SysGoods> findAllDesc(int num); List<SysGoods> findAllDesc(int num);
List<SysGoods> search(String keyword); List<SysGoods> search(String keyword);
int goodsCount(int merchant); int goodsCount(int merchant);
int allGoodsCount(); int allGoodsCount();
int countByMerchant(int merchant); int countByMerchant(int merchant);
int deleteById(int id); int deleteById(int id);
int addStock(int id,int stock); int addStock(int id,int stock);
int delStock(int id,int stock); int delStock(int id,int stock);
int updateState(int id,int state); int updateState(int id,int state);
int updateGoods1(String name,String describe,BigDecimal price,int merchant,int stock,int id); 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 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 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); int insert2(String name, String describe, BigDecimal price, int merchant,int stock, String img);
} }

View File

@ -9,13 +9,17 @@ import java.util.List;
@Repository @Repository
public interface SysMtMapper { public interface SysMtMapper {
int insert(String name,String email,String password,float ratio,int state); int insert(String name,String email,String password,float ratio,int state);
SysMt findByEmail(String email); SysMt findByEmail(String email);
SysMt findById(int id); SysMt findById(int id);
int count(); int count();
List<SysMt> findPage(int curRow,int pageSize); List<SysMt> findPage(int curRow,int pageSize);
List<SysMt> findAll(); List<SysMt> findAll();
int deleteById(int id); int deleteById(int id);
int updateRatio(int id,float ratio); int updateRatio(int id,float ratio);
@ -25,7 +29,6 @@ public interface SysMtMapper {
int updateHeader(int id,String header); int updateHeader(int id,String header);
int update(String name,String password,String email); int update(String name,String password,String email);
// todo
int updateName(String name);
int updateName(String name);
} }

View File

@ -8,10 +8,16 @@ import java.util.List;
@Repository @Repository
public interface SysMtUiMapper { public interface SysMtUiMapper {
SysMtUi findByMark(int width, int height, int merchant); SysMtUi findByMark(int width, int height, int merchant);
SysMtUi findById(int id); SysMtUi findById(int id);
List<SysMtUi> findLimit(int width, int height, int num); List<SysMtUi> findLimit(int width, int height, int num);
int updateUrl(String url, int width, int height,int merchant); int updateUrl(String url, int width, int height,int merchant);
int insert(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 deleteByMark(int width, int height,int merchant);
int deleteById(int id); int deleteById(int id);
} }

View File

@ -9,28 +9,43 @@ import java.util.List;
@Repository @Repository
public interface SysOrderMapper { public interface SysOrderMapper {
List<SysOrder> findLimit(int preNum,int sufNum); List<SysOrder> findLimit(int preNum,int sufNum);
List<SysOrder> findPayLimit(int preNum,int sufNum); List<SysOrder> findPayLimit(int preNum,int sufNum);
List<SysOrder> findNotPayLimit(int preNum,int sufNum); List<SysOrder> findNotPayLimit(int preNum,int sufNum);
List<SysOrder> findLimitByMt(int merchantId,int preNum,int sufNum); List<SysOrder> findLimitByMt(int merchantId,int preNum,int sufNum);
List<SysOrder> findPayLimitByMt(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> findNotPayLimitByMt(int merchantId,int preNum,int sufNum);
List<SysOrder> findAll(); List<SysOrder> findAll();
List<SysOrder> findByUser(int user,int preNum,int sufNum); List<SysOrder> findByUser(int user,int preNum,int sufNum);
List<SysOrder> findByMerchant(int merchant,int num); List<SysOrder> findByMerchant(int merchant,int num);
List<SysOrder> findByState(int state); List<SysOrder> findByState(int state);
SysOrder findByOrderId(String orderId); SysOrder findByOrderId(String orderId);
SysOrder findByOrderIdAndMt(String orderId,int merchant); SysOrder findByOrderIdAndMt(String orderId,int merchant);
List<SysOrder> findByOrderMark(String orderMark); List<SysOrder> findByOrderMark(String orderMark);
int orderCount(); int orderCount();
int payCount(); int payCount();
int notPayCount(); int notPayCount();
int orderCountByUser(int userId); int orderCountByUser(int userId);
int orderCountByMt(int merchantId); int orderCountByMt(int merchantId);
int payCountByMt(int merchantId); int payCountByMt(int merchantId);
int notPayCountByMt(int merchantId); int notPayCountByMt(int merchantId);
// 修改订单状态 // 修改订单状态
@ -50,5 +65,6 @@ public interface SysOrderMapper {
// 收益 // 收益
float websiteProfitCount(); float websiteProfitCount();
Float merchantProfitCount(int merchantId); Float merchantProfitCount(int merchantId);
} }

View File

@ -6,7 +6,10 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface SysUiMapper { public interface SysUiMapper {
SysUi findByMark(int width,int height); SysUi findByMark(int width,int height);
int updateUrl(String url,int width,int height); int updateUrl(String url,int width,int height);
int insert(String url,int width,int height); int insert(String url,int width,int height);
int deleteByMark(int width,int height); int deleteByMark(int width,int height);
} }

View File

@ -9,15 +9,25 @@ import java.util.List;
@Repository @Repository
public interface SysUserMapper { public interface SysUserMapper {
SysUser selectById(int id); SysUser selectById(int id);
List<SysUser> findLimit(int preNum,int sufNum); List<SysUser> findLimit(int preNum,int sufNum);
int userCount(); int userCount();
List<SysUser> findAll(); List<SysUser> findAll();
List<Integer> getAllId(); List<Integer> getAllId();
int insert(@Param("username") String username,@Param("password") String password, int insert(@Param("username") String username,@Param("password") String password,
@Param("email") String email,@Param("mark") int mark); @Param("email") String email,@Param("mark") int mark);
SysUser selectByEmail(String email); SysUser selectByEmail(String email);
SysUser getUserInfo(String email); SysUser getUserInfo(String email);
int updateMark(int mark,String email); int updateMark(int mark,String email);
int update(String username,String password,String email); int update(String username,String password,String email);
int updateById(String username,String password,String header,String email,int id); int updateById(String username,String password,String header,String email,int id);
} }

View File

@ -21,19 +21,19 @@ public class MailService {
private final Logger logger = LoggerFactory.getLogger(this.getClass()); private final Logger logger = LoggerFactory.getLogger(this.getClass());
/** /**
* Spring Boot 使使 * <p>Spring Boot 使使</p>
*/ */
@Autowired @Autowired
private JavaMailSender mailSender; private JavaMailSender mailSender;
/** /**
* qq * <p>qq</p>
*/ */
@Value("${spring.mail.from}") @Value("${spring.mail.from}")
private String from; private String from;
/** /**
* * <p></p>
* @param to * @param to
* @param subject * @param subject
* @param content * @param content
@ -54,7 +54,7 @@ public class MailService {
} }
/** /**
* html * <p>html</p>
* @param to * @param to
* @param subject * @param subject
* @param content * @param content
@ -85,7 +85,7 @@ public class MailService {
} }
/** /**
* * <p></p>
* @param to * @param to
* @param subject * @param subject
* @param content * @param content
@ -111,8 +111,8 @@ public class MailService {
} }
} }
/* /**
* * <p></p>
*/ */
public boolean checkEmail(String email){ public boolean checkEmail(String email){
String check = "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$"; String check = "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$";

View File

@ -7,6 +7,10 @@ import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
/**
* @author Bosen
* @date 2021/8/9 22:51
*/
@Service @Service
public class SysUserService { public class SysUserService {
@Autowired @Autowired

View File

@ -37,8 +37,8 @@ public class SchedulerTask {
@Autowired @Autowired
MailService mailService; MailService mailService;
/* /**
* * <p></p>
*/ */
@Scheduled(cron="0 0/1 * * * ?") @Scheduled(cron="0 0/1 * * * ?")
@Transactional @Transactional
@ -57,8 +57,8 @@ public class SchedulerTask {
} }
} }
/* /**
* * <p></p>
*/ */
@Scheduled(cron="0 0/1 * * * ?") @Scheduled(cron="0 0/1 * * * ?")
public void delQRCode(){ public void delQRCode(){
@ -71,8 +71,8 @@ public class SchedulerTask {
} }
} }
/* /**
* * <p>redis</p>
*/ */
@Scheduled(cron="0 0/1 * * * ?") @Scheduled(cron="0 0/1 * * * ?")
public void sendNotice(){ public void sendNotice(){
@ -93,12 +93,14 @@ public class SchedulerTask {
case 2: case 2:
noticeMapper.insert(title,context,type,receive,createTime); noticeMapper.insert(title,context,type,receive,createTime);
break; break;
default:
break;
} }
} }
} }
/* /**
* * <p></p>
*/ */
@Scheduled(cron="0 0/1 * * * ?") @Scheduled(cron="0 0/1 * * * ?")
public void sendEmail(){ public void sendEmail(){
@ -107,5 +109,4 @@ public class SchedulerTask {
mailService.sendHtmlMail(map.get("email"),map.get("title"),map.get("context")); mailService.sendHtmlMail(map.get("email"),map.get("title"),map.get("context"));
} }
} }
} }

View File

@ -12,8 +12,8 @@ import java.util.Date;
*/ */
@Component @Component
public class DateUtil { public class DateUtil {
/* /**
* * <p></p>
*/ */
public String getNMDHIS(){ public String getNMDHIS(){
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");

View File

@ -25,8 +25,7 @@ public class FileUtil {
} }
/** /**
* * <p></p>
*
* @return * @return
* null * null
* *
@ -59,8 +58,8 @@ public class FileUtil {
return url+filename+"."+suffix; return url+filename+"."+suffix;
} }
/* /**
* * <p></p>
*/ */
public String getSuffixName(String filename){ public String getSuffixName(String filename){
String[] strArray = filename.split("\\."); String[] strArray = filename.split("\\.");
@ -68,8 +67,8 @@ public class FileUtil {
return strArray[suffixIndex]; return strArray[suffixIndex];
} }
/* /**
* * <p></p>
*/ */
public void deleteFile(String url){ public void deleteFile(String url){
File file1 = new File(classpath+url); File file1 = new File(classpath+url);

View File

@ -9,8 +9,9 @@ import org.springframework.stereotype.Component;
*/ */
@Component @Component
public class IsEmptyUtil { public class IsEmptyUtil {
/*
* /**
* <p></p>
*/ */
private static class IsEmptyUtilHoler{ private static class IsEmptyUtilHoler{
private static IsEmptyUtil INSTANCE = new IsEmptyUtil(); private static IsEmptyUtil INSTANCE = new IsEmptyUtil();
@ -20,8 +21,8 @@ public class IsEmptyUtil {
return IsEmptyUtilHoler.INSTANCE; return IsEmptyUtilHoler.INSTANCE;
} }
/* /**
* ,true * <p>,true</p>
*/ */
public boolean strings(String ... strings){ public boolean strings(String ... strings){
for (String string : strings) { for (String string : strings) {
@ -32,8 +33,8 @@ public class IsEmptyUtil {
return false; return false;
} }
/* /**
* * <p></p>
*/ */
public boolean string(String string){ public boolean string(String string){
if (string==null || string.equals("")){ if (string==null || string.equals("")){
@ -43,8 +44,8 @@ public class IsEmptyUtil {
} }
} }
/* /**
* * <p></p>
*/ */
public boolean object(Object object){ public boolean object(Object object){
if (object==null){ if (object==null){
@ -54,8 +55,8 @@ public class IsEmptyUtil {
} }
} }
/* /**
* ,nulltrue * <p>,nulltrue</p>
*/ */
public boolean objects(Object ... objects){ public boolean objects(Object ... objects){
for (Object object : objects) { for (Object object : objects) {

View File

@ -6,9 +6,9 @@ import org.springframework.stereotype.Component;
@Component @Component
public class JsonUtil { public class JsonUtil {
/** /**
* *
* todo
*/ */
public int[] jsonToIntArray(String json){ public int[] jsonToIntArray(String json){
JSONArray jsonArray = JSON.parseArray(json); JSONArray jsonArray = JSON.parseArray(json);

View File

@ -2,7 +2,6 @@ package com.example.jieyue.merchant.controller;
import com.example.jieyue.common.entity.SysGoods; import com.example.jieyue.common.entity.SysGoods;
import com.example.jieyue.common.entity.SysMt; import com.example.jieyue.common.entity.SysMt;
import com.example.jieyue.common.mapper.SysGoodsMapper;
import com.example.jieyue.merchant.service.MerchantGoodsService; import com.example.jieyue.merchant.service.MerchantGoodsService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -27,8 +26,8 @@ public class MerchantGoodsController {
@Autowired @Autowired
MerchantGoodsService goodsService; MerchantGoodsService goodsService;
/* /**
* * <p></p>
*/ */
@RequestMapping("/merchant/goods") @RequestMapping("/merchant/goods")
public ModelAndView index(ModelAndView modelAndView, HttpSession session, @RequestParam(defaultValue = "1")int page){ public ModelAndView index(ModelAndView modelAndView, HttpSession session, @RequestParam(defaultValue = "1")int page){
@ -44,8 +43,8 @@ public class MerchantGoodsController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/merchant/add-goods") @RequestMapping("/merchant/add-goods")
public ModelAndView addGoods(ModelAndView modelAndView, String name, String describe, public ModelAndView addGoods(ModelAndView modelAndView, String name, String describe,
@ -82,13 +81,15 @@ public class MerchantGoodsController {
case 2: case 2:
modelAndView.addObject("msg","必填信息不能为空"); modelAndView.addObject("msg","必填信息不能为空");
break; break;
default:
break;
} }
modelAndView.setViewName("redirect:goods"); modelAndView.setViewName("redirect:goods");
return modelAndView; return modelAndView;
} }
/* /**
* id * <p>id</p>
*/ */
@RequestMapping("/merchant/del-goods") @RequestMapping("/merchant/del-goods")
public ModelAndView delGoods(ModelAndView modelAndView,int id){ public ModelAndView delGoods(ModelAndView modelAndView,int id){
@ -102,8 +103,8 @@ public class MerchantGoodsController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/merchant/put-goods") @RequestMapping("/merchant/put-goods")
public ModelAndView putGoods(ModelAndView modelAndView,int id){ public ModelAndView putGoods(ModelAndView modelAndView,int id){
@ -116,8 +117,8 @@ public class MerchantGoodsController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/merchant/off-goods") @RequestMapping("/merchant/off-goods")
public ModelAndView OffGoods(ModelAndView modelAndView,int id){ public ModelAndView OffGoods(ModelAndView modelAndView,int id){
@ -130,8 +131,8 @@ public class MerchantGoodsController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/merchant/update-goods") @RequestMapping("/merchant/update-goods")
public ModelAndView updateGoods(ModelAndView modelAndView, String name, String describe, public ModelAndView updateGoods(ModelAndView modelAndView, String name, String describe,
@ -152,7 +153,6 @@ public class MerchantGoodsController {
modelAndView.setViewName("redirect:goods"); modelAndView.setViewName("redirect:goods");
return modelAndView; return modelAndView;
} }
// 修改商品信息 // 修改商品信息
int res = goodsService.updateGoods(name, describe,priceRes,img,redirectAttributes,stockTemp,request,id); int res = goodsService.updateGoods(name, describe,priceRes,img,redirectAttributes,stockTemp,request,id);
switch (res){ switch (res){
@ -168,8 +168,9 @@ public class MerchantGoodsController {
case 2: case 2:
modelAndView.addObject("msg","必填信息不能为空"); modelAndView.addObject("msg","必填信息不能为空");
break; break;
default:
break;
} }
modelAndView.setViewName("redirect:goods"); modelAndView.setViewName("redirect:goods");
return modelAndView; return modelAndView;
} }

View File

@ -28,8 +28,8 @@ public class MerchantLoginController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("do-login") @RequestMapping("do-login")
public ModelAndView doLogin(ModelAndView modelAndView, String email, String password, HttpSession session){ public ModelAndView doLogin(ModelAndView modelAndView, String email, String password, HttpSession session){
@ -52,13 +52,15 @@ public class MerchantLoginController {
} }
session.setAttribute("merchant",merchant); session.setAttribute("merchant",merchant);
break; break;
default:
break;
} }
modelAndView.setViewName("redirect:/merchant/home"); modelAndView.setViewName("redirect:/merchant/home");
return modelAndView; return modelAndView;
} }
/* /**
* 退 * <p>退</p>
*/ */
@RequestMapping("logout") @RequestMapping("logout")
public ModelAndView logout(ModelAndView modelAndView,HttpServletRequest request){ public ModelAndView logout(ModelAndView modelAndView,HttpServletRequest request){
@ -67,8 +69,8 @@ public class MerchantLoginController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("sign-up") @RequestMapping("sign-up")
public String signUp(String email,String name,String password){ public String signUp(String email,String name,String password){
@ -84,12 +86,14 @@ public class MerchantLoginController {
return "该邮箱已被注册"; return "该邮箱已被注册";
case 3: case 3:
return "邮箱格式不正确"; return "邮箱格式不正确";
default:
break;
} }
return null; return null;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("sign-check") @RequestMapping("sign-check")
public ModelAndView singCheck(ModelAndView modelAndView,String email){ public ModelAndView singCheck(ModelAndView modelAndView,String email){
@ -106,6 +110,8 @@ public class MerchantLoginController {
modelAndView.setViewName("redirect:/merchant/login"); modelAndView.setViewName("redirect:/merchant/login");
modelAndView.addObject("msg","注册成功,请等待管理员的审核"); modelAndView.addObject("msg","注册成功,请等待管理员的审核");
break; break;
default:
break;
} }
return modelAndView; return modelAndView;
} }

View File

@ -1,6 +1,5 @@
package com.example.jieyue.merchant.controller; package com.example.jieyue.merchant.controller;
import com.example.jieyue.common.entity.SysMt;
import com.example.jieyue.common.entity.SysMtUi; import com.example.jieyue.common.entity.SysMtUi;
import com.example.jieyue.merchant.service.MerchantUiService; import com.example.jieyue.merchant.service.MerchantUiService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -34,8 +33,8 @@ public class MerchantUiController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/merchant/del-home-img") @RequestMapping("/merchant/del-home-img")
public ModelAndView delHomeImg(ModelAndView modelAndView,int id){ public ModelAndView delHomeImg(ModelAndView modelAndView,int id){
@ -47,13 +46,15 @@ public class MerchantUiController {
case 0: case 0:
modelAndView.addObject("msg","图片删除失败"); modelAndView.addObject("msg","图片删除失败");
break; break;
default:
break;
} }
modelAndView.setViewName("redirect:ui"); modelAndView.setViewName("redirect:ui");
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/merchant/update-home-img") @RequestMapping("/merchant/update-home-img")
public ModelAndView updateHomeImg(ModelAndView modelAndView, HttpServletRequest request, MultipartFile img, RedirectAttributes redirectAttributes,int width,int height){ public ModelAndView updateHomeImg(ModelAndView modelAndView, HttpServletRequest request, MultipartFile img, RedirectAttributes redirectAttributes,int width,int height){
@ -66,13 +67,15 @@ public class MerchantUiController {
case 0: case 0:
modelAndView.addObject("msg","图片修改失败"); modelAndView.addObject("msg","图片修改失败");
break; break;
default:
break;
} }
modelAndView.setViewName("redirect:ui"); modelAndView.setViewName("redirect:ui");
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/merchant/update-header") @RequestMapping("/merchant/update-header")
public ModelAndView updateHeader(RedirectAttributes redirectAttributes,HttpServletRequest request,ModelAndView modelAndView,MultipartFile img){ public ModelAndView updateHeader(RedirectAttributes redirectAttributes,HttpServletRequest request,ModelAndView modelAndView,MultipartFile img){

View File

@ -27,25 +27,25 @@ public class MerchantGoodsService {
FileUtil fileUtil; FileUtil fileUtil;
@Autowired @Autowired
DateUtil dateUtil; DateUtil dateUtil;
@Autowired
IsEmptyUtil isEmptyUtil = new IsEmptyUtil(); IsEmptyUtil isEmptyUtil = new IsEmptyUtil();
/* /**
* * <p></p>
*/ */
public List<SysGoods> getAllGoods(){ public List<SysGoods> getAllGoods(){
return goodsMapper.findAll(); return goodsMapper.findAll();
} }
/* /**
* id * <p>id</p>
*/ */
public SysGoods getGoodsById(int id){ public SysGoods getGoodsById(int id){
return goodsMapper.findById(id); return goodsMapper.findById(id);
} }
/* /**
* * <p></p>
*/ */
public List<SysGoods> getMtGoods(HttpSession session,int page,int num){ public List<SysGoods> getMtGoods(HttpSession session,int page,int num){
SysMt sysMt = (SysMt) session.getAttribute("merchant"); SysMt sysMt = (SysMt) session.getAttribute("merchant");
@ -54,7 +54,6 @@ public class MerchantGoodsService {
/** /**
* <p></p> * <p></p>
*
* @return * @return
*-1 *-1
* 0 sql * 0 sql
@ -106,7 +105,6 @@ public class MerchantGoodsService {
/** /**
* <p>id</p> * <p>id</p>
*
* @return * @return
*-1 *-1
* 1 * 1
@ -128,22 +126,22 @@ public class MerchantGoodsService {
} }
} }
/* /**
* * <p></p>
*/ */
public int getAllPage(int num,SysMt merchant){ public int getAllPage(int num,SysMt merchant){
return (int)Math.ceil((double)goodsMapper.goodsCount(merchant.getId())/(double)num); return (int)Math.ceil((double)goodsMapper.goodsCount(merchant.getId())/(double)num);
} }
/* /**
* * <p></p>
*/ */
public boolean putGoods(int goodId){ public boolean putGoods(int goodId){
return goodsMapper.updateState(goodId, 1) == 1; return goodsMapper.updateState(goodId, 1) == 1;
} }
/* /**
* * <p></p>
*/ */
public boolean OffGoods(int goodId){ public boolean OffGoods(int goodId){
return goodsMapper.updateState(goodId, 0) == 1; return goodsMapper.updateState(goodId, 0) == 1;
@ -151,7 +149,6 @@ public class MerchantGoodsService {
/** /**
* <p></p> * <p></p>
*
* @return * @return
*-1 *-1
* 0 sql * 0 sql

View File

@ -21,7 +21,7 @@ public class MerchantLoginService {
String sitrUrl; String sitrUrl;
/** /**
* * <p></p>
* @return * @return
* 0 * 0
*-1 *-1
@ -46,7 +46,7 @@ public class MerchantLoginService {
} }
/** /**
* * <p></p>
* @return * @return
* 0 * 0
*-1 *-1
@ -92,7 +92,7 @@ public class MerchantLoginService {
} }
/** /**
* * <p></p>
* @return int * @return int
*-1 404 *-1 404
* 0 * 0
@ -112,8 +112,8 @@ public class MerchantLoginService {
} }
} }
/* /**
* * <p></p>
*/ */
public SysMt getMerchantInfo(String email){ public SysMt getMerchantInfo(String email){
return mtMapper.findByEmail(email); return mtMapper.findByEmail(email);

View File

@ -13,8 +13,8 @@ public class MerchantOrderService {
@Autowired @Autowired
SysOrderMapper orderMapper; SysOrderMapper orderMapper;
/* /**
* * <p></p>
*/ */
public List<SysOrder> getOrderList(int merchantId,int page, int num, int flag){ public List<SysOrder> getOrderList(int merchantId,int page, int num, int flag){
switch (flag){ switch (flag){
@ -28,8 +28,8 @@ public class MerchantOrderService {
return null; return null;
} }
/* /**
* * <p></p>
*/ */
public int getAllPage(int merchantId,int flag,int num){ public int getAllPage(int merchantId,int flag,int num){
switch (flag){ switch (flag){
@ -43,8 +43,8 @@ public class MerchantOrderService {
return 1; return 1;
} }
/* /**
* * <p></p>
*/ */
public List<SysOrder> getOrderById(String orderId,int merchant){ public List<SysOrder> getOrderById(String orderId,int merchant){
SysOrder order = orderMapper.findByOrderIdAndMt(orderId,merchant); SysOrder order = orderMapper.findByOrderIdAndMt(orderId,merchant);

View File

@ -27,7 +27,6 @@ public class MerchantUiService {
/** /**
* <p>id</p> * <p>id</p>
*
* @return * @return
* -1 session * -1 session
*/ */
@ -39,15 +38,15 @@ public class MerchantUiService {
return mtUi.getId(); return mtUi.getId();
} }
/* /**
* * <p></p>
*/ */
public SysMtUi getHomeImg(int width,int height,HttpSession session){ public SysMtUi getHomeImg(int width,int height,HttpSession session){
return mtUiMapper.findByMark(width,height,getMtId(session)); return mtUiMapper.findByMark(width,height,getMtId(session));
} }
/* /**
* * <p></p>
*/ */
public int delHomeImg(int id){ public int delHomeImg(int id){
String url = mtUiMapper.findById(id).getUrl(); 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, public int updateHomeImg(int width, int height, HttpSession session, MultipartFile img,RedirectAttributes redirectAttributes,
HttpServletRequest request){ HttpServletRequest request){
@ -93,15 +92,15 @@ public class MerchantUiService {
} }
} }
/* /**
* * <p></p>
*/ */
public int addHomeImg(String url,int width, int height,int id){ public int addHomeImg(String url,int width, int height,int id){
return mtUiMapper.insert(url,width,height,id); return mtUiMapper.insert(url,width,height,id);
} }
/* /**
* * <p></p>
*/ */
public int updateHeard(RedirectAttributes redirectAttributes,HttpServletRequest request, MultipartFile img){ public int updateHeard(RedirectAttributes redirectAttributes,HttpServletRequest request, MultipartFile img){
// 获取商户信息 // 获取商户信息

View File

@ -12,15 +12,15 @@ public class MerchantUserService {
@Autowired @Autowired
SysUserMapper userMapper; SysUserMapper userMapper;
/* /**
* * <p></p>
*/ */
public List<SysUser> getUserList(int page, int num){ public List<SysUser> getUserList(int page, int num){
return userMapper.findLimit((page-1)*num,num); return userMapper.findLimit((page-1)*num,num);
} }
/* /**
* * <p></p>
*/ */
public int getAllPage(int num){ public int getAllPage(int num){
return (int)Math.ceil((double)userMapper.userCount()/(double)num); return (int)Math.ceil((double)userMapper.userCount()/(double)num);

View File

@ -33,8 +33,8 @@ public class UserCartController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/user/add-cart") @RequestMapping("/user/add-cart")
public ModelAndView addCart(ModelAndView modelAndView, String id, @RequestParam(defaultValue = "1") int num, HttpServletRequest request){ public ModelAndView addCart(ModelAndView modelAndView, String id, @RequestParam(defaultValue = "1") int num, HttpServletRequest request){
@ -56,8 +56,8 @@ public class UserCartController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/user/del-cart") @RequestMapping("/user/del-cart")
public ModelAndView delCart(ModelAndView modelAndView,int id){ public ModelAndView delCart(ModelAndView modelAndView,int id){

View File

@ -51,6 +51,8 @@ public class UserInfoController {
case 4: case 4:
modelAndView.addObject("msg","两次输入的密码不一致"); modelAndView.addObject("msg","两次输入的密码不一致");
break; break;
default:
break;
} }
modelAndView.setViewName("redirect:/user/info"); modelAndView.setViewName("redirect:/user/info");
return modelAndView; return modelAndView;

View File

@ -22,8 +22,9 @@ import javax.servlet.http.HttpSession;
public class UserLoginController { public class UserLoginController {
@Autowired @Autowired
private UserLoginService service; private UserLoginService service;
/*
* /**
* <p></p>
*/ */
@RequestMapping("login") @RequestMapping("login")
public ModelAndView index(ModelAndView modelAndView){ public ModelAndView index(ModelAndView modelAndView){
@ -31,8 +32,8 @@ public class UserLoginController {
return modelAndView; return modelAndView;
} }
/* /**
* 退 * <p>退</p>
*/ */
@RequestMapping("logout") @RequestMapping("logout")
public ModelAndView logout(ModelAndView modelAndView,HttpServletRequest request){ public ModelAndView logout(ModelAndView modelAndView,HttpServletRequest request){
@ -41,8 +42,8 @@ public class UserLoginController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("do-login") @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){
@ -64,8 +65,8 @@ public class UserLoginController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("sign-up") @RequestMapping("sign-up")
public String signUp(String email,String username,String password,String repwd){ public String signUp(String email,String username,String password,String repwd){
@ -91,8 +92,8 @@ public class UserLoginController {
return "网络出现错误!!"; return "网络出现错误!!";
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("sign-check") @RequestMapping("sign-check")
public ModelAndView singCheck(ModelAndView modelAndView,@Param("email") String email){ public ModelAndView singCheck(ModelAndView modelAndView,@Param("email") String email){

View File

@ -29,8 +29,8 @@ public class UserNoticeController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/user/del-notice") @RequestMapping("/user/del-notice")
public ModelAndView delNotice(ModelAndView modelAndView,int id){ public ModelAndView delNotice(ModelAndView modelAndView,int id){

View File

@ -24,8 +24,8 @@ public class UserPayController {
@Autowired @Autowired
SysOrderMapper orderMapper; SysOrderMapper orderMapper;
/* /**
* * <p></p>
*/ */
@RequestMapping("/user/pay/wx") @RequestMapping("/user/pay/wx")
public ModelAndView wx(ModelAndView modelAndView, String nums, String users, String merchants, String goods, String prices, 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); return wxPayService.wxNotify(request);
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/user/check-order-status") @RequestMapping("/user/check-order-status")
public boolean checkOrderStatus(String orderMark){ public boolean checkOrderStatus(String orderMark){
@ -69,8 +69,8 @@ public class UserPayController {
} }
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/user/wxpay/index") @RequestMapping("/user/wxpay/index")
public ModelAndView wxNotify(ModelAndView modelAndView,String mark) { public ModelAndView wxNotify(ModelAndView modelAndView,String mark) {
@ -83,42 +83,41 @@ public class UserPayController {
return modelAndView; return modelAndView;
} }
/* // /**
* // * <p>订单并发安全测试</p>
*/ // */
@Autowired // @Autowired
SysGoodsMapper goodsMapper; // SysGoodsMapper goodsMapper;
@Autowired // @Autowired
SysMtMapper merchantMapper; // SysMtMapper merchantMapper;
@RequestMapping("/user/pay/test") // @RequestMapping("/user/pay/test")
@Transactional // @Transactional
public String test() { // public String test() {
// 用于测试商品的id值 // // 用于测试商品的id值
int goodsId = 44; // int goodsId = 44;
SysGoods goods = goodsMapper.findById(goodsId); // SysGoods goods = goodsMapper.findById(goodsId);
if (goods.getStock() > 0){ // if (goods.getStock() > 0){
// 生成orderMark // // 生成orderMark
String orderMark = wxPayService.getOrderId(); // String orderMark = wxPayService.getOrderId();
// 生成订单号 // // 生成订单号
String orderId = wxPayService.getOrderId(); // String orderId = wxPayService.getOrderId();
// 获取商户信息 // // 获取商户信息
SysMt merchant = merchantMapper.findById(goods.getMerchant()); // SysMt merchant = merchantMapper.findById(goods.getMerchant());
// 执行sql语句 // // 执行sql语句
int sql = orderMapper.insert1(orderId, System.currentTimeMillis(), 1, orderMark, 99, // int sql = orderMapper.insert1(orderId, System.currentTimeMillis(), 1, orderMark, 99,
goods.getMerchant(), goods.getPrice(), goodsId, "test", "test", // goods.getMerchant(), goods.getPrice(), goodsId, "test", "test",
"test", "123456", "test", 0,merchant.getRatio()); // "test", "123456", "test", 0,merchant.getRatio());
//
// 将商品库存做相应的减少 // // 将商品库存做相应的减少
int delStock = goodsMapper.delStock(goodsId,1); // int delStock = goodsMapper.delStock(goodsId,1);
//
// 库存检查,库存少于零时回滚 // // 库存检查,库存少于零时回滚
if (sql != 1 || delStock != 1 || goodsMapper.findById(goodsId).getStock() < 0){ // if (sql != 1 || delStock != 1 || goodsMapper.findById(goodsId).getStock() < 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
} // }
//
return "SUCCESS This is /user/pay/test"; // return "SUCCESS This is /user/pay/test";
} // }
return "ERROR This is /user/pay/test"; // return "ERROR This is /user/pay/test";
// }
}
} }

View File

@ -1,6 +1,5 @@
package com.example.jieyue.user.controller; 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.entity.SysGoods;
import com.example.jieyue.common.mapper.SysCommentMapper; import com.example.jieyue.common.mapper.SysCommentMapper;
import com.example.jieyue.user.service.UserHomeService; import com.example.jieyue.user.service.UserHomeService;
@ -50,8 +49,8 @@ public class UserProductController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/user/product/add-comment") @RequestMapping("/user/product/add-comment")
public ModelAndView addComment(ModelAndView modelAndView,int goods,int merchant,String context,HttpServletRequest request){ public ModelAndView addComment(ModelAndView modelAndView,int goods,int merchant,String context,HttpServletRequest request){
@ -70,8 +69,8 @@ public class UserProductController {
return modelAndView; return modelAndView;
} }
/* /**
* * <p></p>
*/ */
@RequestMapping("/user/product/del-comment") @RequestMapping("/user/product/del-comment")
public ModelAndView delComment(ModelAndView modelAndView,int id,int goods){ public ModelAndView delComment(ModelAndView modelAndView,int id,int goods){

View File

@ -22,10 +22,13 @@ public class UserSearchController {
@RequestMapping("/user/search") @RequestMapping("/user/search")
public ModelAndView index(ModelAndView modelAndView,String keyword){ public ModelAndView index(ModelAndView modelAndView,String keyword){
// 获取返回的商品列表 // 使用mysql获取返回的商品列表
List<GoodsIndex> goodsList = searchService.esSearchGoods(keyword); List<SysGoods> goodsList = searchService.mysqlSearchGoods(keyword);
modelAndView.addObject("goodsList",goodsList);
// 使用es获取返回的商品列表
// List<GoodsIndex> goodsList = searchService.esSearchGoods(keyword);
modelAndView.addObject("goodsList",goodsList);
modelAndView.setViewName("user/search/index"); modelAndView.setViewName("user/search/index");
return modelAndView; return modelAndView;
} }

View File

@ -22,8 +22,8 @@ public class UserShopController {
@Autowired @Autowired
UserShopService shopService; UserShopService shopService;
/* /**
* * <p></p>
*/ */
@RequestMapping("/user/shop") @RequestMapping("/user/shop")
public ModelAndView index(ModelAndView modelAndView,int id,@RequestParam(defaultValue = "1") int page){ public ModelAndView index(ModelAndView modelAndView,int id,@RequestParam(defaultValue = "1") int page){

View File

@ -51,8 +51,8 @@ public class UserCartService {
return -1; return -1;
} }
/* /**
* * <p></p>
*/ */
public List<Map> getCartList(HttpServletRequest request){ public List<Map> getCartList(HttpServletRequest request){
// 获取用户信息 // 获取用户信息

View File

@ -16,8 +16,8 @@ public class UserCheckOutService {
@Autowired @Autowired
SysGoodsMapper goodsMapper; SysGoodsMapper goodsMapper;
/* /**
* * <p></p>
*/ */
public Map<SysGoods,Integer> getGoodsInfo(String ids){ public Map<SysGoods,Integer> getGoodsInfo(String ids){
Map<SysGoods,Integer> map = new HashMap<>(); Map<SysGoods,Integer> map = new HashMap<>();
@ -28,8 +28,8 @@ public class UserCheckOutService {
return map; return map;
} }
/* /**
* * <p></p>
*/ */
public BigDecimal getGoodsNumPrice(Map<SysGoods,Integer> goodsMap){ public BigDecimal getGoodsNumPrice(Map<SysGoods,Integer> goodsMap){
BigDecimal allPrice = new BigDecimal(0.00); BigDecimal allPrice = new BigDecimal(0.00);
@ -39,8 +39,8 @@ public class UserCheckOutService {
return allPrice; return allPrice;
} }
/* /**
* ids * <p>ids</p>
*/ */
public Map<Integer,Integer> getIdsMap(String ids){ public Map<Integer,Integer> getIdsMap(String ids){
String[] idsAndNumArray = ids.split(","); String[] idsAndNumArray = ids.split(",");
@ -54,8 +54,8 @@ public class UserCheckOutService {
return map; return map;
} }
/* /**
* cart id * <p>cart id</p>
*/ */
public List<Integer> getCartIds(String ids){ public List<Integer> getCartIds(String ids){
String[] idsAndNumArray = ids.split(","); String[] idsAndNumArray = ids.split(",");

View File

@ -28,8 +28,8 @@ public class UserHomeService {
@Autowired @Autowired
SysMtUiMapper mtUiMapper; SysMtUiMapper mtUiMapper;
/* /**
* * <p> </p>
*/ */
public void setHomeCache(ModelAndView modelAndView){ public void setHomeCache(ModelAndView modelAndView){
redisTemplate.opsForHash().put("homePageCache","imgMap",modelAndView.getModelMap().get("imgMap")); redisTemplate.opsForHash().put("homePageCache","imgMap",modelAndView.getModelMap().get("imgMap"));

View File

@ -31,7 +31,6 @@ public class UserInfoService {
/** /**
* <p></p> * <p></p>
*
* @return * @return
*-1 *-1
* 1 * 1

View File

@ -24,8 +24,8 @@ public class UserLoginService {
@Autowired @Autowired
RedisTemplate redisTemplate; RedisTemplate redisTemplate;
// 判空工具类
IsEmptyUtil isEmptyUtil = IsEmptyUtil.getInstance(); IsEmptyUtil isEmptyUtil = IsEmptyUtil.getInstance();
/** /**
* <p></p> * <p></p>
* @return int * @return int
@ -53,8 +53,8 @@ public class UserLoginService {
} }
} }
/* /**
* * <p></p>
*/ */
public SysUser userInfo(String email){ public SysUser userInfo(String email){
return service.getUserInfo(email); return service.getUserInfo(email);
@ -115,7 +115,7 @@ public class UserLoginService {
} }
/** /**
* * <p></p>
* @return int * @return int
*-1 404 *-1 404
* 0 * 0

View File

@ -17,15 +17,15 @@ public class UserOrderService {
@Autowired @Autowired
SysGoodsMapper goodsMapper; SysGoodsMapper goodsMapper;
/* /**
* * <p></p>
*/ */
public List<SysOrder> getOrderList(int userId,int page,int num){ public List<SysOrder> getOrderList(int userId,int page,int num){
return orderMapper.findByUser(userId,(page-1)*num,num); return orderMapper.findByUser(userId,(page-1)*num,num);
} }
/* /**
* * <p></p>
*/ */
public List<SysGoods> getGoodsList(List<SysOrder> orderList){ public List<SysGoods> getGoodsList(List<SysOrder> orderList){
List<SysGoods> list = new ArrayList<>(); List<SysGoods> list = new ArrayList<>();
@ -35,8 +35,8 @@ public class UserOrderService {
return list; return list;
} }
/* /**
* * <p></p>
*/ */
public int getAllPage(int userId,int num){ public int getAllPage(int userId,int num){
return (int)Math.ceil((double)orderMapper.orderCountByUser(userId)/(double)num); return (int)Math.ceil((double)orderMapper.orderCountByUser(userId)/(double)num);

View File

@ -22,8 +22,8 @@ public class UserProductService {
@Autowired @Autowired
SysUserMapper userMapper; SysUserMapper userMapper;
/* /**
* * <p></p>
*/ */
public List<Map> getCommentList(int goods, int page, int num){ public List<Map> getCommentList(int goods, int page, int num){
List<SysComment> commentInfo = getCommentInfo(goods,page,num); List<SysComment> commentInfo = getCommentInfo(goods,page,num);
@ -44,16 +44,16 @@ public class UserProductService {
return list; return list;
} }
/* /**
* * <p></p>
*/ */
public int getAllCountPage(int goods,int num){ public int getAllCountPage(int goods,int num){
int count = commentMapper.getAllCountByGoods(goods); int count = commentMapper.getAllCountByGoods(goods);
return (int)Math.ceil((double)count/(double)num); return (int)Math.ceil((double)count/(double)num);
} }
/* /**
* id * <p>id</p>
*/ */
public SysGoods getGoods(int id){ public SysGoods getGoods(int id){
return goodsMapper.findById(id); return goodsMapper.findById(id);
@ -61,7 +61,6 @@ public class UserProductService {
/** /**
* <p></p> * <p></p>
*
* @param goods id * @param goods id
* @param page * @param page
* @param num * @param num
@ -70,8 +69,8 @@ public class UserProductService {
return commentMapper.findByGoodsLimit(goods,(page-1)*num,page*num); return commentMapper.findByGoodsLimit(goods,(page-1)*num,page*num);
} }
/* /**
* * <p></p>
*/ */
public SysUser getUserInfo(int userId){ public SysUser getUserInfo(int userId){
return userMapper.selectById(userId); return userMapper.selectById(userId);
@ -79,13 +78,9 @@ public class UserProductService {
/** /**
* <p></p> * <p></p>
*
* @return * @return
*-1 *-1
* 1 * 1
*
* @author Bosen
* 2020/11/28 14:32
*/ */
public int addComment(int goodsId,int merchant,String context,HttpServletRequest request){ public int addComment(int goodsId,int merchant,String context,HttpServletRequest request){
// 获取发表评论的用户信息 // 获取发表评论的用户信息

View File

@ -20,7 +20,7 @@ public class UserSearchService {
/** /**
* <p>mysql</p> * <p>mysql</p>
*/ */
public List<SysGoods> searchGoods(String keyword){ public List<SysGoods> mysqlSearchGoods(String keyword){
return goodsMapper.search(keyword); return goodsMapper.search(keyword);
} }

View File

@ -18,15 +18,15 @@ public class UserShopService {
@Autowired @Autowired
SysGoodsMapper goodsMapper; SysGoodsMapper goodsMapper;
/* /**
* * <p></p>
*/ */
public SysMt getMerchantInfo(int merchantId){ public SysMt getMerchantInfo(int merchantId){
return merchantMapper.findById(merchantId); return merchantMapper.findById(merchantId);
} }
/* /**
* * <p></p>
*/ */
public Map<Integer,SysGoods> getGoodsList(int merchantId, int page, int num){ public Map<Integer,SysGoods> getGoodsList(int merchantId, int page, int num){
List<SysGoods> list = goodsMapper.findByMtLimit(merchantId,(page-1)*num,page*num); List<SysGoods> list = goodsMapper.findByMtLimit(merchantId,(page-1)*num,page*num);
@ -37,8 +37,8 @@ public class UserShopService {
return map; return map;
} }
/* /**
* * <p></p>
*/ */
public Map<Integer,SysGoods> getRandGoodsMap(int merchant,int num){ public Map<Integer,SysGoods> getRandGoodsMap(int merchant,int num){
List<SysGoods> list = goodsMapper.findMerchantRand(merchant,num); List<SysGoods> list = goodsMapper.findMerchantRand(merchant,num);
@ -49,8 +49,8 @@ public class UserShopService {
return map; return map;
} }
/* /**
* * <p></p>
*/ */
public int getAllPage(int merchantId,int num){ public int getAllPage(int merchantId,int num){
int all = goodsMapper.countByMerchant(merchantId); int all = goodsMapper.countByMerchant(merchantId);

View File

@ -63,8 +63,7 @@ public class WxPayService {
} }
/** /**
* * <p></p>
*
* @return * @return
*-1 sql *-1 sql
* 0 * 0
@ -114,16 +113,16 @@ public class WxPayService {
return wxCodeUrl(mark,allPrice); return wxCodeUrl(mark,allPrice);
} }
/* /**
* js * <p>js</p>
*/ */
public String[] getStringArray(String array){ public String[] getStringArray(String array){
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
return array.split(","); return array.split(",");
} }
/* /**
* * <p></p>
*/ */
public String getAllPrice(String[] prices,String[] nums){ public String getAllPrice(String[] prices,String[] nums){
DecimalFormat dfPrice = new DecimalFormat("#.00"); DecimalFormat dfPrice = new DecimalFormat("#.00");
@ -138,8 +137,8 @@ public class WxPayService {
return allPrice.multiply(new BigDecimal(100)).stripTrailingZeros().toPlainString(); return allPrice.multiply(new BigDecimal(100)).stripTrailingZeros().toPlainString();
} }
/* /**
* * <p></p>
*/ */
public String wxCodeUrl(String orderMark,String price){ public String wxCodeUrl(String orderMark,String price){
Map<String, String> data = new HashMap<>(); Map<String, String> data = new HashMap<>();
@ -164,10 +163,8 @@ public class WxPayService {
return codeUrl; return codeUrl;
} }
/* /**
* * <p></p>
*
*
*/ */
public String getOrderId(){ public String getOrderId(){
String s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; String s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
@ -193,7 +190,7 @@ public class WxPayService {
} }
/** /**
* * <p></p>
* @param request * @param request
* @return * @return
*/ */
@ -231,8 +228,7 @@ public class WxPayService {
} }
/** /**
* xml * <p>xml</p>
*
* @param httpServletRequest * @param httpServletRequest
* @return * @return
* @throws IOException * @throws IOException
@ -255,8 +251,7 @@ public class WxPayService {
} }
/** /**
* xml * <p>xml</p>
*
* @param returnCode * @param returnCode
* @param returnMsg * @param returnMsg
* @return * @return