0
点赞
收藏
分享

微信扫一扫

基于SpringCloud+redis+Springsecurity实现的微信小程序外卖系统

文章目录



一、项目介绍


二、技术栈以及项目特点



三、数据库表设计


四、系统设计



          (1)首页模块: 会展现社群福利会员福利领券中心邀请有利自取以及外卖功能


          (2)点单模块: 该模块包含各个周数展现的特价功能会员特惠餐桌啃卤下饭素菜串串米饭


          (3)订单模块: 该模块包含点击添加商品后加入购物车的商品信息最新订单历史订单


          (4)我的管理模块: 该模块包含卡券、积分、余额、我的订单、卡券激活、礼品卡、积分签到、卡券中心、客服、收货地址、退出、退款、收货功能


五、系统功能演示


🚩首页功能演示图


请添加图片描述


请添加图片描述


🚩点单功能演示图


请添加图片描述


请添加图片描述


请添加图片描述


请添加图片描述


请添加图片描述


🚩订单模块演示图


请添加图片描述


请添加图片描述


请添加图片描述


🚩我的管理模块演示图


请添加图片描述


六、系统源代码


public enum ApiResponseCode {
    SUCCESS("0","SUCCESS"),
    PARAM_ERROR("1001001","参数异常"),
    TOKEN_INVALID("1001002","请重新登录"),
    VALICODE_ERROR("1001003","验证码过期"),
    BALANCE_NOT_ENOUGH("1001004","余额不足"),
    GROUPON_PEOPLE_ENOUGH("1001005","拼团人数已满"),
    GROUPON_ING("1001005","该拼团进行中"),
    BARGAIN_NO_FINISH("1001006","当前有未完成的团"),
    GROUPON_PEOPLE_NOTEXIST("1001007","拼团异常"),
    BARGAIN_NO_HASBARGAIN("1001008","已帮好友砍价"),
    BARGAIN_HASDEAD("1001009","已完成或已过期的砍价"),
    ERROR_SIGN("1001010","错误签名"),
    BARGAIN_NO_ORDER("1001011","查无订单"),
    ORDER_STATE_ERROR("1001012","订单已完成"),
    WX_CODE_EMPTY("1001013","code 为空"),
    MOBILE_PHONE_NULL("1001014","手机号不能为空"),
    MERCH_HAS_EXIST("1001015","手机账户已注册"),
    VALIDATE_CODE_ERROR("1001016","验证码错误"),
    VALIDATE_CODE_MAX_ERROR("1001017","验证码次数上限"),
    FLOWPATH_ERROR("1001018","请按流程操作"),
    INTEGRAL_PAST("1001019","积分商品过期"),
    INTEGRAL_NOT_ENOUGH("1001020","亲,您的积分不足"),
    INTEGRAL_MAX_LIMIT("1001021","亲,已超兑换数量"),
    INTEGRAL_STATE_ERROR("1001022","稍后再试"),
    SHOP_NOTEL("1001023","店主未设置客服电话"),
    GROUPIDS_EMPTY("1001000","参数异常");


    private String code;
    private String message;





    ApiResponseCode(String code, String message) {
        this.code = code;
        this.message = message;
    }


    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }


}


@Controller
@RequestMapping(value = "/ump/bargain")
public class BargainController extends AdminController {

    public static Logger logger = Logger.getLogger(BargainController.class);

    @Resource
    private BargainService bargainService;

    @Resource
    ProductService productService;


    /**
     * 砍价活动 列表
     */
    @RequestMapping("/bargainList")
    public UIview bargainList() throws Exception {
        logger.info("进入 bargainController-list,砍价活动列表");
        //获取请求参数
        FormMap formMap = getFormMap();
        //开启分页
        PageHelper.startPage(formMap.getPage(), formMap.getRows());
        //查询展示数量
        List<E> list = bargainService.selectList(formMap);

        //返回到list页面
        UIview result = UIView("/center/ump/bargain/bargainList", false);
        //绑定分页返回
        result.addObject("pageInfo", new PageInfo<E>(list));
        //绑定上一次参数
        result.addObject("queryParam", formMap);
        return result;
    }

    /**
     * 砍价活动 新增
     */
    @RequestMapping("/add")
    public UIview add() throws Exception {

        UIview result = UIView("/center/ump/bargain/bargainCreate", false);

        this.getRequest().setAttribute("title", "砍价活动新增");

        return result;
    }



