SSMに基づくShudu Tianxiangレストラン管理システム

最後にソースコードを取得します
開発言語: Java
Java 開発ツール: JDK1.8
バックエンドフレームワーク: SSM
フロントエンド: JSP テクノロジーを使用して開発
データベース: MySQL5.7 と Navicat 管理ツールの組み合わせ
サーバー: Tomcat8.5
開発ソフトウェア: IDEA / Eclipse
Maven プロジェクト: はい


目次

1. プロジェクトの紹介

2. 研究の背景と意義

3. システムプロジェクトのスクリーンショット

3.1 管理者機能の実装

3.2 ユーザー機能の実現

4. コアコード

4.1 ログイン関連

4.2 ファイルのアップロード

4.3 梱包

5. システムテスト

5.1 テストの概要

5.2 テスト結果


1. プロジェクトの紹介

近年、情報管理産業の継続的な台頭により、人々の日常生活がコンピュータやインターネット技術からますます切り離せないものになってきています。まず、収集したユーザーニーズ分析に従って、設計システムを予備的に理解し、Shudu Tianxiang レストラン管理システムの全体的な機能モジュールを決定します。次に、システムの主要な機能モジュールを詳細に設計し、データベース設計プロセスを通じて関連するデータ情報をデータベースに保存します。その後、MyEclipse 開発プラットフォーム、JSP テクノロジなどの主要な開発ツールを使用してコードを作成し、関連する機能モジュールを設計します。次に、システムは主に機能テストによってテストされ、システムの実行プロセスに存在する問題点とその解決方法が発見され、システムの設計が継続的に改善され完成されます。最後に、本稿で紹介したシステムの設計・導入プロセスをまとめ、今後のシステム開発の展望を提案する。このシステムの研究開発は非常に重要であり、セキュリティの面では、ユーザーがブラウザを使用してウェブサイトにアクセスする際には、登録やパスワードなどの適切な保護措置が講じられ、システムの信頼性を向上させ、ユーザーの個人情報の安全を維持します。情報も財産も。利便性の面では、レストラン管理業界の情報化構築を促進し、関係スタッフによるレストラン情報の管理が大幅に容易になります。


2. 研究の背景と意義

情報管理モードは、業界のワークフローを手動サービスからコンピューター技術を使用した情報管理サービスに段階的に変換することです。この管理モードは急速に発展しており、非常にシンプルで使いやすいため、ユーザーは関連する専門知識を習得する必要さえなく、チュートリアルのガイダンスに従って関連システムを通常どおりに使用できるため、より多くの人に使用されています。そしてより多くのユーザー。関連業界における経営の情報化により、管理業務は時間やエリアの制限がなくなり、いつでもどこでも関連業務や成果を完了できるようになりました[1]。現在のところ、経営の情報化は非常に人気があり、現代社会で広く使用されています。1970年代末には初期の電子商取引が登場し、関連企業や企業はコンピュータを利用して専用の社内ネットワークを構築し、それに対応する購買や販売などの活動を内部ネットワークを通じて完結させ、関連企業間の取引を迅速化しました。効率[2]。

現在、多くの業界がインターネット技術を利用して業務プロセスの情報化とデジタル化を行っており、これにより関係者のサービス品質と効率が向上し、関連業界の人的、財務的、物的資源およびその他のリソースが節約されています。外部の世界から関連情報を取得するためのインターネット、主流の情報技術とツール。また、人々の生活に対する要求も常に変化しており、ユーザーの多様なニーズに対応するため、関連する第三次産業が数多く誕生し、電子商取引産業など経営の情報化も徐々に進んでいます。大量の学習教材を参照することで、基本的な開発システムの基本的な背景と主要なタスクを理解し、Java言語、Web技術、JSP技術、HTML言語などの開発技術、デザインシステム機能モジュール、 MySQL データベースの関連構文とツールを使用して、データ テーブルを作成および保存し、テーブル間の相互関係を反映および関連付けることにより、Shudu Tianxiang Restaurant 管理システムを開発および実装します。



