基于springboot网上书城交易平台源码和论文

在Internet高速发展的今天,我们生活的各个领域都涉及到计算机的应用,其中包括网上书城管理系统的网络应用,在国外网上书城管理系统已经是很普遍的方式,不过国内的书城管理系统可能还处于起步阶段。网上书城管理系统具有网上书城信息管理功能的选择。网上书城管理系统采用java技术,基于springboot框架,mysql数据库进行开发,实现了首页、个人中心、用户管理、图书类型管理、图书分类管理、图书信息管理、我的收藏管理、系统管理、订单管理等内容进行管理,本系统具有良好的兼容性和适应性,为用户提供更多的网上书城信息,也提供了良好的平台,从而提高系统的核心竞争力。

本文首先介绍了设计的背景与研究目的,其次介绍系统相关技术,重点叙述了系统功能分析以及详细设计,最后总结了系统的开发心得。

关键词:java技术;网上书城管理系统;mysql

基于springboot网上书城交易平台源码和论文332

演示视频:

基于springboot网上书城交易平台源码和论文


Abstract

In the rapid development of the Internet today, all areas of our life are involved in the application of computers, including the network application of online book city management system, online book city management system in foreign countries has been a very common way, but the domestic book city management system may still be in its infancy. Online book city management system has the choice of online book city information management function. Online book city management system using Java technology, based on springboot framework, mysql database development, to achieve the home page, personal center, user management, book type management, book classification management, book information management, my collection management, system management, order management and other content management. The system has good compatibility and adaptability, to provide users with more online book city information, but also provides a good platform, so as to improve the core competitiveness of the system.

This paper first introduces the design background and research purpose, then introduces the system related technology, focuses on the system function analysis and detailed design, and finally summarizes the development experience of the system.

Key words: Java technology; Online book city management system; mysql


