基于javaweb+mysql的springboot前后端分离网上商城项目设计和实现(java+ssm+springboot+vue+redis)

基于javaweb+mysql的springboot前后端分离网上商城项目设计和实现(java+ssm+springboot+vue+redis)

运行环境

Java≥8、MySQL≥5.7、Node.js≥10

开发工具

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

前端:WebStorm/VSCode/HBuilderX等均可

适用

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

功能说明

基于javaweb+mysql的SpringBoot前后端分离网上商城项目设计和实现(java+ssm+springboot+vue+redis)

主要实现技术:Java、springmvc、springboot、mybatis、mysql、tomcat、shiro权限框架、vue、jquery、node.js 、redis数据库、邮箱相关等技术。

主要功能实现:

用户登录、注册、商城浏览、购买、订单、购物车、退货、用户、个人中心、修改密码、角色等管理

前端主页面:商品关键字搜索和分类搜索功能以及首页轮播图配置展示

首页个人中心主要功能:密码修改、订单、购物车、商品详情模块、可以购买、加入购物车

购买时需要填写用户手机号和收获地址等信息、注册时默认生成支付宝模拟账号密码:

后台管理员主要对商品数据进行管理、分类管理、订单管理以及用户管理扥。

商品列表数据管理、后台添加商品信息、商品基础数据的维护管理、商品订单详情管理:根据关键字查询以及查看每一个订单的详情信息

首页轮播图配置展示、用户角色和权限管理控制:

前后端源码结构:

数据库图:

            for (Integer specsId : specsIds) {
                productSpecs = new ProductSpecs();
                productSpecs.setProductId(productId);
                productSpecs.setSpecsId(specsId);
                productSpecsList.add(productSpecs);
            }
            for (ProductSpecs specs : productSpecsList) {
                System.out.println(specs);
            }
            if(productSpecsService.insertBatch(productSpecsList)){
                return CommonResult.success("添加成功",productSpecsList);
            }else{
                return CommonResult.error("添加失败");
            }
        }
        return CommonResult.error("数据不存在");
    }

    @RequestMapping(value = "/productSpecs/update")
    private CommonResult update(ProductSpecs productSpecs) {
        if(productSpecsService.updateById(productSpecs)){
            return CommonResult.success("更新成功",productSpecs);
        }else{
            return CommonResult.error("更新失败");
        }
    }

    @RequestMapping(value = "/productSpecs/delete")
    private CommonResult delete(ProductSpecs productSpecs) {
        if(productSpecsService.deleteById(productSpecs)){
            return CommonResult.success("删除成功",productSpecs);
        }else{
            return CommonResult.error("删除失败");
        }
    }
}
package com.qiu.controller;

/**
 * @email qiudb.top@aliyun.com
 * @description 用户授权等相关业务
        }else{
            return CommonResult.error("查询失败");
        }
    }
    
    @RequestMapping(value = "/specs/existsSpecsName")
    private CommonResult existsSpecsName(Integer specsId, String specsName, String productType) {
        Boolean isExist = specsService.existsWithSpecsName(specsId,specsName,productType);
        if(isExist!=null){
            return CommonResult.success("查询成功",isExist);
        }else{
            return CommonResult.error("查询失败");
        }
    }

    @RequestMapping(value = "/specs/findAllByType")
    private CommonResult findAllSpecsByType(String productType) {
        List<Specs> specs = specsService.selectAllByType(productType);
        if(specs!=null){
            return CommonResult.success("查询成功",specs);
        }else{
            return CommonResult.error("查询失败");
        }
    }

    @RequestMapping(value = "/specs/add")
    private CommonResult addSpecs(Specs specs) {
        if(specs!=null){
            if(specsService.insertData(specs)){
                return CommonResult.success("添加成功",specs);
            }else{
                return CommonResult.error("添加失败");
            }
        }
        return CommonResult.error("数据不存在");
    }

    @RequestMapping(value = "/specs/update")
    private CommonResult updateSpecs(Specs specs) {
        if(specsService.updateById(specs)){
            return CommonResult.success("更新成功",specs);
        }else{
            return CommonResult.error("更新失败");
        }
    }

        }
        if(data.size()!=0){
            return CommonResult.success("查询成功",data);
        }else{
            return CommonResult.error("查询失败");
        }
    }

}
package com.qiu.controller;

/**
 * @email qiudb.top@aliyun.com
 * @description 描述
 */