    /**
     * 砍价活动 编辑
     */
    @RequestMapping("/edit")
    public UIview edit() throws Exception {

        FormMap formMap = getFormMap();

        E infoMap = bargainService.selectOne(formMap);
        formMap.put("item_id",infoMap.get("item_id"));
        E itemInfo = productService.getItemById(formMap);


        String specString ="";
        if (itemInfo!=null && itemInfo.get("spec_custom")!=null){
            formMap.put("specIds", itemInfo.getStr("spec_custom").split(";"));
            List<E> specList = productService.getSpecCustomByIds(formMap);

            for(E spec :specList){
                specString+=spec.getStr("key_name")+";";
            }
        }
        specString=specString==""?infoMap.getStr("product_name"):specString;

        infoMap.put("skuName",specString);
        UIview result = UIView("/center/ump/bargain/bargainCreate", false);

        this.getRequest().setAttribute("infoMap", infoMap);

        this.getRequest().setAttribute("title", "砍价活动编辑");

        return result;
    }

    /**
     * 砍价活动 保存
     */
    @RequestMapping("/save")
    public UIview save() throws Exception {

        FormMap param = getFormMap();
        if (param.get("validate_id") == null || param.get("validate_id").equals("")) {

            //根据生效时间判断是否现在生效
            if (System.currentTimeMillis()> DateUtil.getTimeByString(param.getStr("start_time"),"yyyy/MM/dd HH:mm:ss")){
                param.put("state", 0);
            }else {
                //未开始状态
                param.put("state", -2);
            }

            bargainService.insert(param);
        } else {
            param.set("eivt", null);
            //失效后再编辑
            if (System.currentTimeMillis()> DateUtil.getTimeByString(param.getStr("start_time"),"yyyy/MM/dd HH:mm:ss") && System.currentTimeMillis()<DateUtil.getTimeByString(param.getStr("end_time"),"yyyy/MM/dd HH:mm:ss")){
                param.put("state", 0);
            }else if (System.currentTimeMillis()<DateUtil.getTimeByString(param.getStr("start_time"),"yyyy/MM/dd HH:mm:ss")){
                param.put("state", -2);
            }

            bargainService.edit(param);
        }
        UIview result = UIView("redirect:bargainList", false);

        return result;
    }

    /**
     * 砍价活动 状态修改
     */
    @RequestMapping("/status")
    public UIview status() throws Exception {

        FormMap formMap = getFormMap();

        formMap.set("eivt", "state");

        bargainService.edit(formMap);

        UIview result = UIView("redirect:bargainList", false);

        return result;
    }

    /**
     * 秒杀活动 删除
     */
    @RequestMapping("/remove")
    public UIview remove() throws Exception {

        FormMap map = getFormMap();

        bargainService.remove(map);

        UIview result = UIView("redirect:bargainList", false);

        return result;
    }

    /**
     * 砍价活动记录列表
     */
    @RequestMapping("/bargainDetailList")
    public UIview bargainOrderList() throws Exception {
        logger.info("进入 bargainController-bargainOrderList,满减送活动列表");
        //获取请求参数
        FormMap formMap = getFormMap();
        //开启分页
        PageHelper.startPage(formMap.getPage(), formMap.getRows());
        //查询展示数量
        List<E> list = bargainService.selectBargainDetailList(formMap);
        //返回到list页面
        UIview result = UIView("/center/ump/bargain/bargainDetailList", false);
        //绑定分页返回
        result.addObject("pageInfo", new PageInfo<E>(list));
        //绑定上一次参数
        result.addObject("queryParam", formMap);
        return result;
    }

    /**
     * 砍价活动 列表
     */
    @RequestMapping("/bargainNancyList")
    public UIview bargainNancyList() throws Exception {
        logger.info("进入 bargainController-bargainOrderList,砍价活动列表");
        //获取请求参数
        FormMap formMap = getFormMap();
        //开启分页
        PageHelper.startPage(formMap.getPage(), formMap.getRows());
        //查询展示数量
        List<E> list = bargainService.selectBargainNancyList(formMap);
        //返回到list页面
        UIview result = UIView("/center/ump/bargain/bargainNancyList", false);
        //绑定分页返回
        result.addObject("pageInfo", new PageInfo<E>(list));
        //绑定上一次参数
        result.addObject("queryParam", formMap);
        return result;
    }


