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.HuiyuanxinxiInfo;
import com.example.dao.HuiyuanxinxiInfoDao;
import com.example.service.HuiyuanxinxiInfoService;
import com.example.exception.CustomException;
import com.example.common.ResultCode;
import com.example.vo.EchartsData;
import com.example.vo.HuiyuanxinxiInfoVo;
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 = "/huiyuanxinxiInfo")
public class HuiyuanxinxiInfoController {
@Resource
private HuiyuanxinxiInfoService huiyuanxinxiInfoService;
@Resource
private HuiyuanxinxiInfoDao huiyuanxinxiInfoDao;
@PostMapping
public Result<HuiyuanxinxiInfo> add(@RequestBody HuiyuanxinxiInfoVo huiyuanxinxiInfo) {
huiyuanxinxiInfo.setMima(SecureUtil.md5(huiyuanxinxiInfo.getMima()));
huiyuanxinxiInfoService.add(huiyuanxinxiInfo);
return Result.success(huiyuanxinxiInfo);
}
//youtixing1
//youtixing2
@DeleteMapping("/{id}")
public Result delete(@PathVariable Long id) {
huiyuanxinxiInfoService.delete(id);
return Result.success();
}
@PutMapping
public Result update(@RequestBody HuiyuanxinxiInfoVo huiyuanxinxiInfo) {
huiyuanxinxiInfoService.update(huiyuanxinxiInfo);
return Result.success();
}
//@PutMapping("/update2")
// public Result update2(@RequestBody HuiyuanxinxiInfoVo huiyuanxinxiInfo) {
// huiyuanxinxiInfoService.update2(huiyuanxinxiInfo);
// return Result.success();
// }
@GetMapping("/{id}")
public Result<HuiyuanxinxiInfo> detail(@PathVariable Long id) {
HuiyuanxinxiInfo huiyuanxinxiInfo = huiyuanxinxiInfoService.findById(id);
return Result.success(huiyuanxinxiInfo);
}
@GetMapping("/changeStatus/{id}")
public Result<HuiyuanxinxiInfo> changeStatus(@PathVariable Long id) {
huiyuanxinxiInfoService.changeStatus(id);
return Result.success();
}
@GetMapping
public Result<List<HuiyuanxinxiInfoVo>> all() {
return Result.success(huiyuanxinxiInfoService.findAll());
}
@GetMapping("/page/{name}")
public Result<PageInfo<HuiyuanxinxiInfoVo>> page(@PathVariable String name,
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "5") Integer pageSize,
HttpServletRequest request) {
return Result.success(huiyuanxinxiInfoService.findPage(name, pageNum, pageSize, request));
}
@GetMapping("/pageqt/{name}")
public Result<PageInfo<HuiyuanxinxiInfoVo>> pageqt(@PathVariable String name,
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "8") Integer pageSize,
HttpServletRequest request) {
return Result.success(huiyuanxinxiInfoService.findPageqt(name, pageNum, pageSize, request));
}
// @PostMapping("/register")
// public Result<HuiyuanxinxiInfo> register(@RequestBody HuiyuanxinxiInfo huiyuanxinxiInfo) {
// if (StrUtil.isBlank(huiyuanxinxiInfo.getName()) || StrUtil.isBlank(huiyuanxinxiInfo.getPassword())) {
// throw new CustomException(ResultCode.PARAM_ERROR);
// }
// return Result.success(huiyuanxinxiInfoService.add(huiyuanxinxiInfo));
// }
/**
* 批量通过excel添加信息
* @param file excel文件
* @throws IOException
*/
@PostMapping("/upload")
public Result upload(MultipartFile file) throws IOException {
List<HuiyuanxinxiInfo> infoList = ExcelUtil.getReader(file.getInputStream()).readAll(HuiyuanxinxiInfo.class);
if (!CollectionUtil.isEmpty(infoList)) {
// 处理一下空数据
List<HuiyuanxinxiInfo> resultList = infoList.stream().filter(x -> ObjectUtil.isNotEmpty(x.getXingming())).collect(Collectors.toList());
for (HuiyuanxinxiInfo info : resultList) {
huiyuanxinxiInfoService.add(info);
}
}
return Result.success();
}
@GetMapping("/get/huiyuanxinxi_tj_xingbie")
Result<List<EchartsData>> huiyuanxinxi_tj_xingbie() {
List<EchartsData> list = new ArrayList<>();
List<Map<String, Object>> huiyuanxinxi_tj_xingbieList = huiyuanxinxiInfoDao.huiyuanxinxi_tj_xingbie();
Map<String, Double> typeMap = new HashMap<>();
for (Map<String, Object> map : huiyuanxinxi_tj_xingbieList) {
typeMap.put((String)map.get("aa"), (Double.valueOf((String)map.get("bb").toString())));
}
getPieData("会员信息按性别统计", list, typeMap);
getBarData("会员信息按性别统计", list, typeMap);
return Result.success(list);
}
@GetMapping("/get/huiyuanxinxi_tj_leixing")
Result<List<EchartsData>> huiyuanxinxi_tj_leixing() {
List<EchartsData> list = new ArrayList<>();
List<Map<String, Object>> huiyuanxinxi_tj_leixingList = huiyuanxinxiInfoDao.huiyuanxinxi_tj_leixing();
Map<String, Double> typeMap = new HashMap<>();
for (Map<String, Object> map : huiyuanxinxi_tj_leixingList) {
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("yonghuming", "A用户名");
row.put("mima", "A密码");
row.put("xingming", "A姓名");
row.put("xingbie", "A性别");
row.put("dianhua", "A电话");
row.put("shenfenzheng", "A身份证");
row.put("zhaopian", "A照片");
row.put("leixing", "A类型");
row.put("zhekou", "A折扣");
row.put("beizhu", "A备注");
row.put("status", "是");
row.put("level", "huiyuanxinxi");
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=huiyuanxinxiInfoModel.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> ro
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
小程序毕业设计,小程序课程设计,含有代码注释,新手也可看懂。毕业设计、期末大作业、课程设计、高分必看,下载下来,简单部署,就可以使用。 包含:项目源码、数据库脚本、软件工具等,该项目可以作为毕设、课程设计使用,前后端代码都在里面。 该系统功能完善、界面美观、操作简单、功能齐全、管理便捷,具有很高的实际应用价值。 项目都经过严格调试,确保可以运行!可以放心下载 1. 技术组成 前端: 小程序 后台框架:SSM/SpringBoot(如果有的话) 开发环境:idea,微信开发者工具 数据库:MySql(建议用 5.7 版本,8.0 有时候会有坑) 数据库可视化工具:使用 Navicat 部署环境:Tomcat(建议用 7.x 或者 8.x 版本),maven
资源推荐
资源详情
资源评论
收起资源包目录
微信小程序微信小程序汉堡点餐系统(java)(包括源码,数据库,教程).zip (828个子文件)
HuiyuanxinxiInfoController.class 14KB
ShangpinxinxiInfoController.class 14KB
GoumaiInfoController.class 13KB
HuiyuanleixingInfoController.class 12KB
ShangpinleibieInfoController.class 12KB
AccountController.class 11KB
AdminInfoController.class 9KB
NxSystemFileController.class 8KB
YonghuService.class 7KB
HuiyuanxinxiInfoService.class 6KB
YonghuController.class 5KB
EchartsController.class 5KB
AdminInfoService.class 5KB
GoumaiInfoService.class 5KB
ShangpinxinxiInfoService.class 4KB
AdminInfo.class 4KB
HuiyuanxinxiInfo.class 4KB
CartInfoService.class 4KB
GoumaiInfo.class 4KB
HuiyuanleixingInfoService.class 4KB
ShangpinleibieInfoService.class 4KB
ShangpinxinxiInfo.class 4KB
RichtextInfoController.class 3KB
CartInfoController.class 3KB
RichtextInfoService.class 3KB
NxSystemFileInfoService.class 3KB
Account.class 3KB
Yonghu.class 3KB
Result.class 2KB
CartInfo.class 2KB
EchartsData.class 2KB
ResultCode.class 2KB
MyInterceptor.class 2KB
HuiyuanxinxiInfoDao.class 2KB
HuiyuanleixingInfo.class 2KB
GlobalExceptionHandler.class 2KB
GoumaiInfoDao.class 2KB
ShangpinleibieInfo.class 2KB
ShangpinxinxiInfoDao.class 2KB
EchartsData$Data.class 2KB
WebMvcConfig.class 2KB
YonghuDao.class 1KB
EchartsData$Series.class 1KB
MyInterceptorConfig.class 1KB
AuthorityInfo.class 1KB
NxSystemFileInfo.class 1KB
RichtextInfo.class 1KB
HuiyuanleixingInfoDao.class 1KB
ShangpinleibieInfoDao.class 1KB
YonghuVo.class 1KB
AuthorityInfo$Model.class 1KB
CustomException.class 1KB
CartInfoDao.class 1KB
AdminInfoDao.class 928B
Application.class 793B
NxSystemFileInfoDao.class 773B
RichtextInfoDao.class 641B
ShangpinleibieInfoVo.class 336B
HuiyuanleixingInfoVo.class 336B
ShangpinxinxiInfoVo.class 332B
HuiyuanxinxiInfoVo.class 328B
RichtextInfoVo.class 312B
GoumaiInfoVo.class 304B
AdminInfoVo.class 300B
font.cs 527B
font.cs 527B
index.css 227KB
index.css 227KB
bootstrap.min.css 119KB
bootstrap.min.css 119KB
layui.css 78KB
layui.css 78KB
font-awesome.css 26KB
font-awesome.css 26KB
quill.snow.css 24KB
quill.snow.css 24KB
admin.css 21KB
admin.css 21KB
admin.css 21KB
admin.css 21KB
layer.css 15KB
layer.css 15KB
layer.css 14KB
layer.css 14KB
layui.mobile.css 11KB
layui.mobile.css 11KB
template.css 11KB
template.css 11KB
layer.css 5KB
layer.css 5KB
login.css 2KB
login.css 2KB
login.css 2KB
login.css 2KB
my.css 1KB
my.css 1KB
nav.css 1KB
nav.css 1KB
code.css 1KB
code.css 1KB
共 828 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
Java徐师兄
- 粉丝: 1492
- 资源: 2309
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Django和HTML的新疆地区水稻产量影响因素可视化分析系统(含数据集)
- windows conan2应用构建模板
- 3_base.apk.1
- 基于STM32F103C8T6的4g模块(air724ug)
- 基于Java技术的ASC学业支持中心并行项目开发设计源码
- 基于Java和微信支付的wxmall开源卖票商城设计源码
- 基于Java和前端技术的东软环保公众监督系统设计源码
- 基于Python、HTML、CSS的crawlerdemo软件工程实训爬虫设计源码
- 基于多智能体深度强化学习的边缘协同任务卸载方法设计源码
- 基于BS架构的Java、Vue、JavaScript、CSS、HTML整合的毕业设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功