摘 要
随着科学技术的飞速发展,各行各业都在努力与现代先进技术接轨,通过科技手段提高自身的优势,免税商品优选购物商城当然也不能排除在外,随着购物商城的不断成熟,它彻底改变了过去传统的免税商品优选购物商城方式,不仅使商城管理难度变低了,还提升了免税商品优选购物商城的灵活性。这种个性化的免税商品优选购物商城特别注重交互协调经营与管理的相互配合,激发了管理人员的创造性与主动性,对资产设备借还的管理而言非常有利。
本文首先分析了免税商品优选购物商城的发展背景和意义,简要阐述了免税商品优选购物商城开发的主要内容和优势,然后简要介绍了国内外免税商品优选购物商城的研究和应用现状,并对系统开发技术,系统分析和总体设计,实现详细功能等。
本免税商品优选购物商城采用的数据库是MYSQL,使用java技术开发,在设计过程中,充分保证了系统代码的良好可读性、实用性、易扩展性、通用性、便于后期维护、操作方便以及页面简洁等特点。
关键词:免税商品优选购物商城;JAVA;MYSQL 数据库
基于Java的springboot免税商品优选购物商城源码和论文020
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.ShangjiaEntity;
import com.entity.view.ShangjiaView;
import com.service.ShangjiaService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
/**
* 商家
* 后端接口
* @author
* @email
* @date 2021-03-19 00:10:08
*/
@RestController
@RequestMapping("/shangjia")
public class ShangjiaController {
@Autowired
private ShangjiaService shangjiaService;
@Autowired
private TokenService tokenService;
/**
* 登录
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
ShangjiaEntity user = shangjiaService.selectOne(new EntityWrapper<ShangjiaEntity>().eq("shangjiazhanghao", username));
if(user==null || !user.getMima().equals(password)) {
return R.error("账号或密码不正确");
}
if("否".equals(user.getSfsh())) return R.error("账号已锁定,请联系管理员审核。");
String token = tokenService.generateToken(user.getId(), username,"shangjia", "商家" );
return R.ok().put("token", token);
}
/**
* 注册
*/
@IgnoreAuth
@RequestMapping("/register")
public R register(@RequestBody ShangjiaEntity shangjia){
//ValidatorUtils.validateEntity(shangjia);
ShangjiaEntity user = shangjiaService.selectOne(new EntityWrapper<ShangjiaEntity>().eq("shangjiazhanghao", shangjia.getShangjiazhanghao()));
if(user!=null) {
return R.error("注册用户已存在");
}
Long uId = new Date().getTime();
shangjia.setId(uId);
shangjiaService.insert(shangjia);
return R.ok();
}
/**
* 退出
*/
@RequestMapping("/logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}
/**
* 获取用户的session用户信息
*/
@RequestMapping("/session")
public R getCurrUser(HttpServletRequest request){
Long id = (Long)request.getSession().getAttribute("userId");
ShangjiaEntity user = shangjiaService.selectById(id);
return R.ok().put("data", user);
}
/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
ShangjiaEntity user = shangjiaService.selectOne(new EntityWrapper<ShangjiaEntity>().eq("shangjiazhanghao", username));
if(user==null) {
return R.error("账号不存在");
}
user.setMima("123456");
shangjiaService.updateById(user);
return R.ok("密码已重置为:123456");
}
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,ShangjiaEntity shangjia,
HttpServletRequest request){
EntityWrapper<ShangjiaEntity> ew = new EntityWrapper<ShangjiaEntity>();
PageUtils page = shangjiaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shangjia), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,ShangjiaEntity shangjia, HttpServletRequest request){
EntityWrapper<ShangjiaEntity> ew = new EntityWrapper<ShangjiaEntity>();
PageUtils page = shangjiaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shangjia), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( ShangjiaEntity shangjia){
EntityWrapper<ShangjiaEntity> ew = new EntityWrapper<ShangjiaEntity>();
ew.allEq(MPUtil.allEQMapPre( shangjia, "shangjia"));
return R.ok().put("data", shangjiaService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(ShangjiaEntity shangjia){
EntityWrapper< ShangjiaEntity> ew = new EntityWrapper< ShangjiaEntity>();
ew.allEq(MPUtil.allEQMapPre( shangjia, "shangjia"));
ShangjiaView shangjiaView = shangjiaService.selectView(ew);
return R.ok("查询商家成功").put("data", shangjiaView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
ShangjiaEntity shangjia = shangjiaService.selectById(id);
return R.ok().put("data", shangjia);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
ShangjiaEntity shangjia = shangjiaService.selectById(id);
return R.ok().put("data", shangjia);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ShangjiaEntity shangjia, HttpServletRequest request){
shangjia.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(shangjia);
ShangjiaEntity user = shangjiaService.selectOne(new EntityWrapper<ShangjiaEntity>().eq("shangjiazhanghao", shangjia.getShangjiazhanghao()));
if(user!=null) {
return R.error("用户已存在");
}
shangjia.setId(new Date().getTime());
shangjiaService.insert(shangjia);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ShangjiaEntity shangjia, HttpServletRequest request){
shangjia.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(shangjia);
ShangjiaEntity user = shangjiaService.selectOne(new EntityWrapper<ShangjiaEntity>().eq("shangjiazhanghao", shangjia.getShangjiazhanghao()));
if(user!=null) {
return R.error("用户已存在");
}
shangjia.setId(new Date().getTime());
shangjiaService.insert(shangjia);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody ShangjiaEntity shangjia, HttpServletRequest request){
//ValidatorUtils.validateEntity(shangjia);
shangjiaService.updateById(shangjia);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
shangjiaService.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<ShangjiaEntity> wrapper = new EntityWrapper<ShangjiaEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = shangjiaService.selectCount(wrapper);
return R.ok().put("count", count);
}
}
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.ZaixiankefuEntity;
import com.entity.view.ZaixiankefuView;
import com.service.ZaixiankefuService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
/**
* 在线客服
* 后端接口
* @author
* @email
* @date 2021-03-19 00:10:08
*/
@RestController
@RequestMapping("/zaixiankefu")
public class ZaixiankefuController {
@Autowired
private ZaixiankefuService zaixiankefuService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,ZaixiankefuEntity zaixiankefu,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yonghu")) {
zaixiankefu.setZhanghao((String)request.getSession().getAttribute("username"));
}
if(tableName.equals("shangjia")) {
zaixiankefu.setShangjiazhanghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<ZaixiankefuEntity> ew = new EntityWrapper<ZaixiankefuEntity>();
PageUtils page = zaixiankefuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zaixiankefu), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,ZaixiankefuEntity zaixiankefu, HttpServletRequest request){
EntityWrapper<ZaixiankefuEntity> ew = new EntityWrapper<ZaixiankefuEntity>();
PageUtils page = zaixiankefuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zaixiankefu), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( ZaixiankefuEntity zaixiankefu){
EntityWrapper<ZaixiankefuEntity> ew = new EntityWrapper<ZaixiankefuEntity>();
ew.allEq(MPUtil.allEQMapPre( zaixiankefu, "zaixiankefu"));
return R.ok().put("data", zaixiankefuService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(ZaixiankefuEntity zaixiankefu){
EntityWrapper< ZaixiankefuEntity> ew = new EntityWrapper< ZaixiankefuEntity>();
ew.allEq(MPUtil.allEQMapPre( zaixiankefu, "zaixiankefu"));
ZaixiankefuView zaixiankefuView = zaixiankefuService.selectView(ew);
return R.ok("查询在线客服成功").put("data", zaixiankefuView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
ZaixiankefuEntity zaixiankefu = zaixiankefuService.selectById(id);
return R.ok().put("data", zaixiankefu);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
ZaixiankefuEntity zaixiankefu = zaixiankefuService.selectById(id);
return R.ok().put("data", zaixiankefu);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ZaixiankefuEntity zaixiankefu, HttpServletRequest request){
zaixiankefu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(zaixiankefu);
zaixiankefuService.insert(zaixiankefu);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ZaixiankefuEntity zaixiankefu, HttpServletRequest request){
zaixiankefu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(zaixiankefu);
zaixiankefuService.insert(zaixiankefu);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody ZaixiankefuEntity zaixiankefu, HttpServletRequest request){
//ValidatorUtils.validateEntity(zaixiankefu);
zaixiankefuService.updateById(zaixiankefu);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
zaixiankefuService.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<ZaixiankefuEntity> wrapper = new EntityWrapper<ZaixiankefuEntity>();
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("yonghu")) {
wrapper.eq("zhanghao", (String)request.getSession().getAttribute("username"));
}
if(tableName.equals("shangjia")) {
wrapper.eq("shangjiazhanghao", (String)request.getSession().getAttribute("username"));
}
int count = zaixiankefuService.selectCount(wrapper);
return R.ok().put("count", count);
}
}