    /**
     * 查询商品列表
     */
    @ResponseBody
    @RequestMapping("/productList.json")
    public String productList() throws Exception {
        logger.info("进入seckillController-productList,查询商品");
        try {
            FormMap formMap = getFormMap();
            formMap.set("product_name", new String(formMap.getStr("product_name").getBytes("ISO-8859-1")));
            List<E> productList = bargainService.selectProductList(formMap);
            List<E> productJson = new ArrayList<E>();
            for (E e : productList) {
                E productinfo = new E();
                productinfo.set("product_name", "<img src='" + WeiitUtil.getFileDomain() + e.getStr("product_img") + "' width='60px' height='60px'/>" + e.getStr("product_name"));
                productinfo.set("sale_price", e.getStr("sale_price"));
                productinfo.set("stock", e.getStr("stock"));
                if (StringUtils.isEmpty(e.getStr("state"))) {
                    productinfo.set("option", "<a href='javascript:;'   title='选取' class='btn bg-green m-r-5 m-b-5 able_product_" + e.getStr("product_id") + "' style='height: 22px;padding-top: 0px;' οnclick='selectProduct(" + e.getStr("product_id") + ")' price='" + e.getStr("sale_price") + "'spec_config='" + e.getStr("spec_config") + "'>选取</a>");
                } else {
                    productinfo.set("option", "<a href='javascript:;' class='btn bg-grey m-r-5 m-b-5' style='height: 22px;padding-top: 0px;'>已参加</a>");
                }
                productJson.add(productinfo);
            }
            return toJsonAPI(productJson);
        } catch (Exception e) {
            e.printStackTrace();
            throw new Exception("出错啦...");
        }
    }

    /**
     * 选择多规格商品  规格、价格、库存、操作
     * produce_id
     */
    @ResponseBody
    @RequestMapping("/skuList.json")
    public String skuList() throws Exception {
        logger.info("BargainController-skuList,选择多规格商品");
        FormMap formMap = getFormMap();
        formMap.put("is_deleted", 0);
        formMap.put("is_disabled", 0);
        List<E> list = productService.selectItemList(formMap);

        E productInfo = productService.selectById(formMap);

        List<E> productJson = new ArrayList<E>();
        for (E e : list) {
            E productinfo = new E();
            formMap.put("specIds", e.getStr("spec_custom").split(";"));
            List<E> specList = productService.getSpecCustomByIds(formMap);
            String specString ="";
            for(E spec :specList){
                specString+=spec.getStr("key_name")+";";
            }
            specString=specString==""?productInfo.getStr("product_name"):specString;
            productinfo.set("specDesc",specString);
            productinfo.set("sale_price", e.getStr("sale_price"));
            productinfo.set("stock", e.getStr("stock"));
            productinfo.set("option", "<a href='javascript:;'   title='选取' class='btn bg-green m-r-5 m-b-5 able_item_" + e.getStr("item_id") + "' style='height: 22px;padding-top: 0px;' οnclick='selectItem(" + e.getStr("item_id") + ")' specDesc='" + specString + "'  product_id='" + e.getStr("product_id") + "' product_img='" + WeiitUtil.getFileDomain()+productInfo.getStr("product_img") + "' stock='" + e.getStr("stock") + "' price='" + e.getStr("sale_price") + "'>选取</a>");

            productJson.add(productinfo);

        }
        return toJsonAPI(productJson);
    }


    /**
     * 微页面(活动页) 根据bargain_ids 获取砍价商品活动列表
     */
    @ResponseBody
    @RequestMapping("/getProductByBargainIds")
    public String getProductByBargainIds(@RequestParam String token,String bargain_ids,Integer bargainGetType) throws Exception {
        logger.info("进入 bargainController-getProductByBargainIds,微页面根据bargain_ids 获取砍价商品活动列表");
        FormMap formMap = new FormMap();
        try {
            formMap.put("shop_id", DesUtil.decrypt(token));
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("token 解密失败");
            return "";
        }
        if (!StringUtils.isEmpty(bargain_ids)&& bargainGetType==0) {
            formMap.put("bargain_ids", StringUtils.strip(bargain_ids, "[]").split(","));
        }
		formMap.put("end_time",new Date());
        List<E> BargainList = bargainService.getProductByBargainIds(formMap);
        return toJsonAPI(BargainList);
    }


}

💨实现源码获取👇


作者:KJ.JK

文章对你有所帮助的话,欢迎给个赞或者 star,你的支持是对作者最大的鼓励,不足之处可以在评论区多多指正,交流学习

举报

相关推荐

0 条评论