The front-end template frame is Bootstrap, The system is divided into foreground and background . The background is mainly the administrator role , Functions :
Commodity type management , Commodity management , Order management , Member management , Administrator management, etc . Front desk user functions include : Sign in , register , View item , add to cart , payment , View order , Personal center, etc . Total of the system 9 Zhang Biao

Operating environment :windows/linux,jdk1.8,mysql5.x,maven3.5\3.6,tomcat7.0 

 

 

 

 

 

 

Front end commodity controller :
/** * <p> * Front end controller * </p> */ @RestController @RequestMapping("/goods") public
class GoodsController { @Autowired private GoodsService goodsService;
@Autowired private ProviderService providerService; @Autowired private
CategoryService categoryService; /** * Commodity fuzzy query * * @param * @return */
@SysLog(" Commodity query operation ") @RequestMapping("/goodsList") public DataGridViewResult
goodsList(GoodsVO goodsVO) { // Create paging information parameter 1 Current page parameter 2 Number of displays per page IPage<Goods> page =
new Page<>(goodsVO.getPage(), goodsVO.getLimit()); QueryWrapper<Goods>
queryWrapper = new QueryWrapper<>(); queryWrapper.eq(goodsVO.getProviderid() !=
null && goodsVO.getProviderid() != 0, "providerid", goodsVO.getProviderid());
queryWrapper.like(!StringUtils.isEmpty(goodsVO.getGname()), "gname",
goodsVO.getGname()); IPage<Goods> goodsIPage = goodsService.page(page,
queryWrapper); List<Goods> records = goodsIPage.getRecords(); for (Goods goods
: records) { Provider provider =
providerService.getById(goods.getProviderid()); if (null != provider) {
goods.setProvidername(provider.getProvidername()); } } return new
DataGridViewResult(goodsIPage.getTotal(), records); } /** * Add product information * * @param
goods * @return */ @SysLog(" Product addition ") @PostMapping("/addgoods") public Result
addGoods(Goods goods) { String id = RandomStringUtils.randomAlphanumeric(8); if
(goods.getGoodsimg()!=null&&goods.getGoodsimg().endsWith("_temp")){ String
newName = AppFileUtils.renameFile(goods.getGoodsimg());
goods.setGoodsimg(newName); } goods.setGnumbering(id); boolean bool =
goodsService.save(goods); if (bool) { return Result.success(true, "200",
" Added successfully !"); } return Result.error(false, null, " Add failed !"); } /** * Modify product information * *
@param goods * @return */ @SysLog(" Commodity modification ") @PostMapping("/updategoods") public
Result updateGoods(Goods goods) { // The product picture is not the default picture if
(!(goods.getGoodsimg()!=null&&goods.getGoodsimg().equals(Constast.DEFAULT_IMG))){
if (goods.getGoodsimg().endsWith("_temp")){ String newName =
AppFileUtils.renameFile(goods.getGoodsimg()); goods.setGoodsimg(newName);
// Delete original picture String oldPath = goodsService.getById(goods.getGid()).getGoodsimg();
AppFileUtils.removeFileByPath(oldPath); } } boolean bool =
goodsService.updateById(goods); if (bool) { return Result.success(true, "200",
" Modified successfully !"); } return Result.error(false, null, " Modification failed !"); } /** * Delete a single piece of data * *
@param id * @return */ @SysLog(" Product deletion ") @RequestMapping("/deleteOne") public
Result deleteOne(int id) { boolean bool = goodsService.removeById(id); if
(bool) { return Result.success(true, "200", " Delete succeeded !"); } return
Result.error(false, null, " Deletion failed !"); } /** * according to id Query the category owned by the current commodity * * @param id *
@return */ @RequestMapping("/initGoodsByCategoryId") public DataGridViewResult
initGoodsByCategoryId(int id) { List<Map<String, Object>> mapList = null; try {
// Query all category lists mapList = categoryService.listMaps(); // According to commodity id Query categories owned by goods Set<Integer>
cateIdList = categoryService.findGoodsByCategoryId(id); for (Map<String,
Object> map : mapList) { // Define tag Not selected by default boolean flag = false; int cateId = (int)
map.get("cateid"); for (Integer cid : cateIdList) { if (cid == cateId) { flag =
true; break; } } map.put("LAY_CHECKED", flag); } } catch (Exception e) {
e.printStackTrace(); } return new
DataGridViewResult(Long.valueOf(mapList.size()), mapList); } /** * According to commodity id Load product information
* @param goodsid * @return */ @GetMapping("/loadGoodsById") public
DataGridViewResult loadGoodsById(int goodsid) { QueryWrapper<Goods>
goodsQueryWrapper = new QueryWrapper<>(); goodsQueryWrapper.eq(goodsid != 0,
"gid", goodsid); Goods goods = goodsService.getById(goodsid); return new
DataGridViewResult(goods); } /** * Assign categories to items * * @param categoryids * @param
goodsid * @return */ @SysLog(" Category add operation ") @RequestMapping("/saveGoodsCategory")
public Result saveGoodsCategory(String categoryids, int goodsid) { try { if
(goodsService.saveGoodsCategory(goodsid, categoryids)) { return
Result.success(true, null, " Allocation succeeded "); } } catch (Exception e) {
e.printStackTrace(); } return Result.error(false, null, " allocation failed "); } /** * Load drop-down box
* * @return */ @RequestMapping("/loadAllGoods") public DataGridViewResult
loadAllGoods() { QueryWrapper<Goods> queryWrapper = new QueryWrapper<>();
List<Goods> list = goodsService.list(queryWrapper); return new
DataGridViewResult(list); } /** * Check commodity by supplier drop-down box * * @param providerid * @return
*/ @RequestMapping("/loadGoodsByProvidreId") public DataGridViewResult
loadGoodsByProvidreId(Integer providerid) { QueryWrapper<Goods>
goodsQueryWrapper = new QueryWrapper<>(); goodsQueryWrapper.eq(providerid !=
null, "providerid", providerid); List<Goods> list =
goodsService.list(goodsQueryWrapper); for (Goods goods : list) { Provider
provider = providerService.getById(goods.getProviderid()); if (null !=
provider) { goods.setProvidername(provider.getProvidername()); } } return new
DataGridViewResult(list); } }

