规范代码和注释规范

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.scheduling.annotation.EnableScheduling;
@MapperScan("com.example.jieyue.common.mapper")// mapper扫描
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 23:07
*/
@MapperScan("com.example.jieyue.common.mapper")
@SpringBootApplication
@ServletComponentScan
@EnableScheduling// 定时任务
@EnableScheduling
public class JieyueApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
@ -27,8 +32,8 @@ public class JieyueApplication extends SpringBootServletInitializer {
return builder.sources(JieyueApplication.class);
}
/*
*
/**
* <p></p>
*/
@Bean
public TomcatServletWebServerFactory containerFactory() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,19 +13,7 @@ public class AdminRbacService {
SysRoleAccessMapper roleAccessMapper;
/**
* <p></p>
* @return 1 -1
* @author Bosen
* 2020/12/30 5:19
* TODO TODO TODO TODO
*/
public int updateAdminRoleAction(int adminId,String roles){
// 对使用json封装的js数组进行解析
return -1;
}
/*
*
* <p></p>
*/
@Transactional
public boolean setRoleAccess(int role,int[] ids){
@ -39,6 +27,4 @@ public class AdminRbacService {
}
return true;
}
}

View File

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

View File

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

View File

@ -1,17 +1,11 @@
package com.example.jieyue.common.component;
import com.example.jieyue.common.entity.*;
import com.example.jieyue.common.mapper.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**

View File

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

View File

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

View File

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

View File

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

View File

@ -20,9 +20,7 @@ public class UserWebMvcConfigurer implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
/*
* 访
*/
// 登录拦截
registry.addInterceptor(new LoginHandlerInterceptor())
.addPathPatterns("/user/**")
.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;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:47
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SysAccess {
private int id;
private String name;
private String url;
private int status;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}

View File

