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.ManyidupingjiaEntity;
import com.entity.view.ManyidupingjiaView;
import com.service.ManyidupingjiaService;
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-04-16 15:43:38
*/
@RestController
@RequestMapping("/manyidupingjia")
public class ManyidupingjiaController {
@Autowired
private ManyidupingjiaService manyidupingjiaService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,ManyidupingjiaEntity manyidupingjia,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("kehu")) {
manyidupingjia.setYonghuming((String)request.getSession().getAttribute("username"));
}
EntityWrapper<ManyidupingjiaEntity> ew = new EntityWrapper<ManyidupingjiaEntity>();
PageUtils page = manyidupingjiaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, manyidupingjia), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,ManyidupingjiaEntity manyidupingjia,
HttpServletRequest request){
EntityWrapper<ManyidupingjiaEntity> ew = new EntityWrapper<ManyidupingjiaEntity>();
PageUtils page = manyidupingjiaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, manyidupingjia), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( ManyidupingjiaEntity manyidupingjia){
EntityWrapper<ManyidupingjiaEntity> ew = new EntityWrapper<ManyidupingjiaEntity>();
ew.allEq(MPUtil.allEQMapPre( manyidupingjia, "manyidupingjia"));
return R.ok().put("data", manyidupingjiaService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(ManyidupingjiaEntity manyidupingjia){
EntityWrapper< ManyidupingjiaEntity> ew = new EntityWrapper< ManyidupingjiaEntity>();
ew.allEq(MPUtil.allEQMapPre( manyidupingjia, "manyidupingjia"));
ManyidupingjiaView manyidupingjiaView = manyidupingjiaService.selectView(ew);
return R.ok("查询满意度评价成功").put("data", manyidupingjiaView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
ManyidupingjiaEntity manyidupingjia = manyidupingjiaService.selectById(id);
return R.ok().put("data", manyidupingjia);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
ManyidupingjiaEntity manyidupingjia = manyidupingjiaService.selectById(id);
return R.ok().put("data", manyidupingjia);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ManyidupingjiaEntity manyidupingjia, HttpServletRequest request){
manyidupingjia.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(manyidupingjia);
manyidupingjiaService.insert(manyidupingjia);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ManyidupingjiaEntity manyidupingjia, HttpServletRequest request){
manyidupingjia.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(manyidupingjia);
manyidupingjiaService.insert(manyidupingjia);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody ManyidupingjiaEntity manyidupingjia, HttpServletRequest request){
//ValidatorUtils.validateEntity(manyidupingjia);
manyidupingjiaService.updateById(manyidupingjia);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
manyidupingjiaService.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<ManyidupingjiaEntity> wrapper = new EntityWrapper<ManyidupingjiaEntity>();
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("kehu")) {
wrapper.eq("yonghuming", (String)request.getSession().getAttribute("username"));
}
int count = manyidupingjiaService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
* (按值统计)
*/
@RequestMapping("/value/{xColumnName}/{yColumnName}")
public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
EntityWrapper<ManyidupingjiaEntity> ew = new EntityWrapper<ManyidupingjiaEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("kehu")) {
2013crazy
- 粉丝: 949
- 资源: 2650
最新资源
- 新能源电池包气密性检测stp全套技术资料100%好用.zip
- MIPI-DPU platform TCL
- MATLAB 实现基于核密度估计(KDE)进行时间序列预测模型的项目详细实例(含完整的程序,GUI设计和代码详解)
- MATLAB 实现基于贝叶斯网络(Bayesian Network)进行时间序列预测模型的项目详细实例(含完整的程序,GUI设计和代码详解)
- 模型预测控制(MPC)+路径跟踪(PTC)+侧偏角软约束+主动前轮转向(AFS),目前的范例是72km h,附着系数0.3的单移线,附着系数0.85双移线 仿真使用的是MATLAB2020b版本和c
- 线缆装铠机sw18全套技术资料100%好用.zip
- MATLAB 实现基于ABKDE(自适应带宽核密度估计)进行时间序列预测模型的项目详细实例(含完整的程序,GUI设计和代码详解)
- comsol sofc固体氧化物燃料电池 单通道非绝热逆流固体氧化物燃料电池模型,包括阴阳极气体扩散层,电极扩散层尺寸来源于实际电池(极化曲线,性能曲线,气体分布,温度分布)
- MATLAB 实现基于自适应滤波(Adaptive Filtering)进行时间序列预测模型的项目详细实例(含完整的程序,GUI设计和代码详解)
- nltk的punkt与stopwords
- MATLAB 实现基于K近邻回归(KNN)进行时间序列预测模型的项目详细实例(含完整的程序,GUI设计和代码详解)
- Steam++ -v3.0.0-rc.11-win-x64
- 星巴克杯子圆弧涂胶x_t全套技术资料100%好用.zip
- MATLAB实现COA-CNN-BiLSTM-Attention-RF浣熊优化卷积双向长短期记忆神经网络注意力机制组合随机森林多输入单输出回归预测(含完整的程序,GUI设计和代码详解)
- 永磁同步电机电流环模型预测控制(MPC)simulink仿真模型,速度环PI控制,电流环为MPC控制,不是FOC控制
- 药瓶侧身扫码抓取称重设备X_T全套技术资料100%好用.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