Front end sales controller : 
/** * <p> * Front end controller * </p> */ @RestController @RequestMapping("/sale") public
class SaleController { @Autowired private SaleService saleService; @Autowired
private GoodsService goodsService; @Autowired private CustomerService
customerService; /** * Sales query * * @param * @return */ @SysLog(" Sales query operation ")
@RequestMapping("/saleList") public DataGridViewResult saleList(SaleVO saleVO)
{ // Create paging information parameter 1 Current page parameter 2 Number of displays per page IPage<Sale> page = new Page<>(saleVO.getPage(),
saleVO.getLimit()); QueryWrapper<Sale> queryWrapper = new QueryWrapper<>();
queryWrapper.like(!StringUtils.isEmpty(saleVO.getNumbering()),"numbering",
saleVO.getNumbering()); queryWrapper.eq(saleVO.getGid() != null &&
saleVO.getGid() != 0, "gid", saleVO.getGid());
queryWrapper.ge(saleVO.getStartTime() != null, "buytime",
saleVO.getStartTime()); queryWrapper.le(saleVO.getEndTime() != null, "buytime",
saleVO.getEndTime()); queryWrapper.orderByDesc("buytime"); IPage<Sale>
saleIPage = saleService.page(page, queryWrapper); List<Sale> records =
saleIPage.getRecords(); for (Sale sale : records) {
sale.setAllmoney(sale.getMoney()*sale.getBuyquantity()); Customer customer =
customerService.getById(sale.getCustid()); if (null != customer) {
sale.setCustomervip(customer.getCustvip());
sale.setCustomername(customer.getCustname()); } Goods goods =
goodsService.getById(sale.getGid()); if (null != goods) {
sale.setGoodsname(goods.getGname()); sale.setGnumbering(goods.getGnumbering());
} } return new DataGridViewResult(saleIPage.getTotal(), records); } /** *
Add sales order information * * @param sale * @return */ @SysLog(" Add sales ") @PostMapping("/addsale")
public Result addsale(Sale sale, HttpSession session) { if (sale.getGid()==0){
return Result.error(false, null, " Add failed ! Unselected item "); } Goods goods =
goodsService.getById(sale.getGid()); Integer gquantity = goods.getGquantity();
if(gquantity<sale.getBuyquantity()){ return Result.error(false, null,
" Add failed ! Insufficient inventory , Inventory is :"+gquantity); } User user = (User)
session.getAttribute("username"); String num =
RandomStringUtils.randomAlphanumeric(7); sale.setNumbering(num);
sale.setPerson(user.getUsername()); sale.setBuytime(new Date());
sale.setRealnumber(sale.getBuyquantity()); boolean bool =
saleService.save(sale); if (bool) { return Result.success(true, "200",
" Added successfully !"); } return Result.error(false, null, " Add failed ! Insufficient inventory "); } /** * Modify sales order information * *
@param sale * @return */ @SysLog(" Sales modification ") @PostMapping("/updatesale") public
Result updatesale(Sale sale, HttpSession session) { User user = (User)
session.getAttribute("username"); sale.setPerson(user.getUsername());
sale.setBuytime(new Date()); boolean bool = saleService.updateById(sale); if
(bool) { return Result.success(true, "200", " Modified successfully !"); } return
Result.error(false, null, " Modification failed !"); } /** * Delete a single piece of data * * @param id * @return */
@SysLog(" Delete sales ") @RequestMapping("/deleteOne") public Result deleteOne(int id)
{ boolean bool = saleService.removeById(id); if (bool) { return
Result.success(true, "200", " Delete succeeded !"); } return Result.error(false, null,
" Deletion failed !"); } }