3. システムプロジェクトのスクリーンショット

3.1 管理者機能の実装

管理者は、任意のブラウザを選択して Web サイトを開くことができ、正しい情報を入力した後、管理者として関連する管理権限を行使できます。

管理者は、[ユーザー管理] を選択して、ユーザー アカウントの表示、ユーザー名の変更など、関連するユーザー情報レコードを管理できます。

 

管理者は、料理タイプの追加、定食タイプの表示、飲み物タイプの変更など、タイプ管理を選択することで、関連するタイプ情報レコードを管理できます。

 

管理者は、料理名、詳細情報の表示、価格の変更などの料理管理を選択することで、関連する料理情報レコードを管理できます。

 

管理者は、個室管理を選択することで、個室名の確認、個室情報の照会、個室の保証金の変更など、関連する個室情報の記録を管理することができます。

 

管理者は、顧客サービス管理、カルーセルマップ管理、アクティビティの相談と閲覧などのシステム管理を選択して、関連するシステム情報を管理します。

 

 

 

3.2 ユーザー機能の実現

ユーザーは本システムをブラウザ上で開き、イベント情報の閲覧、個室予約、料理情報の閲覧などの操作を行うことができます。

個室予約を選択すると、個室詳細の閲覧、個室予約、個室評価など、関連する個室情報を予約できます。

 

ユーザーは、料理名の閲覧、買い物カゴへの追加、即購入など、料理情報を選択することで関連する料理情報レコードを閲覧することができます。

 

ユーザーは、個人データの表示、個人注文の表示、個人コレクションの管理など、パーソナル センターを選択して個人情報を管理できます。

 


4. コアコード

4.1 ログイン関連


package com.controller;


import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;

/**
 * 登录相关
 */
@RequestMapping("users")
@RestController
public class UserController{
	
	@Autowired
	private UserService userService;
	
	@Autowired
	private TokenService tokenService;

	/**
	 * 登录
	 */
	@IgnoreAuth
	@PostMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
		if(user==null || !user.getPassword().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
		return R.ok().put("token", token);
	}
	
