🙊作者简介:多年编程开发经验,专注java技术领域和毕业设计项目实战,系统定制、远程部署调试、代码讲解、代码修改
🍅擅长语言:springboot、ssm、vue、html、jsp、php、python、爬虫、小程序、安卓app
⬇️源码获取:文末可以获取源码+数据库+文档⚡感兴趣的可以先收藏+关注,后续会更新更多项目资料,所有项目均配有开发文档和安装配置教程
系统介绍
手机商城微信小程序按照操作主体分为管理员和用户。管理员的功能包括用户信息管理,商品信息管理,商品类型管理,购物车管理,商品质询管理,客服聊天管理。用户的功能包括注册,信息查看等功能。
系统主要技术
开发语言:Java
使用框架:SSM
系统架构:B/S
前端技术:Vue、JavaScript
数据库 :Mysql 5.7/8.0
编译工具:idea或者eclipse,jdk1.8,maven
系统功能结构设计
图4-5系统功能结构图
系统功能实现
注册用户通过注册窗口,进行在线填写自己的用户名、密码、姓名、手机、电子邮箱等等,信息编辑完成后核对信息无误后进行选择注册,系统核对用户所输入的账号信息是否准确,核对信息准确无误后系统进入到操作界面。
用户通过登录进入到系统操作界面后,可以根据需求对首页、商品信息、特价商品、我的等模块进行管理维护操作。
如图5-1所示。
图5-1注册用户界面图
用户登录通过用户名、密码行页面,进入到购物系统设计主界面,进入到操作界面,进行相对应操作,如图5-2所示。
图5-2用户登录界面图
用户首页页面可以查看首页、商品信息、特价商品、我的等信息,进行提交操作,如图5-3所示。
图5-3首页界面图
用户进入特价商品页面可以填写商品名称、倒计时、分类、图片、规格、品牌、生产日期、保质期、价格等信息,进行加入购物车、立即购买操作,如图5-4所示。
图5-4特价商品界面图
用户进入用户信息页面可以填写用户名、密码、姓名、性别、头像、手机、邮箱等信息,进行保存、退出登录操作,如图5-5-所示。
图5-5用户信息界面图
用户进入用户充值页面可以填写金额等信息,进行提交操作,如图5-6-所示。
图5-6用户充值界面图
用户进入我的订单页面可以填写商品名称、价格、地址等信息,进行提交操作,如图5-7-所示
论文参考
核心代码
package com.controller;
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.StringUtil;
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("/news")
public class NewsController {
private static final Logger logger = LoggerFactory.getLogger(NewsController.class);
@Autowired
private NewsService newsService;
@Autowired
private TokenService tokenService;
@Autowired
private DictionaryService dictionaryService;
//级联表service
@Autowired
private YonghuService yonghuService;
/**
* 后端列表
*/
@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(StringUtil.isEmpty(role))
return R.error(511,"权限为空");
else if("用户".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
if(params.get("orderBy")==null || params.get("orderBy")==""){
params.put("orderBy","id");
}
PageUtils page = newsService.queryPage(params);
//字典表数据转换
List<NewsView> list =(List<NewsView>)page.getList();
for(NewsView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
NewsEntity news = newsService.selectById(id);
if(news !=null){
//entity转view
NewsView view = new NewsView();
BeanUtils.copyProperties( news , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody NewsEntity news, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,news:{}",this.getClass().getName(),news.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(StringUtil.isEmpty(role))
return R.error(511,"权限为空");
Wrapper<NewsEntity> queryWrapper = new EntityWrapper<NewsEntity>()
.eq("news_name", news.getNewsName())
.eq("news_types", news.getNewsTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
NewsEntity newsEntity = newsService.selectOne(queryWrapper);
if(newsEntity==null){
news.setInsertTime(new Date());
news.setCreateTime(new Date());
newsService.insert(news);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody NewsEntity news, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,news:{}",this.getClass().getName(),news.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(StringUtil.isEmpty(role))
return R.error(511,"权限为空");
//根据字段查询是否有相同数据
Wrapper<NewsEntity> queryWrapper = new EntityWrapper<NewsEntity>()
.notIn("id",news.getId())
.andNew()
.eq("news_name", news.getNewsName())
.eq("news_types", news.getNewsTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
NewsEntity newsEntity = newsService.selectOne(queryWrapper);
if("".equals(news.getNewsPhoto()) || "null".equals(news.getNewsPhoto())){
news.setNewsPhoto(null);
}
if(newsEntity==null){
// String role = String.valueOf(request.getSession().getAttribute("role"));
// if("".equals(role)){
// news.set
// }
newsService.updateById(news);//根据id更新
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
newsService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}