团购卷卷码表
原订单列表逻辑 店铺营业时间 团购卷订单 团购卷卷码表 资源管理 字典管理 通用门店 个人中心 支付
This commit is contained in:
@@ -5,19 +5,28 @@ import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.LocationUtils;
|
||||
import com.chaozhanggui.system.cashierservice.util.RedisUtils;
|
||||
import com.chaozhanggui.system.cashierservice.util.StringUtil;
|
||||
import com.chaozhanggui.system.cashierservice.util.ValidateCodeUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.google.gson.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 通用接口
|
||||
*
|
||||
* @author lyf
|
||||
*/
|
||||
@RestController
|
||||
@@ -37,6 +46,7 @@ public class CommonController {
|
||||
|
||||
/**
|
||||
* 发送短信验证码
|
||||
*
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
@@ -49,8 +59,8 @@ public class CommonController {
|
||||
validateCodeUtil.requestValidateCodeAli(phone, random);
|
||||
//存入缓存
|
||||
try {
|
||||
redisUtils.set(phone,random,ONE_MINUTE,TimeUnit.SECONDS);
|
||||
}catch (Exception e){
|
||||
redisUtils.set(phone, random, ONE_MINUTE, TimeUnit.SECONDS);
|
||||
} catch (Exception e) {
|
||||
throw new MsgException("验证码发送失败");
|
||||
}
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
@@ -62,6 +72,32 @@ public class CommonController {
|
||||
@GetMapping("/tbPlatformDict")
|
||||
public Result getPlatformDict(@RequestParam String type, @RequestHeader String environment) {
|
||||
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType(type, environment);
|
||||
return Result.success(CodeEnum.SUCCESS,carouselList);
|
||||
return Result.success(CodeEnum.SUCCESS, carouselList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 行政区域查询
|
||||
*
|
||||
* @param keywords citycode市、adcode区
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("location/district")
|
||||
public Result createOrder(String keywords) throws JsonProcessingException {
|
||||
String district = LocationUtils.district(keywords);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
// 将 JSON 字符串解析为 JsonNode 对象
|
||||
JsonNode jsonNode = mapper.readTree(district);
|
||||
JsonNode districts = jsonNode.get("districts");
|
||||
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, districts);
|
||||
}
|
||||
|
||||
@GetMapping("location/getGPSByIp")
|
||||
public Result getGPSByIp(String ip) throws JsonProcessingException {
|
||||
String gpsInfo = LocationUtils.getGPSByIp(ip);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
JsonNode jsonNode = mapper.readTree(gpsInfo);
|
||||
return Result.success(CodeEnum.SUCCESS, jsonNode);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.CreateGroupOrderDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.GroupOrderDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.OrderDto;
|
||||
import com.chaozhanggui.system.cashierservice.service.GroupOrderCouponService;
|
||||
import com.chaozhanggui.system.cashierservice.service.GroupOrderInfoService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -22,6 +26,9 @@ public class GroupOrderInfoController {
|
||||
@Resource
|
||||
private GroupOrderInfoService tbGroupOrderInfoService;
|
||||
|
||||
@Resource
|
||||
private GroupOrderCouponService orderCouponService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
@@ -30,14 +37,35 @@ public class GroupOrderInfoController {
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询卷码
|
||||
*/
|
||||
@RequestMapping("getCoupon")
|
||||
public Result queryCouponById(Integer id) {
|
||||
return Result.success(CodeEnum.SUCCESS,orderCouponService.queryByOrderId(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 团购卷 下单
|
||||
* @param token
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/creatGroupOrder")
|
||||
public Result createOrder(@RequestHeader String token,@RequestBody CreateGroupOrderDto param){
|
||||
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||
String phone = TokenUtil.parseParamFromToken(token).getString("phone");
|
||||
param.setUserId(Integer.valueOf(userId));
|
||||
param.setPhone(phone);
|
||||
return tbGroupOrderInfoService.insert(param);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
@@ -49,16 +77,6 @@ public class GroupOrderInfoController {
|
||||
return tbGroupOrderInfoService.queryById(id,lng,lat);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param tbGroupOrderInfo 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@RequestMapping("add")
|
||||
public Result add(TbGroupOrderInfo tbGroupOrderInfo) {
|
||||
return tbGroupOrderInfoService.insert(tbGroupOrderInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ComShopDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.HomeBaseDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
|
||||
import com.chaozhanggui.system.cashierservice.service.HomeDistrictService;
|
||||
@@ -22,6 +23,9 @@ public class HomeDistrictController {
|
||||
@Resource
|
||||
private HomeDistrictService districtService;
|
||||
|
||||
/**
|
||||
* 顶部图/菜单
|
||||
*/
|
||||
@RequestMapping("/topCommon")
|
||||
public Result topCommon(HomeDto param,@RequestHeader("environment") String environment){
|
||||
return districtService.topCommon(param,environment);
|
||||
@@ -44,7 +48,15 @@ public class HomeDistrictController {
|
||||
* 咖啡饮品
|
||||
*/
|
||||
@RequestMapping("/productCate")
|
||||
public Result productCate(HomeDto param) throws ExecutionException, InterruptedException {
|
||||
public Result productCate(HomeDto param){
|
||||
return districtService.proList(param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用门店
|
||||
*/
|
||||
@RequestMapping("/comShopList")
|
||||
public Result comShopList(ComShopDto param){
|
||||
return districtService.queryComShopList(param);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.LocationUtils;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/location")
|
||||
public class LocationController {
|
||||
|
||||
|
||||
/**
|
||||
* 行政区域查询
|
||||
*
|
||||
* @param keywords citycode市、adcode区
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/district")
|
||||
public Result createOrder(String keywords) throws JsonProcessingException {
|
||||
String district = LocationUtils.district(keywords);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
// 将 JSON 字符串解析为 JsonNode 对象
|
||||
JsonNode jsonNode = mapper.readTree(district);
|
||||
JsonNode districts = jsonNode.get("districts");
|
||||
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, districts);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +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.entity.dto.UserPassDto;
|
||||
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
||||
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||
import com.chaozhanggui.system.cashierservice.service.LoginService;
|
||||
@@ -252,7 +252,7 @@ public class LoginContoller {
|
||||
}
|
||||
|
||||
@PostMapping(value = "/upPass")
|
||||
public Result upPass(@RequestHeader String token,@RequestBody UserPassVo passVo){
|
||||
public Result upPass(@RequestHeader String token,@RequestBody UserPassDto passVo){
|
||||
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||
String newPass = MD5Utils.MD5Encode(passVo.getNewPass(), "utf-8");
|
||||
if (ObjectUtil.isNull(passVo.getCode())) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@@ -61,6 +62,21 @@ public class NotifyController {
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping("notifyCallBackGroup")
|
||||
public String notifyCallBackGroup(HttpServletRequest request){
|
||||
Map<String, Object> map= getParameterMap(request);
|
||||
log.info("团购卷回调返回信息:{}",JSONUtil.toJsonStr(map));
|
||||
if(ObjectUtil.isNotEmpty(map)&&map.containsKey("code")&&"200".equals(map.get("code")+"")){
|
||||
JSONObject object=JSONUtil.parseObj(map.get("data"));
|
||||
if(ObjectUtil.isNotEmpty(object)&&object.containsKey("status")&&"1".equals(object.getStr("status"))){
|
||||
String orderNo=object.getStr("orderNumber");
|
||||
return payService.callBackGroupPay(orderNo);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Map<String, Object> getParameterMap(HttpServletRequest request) {
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbOrderDetail;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ReturnGroupOrderDto;
|
||||
import com.chaozhanggui.system.cashierservice.service.PayService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.IpUtil;
|
||||
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@@ -26,25 +30,36 @@ public class PayController {
|
||||
|
||||
/**
|
||||
* 支付
|
||||
*
|
||||
* @param request
|
||||
* @param openId
|
||||
* payType wechatPay:微信支付;aliPay:支付宝支付;
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("orderPay")
|
||||
public Result pay(HttpServletRequest request, @RequestHeader("openId") String openId, @RequestBody Map<String,String> map) {
|
||||
if(ObjectUtil.isEmpty(map)||map.size()<=0||!map.containsKey("orderId")||ObjectUtil.isEmpty(map.get("orderId"))){
|
||||
public Result pay(HttpServletRequest request, @RequestHeader String token, @RequestBody Map<String, String> map) {
|
||||
if (ObjectUtil.isEmpty(map) || map.size() <= 0 || !map.containsKey("orderId") || ObjectUtil.isEmpty(map.get("orderId"))) {
|
||||
return Result.fail("订单号不允许为空");
|
||||
}
|
||||
|
||||
String orderId = map.get("orderId").toString();
|
||||
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||
try {
|
||||
return payService.payOrder(openId,map.get("orderId").toString(), IpUtil.getIpAddr(request));
|
||||
if(orderId.startsWith("GP")){
|
||||
return payService.groupOrderPay(orderId, map.get("payType"), userId, IpUtil.getIpAddr(request));
|
||||
}else {
|
||||
return payService.payOrder(userId, orderId, map.get("payType"), IpUtil.getIpAddr(request));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return Result.fail("支付失败");
|
||||
}
|
||||
|
||||
@RequestMapping("returnGpOrder")
|
||||
public Result returnOrder(@RequestBody ReturnGroupOrderDto param){
|
||||
return payService.returnOrder(param);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// public Result memberAccountPay(@RequestHeader("openId") String openId,
|
||||
@@ -59,12 +74,13 @@ public class PayController {
|
||||
|
||||
/**
|
||||
* 修改订单状态
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("modfiyOrderInfo")
|
||||
public Result modfiyOrderInfo( @RequestBody Map<String,String> map){
|
||||
if(ObjectUtil.isEmpty(map)||map.size()<=0||!map.containsKey("orderId")||ObjectUtil.isEmpty(map.get("orderId"))){
|
||||
public Result modfiyOrderInfo(@RequestBody Map<String, String> map) {
|
||||
if (ObjectUtil.isEmpty(map) || map.size() <= 0 || !map.containsKey("orderId") || ObjectUtil.isEmpty(map.get("orderId"))) {
|
||||
return Result.fail("订单号不允许为空");
|
||||
}
|
||||
|
||||
@@ -79,23 +95,18 @@ public class PayController {
|
||||
|
||||
/**
|
||||
* 充值
|
||||
*
|
||||
* @param request
|
||||
* @param openId
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("memeberIn")
|
||||
public Result memeberIn(HttpServletRequest request,@RequestHeader("openId") String openId,@RequestHeader("id") String id,
|
||||
@RequestBody Map<String,Object> map
|
||||
){
|
||||
return payService.memberIn(openId,id,map.get("amount").toString(),map.get("shopId").toString(),IpUtil.getIpAddr(request));
|
||||
public Result memeberIn(HttpServletRequest request, @RequestHeader("openId") String openId, @RequestHeader("id") String id,
|
||||
@RequestBody Map<String, Object> map
|
||||
) {
|
||||
return payService.memberIn(openId, id, map.get("amount").toString(), map.get("shopId").toString(), IpUtil.getIpAddr(request));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.chaozhanggui.system.cashierservice.service.ProductService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -20,6 +21,21 @@ public class ProductController {
|
||||
@Autowired
|
||||
private ProductService productService;
|
||||
|
||||
/**
|
||||
* 通过桌码获取shopId
|
||||
* @param code
|
||||
* @return shopid
|
||||
*/
|
||||
@RequestMapping("queryShopIdByTableCode")
|
||||
public Result queryShopIdByTableCode(@RequestParam("code") String code) {
|
||||
return productService.queryShopIdByTableCode(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过code和分组Id
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("queryProduct")
|
||||
public Result queryProduct(@RequestBody Map<String, String> map) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user