Android客户端功能描述:
1:登录注册:用户可以通过自己的信息进行账号的注册
2:商家查看:查看发布的外卖商家信息
3:商家详情:用户点击某一个商家之后可以查看商家的地址和联系方式信息
4:外卖分类:用户在点餐的详情页面可以根据分类信息进行美食的选择;
5:订单支付:用户选择完美食之后可以查看自己选择的信息,以及对美食信息进行支付
6:我的订单:用户可以查看自己的订单信息;
7:个人信息:用户登录之后可以查看用户的基本资料以及对密码信息进行修改
后台服务端功能描述:
1:用户管理:可以查看注册的用户信息
2:订单信息:查看用户的订单信息
3:商家信息:添加商家信息以及对商家信息进行查看
1:客户端使用Android stuido进行开发;
2:服务端后台使用Myeclipse2014进行开发;
3:mysql数据库进行数据存储;
4:需要jdk1.7以上
5:使用雷电模拟器或者Androidstuio自带的模拟器进行运行
总体设计逻辑和思路:
1:先设计数据库表文件
2:写服务端jsp页面以及写api接口给客户端提供数据
3:完成后台服务端的数据交互,也就是jsp页面数据的存储和显示
4:进行客户端页面的开发;
5:进行客户端对api接口的调用,也就是获取数据库的数据以及在客户端进行显示移动端:
1:使用android原生控件以及xml布局文件来完成界面的显示
2:使用java代码完成功能的数据和逻辑交互
3:使用http网络请求完成数据的请求;
4:使用json数据解析完成客户端数据的回调和显示服务端后台:
1:使用mysql完成数据的存储
2:使用jdbc完成数据库和代码的逻辑交互
3:使用jsp完成网页数据的显示
4:使用java代码完成api接口的编写以及以及数据的回调
四、运行截图信息
说明:后台信息管理界面
说明:用户登录之后的首页界面,也就是商家的列表界面,点击之后可以查看详情的信息界面;
说明:个人信息界面,可以查看用户的信息,我的订单,修改密码信息;
说明:用点餐界面,用户在此界面可以根据分类点餐,也可以选择美食的数量信息,选择完之后可以进行美食的支付操作;
说明:订单信息确认界面;
说明:我的订单界面,可以查看自己的历史订单信息;
public class StoreFragment extends BaseFragment {// 获取view
private View rootView;
// 获取控件
private ListView mListMessage;
Listlist_result = new ArrayList ();
MaterialRefreshLayout materialRefreshLayout;
private boolean isPrepared;@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_newsload, null);
isPrepared = true;
// setlazyLoad();
initWidget();
initData();
return rootView;
}/**
* 加载数据的方法,只要保证isPrepared和isVisible都为true的时候才往下执行开始加载数据
*/
@Override
protected void setlazyLoad() {
super.setlazyLoad();if (!isPrepared || !isVisible) {
return;
}
if (list_result.size() == 0) {
initWidget();
initData();
}
}
@Override
public void initWidget() {mListMessage = (ListView) rootView.findViewById(R.id.mListMessage);
materialRefreshLayout = (MaterialRefreshLayout) rootView.findViewById(R.id.refresh);
materialRefreshLayout.setLoadMore(false);
materialRefreshLayout.setMaterialRefreshListener(new MaterialRefreshListener() {
@Override
public void onRefresh(final MaterialRefreshLayout materialRefreshLayout) {
CampusAction(false);
materialRefreshLayout.finishRefresh();
}
@Override
public void onRefreshLoadMore(MaterialRefreshLayout materialRefreshLayout) {
//上拉加载更多...
// 结束上拉刷新...
materialRefreshLayout.finishRefreshLoadMore();
}
});
}@Override
public void onClick(View v) {}
@Override
public void initData() {
CampusAction(true);
mListMessage.setOnItemClickListener(new OnItemClickListener() {@Override
public void onItemClick(AdapterView> arg0, View arg1, int pos, long arg3) {Intent intent = new Intent(getActivity(), LookStoreActivity.class);
intent.putExtra("msg",list_result.get(pos));
startActivity(intent);
}
});}
private void CampusAction(boolean isShow) {
AjaxParams params = new AjaxParams();
params.put("action_flag", "listTypePhone");
httpPost(Consts.URL + Consts.APP.FoodAction, params, Consts.actionId.resultCode, isShow, "正在加载...");
}
@Override
protected void callBackSuccess(ResponseEntry entry, int actionId) {
super.callBackSuccess(entry, actionId);switch (actionId) {
case Consts.actionId.resultCode:
materialRefreshLayout.finishRefresh();
if (null != entry.getData() && !TextUtils.isEmpty(entry.getData())) {String jsonMsg = entry.getData().substring(1, entry.getData().length() - 1);
if (null != jsonMsg && !TextUtils.isEmpty(jsonMsg)) {
list_result = mGson.fromJson(entry.getData(), new TypeToken>() {
}.getType());
StorListAdapter campusAdapter = new StorListAdapter(getActivity(), list_result);
mListMessage.setAdapter(campusAdapter);
} else {
}
}
break;
default:
break;
}}
@Override
protected void callBackAllFailure(String strMsg, int actionId) {
super.callBackAllFailure(strMsg, actionId);
ToastUtil.show(getActivity(), strMsg);}
@Override
public void onResume() {
// TODO Auto-generated method stub
super.onResume();}
}
public class FoodFragment extends BaseFragment implements FoodAddListner {MainModel mainModel;
private ListlistMsgSearch = new ArrayList ();
// 获取view
private View rootView;
// 获取控件
private ListView mListMessage;private ListView mListChoiceMessage;
private CheckBox mllType;
private Listlist_result_type = new ArrayList ();
private boolean isPrepared;// 预加载标志private TextView mtvFoodNumber;
private LinearLayout mllGoBuy;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_selected, null);
isPrepared = true;
setlazyLoad();
return rootView;
}/**
* 加载数据的方法,只要保证isPrepared和isVisible都为true的时候才往下执行开始加载数据
*/
@Override
protected void setlazyLoad() {
super.setlazyLoad();if (!isPrepared || !isVisible) {
return;
}
if (listFood.size() == 0) {
initWidget();
initData();
}
}@Override
public void initWidget() {
mListChoiceMessage = (ListView) rootView.findViewById(R.id.mListChoiceMessage);
mllType = (CheckBox) rootView.findViewById(R.id.mllType);
mListMessage = (ListView) rootView.findViewById(R.id.mListMessage);
mtvFoodNumber = (TextView) rootView.findViewById(R.id.mtvFoodNumber);mllGoBuy = (LinearLayout) rootView.findViewById(R.id.mllGoBuy);
mllGoBuy.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {Intent intent = new Intent(getActivity(),PayMessageActivity.class);
intent.putExtra("msg",(Serializable) list_result_choice);
intent.putExtra("payMoney",shopMoneyPrice+"");
getActivity().startActivity(intent);
}
});}
@Override
public void onClick(View v) {
}
@Override
public void initData() {TypeModel type = new TypeModel();
type.setTypeId("-1");
type.setTypeId("-1");
type.setTypeId("-1");
mllType.setOnCheckedChangeListener(new OnCheckedChangeListener() {@Override
public void onCheckedChanged(CompoundButton arg0, boolean arg1) {ChoiceMessageAdapter choiceMessageAdapter = new ChoiceMessageAdapter(getActivity(), list_result_type);
mListChoiceMessage.setAdapter(choiceMessageAdapter);if (arg1) {
mListChoiceMessage.setVisibility(View.VISIBLE);
} else {
mListChoiceMessage.setVisibility(View.GONE);
}
}
});listPhoneMessage(false);
}
private void listPhoneMessage(boolean isShow) {
AjaxParams params = new AjaxParams();
params.put("action_flag", "listPhoneMessage");
httpPost(Consts.URL + Consts.APP.FoodAction, params, Consts.actionId.resultFlag, isShow, "正在加载...");
}private List
listFood = new ArrayList ();
FoodChocieListAdapter lookListAdapter;
@Override
protected void callBackSuccess(ResponseEntry entry, int actionId) {
super.callBackSuccess(entry, actionId);switch (actionId) {
case Consts.actionId.resultFlag:
if (null != entry.getData() && !TextUtils.isEmpty(entry.getData())) {String jsonMsg = entry.getData().substring(1, entry.getData().length() - 1);
if (null != jsonMsg && !TextUtils.isEmpty(jsonMsg)) {
mainModel = mGson.fromJson(entry.getData(), MainModel.class);
list_result_type = mainModel.getFlagTop();
listFood = mainModel.getFlagFood();
lookListAdapter= new FoodChocieListAdapter(getActivity(), listFood, this);
mListMessage.setAdapter(lookListAdapter);
}
}
break;
}}
@Override
protected void callBackAllFailure(String strMsg, int actionId) {
super.callBackAllFailure(strMsg, actionId);
ToastUtil.show(getActivity(), strMsg);}
private FoodModel foodModelAdapter;
@Override
public void setJian(int pos, FoodModel carModel) {
Log.i("pony_log:", pos + "");
carModel.setTotalNumber(carModel.getTotalNumber() - 1);
listFood.set(pos, carModel);
lookListAdapter.notifyDataSetChanged();
TotalMoney();
}@Override
public void setJia(int pos, FoodModel carModel) {
Log.i("pony_log:", pos + "");
carModel.setTotalNumber(carModel.getTotalNumber() + 1);
listFood.set(pos, carModel);
lookListAdapter.notifyDataSetChanged();
TotalMoney();
}
private Listlist_result_choice = new ArrayList (); Double shopMoneyPrice ;
private void TotalMoney() {
shopMoneyPrice = 0.0;
list_result_choice.clear();
for (int i = 0; i < listFood.size(); i++) {
shopMoneyPrice = shopMoneyPrice + (Double.valueOf(listFood.get(i).getfMoney()) * listFood.get(i).getTotalNumber());
if (listFood.get(i).getTotalNumber()>0) {
list_result_choice.add(listFood.get(i));
}
}
mtvFoodNumber.setText(shopMoneyPrice + "元");
}
}
/*
Navicat MySQL Data TransferSource Server : mydata
Source Server Version : 50528
Source Host : localhost:3306
Source Database : takeawayTarget Server Type : MYSQL
Target Server Version : 50528
File Encoding : 65001Date: 2023-02-23 16:24:17
*/SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for classifytb
-- ----------------------------
DROP TABLE IF EXISTS `classifytb`;
CREATE TABLE `classifytb` (
`classifyId` int(11) NOT NULL AUTO_INCREMENT,
`classifyTypeId` int(11) DEFAULT NULL,
`classifyName` varchar(255) DEFAULT NULL,
PRIMARY KEY (`classifyId`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;-- ----------------------------
-- Records of classifytb
-- ----------------------------
INSERT INTO `classifytb` VALUES ('1', '15', '人气必买');
INSERT INTO `classifytb` VALUES ('2', '15', '清爽果茶');
INSERT INTO `classifytb` VALUES ('3', '15', '现煮奶茶');
INSERT INTO `classifytb` VALUES ('4', '15', '零食小吃');
INSERT INTO `classifytb` VALUES ('5', '15', '大单划算');-- ----------------------------
-- Table structure for foodmsg
-- ----------------------------
DROP TABLE IF EXISTS `foodmsg`;
CREATE TABLE `foodmsg` (
`fid` int(50) NOT NULL AUTO_INCREMENT,
`fTitle` varchar(100) NOT NULL,
`fTyeId` varchar(100) DEFAULT NULL,
`fTyeName` varchar(255) DEFAULT NULL,
`fMoney` varchar(255) DEFAULT NULL,
`fTopState` varchar(255) DEFAULT NULL,
`fImage` varchar(100) NOT NULL,
`fStoreId` int(11) DEFAULT NULL,
PRIMARY KEY (`fid`)
) ENGINE=InnoDB AUTO_INCREMENT=60 DEFAULT CHARSET=utf8;-- ----------------------------
-- Records of foodmsg
-- ------------------------------ ----------------------------
-- Table structure for ordertb
-- ----------------------------
DROP TABLE IF EXISTS `ordertb`;
CREATE TABLE `ordertb` (
`orderId` int(11) NOT NULL AUTO_INCREMENT,
`orderMessageId` varchar(255) DEFAULT NULL,
`orderMessageInfor` varchar(255) DEFAULT NULL,
`orderMessageMoney` varchar(255) DEFAULT NULL,
`tableMessage` varchar(255) DEFAULT NULL,
`orderUserId` varchar(11) DEFAULT NULL,
`orderUserName` varchar(255) DEFAULT NULL,
`orderTime` varchar(100) DEFAULT NULL,
PRIMARY KEY (`orderId`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;-- ----------------------------
-- Records of ordertb
-- ----------------------------
-- ----------------------------
-- Table structure for typemsg
-- ----------------------------
DROP TABLE IF EXISTS `typemsg`;
CREATE TABLE `typemsg` (
`typeId` int(50) NOT NULL AUTO_INCREMENT,
`typeName` varchar(255) DEFAULT NULL,
`typePhone` varchar(100) DEFAULT NULL,
`typeAddress` varchar(255) DEFAULT NULL,
`typeImage` varchar(255) DEFAULT NULL,
PRIMARY KEY (`typeId`)
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8;-- ----------------------------
-- Records of typemsg
-- ------------------------------ ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`uid` int(50) NOT NULL AUTO_INCREMENT,
`uname` varchar(100) NOT NULL,
`uphone` varchar(100) NOT NULL,
`upswd` varchar(100) NOT NULL,
`utime` varchar(100) NOT NULL,
`uaddress` varchar(255) DEFAULT NULL,
PRIMARY KEY (`uid`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;-- ----------------------------
-- Records of user
-- ----------------------------