package com.demo01.demo.service;
import com.demo01.demo.entity.*;
import com.demo01.demo.mappers.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import net.sf.json.JSONArray;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
@Service
public class OrderServiceImpl implements OrderService {
@Autowired
OrderMapper orderMapper;
@Override
public List<Order> findAllOrderByID(String openid) {
List<Order> orderList = new ArrayList<>();
List<Integer> orderIdList = new ArrayList<>();
orderIdList = orderMapper.findAllOrderByID(openid);
orderIdList.forEach(re -> {
Order order = findOneOrder(re);
orderList.add(order);
});
return orderList;
}
public List<MiniOrder> findAllMiniOrder(String openid) {
List<MiniOrderEntry> entryList = orderMapper.findAllMiniOrder(openid);
List<MiniOrder> orderList = new ArrayList<>();
List<String> drinkIdList = new ArrayList<>();
List<String> imageList = new ArrayList<>();
MiniOrder orderTmp = new MiniOrder();
int drinkId;
int orderId = -1;
double total = 0;
//查询结果为空
if (entryList.size() == 0)
return null;
//根据订单编号合并订单条目,组成一个完整订单
for (MiniOrderEntry e : entryList) {
//当前条目属于一个新订单
if (orderId != e.getOrderId()) {
//不是第一个订单才需要添加到orderList
if (orderId != -1) {
orderTmp.setTotal(total);
orderTmp.setDrinkIdList(drinkIdList);
orderTmp.setImageList(imageList);
orderList.add(orderTmp);
}
//清空上个订单用到的变量
orderTmp = new MiniOrder();
drinkIdList = new ArrayList<>();
imageList = new ArrayList<>();
total = 0;
//不是第一个订单才需要清空drinkList,imageList
if (orderId != -1) {
drinkIdList.clear();
imageList.clear();
}
//
orderId = e.getOrderId();
orderTmp.setOrderId(e.getOrderId());
orderTmp.setOrderTime(e.getTime());
orderTmp.setOpenid(e.getOpenid());
total += e.getPrice();
//加入一种饮品
drinkIdList.add(e.getId());
imageList.add(e.getImage());
}
//当前条目与上条条目属于同一个订单,仅添加饮品
else {
total += e.getPrice();
drinkIdList.add(e.getId());
imageList.add(e.getImage());
}
}
orderTmp.setTotal(total);
orderTmp.setDrinkIdList(drinkIdList);
orderTmp.setImageList(imageList);
orderList.add(orderTmp);
return orderList;
}
public List<MiniOrder> findMakingMiniOrder(String openid) {
List<MiniOrderEntry> entryList = orderMapper.findMakingMiniOrder(openid);
List<MiniOrder> orderList = new ArrayList<>();
List<String> drinkIdList = new ArrayList<>();
List<String> imageList = new ArrayList<>();
MiniOrder orderTmp = new MiniOrder();
int drinkId;
int orderId = -1;
double total = 0;
//查询结果为空
if (entryList.size() == 0)
return null;
//根据订单编号合并订单条目,组成一个完整订单
for (MiniOrderEntry e : entryList) {
//当前条目属于一个新订单
if (orderId != e.getOrderId()) {
//不是第一个订单才需要添加到orderList
if (orderId != -1) {
orderTmp.setTotal(total);
orderTmp.setDrinkIdList(drinkIdList);
orderTmp.setImageList(imageList);
orderList.add(orderTmp);
}
//清空上个订单用到的变量
orderTmp = new MiniOrder();
drinkIdList = new ArrayList<>();
imageList = new ArrayList<>();
total = 0;
//不是第一个订单才需要清空drinkList,imageList
if (orderId != -1) {
drinkIdList.clear();
imageList.clear();
}
//
orderId = e.getOrderId();
orderTmp.setOrderId(e.getOrderId());
orderTmp.setOrderTime(e.getTime());
orderTmp.setOpenid(e.getOpenid());
total += e.getPrice();
//加入一种饮品
drinkIdList.add(e.getId());
imageList.add(e.getImage());
}
//当前条目与上条条目属于同一个订单,仅添加饮品
else {
total += e.getPrice();
drinkIdList.add(e.getId());
imageList.add(e.getImage());
}
}
orderTmp.setTotal(total);
orderTmp.setDrinkIdList(drinkIdList);
orderTmp.setImageList(imageList);
orderList.add(orderTmp);
return orderList;
}
public List<MiniOrder> findCompletedMiniOrder(String openid) {
List<MiniOrderEntry> entryList = orderMapper.findCompletedMiniOrder(openid);
List<MiniOrder> orderList = new ArrayList<>();
List<String> drinkIdList = new ArrayList<>();
List<String> imageList = new ArrayList<>();
MiniOrder orderTmp = new MiniOrder();
int drinkId;
int orderId = -1;
double total = 0;
//查询结果为空
if (entryList.size() == 0)
return null;
//根据订单编号合并订单条目,组成一个完整订单
for (MiniOrderEntry e : entryList) {
//当前条目属于一个新订单
if (orderId != e.getOrderId()) {
//不是第一个订单才需要添加到orderList
if (orderId != -1) {
orderTmp.setTotal(total);
orderTmp.setDrinkIdList(drinkIdList);
orderTmp.setImageList(imageList);
orderList.add(orderTmp);
}
//清空上个订单用到的变量
orderTmp = new MiniOrder();
drinkIdList = new ArrayList<>();
imageList = new ArrayList<>();
total = 0;
//不是第一个订单才需要清空drinkList,imageList
if (orderId != -1) {
drinkIdList.clear();
imageList.clear();
}
//
orderId = e.getOrderId();
orderTmp.setOrderId(e.getOrderId());
orderTmp.setOrderTime(e.getTime());
orderTmp.setOpenid(e.getOpenid());
total += e.getPrice();
//加入一种饮品
drinkIdList.add(e.getId());
imageList.add(e.getImage());
}
//当前条目与上条条目属于同一个订单,仅添加饮品
else {
total += e.getPrice();
drinkIdList.add(e.getId());
imageList.add(e.getImage());
}
}
orderTmp.setTotal(total);
orderTmp.setDrinkIdList(drinkIdList);
orderTmp.setImageList(imageList);
orderList.add(orderTmp);
return orderList;
}
pu
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
毕业设计、课程设计、大作业——微信小程序奶茶下单系统,前后端分离,Json通信,Springboot后端,,持久层mybatis。 技术栈 客户端 微信小程序 后台前端 React,Ant组件库 后台后端 SpringBoot,Mysql 四.具体实现 客户端 客户端采用小程序为客户提供图形界面,方便客户查看商品,下订单,查看订单状态 前端 1.登录: 客户可以使用微信一键登录进入小程序,小程序会保存用户的登录信息 毕业设计、课程设计、大作业——微信小程序奶茶下单系统,前后端分离,Json通信,Springboot后端,,持久层mybatis 毕业设计、课程设计、大作业——微信小程序奶茶下单系统,前后端分离,Json通信,Springboot后端,,持久层mybatis 毕业设计、课程设计、大作业——微信小程序奶茶下单系统,前后端分离,Json通信,Springboot后端,,持久层mybatis 毕业设计、课程设计、大作业——微信小程序奶茶下单系统,前后端分离,Json通信,Springboot后端,,持久层mybatis 毕业设计、课程设计、大作业——微信小程序
资源推荐
资源详情
资源评论
收起资源包目录
毕业设计、课程设计、大作业-微信小程序奶茶下单系统,前后端分离,Json通信,Springboot后端,,持久层mybatis (173个子文件)
mvnw.cmd 6KB
.gitignore 298B
.gitignore 29B
demo.iml 16KB
milktea.iml 336B
maven-wrapper.jar 50KB
OrderServiceImpl.java 12KB
getExcleController.java 6KB
ExcelUtil.java 6KB
MavenWrapperDownloader.java 5KB
AdminServiceImpl.java 5KB
BannerServiceImpl.java 5KB
DeliveryController.java 5KB
MakerController.java 3KB
OrderController.java 3KB
AdminController.java 3KB
Order.java 3KB
Swagger2Configuration.java 3KB
MilkteaServiceImpl.java 3KB
ResultUtils.java 2KB
MilkteaController.java 2KB
OrderDrink.java 2KB
SelectInfo.java 2KB
UserController.java 2KB
UserServiceImpl.java 2KB
BannerController.java 2KB
MiniOrder.java 2KB
MiniOrderEntry.java 2KB
User.java 2KB
AdminLoginController.java 2KB
Milktea.java 1KB
MilkTeaForExcel.java 1KB
ExcelListener.java 1KB
Admin.java 1KB
BillPrintInfo.java 1KB
ExcelWriterFactory.java 1KB
WebConfig.java 1KB
TestFilter.java 1019B
LoginInterceptor.java 933B
OrderMapper.java 930B
DeliveryServiceImpl.java 925B
OrderService.java 855B
RevenueController.java 846B
Revenue.java 833B
MilkteaMapper.java 788B
OrderForMaker.java 768B
OrderInfoChart.java 709B
Result.java 673B
MakerServiceImpl.java 669B
RevenueServiceImpl.java 667B
MilkteaService.java 598B
LoginInfoDTO.java 571B
DemoApplication.java 537B
Banner.java 495B
AdminMapper.java 480B
AdminService.java 471B
DemoApplicationTests.java 464B
UserMapper.java 454B
UserService.java 405B
DeliveryMapper.java 396B
BannerMapper.java 387B
RevenueMapper.java 374B
MakerMapper.java 350B
DeliveryService.java 309B
BannerService.java 305B
RevenueService.java 260B
MakerService.java 238B
IpConfiguration.java 0B
cart.js 6KB
milkteaDetail.js 6KB
order.js 5KB
login.js 5KB
app.js 4KB
milktea.js 4KB
pay.js 4KB
changeAddress.js 3KB
index.js 2KB
orderDetail.js 2KB
address.js 2KB
user.js 1KB
util.js 472B
logs.js 261B
app.json 2KB
project.config.json 2KB
sitemap.json 191B
logs.json 77B
index.json 27B
milktea.json 27B
milkteaDetail.json 27B
cart.json 27B
order.json 27B
user.json 27B
pay.json 27B
changeAddress.json 27B
orderDetail.json 27B
address.json 27B
login.json 27B
mvnw 10KB
logo.png 73KB
icon_more.png 37KB
共 173 条
- 1
- 2
资源评论
- weixin_371019362023-07-12发现一个宝藏资源,资源有很高的参考价值,赶紧学起来~
白话机器学习
- 粉丝: 1w+
- 资源: 7671
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功