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.transaction.annotation.Transactional;
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.XiaoshoutongjiEntity;
import com.entity.view.XiaoshoutongjiView;
import com.service.XiaoshoutongjiService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
import java.io.IOException;
/**
* 销售统计
* 后端接口
* @author
* @email
* @date 2022-05-06 18:06:12
*/
@RestController
@RequestMapping("/xiaoshoutongji")
public class XiaoshoutongjiController {
@Autowired
private XiaoshoutongjiService xiaoshoutongjiService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,XiaoshoutongjiEntity xiaoshoutongji,
@RequestParam(required = false) @DateTimeFormat(pattern="yyyy-MM-dd") Date tongjiyuefenstart,
@RequestParam(required = false) @DateTimeFormat(pattern="yyyy-MM-dd") Date tongjiyuefenend,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("xiaoshouyuan")) {
xiaoshoutongji.setXiaoshouzhanghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<XiaoshoutongjiEntity> ew = new EntityWrapper<XiaoshoutongjiEntity>();
if(tongjiyuefenstart!=null) ew.ge("tongjiyuefen", tongjiyuefenstart);
if(tongjiyuefenend!=null) ew.le("tongjiyuefen", tongjiyuefenend);
PageUtils page = xiaoshoutongjiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, xiaoshoutongji), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,XiaoshoutongjiEntity xiaoshoutongji,
@RequestParam(required = false) @DateTimeFormat(pattern="yyyy-MM-dd") Date tongjiyuefenstart,
@RequestParam(required = false) @DateTimeFormat(pattern="yyyy-MM-dd") Date tongjiyuefenend,
HttpServletRequest request){
EntityWrapper<XiaoshoutongjiEntity> ew = new EntityWrapper<XiaoshoutongjiEntity>();
if(tongjiyuefenstart!=null) ew.ge("tongjiyuefen", tongjiyuefenstart);
if(tongjiyuefenend!=null) ew.le("tongjiyuefen", tongjiyuefenend);
PageUtils page = xiaoshoutongjiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, xiaoshoutongji), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( XiaoshoutongjiEntity xiaoshoutongji){
EntityWrapper<XiaoshoutongjiEntity> ew = new EntityWrapper<XiaoshoutongjiEntity>();
ew.allEq(MPUtil.allEQMapPre( xiaoshoutongji, "xiaoshoutongji"));
return R.ok().put("data", xiaoshoutongjiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(XiaoshoutongjiEntity xiaoshoutongji){
EntityWrapper< XiaoshoutongjiEntity> ew = new EntityWrapper< XiaoshoutongjiEntity>();
ew.allEq(MPUtil.allEQMapPre( xiaoshoutongji, "xiaoshoutongji"));
XiaoshoutongjiView xiaoshoutongjiView = xiaoshoutongjiService.selectView(ew);
return R.ok("查询销售统计成功").put("data", xiaoshoutongjiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
XiaoshoutongjiEntity xiaoshoutongji = xiaoshoutongjiService.selectById(id);
return R.ok().put("data", xiaoshoutongji);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
XiaoshoutongjiEntity xiaoshoutongji = xiaoshoutongjiService.selectById(id);
return R.ok().put("data", xiaoshoutongji);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody XiaoshoutongjiEntity xiaoshoutongji, HttpServletRequest request){
xiaoshoutongji.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(xiaoshoutongji);
xiaoshoutongjiService.insert(xiaoshoutongji);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody XiaoshoutongjiEntity xiaoshoutongji, HttpServletRequest request){
xiaoshoutongji.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(xiaoshoutongji);
xiaoshoutongjiService.insert(xiaoshoutongji);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody XiaoshoutongjiEntity xiaoshoutongji, HttpServletRequest request){
//ValidatorUtils.validateEntity(xiaoshoutongji);
xiaoshoutongjiService.updateById(xiaoshoutongji);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
xiaoshoutongjiService.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<XiaoshoutongjiEntity> wrapper = new EntityWrapper<XiaoshoutongjiEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("xiaoshouyuan")) {
wrapper.eq("xiaoshouzhanghao", (String)reque
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
springboot+vue 4S店车辆管理系统.zip (889个子文件)
update-password.vue.bak 3KB
update-password.vue.bak 3KB
IndexMain.vue.bak 2KB
IndexMain.vue.bak 2KB
IndexAsideStatic.vue.bak 2KB
IndexAsideStatic.vue.bak 2KB
BreadCrumbs.vue.bak 2KB
BreadCrumbs.vue.bak 2KB
IndexHeader.vue.bak 2KB
IndexHeader.vue.bak 2KB
3-build.bat 15B
3-build.bat 15B
2-run.bat 14B
2-run.bat 14B
1-install.bat 12B
1-install.bat 12B
XiaoshoutongjiController.class 12KB
YingyetongjiController.class 11KB
CommonController.class 11KB
XiaoshouyuanController.class 10KB
WeixiuyuanController.class 10KB
CheliangxiaoshouController.class 9KB
CheliangweixiuController.class 8KB
GongyingshangxinxiController.class 8KB
CheliangxinxiController.class 8KB
BaoxiangongsiController.class 8KB
WuzixinxiController.class 8KB
KehuController.class 8KB
MPUtil.class 7KB
UserController.class 6KB
CheliangxiaoshouEntity.class 5KB
CheliangweixiuEntity.class 5KB
XiaoshoutongjiServiceImpl.class 5KB
FileController.class 5KB
YingyetongjiServiceImpl.class 5KB
TokenServiceImpl.class 5KB
CheliangxinxiEntity.class 4KB
KehuEntity.class 4KB
WuzixinxiEntity.class 4KB
ConfigController.class 4KB
BaiduUtil.class 4KB
GongyingshangxinxiServiceImpl.class 4KB
CheliangxiaoshouServiceImpl.class 4KB
AuthorizationInterceptor.class 4KB
XiaoshouyuanEntity.class 4KB
CheliangweixiuServiceImpl.class 4KB
WeixiuyuanEntity.class 4KB
CheliangxinxiServiceImpl.class 4KB
BaoxiangongsiServiceImpl.class 4KB
XiaoshouyuanServiceImpl.class 4KB
WeixiuyuanServiceImpl.class 4KB
XiaoshoutongjiEntity.class 4KB
WuzixinxiServiceImpl.class 4KB
GongyingshangxinxiEntity.class 4KB
KehuServiceImpl.class 4KB
BaoxiangongsiEntity.class 4KB
YingyetongjiEntity.class 3KB
CheliangxiaoshouModel.class 3KB
CheliangxiaoshouVO.class 3KB
Query.class 3KB
CheliangweixiuModel.class 3KB
CheliangweixiuVO.class 3KB
UserServiceImpl.class 3KB
PageUtils.class 3KB
TokenEntity.class 3KB
KehuModel.class 2KB
KehuVO.class 2KB
CommonServiceImpl.class 2KB
InterceptorConfig.class 2KB
CommonUtil.class 2KB
CheliangxinxiModel.class 2KB
CheliangxinxiVO.class 2KB
XiaoshoutongjiDao.class 2KB
YingyetongjiDao.class 2KB
XiaoshoutongjiService.class 2KB
YingyetongjiService.class 2KB
WuzixinxiModel.class 2KB
WuzixinxiVO.class 2KB
XiaoshoutongjiModel.class 2KB
XiaoshoutongjiVO.class 2KB
R.class 2KB
GongyingshangxinxiService.class 2KB
UserEntity.class 2KB
CheliangxiaoshouService.class 2KB
GongyingshangxinxiDao.class 2KB
SpringContextUtils.class 2KB
XiaoshouyuanModel.class 2KB
ValidatorUtils.class 2KB
CheliangweixiuService.class 2KB
WeixiuyuanModel.class 2KB
ConfigServiceImpl.class 2KB
XiaoshouyuanVO.class 2KB
CheliangxiaoshouDao.class 2KB
BaoxiangongsiService.class 2KB
CheliangxinxiService.class 2KB
WeixiuyuanVO.class 2KB
XiaoshouyuanService.class 2KB
CheliangweixiuDao.class 2KB
WeixiuyuanService.class 2KB
BaoxiangongsiDao.class 2KB
共 889 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
计算机学长阿伟
- 粉丝: 3078
- 资源: 559
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功