java springboot宠物交易商城微信小程序源码和论文

基于微信的宠物交易商城设计与开发

摘要:随着互联网的进一步发展,传统手机移动端应用软件所存在的问题逐渐出现在技术关注领域,原生的安卓应用软件在安装卸载过程中影响了用户的体验,一种为提高用户体验而产生的轻量级内嵌式WEB程序日益受到开发人员的关注。自微信小程序被提出以来,越来越多的互联网企业竞相研发独立小程序应用,在未来具有广阔前景。

本文基于当前流行的微信小程序应用开发技术,结合宠物交易商城的用户需求,面向小型店铺开发一套易于复用、可配置、低代码开发的微信小程序宠物交易商城系统。该系统通过目前主流Java后端开发框架SpringBoot与主流数据源配置框架MyBatis以及通用MySQL数据库搭建后台服务器项目,使用Vue前端设计框架和Element-ui界面元素实现小程序管理员系统界面,并根据微信小程序官方提供的设计文档制作了原生的宠物交易商城小程序。该小程序能够满足当前小型店铺的商业服务需求,实现了分模块动态配置,易于二次开发,便于快速搭建成型系统,具备一定经济效应。

关键词:宠物交易商城,小程序,动态配置,SpringBoot,Vue

【527】基于java springboot宠物交易商城微信小程序源码和论文 


Design and Development of Online Mall Based on WeChat

Abstract: With the further development of the Internet, the problems existing in the traditional mobile terminal application software developed in the field of technological focus, the native android applications affect the user experience in the process of unloading installation, to improve the user experience and produce a lightweight embedded WEB application by developers, more and more attention. Since WeChat small program was put forward, more and more Internet enterprises compete to develop independent small program applications, which will have broad prospects in the future.

Based on the current popular WeChat small program application development technology, combined with the user needs of online shopping mall, for small shops to develop a set of easy reuse, configurable, low code development of WeChat small program online shopping mall system. The system uses the current mainstream Java backend development framework SpringBoot, the mainstream data source configuration framework Mybatis and the general MySQL database to build the backend server project, and uses the Vue front-end design framework and Element-UI interface elements to realize the small program administrator system interface. And according to the WeChat small program official design documents produced the original online mall small program. The small program can meet the current commercial service needs of small shops, realize the dynamic configuration of modules, easy to secondary development, easy to quickly build a molding system, with a certain economic effect.

Keywords: online mall, mini program, dynamic allocation, SpringBoot, Vue

package com.ndky.shop_back.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ndky.shop_back.dao.GoodDao;
import com.ndky.shop_back.entity.Good;
import com.ndky.shop_back.entity.QueryInfo;
import com.ndky.shop_back.service.GoodService;
import com.ndky.shop_back.util.Consts;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
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 org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;

@RestController
public class GoodController {
    @Autowired
    GoodService goodService;

    @RequestMapping("/allGood")
    public String getGoodList(QueryInfo queryInfo) {
        // 获取最大列表数和当前编号
        int number = goodService.getGoodCounts("%" + queryInfo.getQuery() + "%");
        int pageState = (queryInfo.getPageNum() - 1) * queryInfo.getPageSize();

        List<Good> good = goodService.getAllGood("%" + queryInfo.getQuery() + "%", pageState, queryInfo.getPageSize());
        HashMap<String, Object> res = new HashMap<>();
        res.put("number", number);
        res.put("data", good);
        String res_string = JSON.toJSONString(res);
        return res_string;
    }

    @RequestMapping("/goodState")
    public String updateGoodState(@RequestParam("good_id") Integer good_id,
                                  @RequestParam("good_state") Boolean good_state) {
        int i = goodService.updateState(good_id, good_state);
        return i > 0 ? "success" : "error";
    }

    @RequestMapping("/addGood")
    public String addGood(@RequestBody Good good) {
        int i = goodService.addGood(good);


        return i > 0 ? "success" : "error";
    }

    @RequestMapping("/deleteGood")
    public String deleteGood(int good_id) {
        int i = goodService.deleteGood(good_id);
        return i > 0 ? "success" : "error";
    }

    @RequestMapping("/getUpdateGood")
    public String getUpdateGood(int good_id) {
        Good good=goodService.getUpdateGood(good_id);
        String string = JSON.toJSONString(good);//注意这里也可以直接返回对象,springboot会把对象直接转换成字符串
        return string;
    }

    @RequestMapping("/editGood")
    public String editUser(@RequestBody Good good) {
        int i = goodService.editGood(good);
        return i > 0 ? "success" : "error";
    }


