手把手教你做一个安卓点餐系统
Posted 程序员springmeng
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了手把手教你做一个安卓点餐系统相关的知识,希望对你有一定的参考价值。
最近有小伙伴要学习安卓,今天给大家展示一个安卓系统的开发,希望能帮到你学习!
传统的点餐方式有:
1) 手工点餐模式。在这种模式下,流程简单,店员很快知道要点什么,但随着点餐人数多,就会让店家分不清谁点的是什么,出错概率就增加。
2) 店员手持PDA等触摸屏掌上电脑进行点餐。这种模式虽然减少了传统手工点餐的纸质浪费,但也需要店员一个一个记录,在这过程中也消耗了部分时间。而且这种模式需要添加基站设备,设备支出成本也是极高。
3) 少数店家用APP或公众号来点餐。目前已经有少数商家用APP来实现点餐,但大多数还是用前两种来点餐。而且现阶段的APP点餐系统发展还不完善,还有待提高。
一,开发需求和技术栈
登录模块设计、点菜模块、付款模块、菜品浏览模块、订单模块、用户管理模块、分享动态模块等等。
技术栈:android、Java、mysql、SpringBoot、Mysql
二,系统的界面
三,系统的核心代码
//作者:小孟 v:jishulearn
@Controller
@RequestMapping("/api")
public class ApiController
@Autowired
private UsersService userService;
@Autowired
private ProductsService booksService;
@Autowired
private ShopsService bookshopService;
@Autowired
private ShopcartService shopcartService;
@Autowired
private ShoporderService orderService;
@Autowired
private PinglunService pinglunService;
@Autowired
private DizhiService dizhiService;
@Autowired
private PengyouquanService pengyouquanService;
@PostMapping("/userlogin")
@ResponseBody
public JsonResult login(String username, String password)
if (username == null || username.trim().isEmpty()) return JsonResult.error("请输入账号");
if (password == null || password.trim().isEmpty()) return JsonResult.error("请输入密码");
Users user = userService.getOne(new QueryWrapper<Users>().eq("username",username).eq("password",password));
if(user != null)
return JsonResult.ok("登录成功").put("username",username).put("password",password).put("id",user.getId());
else
return JsonResult.error("用户名或密码错误");
@PostMapping("/userreg")
@ResponseBody
public JsonResult reg(String username1, String password1,String nickname1)
if (username1 == null || username1.trim().isEmpty()) return JsonResult.error("请输入账号");
if (password1 == null || password1.trim().isEmpty()) return JsonResult.error("请输入密码");
Users user1 = new Users();
user1.setUsername(username1);
user1.setNickname(nickname1);
user1.setPassword(password1);
if (userService.save(user1))
return JsonResult.ok("注册成功");
return JsonResult.error("注册失败");
@PostMapping("/userupdate")
@ResponseBody
public JsonResult update(Integer id,String username2, String password2,String nickname2)
if (username2 == null || username2.trim().isEmpty()) return JsonResult.error("请输入账号");
if (password2 == null || password2.trim().isEmpty()) return JsonResult.error("请输入密码");
if (nickname2 == null || nickname2.trim().isEmpty()) return JsonResult.error("请输入密码");
Users userone = userService.getById(id);
if(userone == null)
return JsonResult.ok("用户不存在!");
userone.setUsername(username2);
userone.setPassword(password2);
userone.setNickname(nickname2);
if (userService.save(userone))
return JsonResult.ok("修改成功");
return JsonResult.error("修改失败");
/**
* book查询全部
*/
@ResponseBody
@RequestMapping("/book/listByname")
public JsonResult listByname(String name)
PageParam<Products> pageParam = new PageParam<>();
pageParam.put("name", name);
List<Products> records = booksService.listAll(pageParam.getNoPageParam());
return JsonResult.ok().setData(records);
/**
* 查询所有
* @param bookshop
* @return
*/
@ResponseBody
@RequestMapping("/book/list")
public JsonResult productList(String bookshop)
PageParam<Shops> pageParam = new PageParam<>();
List<Products> records = booksService.listAll(pageParam.getNoPageParam());
return JsonResult.ok().setData(records);
/**
* bookshop查询全部
*/
@ResponseBody
@RequestMapping("/bookshop/list")
public JsonResult list2(String name)
PageParam<Shops> pageParam = new PageParam<>();
pageParam.put("name", name);
List<Shops> records = bookshopService.listAll(pageParam.getNoPageParam());
return JsonResult.ok().setData(records);
/**
* 管理
* Created by 小孟 v:jishulearn
*/
@Controller
@RequestMapping("/zaocan/pengyouquan")
public class PengyouquanController extends BaseController
@Autowired
private PengyouquanService pengyouquanService;
@RequestMapping()
public String view()
return "zaocan/pengyouquan.html";
/**
* 分页查询
*/
@ResponseBody
@RequestMapping("/page")
public PageResult<Pengyouquan> page(HttpServletRequest request)
PageParam<Pengyouquan> pageParam = new PageParam<>(request);
return new PageResult<>(pengyouquanService.page(pageParam, pageParam.getWrapper()).getRecords(), pageParam.getTotal());
//return pengyouquanService.listPage(pageParam); // 使用关联查询
/**
* 查询全部
*/
@ResponseBody
@RequestMapping("/list")
public JsonResult list(HttpServletRequest request)
PageParam<Pengyouquan> pageParam = new PageParam<>(request);
return JsonResult.ok().setData(pengyouquanService.list(pageParam.getOrderWrapper()));
//List<Pengyouquan> records = pengyouquanService.listAll(pageParam.getNoPageParam()); // 使用关联查询
//return JsonResult.ok().setData(pageParam.sortRecords(records));
/**
* 根据id查询
*/
@ResponseBody
@RequestMapping("/get")
public JsonResult get(Integer id)
return JsonResult.ok().setData(pengyouquanService.getById(id));
// 使用关联查询
//PageParam<Pengyouquan> pageParam = new PageParam<>();
//pageParam.put("id", id);
//List<Pengyouquan> records = pengyouquanService.listAll(pageParam.getNoPageParam());
//return JsonResult.ok().setData(pageParam.getOne(records));
/**
* 添加
*/
@ResponseBody
@RequestMapping("/save")
public JsonResult save(Pengyouquan pengyouquan)
if (pengyouquanService.save(pengyouquan))
return JsonResult.ok("添加成功");
return JsonResult.error("添加失败");
public class AddDiZHiActivity extends BaseActivity
@BindView(R.id.tv_title)
TextView tv_title;
@BindView(R.id.iv_back)
ImageView iv_back;
@BindView(R.id.iv_right)
ImageView iv_right;
@BindView(R.id.et_one)
EditText et_one;
@BindView(R.id.et_two)
EditText et_two;
@BindView(R.id.et_three)
EditText et_three;
@Override
protected int createLayout()
return R.layout.activity_adddizhi;
@Override
public void initViews()
iv_back.setVisibility(View.VISIBLE);
tv_title.setText("添加地址");
@Override
public void initData()
@OnClick(R.id.iv_back, R.id.tv_add)
public void onViewClicked(View view)
switch (view.getId())
case R.id.iv_back:
finish();
break;
case R.id.tv_add:
if (TextUtils.isEmpty(et_one.getText().toString()))
showToast("请填写地址");
return;
if (TextUtils.isEmpty(et_two.getText().toString()))
showToast("请填写联系人");
return;
if (TextUtils.isEmpty(et_three.getText().toString()))
showToast("请填写联系方式");
return;
add();
break;
public class DiZhiActivity extends BaseActivity
@BindView(R.id.tv_title)
TextView tv_title;
@BindView(R.id.iv_back)
ImageView iv_back;
private Intent intent;
@BindView(R.id.rv_shop)
RecyclerView rv_shop;
@BindView(R.id.iv_right)
ImageView iv_right;
private DiZHiAdapter diZHiAdapter;
private List<PengListInfoBane> shopBeans = new ArrayList<>();
@Override
protected int createLayout()
return R.layout.activity_shop;
@Override
public void initViews()
BCManager.instance().listener("DiZhiActivity", "DiZhiActivity", new BlockCallBack()
@Override
public void block(Object target, String name, Object data)
getData();
);
getData();
iv_back.setVisibility(View.VISIBLE);
tv_title.setText("地址管理");
iv_right.setVisibility(View.VISIBLE);
iv_right.setImageResource(R.mipmap.ic_add);
private void getData()
MyHttpUtils.build()//构建myhttputils
.url(HttpConfig.HTTP_IP + "/dizhi/list")//获取ip的url
.setJavaBean(DiZhiBean.class)//设置请求结果对应的java对象
.onExecute(new CommCallback<DiZhiBean>()
@Override
public void onSucceed(DiZhiBean ipBean)
Log.e("ipBean", ipBean + "ipBean");
rv_shop.setLayoutManager(new LinearLayoutManager(DiZhiActivity.this));
diZHiAdapter = new DiZHiAdapter(DiZhiActivity.this, R.layout.item_dizhi, ipBean.getData());
rv_shop.setAdapter(diZHiAdapter);
diZHiAdapter.setOnItemClickListener(new MultiItemTypeAdapter.OnItemClickListener()
@Override
public void onItemClick(View view, RecyclerView.ViewHolder viewHolder, int i)
BCManager.instance().post("dizhi","dizhi",ipBean.getData().get(i));
showToast("选择成功");
finish();
@Override
public boolean onItemLongClick(View view, RecyclerView.ViewHolder viewHolder, int i)
return 手把手教你做视频播放器