This is the fourth day of my participation in the August More text Challenge. For details, see: August More Text Challenge

Main function design:

User, region, substance type, substance details, substance application and review as well as my application and notification announcements and flexible control menu permissions

                                                           

Main technical implementation: Spring, SpringMVC, SpringBoot, Springboot security permission framework MyBatis, jquery, MD5, Bootstarp. js Tomcat, interceptor, etc

Specific function modules: user module, role module, menu module, department module and flexible permission control, which can be controlled to the page or button to meet most of the permission requirements

Business module functions: area management, management of different areas and substance release, substance type management, substance details management, substance application management, substance audit management, my substance application management, and system notice announcement view and other specific function modules, as well as modify password exit, etc.

Function screenshots are as follows:

/** * . * * * * */ package io.renren.modules.sys.controller; import com.google.code.kaptcha.Constants; import com.google.code.kaptcha.Producer; import io.renren.common.utils.R; import io.renren.modules.sys.shiro.ShiroUtils; import org.apache.shiro.authc.*; import org.apache.shiro.subject.Subject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.imageio.ImageIO; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.awt.image.BufferedImage; import java.io.IOException; /** * log in ** @author Mark s.com */ @controller public class SysLoginController {@autowired private Producer;  @RequestMapping("captcha.jpg") public void captcha(HttpServletResponse response)throws IOException { response.setHeader("Cache-Control", "no-store, no-cache"); response.setContentType("image/jpeg"); String text = producer.createText(); BufferedImage image = producer.createImage(text); / / save the shiro session ShiroUtils. SetSessionAttribute (the KAPTCHA_SESSION_KEY, text); ServletOutputStream out = response.getOutputStream(); ImageIO.write(image, "jpg", out); } /** * login */ @responsebody@requestmapping (value = "/sys/login", method = RequestMethod.POST) public R login(String username, String password, String captcha) { String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY); if(! Captcha. EqualsIgnoreCase (kaptcha)){return R.error(" captcha is not correct "); } try{ Subject subject = ShiroUtils.getSubject(); UsernamePasswordToken token = new UsernamePasswordToken(username, password); //md5+Jiayan subject.login(token); }catch (UnknownAccountException e) { return R.error(e.getMessage()); } the catch (IncorrectCredentialsException e) {return R.e rror (" account or password is not correct "); }catch (LockedAccountException e) {return r.ror (" Account locked, please contact administrator "); }catch (AuthenticationException e) {return R.ror (" account authentication failed "); } return R.ok(); } @requestMapping (value = "logout",); method = RequestMethod.GET) public String logout() { ShiroUtils.logout(); return "redirect:login.html"; }}Copy the code

User home Page Super administrator page Functions:

User management: CRUD functionality for each module is complete

Flexible role permissions:

Menu Management:

Area Management:

Type management of anti-epidemic substances:

Detailed management of anti-epidemic substances;

package io.renren.modules.sys.controller; import io.renren.common.utils.PageUtils; import io.renren.common.utils.R; import io.renren.modules.sys.entity.MatterApply; import io.renren.modules.sys.service.MatterApplyService; import io.renren.modules.sys.service.impl.MatterApplyServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Arrays; import java.util.Date; import java.util.Map; @RestController @RequestMapping("/sys/matterApply") public class MatterApplyController extends AbstractController { @Autowired private MatterApplyService MatterApplyService; @Autowired MatterApplyServiceImpl MatterApplyServiceImpe; @RequestMapping("/list") public R list(@RequestParam Map<String, Object> params){ PageUtils page = MatterApplyService.queryPage(params); return R.ok().put("page", page); } @RequestMapping("/AuditList") public R AuditList(@RequestParam Map<String, Object> params){params.put("applyStu"," unapproved "); PageUtils page = MatterApplyService.queryPage(params); return R.ok().put("page", page); } @RequestMapping("/listByUser") public R listByUser(@RequestParam Map<String, Object> params){ params.put("applyUserId",String.valueOf(getUserId())); PageUtils page = MatterApplyService.queryPage(params); return R.ok().put("page", page); } @RequestMapping("/info/{id}") public R info(@PathVariable("id") Long id){ MatterApply matterApply = MatterApplyService.getById(id); return R.ok().put("matterApply", matterApply); } @RequestMapping("/save") public R save(@RequestBody MatterApply matterApply){ matterApply.setApplyTime(new Date()); matterApply.setApplyUserId(getUserId()); Matterapply.setapplystu (" not audited "); MatterApplyService.save(matterApply); return R.ok(); } @RequestMapping("/update") public R update(@RequestBody MatterApply matterApply){ MatterApplyService.updateById(matterApply); return R.ok(); } @RequestMapping("/delete") public R delete(@RequestBody Long[] ids){ MatterApplyService.removeByIds(Arrays.asList(ids)); return R.ok(); }}Copy the code

User’s application for anti-epidemic substances:

Administrator review:

Common user rights;

Data set design ER diagram:

CREATE TABLE `NewTable` ( `user_id` bigint(20) NOT NULL AUTO_INCREMENT , 'username' varchar(50) CHARACTER SET UTf8MB4 COLLATE UTf8MB4_general_ci NOT NULL COMMENT 'username', 'password' varchar(100) CHARACTER SET UTf8MB4 COLLATE UTf8MB4_general_CI NULL DEFAULT NULL COMMENT 'password', 'salt' varchar(20) CHARACTER SET UTf8MB4 COLLATE UTf8MB4_general_CI NULL DEFAULT NULL COMMENT 'SALT', 'email' varchar(100) CHARACTER SET UTf8MB4 COLLATE UTf8MB4_general_CI NULL DEFAULT NULL COMMENT 'email', 'mobile' vARCHar (100) CHARACTER SET UTf8MB4 COLLATE UTf8MB4_general_CI NULL DEFAULT NULL COMMENT 'mobile' VARCHar (100) CHARACTER SET UTf8MB4 COLLATE UTf8MB4_GENERAL_CI NULL DEFAULT NULL COMMENT 'status' tinyint(4) NULL DEFAULT NULL COMMENT' Normal ', 'dept_id' bigint(20) NULL DEFAULT NULL COMMENT 'department ID',' create_time 'datetime NULL DEFAULT NULL COMMENT' Creation time ', PRIMARY KEY (`user_id`), UNIQUE INDEX `username` (`username`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8mb4 COLLATE= UTF8MB4_general_ci COMMENT=' user 'AUTO_INCREMENT=3 ROW_FORMAT=COMPACT;Copy the code

Follow the blogger one health three couplets yo