package com.example.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import com.example.common.Result;
import com.example.common.ResultCode;
import com.example.entity.DingdanxinxiInfo;
import com.example.dao.DingdanxinxiInfoDao;
import com.example.service.DingdanxinxiInfoService;
import com.example.exception.CustomException;
import com.example.common.ResultCode;
import com.example.vo.EchartsData;
import com.example.vo.DingdanxinxiInfoVo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.example.service.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Value;
import cn.hutool.core.util.StrUtil;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@RequestMapping(value = "/dingdanxinxiInfo")
public class DingdanxinxiInfoController {
@Resource
private DingdanxinxiInfoService dingdanxinxiInfoService;
@Resource
private DingdanxinxiInfoDao dingdanxinxiInfoDao;
@PostMapping
public Result<DingdanxinxiInfo> add(@RequestBody DingdanxinxiInfoVo dingdanxinxiInfo) {
//mixmajixami
dingdanxinxiInfoService.add(dingdanxinxiInfo);
return Result.success(dingdanxinxiInfo);
}
//youtixing1
//youtixing2
@GetMapping("/getByDiqu")
public Result<List<Map<String,String>>> qidu() {
return Result.success(dingdanxinxiInfoService.findByDiqu());
}
@DeleteMapping("/{id}")
public Result delete(@PathVariable Long id) {
dingdanxinxiInfoService.delete(id);
return Result.success();
}
@PutMapping
public Result update(@RequestBody DingdanxinxiInfoVo dingdanxinxiInfo) {
dingdanxinxiInfoService.update(dingdanxinxiInfo);
return Result.success();
}
//@PutMapping("/update2")
// public Result update2(@RequestBody DingdanxinxiInfoVo dingdanxinxiInfo) {
// dingdanxinxiInfoService.update2(dingdanxinxiInfo);
// return Result.success();
// }
@GetMapping("/{id}")
public Result<DingdanxinxiInfo> detail(@PathVariable Long id) {
DingdanxinxiInfo dingdanxinxiInfo = dingdanxinxiInfoService.findById(id);
return Result.success(dingdanxinxiInfo);
}
@GetMapping("/changeStatus/{id}")
public Result<DingdanxinxiInfo> changeStatus(@PathVariable Long id) {
dingdanxinxiInfoService.changeStatus(id);
return Result.success();
}
@GetMapping("/changeIszf/{id}")
public Result<DingdanxinxiInfo> changeIszf(@PathVariable Long id) {
dingdanxinxiInfoService.changeIszf(id);
return Result.success();
}
@GetMapping
public Result<List<DingdanxinxiInfoVo>> all() {
return Result.success(dingdanxinxiInfoService.findAll());
}
@GetMapping("/page/{name}")
public Result<PageInfo<DingdanxinxiInfoVo>> page(@PathVariable String name,
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "5") Integer pageSize,
HttpServletRequest request) {
return Result.success(dingdanxinxiInfoService.findPage(name, pageNum, pageSize, request));
}
@GetMapping("/pageqt/{name}")
public Result<PageInfo<DingdanxinxiInfoVo>> pageqt(@PathVariable String name,
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "8") Integer pageSize,
HttpServletRequest request) {
return Result.success(dingdanxinxiInfoService.findPageqt(name, pageNum, pageSize, request));
}
// @PostMapping("/register")
// public Result<DingdanxinxiInfo> register(@RequestBody DingdanxinxiInfo dingdanxinxiInfo) {
// if (StrUtil.isBlank(dingdanxinxiInfo.getName()) || StrUtil.isBlank(dingdanxinxiInfo.getPassword())) {
// throw new CustomException(ResultCode.PARAM_ERROR);
// }
// return Result.success(dingdanxinxiInfoService.add(dingdanxinxiInfo));
// }
/**
* 批量通过excel添加信息
* @param file excel文件
* @throws IOException
*/
@PostMapping("/upload")
public Result upload(MultipartFile file) throws IOException {
List<DingdanxinxiInfo> infoList = ExcelUtil.getReader(file.getInputStream()).readAll(DingdanxinxiInfo.class);
if (!CollectionUtil.isEmpty(infoList)) {
// 处理一下空数据
List<DingdanxinxiInfo> resultList = infoList.stream().filter(x -> ObjectUtil.isNotEmpty(x.getCaipinming())).collect(Collectors.toList());
for (DingdanxinxiInfo info : resultList) {
dingdanxinxiInfoService.add(info);
}
}
return Result.success();
}
@GetMapping("/get/dingdanxinxi_tj_shangjiamingcheng")
Result<List<EchartsData>> dingdanxinxi_tj_shangjiamingcheng() {
List<EchartsData> list = new ArrayList<>();
List<Map<String, Object>> dingdanxinxi_tj_shangjiamingchengList = dingdanxinxiInfoDao.dingdanxinxi_tj_shangjiamingcheng();
Map<String, Double> typeMap = new HashMap<>();
for (Map<String, Object> map : dingdanxinxi_tj_shangjiamingchengList) {
typeMap.put((String)map.get("aa"), (Double.valueOf((String)map.get("bb").toString())));
}
getPieData("订单信息按商家名称统计", list, typeMap);
getBarData("订单信息按商家名称统计", list, typeMap);
return Result.success(list);
}
@GetMapping("/getExcelModel")
public void getExcelModel(HttpServletResponse response) throws IOException {
// 1. 生成excel
Map<String, Object> row = new LinkedHashMap<>();
row.put("shangjiamingcheng", "A商家名称");
row.put("caipinming", "A菜品名");
row.put("jiage", "A价格");
row.put("goumaishuliang", "A购买数量");
row.put("goumaijine", "A购买金额");
row.put("yonghuming", "A用户名");
row.put("dianhua", "A电话");
row.put("dizhi", "A地址");
row.put("manyidu", "A满意度");
row.put("pingjianeirong", "A评价内容");
row.put("status", "是");
row.put("level", "dingdanxinxi");
List<Map<String, Object>> list = CollUtil.newArrayList(row);
// 2. 写excel
ExcelWriter writer = ExcelUtil.getWriter(true);
writer.write(list, true);
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
response.setHeader("Content-Disposition","attachment;filename=dingdanxinxiInfoModel.xlsx");
ServletOutputStream out = response.getOutputStream();
writer.flush(out, true);
writer.close();
IoUtil.close(System.out);
}
@GetMapping("/getExcel")
public void getExcel(HttpServletResponse response) throws IOException {
// 1. 生成excel
Map<String, Object> row = new LinkedHashMap<>();
row.put("shangjiamingcheng", "A商家名称");
row.put("caipinming", "A菜品名");
row.put("jiage", "A价格");
row.put("goumaishuliang", "A购买数量");
row.put("goumaijine", "A购买金额");
row.put("yonghuming", "A用户名");
row.put(
没有合适的资源?快使用搜索试试~ 我知道了~
基于springboot的某大学外卖系统源码数据库.zip
共1183个文件
gif:166个
js:162个
css:128个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 198 浏览量
2023-06-21
16:04:58
上传
评论
收藏 27.32MB ZIP 举报
温馨提示
源码是经过本地编译可运行的,下载完成之后配置相应环境即可使用。源码功能都是经过老师肯定的,都能满足要求,有需要放心下载即可。源码是经过本地编译可运行的,下载完成之后配置相应环境即可使用。源码功能都是经过老师肯定的,都能满足要求,有需要放心下载即可。源码是经过本地编译可运行的,下载完成之后配置相应环境即可使用。源码功能都是经过老师肯定的,都能满足要求,有需要放心下载即可。源码是经过本地编译可运行的,下载完成之后配置相应环境即可使用。源码功能都是经过老师肯定的,都能满足要求,有需要放心下载即可。源码是经过本地编译可运行的,下载完成之后配置相应环境即可使用。源码功能都是经过老师肯定的,都能满足要求,有需要放心下载即可。源码是经过本地编译可运行的,下载完成之后配置相应环境即可使用。源码功能都是经过老师肯定的,都能满足要求,有需要放心下载即可。源码是经过本地编译可运行的,下载完成之后配置相应环境即可使用。源码功能都是经过老师肯定的,都能满足要求,有需要放心下载即可。源码是经过本地编译可运行的,下载完成之后配置相应环境即可使用。源码功能都是经过老师肯定的,都能满足要求,有需要放心下载即可。源码是经
资源推荐
资源详情
资源评论
收起资源包目录
基于springboot的某大学外卖系统源码数据库.zip (1183个子文件)
alipay_md5.asp 11KB
alipay_md5.asp 11KB
alipay_function.asp 6KB
alipay_function.asp 6KB
alipay_notify.asp 5KB
alipay_notify.asp 5KB
alipay_service.asp 2KB
alipay_service.asp 2KB
DingdanxinxiInfoController.class 14KB
MaijiaxinxiInfoController.class 13KB
XinwentongzhiInfoController.class 13KB
ShangjiaxinxiInfoController.class 13KB
CanyinxinxiInfoController.class 13KB
XitongjianjieInfoController.class 12KB
YonghuxinxiInfoController.class 12KB
LiuyanbanInfoController.class 12KB
AccountController.class 11KB
AdminInfoController.class 9KB
NxSystemFileController.class 8KB
MaijiaxinxiInfoService.class 6KB
ShangjiaxinxiInfoService.class 5KB
EchartsController.class 5KB
YonghuxinxiInfoService.class 5KB
XinwentongzhiInfoService.class 5KB
AdminInfoService.class 5KB
DingdanxinxiInfoService.class 5KB
CommentInfoService.class 5KB
AdminInfo.class 4KB
CanyinxinxiInfoService.class 4KB
YonghuxinxiInfo.class 4KB
XitongjianjieInfoService.class 4KB
XinwentongzhiInfo.class 4KB
DingdanxinxiInfo.class 4KB
CollectInfoController.class 4KB
LiuyanbanInfoService.class 4KB
CanyinxinxiInfo.class 4KB
CommentInfoController.class 4KB
MaijiaxinxiInfo.class 4KB
ShangjiaxinxiInfo.class 3KB
RichtextInfoController.class 3KB
CollectInfoService.class 3KB
RichtextInfoService.class 3KB
NxSystemFileInfoService.class 3KB
Account.class 3KB
LiuyanbanInfo.class 3KB
CollectInfo.class 3KB
CommentInfo.class 3KB
Result.class 2KB
EchartsData.class 2KB
DingdanxinxiInfoDao.class 2KB
ResultCode.class 2KB
MyInterceptor.class 2KB
XitongjianjieInfo.class 2KB
GlobalExceptionHandler.class 2KB
MaijiaxinxiInfoDao.class 2KB
CanyinxinxiInfoDao.class 2KB
XinwentongzhiInfoDao.class 2KB
ShangjiaxinxiInfoDao.class 2KB
EchartsData$Data.class 2KB
WebMvcConfig.class 2KB
CommentInfoDao.class 1KB
EchartsData$Series.class 1KB
MyInterceptorConfig.class 1KB
AuthorityInfo.class 1KB
NxSystemFileInfo.class 1KB
CollectInfoDao.class 1KB
RichtextInfo.class 1KB
LiuyanbanInfoDao.class 1KB
YonghuxinxiInfoDao.class 1KB
AuthorityInfo$Model.class 1KB
CustomException.class 1KB
XitongjianjieInfoDao.class 1KB
AdminInfoDao.class 928B
Application.class 793B
NxSystemFileInfoDao.class 773B
RichtextInfoDao.class 641B
XitongjianjieInfoVo.class 332B
ShangjiaxinxiInfoVo.class 332B
XinwentongzhiInfoVo.class 332B
DingdanxinxiInfoVo.class 328B
CanyinxinxiInfoVo.class 324B
MaijiaxinxiInfoVo.class 324B
YonghuxinxiInfoVo.class 324B
LiuyanbanInfoVo.class 316B
RichtextInfoVo.class 312B
CollectInfoVo.class 308B
AdminInfoVo.class 300B
index.css 227KB
index.css 227KB
index.css 227KB
index.css 227KB
index.css 227KB
index.css 227KB
bootstrap.css 141KB
bootstrap.css 141KB
bootstrap.min.css 119KB
bootstrap.min.css 119KB
bootstrap.min.css 119KB
bootstrap.min.css 119KB
common.css 118KB
共 1183 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12
资源评论
知一NN
- 粉丝: 42
- 资源: 3827
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- C#MVC+EasyUI+Enterprise Library开发框架源码数据库 SQL2008源码类型 WebForm
- (源码)基于Arduino的直流电机控制系统.zip
- (源码)基于SpringBoot框架的学校工资管理系统.zip
- (源码)基于C++的锻造系统优化计算器.zip
- (源码)基于计算机视觉和Arduino的电机旋转控制系统.zip
- (源码)基于Flutter的移动监控与预警系统.zip
- (源码)基于C++的失物招领系统.zip
- (源码)基于SSM框架的教务管理系统.zip
- FPGA配置Flash大小选择因素.pdf
- C#通用进销存管理系统源码带文档数据库 SQL2008源码类型 WebForm
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功