@ -1,60 +1,21 @@
package com.example.jieyue.common.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:46
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SysAdmin {
private int id;
private String name;
private String password;
private String email;
private int mark;
@Override
public String toString() {
return "SysAdmin{" +
"id=" + id +
", name='" + name + '\'' +
", password='" + password + '\'' +
", email='" + email + '\'' +
", mark=" + mark +
'}';
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getMark() {
return mark;
}
public void setMark(int mark) {
this.mark = mark;
}
}

View File

@ -1,40 +1,20 @@
package com.example.jieyue.common.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:46
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SysAdminRole {
private int id;
private int adminId;
private int roleId;
private int status;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getAdminId() {
return adminId;
}
public void setAdminId(int adminId) {
this.adminId = adminId;
}
public int getRoleId() {
return roleId;
}
public void setRoleId(int roleId) {
this.roleId = roleId;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}

View File

@ -1,40 +1,20 @@
package com.example.jieyue.common.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:46
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SysCart {
private int id;
private int goodsId;
private int userId;
private int goodsNum;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getGoodsId() {
return goodsId;
}
public void setGoodsId(int goodsId) {
this.goodsId = goodsId;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getGoodsNum() {
return goodsNum;
}
public void setGoodsNum(int goodsNum) {
this.goodsNum = goodsNum;
}
}

View File

@ -1,5 +1,17 @@
package com.example.jieyue.common.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:46
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SysComment {
private int id;
private int user;
@ -7,52 +19,4 @@ public class SysComment {
private int merchant;
private String context;
private long createTime;
public int getMerchant() {
return merchant;
}
public void setMerchant(int merchant) {
this.merchant = merchant;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getUser() {
return user;
}
public void setUser(int user) {
this.user = user;
}
public int getGoods() {
return goods;
}
public void setGoods(int goods) {
this.goods = goods;
}
public String getContext() {
return context;
}
public void setContext(String context) {
this.context = context;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
}

View File

@ -1,7 +1,19 @@
package com.example.jieyue.common.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:46
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SysGoods {
private int id;
private String name;
@ -11,81 +23,4 @@ public class SysGoods {
private int state;
private int merchant;
private int stock;
@Override
public String toString() {
return "SysGoods{" +
"id=" + id +
", name='" + name + '\'' +
", describe='" + describe + '\'' +
", img='" + img + '\'' +
", price=" + price +
", state=" + state +
", merchant=" + merchant +
'}';
}
public int getStock() {
return stock;
}
public void setStock(int stock) {
this.stock = stock;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescribe() {
return describe;
}
public void setDescribe(String describe) {
this.describe = describe;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
public int getMerchant() {
return merchant;
}
public void setMerchant(int merchant) {
this.merchant = merchant;
}
}

View File

@ -1,5 +1,17 @@
package com.example.jieyue.common.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:46
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SysMt {
private int id;
private String name;
@ -8,60 +20,4 @@ public class SysMt {
private float ratio;
private int state;
private String header;
public String getHeader() {
return header;
}
public void setHeader(String header) {
this.header = header;
}
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public float getRatio() {
return ratio;
}
public void setRatio(float ratio) {
this.ratio = ratio;
}
}

View File

@ -1,61 +1,21 @@
package com.example.jieyue.common.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:46
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SysMtUi {
private int id;
private String url;
private int width;
private int height;
private int merchant;
@Override
public String toString() {
return "SysMtUi{" +
"id=" + id +
", url='" + url + '\'' +
", width=" + width +
", height=" + height +
", merchant=" + merchant +
'}';
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public int getMerchant() {
return merchant;
}
public void setMerchant(int merchant) {
this.merchant = merchant;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}

View File

@ -6,6 +6,11 @@ import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:46
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@ -16,52 +21,4 @@ public class SysNotice implements Serializable {
private String context;
private int receive;
private long createTime;
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContext() {
return context;
}
public void setContext(String context) {
this.context = context;
}
public int getReceive() {
return receive;
}
public void setReceive(int receive) {
this.receive = receive;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
}

View File

@ -1,7 +1,19 @@
package com.example.jieyue.common.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:46
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SysOrder {
private int id;
private String orderId;
@ -22,166 +34,5 @@ public class SysOrder {
private String payCodeUrl;
private int cartId;
private float merchantRatio;
public float getMerchantRatio() {
return merchantRatio;
}
public void setMerchantRatio(float merchantRatio) {
this.merchantRatio = merchantRatio;
}
public int getCartId() {
return cartId;
}
public void setCartId(int cartId) {
this.cartId = cartId;
}
public String getPayCodeUrl() {
return payCodeUrl;
}
public void setPayCodeUrl(String payCodeUrl) {
this.payCodeUrl = payCodeUrl;
}
public int getPayWay() {
return payWay;
}
public void setPayWay(int payWay) {
this.payWay = payWay;
}
public String getCouponCode() {
return couponCode;
}
public void setCouponCode(String couponCode) {
this.couponCode = couponCode;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
public long getPayTime() {
return payTime;
}
public void setPayTime(long payTime) {
this.payTime = payTime;
}
public int getGoodsNum() {
return goodsNum;
}
public void setGoodsNum(int goodsNum) {
this.goodsNum = goodsNum;
}
public int getOrderState() {
return orderState;
}
public void setOrderState(int orderState) {
this.orderState = orderState;
}
public String getOrderMark() {
return orderMark;
}
public void setOrderMark(String orderMark) {
this.orderMark = orderMark;
}
public int getOrderMerchant() {
return orderMerchant;
}
public void setOrderMerchant(int orderMerchant) {
this.orderMerchant = orderMerchant;
}
public int getOrderUser() {
return orderUser;
}
public void setOrderUser(int orderUser) {
this.orderUser = orderUser;
}
public int getGoodsId() {
return goodsId;
}
public void setGoodsId(int goodsId) {
this.goodsId = goodsId;
}
public BigDecimal getOrderPrice() {
return orderPrice;
}
public void setOrderPrice(BigDecimal orderPrice) {
this.orderPrice = orderPrice;
}
public String getOrderNotes() {
return orderNotes;
}
public void setOrderNotes(String orderNotes) {
this.orderNotes = orderNotes;
}
public String getUserAddress() {
return userAddress;
}
public void setUserAddress(String userAddress) {
this.userAddress = userAddress;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPhone() {
return userPhone;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
private String userPhone;
}

View File

@ -1,31 +1,19 @@
package com.example.jieyue.common.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:46
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SysRole {
private int id;
private String name;
private int status;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}

View File

@ -1,40 +1,20 @@
package com.example.jieyue.common.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:46
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SysRoleAccess {
private int id;
private int roleId;
private int accessId;
private int status;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getRoleId() {
return roleId;
}
public void setRoleId(int roleId) {
this.roleId = roleId;
}
public int getAccessId() {
return accessId;
}
public void setAccessId(int accessId) {
this.accessId = accessId;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}

View File

@ -1,35 +1,20 @@
package com.example.jieyue.common.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:46
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SysUi {
private int id;
private String url;
private int width;
private int height;
@Override
public String toString() {
return "SysUi{" +
"id=" + id +
", url='" + url + '\'' +
", width=" + width +
", height=" + height +
'}';
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}

View File

@ -1,5 +1,17 @@
package com.example.jieyue.common.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <p></p>
* @author Bosen
* @date 2021/8/9 22:46
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
public class SysUser {
private int id;
private String username;
@ -7,64 +19,4 @@ public class SysUser {
private String email;
private int mark;
private String header;
@Override
public String toString() {
return "SysUser{" +
"id=" + id +
", username='" + username + '\'' +
", password='" + password + '\'' +
", email='" + email + '\'' +
", mark=" + mark +
", header='" + header + '\'' +
'}';
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getMark() {
return mark;
}
public void setMark(int mark) {
this.mark = mark;
}
public String getHeader() {
return header;
}
public void setHeader(String header) {
this.header = header;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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