    //查询所有商品,返回到微信小程序
    @RequestMapping("/selectAllGood")
    public String selectAllGood(){
        List<Good> list=goodService.selectAllGood();
        String string = JSON.toJSONString(list);//注意这里也可以直接返回对象,springboot会把对象直接转换成字符串
        return string;
    }
    //按照class_name查询商品,填充商品分类右边栏目
    @RequestMapping("/selectGoodByClass")
    public String selectGoodByClass(@Param("class_name") String class_name){
        List<Good> list=goodService.selectGoodByClass(class_name);
        String string = JSON.toJSONString(list);
        return string;
    }

    @RequestMapping("/selectGoodById")
    public String selectGoodById(@Param("good_id") Integer good_id){
        Good good=goodService.selectGoodById(good_id);
        String string = JSON.toJSONString(good);
        return string;
    }

    @RequestMapping("/searchGood")
    public String searchGood(@Param("query") String query){
        List<Good> list=goodService.searchGood(query);
        String string = JSON.toJSONString(list);
        return string;
    }


    @RequestMapping("/setGoodStar")
    public String setGoodStar(@Param("good_id") Integer good_id,@Param("good_star")Integer good_star){
        int i = goodService.setGoodStar(good_id, good_star);
        return i > 0 ? "success" : "error";
    }


    @RequestMapping("/getGoodByStar")
    public String getGoodByStar(QueryInfo queryInfo){
        // 获取最大列表数和当前编号
        int number = goodService.getGoodCounts("%" + queryInfo.getQuery() + "%");
        int pageState = (queryInfo.getPageNum() - 1) * queryInfo.getPageSize();

        List<Good> good = goodService.getGoodByStar("%" + queryInfo.getQuery() + "%", pageState, queryInfo.getPageSize());
        HashMap<String, Object> res = new HashMap<>();
        res.put("number", number);
        res.put("data", good);
        String res_string = JSON.toJSONString(res);
        return res_string;
    }

    @RequestMapping("/getStarByGoodId")
    public Integer getStarByGoodId(@Param("good_id") Integer good_id){
        return goodService.getStarByGoodId(good_id);
    }


    //更新商品图片
    @RequestMapping("/updateGoodImage")
    public Object updateGoodImage(@RequestParam("file") MultipartFile avatorFile, @RequestParam("good_id")int id){
        JSONObject jsonObject = new JSONObject();
        if(avatorFile.isEmpty()){
            jsonObject.put(Consts.CODE,0);
            jsonObject.put(Consts.MSG,"文件上传失败");
            return jsonObject;
        }
        //文件名=当前时间到毫秒+原来的文件名
        String fileName = System.currentTimeMillis()+avatorFile.getOriginalFilename();
        //文件路径
        String filePath = System.getProperty("user.dir")+System.getProperty("file.separator")+"img"
                +System.getProperty("file.separator")+"goodImage";
        //如果文件路径不存在,新增该路径
        File file1 = new File(filePath);
        if(!file1.exists()){
            file1.mkdir();
        }
        //实际的文件地址
        File dest = new File(filePath+System.getProperty("file.separator")+fileName);
        //存储到数据库里的相对文件地址
        String storeAvatorPath = Consts.URL+"/img/goodImage/"+fileName;
        try {
            avatorFile.transferTo(dest);
            Good good=new Good();
            good.setGood_id(id);
            good.setGood_image(storeAvatorPath);

            int flag = goodService.editGood(good);
            if(flag>0){
                jsonObject.put(Consts.CODE,1);
                jsonObject.put(Consts.MSG,"上传成功");
                jsonObject.put("pic",storeAvatorPath);
                return jsonObject;
            }
            jsonObject.put(Consts.CODE,0);
            jsonObject.put(Consts.MSG,"上传失败");
            return jsonObject;
        } catch (IOException e) {
            jsonObject.put(Consts.CODE,0);
            jsonObject.put(Consts.MSG,"上传失败"+e.getMessage());
        }finally {
            return jsonObject;
        }
    }


}
package com.ndky.shop_back.controller;

import com.alibaba.fastjson.JSON;
import com.ndky.shop_back.entity.QueryInfo;
import com.ndky.shop_back.entity.User;
import com.ndky.shop_back.service.UserService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
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 java.util.HashMap;
import java.util.List;

@RestController
public class UserController {
    @Autowired
    UserService userService;

    @RequestMapping("/allUser")
    public String getUserList(QueryInfo queryInfo) {
        // 获取最大列表数和当前编号
        int number = userService.getUserCounts("%" + queryInfo.getQuery() + "%");
        int pageState = (queryInfo.getPageNum() - 1) * queryInfo.getPageSize();

        List<User> users = userService.getAllUser("%" + queryInfo.getQuery() + "%", pageState, queryInfo.getPageSize());
        HashMap<String, Object> res = new HashMap<>();
        res.put("number", number);
        res.put("data", users);
        String res_string = JSON.toJSONString(res);
        return res_string;
    }