	/**
	 * 注册
	 */
	@IgnoreAuth
	@PostMapping(value = "/register")
	public R register(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

	/**
	 * 退出
	 */
	@GetMapping(value = "logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
    	user.setPassword("123456");
        userService.update(user,null);
        return R.ok("密码已重置为:123456");
    }
	
	/**
     * 列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,UserEntity user){
        EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
    	PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/list")
    public R list( UserEntity user){
       	EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
      	ew.allEq(MPUtil.allEQMapPre( user, "user")); 
        return R.ok().put("data", userService.selectListView(ew));
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);
        userService.updateById(user);//全部更新
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

4.2 ファイルのアップロード

package com.controller;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity;
import com.entity.EIException;
import com.service.ConfigService;
import com.utils.R;

/**
 * 上传文件映射表
 */
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
	@Autowired
    private ConfigService configService;
	/**
	 * 上传文件
	 */
	@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("上传文件不能为空");
		}
		String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
		File path = new File(ResourceUtils.getURL("classpath:static").getPath());
		if(!path.exists()) {
		    path = new File("");
		}
		File upload = new File(path.getAbsolutePath(),"/upload/");
		if(!upload.exists()) {
		    upload.mkdirs();
		}
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(upload.getAbsolutePath()+"/"+fileName);
		file.transferTo(dest);
		FileUtils.copyFile(dest, new File("C:\\Users\\Desktop\\jiadian\\springbootl7own\\src\\main\\resources\\static\\upload"+"/"+fileName));
		if(StringUtils.isNotBlank(type) && type.equals("1")) {
			ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
			if(configEntity==null) {
				configEntity = new ConfigEntity();
				configEntity.setName("faceFile");
				configEntity.setValue(fileName);
			} else {
				configEntity.setValue(fileName);
			}
			configService.insertOrUpdate(configEntity);
		}
		return R.ok().put("file", fileName);
	}
	
	/**
	 * 下载文件
	 */
	@IgnoreAuth
	@RequestMapping("/download")
	public ResponseEntity<byte[]> download(@RequestParam String fileName) {
		try {
			File path = new File(ResourceUtils.getURL("classpath:static").getPath());
			if(!path.exists()) {
			    path = new File("");
			}
			File upload = new File(path.getAbsolutePath(),"/upload/");
			if(!upload.exists()) {
			    upload.mkdirs();
			}
			File file = new File(upload.getAbsolutePath()+"/"+fileName);
			if(file.exists()){
				/*if(!fileService.canRead(file, SessionManager.getSessionUser())){
					getResponse().sendError(403);
				}*/
				HttpHeaders headers = new HttpHeaders();
			    headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);    
			    headers.setContentDispositionFormData("attachment", fileName);    
			    return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}

4.3 梱包

package com.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * 返回数据
 */
public class R extends HashMap<String, Object> {
	private static final long serialVersionUID = 1L;
	
	public R() {
		put("code", 0);
	}
	
	public static R error() {
		return error(500, "未知异常,请联系管理员");
	}
	
	public static R error(String msg) {
		return error(500, msg);
	}
	
	public static R error(int code, String msg) {
		R r = new R();
		r.put("code", code);
		r.put("msg", msg);
		return r;
	}

	public static R ok(String msg) {
		R r = new R();
		r.put("msg", msg);
		return r;
	}
	
	public static R ok(Map<String, Object> map) {
		R r = new R();
		r.putAll(map);
		return r;
	}
	
	public static R ok() {
		return new R();
	}

	public R put(String key, Object value) {
		super.put(key, value);
		return this;
	}
}

5. システムテスト

5.1 テストの概要

システムを使用する前に行う必要がある作業の重要な部分は、システム テストです。システムテストでは、システム使用時のインターフェイス環境がクリーンでフレンドリーであるか、ユーザーアカウント情報が安全で信頼できるか、パフォーマンスが安定して堅牢であるか、機能がユーザーのニーズを満たしているかなどを検証します。システムテストでは、システム運用中に発生する問題を発見するだけでなく、問題の原因を分析し、解決する方法を見つける必要もあります[21]。

システムテストは主にブラックボックステストとホワイトボックステストに分けられます[22]。ブラックボックステストは機能テストであり、主にユーザーの観点からシステムをテストします。ブラックボックステストのプロセスでは、テスターはシステム内のコードに注意を払って理解する必要がなく、システムのプログラムインターフェイスに従ってシステム機能を実行してテストします。ホワイトボックステストは構造テストであり、主にプログラマの観点からシステムをテストします。ブラックボックステストとは異なり、ホワイトボックステストはコードベースのテストプロセスであり、テスト担当者はシステムの内部コードなどを理解し、実際のシステムが期待どおりの結果になっているかどうかを確認する必要があります。プログラムの状態や論理パスが期待した結果と一致しているか 設計内容が仕様に準拠しているか。

5.2 テスト結果

このシステムは主に機能テストの方法を使用して、システムの機能的効果をテストします。

 

テスト環境は、低構成のコンピューターまたはノートブックを使用し、Windows 7 以降のオペレーティング システム環境を構成し、ブラウザーにこのシステムの Web サイトのアドレスを入力し、このシステムのホームページに正常にアクセスできる場合、それを意味します。このシステムがテストを正常に実行できることを確認します。つまり、上記の関連するシステム テストの内容によれば、このシステムのテスト結果は比較的スムーズで、システム パフォーマンスは比較的安定しており、基本的に問題はありません。 

おすすめ

転載: blog.csdn.net/weixin_52721608/article/details/132758882