• 基于javaweb的在线化妆品商城系统(java+ssm+jsp+js+bootstrap+mysql)


    基于javaweb的在线化妆品商城系统(java+ssm+jsp+js+bootstrap+mysql)

    运行环境

    Java≥8、MySQL≥5.7、Tomcat≥8

    开发工具

    eclipse/idea/myeclipse/sts等均可配置运行

    适用

    课程设计,大作业,毕业设计,项目练习,学习演示等

    功能说明

    20220522210455

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-KMIkwHCA-1666884451321)(https://pic1.imgdb.cn/files/52560/project20/20220522210456.jpg)]

    20220522210457

    20220522210458

    20220522210459

    20220522210500

    在线化妆品商城系统(java+SSM+JSP+JS+Bootstrap+mysql)

    项目介绍

    本项目为前后台项目,前台为普通用户登录,后台为管理员登录; 管理员角色包含以下功能: 管理员登录,分类管理,产品管理,用户管理,订单管理等功能。 用户角色包含以下功能: 提交订单,用户登录,用户首页,查看商品,查看订单,查看购物车等功能。

    环境需要

    1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;  5.数据库:MySql 5.7版本; 6.是否Maven项目:是;

    技术栈

    1. 后端:Spring+SpringMVC+Mybatis 2. 前端:JSP+CSS+JavaScript+jQuery+Bootstrap

    使用说明

    1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中db.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,在浏览器中输入http://localhost:8080/ssm_hzp_site/ 登录  注:Tomcat中配置项目路径必须为ssm_hzp_site 用户账号/密码: user/123456 管理员账号/密码:admin/admin

    用户信息管理:

    /**

    • 用户信息管理

    */

    @Controller

    public class ForeUserController extends BaseController{

    @Resource(name = “addressService”)

    private AddressService addressService;

    @Resource(name=“userService”)

    private UserService userService;

    //转到前台天猫-用户详情页

    @RequestMapping(value = “userDetails”, method = RequestMethod.GET)

    public String goToUserDetail(HttpSession session, Map map){

    logger.info(“检查用户是否登录”);

    Object userId = checkUser(session);

    if (userId != null) {

    logger.info(“获取用户信息”);

    User user = userService.get(Integer.parseInt(userId.toString()));

    map.put(“user”, user);

    logger.info(“获取用户所在地区级地址”);

    String districtAddressId = user.getUser_address().getAddress_areaId();

    Address districtAddress = addressService.get(districtAddressId);

    logger.info(“获取市级地址信息”);

    Address cityAddress = addressService.get(districtAddress.getAddress_regionId().getAddress_areaId());

    logger.info(“获取其他地址信息”);

    List

    addressList = addressService.getRoot();

    List

    cityList = addressService.getList(

    null,cityAddress.getAddress_regionId().getAddress_areaId()

    );

    List

    districtList = addressService.getList(null,cityAddress.getAddress_areaId());

    map.put(“addressList”, addressList);

    map.put(“cityList”, cityList);

    map.put(“districtList”, districtList);

    map.put(“addressId”, cityAddress.getAddress_regionId().getAddress_areaId());

    map.put(“cityAddressId”, cityAddress.getAddress_areaId());

    map.put(“districtAddressId”, districtAddressId);

    return “fore/userDetails”;

    } else {

    return “redirect:/login”;

    //前台天猫-用户更换头像

    @ResponseBody

    @RequestMapping(value = “user/uploadUserHeadImage”, method = RequestMethod.POST, produces = “application/json;charset=utf-8”)

    public String uploadUserHeadImage(@RequestParam MultipartFile file, HttpSession session

    ){

    String originalFileName = file.getOriginalFilename();

    logger.info(“获取图片原始文件名:{}”, originalFileName);

    String extension = originalFileName.substring(originalFileName.lastIndexOf(‘.’));

    String fileName = UUID.randomUUID() + extension;

    String filePath = session.getServletContext().getRealPath(“/”) + “rhttps://pic1.imgdb.cn/files/52560/item/userProfilePicture/” + fileName;

    logger.info(“文件上传路径:{}”, filePath);

    JSONObject jsonObject = new JSONObject();

    try {

    logger.info(“文件上传中…”);

    file.transferTo(new File(filePath));

    logger.info(“文件上传成功!”);

    jsonObject.put(“success”, true);

    jsonObject.put(“fileName”, fileName);

    } catch (IOException e) {

    logger.warn(“文件上传失败!”);

    e.printStackTrace();

    jsonObject.put(“success”, false);

    return jsonObject.toJSONString();

    //前台天猫-用户详情更新

    @RequestMapping(value=“user/update”,method=RequestMethod.POST,produces =“application/json;charset=utf-8”)

    public String userUpdate(HttpSession session, Map map,

    @RequestParam(value = “user_nickname”) String user_nickname /*用户昵称 */,

    @RequestParam(value = “user_realname”) String user_realname /真实姓名/,

    @RequestParam(value = “user_gender”) String user_gender /用户性别/,

    @RequestParam(value = “user_birthday”) String user_birthday /用户生日/,

    @RequestParam(value = “user_address”) String user_address /*用户所在地 */,

    @RequestParam(value = “user_profile_picture_src”, required = false)

    String user_profile_picture_src /* 用户头像*/,

    @RequestParam(value = “user_password”) String user_password/* 用户密码 */

    ) throws ParseException, UnsupportedEncodingException {

    logger.info(“检查用户是否登录”);

    Object userId = checkUser(session);

    if (userId != null) {

    logger.info(“获取用户信息”);

    User user = userService.get(Integer.parseInt(userId.toString()));

    map.put(“user”, user);

    } else {

    return “redirect:/login”;

    logger.info(“创建用户对象”);

    if (user_profile_picture_src != null && “”.equals(user_profile_picture_src)) {

    user_profile_picture_src = null;

    User userUpdate = new User()

    .setUser_id(Integer.parseInt(userId.toString()))

    .setUser_nickname(user_nickname)

    .setUser_realname(user_realname)

    .setUser_gender(Byte.valueOf(user_gender))

    .setUser_birthday(new SimpleDateFormat(“yyyy-MM-dd”).parse(user_birthday))

    .setUser_address(new Address().setAddress_areaId(user_address))

    .setUser_profile_picture_src(user_profile_picture_src)

    .setUser_password(user_password);

    logger.info(“执行修改”);

    if (userService.update(userUpdate)){

    logger.info(“修改成功!跳转到用户详情页面”);

    return “redirect:/userDetails”;

    throw new RuntimeException();

    订单列表页:

    /**

    • 订单列表页

    */

    @Controller

    public class ForeOrderController extends BaseController {

    @Resource(name = “productService”)

    private ProductService productService;

    @Resource(name = “userService”)

    private UserService userService;

    @Resource(name = “productOrderItemService”)

    private ProductOrderItemService productOrderItemService;

    @Resource(name = “addressService”)

    private AddressService addressService;

    @Resource(name = “categoryService”)

    private CategoryService categoryService;

    @Resource(name = “productImageService”)

    private ProductImageService productImageService;

    @Resource(name = “productOrderService”)

    private ProductOrderService productOrderService;

    @Resource(name = “reviewService”)

    private ReviewService reviewService;

    @Resource(name = “lastIDService”)

    private LastIDService lastIDService;

    //转到前台天猫-订单列表页

    @RequestMapping(value = “order”, method = RequestMethod.GET)

    public String goToPageSimple() {

    return “redirect:/order/0/10”;

    @RequestMapping(value = “order/{index}/{count}”, method = RequestMethod.GET)

    public String goToPage(HttpSession session, Map map,

    @RequestParam(required = false) Byte status,

    @PathVariable(“index”) Integer index/* 页数 */,

    @PathVariable(“count”) Integer count/* 行数*/) {

    logger.info(“检查用户是否登录”);

    Object userId = checkUser(session);

    User user;

    if (userId != null) {

    logger.info(“获取用户信息”);

    user = userService.get(Integer.parseInt(userId.toString()));

    map.put(“user”, user);

    } else {

    return “redirect:/login”;

    Byte[] status_array = null;

    if (status != null) {

    status_array = new Byte[]{status};

    PageUtil pageUtil = new PageUtil(index, count);

    logger.info(“根据用户ID:{}获取订单列表”, userId);

    List productOrderList = productOrderService.getList(

    new ProductOrder().setProductOrder_user(

    new User().setUser_id(Integer.valueOf(userId.toString()))

    ), status_array, new OrderUtil(“productOrder_id”, true), pageUtil

    );

    //订单总数量

    Integer orderCount = 0;

    if (productOrderList.size() > 0) {

    orderCount = productOrderService.getTotal(new ProductOrder().setProductOrder_user(new User().setUser_id(Integer.valueOf(userId.toString()))), status_array);

    logger.info(“获取订单项信息及对应的产品信息”);

    for (ProductOrder order : productOrderList) {

    List productOrderItemList = productOrderItemService.getListByOrderId(

    order.getProductOrder_id(), null

    );

    if (productOrderItemList != null) {

    for (ProductOrderItem productOrderItem : productOrderItemList) {

    Integer product_id = productOrderItem.getProductOrderItem_product().getProduct_id();

    Product product = productService.get(product_id);

    product.setSingleProductImageList(productImageService.getList(

    product_id, (byte) 0, new PageUtil(0, 1)

    ));

    productOrderItem.setProductOrderItem_product(product);

    if (order.getProductOrder_status() == 3) {

    productOrderItem.setIsReview(reviewService.getTotalByOrderItemId(

    productOrderItem.getProductOrderItem_id()) > 0

    );

    order.setProductOrderItemList(productOrderItemList);

    pageUtil.setTotal(orderCount);

    logger.info(“获取产品分类列表信息”);

    List categoryList = categoryService.getList(null, new PageUtil(0, 5));

    map.put(“pageUtil”, pageUtil);

    map.put(“productOrderList”, productOrderList);

    map.put(“categoryList”, categoryList);

    map.put(“status”, status);

    logger.info(“转到前台天猫-订单列表页”);

    return “fore/orderListPage”;

    //转到前台天猫-订单建立页

    @RequestMapping(value = “order/create/{product_id}”, method = RequestMethod.GET)

    public String goToOrderConfirmPage(@PathVariable(“product_id”) Integer product_id,

    @RequestParam(required = false, defaultValue = “1”) Short product_number,

    Map map,

    HttpSession session,

    HttpServletRequest request) throws UnsupportedEncodingException {

    logger.info(“检查用户是否登录”);

    Object userId = checkUser(session);

    User user;

    if (userId != null) {

    logger.info(“获取用户信息”);

    user = userService.get(Integer.parseInt(userId.toString()));

    map.put(“user”, user);

    } else {

    return “redirect:/login”;

    logger.info(“通过产品ID获取产品信息:{}”, product_id);

    Product product = productService.get(product_id);

    if (product == null) {

    return “redirect:/”;

    logger.info(“获取产品的详细信息”);

    product.setProduct_category(categoryService.get(product.getProduct_category().getCategory_id()));

    product.setSingleProductImageList(productImageService.getList(product_id, (byte) 0, new PageUtil(0, 1)));

    logger.info(“封装订单项对象”);

    ProductOrderItem productOrderItem = new ProductOrderItem();

    productOrderItem.setProductOrderItem_product(product);

    productOrderItem.setProductOrderItem_number(product_number);

    productOrderItem.setProductOrderItem_price(product.getProduct_sale_price() * product_number);

    productOrderItem.setProductOrderItem_user(new User().setUser_id(Integer.valueOf(userId.toStrin

  • 相关阅读:
    Mysql的卸载流程
    商业智能BI行业分析思维框架:铅酸蓄电池行业(一)
    提分必练!中创教育PMP全真模拟题分享来喽
    Stimulsoft Ultimate Reports 2022.3.1
    35道最新【软件测试】面试题,常见面试题及答案汇总
    ensp桥接电脑网卡
    猿创征文 | 《深入浅出Vue.js》打卡Day5
    c++ 田忌赛马(史上最全)上海月赛乙组T3
    java:解析json的几种方式
    HTML网页设计制作大作业(div+css)---浩瀚天文 (13页有二级菜单)
  • 原文地址:https://blog.csdn.net/m0_69592937/article/details/127562975