Front end user controller :
/** * <p> * Front end controller * </p> * */ @RestController @RequestMapping("/user") public
class UserController { @Autowired private UserService userService; @Autowired
private RoleService roleService; /** * Sign in * * @param username user name * @param
password password * @param request * @return */ @SysLog(" Login operation ")
@PostMapping("/login") public Result login(String username, String password,
HttpServletRequest request) { try { // Gets the current login principal object Subject subject =
SecurityUtils.getSubject(); UsernamePasswordToken token = new
UsernamePasswordToken(username, password); subject.login(token); LoginUserVO
userDTO = (LoginUserVO) subject.getPrincipal();
request.getSession().setAttribute("username", userDTO.getUser()); return
Result.success(true, "200", " Login succeeded "); } catch (UnknownAccountException e) {
e.printStackTrace(); return Result.error(false, "400", " Login failed , user name does not exist "); }catch
(IncorrectCredentialsException e) { e.printStackTrace(); return
Result.error(false, "400", " Login failed , Password error "); }catch (AuthenticationException e) {
e.printStackTrace(); return Result.error(false, "400", " Login failed , Account disabled "); } } /** *
Get the login verification code * @param response * @param session * @throws IOException */
@RequestMapping("/getCode") public void getCode(HttpServletResponse response,
HttpSession session) throws IOException { // Defines the length and width of the graphic verification code LineCaptcha lineCaptcha
= CaptchaUtil.createLineCaptcha(116, 36,4,5);
session.setAttribute("code",lineCaptcha.getCode()); try { ServletOutputStream
outputStream = response.getOutputStream(); lineCaptcha.write(outputStream);
outputStream.close(); } catch (IOException e) { e.printStackTrace(); } } /** *
Query all user information * * @param userVO * @return */ @SysLog(" User query operation ")
@RequestMapping("/userList") public DataGridViewResult userList(UserVO userVO)
{ // Paging constructor IPage<User> page = new Page<>(userVO.getPage(), userVO.getLimit());
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
queryWrapper.like(!StringUtils.isEmpty(userVO.getUsername()), "username",
userVO.getUsername());
queryWrapper.like(!StringUtils.isEmpty(userVO.getUname()), "uname",
userVO.getUname()); /** * Page turning query * @param page Page turning object * @param queryWrapper
Entity object encapsulation operation class */ IPage<User> userIPage = userService.page(page, queryWrapper);
return new DataGridViewResult(userIPage.getTotal(), userIPage.getRecords()); }
/** * Add user information * * @param user * @return */ @SysLog(" User add operation ")
@PostMapping("/adduser") public Result addRole(User user) {
user.setUcreatetime(new Date()); String salt = UUIDUtil.randomUUID();
user.setPassword(PasswordUtil.md5("000000", salt, 2)); user.setSalt(salt);
user.setType(1); boolean bool = userService.save(user); try { if (bool) {
return Result.success(true, "200", " Added successfully !"); } } catch (Exception e) {
e.printStackTrace(); } return Result.error(false, null, " Add failed !"); } /** *
Verify that the user name exists * * @param username * @return */ @RequestMapping("/checkUserName")
public String checkUserName(String username) { Map<String, Object> map = new
HashMap<>(); try { QueryWrapper<User> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("username", username); User user =
userService.getOne(queryWrapper); if (user != null) { map.put("exist", true);
map.put("message", " User name already exists "); } else { map.put("exist", false);
map.put("message", " User name can be used "); } } catch (Exception e) { e.printStackTrace(); }
return JSON.toJSONString(map); } /** * Modify user information * * @param user * @return */
@SysLog(" User modification ") @PostMapping("/updateuser") public Result updateUser(User
user) { boolean bool = userService.updateById(user); try { if (bool) { return
Result.success(true, "200", " Modified successfully !"); } } catch (Exception e) {
e.printStackTrace(); } return Result.error(false, null, " Modification failed !"); } /** *
Delete a single piece of data * * @param id * @return */ @SysLog(" User delete operation ")
@RequestMapping("/deleteOne") public Result deleteOne(int id) { boolean bool =
userService.removeById(id); try { if (bool) { return Result.success(true,
"200", " Delete succeeded !"); } } catch (Exception e) { e.printStackTrace(); } return
Result.error(false, null, " Deletion failed !"); } /** * reset password * * @param id * @return */
@SysLog(" User modification ") @PostMapping("/resetPwd") public Result resetPwd(int id) {
User user = new User(); String salt = UUIDUtil.randomUUID(); user.setUid(id);
user.setPassword(PasswordUtil.md5("000000", salt, 2)); user.setSalt(salt);
boolean bool = userService.updateById(user); try { if (bool) { return
Result.success(true, "200", " Reset successful !"); } } catch (Exception e) {
e.printStackTrace(); } return Result.error(false, null, " Reset failed !"); } /** *
according to id Query the roles owned by the current user * * @param id * @return */ @RequestMapping("/initRoleByUserId")
public DataGridViewResult initRoleByUserId(int id) { List<Map<String, Object>>
mapList = null; try { // Query all role lists mapList = roleService.listMaps();
// According to user id Query user owned roles Set<Integer> roleIdList = userService.findRoleByUserId(id);
for (Map<String, Object> map : mapList) { // Define tag Not selected by default boolean flag = false;
int roleId = (int) map.get("roleid"); for (Integer rid : roleIdList) { if (rid
== roleId) { flag = true; break; } } map.put("LAY_CHECKED", flag); } } catch
(Exception e) { e.printStackTrace(); } return new
DataGridViewResult(Long.valueOf(mapList.size()), mapList); } /** * Assign roles to users * *
@param roleids * @param userid * @return */ @SysLog(" User add operation ")
@RequestMapping("/saveUserRole") public Result saveUserRole(String roleids, int
userid) { try { if (userService.saveUserRole(userid, roleids)) { return
Result.success(true, null, " Allocation succeeded "); } } catch (Exception e) {
e.printStackTrace(); } return Result.error(false, null, " allocation failed "); } /** * Change Password *
* @param newPassWord1 * @param newPassWord2 * @return */
@RequestMapping("/updateUserPassWord") public Result updateUserPassWord(String
newPassWord1, String newPassWord2,HttpSession session) { User sessionUser =
(User) session.getAttribute("username"); if
(newPassWord1.equals(newPassWord2)){ User user = new User(); String salt =
UUIDUtil.randomUUID(); user.setUid(sessionUser.getUid());
user.setPassword(PasswordUtil.md5(newPassWord1, salt, 2)); user.setSalt(salt);
boolean bool = userService.updateById(user); if (bool){ return
Result.success(true,null," Modified successfully "); }else { return
Result.error(false,null," Modification failed !"); } }else { return
Result.error(false,null," Modification failed , The two passwords are inconsistent !"); } } }

Technology
©2019-2020 Toolsou All rights reserved,
evo Tool usage problems ——Degenerate covariance rank, Umeyama alignment is not possible Experiment 4 Automated test tools - software test mysql Export data sql sentence _mysql according to sql Query statement export data Create a thread ——— Javaweb (3) Data structure experiment ( three )—— Stacks and queues TS stay vue2 Writing in the project web Front end signature plug-in _signature_pad Plug in implements electronic signature function docker Where is the image stored Qt Getting Started tutorial 【 Basic controls 】QCalendarWidget calendar control springboot How to get reality in ip address