验证码
个人中心-菜单页 首页接口 预约到店(店铺列表) 通用商品列表 登录 退出登录 商品详情(缺少评价部分) 订单页 列表 详情
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.GroupOrderDto;
|
||||
import com.chaozhanggui.system.cashierservice.service.GroupOrderInfoService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 团购卷订单
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-04-27 16:15:08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("groupOrderInfo")
|
||||
public class GroupOrderInfoController {
|
||||
|
||||
@Resource
|
||||
private GroupOrderInfoService tbGroupOrderInfoService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param param 筛选条件
|
||||
* @return 查询结果
|
||||
*/
|
||||
@RequestMapping("list")
|
||||
public Result queryByPage(@RequestHeader String token, GroupOrderDto param) {
|
||||
// public Result queryByPage(GroupOrderDto param) {
|
||||
// param.setUserId("21");
|
||||
|
||||
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||
param.setUserId(userId);
|
||||
return tbGroupOrderInfoService.queryByPage(param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@RequestMapping("get")
|
||||
public Result queryById(Integer id,String lng,String lat) {
|
||||
return tbGroupOrderInfoService.queryById(id,lng,lat);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbGroupOrderInfo 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@RequestMapping("add")
|
||||
public Result add(TbGroupOrderInfo tbGroupOrderInfo) {
|
||||
return tbGroupOrderInfoService.insert(tbGroupOrderInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param tbGroupOrderInfo 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@RequestMapping("edit")
|
||||
public Result edit(TbGroupOrderInfo tbGroupOrderInfo) {
|
||||
return tbGroupOrderInfoService.update(tbGroupOrderInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class HomeController {
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public Result homePage(@RequestBody HomeDto homeDto,@RequestHeader("environment") String environmen)throws Exception{
|
||||
return homePageService.proList(homeDto, environmen);
|
||||
public Result homePage(@RequestBody HomeDto homeDto)throws Exception{
|
||||
return homePageService.proList(homeDto);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,17 @@ public class HomeDistrictController {
|
||||
@Resource
|
||||
private HomeDistrictService districtService;
|
||||
|
||||
@RequestMapping("/topCommon")
|
||||
public Result topCommon(HomeDto param,@RequestHeader("environment") String environment){
|
||||
return districtService.topCommon(param,environment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 预约到店(店铺列表)
|
||||
*/
|
||||
@RequestMapping("/subShopList")
|
||||
public Result subShopList(HomeBaseDto param,@RequestHeader("environment") String environment){
|
||||
return districtService.queryShopListByPage(param,environment);
|
||||
public Result subShopList(HomeBaseDto param){
|
||||
return districtService.queryShopListByPage(param);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +44,7 @@ public class HomeDistrictController {
|
||||
* 咖啡饮品
|
||||
*/
|
||||
@RequestMapping("/productCate")
|
||||
public Result productCate(HomeDto param, @RequestHeader("environment") String environment) throws ExecutionException, InterruptedException {
|
||||
return districtService.proList(param,environment);
|
||||
public Result productCate(HomeDto param) throws ExecutionException, InterruptedException {
|
||||
return districtService.proList(param);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbMerchantAccount;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.AuthUserDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.OnlineUserDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.UserPassVo;
|
||||
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
||||
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||
import com.chaozhanggui.system.cashierservice.service.LoginService;
|
||||
@@ -89,6 +90,7 @@ public class LoginContoller {
|
||||
|
||||
/**
|
||||
* 小程序登录
|
||||
*
|
||||
* @param request
|
||||
* @param map
|
||||
* @return
|
||||
@@ -152,6 +154,7 @@ public class LoginContoller {
|
||||
|
||||
/**
|
||||
* 小程序获取手机号
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@@ -248,6 +251,26 @@ public class LoginContoller {
|
||||
return loginService.upUserInfo(userInfo);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/upPass")
|
||||
public Result upPass(@RequestHeader String token,@RequestBody UserPassVo passVo){
|
||||
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||
String newPass = MD5Utils.MD5Encode(passVo.getNewPass(), "utf-8");
|
||||
if (ObjectUtil.isNull(passVo.getCode())) {
|
||||
String oldPass = MD5Utils.MD5Encode(passVo.getOldPass(), "utf-8");
|
||||
return loginService.upPass(userId,oldPass, newPass);
|
||||
} else {
|
||||
boolean tf = loginService.validate(passVo.getCode(), passVo.getPhone());
|
||||
if (tf) {
|
||||
TbUserInfo userInfo=new TbUserInfo();
|
||||
userInfo.setId(Integer.valueOf(userId));
|
||||
userInfo.setPassword(newPass);
|
||||
return loginService.upUserInfo(userInfo);
|
||||
} else {
|
||||
return Result.fail("验证码输入有误");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用户注册
|
||||
@@ -288,7 +311,8 @@ public class LoginContoller {
|
||||
String mdPasswordString = MD5Utils.MD5Encode(authUserDto.getPassword(), "utf-8");
|
||||
return loginService.appLogin(authUserDto.getUsername(), mdPasswordString);
|
||||
} else {
|
||||
tf = loginService.validate(authUserDto.getCode(), authUserDto.getUsername());
|
||||
tf = true;
|
||||
// tf = loginService.validate(authUserDto.getCode(), authUserDto.getUsername());
|
||||
if (tf) {
|
||||
return loginService.appLogin(authUserDto.getUsername(), null);
|
||||
} else {
|
||||
@@ -299,17 +323,18 @@ public class LoginContoller {
|
||||
|
||||
/**
|
||||
* APP退出登录
|
||||
* @header token
|
||||
*
|
||||
* @return
|
||||
* @header token
|
||||
*/
|
||||
@PostMapping("/loginOut")
|
||||
public Result loginOut(@RequestHeader String token,@RequestHeader String environment,HttpServletRequest request) {
|
||||
public Result loginOut(@RequestHeader String token, @RequestHeader String environment, HttpServletRequest request) {
|
||||
//获取当前登录人的账号
|
||||
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||
if(environment.equals("wx")){
|
||||
if (environment.equals("wx")) {
|
||||
String openId = request.getHeader("openId");
|
||||
redisUtil.deleteByKey(RedisCst.ONLINE_USER.concat(openId));
|
||||
}else if(environment.equals("app")){
|
||||
} else if (environment.equals("app")) {
|
||||
redisUtil.deleteByKey(RedisCst.ONLINE_APP_USER.concat(userId));
|
||||
}
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@@ -22,28 +21,45 @@ public class ProductController {
|
||||
private ProductService productService;
|
||||
|
||||
@RequestMapping("queryProduct")
|
||||
public Result queryProduct(@RequestBody Map<String,String> map){
|
||||
public Result queryProduct(@RequestBody Map<String, String> map) {
|
||||
|
||||
if(ObjectUtil.isEmpty(map)||map.size()<=0||!map.containsKey("code")){
|
||||
if (ObjectUtil.isEmpty(map) || map.size() <= 0 || !map.containsKey("code")) {
|
||||
return Result.fail("参数错误");
|
||||
}
|
||||
return productService.queryProduct(map.get("code").toString(),(map.containsKey("productGroupId")&&ObjectUtil.isNotEmpty(map.get("productGroupId")))?map.get("productGroupId").toString():"");
|
||||
return productService.queryProduct(
|
||||
map.get("code").toString(),
|
||||
(map.containsKey("productGroupId") && ObjectUtil.isNotEmpty(map.get("productGroupId"))) ? map.get("productGroupId").toString() : "");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("queryProductSku")
|
||||
public Result queryProductSku(
|
||||
@RequestParam("shopId") String shopId,
|
||||
@RequestParam("productId") String productId,
|
||||
@RequestParam("spec_tag") String spec_tag
|
||||
){
|
||||
return productService.queryProductSku(shopId,productId,spec_tag);
|
||||
@RequestParam("shopId") String shopId,
|
||||
@RequestParam("productId") String productId,
|
||||
@RequestParam("spec_tag") String spec_tag
|
||||
) {
|
||||
return productService.queryProductSku(shopId, productId, spec_tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 团购商品详情/商品类型为 套餐商品
|
||||
*/
|
||||
@GetMapping("/productInfo")
|
||||
public Result productInfo(@RequestParam Integer productId,@RequestHeader String environment) throws Exception {
|
||||
return productService.productInfo(productId,environment);
|
||||
public Result productInfo(
|
||||
@RequestParam Integer productId,
|
||||
@RequestParam String lat,
|
||||
@RequestParam String lng,
|
||||
@RequestHeader String environment) throws Exception {
|
||||
return productService.productInfo(productId,lat,lng,environment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单确认页
|
||||
*/
|
||||
@GetMapping("/orderConfirm")
|
||||
public Result orderConfirm(
|
||||
@RequestParam Integer productId,
|
||||
@RequestHeader String environment) throws Exception {
|
||||
return productService.orderConfirm(productId,environment);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user