CeDo
2021-05-01 a7d2d03fe177a58c22e960e9c87b32f7b05be74f
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/ShopApi.java
@@ -1,17 +1,24 @@
package com.panzhihua.applets.api;
import com.panzhihua.applets.config.WxMaProperties;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.shop.*;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.shop.*;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.utlis.PayUtil;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Map;
/**
 * @auther lyq
@@ -26,6 +33,8 @@
    @Resource
    private CommunityService communityService;
    @Resource
    private WxMaProperties properties;
    @ApiOperation(value = "分页查询店铺" , response = PageShopStoreVO.class)
    @PostMapping("pageshopstore")
@@ -63,6 +72,16 @@
            return R.fail("请重新登陆");
        }
        return communityService.shopCartList(userId);
    }
    @ApiOperation(value = "查询用户购物车商品数量")
    @PostMapping("shopCartUserTotal")
    public R shopCartUserTotal() {
        Long userId = this.getUserId();
        if(userId == null){
            return R.fail("请重新登陆");
        }
        return communityService.shopCartUserTotal(userId);
    }
    @ApiOperation(value = "购物车添加")
@@ -148,6 +167,7 @@
        }
        orderCreateDTO.setUserId(loginUserInfo.getUserId());
        orderCreateDTO.setPhone(loginUserInfo.getPhone());
        orderCreateDTO.setOpenId(loginUserInfo.getOpenid());
        return communityService.orderCreate(orderCreateDTO);
    }
@@ -206,5 +226,16 @@
        return communityService.orderStatistics(loginUserInfo.getUserId());
    }
    @ApiOperation(value = "小程序微信调起支付")
    @PostMapping("wxpay")
    public R wxPay(@RequestBody OrderPayDTO orderPayDTO){
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        if(loginUserInfo == null){
            return R.fail("请重新登陆");
        }
        orderPayDTO.setOpenId(loginUserInfo.getOpenid());
        return communityService.wxPay(orderPayDTO);
    }
}