当前位置:网站首页>SSM second hand trading website
SSM second hand trading website
2022-07-02 07:19:00 【Night Weiyang 5788】
Author URI : In the middle of the night 5788
brief introduction :Java Quality creators in the field 、Java project 、 Learning materials 、 Technical assistance
Get the source code at the end of the article
Project introduction
The project is divided into front and back stages , Foreground ordinary user role , Background administrator role .
The main functions of the administrator are as follows :
land , Commodity classification management , Commodity management , Commodity order management , User management and other functions .
The main functions of user roles are as follows :
It includes the following functions : See all the products , User login registration , View items by category , Release commodities , Check out the seller's home page , Contact the seller , Leave a message for the product , Check the order , Modify and view personal data and other functions .
Environmental needs
1. Running environment : It is best to java jdk 1.8, We run on this platform . Other versions can, in theory .
2.IDE Environmental Science :IDEA,Eclipse,Myeclipse Fine . recommend IDEA;
3.tomcat Environmental Science :Tomcat 7.x,8.x,9.x All versions are available
4. Hardware environment :windows 7/8/10 1G Above memory ; perhaps Mac OS;
5. database :MySql 5.7 edition ;
6. whether Maven project : yes ;
Technology stack
1. Back end :Spring+SpringMVC+Mybatis
2. front end :JSP+BootStrap+jQuery
Instructions
1. Use Navicat Or other tools , stay mysql Create a database with the corresponding name in , And import the sql file ;
2. Use IDEA/Eclipse/MyEclipse Import the project ,Eclipse/MyEclipse Import time , if maven Item, please select maven;
if maven project , After importing successfully, please execute maven clean;maven install command , And then run ;
3. In the project mybatis.xml Change the database configuration in the configuration file to your own configuration ;
4. Run the project , Input localhost:8080/ssm_ershou_shop Sign in
Run a screenshot
Foreground interface
Backend interface
Related codes
Administrator controller
@Controller
@RequestMapping(value = "admin")
public class AdminController {
private final UserService userService;
private final GoodService goodService;
private final TypeService typeService;
private final OrderService orderService;
@Autowired
public AdminController(UserService userService, GoodService goodService, TypeService typeService, OrderService orderService) {
this.userService = userService;
this.goodService = goodService;
this.typeService = typeService;
this.orderService = orderService;
}
@RequestMapping(value = "/adminLogin", method = RequestMethod.GET)
public String getAdminLogin(){
return "admin/adminLogin";
}
@RequestMapping(value = "/adminLogin", method = RequestMethod.POST)
public String postAdminLogin(ModelMap model,
@RequestParam(value = "email", required = false) String email,
@RequestParam(value = "password", required = false) String password,
HttpSession session) {
User admin = userService.getUserByEmail(email);
String message;
if (admin != null){
String mdsPass = DigestUtils.md5DigestAsHex((password + admin.getCode()).getBytes());
// if (!mdsPass .equals(admin.getPassword())){
// message = " User password error !";
// }
if (!password .equals(admin.getPassword())){
message = " User password error !";
} else if (admin.getRoleId() != 101){
message = " The user does not have access !";
} else {
session.setAttribute("admin",admin);
return "redirect:/admin/adminPage";
}
} else {
message = " The user doesn't exist !";
}
model.addAttribute("message", message);
return "admin/adminLogin";
}
@RequestMapping(value = "/adminLogout", method = RequestMethod.GET)
public String adminLogout(@RequestParam(required = false, defaultValue = "false" )String adminLogout, HttpSession session){
if (adminLogout.equals("true")){
session.removeAttribute("admin");
}
// adminLogout = "false";
return "redirect:/";
}
@RequestMapping(value = "/adminPage", method = RequestMethod.GET)
public String getAdminPage(ModelMap model,
HttpSession session){
User admin = (User) session.getAttribute("admin");
if (admin == null){
return "redirect:/admin/adminLogin";
}
List<Good> goodList = goodService.getAllGoodList();
for (Good good : goodList) {
good.setGoodUser(userService.getUserById(good.getUserId()));
good.setGoodSecondType(typeService.getSecondTypeById(good.getSecondTypeId()));
}
List<User> userList = userService.getAllUser();
List<FirstType> firstTypeList = typeService.getAllFirstType();
List<Order> orderList = orderService.getOrderList();
model.addAttribute("goodList", goodList);
model.addAttribute("userList", userList);
model.addAttribute("firstTypeList", firstTypeList);
model.addAttribute("orderList", orderList);
return "admin/adminPage";
}
@RequestMapping(value = "/user/update/status/{statusId}&{userId}", method = RequestMethod.GET)
public ResponseEntity updateUserStatus(@PathVariable Integer statusId,
@PathVariable Integer userId){
Boolean success = userService.updateUserStatus(statusId, userId);
if (success){
List<User> userList = userService.getAllUser();
return ResponseEntity.ok(userList);
}
return ResponseEntity.ok(success);
}
@RequestMapping(value = "/user/delete/{userId}", method = RequestMethod.GET)
public ResponseEntity deleteUser(@PathVariable Integer userId){
Boolean success = userService.deleteUser(userId);
if (success){
List<User> userList = userService.getAllUser();
return ResponseEntity.ok(userList);
}
return ResponseEntity.ok(success);
}
}
Home controller
@Controller
public class HomeController {
private final UserService userService;
@Autowired
public HomeController(UserService userService) {
this.userService = userService;
}
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String loginPage(ModelMap mode, HttpServletRequest request) {
String preURL = request.getHeader("Referer");
mode.addAttribute("preURL", preURL);
return "home/login";
}
@RequestMapping(value = "/login", method = RequestMethod.POST)
public String loginSubmit(ModelMap model,
@RequestParam(value = "preURL", required = false, defaultValue = "") String preURL,
@RequestParam(value = "email", required = false) String email,
@RequestParam(value = "password", required = false) String password,
HttpSession session) {
User user = userService.getUserByEmail(email);
String message;
if (user != null){
String mdsPass = DigestUtils.md5DigestAsHex((password + user.getCode()).getBytes());
if (!mdsPass .equals(user.getPassword())){
message = " User password error !";
} else {
if (user.getStatusId() == 4){
session.setAttribute("user",user);
if (preURL.equals("")){
return "redirect:/";
} else {
return "redirect:" + preURL;
}
} else {
message = " The user is invalid !";
}
}
} else {
message = " The user doesn't exist !";
}
model.addAttribute("message", message);
return "home/login";
}
@RequestMapping(value = "/logout", method = RequestMethod.GET)
public String logout(@RequestParam(required = false, defaultValue = "false" )String logout, HttpSession session){
if (logout.equals("true")){
session.removeAttribute("user");
}
return "redirect:/";
}
@RequestMapping(value = "/register", method = RequestMethod.GET)
public String registerPage(ModelMap model) {
User user = new User();
model.addAttribute("user", user);
return "home/register";
}
@RequestMapping(value = "/register", method = RequestMethod.POST)
public String registerSuccess(ModelMap model,
@Valid User user) {
String status;
Boolean insertSuccess;
InfoCheck infoCheck = new InfoCheck();
if (!infoCheck.isMobile(user.getMobile())){
status = " Please input the correct mobile number !";
} else if (!infoCheck.isEmail(user.getEmail())){
status = " Please enter the correct email !";
} else if (userService.getUserByMobile(user.getMobile()) != null) {
status = " This phone number is already in use !";
} else if (userService.getUserByEmail(user.getEmail()) != null) {
status = " This mailbox is already in use !";
} else if (user.getPassword2() == null){
status = " Please confirm the password !";
} else {
RandomString randomString = new RandomString();
user.setCode(randomString.getRandomString(5));
String md5Pass = DigestUtils.md5DigestAsHex((user.getPassword() + user.getCode()).getBytes());
user.setPassword(md5Pass);
insertSuccess = userService.registerUser(user);
if (insertSuccess){
return "home/login";
} else {
status = " Registration failed !";
model.addAttribute("user", user);
model.addAttribute("status", status);
return "home/register";
}
}
System.out.println(user.getMobile());
System.out.println(status);
model.addAttribute("user", user);
model.addAttribute("status", status);
return "home/register";
}
}
If you want to learn this system , Now get . reply :88ssm
边栏推荐
- Two table Association of pyspark in idea2020 (field names are the same)
- Laravel8中的find_in_set、upsert的使用方法
- 第一个快应用(quickapp)demo
- Sqli-labs customs clearance (less18-less20)
- 一个中年程序员学习中国近代史的小结
- 如何高效开发一款微信小程序
- CAD secondary development object
- 【Torch】解决tensor参数有梯度,weight不更新的若干思路
- PM2 simple use and daemon
- 外币记账及重估总账余额表变化(下)
猜你喜欢
How to call WebService in PHP development environment?
【调参Tricks】WhiteningBERT: An Easy Unsupervised Sentence Embedding Approach
Sqli labs customs clearance summary-page4
JSP intelligent community property management system
在php的开发环境中如何调取WebService?
Oracle EBS ADI development steps
Oracle apex Ajax process + dy verification
使用Matlab实现:Jacobi、Gauss-Seidel迭代
CSRF attack
软件开发模式之敏捷开发(scrum)
随机推荐
华为机试题
SSM实验室设备管理
Only the background of famous universities and factories can programmers have a way out? Netizen: two, big factory background is OK
使用Matlab实现:Jacobi、Gauss-Seidel迭代
Brief analysis of PHP session principle
Pyspark build temporary report error
Sqli-labs customs clearance (less2-less5)
CSRF攻击
【信息检索导论】第六章 词项权重及向量空间模型
parser.parse_args 布尔值类型将False解析为True
【调参Tricks】WhiteningBERT: An Easy Unsupervised Sentence Embedding Approach
类加载器及双亲委派机制
Build FRP for intranet penetration
php中通过集合collect的方法来实现把某个值插入到数组中指定的位置
【BERT,GPT+KG调研】Pretrain model融合knowledge的论文集锦
JSP智能小区物业管理系统
UEditor . Net version arbitrary file upload vulnerability recurrence
ORACLE 11.2.0.3 不停机处理SYSAUX表空间一直增长问题
ssm人事管理系统
Sqli labs customs clearance summary-page4