源码获取:俺的博客首页 "资源" 里下载!
一、开发背景
软件名称:婚品采购商城系统(WeddingShop)
使用对象:需要购买婚品的人,提供线上服务
二、 需求分析
系统分析
本次选择的项目是婚品采购系统,主要是开发出一个具有如今各大主流电商平台都具有的基本功能:浏览商品,加入购物车,提交订单,订单支付后跳转我的订单等。
项目网站的名称是:侣行婚礼,主要寓意是情侣之间,就像是一场长跑的马拉松,一直陪伴的走下去。
三、开发环境
系统环境:Windows 10 专业版
开发工具:IDEA 2019
Java版本:JDK 1.8
服务器:tomcat 8.5x
数据库:MySQL 8.5+
系统采用技术:Servlet+Jsp+Jdbc+jQuery+Ajax+MVC框架
四、其它的看截图:
首页展示1:
首页展示2:
婚品商城:
商品展示:![](https://i-blog.csdnimg.cn/direct/72f5d21015224554a6529a5bdaaa802a.jpeg)
婚礼视频:![](https://i-blog.csdnimg.cn/direct/070b5aa9235749dd9da83c0546b1c9e2.jpeg)
后台管理首页展示:
商品后台管理:
商品类别展示:
后台订单管理:
会员管理展示:
订单管理控制层:
/**
* 用户
**/
@RestController
@RequestMapping("order")
public class OrderController {
@Autowired
OrderService orderService;
@Autowired
UserDao userDao;
@Autowired
OrderDao orderDao;
@Autowired
FlowersDao flowersDao;
@RequestMapping("/test")
R test() {
R r = new R();
return r.setCode(4000).setMsg(Constant.IMG_PATH).setData(orderDao.findAll(null));
}
@RequestMapping("/queryByAccount")
R queryByAccount(@RequestParam("account") String account) {
R r = new R();
if (StringUtil.isEmpty(account)) {
return r.setCode(4000).setMsg(HttpMsg.INVALID_PARAM);
}
List<Order> orders = orderService.queryByAccount(account);
return r.setCode(2000).setData(orders);
}
@RequestMapping("/find")
R find(@RequestParam("page") int page, @RequestParam("searchKey") String searchKey, @RequestParam("account") String account) {
R r = new R();
Map<String, Object> map = new HashMap<>();
List<Order> orders = orderService.find(searchKey, account);
if (orders == null) {
return r.setCode(2000);
}
map.put("items", orders);
map.put("len", orders.size());
return r.setCode(2000).setData(map);
}
@RequestMapping("/findAll")
R findAll(@RequestParam("page") int page, @RequestParam("searchKey") String searchKey) {
R r = new R();
Map<String, Object> map = new HashMap<>();
List<Order> orders = orderService.findAll(searchKey);
if (orders == null) {
return r.setCode(2000);
}
List<Order> items = orders.size() >= page * Constant.PAGE_SIZE ?
orders.subList((page - 1) * Constant.PAGE_SIZE, page * Constant.PAGE_SIZE)
: orders.subList((page - 1) * Constant.PAGE_SIZE, orders.size());
int len = orders.size() % Constant.PAGE_SIZE == 0 ? orders.size() / Constant.PAGE_SIZE
: (orders.size() / Constant.PAGE_SIZE + 1);
List<OrderVo> vos = new ArrayList<>();
for (Order item : items) {
User user = userDao.queryById(item.getUid());
OrderVo vo = new OrderVo();
vo.setAddress(user.getAddress()).setPhone(user.getPhone()).setUsername(user.getName())
.setAmount(item.getAmount()).setFlower(item.getFlower()).setId(item.getId())
.setUid(item.getUid()).setOrder_guid(item.getOrder_guid()).setPrice(item.getPrice())
.setState(item.getState());
vos.add(vo);
}
map.put("items", vos);
map.put("len", len);
return r.setCode(2000).setData(map);
}
@RequestMapping("/update")
R update(@RequestBody Order order) {
R r = new R();
int ans = orderService.update(order);
if (ans >= 0) {
return r.setCode(2000).setMsg(HttpMsg.UPDATE_USER_OK);
}
return r.setCode(4000).setMsg(HttpMsg.UPDATE_USER_FAILED);
}
@RequestMapping("/changeState")
R changeState(@RequestBody Order order) {
orderDao.changeState(order);
return new R().setCode(2000).setMsg(HttpMsg.UPDATE_ORDER_OK);
}
@DeleteMapping("/delete")
R delete(@RequestParam("id") int id) {
R r = new R();
int ans = orderService.delete(id);
if (ans == 1) {
return r.setCode(2000).setMsg(HttpMsg.DELETE_USER_OK);
}
return r.setCode(4000).setMsg(HttpMsg.DELETE_USER_FAILED);
}
}
用户管理控制层:
/**
* 用户
**/
@RestController
@RequestMapping("user")
public class UserController {
@Autowired
UserService userService;
@Autowired
UserDao dao;
@RequestMapping("/test")
R test() {
R r = new R();
return r.setCode(4000).setMsg(Constant.IMG_PATH).setData(dao.findAll());
}
@RequestMapping("/queryInfoByAccount")
R queryInfoByAccount(@RequestParam("account") String account) {
R r = new R();
if (StringUtil.isEmpty(account)){
return r.setCode(4000).setMsg(HttpMsg.INVALID_PARAM);
}
User loginUser = userService.queryInfo(account);
if (loginUser == null){
return r.setCode(4000).setMsg(HttpMsg.INVALID_USER);
}
return r.setCode(2000).setData(loginUser);
}
@RequestMapping("/find")
R find(@RequestParam("page") int page, @RequestParam("searchKey") String searchKey) {
R r = new R();
Map<String, Object> map = new HashMap<>();
List<User> users = userService.find(searchKey);
if (users == null) {
return r.setCode(2000);
}
List<User> items = users.size() >= page * Constant.PAGE_SIZE ?
users.subList((page - 1) * Constant.PAGE_SIZE, page * Constant.PAGE_SIZE)
: users.subList((page - 1) * Constant.PAGE_SIZE, users.size());
int len = users.size() % Constant.PAGE_SIZE == 0 ? users.size() / Constant.PAGE_SIZE
: (users.size() / Constant.PAGE_SIZE + 1);
map.put("items", items);
map.put("len", len);
return r.setCode(2000).setData(map);
}
@RequestMapping("/create")
R create(@RequestBody User user) {
R r = new R();
int ans = userService.add(user);
if (ans == 1) {
return r.setCode(2000).setMsg(HttpMsg.ADD_USER_OK);
}
return r.setCode(4000).setMsg(HttpMsg.ADD_USER_FAILED);
}
@RequestMapping("/update")
R update(@RequestBody User user) {
R r = new R();
int ans = userService.update(user);
if (ans >= 0) {
return r.setCode(2000).setMsg(HttpMsg.UPDATE_USER_OK);
}
return r.setCode(4000).setMsg(HttpMsg.UPDATE_USER_FAILED);
}
@DeleteMapping("/delete")
R delete(@RequestParam("id") int id) {
R r = new R();
int ans = userService.delete(id);
if (ans == 1) {
return r.setCode(2000).setMsg(HttpMsg.DELETE_USER_OK);
}
return r.setCode(4000).setMsg(HttpMsg.DELETE_USER_FAILED);
}
}
登录控制层:
/**
* 登录
**/
@RestController
@RequestMapping("login")
public class LoginController {
@Autowired
LoginDao loginDao;
@RequestMapping("/doLogin")
R doLogin(@RequestBody LoginForm form) {
R r = new R();
if (!VerifyUtil.verifyLoginForm(form)) {
return r.setCode(4000).setMsg(HttpMsg.ERROR_INPUT);
}
User loginUser = loginDao.login(form);
if (loginUser != null) {
return r.setCode(2000).setMsg("欢迎您:" + loginUser.getName()).setData(loginUser);
}
return r.setCode(4000).setMsg(HttpMsg.ERROR_VERIFY);
}
@RequestMapping("/test")
R test() {
R r = new R();
return r.setCode(4000).setMsg(Constant.IMG_PATH);
}
}
源码获取:俺的博客首页 "资源" 里下载!