Project No.: BS-XX-121
1, Project introduction
This project is based on Springboot+Vue to develop and implement a construction site material management system, which is based on the separation of front and rear ends, which is in line with the current mainstream development method. The main functional modules include:
Material management: addition, deletion, modification and query of material types
Supplier management: addition, deletion, modification and inspection of suppliers
Manufacturer management: addition, deletion, modification and inspection of material manufacturers
Purchase management: including purchase review and my purchase information management
Inventory management: material inventory information management. After adding materials, import inventory according to the purchase plan
Quotation management: import the supplier's material quotation list EXCEL table, or export it to EXCEL
Site management: including the basic information management and material details management of the construction site
System management: including role, permission and user management
In addition, it has the function of playing background music online
Basic business process: first add inventory material information -- "import supplier quotation list" -- "generate purchase plan (click purchase in inventory) --" purchase approval "--" purchase receipt "--" tool materials
2, Environment introduction
Locale: Java: jdk1.8
Database: Mysql: mysql5.7
Application server: Tomcat: tomcat8.5.31
Development tools: IDEA or eclipse
Back end development technology: Springboot+Mybatis+SpringSecurity
Front end development technology: Vue+Element
3, System display
Administrator login:
Material management:
Manufacturer and supplier management
Purchase management: purchase review
Purchase management: my purchase information management
Inventory management: first add materials, then click purchase to generate a purchase plan according to the quotation list, and then enter the warehouse after approval
Quotation management:
Site management:
Details of materials used on site:
system management
Permission assignment:
Operator management
4, Core code display
package com.znz.server.controller; import com.znz.server.common.constant.Constants; import com.znz.server.entity.Admin; import com.znz.server.entity.RespBean; import com.znz.server.entity.Role; import com.znz.server.service.IAdminService; import com.znz.server.service.IRoleService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * Operator information * * @author znz * @since 2021-03-06 */ @Api(value = "Operator controller", tags = {"Operator management"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/system/admin") public class AdminController { private final IAdminService adminService; private final IRoleService roleService; @ApiOperation(value = "Get all operators") @GetMapping("/") public List<Admin> getAllAdmins(String keywords) { return adminService.getAllAdmins(keywords); } @ApiOperation(value = "Update operator") @PutMapping("/") public RespBean updateAdmin(@RequestBody Admin admin) { if (adminService.updateById(admin)) { return RespBean.success(Constants.SUCCESS); } return RespBean.error(Constants.FAIL); } @ApiOperation(value = "Delete operator") @DeleteMapping("/{id}") public RespBean deleteAdmin(@PathVariable Integer id) { if (adminService.removeById(id)) { return RespBean.success(Constants.SUCCESS); } return RespBean.success(Constants.FAIL); } @ApiOperation(value = "Get all roles") @GetMapping("/roles") public List<Role> getAllRoles() { return roleService.list(); } @ApiOperation(value = "Update operator role") @PutMapping("/role") public RespBean updateAdminRole(Integer adminId, Integer[] rids) { return adminService.updateAdminRole(adminId, rids); } }
package com.znz.server.controller; import com.google.code.kaptcha.impl.DefaultKaptcha; import com.znz.server.common.core.BaseController; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import javax.imageio.ImageIO; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.awt.image.BufferedImage; import java.io.IOException; /** * Picture verification code * @Author znz * @Date 21-3-6 8:59 PM * @Version 1.0 */ @Api(value = "Verification code controller", tags = {"Verification code management"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController public class CaptchaController extends BaseController { private final DefaultKaptcha defaultKaptcha; /** * Generate verification code * @param request * @param response */ @ApiOperation(value = "Verification Code") @GetMapping(value = "/captcha", produces = "image/jpeg") public void captcha(HttpServletRequest request, HttpServletResponse response) { // Define the response output type as image/jpeg type response.setDateHeader("Expires", 0); // Set standard HTTP/1.1 no-cache headers. response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); // Set IE extended HTTP/1.1 no-cache headers (use addHeader). response.addHeader("Cache-Control", "post-check=0, pre-check=0"); // Set standard HTTP/1.0 no-cache header. response.setHeader("Pragma", "no-cache"); // return a jpeg response.setContentType("image/jpeg"); // Get the text content of the verification code String text = defaultKaptcha.createText(); logger.info("Verification code content: {}", text); // It is convenient to use request for login verification. Refer to adminserviceimpl\login() request.getSession().setAttribute("captcha", text); // Generate graphic verification code BufferedImage image = defaultKaptcha.createImage(text); ServletOutputStream outputStream = null; try { outputStream = response.getOutputStream(); // Output stream output picture in jpg format ImageIO.write(image, "jpg", outputStream); outputStream.flush(); } catch (IOException e) { e.printStackTrace(); } finally { if (null != outputStream) { try { outputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } } }
package com.znz.server.controller; import com.znz.server.annotation.ApiLog; import com.znz.server.common.constant.Constants; import com.znz.server.entity.Admin; import com.znz.server.entity.AdminLoginParam; import com.znz.server.entity.RespBean; import com.znz.server.service.IAdminService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import java.security.Principal; /** * validate logon * @Author znz * @Date 21-3-6 5:03 PM * @Version 1.0 */ @Api(value = "Login controller", tags = {"Login management"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController public class LoginController { private final IAdminService adminService; @ApiLog @ApiOperation(value = "Return after login token") @PostMapping("/login") public RespBean login(@RequestBody AdminLoginParam adminLoginParam, HttpServletRequest request) { return adminService.login(adminLoginParam.getUsername(), adminLoginParam.getPassword(), adminLoginParam.getCode(),request); } @ApiLog @ApiOperation(value = "Get the current login user information") @GetMapping("/admin/info") public Admin getAdminInfo(Principal principal) { if (null == principal) { return null; } String username = principal.getName(); Admin admin = adminService.getAdminByUserName(username); admin.setPassword(null); // Set user roles admin.setRoles(adminService.getRoles(admin.getId())); return admin; } @ApiOperation(value = "Log out") @PostMapping("/logout") public RespBean logout() { return RespBean.success(Constants.LOGOUT); } }
package com.znz.server.controller; import com.znz.server.common.Result; import com.znz.server.common.constant.Constants; import com.znz.server.entity.MaterialCategory; import com.znz.server.entity.RespBean; import com.znz.server.entity.RespPageBean; import com.znz.server.service.IMaterialCategoryService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.time.LocalDateTime; import java.util.Arrays; import java.util.List; /** * Material classification Controller * @author znz * @since 2021-03-10 */ @Api(value = "Material classification controller", tags = {"Material classification management"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/material/materialCategory/mc") public class MaterialCategoryController { private final IMaterialCategoryService materialCategoryService; @ApiOperation(value = "Conditional paging") @GetMapping("/") public RespPageBean getMaterialCategoryPage(String materialCategoryName, @RequestParam(defaultValue = "1") Integer pageIndex, @RequestParam(defaultValue = "10") Integer pageSize) { return materialCategoryService.findMaterialCategoryByPage(materialCategoryName, pageIndex, pageSize); } @ApiOperation(value = "newly added") @PostMapping("/") public RespBean addMaterialCategory(@RequestBody MaterialCategory materialCategory) { /** Date processing */ materialCategory.setCreateDate(LocalDateTime.now()); if (materialCategoryService.save(materialCategory)) { return RespBean.success(Constants.ADD_SUCCESS); } return RespBean.error(Constants.ADD_FAIL); } @ApiOperation(value = "to update") @PutMapping("/") public RespBean updateMaterialCategory(@RequestBody MaterialCategory materialCategory) { if (materialCategoryService.updateById(materialCategory)) { return RespBean.success(Constants.UPDATE_SUCCESS); } return RespBean.error(Constants.UPDATE_FAIL); } @ApiOperation(value = "according to id delete") @DeleteMapping("/{id}") public RespBean deleteMaterialCategory(@PathVariable Integer id) { if (materialCategoryService.removeById(id)) { return RespBean.success(Constants.DELETE_SUCCESS); } return RespBean.error(Constants.DELETE_FAIL); } @ApiOperation(value = "Batch delete") @DeleteMapping("/") public RespBean deleteMaterialCategories(Integer[] ids) { if (materialCategoryService.removeByIds(Arrays.asList(ids))) { return RespBean.success(Constants.DELETE_SUCCESS); } return RespBean.error(Constants.DELETE_FAIL); } @ApiOperation(value = "Query list") @GetMapping("/list") public Result list() { return new Result("1001", Constants.SELECT_SUCCESS, materialCategoryService.list()); } }
5, Project summary
The project interface is clear, and the asynchronous interaction through AJAX is very suitable for graduation.