    @RequestMapping("/userState")
    public String updateUserState(@RequestParam("user_id") Integer user_id,
                                  @RequestParam("user_state") Boolean user_state) {
        int i = userService.updateState(user_id, user_state);
        return i > 0 ? "success" : "error";
    }

    @RequestMapping("/addUser")
    public String addUser(@RequestBody User user) {
        int i = userService.addUser(user);
        return i > 0 ? "success" : "error";
    }

    @RequestMapping("/deleteUser")
    public String deleteUser(int user_id) {
        int i = userService.deleteUser(user_id);
        return i > 0 ? "success" : "error";
    }

    @RequestMapping("/getUpdate")
    public String getUpdateUser(int user_id) {
        User user = userService.getUpdateUser(user_id);
        String string = JSON.toJSONString(user);//注意这里也可以直接返回对象,springboot会把对象直接转换成字符串
        return string;
    }

    @RequestMapping("/editUser")
    public String editUser(@RequestBody User user) {
        int i = userService.editUser(user);
        return i > 0 ? "success" : "error";
    }

    //检查是否已经注册该用户
    @RequestMapping("/checkUser")
    public String checkUser(@RequestBody User user0){
        User user=userService.checkUser(user0.getUser_name());
        if(user!=null){
            return "error";
        }
        return "success";
    }

    //检查用户手机号是否已注册
    @RequestMapping("/checkPhone")
    public String checkPhone(@RequestBody User user0){
        User user=userService.checkPhone(user0.getUser_phone());
        if(user!=null){
            return "error";
        }
        return "success";
    }





    //小程序端
    @RequestMapping("/wxRegister")
    public String wxRegister(@Param("user_name") String user_name,@Param("user_password") String user_password,@Param("user_phone") String user_phone){
        int i = userService.wxRegister(user_name, user_password, user_phone);
        return i > 0 ? "success" : "error";
    }

    //小程序验证用户名、手机号是否被注册
    @RequestMapping("/wxCheckUser")
    public String wxCheckUser(@Param("user_name") String user_name){
        User user=userService.checkUser(user_name);
        if(user!=null){
            return "error";
        }
        return "success";
    }

    @RequestMapping("/wxCheckPhone")
    public String wxCheckPhone(@Param("user_phone") String user_phone){
        User user=userService.checkPhone(user_phone);
        if(user!=null){
            return "error";
        }
        return "success";
    }


    //充值或者消费 更新用户余额
    @RequestMapping("/wxAddMoney")
    public String wxAddMoney(@Param("user_name")String user_name,@Param("user_phone")String user_phone,@Param("user_money")String user_money){
        int i=userService.wxAddMoney(user_name, user_phone, user_money);
        return i>0? "success":"error";
    }


    @RequestMapping("/rePassword")
    public String rePassword(@Param("user_id")Integer user_id,@Param("new_password")String new_password){
        int i=userService.rePassword(user_id, new_password);
        return i>0? "success":"error";
    }

}

  • 22
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
目前,PetShop已经从最初的2.0、3.0等版本,发展到了最新的4.0版本。PetShop 4.0使用ASP.NET 2.0技术开发,其中加入了众多新增特性,因此,在性能、代码数量、可扩展性等方面有了重大改善。可以说,学习PetShop 4.0是深入掌握ASP.NET 2.0技术的捷径。本节将引领读者逐步了解PetShop 4.0的方方面面,包括应用程序安装、功能和用户界面简介、解决方案和体系架构概述等。 由于采用了Master Pages,Membership,以及Profile,表现层的编码量减少了25%,数据层的编码量减少了36%。 他们利用了Project Conversion Wizard把项目从ASP.NET 1.1移植到了ASP.NET 2.0,然后做了以下改动: 1。用System.Transactions代替了原来的Serviced Components提供的事务功能 2。用强类型的范型集合代替了原来的弱类型集合 3。采用ASP.NET 2.0 Membership来做认证和授权 4。创建了针对Oracle 10g的Custom ASP.NET 2.0 Membership Provider 5。利用ASP.NET 2.0的Custom Oracle 和SQL Server Profile Providers 做用户状态管理,包括购物车等 6。采用了Master Pages,取代了原来的用户控件,来实现统一的界面效果 7。使用了ASP.NET 2.0 Wizard控件实现check-out 8。使用了SqlCacheDependency来实现数据库层次的缓存更新(cache invalidation)功能 9。使用了消息队列来实现异时订单处理 使用说明: 数据库在App_data文件中,四个数据库附加就可以,然后相应的去改改Web.config。 登陆用户名和密码份分别是:51aspx/51aspx.com 此项目没有后台管理,可供学习使用 如果项目中出现 MSDTC 不可用 解决:在windows控制面版-->管理工具-->服务-->Distributed Transaction Coordinator-->属性-->启动
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序猿毕业分享网

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值