4.3.3點餐模塊17
4.4后臺管理端19
4.4.1管理員登陸模塊19
4.4.2食材管理模塊19
5推論21
參考文獻22
附表23
致謝37
3系統剖析與總體設計
3.1系統可行性剖析
(1)技術可行性:開發這套新鄉學院外賣排行推薦助手小程序構架基于微信+Java+SSM+HTML技術來實現;以微信小程序開發者工具進行開發,采用MySQL數據庫來存儲平臺系統數據,使用最精典的協同過濾算法來推薦排行,以上的小程序和網站開發組合已被大量的小程序應用所證明,運行穩定可靠外賣點餐,可作為校園外賣排行運算推薦的開發技術,因而技術上可行。
(2)經濟可行性:微信小程序是集合在微信上的功能,所以并不須要安裝或則是下載,只須要人力物力的投入,時間上也合適,不須要好多額外開支外賣點餐,后期可以通過推廣商鋪來繳納一定的利益,因而具有經濟可行性。
(3)操作可行性:本系統實現了用戶與數據庫的互動,界面簡單友好,操作便捷。才能為用戶提供愈加具體的商鋪數據。與此同時對于許多顧客來說,微信小程序不占用手機的顯存,并且也不受手機系統的限制,可以使用上去非常的快捷,具有操作可行性。
(4)法律可行性:本文轉載自是合法的研究方向課題,符合法律要求。
系統可行性剖析從技術可行性、經濟可行性、運行可行性以及法律可行性等方面剖析。
3.2系統功能需求剖析
課題設計校園外賣個性化推薦系統包括小程序端和后臺管理端兩個部份,小程序注冊用戶和商家用戶可飯店列表、購物車訂單及個人中心等,后臺管理端可對食材信息、菜品類別信息、優惠資訊管理、訂單管理、統計及用戶管理等。
4系統詳盡設計與實現
4.1系統功能結構設計
課題設計校園外賣個性化推薦系統包括小程序端和后臺管理端兩個部份,小程序注冊用戶和商家用戶可飯店列表、購物車訂單及個人中心等,后臺管理端可對食材信息、菜品類別信息、優惠資訊管理、訂單管理、統計及用戶管理等。
其系統結布光如4-1圖所示。
圖4-1系統功能結布光
Fig.4-1
package com.ideabobo;
import org.mybatis.generator.api.MyBatisGenerator;
import org.mybatis.generator.config.Configuration;
import org.mybatis.generator.config.xml.ConfigurationParser;
import org.mybatis.generator.exception.InvalidConfigurationException;
import org.mybatis.generator.exception.XMLParserException;
import org.mybatis.generator.internal.DefaultShellCallback;
import com.alibaba.fastjson.JSON;
import com.ideabobo.util.Common;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.DatabaseMetaData;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* @Describe
* @Author Corey
* @Date 2018/7/12.
*/
public class StartGenerator {
public static void main(String[] args) {
createMappingTables();
List<String> warnings = new ArrayList<String>();
boolean overwrite = true;
String genCfg = "/generatorConfig.xml";
File configFile = new File(StartGenerator.class.getResource(genCfg)
.getFile());
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = null;
try {
config = cp.parseConfiguration(configFile);
} catch (IOException e) {
e.printStackTrace();
} catch (XMLParserException e) {
e.printStackTrace();
}
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
MyBatisGenerator myBatisGenerator = null;
try {
myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
} catch (InvalidConfigurationException e) {
e.printStackTrace();
}
try {
myBatisGenerator.generate(null);
} catch (SQLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public static void createMappingTables() {
Connection con = null;
try {
// 使用properties對象加載輸入流
// 獲取key對應的value值
String driver = Common.getProperty("spring.datasource.driver-class-name");// "com.mysql.jdbc.Driver";
String url = Common.getProperty("spring.datasource.url");// "jdbc:mysql://localhost:3306/samp_db";
String username = Common.getProperty("spring.datasource.username"); // "root";
String password = Common.getProperty("spring.datasource.password");// "";
Class.forName(driver); // classLoader,加載對應驅動
con = (Connection) DriverManager.getConnection(url, username,
password);
} catch (Exception e) {
e.printStackTrace();
}
try {
DatabaseMetaData meta = (DatabaseMetaData) con.getMetaData();
ResultSet rs = meta.getTables(null, null, null,
new String[] { "TABLE" });
ArrayList<String> tables = new ArrayList<>();
while (rs.next()) {
String tableName = rs.getString(3);
tables.add(tableName);
System.out.println("表名:" + rs.getString(3));
//System.out.println("表所屬用戶名:" + rs.getString(2));
System.out.println("------------------------------");
}
con.close();
String filePackage = Common.getProperty("tablemappingpackage");
String servicePackage = Common.getProperty("servicemappingpackage").replaceAll("\\.", "\\\\")+"\\";
String packagePath = System.getProperty("user.dir")+"\\src\\main\\java\\"+filePackage.replaceAll("\\.", "\\\\")+"\\";
String servicePackagePath = System.getProperty("user.dir")+"\\src\\main\\java\\"+servicePackage;
String cfilepath = "Dbtablemapping.java";
String path = packagePath+cfilepath;
File file = new File(path);
File packageDir = new File(packagePath);
File serviceDir = new File(servicePackagePath);
if(packageDir.exists()){
if(packageDir.isDirectory()){
File[] modelFiles = packageDir.listFiles();
for(File mfile:modelFiles){
if(mfile.getName().equals("Dbtablemapping.java")||mfile.getName().equals("Dbservice.java")){
continue;
}else{
mfile.delete();
}
}
}
}
if(serviceDir.exists()){
if(serviceDir.isDirectory()){
File[] modelFiles = serviceDir.listFiles();
for(File mfile:modelFiles){
if(mfile.getName().equals("DatabaseService.java")){
continue;
}else{
mfile.delete();
}
}
}
}
StringBuilder sb = new StringBuilder();
sb.append("package com.ideabobo.model;\r\n");
sb.append("import com.alibaba.fastjson.JSON;\r\n");
sb.append("public class Dbtablemapping {\r\n");
sb.append("\tpublic static Object parseStringModel(String value, String table) {\r\n");
sb.append("\t\tObject object = null;\r\n");
sb.append("\t\tswitch (table) {\r\n");
//sb.append("");//拼裝
for(String table:tables){
String caseStr = "\t\t\tcase \""+table+"\": object = JSON.parseObject(value, "+getModeNameByTable(table)+".class); break;\r\n";
sb.append(caseStr);
}
sb.append("\t\t}\r\n");
sb.append("\t\treturn object;\r\n");
sb.append("}\r\n");
sb.append("public static Object getModelByTable(String table) {\r\n");
sb.append("\tObject object = null;\r\n");
sb.append("\tswitch (table) {\r\n");
for(String table:tables){
String caseStr = "\t\t\tcase \""+table+"\": object = new "+getModeNameByTable(table)+"(); break;\r\n";
sb.append(caseStr);
}
sb.append("\t\t}\r\n");
sb.append("\t\treturn object;\r\n");
sb.append("\t}\r\n");
sb.append("}\r\n");
if(!file.exists()){
System.out.println(file.getAbsolutePath());
file.createNewFile();
}
Common.str2File(file.getAbsolutePath(), sb.toString());
String mappingfilepath = System.getProperty("user.dir")+"\\src\\main\\resources\\mapper\\";
File mfile = new File(mappingfilepath);
if(mfile.exists() && mfile.isDirectory()){
File[] files = mfile.listFiles();
for(File mapperfile:files){
String mapfilename = mapperfile.getName();
if(!mapfilename.equals("DatabaseMapper.xml")){
mapperfile.delete();
}
}
}
} catch (Exception e) {
try {
con.close();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static String getModeNameByTable(String tableName){
String tablePre = Common.getProperty("tableprefix");
String modelName = tableName;
if(tablePre!=null && !tablePre.equals("")){
modelName = modelName.replaceAll(tablePre, "");
}
modelName = Common.toUpperCaseFirstOne(modelName);
return modelName;
}
}
免責聲明:部分文章信息來源于網絡以及網友投稿,本站只負責對文章進行整理、排版、編輯,出于傳遞更多信息之目的,并不意味著贊同其觀點或證實其內容的真實性,如本站文章和轉稿涉及版權等問題,請作者在及時聯系本站,我們會盡快為您處理。