项目介绍
随着经济的发展,人们的生活质量在逐渐提高。近些年来休闲产品的销量大增。比如奶茶作为一种新型的饮料,有着很多的作用,它可以去油腻、助消化、益思提神、利尿解毒、消除疲劳,也适合干急慢性肠炎、胃炎及十二指肠溃疡等病人饮用。对酒精和麻醉药物中毒者,它还能发挥解毒作用。因此,在中国获得了极大的发展。
街边奶茶店,消费对象是逛街人群、大学生居多,像一些大型连锁的奶茶店会比较注重口感而且会根据不同时节快速的推出新口味产品,而且店内设置一些有风格的位置和装修,是朋友之间休闲聊天的好选择,相比与西餐厅和咖啡厅,价格和口味相对大众化,奶茶店的未来市场在干连锁品牌和创新上。杯装奶茶比较方便快捷,消费者多数是办公室人群和蜗居人群喜欢快捷不喜欢麻烦,像香飘飘,就是以价格、方便取得很大的奶茶市场,相对口感和样式上,奶茶店相对优胜,尤其是在夏天,但是现在也有不少的商家发展罐装奶茶和瓶装奶茶,这方面的市场还是蛮大的,但投入的资本研究、宣传、发行,相对较大。现在的大学生文娱生活也在日益丰富。尤其重庆地区麻将氛围浓厚,所以开一家网上奶茶购买平台的市场前景还是很理想的
开发环境
开发语言:Java
数据库 :MySQL
系统架构:B/S
后端框架:SpringBoot
前端框架:Vue
开发工具:IDEA或者Eclipse,JDK1.8,Maven
系统截图
部分代码
package com.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
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 com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.ShangpinxinxiEntity;
import com.entity.view.ShangpinxinxiView;
import com.service.ShangpinxinxiService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
/**
* 奶茶信息
* 后端接口
*/
@RestController
@RequestMapping("/shangpinxinxi")
public class ShangpinxinxiController {
@Autowired
private ShangpinxinxiService shangpinxinxiService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,ShangpinxinxiEntity shangpinxinxi,
HttpServletRequest request){
EntityWrapper<ShangpinxinxiEntity> ew = new EntityWrapper<ShangpinxinxiEntity>();
PageUtils page = shangpinxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shangpinxinxi), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request){
EntityWrapper<ShangpinxinxiEntity> ew = new EntityWrapper<ShangpinxinxiEntity>();
PageUtils page = shangpinxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shangpinxinxi), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( ShangpinxinxiEntity shangpinxinxi){
EntityWrapper<ShangpinxinxiEntity> ew = new EntityWrapper<ShangpinxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( shangpinxinxi, "shangpinxinxi"));
return R.ok().put("data", shangpinxinxiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(ShangpinxinxiEntity shangpinxinxi){
EntityWrapper< ShangpinxinxiEntity> ew = new EntityWrapper< ShangpinxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( shangpinxinxi, "shangpinxinxi"));
ShangpinxinxiView shangpinxinxiView = shangpinxinxiService.selectView(ew);
return R.ok("查询奶茶信息成功").put("data", shangpinxinxiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
ShangpinxinxiEntity shangpinxinxi = shangpinxinxiService.selectById(id);
shangpinxinxi.setClicknum(shangpinxinxi.getClicknum()+1);
shangpinxinxi.setClicktime(new Date());
shangpinxinxiService.updateById(shangpinxinxi);
return R.ok().put("data", shangpinxinxi);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
ShangpinxinxiEntity shangpinxinxi = shangpinxinxiService.selectById(id);
shangpinxinxi.setClicknum(shangpinxinxi.getClicknum()+1);
shangpinxinxi.setClicktime(new Date());
shangpinxinxiService.updateById(shangpinxinxi);
return R.ok().put("data", shangpinxinxi);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request){
shangpinxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(shangpinxinxi);
shangpinxinxiService.insert(shangpinxinxi);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request){
shangpinxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(shangpinxinxi);
shangpinxinxiService.insert(shangpinxinxi);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request){
//ValidatorUtils.validateEntity(shangpinxinxi);
shangpinxinxiService.updateById(shangpinxinxi);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
shangpinxinxiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<ShangpinxinxiEntity> wrapper = new EntityWrapper<ShangpinxinxiEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = shangpinxinxiService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
* 前端智能排序
*/
@IgnoreAuth
@RequestMapping("/autoSort")
public R autoSort(@RequestParam Map<String, Object> params,ShangpinxinxiEntity shangpinxinxi, HttpServletRequest request,String pre){
EntityWrapper<ShangpinxinxiEntity> ew = new EntityWrapper<ShangpinxinxiEntity>();
Map<String, Object> newMap = new HashMap<String, Object>();
Map<String, Object> param = new HashMap<String, Object>();
Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
String key = entry.getKey();
String newKey = entry.getKey();
if (pre.endsWith(".")) {
newMap.put(pre + newKey, entry.getValue());
} else if (StringUtils.isEmpty(pre)) {
newMap.put(newKey, entry.getValue());
} else {
newMap.put(pre + "." + newKey, entry.getValue());
}
}
params.put("sort", "clicknum");
params.put("order", "desc");
PageUtils page = shangpinxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shangpinxinxi), params), params));
return R.ok().put("data", page);
}
}