当前位置:网站首页>SSM garbage classification management system
SSM garbage classification management system
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 garbage classification management system adopts B/S Structure . The system administrator has the function of community management 、 Garbage classification information 、 Garbage station information 、 Garbage transportation information 、 Spam 、 Repair management , Complaint management and other functions . The interface of this system is simple and intuitive , Easy to operate and use , Strong interaction .
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. whether Maven project : yes ; See if the source directory contains pom.xml; If included , Then for maven project , Otherwise, it is not maven project
6. database :MySql 5.7 edition ;
Technology stack
1. Back end :Spring SpringMVC MyBatis
2. front end :HTML+CSS+Javascript+jQuery+bootstrap
Instructions
1. Use Navicat Or other tools , stay mysql Create a database with the corresponding name in , And import the sql file ;
2. In the project yml Change the database configuration in the configuration file to your own configuration
3. 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 , To configure tomcat, And then run ;
4. Run the project , Input localhost:8080/ Sign in
5. Account admin password 123123
Run a screenshot
Related codes
Log in to the controller
/**
*
* Login related
*/
@Controller
public class SysLoginController {
@Autowired
private Producer producer;
@Autowired
private SysUserService sysUserService;
@RequestMapping("captcha.jpg")
public void captcha(HttpServletResponse response) throws ServletException, IOException {
response.setHeader("Cache-Control", "no-store, no-cache");
response.setContentType("image/jpeg");
// Generate text verification code
String text = producer.createText();
// Generate image captcha
BufferedImage image = producer.createImage(text);
// Save to shiro session
ShiroUtils.setSessionAttribute(Constants.KAPTCHA_SESSION_KEY, text);
ServletOutputStream out = response.getOutputStream();
ImageIO.write(image, "jpg", out);
}
/**
* Sign in
*/
@ResponseBody
@RequestMapping(value = "/sys/login", method = RequestMethod.POST)
public R login(String username, String password, String captcha) throws IOException {
String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY);
System.out.println("== Verification Code =="+kaptcha);
System.out.println("==password=="+password);
System.out.println("==username=="+username);
if(!captcha.equalsIgnoreCase(kaptcha)){
return R.error(" The verification code is incorrect ");
}
if(password==null){
return R.error(" The password cannot be empty ");
}
try {
Subject subject = ShiroUtils.getSubject();
//sha256 encryption
password = new Sha256Hash(password).toHex();
System.out.println("==sha256 encryption ==="+password);
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
subject.login(token);
} catch (UnknownAccountException e) {
return R.error(e.getMessage());
} catch (IncorrectCredentialsException e) {
return R.error(e.getMessage());
} catch (LockedAccountException e) {
return R.error(e.getMessage());
} catch (AuthenticationException e) {
return R.error(" Account verification failed ");
}
return R.ok();
}
/**
*/
@ResponseBody
@RequestMapping(value = "/sys/reg", method = RequestMethod.POST)
public R reg(String username, String password, String captcha) throws IOException {
// String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY);
// if(!captcha.equalsIgnoreCase(kaptcha)){
// return R.error(" The verification code is incorrect ");
// }
//sha256 encryption
SysUserEntity user = new SysUserEntity();
user.setUsername(username);
user.setPassword(password);
user.setStatus(1);
List<Long> roles = new ArrayList<>();
roles.add(1L);
user.setRoleIdList(roles);
this.sysUserService.save(user);
return R.ok();
}
/**
* sign out
*/
@RequestMapping(value = "logout", method = RequestMethod.GET)
public String logout() {
ShiroUtils.logout();
return "redirect:login.html";
}
}
User controller
/**
*
* System users
*
*/
@RestController
@RequestMapping("/sys/user")
public class SysUserController extends AbstractController {
@Autowired
private SysUserService sysUserService;
@Autowired
private SysUserRoleService sysUserRoleService;
/**
* List of all users
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params) {
// Query list data
Query query = new Query(params);
List<SysUserEntity> userList = sysUserService.queryList(query);
int total = sysUserService.queryTotal(query);
PageUtils pageUtil = new PageUtils(userList, total, query.getLimit(), query.getPage());
return R.ok().put("page", pageUtil);
}
@RequestMapping("/list2")
public R list2(@RequestParam Map<String, Object> params) {
// Query list data
Query query = new Query(params);
List<SysUserEntity> userList = sysUserService.queryList(query);
return R.ok().put("list", userList);
}
/**
* Get the login user information
*/
@RequestMapping("/info")
public R info() {
return R.ok().put("user", this.sysUserService.queryObject(getUser().getUserId()));
}
/**
* Change the login user password
*/
@SysLog(" Change Password ")
@RequestMapping("/password")
public R password(String password, String newPassword) {
Assert.isBlank(newPassword, " New password cannot be empty ");
//sha256 encryption
password = new Sha256Hash(password).toHex();
//sha256 encryption
newPassword = new Sha256Hash(newPassword).toHex();
// Update the password
int count = sysUserService.updatePassword(getUserId(), password, newPassword);
if (count == 0) {
return R.error(" The original password is incorrect ");
}
// sign out
ShiroUtils.logout();
return R.ok();
}
@SysLog(" Modify personal information ")
@RequestMapping("/updateInfo")
public R updateInfo(@RequestBody SysUserEntity user) {
this.sysUserService.update(user);
return R.ok();
}
/**
* User information
*/
@RequestMapping("/info/{userId}")
public R info(@PathVariable("userId") Long userId) {
SysUserEntity user = sysUserService.queryObject(userId);
// Get the list of roles to which the user belongs
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(userId);
user.setRoleIdList(roleIdList);
return R.ok().put("user", user);
}
/**
* Save the user
*/
@SysLog(" Save the user ")
@RequestMapping("/save")
public R save(@RequestBody SysUserEntity user) {
ValidatorUtils.validateEntity(user, AddGroup.class);
user.setCreateUserId(getUserId());
sysUserService.save(user);
return R.ok();
}
/**
* Modify the user
*/
@SysLog(" Modify the user ")
@RequestMapping("/update")
public R update(@RequestBody SysUserEntity user) {
ValidatorUtils.validateEntity(user, UpdateGroup.class);
user.setCreateUserId(getUserId());
sysUserService.update(user);
return R.ok();
}
/**
* Delete user
*/
@SysLog(" Delete user ")
@RequestMapping("/delete")
public R delete(@RequestBody Long[] userIds) {
if (ArrayUtils.contains(userIds, 1L) || ArrayUtils.contains(userIds, -1L)) {
return R.error(" The system administrator cannot delete ");
}
if (ArrayUtils.contains(userIds, getUserId())) {
return R.error(" The current user cannot delete ");
}
sysUserService.deleteBatch(userIds);
return R.ok();
}
}
If you want to learn this system , Now get . reply :030ssm
边栏推荐
- RMAN incremental recovery example (1) - without unbacked archive logs
- CAD二次开发 对象
- Oracle EBS ADI development steps
- 离线数仓和bi开发的实践和思考
- ORACLE EBS 和 APEX 集成登录及原理分析
- oracle apex ajax process + dy 校验
- Agile development of software development pattern (scrum)
- Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
- MySQL中的正则表达式
- IDEA2020中PySpark的两表关联(字段名相同)
猜你喜欢
TCP攻击
Pratique et réflexion sur l'entrepôt de données hors ligne et le développement Bi
JSP智能小区物业管理系统
Check log4j problems using stain analysis
离线数仓和bi开发的实践和思考
SSM学生成绩信息管理系统
MapReduce与YARN原理解析
Yolov5 practice: teach object detection by hand
CAD二次开发 对象
【Ranking】Pre-trained Language Model based Ranking in Baidu Search
随机推荐
allennlp 中的TypeError: Object of type Tensor is not JSON serializable错误
php中判断版本号是否连续
优化方法:常用数学符号的含义
ORACLE APEX 21.2安装及一键部署
Error in running test pyspark in idea2020
php中获取汉字拼音大写首字母
MapReduce concepts and cases (Shang Silicon Valley Learning Notes)
华为机试题
2021-07-17c /cad secondary development creation circle (5)
php中的数字金额转换大写数字
sparksql数据倾斜那些事儿
Check log4j problems using stain analysis
【信息检索导论】第三章 容错式检索
ssm+mysql实现进销存系统
Yaml file of ingress controller 0.47.0
【Ranking】Pre-trained Language Model based Ranking in Baidu Search
Explain in detail the process of realizing Chinese text classification by CNN
oracle EBS标准表的后缀解释说明
Brief analysis of PHP session principle
RMAN增量恢复示例(1)-不带未备份的归档日志