@RestController
@CrossOrigin
public class BannerController {
    final BannerService bannerService;
    public BannerController(BannerService bannerService){
        this.bannerService = bannerService;
    }

    /*商品类别*/
    @RequestMapping(value = "/banner/add")
    private CommonResult addBanner(Banner banner) {
        if(bannerService.insertData(banner)){
            return CommonResult.success("商品轮播图添加成功",banner);
        }else{
            return CommonResult.error("商品轮播图添加失败");
        }
    }

    @RequestMapping(value = "/banner/update")
    private CommonResult updateType(Banner banner) {
        if(bannerService.updateById(banner)){
            return CommonResult.success("商品轮播图修改成功",banner);
        }else{

    @RequestMapping(value = "/productBrand/deleteByName")
    private CommonResult deleteBrandByName(String brandName) {
        if(productBrandService.deleteByName(brandName)){
            return CommonResult.success("商品品牌删除成功","brandName: "+brandName);
        }else{
            return CommonResult.error("商品品牌删除失败");
        }
    }

    @RequestMapping(value = "/productBrand/findAll")
    private CommonResult findAllBrand() {
        List<ProductBrand> productBrands = productBrandService.selectAll();
        if(productBrands!=null){
            return CommonResult.success("商品品牌查询成功",productBrands);
        }else{
            return CommonResult.error("商品品牌查询失败");
        }
    }

    @RequestMapping(value = "/productBrand/existsBrandName")
    private CommonResult existsBrandName(Integer brandId,String brandName) {
        Boolean isExist = productBrandService.existsWithBrandName(brandId,brandName);
        if(isExist!=null){
            return CommonResult.success("查询成功",isExist);
        }else{
            return CommonResult.error("查询失败");
        }
    }

    @RequestMapping(value = "/productBrand/findAllName")
    private CommonResult findAllBrandName() {
        List<String> names = productBrandService.selectAllName();
        if(names!=null){
            return CommonResult.success("商品品牌名称查询成功",names);
        }else{
            return CommonResult.error("商品品牌名称查询失败");
        }
    }
}
package com.qiu.controller;
                        }else{
                            return CommonResult.error("创建订单失败");
                        }
                    }else{
                        return CommonResult.error("创建订单失败");
                    }
                }else{
                    return CommonResult.error("商品库存不足");
                }
            }
        }else{
            return CommonResult.error("订单数据不完整");
        }
    }

    @RequestMapping(value = "/order/cartOrder")
    private CommonResult cartOrder(String orderNo,String ordersInfo) {
        JSONArray jsonArray = JSON.parseArray(ordersInfo);
        List<Order> orders = JSONObject.parseArray(jsonArray.toJSONString(), Order.class);
        if(orders!=null){
            ArrayList<String> orderInfo = new ArrayList<>();
            ArrayList<String> productInfo = new ArrayList<>();
            for (Order order : orders) {
                Product product = productService.selectByKey(order.getProductNo());
                Integer productStock = product.getProductStock();
                Integer payAmount = order.getPayAmount();
                boolean isOk =productStock >= payAmount;
                if(isOk){
                    Product newProduct = new Product();
                    newProduct.setProductId(product.getProductId());
                    int newStock = productStock - payAmount;
                    newProduct.setProductStock(newStock);
                    newProduct.setIsStockOut(newStock<product.getLowestStock());
                    // 如果库存小于等于0,自动下架
                    newProduct.setIsSale(newStock>0);
                    if(productService.updateById(newProduct)){
                        if(orderService.insertData(order)){
                            orderInfo.add(order.getOrderNo());
                            productInfo.add(order.getProductNo());
                        }
                    }
                }
            }
            if(orderInfo.size()!=0){
                String orderNoInfo = StringUtils.join(orderInfo, ",");
                String productNoInfo = StringUtils.join(productInfo, ",");
        }
    }

    @RequestMapping(value = "/productBrand/deleteById")
    private CommonResult deleteBrandById(Integer brandId) {
        if(productBrandService.deleteById(brandId)){
            return CommonResult.success("商品品牌删除成功","brandId: "+brandId);
        }else{
            return CommonResult.error("商品品牌删除失败");
        }
    }

    @RequestMapping(value = "/productBrand/deleteByName")
    private CommonResult deleteBrandByName(String brandName) {
        if(productBrandService.deleteByName(brandName)){
            return CommonResult.success("商品品牌删除成功","brandName: "+brandName);
        }else{
            return CommonResult.error("商品品牌删除失败");
        }
    }

    @RequestMapping(value = "/productBrand/findAll")
    private CommonResult findAllBrand() {
        List<ProductBrand> productBrands = productBrandService.selectAll();
        if(productBrands!=null){
            return CommonResult.success("商品品牌查询成功",productBrands);
        }else{
            return CommonResult.error("商品品牌查询失败");
        }
    }

    @RequestMapping(value = "/productBrand/existsBrandName")
    private CommonResult existsBrandName(Integer brandId,String brandName) {
        Boolean isExist = productBrandService.existsWithBrandName(brandId,brandName);
        if(isExist!=null){
            return CommonResult.success("查询成功",isExist);
        }else{
            return CommonResult.error("查询失败");
        }
    }

    @RequestMapping(value = "/productBrand/findAllName")
    private CommonResult findAllBrandName() {
        List<String> names = productBrandService.selectAllName();
        if(names!=null){
            return CommonResult.success("商品品牌名称查询成功",names);
        }else{
            return CommonResult.error("商品品牌名称查询失败");
        }
    }
}
package com.qiu.controller;
        vip.setOverdueTime(cal.getTime());
        if(vipService.insertData(vip)){
            return CommonResult.success("vip信息插入成功",vip);
        }else{
            return CommonResult.error("vip信息插入失败");
        }
    }

    //更新vip信息
    @RequestMapping(value = "/vip/updateVip")
    private CommonResult updateVip(Vip vip) {
        if(vipService.updateById(vip)){
            return CommonResult.success("vip信息更新成功",vip);
        }else{
            return CommonResult.error("vip信息更新失败");
        }
    }

    //删除vip信息
    @RequestMapping(value = "/vip/deleteVip")
    private CommonResult deleteVip(Integer vipId) {
        if(vipService.deleteById(vipId)){
            return CommonResult.success("删除成功",vipId);
        }else{
            return CommonResult.error("删除失败");
        }
    }
}
package com.qiu.controller;
    /*查询所有用户*/
    @RequestMapping(value = "/userRole/existsRole")
    private CommonResult existsRole(Integer roleId) {
        Boolean isExist = userRoleService.existsRole(roleId);
        if(isExist!=null){
            return CommonResult.success("查询成功",isExist);
        }else{
            return CommonResult.error("查询失败");
        }
    }

    @RequestMapping(value = "/userRole/add")
    private CommonResult add(UserRole userRole) {
        if(userRole!=null){
            if(userRoleService.insertData(userRole)){
                return CommonResult.success("添加成功",userRole);
            }else{
                return CommonResult.error("添加失败");
            }
        }
        return CommonResult.error("用户数据不存在");
    }

    @RequestMapping(value = "/userRole/delete")
    private CommonResult delete(Integer userId) {
        Boolean bool = userRoleService.deleteById(userId);
        System.out.println(bool);
        if(bool){
            return CommonResult.success("删除成功",userId);
        }else{
            return CommonResult.error("删除失败");
        }
    }

}
package com.qiu.controller;

            log.info("【支付宝支付】退款失败 error={}", e.toString());
        }
        return CommonResult.success("退款成功");
    }

    @GetMapping(value = "/paySuccess")
    @ResponseBody
    public void success(@RequestParam Map<String, String> map,HttpServletResponse response) {
        try{
            String tradeNo =map.get("out_trade_no");
            if(tradeNo.contains("Vip")){
                Integer orderId = orderService.selectIdByKey(tradeNo);
                Order order = new Order();
                order.setOrderId(orderId);
                order.setOrderState("开通成功");
                String serialNumber =  redisTemplate.opsForValue().get(tradeNo);
                if(serialNumber !=null){
                    response.sendRedirect("http://"+hostAddress+"/?#/personalCenter?serialNumber="+serialNumber);
                    redisTemplate.delete(tradeNo);
                }else{
                    response.sendRedirect("http://"+hostAddress+"/?#/personalCenter?serialNumber="+"ERROR");
                }
                orderService.updateById(order);
            }else{
                String Str =  redisTemplate.opsForValue().get(tradeNo);
                redisTemplate.delete(tradeNo);
                assert Str != null;
                String[] ordersNo = Str.split(",");
                System.out.println(Arrays.toString(ordersNo));
                for (String orderNo : ordersNo) {
                    Integer orderId = orderService.selectIdByKey(orderNo);
                    Order order = new Order();
                    order.setOrderId(orderId);
                    order.setOrderState("待发货");
                    orderService.updateById(order);
                }
                response.sendRedirect("http://"+hostAddress+"/?#/myOrder");
            }
        }catch (IOException e) {
            e.printStackTrace();
        }
    }

    @ResponseBody
    @PostMapping(value = "/payNotify")
    public void payNotify(@RequestParam Map<String, String> map) {
        String tradeStatus = map.get("trade_status");
        if(tradeStatus.equals("TRADE_SUCCESS")){
            String payTime = map.get("gmt_payment");
            String tradeNo =map.get("out_trade_no");
            String tradeName = map.get("subject");
            String payAmount = map.get("buyer_pay_amount");
            log.info("[支付成功] {交易时间:{},订单号:{},订单名称:{},交易金额:{}}",payTime,tradeNo,tradeName,payAmount);
                            orderInfo.add(order.getOrderNo());
                            productInfo.add(order.getProductNo());
                        }
                    }
                }
            }
            if(orderInfo.size()!=0){
                String orderNoInfo = StringUtils.join(orderInfo, ",");
                String productNoInfo = StringUtils.join(productInfo, ",");
                redisTemplate.opsForValue().set(orderNo,orderNoInfo,24, TimeUnit.HOURS);
                return CommonResult.success("创建订单成功",productNoInfo);
            }else{
                return CommonResult.success("创建订单失败");
            }
        }else{
            return CommonResult.error("订单数据不完整");
        }
    }

    @RequestMapping(value = "/order/update")
    private CommonResult updateOrder(Order order) {
        if(orderService.updateById(order)){
            return CommonResult.success("修改订单成功",order);
        }else{
            return CommonResult.error("修改订单失败");
        }
    }

    @RequestMapping(value = "/order/delete")
    private CommonResult deleteOrder(Integer orderId) {
        if(orderService.deleteById(orderId)){
            return CommonResult.success("删除订单成功","订单id:"+orderId);
        }else{
            return CommonResult.error("删除订单失败");
        }
    }

    @RequestMapping(value = "/order/receipt")
    private CommonResult updateOrder(Integer orderId) {
        Order order = new Order();
        order.setOrderId(orderId);
        order.setOrderState("已收货");
        if(orderService.updateById(order)){
            return CommonResult.success("商品收货成功",order);
        }else{
            return CommonResult.error("商品收货失败");
        }
    }

    @RequestMapping(value = "/orderDetail/orderInfo")
    private CommonResult orderInfo(String orderNo) {
        ArrayList<Object> resultList = new ArrayList<>();
        Order order = orderService.selectByKey(orderNo);

@CrossOrigin
@RequestMapping("/alipay")
@Slf4j
@Controller
public class AlipayController {
    private final AlipayService alipayService;
    private final OrderService orderService;
    private final RedisTemplate<String,String> redisTemplate;
    private final String hostAddress;
    public AlipayController(AlipayService alipayService,OrderService orderService,RedisTemplate<String,String> redisTemplate) {
        this.alipayService = alipayService;
        this.orderService = orderService;
        this.redisTemplate = redisTemplate;
        this.hostAddress= PropertiesUtil.getServerHost() +":"+PropertiesUtil.getPort();
    }

    @RequestMapping("/")
    private String index(){
        return "index.html";
    }

    /*
    https://qiustudy.utools.club/alipay/create?orderNo=10060&orderName=花卷商城-华为手机支付订单&payPrice=4000
    */
    @ResponseBody
    @PostMapping(value = "/create", produces = "text/html;charset=utf-8")
    public void create(@RequestParam("orderNo") String orderNo,
                         @RequestParam("orderName") String orderName,
                         @RequestParam("payPrice") String payPrice
            ,HttpServletResponse response) {
        //发起支付
       // return alipayService.create(orderNo, orderName, payPrice);

        }else{
            return CommonResult.error("商品是否存在查询失败");
        }
    }
    @RequestMapping(value = "/product/existsType")
    private CommonResult existsType(String productType) {
        Boolean isExist = productService.existsProductType(productType);
        if(isExist!=null){
            return CommonResult.success("查询成功",isExist);
        }else{
            return CommonResult.error("查询失败");
        }
    }
    @RequestMapping(value = "/product/existsBrand")
    private CommonResult existsBrand(String productBrand) {
        Boolean isExist = productService.existsProductBrand(productBrand);
        if(isExist!=null){
            return CommonResult.success("查询成功",isExist);
        }else{
            return CommonResult.error("查询失败");
        }
    }
    @RequestMapping(value = "/product/findAll")
    private CommonResult findAll() {
        List<Product> products = productService.selectAll();
        if(products!=null){
            return CommonResult.success("全部商品信息查询成功",products);
        }else{
            return CommonResult.error("全部商品信息查询失败");
        }
    }
    @RequestMapping(value = "/product/findAllSale")
    private CommonResult findAllSale() {
        List<Product> products = productService.selectAllSale();
        if(products!=null){
            return CommonResult.success("全部商品信息查询成功",products);
        }else{
            return CommonResult.error("全部商品信息查询失败");
        }
    }
    @RequestMapping(value = "/product/findAllLikeName")
    private CommonResult findAllLikeName(String keyWord) {
        List<Product> products = productService.selectAllLikeName(keyWord);
        if(products!=null){
            return CommonResult.success("全部商品信息查询成功",products);
        }else{
            return CommonResult.error("全部商品信息查询失败");
        }
    }
    @RequestMapping(value = "/product/findAllLikeType")
    private CommonResult findAllLikeType(String keyWord) {
        List<Product> products = productService.selectAllLikeType(keyWord);
     * @param sendTo 收件人
     */
    @RequestMapping(value = "/util/sendFile")
    public String sendmailFile(String sendTo, String content) {
        try {
            String filePath = "F:\\IDEA\\JAVA_Program\\Springboot-Mall\\src\\main\\resources\\static\\1.zip";
            mailService.sendAttachmentsMail(sendTo, "文件操作", content, filePath);
            return "发送成功!";
        } catch (Exception e) {
            e.printStackTrace();
            return "发送邮件时发生异常,稍后请重新发送!";
        }
    }

    /**
     * 验证输入的验证码是否正确
     *
     * @param key  验证的依据
     * @param code 验证码
     */
    @RequestMapping(value = "/allow/checkCode")
    public CommonResult checkCode(String key, String code) {
        String codeK = redisTemplate.opsForValue().get(key);
        if (codeK == null) {
            return CommonResult.error("验证码不存在或已过期,请重新发送!");
        }
        if (codeK.equals(code)) {
            redisTemplate.delete(key);
            return CommonResult.success("验证码成功!", true);
        } else {
            return CommonResult.success("验证码错误!", false);
        }
    }

    /**
     * 用于绑定手机号操作,发送验证码
     *
     * @param phone 发送的手机号
     */
    @RequestMapping(value = "/util/smsCode")
    public CommonResult aliYunSmsCode(String phone) {
        String code = redisTemplate.opsForValue().get(phone);
        if (!StringUtils.isEmpty(code)) {
            return CommonResult.error(phone + "的验证码还未过期!");
        }
        //生成验证码并存储到redis中
        code = MyUtils.getCode(6);
        boolean isSend = aliYunSmsService.sendSms(phone, code);
        if (isSend) {
            redisTemplate.opsForValue().set(phone, code, 10, TimeUnit.MINUTES);
            return CommonResult.success("验证码已发送,网络有延迟请稍等~");
        } else {
            return CommonResult.error("验证码发送失败,请稍后重试~");
    }

    /*查询所有用户*/
    @RequestMapping(value = "/userRole/findAll")
    private CommonResult findAll() {
        List<UserRole> userRoles = userRoleService.selectAll();
        if(userRoles!=null){
            return CommonResult.success("查询成功",userRoles);
        }else{
            return CommonResult.error("查询失败");
        }
    }

    /*查询所有用户*/
    @RequestMapping(value = "/userRole/existsRole")
    private CommonResult existsRole(Integer roleId) {
        Boolean isExist = userRoleService.existsRole(roleId);
        if(isExist!=null){
            return CommonResult.success("查询成功",isExist);
        }else{
            return CommonResult.error("查询失败");
        }
    }

    @RequestMapping(value = "/userRole/add")
    private CommonResult add(UserRole userRole) {
        if(userRole!=null){
            if(userRoleService.insertData(userRole)){
                return CommonResult.success("添加成功",userRole);
            }else{
                return CommonResult.error("添加失败");
            }
        }
        return CommonResult.error("用户数据不存在");
    }

    @RequestMapping(value = "/userRole/delete")
    private CommonResult delete(Integer userId) {
        Boolean bool = userRoleService.deleteById(userId);
        System.out.println(bool);
        if(bool){
            return CommonResult.success("删除成功",userId);
        }else{
            return CommonResult.error("删除失败");
        }
    }

    }

    @RequestMapping(value = "/productType/deleteByName")
    private CommonResult deleteTypeByName(String typeName) {
        if(productTypeService.deleteByName(typeName)){
            return CommonResult.success("商品分类删除成功","typeName: "+typeName);
        }else{
            return CommonResult.error("商品分类删除失败");
        }
    }

    @RequestMapping(value = "/productType/existsTypeName")
    private CommonResult existsTypeName(Integer typeId,String typeName) {
        Boolean isExist = productTypeService.existsWithTypeName(typeId,typeName);
        if(isExist!=null){
            return CommonResult.success("查询成功",isExist);
        }else{
            return CommonResult.error("查询失败");
        }
    }

    @RequestMapping(value = "/productType/findAll")
    private CommonResult findAllType() {
        List<ProductType> productTypes = productTypeService.selectAll();
        if(productTypes!=null){
            return CommonResult.success("商品分类查询成功",productTypes);
        }else{
            return CommonResult.error("商品分类查询失败");
        }
    }

    @RequestMapping(value = "/productType/findAllName")
    private CommonResult findAllTypeName() {
        List<String> names = productTypeService.selectAllName();
        if(names!=null){
            return CommonResult.success("商品分类名称查询成功",names);
        }else{
            return CommonResult.error("商品分类名称查询失败");
        }
    }

    /*商品品牌*/
    @RequestMapping(value = "/productBrand/add")
    private CommonResult addBrand(ProductBrand productBrand) {
        if(productBrandService.insertData(productBrand)){
            return CommonResult.success("商品品牌添加成功",productBrand);
        }else{
            return CommonResult.error("商品品牌添加失败");
    private final AliYunSmsService aliYunSmsService;
    private final IMailService mailService;
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    public UtilController(RedisTemplate<String, String> redisTemplate, IMailService mailService, AliYunSmsService aliYunSmsService) {
        this.mailService = mailService;
        this.aliYunSmsService = aliYunSmsService;
        this.redisTemplate = redisTemplate;
    }

    /**
     * 发送一个简单的文本邮件
     *
     * @param sendTo 收件人
     */
    @RequestMapping(value = "/util/send")
    public String sendmail(String sendTo) {
        mailService.sendSimpleMail(sendTo, "主题:你好普通邮件", "内容:第一封邮件");
        return "发送成功!";
    }

    /**
     * 发送一个邮箱随机验证码
     *
     * @param sendTo 收件人
     */
    @RequestMapping(value = "/allow/sendHtmlCode")
    public CommonResult sendHtmlCode(String sendTo) {
//        long startTime = System.currentTimeMillis(); //获取开始时间
        try {
            String code = MyUtils.getCode(6);
//            long oneTime = System.currentTimeMillis(); //获取第一阶段时间
            Map<String, Object> data = new HashMap<>();
            data.put("code", code);
            data.put("year", Calendar.getInstance().get(Calendar.YEAR));
            redisTemplate.opsForValue().set(sendTo, code, 10, TimeUnit.MINUTES);
            System.out.println("验证码是:" + code);
//          long twoTime = System.currentTimeMillis(); //获取第二阶段时间
            mailService.sendTemplateMail(sendTo, "操作验证码", "mail", data);
//          long threeTime = System.currentTimeMillis(); //获取第三阶段时间
//          MyUtils.speedTest(startTime,oneTime,twoTime,threeTime);
            return CommonResult.success("验证码已发送,网络有延迟请稍等~");
        } catch (Exception e) {
            return CommonResult.error("发送验证码时发生异常,请稍后重试!");
    private CommonResult dealWithReturn(Integer returnId,String operatorNumber,String operatorName) {
        if(returnId!=null){
            ReturnGoods returnGoods = returnGoodsService.selectById(returnId);
            returnGoods.setReturnState("允许退货");
            returnGoods.setDealTime(new Date());
            returnGoods.setOperatorNumber(operatorNumber);
            returnGoods.setOperatorName(operatorName);
            String orderNo = returnGoods.getOrderNo();
            Integer orderId = orderService.selectIdByKey(orderNo);
            Order order = new Order();
            order.setOrderId(orderId);
            order.setReturnState(true);
            order.setOrderState("已退货");
            Logistics logistics = logisticsService.selectOrderNo(orderNo);
            if(logistics!=null){
                logisticsService.deleteById(logistics.getLogisticId());
            }
            if(orderService.updateById(order)){
                if(returnGoodsService.updateById(returnGoods)){
                    return CommonResult.success("更新成功",returnGoods);
                }else{
                    return CommonResult.error("更新失败");
                }
            }else{
                return CommonResult.error("更新失败");
            }
        }
        return CommonResult.error("商品退货数据不存在");
    }

    /*买家快递寄回*/
    @RequestMapping(value = "/returnGoods/sendBack")
    private CommonResult sendBack(Integer returnId) {
        if(returnId!=null){
            ReturnGoods returnGoods = new ReturnGoods();
            returnGoods.setReturnId(returnId);
            returnGoods.setReturnState("待收货");
            returnGoods.setDealTime(new Date());
            if(returnGoodsService.updateById(returnGoods)){
                return CommonResult.success("更新成功",returnGoods);
            }else{
                return CommonResult.error("更新失败");
            }
        }
        return CommonResult.error("商品退货数据不完整");
    }

    /*商家收到寄回的商品*/
    @RequestMapping(value = "/returnGoods/receipt")
    private CommonResult receipt(Integer returnId) {
        if(returnId!=null){
            ReturnGoods returnGoods = new ReturnGoods();

请添加图片描述

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值