✨作者主页:IT毕设梦工厂✨
个人简介:曾从事计算机专业培训教学,擅长Java、Python、微信小程序、Golang、安卓Android等项目实战。接项目定制开发、代码讲解、答辩教学、文档编写、降重等。
☑文末获取源码☑
精彩专栏推荐⬇⬇⬇
Java项目
Python项目
安卓项目
微信小程序项目
一、前言
中国是茶文化的发源地,茶文化深深植根于中国传统文化之中。然而,随着社会的发展和科技的进步,传统的茶文化传播方式已经难以满足现代人的需求。尤其是在年轻一代中,对茶文化的了解和兴趣日益减少。因此,借助现代科技手段,创新茶文化的传播方式,提高人们对茶文化的认知和接受度,成为了迫切需要解决的问题。
当前,虽然已经有一些茶叶电商网站和APP,但它们主要集中在茶叶销售和资讯提供上,而忽视了茶文化传播和社区互动的重要性。这导致消费者难以深入了解茶叶的品种、产地、品牌等信息,更无法进行品鉴交流和社区互动等操作。因此,开发一款集电商、资讯、社交于一体的茗茶微信小程序/安卓APP,对于推动茶文化的发展和满足现代人的需求具有重要意义。
本课题旨在开发一款集电商、资讯、社交于一体的茗茶微信小程序/安卓APP。该应用程序将具备以下功能:
茶叶信息查询:消费者可以方便地查询茶叶的品种、产地、品牌等信息。
在线购买:消费者可以在线购买自己喜欢的茶叶。
品鉴交流:消费者可以在应用程序上分享自己的品茶心得,与其他茶友进行交流。
社区互动:消费者可以在应用程序上参与各种茶文化活动,与其他茶友进行互动。
通过这些功能,该应用程序将为消费者提供一个茶文化体验,同时也将为茶产业的发展提供一个新的平台。
本课题的意义在于将电子商务与茶文化相结合,利用现代科技手段推动茶文化的发展和传播。具体来说,该研究的意义包括:
提高消费者对茶文化的认知和接受度:通过该应用程序,消费者可以更加深入地了解茶文化,提高对茶文化的认知和接受度。
增进茶产业的发展:该应用程序将为茶产业提供一个全新的销售和推广平台,有利于茶产业的发展。
推动传统文化的现代化转型:通过将电子商务与传统文化相结合,该研究将为传统文化的现代化转型提供一个新的思路和方法。
二、开发环境
- 开发语言:Java
- 数据库:MySQL
- 系统架构:移动端
- 后端:SpringBoot
- 前端:Vue
三、系统界面展示
- 茗茶微信小程序/安卓APP界面展示:
四、部分代码设计
- 微信小程序/安卓APP项目实战-代码参考:
/**
* Servlet implementation class UserServlet
*/
@WebServlet("/UserServlet")
public class UserServlet extends HttpServlet {
UserService us = new UserServiceImpl();
/**
* @see HttpServlet#HttpServlet()
*/
public UserServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html; charset=utf-8");// 此句话必须在创建out之前
HttpSession session = request.getSession();
PrintWriter out = response.getWriter();
String opt = request.getParameter("opt");
System.out.println("用户的opt"+opt);
if("login".equals(opt)) {
String name = request.getParameter("name");
String pwd = request.getParameter("textfield2");
User user = us.login(name, pwd);
if(user!=null) {
session.setAttribute("User",user);
if(user.getFlag()==1) {
out.print("<script>alert('登陆成功!');location.href='/tea/admin/userUpdate.jsp'</script>");
}else {
out.print("<script>alert('登陆成功!');location.href='/tea/index.jsp'</script>");
}
}else {
out.print("<script>alert('用户名或密码错误,无账号请点击注册!');location.href='index.jsp'</script>");
}
}
if("register".equals(opt)) {
String name = request.getParameter("name");
String pwd = request.getParameter("textfield2");
String rname = request.getParameter("rname");
String email = request.getParameter("email");
String lx = request.getParameter("lx");
String cno = request.getParameter("cno");
String address = request.getParameter("address");
String phone = request.getParameter("phone");
User user = new User();
user.setPassname(name);
user.setPassword(pwd);
user.setRealname(rname);
user.setEmail(email);
user.setCerttype(lx);
user.setCertno(cno);
user.setAddress(address);
user.setPhone(phone);
int a = us.addUser(user);
if(a>0) {
out.print("<script>alert('注册成功!');location.href='login1.jsp'</script>");
}else {
out.print("<script>alert('注册失败!');location.href='register.jsp'</script>");
}
}if("myinfoshow".equals(opt)) {
int id=((User)session.getAttribute("User")).getId();//通过传ID查询信息值
User user = us.showinfo(id);
if(user!=null) {
session.setAttribute("user", user);
response.sendRedirect("myinfo.jsp");
}
}
if("updatemyinfo".equals(opt)) {
Integer id=4;
String realname=request.getParameter("realname");
String phone=request.getParameter("phone");
String email=request.getParameter("email");
String certtype=request.getParameter("certtype");
String certno=request.getParameter("cetyno");
String address=request.getParameter("address");
User user=new User();
user.setId(id);
user.setRealname(realname);
user.setPhone(phone);
user.setEmail(email);
user.setCerttype(certtype);
user.setCertno(certno);
user.setAddress(address);
int a=us.updateUserInfo(user, id);
if(a>0) {
out.print("<script>alert('修改成功!');location.href='UserServlet?opt=myinfoshow'</script>");
}else {
out.print("<script>alert('修改失败!');location.href='UserServlet?opt=myinfoshow'</script>");
}
}else if("showAll".equals(opt)){
int index = Integer.parseInt(request.getParameter("page")==null?"1":request.getParameter("page"));
String pageSize = request.getParameter("limit") == null ? "10" : request.getParameter("limit");
PageInfo<User> getpage=us.getUserByPage(null, index, Integer.parseInt(pageSize));
JSONObject jsonobject=new JSONObject();
jsonobject.put("code", 0);
jsonobject.put("msg", "");
jsonobject.put("count", getpage.getTotal());
jsonobject.put("data", getpage.getList());
String json=jsonobject.toString();
out.print(json);
}
//用户的删除
if("delete".equals(opt)){
String id=request.getParameter("id");
System.out.println("aaaaaaaa"+id);
int count=us.delUser(Integer.parseInt(id));
if(count>0){
out.print("<script>alert('删除成功');location.href='/tea/admin/ShowUser.jsp'</script>");
}else{
out.print("<script>alert('删除失败');location.href='/tea/admin/userDel.jsp'</script>");
}
}
//用户的编辑
if("edit".equals(opt)){
String email=request.getParameter("email");
String phone=request.getParameter("phone");
String address=request.getParameter("address");
String id=request.getParameter("id");
User user=new User();
user.setAddress(address);
user.setEmail(email);
user.setPhone(phone);
if(!"".equals(id)){
user.setId(Integer.parseInt(id));
}
int count=us.updateUser(user);
if(count>0){
out.print("<script>alert('修改成功');location.href='/tea/admin/ShowUser.jsp'</script>");
}else{
out.print("<script>alert('修改失败');location.href='/tea/admin/UpdateUser.jsp'</script>");
}
}
//通过id查找用户
if("selectOne".equals(opt)){
String id=request.getParameter("id");
User user=us.selectOne(Integer.parseInt(id));
session.setAttribute("user", user);
out.print("<script>location.href='/tea/admin/UpdateUser.jsp'</script>");
}
//实时验证
if("selName".equals(opt)) {
String name = request.getParameter("n");
if("".equals(name)) {
out.print("用户名不能为空");
}else {
User user = new User();
user.setPassname(name);
PageInfo<User> pi = us.getUserByPage(user, 0, 0);
if(pi.getList().size()!=0) {
out.print("用户名重复");
}
}
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
/**
* Servlet implementation class TypeServlet
*/
@WebServlet("/TypeServlet")
public class TypeServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public TypeServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html; charset=utf-8");
PrintWriter out=response.getWriter();
HttpSession session=request.getSession();
TypeService types=new TypeServiceImpl();
List<Type> typelist=types.selectAllType();
BrandService brands=new BrandServiceImpl();
List<Brand> brandlist=brands.selectAllType();
/*request.setAttribute("typelist", typelist);
request.setAttribute("brandlist", brandlist);*/
session.setAttribute("typelist", typelist);
session.setAttribute("brandlist", brandlist);
String opt=request.getParameter("opt");
if("gettype".equals(opt)){
response.sendRedirect("showtealists.jsp");
}else{
response.sendRedirect("/tea/admin/GoodsInsert.jsp");
/*request.getRequestDispatcher("/admin/GoodsInsert.jsp").forward(request, response);*/
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
/**
* Servlet implementation class TeaServlet
*/
@WebServlet("/TeaServlet")
public class TeaServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public TeaServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html; charset=utf-8");
PrintWriter out=response.getWriter();
HttpSession session= request.getSession();
//创建Tea的serivce对象
TeaService teas=new TeaServiceImpl();
String opt=request.getParameter("opt");
System.out.println(opt);
if("add".equals(opt)){
Tea tea=new Tea();
String typeid=null;
String brandid=null;
String teano=null;
String name=null;
String price=null;
String stock=null;
String spec=null;
String packspec=null;
String licenseno=null;
String season=null;
String tech=null;
String proloc=null;
String producedate=null;
String bzq=null;
String shortinfo=null;
//tech text producedate bzq pic1 shortinfo
String pic1=null;
String pic2=null;
String pic3=null;
String file1 = null;
String fileName1 = null;
String file2 = null;
String fileName2 = null;
String file3 = null;
String fileName3 = null;
boolean flag = true;// 文件是否上传成功
Date time = new Date();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
//新建一个FileItrm的工厂类分析input标签
FileItemFactory factory=new DiskFileItemFactory();
//创建input框分析器
ServletFileUpload fileUpload=new ServletFileUpload(factory);
//分析request请求
try {
List<FileItem> list=fileUpload.parseRequest(request);
for(FileItem item:list){
if(item.isFormField()){//普通表单字段
if("typeid".equals(item.getFieldName())){
typeid=item.getString("utf-8");
}else if("brandid".equals(item.getFieldName())){
brandid=item.getString("utf-8");
}else if("teano".equals(item.getFieldName())){
teano=item.getString("utf-8");
}else if("name".equals(item.getFieldName())){
name=item.getString("utf-8");
}else if("price".equals(item.getFieldName())){
price=item.getString("utf-8");
}else if("stock".equals(item.getFieldName())){
stock=item.getString("utf-8");
}else if("spec".equals(item.getFieldName())){
spec=item.getString("utf-8");
}else if("packspec".equals(item.getFieldName())){
packspec=item.getString("utf-8");
}else if("licenseno".equals(item.getFieldName())){
licenseno=item.getString("utf-8");
}else if("season".equals(item.getFieldName())){
season=item.getString("utf-8");
}else if("tech".equals(item.getFieldName())){
tech=item.getString("utf-8");
}else if("proloc".equals(item.getFieldName())){
proloc=item.getString("utf-8");
}else if("producedate".equals(item.getFieldName())){
producedate=item.getString("utf-8");
}else if("bzq".equals(item.getFieldName())){
bzq=item.getString("utf-8");
}else if("shortinfo".equals(item.getFieldName())){
shortinfo=item.getString("utf-8");
}
}else {//文件表单字段
String ext1=null;
String ext2=null;
String ext3=null;
File upfile1=null;
File upfile2=null;
File upfile3=null;
String[] exts = { "jpg", "png", "JEPG", "gif" };
List es = Arrays.asList(exts);
if("pic1".equals(item.getFieldName())){
file1 = item.getName();
if(!"".equals(file1) && file1!=null) {
ext1 = FilenameUtils.getExtension(file1);
String realPath = request.getServletContext().getRealPath("/upload");// 项目真实路径
fileName1 = FilenameUtils.getBaseName(file1) + System.currentTimeMillis() + "."
+ FilenameUtils.getExtension(file1);
upfile1 = new File(realPath, fileName1);
if (es.contains(ext1)) {
item.write(upfile1);
tea.setPic1("upload\\" + fileName1);
} else {
flag = false;
}
}
}else if("pic2".equals(item.getFieldName())){
file2 = item.getName();
if(!"".equals(file2) && file2!=null) {
ext2 = FilenameUtils.getExtension(file2);
String realPath = request.getServletContext().getRealPath("/upload");// 项目真实路径
fileName2 = FilenameUtils.getBaseName(file2) + System.currentTimeMillis() + "."
+ FilenameUtils.getExtension(file2);
upfile2 = new File(realPath, fileName2);
if (es.contains(ext2)) {
item.write(upfile2);
tea.setPic2("upload\\" + fileName2);
} else {
flag = false;
}
}
}else if("pic3".equals(item.getFieldName())){
file3 = item.getName();
if(!"".equals(file3) && file3!=null) {
ext3 = FilenameUtils.getExtension(file3);
String realPath = request.getServletContext().getRealPath("/upload");// 项目真实路径
fileName3 = FilenameUtils.getBaseName(file3) + System.currentTimeMillis() + "."
+ FilenameUtils.getExtension(file3);
upfile3 = new File(realPath, fileName3);
if (es.contains(ext3)) {
item.write(upfile3);
tea.setPic3("upload\\" + fileName3);
} else {
flag = false;
}
}
}
}
}
} catch (FileUploadException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (flag) {
if(!"".equals(brandid)) {
tea.setBrandid(Integer.parseInt(brandid));
}
if(!"".equals(bzq)) {
tea.setBzq(Integer.parseInt(bzq));
}
tea.setLicenseno(licenseno);
tea.setPackspec(packspec);
if(!"".equals(price)) {
tea.setPrice(Double.parseDouble(price));
}
try {
if(!"".equals(producedate)) {
tea.setProducedate(df.parse(producedate));
}
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(!"".equals(typeid)) {
tea.setTypeid(Integer.parseInt(typeid));
}
tea.setTech(tech);
tea.setTeano(teano);
if(!"".equals(stock)) {
tea.setStock(Integer.parseInt(stock));
}
tea.setSpec(spec);
tea.setShortinfo(shortinfo);
tea.setSeason(season);
tea.setProloc(proloc);
tea.setName(name);
int i = teas.addTea(tea);
if (i > 0) {
out.print("<script>alert('添加成功!');location.href='/tea/admin/ShowGoods.jsp';</script>");
}else {
out.print("<script>alert('添加失败!');location.href='/tea/admin/GoodsInsert.jsp';</script>");
}
}else {
out.print("<script>alert('不允许此文件类型上传!添加失败!');location.href='/tea/admin/GoodsInsert.jsp';</script>");
}
}else if("sel".equals(opt)){
String pageNo=request.getParameter("pageno");
//String pageSize=request.getParameter("pagesize");
Integer pageno = pageNo==null?1:Integer.parseInt(pageNo);
PageInfo<Tea> paget= teas.getTea(null, pageno, 12);
session.setAttribute("tealist", paget.getList());
response.sendRedirect("showtealists.jsp");
}else if("toupd".equals(opt)){
String teaid=request.getParameter("teaid");
Tea tea=teas.getTeaById(Integer.parseInt(teaid));
request.setAttribute("tea", tea);
request.getRequestDispatcher("../admin/UpadateGoods.jsp").forward(request, response);
}
//显示所有茶商品
else if("showAll".equals(opt)){
//检测session中有没有品牌和种类的值,如果没有重新查询
Object typelist=session.getAttribute("typelist");
Object brandlist=session.getAttribute("brandlist");
List<Type> listtype;
List<Brand> listbrand;
if(typelist==null){
TypeService types=new TypeServiceImpl() ;
listtype=types.selectAllType();
session.setAttribute("typelist",listtype );
}else{
listtype=(List<Type>)typelist;
}
if(brandlist==null){
BrandService brands=new BrandServiceImpl();
listbrand=brands.selectAllType();
session.setAttribute("brandlist", listbrand);
}else{
listbrand=(List<Brand>)brandlist;
}
int currentNumber = Integer.parseInt(request.getParameter("page")==null?"1":request.getParameter("page"));//页码
String currentPage = request.getParameter("limit") == null ? "1" : request.getParameter("limit");//大小
PageInfo<Tea> paget= teas.getTea(null, currentNumber, Integer.parseInt(currentPage));
List tealist=new ArrayList<>();
for(Tea tea:paget.getList()){
Map<String,Object> map=new HashMap();
//将tea的对象转换成map
Class clazz = tea.getClass();
System.out.println(clazz);
Field[] fields = clazz.getDeclaredFields();
for (Field field : clazz.getDeclaredFields()) {
field.setAccessible(true);
String fieldName = field.getName();
Object value;
try {
value = field.get(tea);
map.put(fieldName, value);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//替换Map中的类型id
for(Type type:listtype){
if(map.get("typeid")!=null){
if(((type.getId()).toString()).equals((map.get("typeid")).toString())){
map.put("typeid", type.getName());
System.out.println((type.getId()).toString()+"="+map.get("typeid"));
break;
}
}
}
for(Brand brand:listbrand){
if(map.get("brandid")!=null){
if((brand.getId()).toString().equals((map.get("brandid")).toString())){
map.put("brandid", brand.getName());
break;
}
}
}
tealist.add(map);
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("code", 0);
jsonObject.put("msg", "");
jsonObject.put("count", paget.getTotal());
jsonObject.put("data", tealist);
String json=jsonObject.toString();
out.print(json);
}
//删除茶商品
else if("delete".equals(opt)) {
String teano =request.getParameter("teano");
if(!"".equals(teano)) {
NewsService newss=new NewsServiceImpl();
newss.deleteNews(teano);
Tea tea=new Tea();
tea.setTeano(teano);
TeaService tess=new TeaServiceImpl();
int count= tess.delTea(tea);
if (count>0) {
response.sendRedirect("/tea/admin/GoodsDel.jsp");
}
}
}
else if("sel1".equals(opt)) {
String teano = request.getParameter("teano");
Tea teaone = teas.selectOneTea(teano);
System.out.println(teaone.getTeano());
session.setAttribute("tea", teaone);
out.print("<script>location.href='/tea/admin/UpdateGoods.jsp'</script>");
}
else if("update".equals(opt)) {
System.out.println("dddd");
Tea tea=new Tea();
String id=request.getParameter("id");
String typeid=request.getParameter("typeid");
String brandid=request.getParameter("brandid");
String teano=request.getParameter("teano");
String name=request.getParameter("name");
String price=request.getParameter("price");
String stock=request.getParameter("stock");
String spec=request.getParameter("spec");
String packspec=request.getParameter("packspec");
String licenseno=request.getParameter("licenseno");
String season=request.getParameter("season");
String tech=request.getParameter("tech");
String proloc=request.getParameter("proloc");
String producedate=request.getParameter("producedate");
String bzq=request.getParameter("bzq");
String shortinfo=request.getParameter("shortinfo");
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
if(id!=null) {
tea.setId(Integer.parseInt(id));
}
if(typeid!=null) {
tea.setTypeid(Integer.parseInt(typeid));
}
System.out.println("z");
if(brandid!=null) {
tea.setBrandid(Integer.parseInt(brandid));
}
if(bzq!=null) {
tea.setBzq(Integer.parseInt(bzq));
}
tea.setLicenseno(licenseno);
tea.setPackspec(packspec);
if(price!=null) {
tea.setPrice(Double.parseDouble(price));
}
try {
if(producedate!=null) {
tea.setProducedate(df.parse(producedate));
}
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
tea.setTech(tech);
tea.setTeano(teano);
if(stock!=null) {
tea.setStock(Integer.parseInt(stock));
}
tea.setSpec(spec);
tea.setShortinfo(shortinfo);
tea.setSeason(season);
tea.setProloc(proloc);
tea.setName(name);
System.out.println("q");
int i = teas.updTea(tea);
System.out.println(i);
if (i > 0) {
out.print("<script>alert('修改成功!');location.href='/tea/admin/ShowGoods.jsp';</script>");
}
}else if("teadetial".equals(opt)){
String teaid=request.getParameter("teaid");
Tea tea=teas.getTeaById(Integer.parseInt(teaid));
session.setAttribute("tea", tea);
request.getRequestDispatcher("teashow.jsp").forward(request, response);
}else if("suggest".equals(opt)){
String getword=request.getParameter("keyword");
//String keyword=getword;
List<Tea> tealist=teas.selectTeaByOr(getword, 1, 100);
List backword =new ArrayList();
for(Tea tea:tealist){
backword.add(tea.getName());
}
if(backword!=null){
out.write((JSONArray.fromObject(backword)).toString());
}else{
out.write("");
}
}else if("selname".equals(opt)) {
String teaname = request.getParameter("teaname");
Tea teaone = teas.selectTeaname(teaname);
session.setAttribute("tea", teaone);
response.sendRedirect("teashow.jsp");
}else if("selltea".equals(opt)){
String word=request.getParameter("word");
//String keyword=getword;
List<Tea> tealist=teas.selectTeaByOr(word, 1, 9);
request.setAttribute("tealist", tealist);
request.getRequestDispatcher("showtealists.jsp").forward(request, response);
}else if("selltype".equals("opt")){
Tea tea =new Tea();
String brandid=request.getParameter("brandid");
String typeid=request.getParameter("typeid");
String proloc=request.getParameter("proloc");
if(brandid!=null){
Integer bid=Integer.parseInt(brandid);
tea.setBrandid(bid);
}
if(typeid!=null){
Integer tid=Integer.parseInt(typeid);
tea.setTypeid(tid);
}
if(proloc!=null){
tea.setProloc(proloc);
}
PageInfo<Tea> paget=teas.selectTeaByAnd(tea, 1, 9) ;
session.setAttribute("tealist", paget.getList());
response.sendRedirect("showtealists.jsp");
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
五、论文参考
- 计算机毕业设计选题推荐-茗茶微信小程序/安卓APP-论文参考:
六、系统视频
茗茶微信小程序/安卓APP-项目视频:
计算机毕业设计选题推荐-茗茶微信小程序/安卓APP-项目实战
结语
计算机毕业设计选题推荐-茗茶微信小程序/安卓APP-项目实战
大家可以帮忙点赞、收藏、关注、评论啦~
源码获取:私信我