package com.controller;import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;/*** 用户* 后端接口* @author* @email
*/
@RestController
@Controller
@RequestMapping("/yonghu")
public class YonghuController {private static final Logger logger = LoggerFactory.getLogger(YonghuController.class);private static final String TABLE_NAME = "yonghu";@Autowiredprivate YonghuService yonghuService;@Autowiredprivate TokenService tokenService;@Autowiredprivate DictionaryService dictionaryService;//字典@Autowiredprivate GonggaoService gonggaoService;//公告@Autowiredprivate JixiaoService jixiaoService;//绩效@Autowiredprivate PeixunService peixunService;//培训@Autowiredprivate RenshidiaodongService renshidiaodongService;//人事调动@Autowiredprivate SingleSeachService singleSeachService;//单页数据@Autowiredprivate XinziService xinziService;//薪资@Autowiredprivate YuangongService yuangongService;//员工@Autowiredprivate YuangongKaoqinService yuangongKaoqinService;//员工考勤@Autowiredprivate YuangongKaoqinListService yuangongKaoqinListService;//员工考勤详情@Autowiredprivate YuangongqingjiaService yuangongqingjiaService;//员工请假@Autowiredprivate ZhaopinService zhaopinService;//招聘@Autowiredprivate UsersService usersService;//管理员/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永不会进入");else if("用户".equals(role))params.put("yonghuId",request.getSession().getAttribute("userId"));else if("员工".equals(role))params.put("yuangongId",request.getSession().getAttribute("userId"));CommonUtil.checkMap(params);PageUtils page = yonghuService.queryPage(params);//字典表数据转换List<YonghuView> list =(List<YonghuView>)page.getList();for(YonghuView c:list){//修改对应字典表字段dictionaryService.dictionaryConvert(c, request);}return R.ok().put("data", page);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id, HttpServletRequest request){logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);YonghuEntity yonghu = yonghuService.selectById(id);if(yonghu !=null){//entity转viewYonghuView view = new YonghuView();BeanUtils.copyProperties( yonghu , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody YonghuEntity yonghu, HttpServletRequest request){logger.debug("save方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString());String role = String.valueOf(request.getSession().getAttribute("role"));if(false)return R.error(511,"永远不会进入");Wrapper<YonghuEntity> queryWrapper = new EntityWrapper<YonghuEntity>().eq("username", yonghu.getUsername()).or().eq("yonghu_phone", yonghu.getYonghuPhone()).or().eq("yonghu_id_number", yonghu.getYonghuIdNumber());logger.info("sql语句:"+queryWrapper.getSqlSegment());YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper);if(yonghuEntity==null){yonghu.setCreateTime(new Date());yonghu.setPassword("123456");yonghuService.insert(yonghu);return R.ok();}else {return R.error(511,"账户或者用户手机号或者用户身份证号已经被使用");}}/*** 后端修改*/@RequestMapping("/update")public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {logger.debug("update方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString());YonghuEntity oldYonghuEntity = yonghuService.selectById(yonghu.getId());//查询原先数据String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");if("".equals(yonghu.getYonghuPhoto()) || "null".equals(yonghu.getYonghuPhoto())){yonghu.setYonghuPhoto(null);}yonghuService.updateById(yonghu);//根据id更新return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Integer[] ids, HttpServletRequest request){logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());List<YonghuEntity> oldYonghuList =yonghuService.selectBatchIds(Arrays.asList(ids));//要删除的数据yonghuService.deleteBatchIds(Arrays.asList(ids));return R.ok();}/*** 批量上传*/@RequestMapping("/batchInsert")public R save( String fileName, HttpServletRequest request){logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))try {List<YonghuEntity> yonghuList = new ArrayList<>();//上传的东西Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段Date date = new Date();int lastIndexOf = fileName.lastIndexOf(".");if(lastIndexOf == -1){return R.error(511,"该文件没有后缀");}else{String suffix = fileName.substring(lastIndexOf);if(!".xls".equals(suffix)){return R.error(511,"只支持后缀为xls的excel文件");}else{URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径File file = new File(resource.getFile());if(!file.exists()){return R.error(511,"找不到上传文件,请联系管理员");}else{List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件dataList.remove(0);//删除第一行,因为第一行是提示for(List<String> data:dataList){//循环YonghuEntity yonghuEntity = new YonghuEntity();
//                            yonghuEntity.setUsername(data.get(0));                    //账户 要改的
//                            yonghuEntity.setPassword("123456");//密码
//                            yonghuEntity.setYonghuName(data.get(0));                    //用户姓名 要改的
//                            yonghuEntity.setYonghuPhone(data.get(0));                    //用户手机号 要改的
//                            yonghuEntity.setYonghuIdNumber(data.get(0));                    //用户身份证号 要改的
//                            yonghuEntity.setYonghuPhoto("");//详情和图片
//                            yonghuEntity.setSexTypes(Integer.valueOf(data.get(0)));   //性别 要改的
//                            yonghuEntity.setYonghuEmail(data.get(0));                    //用户邮箱 要改的
//                            yonghuEntity.setJinyongTypes(Integer.valueOf(data.get(0)));   //账户状态 要改的
//                            yonghuEntity.setCreateTime(date);//时间yonghuList.add(yonghuEntity);//把要查询是否重复的字段放入map中//账户if(seachFields.containsKey("username")){List<String> username = seachFields.get("username");username.add(data.get(0));//要改的}else{List<String> username = new ArrayList<>();username.add(data.get(0));//要改的seachFields.put("username",username);}//用户手机号if(seachFields.containsKey("yonghuPhone")){List<String> yonghuPhone = seachFields.get("yonghuPhone");yonghuPhone.add(data.get(0));//要改的}else{List<String> yonghuPhone = new ArrayList<>();yonghuPhone.add(data.get(0));//要改的seachFields.put("yonghuPhone",yonghuPhone);}//用户身份证号if(seachFields.containsKey("yonghuIdNumber")){List<String> yonghuIdNumber = seachFields.get("yonghuIdNumber");yonghuIdNumber.add(data.get(0));//要改的}else{List<String> yonghuIdNumber = new ArrayList<>();yonghuIdNumber.add(data.get(0));//要改的seachFields.put("yonghuIdNumber",yonghuIdNumber);}}//查询是否重复//账户List<YonghuEntity> yonghuEntities_username = yonghuService.selectList(new EntityWrapper<YonghuEntity>().in("username", seachFields.get("username")));if(yonghuEntities_username.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(YonghuEntity s:yonghuEntities_username){repeatFields.add(s.getUsername());}return R.error(511,"数据库的该表中的 [账户] 字段已经存在 存在数据为:"+repeatFields.toString());}//用户手机号List<YonghuEntity> yonghuEntities_yonghuPhone = yonghuService.selectList(new EntityWrapper<YonghuEntity>().in("yonghu_phone", seachFields.get("yonghuPhone")));if(yonghuEntities_yonghuPhone.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(YonghuEntity s:yonghuEntities_yonghuPhone){repeatFields.add(s.getYonghuPhone());}return R.error(511,"数据库的该表中的 [用户手机号] 字段已经存在 存在数据为:"+repeatFields.toString());}//用户身份证号List<YonghuEntity> yonghuEntities_yonghuIdNumber = yonghuService.selectList(new EntityWrapper<YonghuEntity>().in("yonghu_id_number", seachFields.get("yonghuIdNumber")));if(yonghuEntities_yonghuIdNumber.size() >0 ){ArrayList<String> repeatFields = new ArrayList<>();for(YonghuEntity s:yonghuEntities_yonghuIdNumber){repeatFields.add(s.getYonghuIdNumber());}return R.error(511,"数据库的该表中的 [用户身份证号] 字段已经存在 存在数据为:"+repeatFields.toString());}yonghuService.insertBatch(yonghuList);return R.ok();}}}}catch (Exception e){e.printStackTrace();return R.error(511,"批量插入数据异常,请联系管理员");}}/*** 登录*/@IgnoreAuth@RequestMapping(value = "/login")public R login(String username, String password, String captcha, HttpServletRequest request) {YonghuEntity yonghu = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("username", username));if(yonghu==null || !yonghu.getPassword().equals(password))return R.error("账号或密码不正确");else if(yonghu.getJinyongTypes() != 1)return R.error("账户已被禁用");String token = tokenService.generateToken(yonghu.getId(),username, "yonghu", "用户");R r = R.ok();r.put("token", token);r.put("role","用户");r.put("username",yonghu.getYonghuName());r.put("tableName","yonghu");r.put("userId",yonghu.getId());return r;}/*** 注册*/@IgnoreAuth@PostMapping(value = "/register")public R register(@RequestBody YonghuEntity yonghu, HttpServletRequest request) {
//    	ValidatorUtils.validateEntity(user);Wrapper<YonghuEntity> queryWrapper = new EntityWrapper<YonghuEntity>().eq("username", yonghu.getUsername()).or().eq("yonghu_phone", yonghu.getYonghuPhone()).or().eq("yonghu_id_number", yonghu.getYonghuIdNumber());YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper);if(yonghuEntity != null)return R.error("账户或者用户手机号或者用户身份证号已经被使用");yonghu.setJinyongTypes(1);//启用yonghu.setCreateTime(new Date());yonghuService.insert(yonghu);return R.ok();}/*** 重置密码*/@GetMapping(value = "/resetPassword")public R resetPassword(Integer  id, HttpServletRequest request) {YonghuEntity yonghu = yonghuService.selectById(id);yonghu.setPassword("123456");yonghuService.updateById(yonghu);return R.ok();}/*** 修改密码*/@GetMapping(value = "/updatePassword")public R updatePassword(String  oldPassword, String  newPassword, HttpServletRequest request) {YonghuEntity yonghu = yonghuService.selectById((Integer)request.getSession().getAttribute("userId"));if(newPassword == null){return R.error("新密码不能为空") ;}if(!oldPassword.equals(yonghu.getPassword())){return R.error("原密码输入错误");}if(newPassword.equals(yonghu.getPassword())){return R.error("新密码不能和原密码一致") ;}yonghu.setPassword(newPassword);yonghuService.updateById(yonghu);return R.ok();}/*** 忘记密码*/@IgnoreAuth@RequestMapping(value = "/resetPass")public R resetPass(String username, HttpServletRequest request) {YonghuEntity yonghu = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("username", username));if(yonghu!=null){yonghu.setPassword("123456");yonghuService.updateById(yonghu);return R.ok();}else{return R.error("账号不存在");}}/*** 获取用户的session用户信息*/@RequestMapping("/session")public R getCurrYonghu(HttpServletRequest request){Integer id = (Integer)request.getSession().getAttribute("userId");YonghuEntity yonghu = yonghuService.selectById(id);if(yonghu !=null){//entity转viewYonghuView view = new YonghuView();BeanUtils.copyProperties( yonghu , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 退出*/@GetMapping(value = "logout")public R logout(HttpServletRequest request) {request.getSession().invalidate();return R.ok("退出成功");}/*** 前端列表*/@IgnoreAuth@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));CommonUtil.checkMap(params);PageUtils page = yonghuService.queryPage(params);//字典表数据转换List<YonghuView> list =(List<YonghuView>)page.getList();for(YonghuView c:list)dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段return R.ok().put("data", page);}/*** 前端详情*/@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Integer id, HttpServletRequest request){logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);YonghuEntity yonghu = yonghuService.selectById(id);if(yonghu !=null){//entity转viewYonghuView view = new YonghuView();BeanUtils.copyProperties( yonghu , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view, request);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody YonghuEntity yonghu, HttpServletRequest request){logger.debug("add方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString());Wrapper<YonghuEntity> queryWrapper = new EntityWrapper<YonghuEntity>().eq("username", yonghu.getUsername()).or().eq("yonghu_phone", yonghu.getYonghuPhone()).or().eq("yonghu_id_number", yonghu.getYonghuIdNumber())
//            .notIn("yonghu_types", new Integer[]{102});logger.info("sql语句:"+queryWrapper.getSqlSegment());YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper);if(yonghuEntity==null){yonghu.setCreateTime(new Date());yonghu.setPassword("123456");yonghuService.insert(yonghu);return R.ok();}else {return R.error(511,"账户或者用户手机号或者用户身份证号已经被使用");}}}

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.OrdersEntity;
import com.service.OrdersService;import com.entity.TushuxinxiEntity;
import com.entity.view.TushuxinxiView;import com.service.TushuxinxiService;
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-01-18 10:58:17*/
@RestController
@RequestMapping("/tushuxinxi")
public class TushuxinxiController {@Autowiredprivate TushuxinxiService tushuxinxiService;@Autowiredprivate OrdersService ordersService;/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params,TushuxinxiEntity tushuxinxi,HttpServletRequest request){EntityWrapper<TushuxinxiEntity> ew = new EntityWrapper<TushuxinxiEntity>();PageUtils page = tushuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, tushuxinxi), params), params));return R.ok().put("data", page);}/*** 前端列表*/@IgnoreAuth@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params,TushuxinxiEntity tushuxinxi, HttpServletRequest request){EntityWrapper<TushuxinxiEntity> ew = new EntityWrapper<TushuxinxiEntity>();PageUtils page = tushuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, tushuxinxi), params), params));return R.ok().put("data", page);}/*** 列表*/@RequestMapping("/lists")public R list( TushuxinxiEntity tushuxinxi){EntityWrapper<TushuxinxiEntity> ew = new EntityWrapper<TushuxinxiEntity>();ew.allEq(MPUtil.allEQMapPre( tushuxinxi, "tushuxinxi")); return R.ok().put("data", tushuxinxiService.selectListView(ew));}/*** 查询*/@RequestMapping("/query")public R query(TushuxinxiEntity tushuxinxi){EntityWrapper< TushuxinxiEntity> ew = new EntityWrapper< TushuxinxiEntity>();ew.allEq(MPUtil.allEQMapPre( tushuxinxi, "tushuxinxi")); TushuxinxiView tushuxinxiView =  tushuxinxiService.selectView(ew);return R.ok("查询图书信息成功").put("data", tushuxinxiView);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id){TushuxinxiEntity tushuxinxi = tushuxinxiService.selectById(id);tushuxinxi.setClicknum(tushuxinxi.getClicknum()+1);tushuxinxi.setClicktime(new Date());tushuxinxiService.updateById(tushuxinxi);return R.ok().put("data", tushuxinxi);}/*** 前端详情*/@IgnoreAuth@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Long id){TushuxinxiEntity tushuxinxi = tushuxinxiService.selectById(id);tushuxinxi.setClicknum(tushuxinxi.getClicknum()+1);tushuxinxi.setClicktime(new Date());tushuxinxiService.updateById(tushuxinxi);return R.ok().put("data", tushuxinxi);}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody TushuxinxiEntity tushuxinxi, HttpServletRequest request){tushuxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(tushuxinxi);tushuxinxiService.insert(tushuxinxi);return R.ok();}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody TushuxinxiEntity tushuxinxi, HttpServletRequest request){tushuxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(tushuxinxi);tushuxinxiService.insert(tushuxinxi);return R.ok();}/*** 修改*/@RequestMapping("/update")public R update(@RequestBody TushuxinxiEntity tushuxinxi, HttpServletRequest request){//ValidatorUtils.validateEntity(tushuxinxi);tushuxinxiService.updateById(tushuxinxi);//全部更新return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Long[] ids){tushuxinxiService.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<TushuxinxiEntity> wrapper = new EntityWrapper<TushuxinxiEntity>();if(map.get("remindstart")!=null) {wrapper.ge(columnName, map.get("remindstart"));}if(map.get("remindend")!=null) {wrapper.le(columnName, map.get("remindend"));}int count = tushuxinxiService.selectCount(wrapper);return R.ok().put("count", count);}/*** 前端智能排序*/@IgnoreAuth@RequestMapping("/autoSort")public R autoSort(@RequestParam Map<String, Object> params,TushuxinxiEntity tushuxinxi, HttpServletRequest request,String pre){EntityWrapper<TushuxinxiEntity> ew = new EntityWrapper<TushuxinxiEntity>();Map<String, Object> newMap = new HashMap<String, Object>();Map<String, Object> param = new HashMap<String, Object>();Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();while (it.hasNext()) {Map.Entry<String, Object> entry = it.next();String key = entry.getKey();String newKey = entry.getKey();if (pre.endsWith(".")) {newMap.put(pre + newKey, entry.getValue());} else if (StringUtils.isEmpty(pre)) {newMap.put(newKey, entry.getValue());} else {newMap.put(pre + "." + newKey, entry.getValue());}}params.put("sort", "clicknum");params.put("order", "desc");PageUtils page = tushuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, tushuxinxi), params), params));return R.ok().put("data", page);}/*** 协同算法(按用户购买推荐)*/@RequestMapping("/autoSort2")public R autoSort2(@RequestParam Map<String, Object> params,TushuxinxiEntity tushuxinxi, HttpServletRequest request){String userId = request.getSession().getAttribute("userId").toString();String goodtypeColumn = "tushufenlei";List<OrdersEntity> orders = ordersService.selectList(new EntityWrapper<OrdersEntity>().eq("userid", userId).eq("tablename", "tushuxinxi").orderBy("addtime", false));List<String> goodtypes = new ArrayList<String>();Integer limit = params.get("limit")==null?10:Integer.parseInt(params.get("limit").toString());List<TushuxinxiEntity> tushuxinxiList = new ArrayList<TushuxinxiEntity>();//去重List<OrdersEntity> ordersDist = new ArrayList<OrdersEntity>();for(OrdersEntity o1 : orders) {boolean addFlag = true;for(OrdersEntity o2 : ordersDist) {if(o1.getGoodid()==o2.getGoodid()) {addFlag = false;break;}}if(addFlag) ordersDist.add(o1);}if(ordersDist!=null && ordersDist.size()>0) {for(OrdersEntity o : ordersDist) {tushuxinxiList.addAll(tushuxinxiService.selectList(new EntityWrapper<TushuxinxiEntity>().eq(goodtypeColumn, o.getGoodtype())));}}EntityWrapper<TushuxinxiEntity> ew = new EntityWrapper<TushuxinxiEntity>();params.put("sort", "id");params.put("order", "desc");PageUtils page = tushuxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, tushuxinxi), params), params));List<TushuxinxiEntity> pageList = (List<TushuxinxiEntity>)page.getList();if(tushuxinxiList.size()<limit) {int toAddNum = (limit-tushuxinxiList.size())<=pageList.size()?(limit-tushuxinxiList.size()):pageList.size();for(TushuxinxiEntity o1 : pageList) {boolean addFlag = true;for(TushuxinxiEntity o2 : tushuxinxiList) {if(o1.getId().intValue()==o2.getId().intValue()) {addFlag = false;break;}}if(addFlag) {tushuxinxiList.add(o1);if(--toAddNum==0) break;}   }}page.setList(tushuxinxiList);return R.ok().put("data", page);}/*** (按值统计)*/@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<TushuxinxiEntity> ew = new EntityWrapper<TushuxinxiEntity>();List<Map<String, Object>> result = tushuxinxiService.selectValue(params, ew);SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");for(Map<String, Object> m : result) {for(String k : m.keySet()) {if(m.get(k) instanceof Date) {m.put(k, sdf.format((Date)m.get(k)));}}}return R.ok().put("data", result);}/*** (按值统计)时间统计类型*/@RequestMapping("/value/{xColumnName}/{yColumnName}/{timeStatType}")public R valueDay(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType,HttpServletRequest request) {Map<String, Object> params = new HashMap<String, Object>();params.put("xColumn", xColumnName);params.put("yColumn", yColumnName);params.put("timeStatType", timeStatType);EntityWrapper<TushuxinxiEntity> ew = new EntityWrapper<TushuxinxiEntity>();List<Map<String, Object>> result = tushuxinxiService.selectTimeStatValue(params, ew);SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");for(Map<String, Object> m : result) {for(String k : m.keySet()) {if(m.get(k) instanceof Date) {m.put(k, sdf.format((Date)m.get(k)));}}}return R.ok().put("data", result);}/*** 分组统计*/@RequestMapping("/group/{columnName}")public R group(@PathVariable("columnName") String columnName,HttpServletRequest request) {Map<String, Object> params = new HashMap<String, Object>();params.put("column", columnName);EntityWrapper<TushuxinxiEntity> ew = new EntityWrapper<TushuxinxiEntity>();List<Map<String, Object>> result = tushuxinxiService.selectGroup(params, ew);SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");for(Map<String, Object> m : result) {for(String k : m.keySet()) {if(m.get(k) instanceof Date) {m.put(k, sdf.format((Date)m.get(k)));}}}return R.ok().put("data", result);}}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/651064.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Spring扩展点在微服务应用(待完善)

ApplicationListener扩展 nacos注册服务&#xff0c; 监听容器发布事件 # 容器发布事件 AbstractAutoServiceRegistration#onApplicationEvent # 接收事件吗&#xff0c;注册服务到nacos NacosServiceRegistry#register Lifecycle扩展 #订阅服务实例更改的事件 NamingService#…

【开源】基于JAVA的学生综合素质评价系统

目录 一、摘要1.1 项目介绍1.2 项目录屏 二、功能模块2.1 学生功能2.2 教师功能2.3 教务处功能 三、系统展示四、核心代码4.1 查询我的学科竞赛4.2 保存单个问卷4.3 根据类型查询学生问卷4.4 填写语数外评价4.5 填写品德自评问卷分 五、免责说明 一、摘要 1.1 项目介绍 基于J…

【数据结构】栈、队列、数组、列表

数据结构是什么&#xff1f; 数据结构是计算机存储、组织数据的方式 是指数据相互之间是以什么方式排列在一起的。 数据结构是为了更加方便的管理和使用数据&#xff0c;需要结合具体的业务场景来进行选择。一般情况下&#xff0c;精心选择的数据结构可以带来更高的运行或者…

MongoDB日期存储与查询、@Query、嵌套字段查询实战总结

缘由 MongoDB数据库如下&#xff1a; 如上截图&#xff0c;使用MongoDB客户端工具DataGrip&#xff0c;在filter过滤框输入{ profiles.alias: 逆天子, profiles.channel: }&#xff0c;即可实现昵称和渠道多个嵌套字段过滤查询。 现有业务需求&#xff1a;用Java代码来查询…

LeetCode.2861. 最大合金数

题目 题目链接 分析 这道题目一定要多读几遍&#xff0c;才能理解。 大意就是你有钱budget 和 库存stock的金属零件&#xff0c;让你从一堆机器里面选择一种机器可以合成最多金属的数量是多少&#xff0c;这些机器合成金属需要的零件数目是不一样的&#xff0c;composition…

程序员必备!10款实用便捷的Git可视化管理工具

前言 俗话说得好“工欲善其事&#xff0c;必先利其器”&#xff0c;合理的选择和使用可视化的管理工具可以降低技术入门和使用的门槛。我们在团队开发中统一某个开发工具的使用能够大大降低沟通成本&#xff0c;提高协作沟通效率。今天给大家分享10款实用便捷的Git可视化管理工…

(免费领源码)java#SSM#mysql疫情时期人员流调平台69124-计算机毕业设计项目选题推荐

目 录 摘要 1 绪论 1.1研究意义 1.2开发现状 1.3系统开发技术的特色 1.4 ssm框架介绍 1.5论文结构与章节安排 2 疫情时期人员流调平台系统分析 2.1 可行性分析 2.2 系统流程分析 2.2.1数据增加流程 2.2.2数据修改流程 2.2.3数据删除流程 2.3 系统功能分析 2.3.1…

VisionMaster图像拼接功能实现

由于硬件或安装环境限制&#xff0c;单个相机视野无法覆盖整个视野&#xff0c;但实际应用需要全视野图像时&#xff0c;可以拍摄物体的多个部分拼接成一张整图。VM提供图像拼接工具对图像进行拼接。 使用标定图进行标定建模是最重要的一步&#xff0c;成功标定后可以将图像无…

python222网站实战(SpringBoot+SpringSecurity+MybatisPlus+thymeleaf+layui)-帖子管理实现

锋哥原创的SpringbootLayui python222网站实战&#xff1a; python222网站实战课程视频教程&#xff08;SpringBootPython爬虫实战&#xff09; ( 火爆连载更新中... )_哔哩哔哩_bilibilipython222网站实战课程视频教程&#xff08;SpringBootPython爬虫实战&#xff09; ( 火…

【c++】高精度算法(洛谷刷题2024)扫雷游戏详解

系列文章目录 第二题&#xff1a;扫雷游戏 视频讲解&#xff1a;http://【洛谷题单 - 算法 - 高精度】https://www.bilibili.com/video/BV1Ym4y1s7BD?vd_source66a11ab493493f42b08b31246a932bbb 文章目录 目录 系列文章目录 文章目录 前言 一、题目分析以及思考 二、代…

多维时序 | Matlab实现CNN-BiGRU-Mutilhead-Attention卷积双向门控循环单元融合多头注意力机制多变量时间序列预测

多维时序 | Matlab实现CNN-BiGRU-Mutilhead-Attention卷积双向门控循环单元融合多头注意力机制多变量时间序列预测 目录 多维时序 | Matlab实现CNN-BiGRU-Mutilhead-Attention卷积双向门控循环单元融合多头注意力机制多变量时间序列预测效果一览基本介绍程序设计参考资料 效果一…

qemu的安装

1、简介 QEMU&#xff08;Quick EMUlator&#xff09;是一个开源的处理器模拟器&#xff0c;它可以在一种硬件平台上模拟另一种硬件平台&#xff0c;从而运行各种不同的操作系统。QEMU通过动态二进制翻译来实现高性能的模拟&#xff0c;这使得它可以在接近原生性能的速度下运行…

21.云原生之ArgoCD CICD实战(部分待补充)

云原生专栏大纲 文章目录 部署项目介绍项目结构介绍GitLab CI/CDGitLab CI/CD主要特点和功能 部署测试argocd的cd过程CICD工作流准备工作github中工作流文件创建gitlab中工作流文件创建【实操待补充】GitLab CI示例 数据加密之seale sealedBitnami Sealed Secrets介绍Bitnami …

basicPython-1

元组 """ 目录: 1.创建元组 2.元组的拼接 3.元组的解压赋值 4.元组的切片 5.元组的元素的索引 6.元组的嵌套 7.统计某个元素的个数 """"""创建元组(元组不可变)""" # 1.强制:tuple() # 2.普通 tuple_0 (1,) tup…

MYSQL表的约束详解!

文章目录 前言一、空属性二、默认值三、列描述四、zerofill五、主键六、自增长七、唯一键八、外键 前言 真正约束字段的是数据类型&#xff0c;但是数据类型约束很单一&#xff0c;需要有一些额外的约束&#xff0c;更好的保证数据的合法性&#xff0c;从业务逻辑角度保证数据…

VS生成报错:MSB8036 The Windows SDK version 8.1 was not found.找不到 Windows SDK 版本 8.1

目录 一、查看本机SDK二、 解决法一&#xff1a;适配本电脑的SDK法二&#xff1a;下载SDK 8.1 VS生成报错&#xff1a;MSB8036 找不到 Windows SDK 版本 8.1。请安装所需版本的 Windows SDK&#xff0c;或者在项目属性页中或通过右键单击解决方案并选择“重定解决方案目标”来更…

NAT地址转换协议

目录 NAT应用场景静态NAT动态NATNAPTEasy IPNAT服务器 点击跳转NAT配置&#xff08;动态nat&#xff0c;静态nat&#xff0c;Easy IP&#xff09; NAT应用场景 - 随着网络设备的数量不断增长&#xff0c;对IPv4地址的需求也不断增加&#xff0c;导致可用IPv4地址空间逐渐耗尽…

C++17中lambda表达式新增加支持的features

C17中对lambda表达式新增加了2种features&#xff1a;lambda capture of *this和constexpr lambda 1.lambda capture of *this: *this:拷贝当前对象,创建副本&#xff1a;捕获*this意味着该lambda生成的闭包将存储当前对象的一份拷贝 。 this:通过引用捕获。 当你需…

Jmeter接口测试总结

&#x1f345; 视频学习&#xff1a;文末有免费的配套视频可观看 &#x1f345; 关注公众号【互联网杂货铺】&#xff0c;回复 1 &#xff0c;免费获取软件测试全套资料&#xff0c;资料在手&#xff0c;涨薪更快 Jmeter介绍&测试准备 Jmeter介绍&#xff1a;Jmeter是软件…

Linux第36步_创建正点原子的TF-A工作区

创建正点原子的TF-A工作区&#xff0c;目的是想查看正点原子的设备树文件“stm32mp157d-atk.dts”和设备树头文件“stm32mp157d-atk.dtsi”&#xff0c;了解设备树是什么样子&#xff0c;为后期基于“ST公司的源码”创建自己的设备树提供参考&#xff0c;同时也是为了学习移植u…