团购卷卷码表
原订单列表逻辑 店铺营业时间 团购卷订单 团购卷卷码表 资源管理 字典管理 通用门店 个人中心 支付
This commit is contained in:
@@ -41,9 +41,14 @@ public class LoginFilter implements Filter {
|
|||||||
// "cashierService/location/**",//高德 获取行政区域
|
// "cashierService/location/**",//高德 获取行政区域
|
||||||
// "cashierService/home/homePageUp",//首页上半
|
// "cashierService/home/homePageUp",//首页上半
|
||||||
// "cashierService/home",//首页
|
// "cashierService/home",//首页
|
||||||
// "cashierService/distirict/subShopList",//首页
|
//
|
||||||
// "cashierService/product/productInfo",//商品详情
|
// "cashierService/distirict/**",//首页其它接口
|
||||||
// "cashierService/login/**"//登录部分接口不校验
|
// "cashierService/login/**",//登录部分接口不校验
|
||||||
|
// "cashierService/notify/**",//登录部分接口不校验
|
||||||
|
// "cashierService/product/queryShopIdByTableCode",
|
||||||
|
// "cashierService/product/queryProduct",
|
||||||
|
// "cashierService/product/productInfo",
|
||||||
|
// "notify/**"//登录部分接口不校验
|
||||||
);
|
);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -74,11 +79,11 @@ public class LoginFilter implements Filter {
|
|||||||
|
|
||||||
//environment 环境标识 wx app 后续environment不可为空
|
//environment 环境标识 wx app 后续environment不可为空
|
||||||
String environment = request.getHeader("environment");
|
String environment = request.getHeader("environment");
|
||||||
//token校验目前只对app生效
|
// //token校验目前只对app生效
|
||||||
if (StringUtils.isBlank(environment) || !environment.equals("app")) {
|
// if (StringUtils.isBlank(environment) || !environment.equals("app")) {
|
||||||
chain.doFilter(req, resp);
|
// chain.doFilter(req, resp);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 判断用户TOKEN是否存在
|
// 判断用户TOKEN是否存在
|
||||||
String token = request.getHeader("token");
|
String token = request.getHeader("token");
|
||||||
|
|||||||
@@ -5,19 +5,28 @@ import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
|||||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
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.RedisUtils;
|
||||||
import com.chaozhanggui.system.cashierservice.util.StringUtil;
|
import com.chaozhanggui.system.cashierservice.util.StringUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.util.ValidateCodeUtil;
|
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 lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用接口
|
* 通用接口
|
||||||
|
*
|
||||||
* @author lyf
|
* @author lyf
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@@ -37,6 +46,7 @@ public class CommonController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送短信验证码
|
* 发送短信验证码
|
||||||
|
*
|
||||||
* @param phone
|
* @param phone
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -49,8 +59,8 @@ public class CommonController {
|
|||||||
validateCodeUtil.requestValidateCodeAli(phone, random);
|
validateCodeUtil.requestValidateCodeAli(phone, random);
|
||||||
//存入缓存
|
//存入缓存
|
||||||
try {
|
try {
|
||||||
redisUtils.set(phone,random,ONE_MINUTE,TimeUnit.SECONDS);
|
redisUtils.set(phone, random, ONE_MINUTE, TimeUnit.SECONDS);
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
throw new MsgException("验证码发送失败");
|
throw new MsgException("验证码发送失败");
|
||||||
}
|
}
|
||||||
return Result.success(CodeEnum.SUCCESS);
|
return Result.success(CodeEnum.SUCCESS);
|
||||||
@@ -62,6 +72,32 @@ public class CommonController {
|
|||||||
@GetMapping("/tbPlatformDict")
|
@GetMapping("/tbPlatformDict")
|
||||||
public Result getPlatformDict(@RequestParam String type, @RequestHeader String environment) {
|
public Result getPlatformDict(@RequestParam String type, @RequestHeader String environment) {
|
||||||
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType(type, 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;
|
package com.chaozhanggui.system.cashierservice.controller;
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderInfo;
|
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.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.service.GroupOrderInfoService;
|
||||||
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -22,6 +26,9 @@ public class GroupOrderInfoController {
|
|||||||
@Resource
|
@Resource
|
||||||
private GroupOrderInfoService tbGroupOrderInfoService;
|
private GroupOrderInfoService tbGroupOrderInfoService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private GroupOrderCouponService orderCouponService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
*
|
*
|
||||||
@@ -30,14 +37,35 @@ public class GroupOrderInfoController {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping("list")
|
@RequestMapping("list")
|
||||||
public Result queryByPage(@RequestHeader String token, GroupOrderDto param) {
|
public Result queryByPage(@RequestHeader String token, GroupOrderDto param) {
|
||||||
// public Result queryByPage(GroupOrderDto param) {
|
|
||||||
// param.setUserId("21");
|
|
||||||
|
|
||||||
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||||
param.setUserId(userId);
|
param.setUserId(userId);
|
||||||
return tbGroupOrderInfoService.queryByPage(param);
|
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);
|
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;
|
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.HomeBaseDto;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
|
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
|
||||||
import com.chaozhanggui.system.cashierservice.service.HomeDistrictService;
|
import com.chaozhanggui.system.cashierservice.service.HomeDistrictService;
|
||||||
@@ -22,6 +23,9 @@ public class HomeDistrictController {
|
|||||||
@Resource
|
@Resource
|
||||||
private HomeDistrictService districtService;
|
private HomeDistrictService districtService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 顶部图/菜单
|
||||||
|
*/
|
||||||
@RequestMapping("/topCommon")
|
@RequestMapping("/topCommon")
|
||||||
public Result topCommon(HomeDto param,@RequestHeader("environment") String environment){
|
public Result topCommon(HomeDto param,@RequestHeader("environment") String environment){
|
||||||
return districtService.topCommon(param,environment);
|
return districtService.topCommon(param,environment);
|
||||||
@@ -44,7 +48,15 @@ public class HomeDistrictController {
|
|||||||
* 咖啡饮品
|
* 咖啡饮品
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/productCate")
|
@RequestMapping("/productCate")
|
||||||
public Result productCate(HomeDto param) throws ExecutionException, InterruptedException {
|
public Result productCate(HomeDto param){
|
||||||
return districtService.proList(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.TbUserInfo;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.AuthUserDto;
|
import com.chaozhanggui.system.cashierservice.entity.dto.AuthUserDto;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.OnlineUserDto;
|
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.RedisCst;
|
||||||
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.service.LoginService;
|
import com.chaozhanggui.system.cashierservice.service.LoginService;
|
||||||
@@ -252,7 +252,7 @@ public class LoginContoller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/upPass")
|
@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 userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||||
String newPass = MD5Utils.MD5Encode(passVo.getNewPass(), "utf-8");
|
String newPass = MD5Utils.MD5Encode(passVo.getNewPass(), "utf-8");
|
||||||
if (ObjectUtil.isNull(passVo.getCode())) {
|
if (ObjectUtil.isNull(passVo.getCode())) {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
@CrossOrigin(origins = "*")
|
@CrossOrigin(origins = "*")
|
||||||
@RestController
|
@RestController
|
||||||
@@ -61,6 +62,21 @@ public class NotifyController {
|
|||||||
return null;
|
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) {
|
private Map<String, Object> getParameterMap(HttpServletRequest request) {
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.controller;
|
package com.chaozhanggui.system.cashierservice.controller;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
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.service.PayService;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import com.chaozhanggui.system.cashierservice.util.IpUtil;
|
import com.chaozhanggui.system.cashierservice.util.IpUtil;
|
||||||
|
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@CrossOrigin(origins = "*")
|
@CrossOrigin(origins = "*")
|
||||||
@@ -26,25 +30,36 @@ public class PayController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付
|
* 支付
|
||||||
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param openId
|
* payType wechatPay:微信支付;aliPay:支付宝支付;
|
||||||
* @param map
|
* @param map
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("orderPay")
|
@RequestMapping("orderPay")
|
||||||
public Result pay(HttpServletRequest request, @RequestHeader("openId") String openId, @RequestBody Map<String,String> map) {
|
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"))){
|
if (ObjectUtil.isEmpty(map) || map.size() <= 0 || !map.containsKey("orderId") || ObjectUtil.isEmpty(map.get("orderId"))) {
|
||||||
return Result.fail("订单号不允许为空");
|
return Result.fail("订单号不允许为空");
|
||||||
}
|
}
|
||||||
|
String orderId = map.get("orderId").toString();
|
||||||
|
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||||
try {
|
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) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return Result.fail("支付失败");
|
return Result.fail("支付失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping("returnGpOrder")
|
||||||
|
public Result returnOrder(@RequestBody ReturnGroupOrderDto param){
|
||||||
|
return payService.returnOrder(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// public Result memberAccountPay(@RequestHeader("openId") String openId,
|
// public Result memberAccountPay(@RequestHeader("openId") String openId,
|
||||||
@@ -59,12 +74,13 @@ public class PayController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改订单状态
|
* 修改订单状态
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("modfiyOrderInfo")
|
@RequestMapping("modfiyOrderInfo")
|
||||||
public Result modfiyOrderInfo( @RequestBody Map<String,String> map){
|
public Result modfiyOrderInfo(@RequestBody Map<String, String> map) {
|
||||||
if(ObjectUtil.isEmpty(map)||map.size()<=0||!map.containsKey("orderId")||ObjectUtil.isEmpty(map.get("orderId"))){
|
if (ObjectUtil.isEmpty(map) || map.size() <= 0 || !map.containsKey("orderId") || ObjectUtil.isEmpty(map.get("orderId"))) {
|
||||||
return Result.fail("订单号不允许为空");
|
return Result.fail("订单号不允许为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,23 +95,18 @@ public class PayController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 充值
|
* 充值
|
||||||
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param openId
|
* @param openId
|
||||||
* @param map
|
* @param map
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("memeberIn")
|
@RequestMapping("memeberIn")
|
||||||
public Result memeberIn(HttpServletRequest request,@RequestHeader("openId") String openId,@RequestHeader("id") String id,
|
public Result memeberIn(HttpServletRequest request, @RequestHeader("openId") String openId, @RequestHeader("id") String id,
|
||||||
@RequestBody Map<String,Object> map
|
@RequestBody Map<String, Object> map
|
||||||
){
|
) {
|
||||||
return payService.memberIn(openId,id,map.get("amount").toString(),map.get("shopId").toString(),IpUtil.getIpAddr(request));
|
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.service.ProductService;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -20,6 +21,21 @@ public class ProductController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ProductService productService;
|
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")
|
@RequestMapping("queryProduct")
|
||||||
public Result queryProduct(@RequestBody Map<String, String> map) {
|
public Result queryProduct(@RequestBody Map<String, String> map) {
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.dao;
|
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.SysDict;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.SysDictDetail;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@Mapper
|
|
||||||
public interface SysDictDetailMapper {
|
|
||||||
|
|
||||||
List<SysDict> selectHot();
|
|
||||||
|
|
||||||
List<SysDict> selectByType(@Param("type") String type);
|
|
||||||
|
|
||||||
List<SysDictDetail> selectByDictId(@Param("dictId") Long dictId);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,17 +1,14 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.dao;
|
package com.chaozhanggui.system.cashierservice.dao;
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.SysDict;
|
import com.chaozhanggui.system.cashierservice.entity.SysDict;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface SysDictMapper {
|
public interface SysDictMapper {
|
||||||
int deleteByPrimaryKey(Long dictId);
|
List<SysDict> selectHot();
|
||||||
|
|
||||||
int insert(SysDict record);
|
List<SysDict> selectByType(@Param("type") String type);
|
||||||
|
|
||||||
int insertSelective(SysDict record);
|
List<SysDict> selectByDictId(@Param("dictId") Long dictId);
|
||||||
|
|
||||||
SysDict selectByPrimaryKey(Long dictId);
|
|
||||||
|
|
||||||
int updateByPrimaryKeySelective(SysDict record);
|
|
||||||
|
|
||||||
int updateByPrimaryKey(SysDict record);
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.dao;
|
||||||
|
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderCoupon;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团购卷 卷码表(TbGroupOrderCoupon)表数据库访问层
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2024-05-06 14:39:59
|
||||||
|
*/
|
||||||
|
public interface TbGroupOrderCouponMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过ID查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
TbGroupOrderCoupon queryById(Integer id);
|
||||||
|
|
||||||
|
List<TbGroupOrderCoupon> queryByOrderId(Integer orderId);
|
||||||
|
|
||||||
|
List<TbGroupOrderCoupon> queryNoRefundByOrderId(Integer orderId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据
|
||||||
|
*
|
||||||
|
* @param tbGroupOrderCoupon 查询条件
|
||||||
|
* @param pageable 分页对象
|
||||||
|
* @return 对象列表
|
||||||
|
*/
|
||||||
|
List<TbGroupOrderCoupon> queryAll(TbGroupOrderCoupon tbGroupOrderCoupon, @Param("pageable") Pageable pageable);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*
|
||||||
|
* @param tbGroupOrderCoupon 实例对象
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int insert(TbGroupOrderCoupon tbGroupOrderCoupon);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增数据(MyBatis原生foreach方法)
|
||||||
|
*
|
||||||
|
* @param entities List<TbGroupOrderCoupon> 实例对象列表
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int insertBatch(@Param("entities") List<TbGroupOrderCoupon> entities);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*
|
||||||
|
* @param tbGroupOrderCoupon 实例对象
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int update(TbGroupOrderCoupon tbGroupOrderCoupon);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
int deleteById(Integer id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -3,6 +3,7 @@ package com.chaozhanggui.system.cashierservice.dao;
|
|||||||
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderInfo;
|
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderInfo;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.GroupOrderDto;
|
import com.chaozhanggui.system.cashierservice.entity.dto.GroupOrderDto;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.vo.GroupOrderListVo;
|
import com.chaozhanggui.system.cashierservice.entity.vo.GroupOrderListVo;
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -23,6 +24,8 @@ public interface TbGroupOrderInfoMapper {
|
|||||||
*/
|
*/
|
||||||
TbGroupOrderInfo queryById(Integer id);
|
TbGroupOrderInfo queryById(Integer id);
|
||||||
|
|
||||||
|
TbGroupOrderInfo selectByPayOrderNo(@Param("payOrderNO")String payOrderNO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据
|
* 查询数据
|
||||||
*
|
*
|
||||||
@@ -56,13 +59,6 @@ public interface TbGroupOrderInfoMapper {
|
|||||||
*/
|
*/
|
||||||
int update(TbGroupOrderInfo tbGroupOrderInfo);
|
int update(TbGroupOrderInfo tbGroupOrderInfo);
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过主键删除数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 影响行数
|
|
||||||
*/
|
|
||||||
int deleteById(Integer id);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ public interface TbOrderInfoMapper {
|
|||||||
List<TbOrderInfo> selectAllByStatus(String status);
|
List<TbOrderInfo> selectAllByStatus(String status);
|
||||||
TbOrderInfo selectByPayOrderNo(String payOrderNo);
|
TbOrderInfo selectByPayOrderNo(String payOrderNo);
|
||||||
|
|
||||||
List<TbOrderInfo> selectByUserId(@Param("userId")Integer userId, @Param("page")Integer page,
|
List<TbOrderInfo> selectByUserId(@Param("userId")Integer userId, @Param("status") String status);
|
||||||
@Param("size")Integer size, @Param("status") String status);
|
|
||||||
|
|
||||||
|
|
||||||
List<TbOrderInfo> selectByTradeDay(@Param("day") String day,@Param("minPrice") BigDecimal minPrice,@Param("maxPrice") BigDecimal maxPrice);
|
List<TbOrderInfo> selectByTradeDay(@Param("day") String day,@Param("minPrice") BigDecimal minPrice,@Param("maxPrice") BigDecimal maxPrice);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.chaozhanggui.system.cashierservice.dao;
|
|||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,6 +24,7 @@ public interface TbPlatformDictMapper {
|
|||||||
List<TbPlatformDict> queryByIdList(@Param("idList")List<Integer> idList);
|
List<TbPlatformDict> queryByIdList(@Param("idList")List<Integer> idList);
|
||||||
|
|
||||||
List<TbPlatformDict> queryAllByType(@Param("type") String type,@Param("environment") String environment);
|
List<TbPlatformDict> queryAllByType(@Param("type") String type,@Param("environment") String environment);
|
||||||
|
List<TbPlatformDict> queryGroupByValue(@Param("value")String value,@Param("environment") String environment);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,5 +27,6 @@ public interface TbProductGroupMapper {
|
|||||||
List<TbProductGroup> selectByIdAndShopId(@Param("code") String code);
|
List<TbProductGroup> selectByIdAndShopId(@Param("code") String code);
|
||||||
|
|
||||||
List<TbProductGroup> selectByQrcode(@Param("qrCode") String qrCode,@Param("groupId") Integer groupId);
|
List<TbProductGroup> selectByQrcode(@Param("qrCode") String qrCode,@Param("groupId") Integer groupId);
|
||||||
|
List<TbProductGroup> selectByShopId(@Param("shopId") String shopId,@Param("groupId") Integer groupId);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -27,4 +27,11 @@ public interface TbProductMapper {
|
|||||||
@Param("rightTopLng") Double rightTopLng, @Param("rightTopLat") Double rightTopLat,
|
@Param("rightTopLng") Double rightTopLng, @Param("rightTopLat") Double rightTopLat,
|
||||||
@Param("leftBottomLng") Double leftBottomLng, @Param("leftBottomLat") Double leftBottomLat,
|
@Param("leftBottomLng") Double leftBottomLng, @Param("leftBottomLat") Double leftBottomLat,
|
||||||
@Param("cities") String cities, @Param("orderBy") String orderBy, @Param("lng") String lng, @Param("lat") String lat);
|
@Param("cities") String cities, @Param("orderBy") String orderBy, @Param("lng") String lng, @Param("lat") String lat);
|
||||||
|
|
||||||
|
List<ShopGroupInfoVo> selHotGroups(@Param("type") String type,
|
||||||
|
@Param("startTime") String startTime, @Param("endTime") String endTime,
|
||||||
|
@Param("cities") String cities, @Param("orderBy") String orderBy, @Param("lng") String lng, @Param("lat") String lat);
|
||||||
|
|
||||||
|
|
||||||
|
void upGroupRealSalesNumber(@Param("id") String id,@Param("number") Integer number);
|
||||||
}
|
}
|
||||||
@@ -21,10 +21,13 @@ public interface TbShopInfoMapper {
|
|||||||
|
|
||||||
List<SubShopVo> selShopInfoByGps(@Param("rightTopLng") Double rightTopLng, @Param("rightTopLat") Double rightTopLat,
|
List<SubShopVo> selShopInfoByGps(@Param("rightTopLng") Double rightTopLng, @Param("rightTopLat") Double rightTopLat,
|
||||||
@Param("leftBottomLng") Double leftBottomLng, @Param("leftBottomLat") Double leftBottomLat,
|
@Param("leftBottomLng") Double leftBottomLng, @Param("leftBottomLat") Double leftBottomLat,
|
||||||
@Param("cities") String cities, @Param("lng") String lng, @Param("lat") String lat);
|
@Param("cities") String cities, @Param("lng") String lng, @Param("lat") String lat,
|
||||||
|
@Param("shopName")String shopName);
|
||||||
|
|
||||||
TbShopInfo selectByPrimaryKey(Integer id);
|
TbShopInfo selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
Integer selNumByChain(@Param("chainName") String chainName);
|
||||||
|
|
||||||
List<TbShopInfo> selectByIds(@Param("list") List<String> ids);
|
List<TbShopInfo> selectByIds(@Param("list") List<String> ids);
|
||||||
|
|
||||||
int updateByPrimaryKeySelective(TbShopInfo record);
|
int updateByPrimaryKeySelective(TbShopInfo record);
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ public interface TbShopTableMapper {
|
|||||||
|
|
||||||
TbShopTable selectQRcode(String code);
|
TbShopTable selectQRcode(String code);
|
||||||
|
|
||||||
|
String queryShopIdByTableCode(String code);
|
||||||
|
|
||||||
int updateByPrimaryKeySelective(TbShopTable record);
|
int updateByPrimaryKeySelective(TbShopTable record);
|
||||||
|
|
||||||
int updateByPrimaryKey(TbShopTable record);
|
int updateByPrimaryKey(TbShopTable record);
|
||||||
|
|||||||
@@ -3,17 +3,28 @@ package com.chaozhanggui.system.cashierservice.entity;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class SysDict implements Serializable {
|
public class SysDict implements Serializable {
|
||||||
|
|
||||||
private Long dictId;
|
private Long dictId;
|
||||||
|
|
||||||
private String dictName;
|
private String dictName;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private String description;
|
/**
|
||||||
|
* 是否有子类0否1是
|
||||||
|
*/
|
||||||
|
private Integer isChild;
|
||||||
|
|
||||||
private Integer isChild;
|
/**
|
||||||
|
* 值
|
||||||
|
*/
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
private List<SysDict> detail=new ArrayList<>();
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团购卷 卷码表(TbGroupOrderCoupon)实体类
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2024-05-06 14:39:59
|
||||||
|
*/
|
||||||
|
public class TbGroupOrderCoupon implements Serializable {
|
||||||
|
private static final long serialVersionUID = -35424376349743542L;
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 团购订单id
|
||||||
|
*/
|
||||||
|
private Integer orderId;
|
||||||
|
/**
|
||||||
|
* 团购卷码
|
||||||
|
*/
|
||||||
|
private String couponNo;
|
||||||
|
/**
|
||||||
|
* 是否已退款
|
||||||
|
* 0:否
|
||||||
|
* 1:是
|
||||||
|
*/
|
||||||
|
private Integer isRefund;
|
||||||
|
/**
|
||||||
|
* 退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal refundAmount;
|
||||||
|
/**
|
||||||
|
* 退款原因
|
||||||
|
*/
|
||||||
|
private String refundReason;
|
||||||
|
/**
|
||||||
|
* 退款说明
|
||||||
|
*/
|
||||||
|
private String refundDesc;
|
||||||
|
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getOrderId() {
|
||||||
|
return orderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderId(Integer orderId) {
|
||||||
|
this.orderId = orderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCouponNo() {
|
||||||
|
return couponNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCouponNo(String couponNo) {
|
||||||
|
this.couponNo = couponNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIsRefund() {
|
||||||
|
return isRefund;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsRefund(Integer isRefund) {
|
||||||
|
this.isRefund = isRefund;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getRefundAmount() {
|
||||||
|
return refundAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefundAmount(BigDecimal refundAmount) {
|
||||||
|
this.refundAmount = refundAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRefundReason() {
|
||||||
|
return refundReason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefundReason(String refundReason) {
|
||||||
|
this.refundReason = refundReason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRefundDesc() {
|
||||||
|
return refundDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefundDesc(String refundDesc) {
|
||||||
|
this.refundDesc = refundDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -2,17 +2,13 @@ package com.chaozhanggui.system.cashierservice.entity;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
/**
|
|
||||||
* 团购卷订单
|
|
||||||
*
|
|
||||||
* @author ww
|
|
||||||
* @since 2024-04-27 16:15:09
|
|
||||||
*/
|
|
||||||
@Data
|
@Data
|
||||||
public class TbGroupOrderInfo implements Serializable {
|
public class TbGroupOrderInfo implements Serializable {
|
||||||
private static final long serialVersionUID = -27465362251022601L;
|
private static final long serialVersionUID = -11810357048433715L;
|
||||||
/**
|
/**
|
||||||
* id
|
* id
|
||||||
*/
|
*/
|
||||||
@@ -21,6 +17,7 @@ public class TbGroupOrderInfo implements Serializable {
|
|||||||
* 订单编号
|
* 订单编号
|
||||||
*/
|
*/
|
||||||
private String orderNo;
|
private String orderNo;
|
||||||
|
private Integer merchantId;
|
||||||
/**
|
/**
|
||||||
* 商户Id
|
* 商户Id
|
||||||
*/
|
*/
|
||||||
@@ -33,48 +30,51 @@ public class TbGroupOrderInfo implements Serializable {
|
|||||||
* 商品id
|
* 商品id
|
||||||
*/
|
*/
|
||||||
private Integer proId;
|
private Integer proId;
|
||||||
/**
|
|
||||||
* 商品名称
|
|
||||||
*/
|
|
||||||
private String proName;
|
|
||||||
/**
|
/**
|
||||||
* 商品图
|
* 商品图
|
||||||
*/
|
*/
|
||||||
private String proImg;
|
private String proImg;
|
||||||
/**
|
/**
|
||||||
* 团购卷编号
|
* 商品名称
|
||||||
*/
|
*/
|
||||||
private String couponNo;
|
private String proName;
|
||||||
/**
|
|
||||||
* 团购卷图片
|
|
||||||
*/
|
|
||||||
private String couponUrl;
|
|
||||||
/**
|
/**
|
||||||
* 团购卷到期日期
|
* 团购卷到期日期
|
||||||
*/
|
*/
|
||||||
private Date expDate;
|
private Date expDate;
|
||||||
/**
|
/**
|
||||||
* 支付方式
|
* 订单类型 预留字段
|
||||||
*/
|
*/
|
||||||
private String orderType;
|
private String orderType;
|
||||||
|
/**
|
||||||
|
* 支付方式 wechatPay微信支付,aliPay支付宝支付
|
||||||
|
*/
|
||||||
|
private String payType;
|
||||||
/**
|
/**
|
||||||
* 订单金额
|
* 订单金额
|
||||||
*/
|
*/
|
||||||
private Double orderAmount;
|
private BigDecimal orderAmount;
|
||||||
/**
|
/**
|
||||||
* 优惠金额
|
* 优惠金额
|
||||||
*/
|
*/
|
||||||
private Double saveAmount;
|
private BigDecimal saveAmount;
|
||||||
/**
|
/**
|
||||||
* 实付金额
|
* 实付金额
|
||||||
*/
|
*/
|
||||||
private Double payAmount;
|
private BigDecimal payAmount;
|
||||||
|
/**
|
||||||
|
* 退单金额
|
||||||
|
*/
|
||||||
|
private BigDecimal refundAmount;
|
||||||
/**
|
/**
|
||||||
* 数量
|
* 数量
|
||||||
*/
|
*/
|
||||||
private Integer number;
|
private Integer number;
|
||||||
|
|
||||||
|
private Integer refundNumber;
|
||||||
/**
|
/**
|
||||||
* 订单状态
|
* 订单状态
|
||||||
|
* 状态: unpaid-待付款;unused-待使用;closed-已完成;refunding-退款中;refund-已退款;cancelled-已取消;
|
||||||
*/
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
/**
|
/**
|
||||||
@@ -90,13 +90,17 @@ public class TbGroupOrderInfo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Date payTime;
|
private Date payTime;
|
||||||
/**
|
/**
|
||||||
* 是否支持退款 0:不支持
|
* 是否支持退款 0:不支持 1:支持
|
||||||
*/
|
*/
|
||||||
private Integer refundAble;
|
private Integer refundAble;
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 卷码核销员
|
||||||
|
*/
|
||||||
|
private String verifier;
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
@@ -114,5 +118,6 @@ public class TbGroupOrderInfo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer source;
|
private Integer source;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public class TbPlatformDict implements Serializable {
|
|||||||
* 描述 同类型下 name唯一
|
* 描述 同类型下 name唯一
|
||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
private String value;
|
||||||
private String fontColor;
|
private String fontColor;
|
||||||
private String backColor;
|
private String backColor;
|
||||||
/**
|
/**
|
||||||
@@ -102,6 +103,14 @@ public class TbPlatformDict implements Serializable {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ public class TbShopInfo implements Serializable {
|
|||||||
|
|
||||||
private String industryName;
|
private String industryName;
|
||||||
|
|
||||||
|
private String businessStartDay;
|
||||||
|
private String businessEndDay;
|
||||||
private String businessTime;
|
private String businessTime;
|
||||||
|
|
||||||
private String postTime;
|
private String postTime;
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package com.chaozhanggui.system.cashierservice.entity.dto;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页数据
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class BasePageDto {
|
public class BasePageDto {
|
||||||
private Integer page = 1;
|
private Integer page = 1;
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用门店查询类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ComShopDto extends HomeBaseDto{
|
||||||
|
/**
|
||||||
|
* 连锁店名
|
||||||
|
*/
|
||||||
|
private String shopName;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CreateGroupOrderDto {
|
||||||
|
private Integer proId;
|
||||||
|
private Integer shopId;
|
||||||
|
private Integer num;
|
||||||
|
private Integer userId;
|
||||||
|
private String phone;
|
||||||
|
private BigDecimal orderAmount;
|
||||||
|
private BigDecimal payAmount;
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,11 +2,12 @@ package com.chaozhanggui.system.cashierservice.entity.dto;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询通用核心类
|
* 查询通用核心类
|
||||||
* 经纬度
|
* 经纬度
|
||||||
* 城市信息
|
* 城市信息
|
||||||
* 分页数据
|
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class HomeBaseDto extends BasePageDto{
|
public class HomeBaseDto extends BasePageDto{
|
||||||
@@ -23,8 +24,7 @@ public class HomeBaseDto extends BasePageDto{
|
|||||||
*/
|
*/
|
||||||
private String address;
|
private String address;
|
||||||
|
|
||||||
private double distanceInKm = 10;
|
private String distanceInKm;
|
||||||
|
|
||||||
//是否分页 1分页
|
|
||||||
private Integer isPage = 1;
|
private Integer isPage = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,17 @@ public class HomeDto extends HomeBaseDto {
|
|||||||
/**
|
/**
|
||||||
* 0.今日上新
|
* 0.今日上新
|
||||||
* 1.离我最近
|
* 1.离我最近
|
||||||
* 2.销量优先/热榜推荐
|
* 2.销量优先
|
||||||
* 3.价格优先
|
* 3.价格优先
|
||||||
|
* 4.热榜推荐
|
||||||
|
* 5.精选推荐
|
||||||
*/
|
*/
|
||||||
private Integer orderBy = 0;
|
private Integer orderBy = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0:今天
|
||||||
|
* 1:两小时内
|
||||||
|
*/
|
||||||
|
private Integer dateType = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ReturnGroupOrderDto {
|
||||||
|
/**
|
||||||
|
* 退单数
|
||||||
|
*/
|
||||||
|
private Integer num;
|
||||||
|
/**
|
||||||
|
* 团购订单id
|
||||||
|
*/
|
||||||
|
private Integer orderId;
|
||||||
|
/**
|
||||||
|
* 退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal refundAmount;
|
||||||
|
/**
|
||||||
|
* 退款原因
|
||||||
|
*/
|
||||||
|
private String refundReason;
|
||||||
|
/**
|
||||||
|
* 退款说明
|
||||||
|
*/
|
||||||
|
private String refundDesc;
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@ import lombok.Data;
|
|||||||
* 修改密码的 Vo 类
|
* 修改密码的 Vo 类
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class UserPassVo {
|
public class UserPassDto {
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
private String code;
|
private String code;
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||||
|
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.SysDict;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -20,5 +21,5 @@ public class CommonVo {
|
|||||||
/**
|
/**
|
||||||
* 菜单列表 不一定有
|
* 菜单列表 不一定有
|
||||||
*/
|
*/
|
||||||
private List<DicDetailVO> menu;
|
private List<SysDict> menu;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,19 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||||
|
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderCoupon;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbPurchaseNotice;
|
import com.chaozhanggui.system.cashierservice.entity.TbPurchaseNotice;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class GroupOrderDetailsVo {
|
public class GroupOrderDetailsVo {
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 商品id
|
||||||
|
*/
|
||||||
|
private Integer proId;
|
||||||
/**
|
/**
|
||||||
* 商品名称
|
* 商品名称
|
||||||
*/
|
*/
|
||||||
@@ -19,7 +26,7 @@ public class GroupOrderDetailsVo {
|
|||||||
* 可用时间说明
|
* 可用时间说明
|
||||||
* 周一至周日
|
* 周一至周日
|
||||||
*/
|
*/
|
||||||
private String avaTime;
|
private String avaTime="";
|
||||||
/**
|
/**
|
||||||
* 商品描述
|
* 商品描述
|
||||||
* 随时退·过期自动退·到店
|
* 随时退·过期自动退·到店
|
||||||
@@ -28,7 +35,7 @@ public class GroupOrderDetailsVo {
|
|||||||
/**
|
/**
|
||||||
* 订单金额
|
* 订单金额
|
||||||
*/
|
*/
|
||||||
private Double orderAmount;
|
private BigDecimal orderAmount;
|
||||||
/**
|
/**
|
||||||
* number 张可用 | 2024-04-11 23:59:59 到期
|
* number 张可用 | 2024-04-11 23:59:59 到期
|
||||||
*/
|
*/
|
||||||
@@ -41,14 +48,9 @@ public class GroupOrderDetailsVo {
|
|||||||
* 是否支持退款
|
* 是否支持退款
|
||||||
*/
|
*/
|
||||||
private Integer refundAble;
|
private Integer refundAble;
|
||||||
/**
|
|
||||||
* 卷码
|
List<TbGroupOrderCoupon> coupons;
|
||||||
*/
|
|
||||||
private List<String> couponNo;
|
|
||||||
/**
|
|
||||||
* 卷码图
|
|
||||||
*/
|
|
||||||
private List<String> couponUrl;
|
|
||||||
/**
|
/**
|
||||||
* 商家名称
|
* 商家名称
|
||||||
*/
|
*/
|
||||||
@@ -72,7 +74,7 @@ public class GroupOrderDetailsVo {
|
|||||||
/**
|
/**
|
||||||
* 购买须知
|
* 购买须知
|
||||||
*/
|
*/
|
||||||
private TbPurchaseNotice notice;
|
private TbPurchaseNotice notice=new TbPurchaseNotice();
|
||||||
/**
|
/**
|
||||||
* 订单编号
|
* 订单编号
|
||||||
*/
|
*/
|
||||||
@@ -92,30 +94,6 @@ public class GroupOrderDetailsVo {
|
|||||||
/**
|
/**
|
||||||
* 实付金额
|
* 实付金额
|
||||||
*/
|
*/
|
||||||
private Double payAmount;
|
private BigDecimal payAmount;
|
||||||
|
private BigDecimal saveAmount;
|
||||||
public void setStatus(String status) {
|
|
||||||
switch (status) {
|
|
||||||
case "unpaid":
|
|
||||||
this.status = "待付款";
|
|
||||||
break;
|
|
||||||
case "unused":
|
|
||||||
this.status = "待使用";
|
|
||||||
break;
|
|
||||||
case "closed":
|
|
||||||
this.status = "已完成";
|
|
||||||
break;
|
|
||||||
case "refunding":
|
|
||||||
this.status = "退款中";
|
|
||||||
break;
|
|
||||||
case "refund":
|
|
||||||
this.status = "已退款";
|
|
||||||
break;
|
|
||||||
case "cancelled":
|
|
||||||
this.status = "已取消";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,10 +20,6 @@ public class GroupOrderListVo {
|
|||||||
* 商品图
|
* 商品图
|
||||||
*/
|
*/
|
||||||
private String proImg;
|
private String proImg;
|
||||||
/**
|
|
||||||
* 团购卷图片
|
|
||||||
*/
|
|
||||||
private String couponUrl;
|
|
||||||
/**
|
/**
|
||||||
* 订单金额
|
* 订单金额
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ public class HomeDistrictVo{
|
|||||||
* 描述 同类型下 name唯一
|
* 描述 同类型下 name唯一
|
||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
private String value;
|
||||||
/**
|
/**
|
||||||
* 字体颜色
|
* 字体颜色
|
||||||
*/
|
*/
|
||||||
@@ -29,5 +31,7 @@ public class HomeDistrictVo{
|
|||||||
* 绝对跳转地址
|
* 绝对跳转地址
|
||||||
*/
|
*/
|
||||||
private String absUrl;
|
private String absUrl;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||||
|
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.SysDict;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -20,7 +21,7 @@ public class HomeUpVO {
|
|||||||
/**
|
/**
|
||||||
* 条件查询
|
* 条件查询
|
||||||
*/
|
*/
|
||||||
List<DicDetailVO> menu;
|
List<SysDict> menu;
|
||||||
/**
|
/**
|
||||||
* 今日上新
|
* 今日上新
|
||||||
*/
|
*/
|
||||||
@@ -74,11 +75,11 @@ public class HomeUpVO {
|
|||||||
this.district = district;
|
this.district = district;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DicDetailVO> getMenu() {
|
public List<SysDict> getMenu() {
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMenu(List<DicDetailVO> menu) {
|
public void setMenu(List<SysDict> menu) {
|
||||||
this.menu = menu;
|
this.menu = menu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import java.math.BigDecimal;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class OrderConfirmVo {
|
public class OrderConfirmVo {
|
||||||
|
private String proId;
|
||||||
|
private String shopId;
|
||||||
/**
|
/**
|
||||||
* 商品图片
|
* 商品图片
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -50,6 +50,14 @@ public class ProductInfoVo {
|
|||||||
* 店铺名称
|
* 店铺名称
|
||||||
*/
|
*/
|
||||||
private String shopName;
|
private String shopName;
|
||||||
|
/**
|
||||||
|
* 多少家店可用
|
||||||
|
*/
|
||||||
|
private Integer shopNum;
|
||||||
|
/**
|
||||||
|
* 连锁店扩展店名
|
||||||
|
*/
|
||||||
|
private String chainName;
|
||||||
/**
|
/**
|
||||||
* 联系方式
|
* 联系方式
|
||||||
*/
|
*/
|
||||||
@@ -75,5 +83,5 @@ public class ProductInfoVo {
|
|||||||
/**
|
/**
|
||||||
* 购买须知/价格说明
|
* 购买须知/价格说明
|
||||||
*/
|
*/
|
||||||
private TbPurchaseNotice purchaseNotice;
|
private TbPurchaseNotice purchaseNotice=new TbPurchaseNotice();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public class ProductVo {
|
|||||||
@Data
|
@Data
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public static class Food {
|
public static class Food {
|
||||||
|
private Integer id;
|
||||||
private String name; // 商品名称
|
private String name; // 商品名称
|
||||||
private BigDecimal lowPrice; // 售价
|
private BigDecimal lowPrice; // 售价
|
||||||
private String unitName; // 单位
|
private String unitName; // 单位
|
||||||
|
|||||||
@@ -28,4 +28,7 @@ public class ShopGroupInfoVo {
|
|||||||
//销量
|
//销量
|
||||||
private Integer number;
|
private Integer number;
|
||||||
|
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,12 @@ public class SubShopVo{
|
|||||||
* 手机号
|
* 手机号
|
||||||
*/
|
*/
|
||||||
private String phone;
|
private String phone;
|
||||||
|
/**
|
||||||
|
* 营业时间
|
||||||
|
*/
|
||||||
|
private String businessStartDay;
|
||||||
|
private String businessEndDay;
|
||||||
|
private String businessTime;
|
||||||
/**
|
/**
|
||||||
* Logo图
|
* Logo图
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ReturnOrderReq extends BaseRequest {
|
||||||
|
|
||||||
|
private String orderNumber;
|
||||||
|
|
||||||
|
private String amount;
|
||||||
|
|
||||||
|
private String mercRefundNo;
|
||||||
|
|
||||||
|
private String refundReason;
|
||||||
|
|
||||||
|
private String payPassword;
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.service;
|
||||||
|
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbGroupOrderCoupon;
|
||||||
|
import com.chaozhanggui.system.cashierservice.dao.TbGroupOrderCouponMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团购卷 卷码表(TbGroupOrderCoupon)表服务实现类
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2024-05-06 14:39:59
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class GroupOrderCouponService {
|
||||||
|
@Resource
|
||||||
|
private TbGroupOrderCouponMapper tbGroupOrderCouponMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过ID查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
public TbGroupOrderCoupon queryById(Integer id) {
|
||||||
|
return this.tbGroupOrderCouponMapper.queryById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TbGroupOrderCoupon> queryByOrderId(Integer orderId) {
|
||||||
|
return tbGroupOrderCouponMapper.queryByOrderId(orderId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TbGroupOrderCoupon> queryNoRefundByOrderId(Integer orderId) {
|
||||||
|
return tbGroupOrderCouponMapper.queryNoRefundByOrderId(orderId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TbGroupOrderCoupon insert(TbGroupOrderCoupon tbGroupOrderCoupon) {
|
||||||
|
this.tbGroupOrderCouponMapper.insert(tbGroupOrderCoupon);
|
||||||
|
return tbGroupOrderCoupon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TbGroupOrderCoupon update(TbGroupOrderCoupon tbGroupOrderCoupon) {
|
||||||
|
this.tbGroupOrderCouponMapper.update(tbGroupOrderCoupon);
|
||||||
|
return this.queryById(tbGroupOrderCoupon.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.service;
|
package com.chaozhanggui.system.cashierservice.service;
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbProductMapper;
|
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbPurchaseNoticeMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbShopInfoMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbGroupOrderInfoMapper;
|
import com.chaozhanggui.system.cashierservice.entity.dto.CreateGroupOrderDto;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.GroupOrderDto;
|
import com.chaozhanggui.system.cashierservice.entity.dto.GroupOrderDto;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.vo.GroupOrderDetailsVo;
|
import com.chaozhanggui.system.cashierservice.entity.vo.GroupOrderDetailsVo;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.vo.GroupOrderListVo;
|
import com.chaozhanggui.system.cashierservice.entity.vo.GroupOrderListVo;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.vo.ProductVo;
|
import com.chaozhanggui.system.cashierservice.entity.vo.ProductVo;
|
||||||
|
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.util.LocationUtils;
|
import com.chaozhanggui.system.cashierservice.util.LocationUtils;
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -22,18 +22,23 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Arrays;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class GroupOrderInfoService{
|
public class GroupOrderInfoService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private TbShopInfoMapper shopInfoMapper;
|
private TbShopInfoMapper shopInfoMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TbProductMapper tbProductMapper;
|
private TbProductMapper tbProductMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private TbGroupOrderInfoMapper tbGroupOrderInfoMapper;
|
private TbGroupOrderInfoMapper tbGroupOrderInfoMapper;
|
||||||
|
@Autowired
|
||||||
|
private GroupOrderCouponService groupOrderCouponService;
|
||||||
|
@Autowired
|
||||||
|
private TbMerchantAccountMapper merchantAccountMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private TbPurchaseNoticeMapper noticeMapper;
|
private TbPurchaseNoticeMapper noticeMapper;
|
||||||
|
|
||||||
@@ -43,23 +48,33 @@ public class GroupOrderInfoService{
|
|||||||
* @param id 主键
|
* @param id 主键
|
||||||
* @return 实例对象
|
* @return 实例对象
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public Result queryById(Integer id,String lng,String lat) {
|
public Result queryById(Integer id, String lng, String lat) {
|
||||||
TbGroupOrderInfo groupOrder = tbGroupOrderInfoMapper.queryById(id);
|
TbGroupOrderInfo groupOrder = tbGroupOrderInfoMapper.queryById(id);
|
||||||
GroupOrderDetailsVo result=new GroupOrderDetailsVo();
|
GroupOrderDetailsVo result = new GroupOrderDetailsVo();
|
||||||
|
result.setId(id);
|
||||||
|
result.setProId(groupOrder.getProId());
|
||||||
result.setProName(groupOrder.getProName());
|
result.setProName(groupOrder.getProName());
|
||||||
result.setProImg(groupOrder.getProImg());
|
result.setProImg(groupOrder.getProImg());
|
||||||
TbPurchaseNotice tbPurchaseNotice = noticeMapper.queryByCouponId(groupOrder.getProId());
|
TbPurchaseNotice tbPurchaseNotice = noticeMapper.queryByCouponId(groupOrder.getProId());
|
||||||
result.setAvaTime(tbPurchaseNotice.getAvailableTime()+" | 到店吃");
|
if(tbPurchaseNotice!=null){
|
||||||
// result.setProDetail();
|
result.setAvaTime(tbPurchaseNotice.getAvailableTime()+" | 到店吃");
|
||||||
|
result.setNotice(tbPurchaseNotice);
|
||||||
|
}
|
||||||
|
// result.setProDetail(); //随时退·过期自动退·到店
|
||||||
result.setOrderAmount(groupOrder.getOrderAmount());
|
result.setOrderAmount(groupOrder.getOrderAmount());
|
||||||
|
|
||||||
result.setExpDate(groupOrder.getNumber()+"张可用 | "+ DateUtils.getTimeM(groupOrder.getExpDate()));
|
if(!groupOrder.getStatus().equals("unpaid")){
|
||||||
|
if(!groupOrder.getStatus().equals("closed")){
|
||||||
|
result.setExpDate(groupOrder.getNumber()-
|
||||||
|
groupOrder.getRefundNumber() + "张可用 | " +
|
||||||
|
DateUtils.getTimeM(
|
||||||
|
groupOrder.getExpDate())+" 到期");
|
||||||
|
}
|
||||||
|
}
|
||||||
result.setRefundAble(groupOrder.getRefundAble());
|
result.setRefundAble(groupOrder.getRefundAble());
|
||||||
List<String> coupons = Arrays.asList(groupOrder.getCouponNo().split(","));
|
List<TbGroupOrderCoupon> tbGroupOrderCoupons = groupOrderCouponService.queryByOrderId(id);
|
||||||
List<String> couponUrls = Arrays.asList(groupOrder.getCouponUrl().split(","));
|
result.setCoupons(tbGroupOrderCoupons);
|
||||||
result.setCouponNo(coupons);
|
|
||||||
result.setCouponUrl(couponUrls);
|
|
||||||
|
|
||||||
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(groupOrder.getShopId());
|
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(groupOrder.getShopId());
|
||||||
result.setShopName(shopInfo.getShopName());
|
result.setShopName(shopInfo.getShopName());
|
||||||
@@ -73,67 +88,90 @@ public class GroupOrderInfoService{
|
|||||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(groupOrder.getProId());
|
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(groupOrder.getProId());
|
||||||
result.setTagVos(JSONUtil.parseListTNewList(product.getGroupSnap(), ProductVo.class));
|
result.setTagVos(JSONUtil.parseListTNewList(product.getGroupSnap(), ProductVo.class));
|
||||||
|
|
||||||
result.setNotice(tbPurchaseNotice);
|
|
||||||
|
|
||||||
result.setOrderNo(groupOrder.getOrderNo());
|
result.setOrderNo(groupOrder.getOrderNo());
|
||||||
result.setPhone(groupOrder.getPhone());
|
result.setPhone(groupOrder.getPhone());
|
||||||
result.setPayTime(DateUtils.getTime(groupOrder.getPayTime()));
|
if (groupOrder.getPayTime() != null) {
|
||||||
|
result.setPayTime(DateUtils.getTime(groupOrder.getPayTime()));
|
||||||
|
}
|
||||||
result.setNumber(groupOrder.getNumber());
|
result.setNumber(groupOrder.getNumber());
|
||||||
result.setPayAmount(groupOrder.getPayAmount());
|
result.setPayAmount(groupOrder.getPayAmount());
|
||||||
return Result.success(CodeEnum.SUCCESS,result);
|
result.setSaveAmount(groupOrder.getSaveAmount());
|
||||||
|
result.setStatus(groupOrder.getStatus());
|
||||||
|
return Result.success(CodeEnum.SUCCESS, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
|
*
|
||||||
* @return 查询结果
|
* @return 查询结果
|
||||||
*/
|
*/
|
||||||
public Result queryByPage(GroupOrderDto param) {
|
public Result queryByPage(GroupOrderDto param) {
|
||||||
PageHelper.startPage(param.getPage(), param.getSize());
|
PageHelper.startPage(param.getPage(), param.getSize());
|
||||||
List<GroupOrderListVo> tbGroupOrderInfos = tbGroupOrderInfoMapper.queryAll(param);
|
return new Result(CodeEnum.SUCCESS,new PageInfo<>(tbGroupOrderInfoMapper.queryAll(param)));
|
||||||
return Result.success(CodeEnum.SUCCESS,new PageInfo(tbGroupOrderInfos));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增数据
|
* 新增数据
|
||||||
*
|
*
|
||||||
* @param tbGroupOrderInfo 实例对象
|
|
||||||
* @return 实例对象
|
* @return 实例对象
|
||||||
*/
|
*/
|
||||||
|
public Result insert(CreateGroupOrderDto param) {
|
||||||
public Result insert(TbGroupOrderInfo tbGroupOrderInfo) {
|
TbMerchantAccount tbMerchantAccount = merchantAccountMapper.selectByShopId(param.getShopId().toString());
|
||||||
|
if (tbMerchantAccount == null) {
|
||||||
|
throw new MsgException("生成订单错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
TbGroupOrderInfo tbGroupOrderInfo = new TbGroupOrderInfo();
|
||||||
|
tbGroupOrderInfo.setOrderNo(generateOrderNumber());
|
||||||
|
tbGroupOrderInfo.setMerchantId(tbMerchantAccount.getId());
|
||||||
|
tbGroupOrderInfo.setShopId(param.getShopId());
|
||||||
|
tbGroupOrderInfo.setProId(param.getProId());
|
||||||
|
tbGroupOrderInfo.setUserId(param.getUserId());
|
||||||
|
tbGroupOrderInfo.setPhone(param.getPhone());
|
||||||
|
TbProduct tbProduct = tbProductMapper.selectById(param.getProId());
|
||||||
|
tbGroupOrderInfo.setProImg(tbProduct.getCoverImg());
|
||||||
|
tbGroupOrderInfo.setProName(tbProduct.getName());
|
||||||
|
tbGroupOrderInfo.setNumber(param.getNum());
|
||||||
|
tbGroupOrderInfo.setRefundNumber(0);
|
||||||
|
tbGroupOrderInfo.setOrderAmount(param.getOrderAmount());
|
||||||
|
tbGroupOrderInfo.setRefundAmount(BigDecimal.ZERO);
|
||||||
|
tbGroupOrderInfo.setSaveAmount(param.getOrderAmount().subtract(param.getPayAmount()));
|
||||||
|
tbGroupOrderInfo.setPayAmount(param.getPayAmount());
|
||||||
|
tbGroupOrderInfo.setStatus("unpaid");
|
||||||
|
tbGroupOrderInfo.setRemark(param.getRemark());
|
||||||
|
tbGroupOrderInfo.setCreateTime(new Date());
|
||||||
|
tbGroupOrderInfo.setTradeDay(new Date());
|
||||||
|
tbGroupOrderInfo.setRefundAble(1);
|
||||||
int insert = tbGroupOrderInfoMapper.insert(tbGroupOrderInfo);
|
int insert = tbGroupOrderInfoMapper.insert(tbGroupOrderInfo);
|
||||||
if(insert>0){
|
if (insert > 0) {
|
||||||
return new Result(CodeEnum.SUCCESS);
|
return new Result(CodeEnum.SUCCESS,tbGroupOrderInfo);
|
||||||
}else {
|
} else {
|
||||||
return new Result(CodeEnum.FAIL);
|
return new Result(CodeEnum.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String generateOrderNumber() {
|
||||||
|
String date = DateUtils.getSdfTimes();
|
||||||
|
Random random = new Random();
|
||||||
|
int randomNum = random.nextInt(900) + 100;
|
||||||
|
return "GP" + date + randomNum;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改数据
|
* 修改数据
|
||||||
*
|
*
|
||||||
* @param tbGroupOrderInfo 实例对象
|
* @param tbGroupOrderInfo 实例对象
|
||||||
* @return 实例对象
|
* @return 实例对象
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public Result update(TbGroupOrderInfo tbGroupOrderInfo) {
|
public Result update(TbGroupOrderInfo tbGroupOrderInfo) {
|
||||||
int update = tbGroupOrderInfoMapper.update(tbGroupOrderInfo);
|
int update = tbGroupOrderInfoMapper.update(tbGroupOrderInfo);
|
||||||
if(update>0){
|
if (update > 0) {
|
||||||
return new Result(CodeEnum.SUCCESS);
|
return new Result(CodeEnum.SUCCESS);
|
||||||
}else {
|
} else {
|
||||||
return new Result(CodeEnum.FAIL);
|
return new Result(CodeEnum.FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过主键删除数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 是否成功
|
|
||||||
*/
|
|
||||||
|
|
||||||
public boolean deleteById(Integer id) {
|
|
||||||
return this.tbGroupOrderInfoMapper.deleteById(id) > 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.service;
|
package com.chaozhanggui.system.cashierservice.service;
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.dao.SysDictDetailMapper;
|
import com.chaozhanggui.system.cashierservice.dao.SysDictMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbCouponCategoryMapper;
|
import com.chaozhanggui.system.cashierservice.dao.TbCouponCategoryMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbPlatformDictMapper;
|
import com.chaozhanggui.system.cashierservice.dao.TbPlatformDictMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbShopInfoMapper;
|
import com.chaozhanggui.system.cashierservice.dao.TbShopInfoMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.SysDict;
|
import com.chaozhanggui.system.cashierservice.entity.SysDict;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbCouponCategory;
|
import com.chaozhanggui.system.cashierservice.entity.TbCouponCategory;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.dto.ComShopDto;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.HomeBaseDto;
|
import com.chaozhanggui.system.cashierservice.entity.dto.HomeBaseDto;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
|
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.vo.*;
|
import com.chaozhanggui.system.cashierservice.entity.vo.*;
|
||||||
@@ -26,7 +27,6 @@ import java.math.BigDecimal;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -41,7 +41,8 @@ public class HomeDistrictService {
|
|||||||
@Resource
|
@Resource
|
||||||
private TbCouponCategoryMapper couponCategoryMapper;
|
private TbCouponCategoryMapper couponCategoryMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private SysDictDetailMapper sysDictDetailMapper;
|
// private SysDictDetailMapper sysDictDetailMapper;
|
||||||
|
private SysDictMapper sysDictMapper;
|
||||||
|
|
||||||
public Result topCommon(HomeDto param, String environment){
|
public Result topCommon(HomeDto param, String environment){
|
||||||
CommonVo result = new CommonVo();
|
CommonVo result = new CommonVo();
|
||||||
@@ -55,22 +56,17 @@ public class HomeDistrictService {
|
|||||||
}else {//商品分类页
|
}else {//商品分类页
|
||||||
TbCouponCategory tbCouponCategory = couponCategoryMapper.queryById(Integer.valueOf(param.getType()));
|
TbCouponCategory tbCouponCategory = couponCategoryMapper.queryById(Integer.valueOf(param.getType()));
|
||||||
result.setTitle(tbCouponCategory.getName());
|
result.setTitle(tbCouponCategory.getName());
|
||||||
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType(param.getType(), environment);
|
List<TbPlatformDict> carouselList = platformDictMapper.queryGroupByValue(param.getType(), environment);
|
||||||
if (!CollectionUtils.isEmpty(carouselList)) {
|
if (!CollectionUtils.isEmpty(carouselList)) {
|
||||||
result.setCarousel(JSONUtil.parseListTNewList(carouselList, HomeCarouselVo.class));
|
result.setCarousel(JSONUtil.parseListTNewList(carouselList, HomeCarouselVo.class));
|
||||||
}
|
}
|
||||||
List<SysDict> sysDicts = sysDictDetailMapper.selectByType(null);
|
List<SysDict> sysDicts = sysDictMapper.selectByType(null);
|
||||||
List<DicDetailVO> dicDetailVO = new ArrayList<>();
|
for (SysDict sysDict : sysDicts) {
|
||||||
for (SysDict sysDictsList : sysDicts) {
|
if (sysDict.getIsChild()==1) {
|
||||||
DicDetailVO dicDetailVOList = new DicDetailVO();
|
sysDict.setDetail(sysDictMapper.selectByDictId(sysDict.getDictId()));
|
||||||
dicDetailVOList.setDictName(sysDictsList.getDictName());
|
}
|
||||||
dicDetailVOList.setName(sysDictsList.getName());
|
|
||||||
dicDetailVOList.setDescription(sysDictsList.getDescription());
|
|
||||||
dicDetailVOList.setDetail(sysDictDetailMapper.selectByDictId(sysDictsList.getDictId()));
|
|
||||||
dicDetailVOList.setIsChild((sysDictsList.getIsChild() == null || sysDictsList.getIsChild() == 0) ? false : true);
|
|
||||||
dicDetailVO.add(dicDetailVOList);
|
|
||||||
}
|
}
|
||||||
result.setMenu(dicDetailVO);
|
result.setMenu(sysDicts);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (param.getOrderBy() != null) {
|
if (param.getOrderBy() != null) {
|
||||||
@@ -80,23 +76,19 @@ public class HomeDistrictService {
|
|||||||
result.setCarousel(JSONUtil.parseListTNewList(carouselList, HomeCarouselVo.class));
|
result.setCarousel(JSONUtil.parseListTNewList(carouselList, HomeCarouselVo.class));
|
||||||
}
|
}
|
||||||
result.setTitle("今日上新");
|
result.setTitle("今日上新");
|
||||||
} else if (param.getOrderBy() == 2) {
|
} else if (param.getOrderBy() == 4) {
|
||||||
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType("hotCoupon", environment);
|
List<TbPlatformDict> carouselList = platformDictMapper.queryAllByType("hotCoupon", environment);
|
||||||
if (!CollectionUtils.isEmpty(carouselList)) {
|
if (!CollectionUtils.isEmpty(carouselList)) {
|
||||||
result.setCarousel(JSONUtil.parseListTNewList(carouselList, HomeCarouselVo.class));
|
result.setCarousel(JSONUtil.parseListTNewList(carouselList, HomeCarouselVo.class));
|
||||||
}
|
}
|
||||||
result.setTitle("热榜推荐");
|
result.setTitle("热榜推荐");
|
||||||
List<SysDict> sysDicts = sysDictDetailMapper.selectHot();
|
List<SysDict> sysDicts = sysDictMapper.selectHot();
|
||||||
List<DicDetailVO> dicDetailVO = new ArrayList<>();
|
for (SysDict sysDict : sysDicts) {
|
||||||
for (SysDict sysDictsList : sysDicts) {
|
if (sysDict.getIsChild()==1) {
|
||||||
DicDetailVO dicDetailVOList = new DicDetailVO();
|
sysDict.setDetail(sysDictMapper.selectByDictId(sysDict.getDictId()));
|
||||||
dicDetailVOList.setDictName(sysDictsList.getDictName());
|
}
|
||||||
dicDetailVOList.setName(sysDictsList.getName());
|
|
||||||
dicDetailVOList.setDescription(sysDictsList.getDescription());
|
|
||||||
dicDetailVOList.setIsChild((sysDictsList.getIsChild() == null || sysDictsList.getIsChild() == 0) ? false : true);
|
|
||||||
dicDetailVO.add(dicDetailVOList);
|
|
||||||
}
|
}
|
||||||
result.setMenu(dicDetailVO);
|
result.setMenu(sysDicts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,7 +106,7 @@ public class HomeDistrictService {
|
|||||||
topAndBottomMap.get("rightTopPoint")[0],//34.39724773780949
|
topAndBottomMap.get("rightTopPoint")[0],//34.39724773780949
|
||||||
topAndBottomMap.get("leftBottomPoint")[1],
|
topAndBottomMap.get("leftBottomPoint")[1],
|
||||||
topAndBottomMap.get("leftBottomPoint")[0],
|
topAndBottomMap.get("leftBottomPoint")[0],
|
||||||
param.getAddress(), param.getLng(), param.getLat());//西安市
|
param.getAddress(), param.getLng(), param.getLat(),null);//西安市
|
||||||
for (SubShopVo subShopVo : subShopVos) {//距离计算
|
for (SubShopVo subShopVo : subShopVos) {//距离计算
|
||||||
if (StringUtils.isNotBlank(subShopVo.getLat()) && StringUtils.isNotBlank(subShopVo.getLng())) {
|
if (StringUtils.isNotBlank(subShopVo.getLat()) && StringUtils.isNotBlank(subShopVo.getLng())) {
|
||||||
BigDecimal distance = LocationUtils.getDistanceFrom2LngLat(
|
BigDecimal distance = LocationUtils.getDistanceFrom2LngLat(
|
||||||
@@ -123,17 +115,38 @@ public class HomeDistrictService {
|
|||||||
subShopVo.setDistances(distance.toString());
|
subShopVo.setDistances(distance.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PageInfo pageInfo = new PageInfo();
|
return Result.success(CodeEnum.SUCCESS, new PageInfo(subShopVos));
|
||||||
pageInfo.setList(subShopVos);
|
|
||||||
return Result.success(CodeEnum.SUCCESS, pageInfo);
|
}
|
||||||
|
|
||||||
|
public Result queryComShopList(ComShopDto param) {
|
||||||
|
Map<String, double[]> topAndBottomMap = LocationUtils.returnLLSquarePoint(
|
||||||
|
Double.parseDouble(param.getLng()),
|
||||||
|
Double.parseDouble(param.getLat()),
|
||||||
|
param.getDistanceInKm());
|
||||||
|
List<SubShopVo> subShopVos = shopInfoMapper.selShopInfoByGps(
|
||||||
|
topAndBottomMap.get("rightTopPoint")[1],//109.06198684730003
|
||||||
|
topAndBottomMap.get("rightTopPoint")[0],//34.39724773780949
|
||||||
|
topAndBottomMap.get("leftBottomPoint")[1],
|
||||||
|
topAndBottomMap.get("leftBottomPoint")[0],
|
||||||
|
param.getAddress(), param.getLng(), param.getLat(),param.getShopName());//西安市
|
||||||
|
for (SubShopVo subShopVo : subShopVos) {//距离计算
|
||||||
|
subShopVo.setBusinessTime(subShopVo.getBusinessStartDay()+"至"+subShopVo.getBusinessEndDay()+" "+subShopVo.getBusinessTime());
|
||||||
|
if (StringUtils.isNotBlank(subShopVo.getLat()) && StringUtils.isNotBlank(subShopVo.getLng())) {
|
||||||
|
BigDecimal distance = LocationUtils.getDistanceFrom2LngLat(
|
||||||
|
Double.parseDouble(param.getLng()), Double.parseDouble(param.getLat()),
|
||||||
|
Double.parseDouble(subShopVo.getLng()), Double.parseDouble(subShopVo.getLat()));
|
||||||
|
subShopVo.setDistances(distance.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.success(CodeEnum.SUCCESS, subShopVos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用商品页
|
* 通用商品页
|
||||||
*/
|
*/
|
||||||
public Result proList(HomeDto param) throws ExecutionException, InterruptedException {
|
public Result proList(HomeDto param) {
|
||||||
PageInfo products = productService.products(param);
|
return Result.success(CodeEnum.SUCCESS, productService.products(param));
|
||||||
return Result.success(CodeEnum.SUCCESS, products);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.service;
|
package com.chaozhanggui.system.cashierservice.service;
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.dao.SysDictDetailMapper;
|
import com.chaozhanggui.system.cashierservice.dao.SysDictMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbPlatformDictMapper;
|
import com.chaozhanggui.system.cashierservice.dao.TbPlatformDictMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbProductSkuMapper;
|
import com.chaozhanggui.system.cashierservice.dao.TbProductSkuMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.Enum.LogoEnum;
|
import com.chaozhanggui.system.cashierservice.entity.Enum.LogoEnum;
|
||||||
@@ -11,6 +11,7 @@ import com.chaozhanggui.system.cashierservice.entity.vo.*;
|
|||||||
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
|
import com.chaozhanggui.system.cashierservice.util.BigDecimalUtils;
|
||||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.util.RandomUtil;
|
import com.chaozhanggui.system.cashierservice.util.RandomUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.util.StringUtil;
|
import com.chaozhanggui.system.cashierservice.util.StringUtil;
|
||||||
@@ -37,7 +38,7 @@ public class HomePageService {
|
|||||||
@Resource
|
@Resource
|
||||||
private TbPlatformDictMapper platformDictMapper;
|
private TbPlatformDictMapper platformDictMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private SysDictDetailMapper sysDictDetailMapper;
|
private SysDictMapper sysDictMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private ProductService productService;
|
private ProductService productService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -53,18 +54,13 @@ public class HomePageService {
|
|||||||
homeUpVO.setDistrict(JSONUtil.parseListTNewList(districtList, HomeDistrictVo.class));
|
homeUpVO.setDistrict(JSONUtil.parseListTNewList(districtList, HomeDistrictVo.class));
|
||||||
|
|
||||||
//菜单
|
//菜单
|
||||||
List<SysDict> sysDicts = sysDictDetailMapper.selectByType("home");
|
List<SysDict> sysDicts = sysDictMapper.selectByType("home");
|
||||||
List<DicDetailVO> dicDetailVO = new ArrayList<>();
|
for (SysDict sysDict : sysDicts) {
|
||||||
for (SysDict sysDictsList : sysDicts) {
|
if (sysDict.getIsChild()==1) {
|
||||||
DicDetailVO dicDetailVOList = new DicDetailVO();
|
sysDict.setDetail(sysDictMapper.selectByDictId(sysDict.getDictId()));
|
||||||
dicDetailVOList.setDictName(sysDictsList.getDictName());
|
}
|
||||||
dicDetailVOList.setName(sysDictsList.getName());
|
|
||||||
dicDetailVOList.setDescription(sysDictsList.getDescription());
|
|
||||||
dicDetailVOList.setDetail(sysDictDetailMapper.selectByDictId(sysDictsList.getDictId()));
|
|
||||||
dicDetailVOList.setIsChild((sysDictsList.getIsChild() == null || sysDictsList.getIsChild() == 0) ? false : true);
|
|
||||||
dicDetailVO.add(dicDetailVOList);
|
|
||||||
}
|
}
|
||||||
homeUpVO.setMenu(dicDetailVO);
|
homeUpVO.setMenu(sysDicts);
|
||||||
/**
|
/**
|
||||||
* 销量榜
|
* 销量榜
|
||||||
*/
|
*/
|
||||||
@@ -72,8 +68,7 @@ public class HomePageService {
|
|||||||
for (HomeVO o : homeVOs) {
|
for (HomeVO o : homeVOs) {
|
||||||
BigDecimal originPrice = o.getOriginPrice();
|
BigDecimal originPrice = o.getOriginPrice();
|
||||||
if (originPrice.compareTo(BigDecimal.ZERO) != 0) {
|
if (originPrice.compareTo(BigDecimal.ZERO) != 0) {
|
||||||
BigDecimal multiply = o.getSalePrice().divide(o.getOriginPrice(), 2, RoundingMode.DOWN).multiply(BigDecimal.TEN);
|
o.setDiscount(BigDecimalUtils.getDiscount(o.getOriginPrice(),o.getSalePrice()));
|
||||||
o.setDiscount(multiply);
|
|
||||||
} else {
|
} else {
|
||||||
o.setDiscount(null);
|
o.setDiscount(null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.service;
|
package com.chaozhanggui.system.cashierservice.service;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.vo.CashierCarVo;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.vo.OrderVo;
|
import com.chaozhanggui.system.cashierservice.entity.vo.OrderVo;
|
||||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||||
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
|
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
|
||||||
@@ -14,25 +11,19 @@ import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
|||||||
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import com.chaozhanggui.system.cashierservice.socket.AppWebSocketServer;
|
|
||||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||||
import com.chaozhanggui.system.cashierservice.util.N;
|
import com.chaozhanggui.system.cashierservice.util.N;
|
||||||
import com.chaozhanggui.system.cashierservice.util.RedisUtils;
|
import com.chaozhanggui.system.cashierservice.util.RedisUtils;
|
||||||
import com.chaozhanggui.system.cashierservice.util.SnowFlakeUtil;
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.awt.print.Pageable;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.time.Instant;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -209,18 +200,12 @@ public class OrderService {
|
|||||||
|
|
||||||
|
|
||||||
public Result orderList(Integer userId, Integer page, Integer size, String status) {
|
public Result orderList(Integer userId, Integer page, Integer size, String status) {
|
||||||
TbUserInfo tbUserInfo = userInfoMapper.selectByPrimaryKey(userId);
|
// TbUserInfo tbUserInfo = userInfoMapper.selectByPrimaryKey(userId);
|
||||||
if (tbUserInfo == null) {
|
// if (tbUserInfo == null) {
|
||||||
return Result.fail("生成订单失败");
|
// return Result.fail("获取订单失败");
|
||||||
}
|
// }
|
||||||
//获取页码号
|
PageHelper.startPage(page, size);
|
||||||
int beginNo;
|
List<TbOrderInfo> tbOrderInfos = orderInfoMapper.selectByUserId(userId, status);
|
||||||
if (page <= 0) {
|
|
||||||
beginNo = 0;
|
|
||||||
} else {
|
|
||||||
beginNo = (page - 1) * size;
|
|
||||||
}
|
|
||||||
List<TbOrderInfo> tbOrderInfos = orderInfoMapper.selectByUserId(userId, beginNo, size, status);
|
|
||||||
|
|
||||||
for (TbOrderInfo orderInfo : tbOrderInfos) {
|
for (TbOrderInfo orderInfo : tbOrderInfos) {
|
||||||
List<TbOrderDetail> list = tbOrderDetailMapper.selectAllByOrderId(orderInfo.getId());
|
List<TbOrderDetail> list = tbOrderDetailMapper.selectAllByOrderId(orderInfo.getId());
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.service;
|
package com.chaozhanggui.system.cashierservice.service;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.dto.ReturnGroupOrderDto;
|
||||||
|
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||||
import com.chaozhanggui.system.cashierservice.model.PayReq;
|
import com.chaozhanggui.system.cashierservice.model.PayReq;
|
||||||
|
import com.chaozhanggui.system.cashierservice.model.ReturnOrderReq;
|
||||||
import com.chaozhanggui.system.cashierservice.model.TradeQueryReq;
|
import com.chaozhanggui.system.cashierservice.model.TradeQueryReq;
|
||||||
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
|
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
|
||||||
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
||||||
@@ -28,16 +32,14 @@ import org.springframework.web.client.RestTemplate;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.time.LocalDateTime;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class PayService {
|
public class PayService {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TbOrderInfoMapper tbOrderInfoMapper;
|
TbOrderInfoMapper tbOrderInfoMapper;
|
||||||
|
|
||||||
@@ -53,7 +55,11 @@ public class PayService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TbOrderDetailMapper tbOrderDetailMapper;
|
TbOrderDetailMapper tbOrderDetailMapper;
|
||||||
|
@Autowired
|
||||||
|
private TbMerchantAccountMapper merchantAccountMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private GroupOrderCouponService groupOrderCouponService;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -66,12 +72,13 @@ public class PayService {
|
|||||||
@Value("${ysk.callBackurl}")
|
@Value("${ysk.callBackurl}")
|
||||||
private String callBackurl;
|
private String callBackurl;
|
||||||
|
|
||||||
|
@Value("${ysk.callBackGroupurl}")
|
||||||
|
private String callBackGroupurl;
|
||||||
|
|
||||||
@Value("${ysk.callBackIn}")
|
@Value("${ysk.callBackIn}")
|
||||||
private String callBackIn;
|
private String callBackIn;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TbCashierCartMapper tbCashierCartMapper;
|
private TbCashierCartMapper tbCashierCartMapper;
|
||||||
|
|
||||||
@@ -94,37 +101,47 @@ public class PayService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TbShopUserFlowMapper tbShopUserFlowMapper;
|
TbShopUserFlowMapper tbShopUserFlowMapper;
|
||||||
|
@Resource
|
||||||
|
private TbGroupOrderInfoMapper tbGroupOrderInfoMapper;
|
||||||
|
@Autowired
|
||||||
|
private TbProductMapper tbProductMapper;
|
||||||
|
@Resource
|
||||||
|
private GroupOrderCouponService orderCouponService;
|
||||||
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Result payOrder(String openId,String orderId,String ip) throws Exception {
|
public Result payOrder(String openId, String orderId,String payType, String ip) throws Exception {
|
||||||
TbOrderInfo orderInfo= tbOrderInfoMapper.selectByPrimaryKey(Integer.valueOf(orderId));
|
TbOrderInfo orderInfo = tbOrderInfoMapper.selectByPrimaryKey(Integer.valueOf(orderId));
|
||||||
|
|
||||||
if(!"unpaid".equals(orderInfo.getStatus())&&!"paying".equals(orderInfo.getStatus())){
|
if (!"unpaid".equals(orderInfo.getStatus()) && !"paying".equals(orderInfo.getStatus())) {
|
||||||
return Result.fail("订单状态异常,不允许支付");
|
return Result.fail("订单状态异常,不允许支付");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ObjectUtil.isNull(orderInfo.getMerchantId())||ObjectUtil.isEmpty(orderInfo.getMerchantId())){
|
if (ObjectUtil.isNull(orderInfo.getMerchantId()) || ObjectUtil.isEmpty(orderInfo.getMerchantId())) {
|
||||||
return Result.fail("没有对应的商户");
|
return Result.fail("没有对应的商户");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TbMerchantThirdApply thirdApply= tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getMerchantId()));
|
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getMerchantId()));
|
||||||
|
|
||||||
if(ObjectUtil.isEmpty(thirdApply)||ObjectUtil.isNull(thirdApply)){
|
if (ObjectUtil.isEmpty(thirdApply) || ObjectUtil.isNull(thirdApply)) {
|
||||||
return Result.fail("支付通道不存在");
|
return Result.fail("支付通道不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
TbOrderPayment payment=tbOrderPaymentMapper.selectByOrderId(orderId);
|
TbOrderPayment payment = tbOrderPaymentMapper.selectByOrderId(orderId);
|
||||||
if(ObjectUtil.isEmpty(payment)||payment==null){
|
if (ObjectUtil.isEmpty(payment) || payment == null) {
|
||||||
payment=new TbOrderPayment();
|
payment = new TbOrderPayment();
|
||||||
payment.setPayTypeId("ysk");
|
payment.setPayTypeId("ysk");
|
||||||
payment.setAmount(orderInfo.getOrderAmount());
|
payment.setAmount(orderInfo.getOrderAmount());
|
||||||
payment.setPaidAmount(orderInfo.getPayAmount());
|
payment.setPaidAmount(orderInfo.getPayAmount());
|
||||||
payment.setHasRefundAmount(BigDecimal.ZERO);
|
payment.setHasRefundAmount(BigDecimal.ZERO);
|
||||||
payment.setPayName("微信支付");
|
if (payType.equals("wechatPay")) {
|
||||||
payment.setPayType("wechatPay");
|
payment.setPayName("微信支付");
|
||||||
|
payment.setPayType("wechatPay");
|
||||||
|
} else if (payType.equals("aliPay")) {
|
||||||
|
payment.setPayName("支付宝支付");
|
||||||
|
payment.setPayType("aliPay");
|
||||||
|
}
|
||||||
payment.setReceived(payment.getAmount());
|
payment.setReceived(payment.getAmount());
|
||||||
payment.setChangeFee(BigDecimal.ZERO);
|
payment.setChangeFee(BigDecimal.ZERO);
|
||||||
payment.setMemberId(orderInfo.getMemberId());
|
payment.setMemberId(orderInfo.getMemberId());
|
||||||
@@ -132,32 +149,41 @@ public class PayService {
|
|||||||
payment.setOrderId(orderInfo.getId().toString());
|
payment.setOrderId(orderInfo.getId().toString());
|
||||||
payment.setCreatedAt(System.currentTimeMillis());
|
payment.setCreatedAt(System.currentTimeMillis());
|
||||||
tbOrderPaymentMapper.insert(payment);
|
tbOrderPaymentMapper.insert(payment);
|
||||||
}else {
|
} else {
|
||||||
|
if (payType.equals("wechatPay")) {
|
||||||
|
payment.setPayName("微信支付");
|
||||||
|
payment.setPayType("wechatPay");
|
||||||
|
} else if (payType.equals("aliPay")) {
|
||||||
|
payment.setPayName("支付宝支付");
|
||||||
|
payment.setPayType("aliPay");
|
||||||
|
}
|
||||||
payment.setUpdatedAt(System.currentTimeMillis());
|
payment.setUpdatedAt(System.currentTimeMillis());
|
||||||
tbOrderPaymentMapper.updateByPrimaryKey(payment);
|
tbOrderPaymentMapper.updateByPrimaryKey(payment);
|
||||||
}
|
}
|
||||||
|
|
||||||
PayReq req=new PayReq();
|
PayReq req = new PayReq();
|
||||||
|
|
||||||
req.setAppId(thirdApply.getAppId());
|
req.setAppId(thirdApply.getAppId());
|
||||||
req.setTimestamp(System.currentTimeMillis());
|
req.setTimestamp(System.currentTimeMillis());
|
||||||
req.setIp(ip);
|
req.setIp(ip);
|
||||||
req.setMercOrderNo(orderInfo.getOrderNo());
|
req.setMercOrderNo(orderInfo.getOrderNo());
|
||||||
req.setNotifyUrl(callBackurl);
|
req.setNotifyUrl(callBackurl);
|
||||||
req.setPayAmt(payment.getAmount().setScale(2,BigDecimal.ROUND_DOWN).toPlainString());
|
req.setPayAmt(payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
|
||||||
req.setPayType("03");
|
if (payType.equals("wechatPay")) {
|
||||||
req.setPayWay("WXZF");
|
req.setPayType("03");
|
||||||
|
req.setPayWay("WXZF");//WXZF ZFBZF UNIONPAY
|
||||||
|
} else if (payType.equals("aliPay")) {
|
||||||
|
req.setPayWay("ZFBZF");
|
||||||
|
}
|
||||||
req.setSubject("扫码点餐");
|
req.setSubject("扫码点餐");
|
||||||
req.setUserId(openId);
|
req.setUserId(openId);
|
||||||
|
|
||||||
|
Map<String, Object> map = BeanUtil.transBeanMap(req);
|
||||||
|
req.setSign(MD5Util.encrypt(map, thirdApply.getAppToken(), true));
|
||||||
|
|
||||||
Map<String,Object> map= BeanUtil.transBeanMap(req);
|
ResponseEntity<String> response = restTemplate.postForEntity(url.concat("trans/pay"), req, String.class);
|
||||||
req.setSign(MD5Util.encrypt(map,thirdApply.getAppToken(),true));
|
if (response.getStatusCodeValue() == 200 && ObjectUtil.isNotEmpty(response.getBody())) {
|
||||||
|
JSONObject object = JSONObject.parseObject(response.getBody());
|
||||||
ResponseEntity<String> response= restTemplate.postForEntity(url.concat("trans/pay"),req,String.class);
|
if (object.get("code").equals("0")) {
|
||||||
if(response.getStatusCodeValue()==200&&ObjectUtil.isNotEmpty(response.getBody())){
|
|
||||||
JSONObject object=JSONObject.parseObject(response.getBody());
|
|
||||||
if(object.get("code").equals("0")){
|
|
||||||
payment.setTradeNumber(object.getJSONObject("data").get("orderNumber").toString());
|
payment.setTradeNumber(object.getJSONObject("data").get("orderNumber").toString());
|
||||||
payment.setUpdatedAt(System.currentTimeMillis());
|
payment.setUpdatedAt(System.currentTimeMillis());
|
||||||
tbOrderPaymentMapper.updateByPrimaryKeySelective(payment);
|
tbOrderPaymentMapper.updateByPrimaryKeySelective(payment);
|
||||||
@@ -166,7 +192,7 @@ public class PayService {
|
|||||||
|
|
||||||
|
|
||||||
tbOrderInfoMapper.updateByPrimaryKey(orderInfo);
|
tbOrderInfoMapper.updateByPrimaryKey(orderInfo);
|
||||||
String key= RedisCst.TABLE_CART.concat(orderInfo.getTableId()).concat("-").concat(orderInfo.getShopId());
|
String key = RedisCst.TABLE_CART.concat(orderInfo.getTableId()).concat("-").concat(orderInfo.getShopId());
|
||||||
//清除缓存购物车数据
|
//清除缓存购物车数据
|
||||||
redisUtil.deleteByKey(key);
|
redisUtil.deleteByKey(key);
|
||||||
JSONObject jsonObject1 = new JSONObject();
|
JSONObject jsonObject1 = new JSONObject();
|
||||||
@@ -175,10 +201,10 @@ public class PayService {
|
|||||||
jsonObject1.put("type", "");
|
jsonObject1.put("type", "");
|
||||||
jsonObject1.put("data", new JSONArray());
|
jsonObject1.put("data", new JSONArray());
|
||||||
jsonObject1.put("amount", 0);
|
jsonObject1.put("amount", 0);
|
||||||
AppWebSocketServer.AppSendInfo(jsonObject1,key, false);
|
AppWebSocketServer.AppSendInfo(jsonObject1, key, false);
|
||||||
tbCashierCartMapper.updateStatusByOrderId(orderId.toString(),"final");
|
tbCashierCartMapper.updateStatusByOrderId(orderId.toString(), "final");
|
||||||
return Result.success(CodeEnum.SUCCESS,object.getJSONObject("data"));
|
return Result.success(CodeEnum.SUCCESS, object.getJSONObject("data"));
|
||||||
}else {
|
} else {
|
||||||
return Result.fail(object.getString("msg"));
|
return Result.fail(object.getString("msg"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,11 +212,159 @@ public class PayService {
|
|||||||
return Result.fail("失败");
|
return Result.fail("失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Result groupOrderPay(String orderId, String payType, String userId, String ip) {
|
||||||
|
TbGroupOrderInfo orderInfo = tbGroupOrderInfoMapper.queryById(Integer.valueOf(orderId));
|
||||||
|
|
||||||
|
if (!"unpaid".equals(orderInfo.getStatus()) && !"paying".equals(orderInfo.getStatus())) {
|
||||||
|
return Result.fail("订单状态异常,不允许支付");
|
||||||
|
}
|
||||||
|
|
||||||
|
TbMerchantAccount tbMerchantAccount = merchantAccountMapper.selectByShopId(orderInfo.getShopId().toString());
|
||||||
|
if (tbMerchantAccount == null) {
|
||||||
|
throw new MsgException("生成订单错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjectUtil.isNull(tbMerchantAccount.getMerchantId()) || ObjectUtil.isEmpty(tbMerchantAccount.getMerchantId())) {
|
||||||
|
return Result.fail("没有对应的商户");
|
||||||
|
}
|
||||||
|
|
||||||
|
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(tbMerchantAccount.getMerchantId()));
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(thirdApply) || ObjectUtil.isNull(thirdApply)) {
|
||||||
|
return Result.fail("支付通道不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
TbOrderPayment payment = tbOrderPaymentMapper.selectByOrderId(orderId);
|
||||||
|
if (ObjectUtil.isEmpty(payment) || payment == null) {
|
||||||
|
payment = new TbOrderPayment();
|
||||||
|
payment.setPayTypeId("ysk");
|
||||||
|
payment.setAmount(orderInfo.getOrderAmount());
|
||||||
|
payment.setPaidAmount(orderInfo.getPayAmount());
|
||||||
|
payment.setHasRefundAmount(BigDecimal.ZERO);
|
||||||
|
if (payType.equals("wechatPay")) {
|
||||||
|
payment.setPayName("微信支付");
|
||||||
|
payment.setPayType("wechatPay");
|
||||||
|
} else if (payType.equals("aliPay")) {
|
||||||
|
payment.setPayName("支付宝支付");
|
||||||
|
payment.setPayType("aliPay");
|
||||||
|
}
|
||||||
|
payment.setReceived(payment.getAmount());
|
||||||
|
payment.setChangeFee(BigDecimal.ZERO);
|
||||||
|
// payment.setMemberId(orderInfo.getMemberId());//会员Id
|
||||||
|
payment.setShopId(orderInfo.getShopId().toString());
|
||||||
|
payment.setOrderId(orderInfo.getId().toString());
|
||||||
|
payment.setCreatedAt(System.currentTimeMillis());
|
||||||
|
tbOrderPaymentMapper.insert(payment);
|
||||||
|
} else {
|
||||||
|
if (payType.equals("wechatPay")) {
|
||||||
|
payment.setPayName("微信支付");
|
||||||
|
payment.setPayType("wechatPay");
|
||||||
|
} else if (payType.equals("aliPay")) {
|
||||||
|
payment.setPayName("支付宝支付");
|
||||||
|
payment.setPayType("aliPay");
|
||||||
|
}
|
||||||
|
payment.setUpdatedAt(System.currentTimeMillis());
|
||||||
|
tbOrderPaymentMapper.updateByPrimaryKey(payment);
|
||||||
|
}
|
||||||
|
|
||||||
|
PayReq req = new PayReq();
|
||||||
|
|
||||||
|
req.setAppId(thirdApply.getAppId());
|
||||||
|
req.setTimestamp(System.currentTimeMillis());
|
||||||
|
req.setIp(ip);
|
||||||
|
req.setMercOrderNo(orderInfo.getOrderNo());
|
||||||
|
req.setNotifyUrl(callBackGroupurl);
|
||||||
|
req.setPayAmt(payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).toPlainString());
|
||||||
|
if (payType.equals("wechatPay")) {
|
||||||
|
req.setPayType("03");
|
||||||
|
req.setPayWay("WXZF");//WXZF ZFBZF UNIONPAY
|
||||||
|
} else if (payType.equals("aliPay")) {
|
||||||
|
req.setPayWay("ZFBZF");
|
||||||
|
}
|
||||||
|
req.setSubject("零点八零:团购卷");
|
||||||
|
req.setUserId(userId);
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, Object> map = BeanUtil.transBeanMap(req);
|
||||||
|
req.setSign(MD5Util.encrypt(map, thirdApply.getAppToken(), true));
|
||||||
|
|
||||||
|
ResponseEntity<String> response = restTemplate.postForEntity(url.concat("trans/pay"), req, String.class);
|
||||||
|
if (response.getStatusCodeValue() == 200 && ObjectUtil.isNotEmpty(response.getBody())) {
|
||||||
|
JSONObject object = JSONObject.parseObject(response.getBody());
|
||||||
|
if (object.get("code").equals("0")) {
|
||||||
|
payment.setTradeNumber(object.getJSONObject("data").get("orderNumber").toString());
|
||||||
|
payment.setUpdatedAt(System.currentTimeMillis());
|
||||||
|
tbOrderPaymentMapper.updateByPrimaryKeySelective(payment);
|
||||||
|
orderInfo.setPayType(payType);
|
||||||
|
orderInfo.setStatus("paying");
|
||||||
|
orderInfo.setPayOrderNo(payment.getTradeNumber());
|
||||||
|
tbGroupOrderInfoMapper.update(orderInfo);
|
||||||
|
JSONObject jsonObject1 = new JSONObject();
|
||||||
|
jsonObject1.put("status", "success");
|
||||||
|
jsonObject1.put("msg", "成功");
|
||||||
|
jsonObject1.put("type", "");
|
||||||
|
jsonObject1.put("data", new JSONArray());
|
||||||
|
jsonObject1.put("amount", 0);
|
||||||
|
tbProductMapper.upGroupRealSalesNumber(orderInfo.getProId().toString(), orderInfo.getNumber());
|
||||||
|
return Result.success(CodeEnum.SUCCESS, object.getJSONObject("data"));
|
||||||
|
} else {
|
||||||
|
return Result.fail(object.getString("msg"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.fail("失败");
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Result accountPay(String orderId, String userId, String shopId,String pwd) {
|
public Result returnOrder(ReturnGroupOrderDto param) {
|
||||||
if (ObjectUtil.isEmpty(orderId) || ObjectUtil.isEmpty(userId)||ObjectUtil.isEmpty(shopId)||ObjectUtil.isEmpty(pwd)) {
|
TbGroupOrderInfo groupOrderInfo = tbGroupOrderInfoMapper.queryById(param.getOrderId());
|
||||||
|
List<TbGroupOrderCoupon> tbGroupOrderCoupons = orderCouponService.queryNoRefundByOrderId(param.getOrderId());
|
||||||
|
if (param.getNum() > tbGroupOrderCoupons.size()) {
|
||||||
|
return Result.fail("可退数量不足");
|
||||||
|
}
|
||||||
|
for (int i = 0; i < param.getNum(); i++) {
|
||||||
|
TbGroupOrderCoupon coupon = tbGroupOrderCoupons.get(i);
|
||||||
|
coupon.setIsRefund(1);
|
||||||
|
coupon.setRefundAmount(param.getRefundAmount());
|
||||||
|
coupon.setRefundDesc(param.getRefundDesc());
|
||||||
|
coupon.setRefundReason(param.getRefundReason());
|
||||||
|
orderCouponService.update(coupon);
|
||||||
|
}
|
||||||
|
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(groupOrderInfo.getMerchantId());
|
||||||
|
MsgException.checkNull(thirdApply, "支付参数配置错误");
|
||||||
|
ReturnOrderReq req = new ReturnOrderReq();
|
||||||
|
req.setAppId(thirdApply.getAppId());
|
||||||
|
req.setTimestamp(System.currentTimeMillis());
|
||||||
|
req.setOrderNumber(groupOrderInfo.getPayOrderNo());
|
||||||
|
req.setAmount(param.getRefundAmount().toString());
|
||||||
|
req.setMercRefundNo(groupOrderInfo.getOrderNo());
|
||||||
|
req.setRefundReason("团购卷:退货");
|
||||||
|
req.setPayPassword(thirdApply.getPayPassword());
|
||||||
|
Map<String, Object> map = BeanUtil.transBean2Map(req);
|
||||||
|
req.setSign(MD5Util.encrypt(map, thirdApply.getAppToken(), true));
|
||||||
|
log.info("groupOrderReturn req:{}", JSONUtil.toJsonStr(req));
|
||||||
|
ResponseEntity<String> response = restTemplate.postForEntity(url.concat("merchantOrder/returnOrder"), req, String.class);
|
||||||
|
log.info("groupOrderReturn:{}", response.getBody());
|
||||||
|
if (response.getStatusCodeValue() == 200 && ObjectUtil.isNotEmpty(response.getBody())) {
|
||||||
|
JSONObject object = JSONObject.parseObject(response.getBody());
|
||||||
|
if (!object.get("code").equals("0")) {
|
||||||
|
MsgException.check(true, "退款渠道调用失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
groupOrderInfo.setRefundNumber(groupOrderInfo.getRefundNumber() + param.getNum());
|
||||||
|
groupOrderInfo.setRefundAmount(groupOrderInfo.getRefundAmount().add(param.getRefundAmount()));
|
||||||
|
if (groupOrderInfo.getNumber() == groupOrderInfo.getRefundNumber()) {
|
||||||
|
groupOrderInfo.setRefundAble(0);
|
||||||
|
groupOrderInfo.setStatus("refund");
|
||||||
|
}
|
||||||
|
tbGroupOrderInfoMapper.update(groupOrderInfo);
|
||||||
|
return Result.success(CodeEnum.SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Result accountPay(String orderId, String userId, String shopId, String pwd) {
|
||||||
|
if (ObjectUtil.isEmpty(orderId) || ObjectUtil.isEmpty(userId) || ObjectUtil.isEmpty(shopId) || ObjectUtil.isEmpty(pwd)) {
|
||||||
return Result.fail("参数错误");
|
return Result.fail("参数错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,18 +384,18 @@ public class PayService {
|
|||||||
return Result.fail("当前店铺未开通储值卡支付");
|
return Result.fail("当前店铺未开通储值卡支付");
|
||||||
}
|
}
|
||||||
|
|
||||||
TbShopUser user = tbShopUserMapper.selectByUserIdAndShopId(userId,shopId);
|
TbShopUser user = tbShopUserMapper.selectByUserIdAndShopId(userId, shopId);
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(user) || !"1".equals(user.getIsVip().toString())) {
|
if (ObjectUtil.isEmpty(user) || !"1".equals(user.getIsVip().toString())) {
|
||||||
return Result.fail("此用户非会员用户");
|
return Result.fail("此用户非会员用户");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if("1".equals(user.getIsPwd())){
|
if ("1".equals(user.getIsPwd())) {
|
||||||
return Result.fail("会员支付密码为初始化密码");
|
return Result.fail("会员支付密码为初始化密码");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!MD5Util.encrypt(pwd).equals(user.getPwd())){
|
if (!MD5Util.encrypt(pwd).equals(user.getPwd())) {
|
||||||
return Result.fail("会员支付密码错误");
|
return Result.fail("会员支付密码错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,12 +428,12 @@ public class PayService {
|
|||||||
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
||||||
|
|
||||||
|
|
||||||
int cartCount= tbCashierCartMapper.updateStatusByOrderId(orderId.toString(),"final");
|
int cartCount = tbCashierCartMapper.updateStatusByOrderId(orderId.toString(), "final");
|
||||||
|
|
||||||
log.info("更新购物车:{}",cartCount);
|
log.info("更新购物车:{}", cartCount);
|
||||||
|
|
||||||
//更新子单状态
|
//更新子单状态
|
||||||
tbOrderDetailMapper.updateStatusByOrderIdAndStatus(Integer.valueOf(orderId),"closed");
|
tbOrderDetailMapper.updateStatusByOrderIdAndStatus(Integer.valueOf(orderId), "closed");
|
||||||
|
|
||||||
//修改主单状态
|
//修改主单状态
|
||||||
orderInfo.setStatus("closed");
|
orderInfo.setStatus("closed");
|
||||||
@@ -269,10 +443,10 @@ public class PayService {
|
|||||||
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
||||||
|
|
||||||
|
|
||||||
JSONObject jsonObject=new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("token",0);
|
jsonObject.put("token", 0);
|
||||||
jsonObject.put("type","wxcreate");
|
jsonObject.put("type", "wxcreate");
|
||||||
jsonObject.put("orderId",orderInfo.getId().toString());
|
jsonObject.put("orderId", orderInfo.getId().toString());
|
||||||
|
|
||||||
producer.putOrderCollect(jsonObject.toJSONString());
|
producer.putOrderCollect(jsonObject.toJSONString());
|
||||||
|
|
||||||
@@ -284,48 +458,48 @@ public class PayService {
|
|||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Result modifyOrderStatus(Integer orderId) throws IOException {
|
public Result modifyOrderStatus(Integer orderId) throws IOException {
|
||||||
TbOrderInfo orderInfo= tbOrderInfoMapper.selectByPrimaryKey(Integer.valueOf(orderId));
|
TbOrderInfo orderInfo = tbOrderInfoMapper.selectByPrimaryKey(Integer.valueOf(orderId));
|
||||||
if(ObjectUtil.isEmpty(orderInfo)){
|
if (ObjectUtil.isEmpty(orderInfo)) {
|
||||||
return Result.fail("订单信息不存在");
|
return Result.fail("订单信息不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
if("paying".equals(orderInfo.getStatus())){
|
if ("paying".equals(orderInfo.getStatus())) {
|
||||||
TbOrderPayment payment= tbOrderPaymentMapper.selectByOrderId(orderInfo.getId().toString());
|
TbOrderPayment payment = tbOrderPaymentMapper.selectByOrderId(orderInfo.getId().toString());
|
||||||
if(ObjectUtil.isNotEmpty(payment)&&ObjectUtil.isNotEmpty(payment.getTradeNumber())){
|
if (ObjectUtil.isNotEmpty(payment) && ObjectUtil.isNotEmpty(payment.getTradeNumber())) {
|
||||||
|
|
||||||
TbMerchantThirdApply thirdApply= tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getMerchantId()));
|
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getMerchantId()));
|
||||||
|
|
||||||
if(ObjectUtil.isEmpty(thirdApply)||ObjectUtil.isNull(thirdApply)){
|
if (ObjectUtil.isEmpty(thirdApply) || ObjectUtil.isNull(thirdApply)) {
|
||||||
return Result.fail("支付通道不存在");
|
return Result.fail("支付通道不存在");
|
||||||
}
|
}
|
||||||
TradeQueryReq req=new TradeQueryReq();
|
TradeQueryReq req = new TradeQueryReq();
|
||||||
req.setAppId(thirdApply.getAppId());
|
req.setAppId(thirdApply.getAppId());
|
||||||
req.setTimestamp(System.currentTimeMillis());
|
req.setTimestamp(System.currentTimeMillis());
|
||||||
req.setOrderNumber(payment.getTradeNumber());
|
req.setOrderNumber(payment.getTradeNumber());
|
||||||
Map<String,Object> map= BeanUtil.transBeanMap(req);
|
Map<String, Object> map = BeanUtil.transBeanMap(req);
|
||||||
|
|
||||||
req.setSign(MD5Util.encrypt(map,thirdApply.getAppToken(),true));
|
req.setSign(MD5Util.encrypt(map, thirdApply.getAppToken(), true));
|
||||||
|
|
||||||
ResponseEntity<String> response= restTemplate.postForEntity(url.concat("merchantOrder/tradeQuery"),req,String.class);
|
ResponseEntity<String> response = restTemplate.postForEntity(url.concat("merchantOrder/tradeQuery"), req, String.class);
|
||||||
if(response.getStatusCodeValue()==200&&ObjectUtil.isNotEmpty(response.getBody())){
|
if (response.getStatusCodeValue() == 200 && ObjectUtil.isNotEmpty(response.getBody())) {
|
||||||
JSONObject object=JSONObject.parseObject(response.getBody());
|
JSONObject object = JSONObject.parseObject(response.getBody());
|
||||||
|
|
||||||
if(object.get("code").equals("0")){
|
if (object.get("code").equals("0")) {
|
||||||
JSONObject data=object.getJSONObject("data");
|
JSONObject data = object.getJSONObject("data");
|
||||||
String status=data.getString("status");
|
String status = data.getString("status");
|
||||||
String cartStatus="";
|
String cartStatus = "";
|
||||||
switch (status){
|
switch (status) {
|
||||||
case "0": //交易失败
|
case "0": //交易失败
|
||||||
break;
|
break;
|
||||||
case "1": //交易成功
|
case "1": //交易成功
|
||||||
|
|
||||||
//修改数据库中购物车数据
|
//修改数据库中购物车数据
|
||||||
int cartCount= tbCashierCartMapper.updateStatusByOrderId(orderId.toString(),"final");
|
int cartCount = tbCashierCartMapper.updateStatusByOrderId(orderId.toString(), "final");
|
||||||
|
|
||||||
log.info("更新购物车:{}",cartCount);
|
log.info("更新购物车:{}", cartCount);
|
||||||
|
|
||||||
//更新子单状态
|
//更新子单状态
|
||||||
tbOrderDetailMapper.updateStatusByOrderIdAndStatus(Integer.valueOf(orderId),"closed");
|
tbOrderDetailMapper.updateStatusByOrderIdAndStatus(Integer.valueOf(orderId), "closed");
|
||||||
|
|
||||||
//修改主单状态
|
//修改主单状态
|
||||||
orderInfo.setStatus("closed");
|
orderInfo.setStatus("closed");
|
||||||
@@ -335,76 +509,72 @@ public class PayService {
|
|||||||
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
||||||
|
|
||||||
|
|
||||||
JSONObject jsonObject=new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("token",0);
|
jsonObject.put("token", 0);
|
||||||
jsonObject.put("type","wxcreate");
|
jsonObject.put("type", "wxcreate");
|
||||||
jsonObject.put("orderId",orderInfo.getId().toString());
|
jsonObject.put("orderId", orderInfo.getId().toString());
|
||||||
|
|
||||||
producer.putOrderCollect(jsonObject.toJSONString());
|
producer.putOrderCollect(jsonObject.toJSONString());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
log.info("发送打印数据");
|
log.info("发送打印数据");
|
||||||
producer.printMechine(orderInfo.getId() + "");
|
producer.printMechine(orderInfo.getId() + "");
|
||||||
log.info("发送赠送购物券");
|
log.info("发送赠送购物券");
|
||||||
JSONObject coupons = new JSONObject();
|
JSONObject coupons = new JSONObject();
|
||||||
coupons.put("type","buy");
|
coupons.put("type", "buy");
|
||||||
coupons.put("orderId",orderId);
|
coupons.put("orderId", orderId);
|
||||||
producer.printCoupons(coupons.toJSONString());
|
producer.printCoupons(coupons.toJSONString());
|
||||||
return Result.success(CodeEnum.SUCCESS,orderId);
|
return Result.success(CodeEnum.SUCCESS, orderId);
|
||||||
case "2": //退款成功
|
case "2": //退款成功
|
||||||
cartStatus="refund";
|
cartStatus = "refund";
|
||||||
orderInfo.setStatus("refund");
|
orderInfo.setStatus("refund");
|
||||||
break;
|
break;
|
||||||
case "3": //退款失败
|
case "3": //退款失败
|
||||||
break;
|
break;
|
||||||
case "4": //退款中
|
case "4": //退款中
|
||||||
cartStatus="refunding";
|
cartStatus = "refunding";
|
||||||
orderInfo.setStatus("refunding");
|
orderInfo.setStatus("refunding");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
tbCashierCartMapper.updateStatusByOrderId(orderId.toString(),cartStatus);
|
tbCashierCartMapper.updateStatusByOrderId(orderId.toString(), cartStatus);
|
||||||
orderInfo.setUpdatedAt(System.currentTimeMillis());
|
orderInfo.setUpdatedAt(System.currentTimeMillis());
|
||||||
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Result.success(CodeEnum.SUCCESS,orderId);
|
return Result.success(CodeEnum.SUCCESS, orderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Result memberIn(String openId,String userId,String amount,String shopId,String ip){
|
public Result memberIn(String openId, String userId, String amount, String shopId, String ip) {
|
||||||
if(ObjectUtil.isEmpty(openId)||ObjectUtil.isEmpty(userId)){
|
if (ObjectUtil.isEmpty(openId) || ObjectUtil.isEmpty(userId)) {
|
||||||
return Result.fail("用户信息允许为空");
|
return Result.fail("用户信息允许为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TbShopUser tbShopUser= tbShopUserMapper.selectByUserIdAndShopId(userId,shopId);
|
TbShopUser tbShopUser = tbShopUserMapper.selectByUserIdAndShopId(userId, shopId);
|
||||||
if(ObjectUtil.isEmpty(tbShopUser)){
|
if (ObjectUtil.isEmpty(tbShopUser)) {
|
||||||
return Result.fail("对应的用户信息不存在");
|
return Result.fail("对应的用户信息不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TbShopInfo shopInfo= tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(shopId));
|
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(shopId));
|
||||||
if(ObjectUtil.isEmpty(shopInfo)){
|
if (ObjectUtil.isEmpty(shopInfo)) {
|
||||||
return Result.fail("对应的店铺信息不存在");
|
return Result.fail("对应的店铺信息不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(shopInfo.getMerchantId()));
|
||||||
TbMerchantThirdApply thirdApply= tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(shopInfo.getMerchantId()));
|
if (ObjectUtil.isEmpty(thirdApply) || ObjectUtil.isNull(thirdApply)) {
|
||||||
if(ObjectUtil.isEmpty(thirdApply)||ObjectUtil.isNull(thirdApply)){
|
|
||||||
return Result.fail("支付通道不存在");
|
return Result.fail("支付通道不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal payAmount= new BigDecimal(amount).setScale(2,BigDecimal.ROUND_DOWN);
|
BigDecimal payAmount = new BigDecimal(amount).setScale(2, BigDecimal.ROUND_DOWN);
|
||||||
|
|
||||||
TbMemberIn memberIn=new TbMemberIn();
|
TbMemberIn memberIn = new TbMemberIn();
|
||||||
memberIn.setAmount(payAmount);
|
memberIn.setAmount(payAmount);
|
||||||
memberIn.setUserId(Integer.valueOf(tbShopUser.getUserId()));
|
memberIn.setUserId(Integer.valueOf(tbShopUser.getUserId()));
|
||||||
memberIn.setCode(tbShopUser.getDynamicCode());
|
memberIn.setCode(tbShopUser.getDynamicCode());
|
||||||
@@ -415,8 +585,7 @@ public class PayService {
|
|||||||
tbMemberInMapper.insert(memberIn);
|
tbMemberInMapper.insert(memberIn);
|
||||||
|
|
||||||
|
|
||||||
|
PayReq req = new PayReq();
|
||||||
PayReq req=new PayReq();
|
|
||||||
|
|
||||||
req.setAppId(thirdApply.getAppId());
|
req.setAppId(thirdApply.getAppId());
|
||||||
req.setTimestamp(System.currentTimeMillis());
|
req.setTimestamp(System.currentTimeMillis());
|
||||||
@@ -430,26 +599,49 @@ public class PayService {
|
|||||||
req.setUserId(openId);
|
req.setUserId(openId);
|
||||||
|
|
||||||
|
|
||||||
Map<String,Object> map= BeanUtil.transBeanMap(req);
|
Map<String, Object> map = BeanUtil.transBeanMap(req);
|
||||||
req.setSign(MD5Util.encrypt(map,thirdApply.getAppToken(),true));
|
req.setSign(MD5Util.encrypt(map, thirdApply.getAppToken(), true));
|
||||||
|
|
||||||
ResponseEntity<String> response= restTemplate.postForEntity(url.concat("trans/pay"),req,String.class);
|
ResponseEntity<String> response = restTemplate.postForEntity(url.concat("trans/pay"), req, String.class);
|
||||||
if(response.getStatusCodeValue()==200&&ObjectUtil.isNotEmpty(response.getBody())){
|
if (response.getStatusCodeValue() == 200 && ObjectUtil.isNotEmpty(response.getBody())) {
|
||||||
JSONObject object=JSONObject.parseObject(response.getBody());
|
JSONObject object = JSONObject.parseObject(response.getBody());
|
||||||
if(object.get("code").equals("0")){
|
if (object.get("code").equals("0")) {
|
||||||
memberIn.setOrderNo(object.getJSONObject("data").get("orderNumber").toString());
|
memberIn.setOrderNo(object.getJSONObject("data").get("orderNumber").toString());
|
||||||
memberIn.setUpdateTime(new Date());
|
memberIn.setUpdateTime(new Date());
|
||||||
tbMemberInMapper.updateByPrimaryKeySelective(memberIn);
|
tbMemberInMapper.updateByPrimaryKeySelective(memberIn);
|
||||||
|
|
||||||
return Result.success(CodeEnum.SUCCESS,object.getJSONObject("data"));
|
return Result.success(CodeEnum.SUCCESS, object.getJSONObject("data"));
|
||||||
}else {
|
} else {
|
||||||
return Result.fail(object.getString("msg"));
|
return Result.fail(object.getString("msg"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Result.fail("失败");
|
return Result.fail("失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public String callBackGroupPay(String payOrderNO) {
|
||||||
|
TbGroupOrderInfo orderInfo = tbGroupOrderInfoMapper.selectByPayOrderNo(payOrderNO);
|
||||||
|
if (ObjectUtil.isEmpty(orderInfo)) {
|
||||||
|
return "订单信息不存在";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("paying".equals(orderInfo.getStatus())) {
|
||||||
|
for (int i = 0; i < orderInfo.getNumber(); i++) {
|
||||||
|
TbGroupOrderCoupon groupOrderCoupon = new TbGroupOrderCoupon();
|
||||||
|
groupOrderCoupon.setOrderId(orderInfo.getId());
|
||||||
|
groupOrderCoupon.setCouponNo(genCouponNumber());
|
||||||
|
groupOrderCoupon.setIsRefund(0);
|
||||||
|
groupOrderCouponService.insert(groupOrderCoupon);
|
||||||
|
}
|
||||||
|
orderInfo.setExpDate(getNextMonDate());
|
||||||
|
//修改主单状态
|
||||||
|
orderInfo.setStatus("unused");
|
||||||
|
orderInfo.setPayAmount(orderInfo.getOrderAmount());
|
||||||
|
tbGroupOrderInfoMapper.update(orderInfo);
|
||||||
|
return "SUCCESS";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public String callBackPay(String payOrderNO) {
|
public String callBackPay(String payOrderNO) {
|
||||||
@@ -474,10 +666,10 @@ public class PayService {
|
|||||||
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
||||||
|
|
||||||
|
|
||||||
JSONObject jsonObject=new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("token",0);
|
jsonObject.put("token", 0);
|
||||||
jsonObject.put("type","wxcreate");
|
jsonObject.put("type", "wxcreate");
|
||||||
jsonObject.put("orderId",orderInfo.getId().toString());
|
jsonObject.put("orderId", orderInfo.getId().toString());
|
||||||
|
|
||||||
producer.putOrderCollect(jsonObject.toJSONString());
|
producer.putOrderCollect(jsonObject.toJSONString());
|
||||||
|
|
||||||
@@ -492,10 +684,10 @@ public class PayService {
|
|||||||
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public String minsuccess(String payOrderNO,String tradeNo){
|
public String minsuccess(String payOrderNO, String tradeNo) {
|
||||||
|
|
||||||
TbMemberIn memberIn= tbMemberInMapper.selectByOrderNo(payOrderNO);
|
TbMemberIn memberIn = tbMemberInMapper.selectByOrderNo(payOrderNO);
|
||||||
if(ObjectUtil.isEmpty(memberIn)){
|
if (ObjectUtil.isEmpty(memberIn)) {
|
||||||
return "充值记录不存在";
|
return "充值记录不存在";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,8 +696,8 @@ public class PayService {
|
|||||||
memberIn.setUpdateTime(new Date());
|
memberIn.setUpdateTime(new Date());
|
||||||
tbMemberInMapper.updateByPrimaryKeySelective(memberIn);
|
tbMemberInMapper.updateByPrimaryKeySelective(memberIn);
|
||||||
|
|
||||||
TbShopUser tbShopUser= tbShopUserMapper.selectByUserIdAndShopId(memberIn.getUserId().toString(),memberIn.getShopId().toString());
|
TbShopUser tbShopUser = tbShopUserMapper.selectByUserIdAndShopId(memberIn.getUserId().toString(), memberIn.getShopId().toString());
|
||||||
if(ObjectUtil.isEmpty(tbShopUser)){
|
if (ObjectUtil.isEmpty(tbShopUser)) {
|
||||||
return "用户信息不存在";
|
return "用户信息不存在";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -515,7 +707,7 @@ public class PayService {
|
|||||||
tbShopUser.setUpdatedAt(System.currentTimeMillis());
|
tbShopUser.setUpdatedAt(System.currentTimeMillis());
|
||||||
tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser);
|
tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser);
|
||||||
|
|
||||||
TbShopUserFlow flow=new TbShopUserFlow();
|
TbShopUserFlow flow = new TbShopUserFlow();
|
||||||
flow.setShopUserId(Integer.valueOf(tbShopUser.getId()));
|
flow.setShopUserId(Integer.valueOf(tbShopUser.getId()));
|
||||||
flow.setBizCode("scanMemberIn");
|
flow.setBizCode("scanMemberIn");
|
||||||
flow.setBizName("会员扫码充值");
|
flow.setBizName("会员扫码充值");
|
||||||
@@ -531,20 +723,48 @@ public class PayService {
|
|||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成长度为12的随机串
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String genCouponNumber() {
|
||||||
|
Random random = new Random();
|
||||||
|
long min = 10000000000L;
|
||||||
|
long max = 19999999999L;
|
||||||
|
// 生成介于min和max之间的随机整数
|
||||||
|
long randomNumber = min + ((long) (random.nextDouble() * (max - min)));
|
||||||
|
// 将随机整数转换为字符串,并在前面补0,直到长度为12位
|
||||||
|
return String.format("%012d", randomNumber);
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args){
|
/**
|
||||||
|
* 获取一个月后的时间
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Date getNextMonDate() {
|
||||||
|
// 获取当前日期和时间
|
||||||
|
LocalDateTime currentDateTime = LocalDateTime.now();
|
||||||
|
// 计算一个月后的日期和时间
|
||||||
|
LocalDateTime nextMonthDateTime = currentDateTime.plusMonths(1);
|
||||||
|
return java.sql.Timestamp.valueOf(nextMonthDateTime);
|
||||||
|
}
|
||||||
|
|
||||||
RestTemplate restTemplate1= new RestTemplate();
|
|
||||||
JSONObject param=new JSONObject();
|
|
||||||
|
|
||||||
String priv="MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAIqNqTqhN8zE7eFZnwKcyBTENce2wdAtl/gaDHNuNVgg33dS27Jx0fKl9QSHXyzyxbAdG8F94niYbRBstrMymFRjuO72jH+rIH62Ym1k7l8JSLVK2dKHXt8lHDaQGUP10q0EEocnDQ9cL93oBNG1ttsV6vOAu1TPvRK9TGihRAe1AgMBAAECgYBmI8KCl0DkcrSOsRvYuC2DqZWf8el1B3eFjeZp3e/zVOCIPYv6Q5ArWg6DVSxjnWEA0KSagqvGjU+xkQMqnXzPcPMhsIS+1wyR/pP+pwiatO2ioHaQpEqHg9eXhxrgA477/xuKVw9zl5GNqaIgd++2NDXnqLh0Y6OR73f0OB5eDQJBAPihEm+UWLOam/Q/k2+k4Lm2dvxJTBur1fslBiJpgMhgcz/PlwRwpL7aPD0AuPv0NqLouuoTiKpq9icnUv12tgsCQQCOqTANw0IErCHUNdinjXewmG3ui1j9XgM41rSn5ZeTrPL4GhZc2zbS/pZT4PBKUL6NLGkfPHmw4rOmNL/Xc5E/AkBqAwQBX5eSvVHSC2mqKPtJNGv3lqlFAzfyJg8/jQzEY5vAkZsq4Xzdg+A7gptdkvvY6rMIK9wSDhl3CGVyfbORAkA1N+g1OiHmnFACWhP4bU25EyPvWQxZeDi7e1zpRTzGWj5JT3IIMb7B9zcdE0yQbI6pG2gbvvOmiOt7lTH7raEBAkBas2gugvR3f0aGqQcqMpyM627pyRppQ2h58/7KBylP3oR2BReqMUcXeiJ8TuBXzbRXpeVQ0DWOva5CWZJmBMdz";
|
public static void main(String[] args) {
|
||||||
|
|
||||||
PayReq req=new PayReq();
|
RestTemplate restTemplate1 = new RestTemplate();
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
|
||||||
|
String priv = "MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAIqNqTqhN8zE7eFZnwKcyBTENce2wdAtl/gaDHNuNVgg33dS27Jx0fKl9QSHXyzyxbAdG8F94niYbRBstrMymFRjuO72jH+rIH62Ym1k7l8JSLVK2dKHXt8lHDaQGUP10q0EEocnDQ9cL93oBNG1ttsV6vOAu1TPvRK9TGihRAe1AgMBAAECgYBmI8KCl0DkcrSOsRvYuC2DqZWf8el1B3eFjeZp3e/zVOCIPYv6Q5ArWg6DVSxjnWEA0KSagqvGjU+xkQMqnXzPcPMhsIS+1wyR/pP+pwiatO2ioHaQpEqHg9eXhxrgA477/xuKVw9zl5GNqaIgd++2NDXnqLh0Y6OR73f0OB5eDQJBAPihEm+UWLOam/Q/k2+k4Lm2dvxJTBur1fslBiJpgMhgcz/PlwRwpL7aPD0AuPv0NqLouuoTiKpq9icnUv12tgsCQQCOqTANw0IErCHUNdinjXewmG3ui1j9XgM41rSn5ZeTrPL4GhZc2zbS/pZT4PBKUL6NLGkfPHmw4rOmNL/Xc5E/AkBqAwQBX5eSvVHSC2mqKPtJNGv3lqlFAzfyJg8/jQzEY5vAkZsq4Xzdg+A7gptdkvvY6rMIK9wSDhl3CGVyfbORAkA1N+g1OiHmnFACWhP4bU25EyPvWQxZeDi7e1zpRTzGWj5JT3IIMb7B9zcdE0yQbI6pG2gbvvOmiOt7lTH7raEBAkBas2gugvR3f0aGqQcqMpyM627pyRppQ2h58/7KBylP3oR2BReqMUcXeiJ8TuBXzbRXpeVQ0DWOva5CWZJmBMdz";
|
||||||
|
|
||||||
|
PayReq req = new PayReq();
|
||||||
|
|
||||||
req.setAppId("M8002023120892f1e4");
|
req.setAppId("M8002023120892f1e4");
|
||||||
req.setTimestamp(System.currentTimeMillis());
|
req.setTimestamp(System.currentTimeMillis());
|
||||||
req.setIp("127.0.0.1");
|
req.setIp("127.0.0.1");
|
||||||
req.setMercOrderNo(System.currentTimeMillis()+"");
|
req.setMercOrderNo(System.currentTimeMillis() + "");
|
||||||
req.setNotifyUrl("https");
|
req.setNotifyUrl("https");
|
||||||
req.setPayAmt("0.01");
|
req.setPayAmt("0.01");
|
||||||
req.setPayType("03");
|
req.setPayType("03");
|
||||||
@@ -552,13 +772,12 @@ public class PayService {
|
|||||||
req.setSubject("ddd");
|
req.setSubject("ddd");
|
||||||
req.setUserId("or1l864NBOoJZhC5x_yeziZ26j6c");
|
req.setUserId("or1l864NBOoJZhC5x_yeziZ26j6c");
|
||||||
|
|
||||||
Map<String,Object> map= BeanUtil.transBeanMap(req);
|
Map<String, Object> map = BeanUtil.transBeanMap(req);
|
||||||
|
|
||||||
req.setSign(MD5Util.encrypt(map,priv,true));
|
req.setSign(MD5Util.encrypt(map, priv, true));
|
||||||
|
|
||||||
|
|
||||||
ResponseEntity<String> response= restTemplate1.postForEntity("https://gatewaytestapi.sxczgkj.cn/gate-service/trans/pay",req,String.class);
|
ResponseEntity<String> response = restTemplate1.postForEntity("https://gatewaytestapi.sxczgkj.cn/gate-service/trans/pay", req, String.class);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TradeQueryReq req=new TradeQueryReq();
|
// TradeQueryReq req=new TradeQueryReq();
|
||||||
@@ -572,11 +791,8 @@ public class PayService {
|
|||||||
// ResponseEntity<String> response= restTemplate1.postForEntity("https://gateway.api.sxczgkj.cn/gate-service/merchantOrder/tradeQuery",req,String.class);
|
// ResponseEntity<String> response= restTemplate1.postForEntity("https://gateway.api.sxczgkj.cn/gate-service/merchantOrder/tradeQuery",req,String.class);
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
System.out.println(">>>>>>>>>>>>>>>"+response.getBody());
|
System.out.println(">>>>>>>>>>>>>>>" + response.getBody());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,16 +10,14 @@ import com.chaozhanggui.system.cashierservice.entity.vo.*;
|
|||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import com.chaozhanggui.system.cashierservice.socket.AppWebSocketServer;
|
import com.chaozhanggui.system.cashierservice.socket.AppWebSocketServer;
|
||||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
import com.chaozhanggui.system.cashierservice.util.*;
|
||||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
|
||||||
import com.chaozhanggui.system.cashierservice.util.LocationUtils;
|
|
||||||
import com.chaozhanggui.system.cashierservice.util.Threads;
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -64,6 +62,13 @@ public class ProductService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
TbProductSkuMapper tbProductSkuMapper;
|
TbProductSkuMapper tbProductSkuMapper;
|
||||||
|
|
||||||
|
public Result queryShopIdByTableCode(String code) {
|
||||||
|
String shopId = tbShopTableMapper.queryShopIdByTableCode(code);
|
||||||
|
if (StringUtils.isBlank(shopId)) {
|
||||||
|
return Result.fail("台桌信息不存在");
|
||||||
|
}
|
||||||
|
return Result.success(CodeEnum.SUCCESS, shopId);
|
||||||
|
}
|
||||||
|
|
||||||
public Result queryProduct(String code, String productGroupId) {
|
public Result queryProduct(String code, String productGroupId) {
|
||||||
|
|
||||||
@@ -142,17 +147,40 @@ public class ProductService {
|
|||||||
* 销量榜
|
* 销量榜
|
||||||
* 咖啡饮品
|
* 咖啡饮品
|
||||||
*/
|
*/
|
||||||
public PageInfo products(HomeDto homeDto) throws ExecutionException, InterruptedException {
|
public PageInfo products(HomeDto homeDto) {
|
||||||
|
if (homeDto.getOrderBy() == 5) {
|
||||||
|
homeDto.setPage(1);
|
||||||
|
homeDto.setSize(4);
|
||||||
|
}
|
||||||
PageHelper.startPage(homeDto.getPage(), homeDto.getSize());
|
PageHelper.startPage(homeDto.getPage(), homeDto.getSize());
|
||||||
//经纬度(附近一km)
|
//经纬度(附近一km)
|
||||||
Map<String, double[]> topAndBottomMap = LocationUtils.returnLLSquarePoint(
|
Map<String, double[]> topAndBottomMap = LocationUtils.returnLLSquarePoint(
|
||||||
Double.parseDouble(homeDto.getLng()), Double.parseDouble(homeDto.getLat()), homeDto.getDistanceInKm());
|
Double.parseDouble(homeDto.getLng()), Double.parseDouble(homeDto.getLat()), homeDto.getDistanceInKm());
|
||||||
|
Long stTime = null;
|
||||||
List<ShopGroupInfoVo> shopGroupInfoVos = tbProductMapper.selGroups(
|
Long enTime = null;
|
||||||
homeDto.getType(),
|
List<ShopGroupInfoVo> shopGroupInfoVos = new ArrayList<>();
|
||||||
topAndBottomMap.get("rightTopPoint")[1], topAndBottomMap.get("rightTopPoint")[0],
|
if (homeDto.getOrderBy() == 4) {
|
||||||
topAndBottomMap.get("leftBottomPoint")[1], topAndBottomMap.get("leftBottomPoint")[0],
|
if (homeDto.getDateType() == 0) {
|
||||||
homeDto.getAddress(), homeDto.getOrderBy().toString(), homeDto.getLng(), homeDto.getLat());
|
stTime = DateUtils.getDayStartLong();
|
||||||
|
enTime = DateUtils.getDayEndLong();
|
||||||
|
} else if (homeDto.getDateType() == 1) {
|
||||||
|
enTime = System.currentTimeMillis();
|
||||||
|
stTime = enTime - 3600000L * 2;
|
||||||
|
}
|
||||||
|
shopGroupInfoVos = tbProductMapper.selHotGroups(
|
||||||
|
homeDto.getType(),
|
||||||
|
DateUtils.getStrTime(new Date(stTime)), DateUtils.getStrTime(new Date(enTime)),
|
||||||
|
homeDto.getAddress(), homeDto.getOrderBy().toString(), homeDto.getLng(), homeDto.getLat());
|
||||||
|
} else {
|
||||||
|
shopGroupInfoVos = tbProductMapper.selGroups(
|
||||||
|
homeDto.getType(),
|
||||||
|
topAndBottomMap.get("rightTopPoint")[1], topAndBottomMap.get("rightTopPoint")[0],
|
||||||
|
topAndBottomMap.get("leftBottomPoint")[1], topAndBottomMap.get("leftBottomPoint")[0],
|
||||||
|
homeDto.getAddress(), homeDto.getOrderBy().toString(), homeDto.getLng(), homeDto.getLat());
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isEmpty(shopGroupInfoVos)) {
|
||||||
|
return new PageInfo();
|
||||||
|
}
|
||||||
List<Integer> productIds = shopGroupInfoVos.stream().map(ShopGroupInfoVo::getProId).collect(Collectors.toList());
|
List<Integer> productIds = shopGroupInfoVos.stream().map(ShopGroupInfoVo::getProId).collect(Collectors.toList());
|
||||||
List<String> stringList = productIds.stream()
|
List<String> stringList = productIds.stream()
|
||||||
.map(Object::toString) // 将 Integer 对象映射为 String 对象
|
.map(Object::toString) // 将 Integer 对象映射为 String 对象
|
||||||
@@ -196,7 +224,7 @@ public class ProductService {
|
|||||||
homeVO.setDiscount(BigDecimal.ZERO);
|
homeVO.setDiscount(BigDecimal.ZERO);
|
||||||
} else {
|
} else {
|
||||||
homeVO.setOriginPrice(tbProductSku.getOriginPrice());
|
homeVO.setOriginPrice(tbProductSku.getOriginPrice());
|
||||||
homeVO.setDiscount(tbProductSku.getOriginPrice().divide(tbProductSku.getSalePrice(), 2, RoundingMode.DOWN).multiply(BigDecimal.TEN));
|
homeVO.setDiscount(BigDecimalUtils.getDiscount(tbProductSku.getOriginPrice(), tbProductSku.getSalePrice()));
|
||||||
}
|
}
|
||||||
//销量
|
//销量
|
||||||
homeVO.setRealSalesNumber(new BigDecimal(o.getNumber()));
|
homeVO.setRealSalesNumber(new BigDecimal(o.getNumber()));
|
||||||
@@ -225,15 +253,13 @@ public class ProductService {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public Result productInfo(Integer productId, String lat, String lng, String environment) throws Exception {
|
public Result productInfo(Integer productId, String lat, String lng, String environment) throws Exception {
|
||||||
CompletableFuture<TbProduct> product = CompletableFuture.supplyAsync(() ->
|
CompletableFuture<TbProductWithBLOBs> product = CompletableFuture.supplyAsync(() ->
|
||||||
tbProductMapper.selectById(productId));
|
tbProductMapper.selectByPrimaryKey(productId));
|
||||||
CompletableFuture<List<TbProductSku>> productSku = CompletableFuture.supplyAsync(() ->
|
CompletableFuture<List<TbProductSku>> productSku = CompletableFuture.supplyAsync(() ->
|
||||||
tbProductSkuMapper.selectSku(productId.toString()));
|
tbProductSkuMapper.selectSku(productId.toString()));
|
||||||
CompletableFuture<List<TagProductVO>> dictPro = CompletableFuture.supplyAsync(() ->
|
Threads.call(product, productSku);
|
||||||
tagProductDeptsMapper.queryTagByProductId(productId.toString()));
|
|
||||||
Threads.call(product, productSku, dictPro);
|
|
||||||
|
|
||||||
TbProduct tbProduct = product.get();
|
TbProductWithBLOBs tbProduct = product.get();
|
||||||
TbShopInfo tbShopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(tbProduct.getShopId()));
|
TbShopInfo tbShopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(tbProduct.getShopId()));
|
||||||
TbPurchaseNotice tbPurchaseNotice = purchaseNoticeMapper.queryByCouponId(tbProduct.getId());
|
TbPurchaseNotice tbPurchaseNotice = purchaseNoticeMapper.queryByCouponId(tbProduct.getId());
|
||||||
|
|
||||||
@@ -254,7 +280,7 @@ public class ProductService {
|
|||||||
productInfo.setDiscount(BigDecimal.ZERO);
|
productInfo.setDiscount(BigDecimal.ZERO);
|
||||||
} else {
|
} else {
|
||||||
productInfo.setOriginPrice(tbProductSku.getSalePrice());
|
productInfo.setOriginPrice(tbProductSku.getSalePrice());
|
||||||
productInfo.setDiscount(tbProductSku.getOriginPrice().divide(tbProductSku.getSalePrice(), 2, RoundingMode.DOWN).multiply(BigDecimal.TEN));
|
productInfo.setDiscount(BigDecimalUtils.getDiscount(tbProductSku.getOriginPrice(), tbProductSku.getSalePrice()));
|
||||||
}
|
}
|
||||||
//现价
|
//现价
|
||||||
productInfo.setSalePrice(new BigDecimal(tbProductSku.getSalePrice().toString()));
|
productInfo.setSalePrice(new BigDecimal(tbProductSku.getSalePrice().toString()));
|
||||||
@@ -264,34 +290,33 @@ public class ProductService {
|
|||||||
//名称
|
//名称
|
||||||
productInfo.setProductName(tbProduct.getName());
|
productInfo.setProductName(tbProduct.getName());
|
||||||
//店铺
|
//店铺
|
||||||
productInfo.setShopName(tbShopInfo.getShopName() + (StringUtils.isNotBlank(tbShopInfo.getChainName()) ? "(" + tbShopInfo.getChainName() + ")" : ""));
|
productInfo.setShopName(tbShopInfo.getShopName());
|
||||||
|
if (StringUtils.isNotBlank(tbShopInfo.getChainName())) {
|
||||||
|
productInfo.setChainName(tbShopInfo.getChainName());
|
||||||
|
Integer i = tbShopInfoMapper.selNumByChain(tbShopInfo.getChainName());
|
||||||
|
productInfo.setShopNum(i);
|
||||||
|
}
|
||||||
productInfo.setPhone(tbShopInfo.getPhone());
|
productInfo.setPhone(tbShopInfo.getPhone());
|
||||||
productInfo.setBusinessTime(tbShopInfo.getBusinessTime());
|
productInfo.setBusinessTime(tbShopInfo.getBusinessStartDay() + "至" + tbShopInfo.getBusinessEndDay() + " " + tbShopInfo.getBusinessTime());
|
||||||
BigDecimal distance = LocationUtils.getDistanceFrom2LngLat(
|
BigDecimal distance = LocationUtils.getDistanceFrom2LngLat(
|
||||||
Double.parseDouble(lng), Double.parseDouble(lat),
|
Double.parseDouble(lng), Double.parseDouble(lat),
|
||||||
Double.parseDouble(tbShopInfo.getLng()), Double.parseDouble(tbShopInfo.getLat()));
|
Double.parseDouble(tbShopInfo.getLng()), Double.parseDouble(tbShopInfo.getLat()));
|
||||||
productInfo.setDistances(distance.toString());//距离
|
productInfo.setDistances(distance.toString());//距离
|
||||||
productInfo.setAddress(tbShopInfo.getAddress());
|
productInfo.setAddress(tbShopInfo.getAddress());
|
||||||
|
|
||||||
//商品 暂时只做单商品
|
List<ProductVo> productVos = JSONUtil.parseListTNewList(tbProduct.getGroupSnap(), ProductVo.class);
|
||||||
ProductVo productVo = new ProductVo();
|
for (ProductVo productVo : productVos) {
|
||||||
TbShopUnit tbShopUnit = unitMapper.selectByPrimaryKey(Integer.valueOf(tbProduct.getUnitId()));
|
for (ProductVo.Food good : productVo.getGoods()) {
|
||||||
TbShopCategory tbShopCategory = categoryMapper.selectByPrimaryKey(Integer.valueOf(tbProduct.getCategoryId()));
|
List<TagProductVO> dictPro = tagProductDeptsMapper.queryTagByProductId(good.getId().toString());
|
||||||
productVo.setTitle(tbShopCategory.getName());
|
good.setProTag(dictPro);
|
||||||
productVo.setNumber(1);
|
}
|
||||||
ProductVo.Food food = new ProductVo.Food();
|
|
||||||
food.setName(tbProduct.getName());
|
|
||||||
food.setUnitName(tbShopUnit.getName());
|
|
||||||
food.setLowPrice(tbProduct.getLowPrice());
|
|
||||||
|
|
||||||
for (TagProductVO tagProductVO : dictPro.get()) {
|
|
||||||
food.getProTag().add(tagProductVO);
|
|
||||||
}
|
}
|
||||||
productVo.getGoods().add(food);
|
|
||||||
productInfo.getProductList().add(productVo);
|
productInfo.setProductList(productVos);
|
||||||
productInfo.setPurchaseNotice(tbPurchaseNotice);
|
|
||||||
List<TbPlatformDict> tbPlatformDicts = platformDictMapper.queryAllByType("prodetail", environment);
|
List<TbPlatformDict> tbPlatformDicts = platformDictMapper.queryAllByType("prodetail", environment);
|
||||||
if (tbPurchaseNotice != null) {
|
if (tbPurchaseNotice != null) {
|
||||||
|
productInfo.setPurchaseNotice(tbPurchaseNotice);
|
||||||
if (tbPurchaseNotice.getBookingType().startsWith("无需预约")) {
|
if (tbPurchaseNotice.getBookingType().startsWith("无需预约")) {
|
||||||
List<TbPlatformDict> book = platformDictMapper.queryAllByType("prodetail-book", environment);
|
List<TbPlatformDict> book = platformDictMapper.queryAllByType("prodetail-book", environment);
|
||||||
tbPlatformDicts.addAll(book);
|
tbPlatformDicts.addAll(book);
|
||||||
@@ -311,15 +336,19 @@ public class ProductService {
|
|||||||
tbProductSkuMapper.selectSku(productId.toString()));
|
tbProductSkuMapper.selectSku(productId.toString()));
|
||||||
CompletableFuture<TbPurchaseNotice> notice = CompletableFuture.supplyAsync(() ->
|
CompletableFuture<TbPurchaseNotice> notice = CompletableFuture.supplyAsync(() ->
|
||||||
purchaseNoticeMapper.queryByCouponId(productId));
|
purchaseNoticeMapper.queryByCouponId(productId));
|
||||||
Threads.call(product, productSku,notice);
|
Threads.call(product, productSku, notice);
|
||||||
|
|
||||||
TbProduct tbProduct = product.get();
|
TbProduct tbProduct = product.get();
|
||||||
OrderConfirmVo confirmVo=new OrderConfirmVo();
|
OrderConfirmVo confirmVo = new OrderConfirmVo();
|
||||||
|
confirmVo.setProId(tbProduct.getId().toString());
|
||||||
|
confirmVo.setShopId(tbProduct.getShopId());
|
||||||
confirmVo.setProImg(tbProduct.getCoverImg());
|
confirmVo.setProImg(tbProduct.getCoverImg());
|
||||||
confirmVo.setProName(tbProduct.getName());
|
confirmVo.setProName(tbProduct.getName());
|
||||||
|
|
||||||
TbPurchaseNotice tbPurchaseNotice = notice.get();
|
TbPurchaseNotice tbPurchaseNotice = notice.get();
|
||||||
confirmVo.setAvaTime(tbPurchaseNotice.getAvailableTime());
|
if (tbPurchaseNotice != null) {
|
||||||
|
confirmVo.setAvaTime(tbPurchaseNotice.getAvailableTime());
|
||||||
|
}
|
||||||
|
|
||||||
//价格组装
|
//价格组装
|
||||||
for (TbProductSku tbProductSku : productSku.get()) {
|
for (TbProductSku tbProductSku : productSku.get()) {
|
||||||
@@ -329,13 +358,15 @@ public class ProductService {
|
|||||||
confirmVo.setSave(tbProductSku.getSalePrice());
|
confirmVo.setSave(tbProductSku.getSalePrice());
|
||||||
} else {
|
} else {
|
||||||
confirmVo.setOriginPrice(tbProductSku.getOriginPrice());
|
confirmVo.setOriginPrice(tbProductSku.getOriginPrice());
|
||||||
confirmVo.setSave(tbProductSku.getSalePrice());
|
confirmVo.setSave(tbProductSku.getOriginPrice().subtract(tbProductSku.getSalePrice()));
|
||||||
}
|
}
|
||||||
//现价=售价
|
//现价=售价
|
||||||
confirmVo.setSalePrice(tbProductSku.getSalePrice().subtract(tbProductSku.getOriginPrice()));
|
confirmVo.setSalePrice(tbProductSku.getSalePrice());
|
||||||
|
}
|
||||||
|
List<TbPlatformDict> tbPlatformDicts = platformDictMapper.queryAllByType("order_confirm_no_counpon", environment);
|
||||||
|
if (!CollectionUtils.isEmpty(tbPlatformDicts)) {
|
||||||
|
confirmVo.setCouponDetail(JSONUtil.parseListTNewList(tbPlatformDicts, TagVo.class).get(0));
|
||||||
}
|
}
|
||||||
List<TbPlatformDict> tbPlatformDicts = platformDictMapper.queryAllByType("order_confirm_no_counpon",environment);
|
|
||||||
confirmVo.setCouponDetail(JSONUtil.parseListTNewList(tbPlatformDicts, TagVo.class).get(0));
|
|
||||||
return Result.success(CodeEnum.SUCCESS, confirmVo);
|
return Result.success(CodeEnum.SUCCESS, confirmVo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.util;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class BigDecimalUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 折扣计算
|
||||||
|
* @param orPrice 原价
|
||||||
|
* @param saPrice 现价
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static BigDecimal getDiscount(BigDecimal orPrice,BigDecimal saPrice){
|
||||||
|
BigDecimal discountRate = saPrice.divide(orPrice, 2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
// 将折扣率转换为百分比形式
|
||||||
|
BigDecimal discountPercentage = discountRate.multiply(BigDecimal.TEN);
|
||||||
|
return discountPercentage;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -269,6 +269,16 @@ public class DateUtils {
|
|||||||
cal.set(Calendar.MILLISECOND, 999);
|
cal.set(Calendar.MILLISECOND, 999);
|
||||||
return cal.getTime();
|
return cal.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Long getDayStartLong() {
|
||||||
|
// 获取今天的日期和时间(00:00:00)
|
||||||
|
LocalDateTime todayStart = LocalDateTime.now().toLocalDate().atStartOfDay();
|
||||||
|
// 转换为UTC时间戳(毫秒)
|
||||||
|
long timestampInMillis = todayStart.toInstant(ZoneOffset.UTC).toEpochMilli();
|
||||||
|
|
||||||
|
return timestampInMillis;
|
||||||
|
}
|
||||||
|
|
||||||
public static Long getDayEndLong() {
|
public static Long getDayEndLong() {
|
||||||
// 获取今天的日期和时间(00:00:00)
|
// 获取今天的日期和时间(00:00:00)
|
||||||
LocalDateTime todayStart = LocalDateTime.now().toLocalDate().atStartOfDay();
|
LocalDateTime todayStart = LocalDateTime.now().toLocalDate().atStartOfDay();
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.util;
|
package com.chaozhanggui.system.cashierservice.util;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -9,7 +11,27 @@ import static java.lang.Math.*;
|
|||||||
import static java.lang.Math.sin;
|
import static java.lang.Math.sin;
|
||||||
|
|
||||||
public class LocationUtils {
|
public class LocationUtils {
|
||||||
|
/**
|
||||||
|
* 通过Ip获取定位信息
|
||||||
|
* @param ip
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getGPSByIp(String ip) {
|
||||||
|
Map<String, String> param = new HashMap<>();
|
||||||
|
//超掌柜生活-用户端
|
||||||
|
param.put("key", "7a7f2e4790ea222660a027352ee3af39");
|
||||||
|
if(StringUtils.isNotBlank(ip)){
|
||||||
|
param.put("ip", ip);
|
||||||
|
}
|
||||||
|
String s = HttpClientUtil.doGet("https://restapi.amap.com/v3/ip", param);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行政区域查询
|
||||||
|
* @param keywords
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public static String district(String keywords) {
|
public static String district(String keywords) {
|
||||||
Map<String, String> param = new HashMap<>();
|
Map<String, String> param = new HashMap<>();
|
||||||
//超掌柜生活-用户端
|
//超掌柜生活-用户端
|
||||||
@@ -57,20 +79,23 @@ public class LocationUtils {
|
|||||||
* 右上顶点 double[] leftTopPoints = stringMap.get("rightTopPoint");
|
* 右上顶点 double[] leftTopPoints = stringMap.get("rightTopPoint");
|
||||||
* 左下点 double[] leftBottomPoints = stringMap.get("leftBottomPoint");
|
* 左下点 double[] leftBottomPoints = stringMap.get("leftBottomPoint");
|
||||||
*/
|
*/
|
||||||
public static Map<String, double[]> returnLLSquarePoint(double longitude, double latitude, double distanceInKm) {
|
public static Map<String, double[]> returnLLSquarePoint(double longitude, double latitude, String distanceInKm) {
|
||||||
|
BigDecimal distanceKm = new BigDecimal(10);
|
||||||
|
if (StringUtils.isNotBlank(distanceInKm)) {
|
||||||
|
distanceKm = new BigDecimal(distanceInKm);
|
||||||
|
}
|
||||||
Map<String, double[]> squareMap = new HashMap<>();
|
Map<String, double[]> squareMap = new HashMap<>();
|
||||||
BigDecimal bdlongitude = new BigDecimal(longitude);
|
BigDecimal bdlongitude = new BigDecimal(longitude);
|
||||||
// 地球平均半径,单位:千米
|
// 地球平均半径,单位:千米
|
||||||
BigDecimal earthRadius = new BigDecimal("6378.137");
|
BigDecimal earthRadius = new BigDecimal("6378.137");
|
||||||
// 将距离转换为弧度
|
// 将距离转换为弧度
|
||||||
|
BigDecimal radialDistance = distanceKm.divide(earthRadius, 10, RoundingMode.HALF_UP);
|
||||||
BigDecimal radialDistance = BigDecimal.valueOf(distanceInKm).divide(earthRadius, 10, RoundingMode.HALF_UP);
|
|
||||||
// 计算纬度上变化对应的角度
|
// 计算纬度上变化对应的角度
|
||||||
BigDecimal dLatitude = BigDecimal.valueOf(Math.toDegrees(2 * Math.asin(Math.sin(radialDistance.divide(BigDecimal.valueOf(2)).doubleValue()) / Math.cos(Math.toRadians(latitude)))));
|
BigDecimal dLatitude = BigDecimal.valueOf(Math.toDegrees(2 * Math.asin(Math.sin(radialDistance.divide(BigDecimal.valueOf(2)).doubleValue()) / Math.cos(Math.toRadians(latitude)))));
|
||||||
// 计算经度上变化对应的角度,这里需要考虑纬度对距离的影响
|
// 计算经度上变化对应的角度,这里需要考虑纬度对距离的影响
|
||||||
// 使用Haversine公式来估算在给定纬度上,距离对应的经度变化
|
// 使用Haversine公式来估算在给定纬度上,距离对应的经度变化
|
||||||
BigDecimal estimatedLongitudeDistance = getDistanceFrom2LngLat(latitude, longitude, latitude, bdlongitude.add(BigDecimal.valueOf(0.01)).doubleValue()); // 假设0.01度经度变化对应的距离
|
BigDecimal estimatedLongitudeDistance = getDistanceFrom2LngLat(latitude, longitude, latitude, bdlongitude.add(BigDecimal.valueOf(0.01)).doubleValue()); // 假设0.01度经度变化对应的距离
|
||||||
BigDecimal dLongitude = BigDecimal.valueOf(distanceInKm).divide(estimatedLongitudeDistance, 10, RoundingMode.HALF_UP).multiply(new BigDecimal("0.0192736")); // 根据比例计算经度变化
|
BigDecimal dLongitude = distanceKm.divide(estimatedLongitudeDistance, 10, RoundingMode.HALF_UP).multiply(new BigDecimal("0.0192736")); // 根据比例计算经度变化
|
||||||
// 正方形四个顶点的坐标
|
// 正方形四个顶点的坐标
|
||||||
double[] rightTopPoint = {BigDecimal.valueOf(latitude).add(dLatitude.divide(BigDecimal.valueOf(2))).doubleValue(), BigDecimal.valueOf(longitude).add(dLongitude.divide(BigDecimal.valueOf(2))).doubleValue()};
|
double[] rightTopPoint = {BigDecimal.valueOf(latitude).add(dLatitude.divide(BigDecimal.valueOf(2))).doubleValue(), BigDecimal.valueOf(longitude).add(dLongitude.divide(BigDecimal.valueOf(2))).doubleValue()};
|
||||||
double[] leftBottomPoint = {BigDecimal.valueOf(latitude).subtract(dLatitude.divide(BigDecimal.valueOf(2))).doubleValue(), BigDecimal.valueOf(longitude).subtract(dLongitude.divide(BigDecimal.valueOf(2))).doubleValue()};
|
double[] leftBottomPoint = {BigDecimal.valueOf(latitude).subtract(dLatitude.divide(BigDecimal.valueOf(2))).doubleValue(), BigDecimal.valueOf(longitude).subtract(dLongitude.divide(BigDecimal.valueOf(2))).doubleValue()};
|
||||||
@@ -93,7 +118,7 @@ public class LocationUtils {
|
|||||||
}
|
}
|
||||||
//1KM
|
//1KM
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Map<String, double[]> stringMap = returnLLSquarePoint(108.975418, 34.280890, 5);
|
Map<String, double[]> stringMap = returnLLSquarePoint(108.975418, 34.280890, "5");
|
||||||
double[] leftTopPoints = stringMap.get("rightTopPoint");
|
double[] leftTopPoints = stringMap.get("rightTopPoint");
|
||||||
double[] leftBottomPoints = stringMap.get("leftBottomPoint");
|
double[] leftBottomPoints = stringMap.get("leftBottomPoint");
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ mybatis:
|
|||||||
ysk:
|
ysk:
|
||||||
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
|
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
|
||||||
callBackurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBack
|
callBackurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBack
|
||||||
|
callBackGroupurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBackGroup
|
||||||
callBackIn: https://p40312246f.goho.co/cashierService/notify/memberInCallBack
|
callBackIn: https://p40312246f.goho.co/cashierService/notify/memberInCallBack
|
||||||
default: 18710449883
|
default: 18710449883
|
||||||
server:
|
server:
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ mybatis:
|
|||||||
ysk:
|
ysk:
|
||||||
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
|
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
|
||||||
callBackurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBack
|
callBackurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBack
|
||||||
|
callBackGroupurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBackGroup
|
||||||
callBackIn: https://p40312246f.goho.co/cashierService/notify/memberInCallBack
|
callBackIn: https://p40312246f.goho.co/cashierService/notify/memberInCallBack
|
||||||
default: 18710449883
|
default: 18710449883
|
||||||
server:
|
server:
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ mybatis:
|
|||||||
ysk:
|
ysk:
|
||||||
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
|
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
|
||||||
callBackurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBack
|
callBackurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBack
|
||||||
|
callBackGroupurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBackGroup
|
||||||
callBackIn: https://p40312246f.goho.co/cashierService/notify/memberInCallBack
|
callBackIn: https://p40312246f.goho.co/cashierService/notify/memberInCallBack
|
||||||
default: 18710449883
|
default: 18710449883
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ mybatis:
|
|||||||
ysk:
|
ysk:
|
||||||
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
|
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
|
||||||
callBackurl: https://cashier.sxczgkj.cn/cashierService/notify/notifyCallBack
|
callBackurl: https://cashier.sxczgkj.cn/cashierService/notify/notifyCallBack
|
||||||
|
callBackGroupurl: https://cashier.sxczgkj.cn/cashierService/notify/notifyCallBackGroup
|
||||||
callBackIn: https://cashier.sxczgkj.cn/cashierService/notify/memberInCallBack
|
callBackIn: https://cashier.sxczgkj.cn/cashierService/notify/memberInCallBack
|
||||||
default: 19191703856
|
default: 19191703856
|
||||||
prod: prod1
|
prod: prod1
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ mybatis:
|
|||||||
ysk:
|
ysk:
|
||||||
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
|
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
|
||||||
callBackurl: https://cashier.sxczgkj.cn/cashierService/notify/notifyCallBack
|
callBackurl: https://cashier.sxczgkj.cn/cashierService/notify/notifyCallBack
|
||||||
|
callBackGroupurl: https://cashier.sxczgkj.cn/cashierService/notify/notifyCallBackGroup
|
||||||
callBackIn: https://cashier.sxczgkj.cn/cashierService/notify/memberInCallBack
|
callBackIn: https://cashier.sxczgkj.cn/cashierService/notify/memberInCallBack
|
||||||
default: 19191703856
|
default: 19191703856
|
||||||
prod: prod2
|
prod: prod2
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ mybatis:
|
|||||||
ysk:
|
ysk:
|
||||||
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
|
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
|
||||||
callBackurl: https://cashierapplet.sxczgkj.cn/cashierService/notify/notifyCallBack
|
callBackurl: https://cashierapplet.sxczgkj.cn/cashierService/notify/notifyCallBack
|
||||||
|
callBackGroupurl: https://cashierapplet.sxczgkj.cn/cashierService/notify/notifyCallBackGroup
|
||||||
callBackIn: https://cashierapplet.sxczgkj.cn/cashierService/notify/memberInCallBack
|
callBackIn: https://cashierapplet.sxczgkj.cn/cashierService/notify/memberInCallBack
|
||||||
default: 18710449883
|
default: 18710449883
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.SysDictDetailMapper">
|
|
||||||
|
|
||||||
<select id="selectHot" resultType="com.chaozhanggui.system.cashierservice.entity.SysDict">
|
|
||||||
select *
|
|
||||||
from sys_dict
|
|
||||||
where type = 'hot'
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectByType" resultType="com.chaozhanggui.system.cashierservice.entity.SysDict">
|
|
||||||
select *
|
|
||||||
from sys_dict
|
|
||||||
where type = 'common'
|
|
||||||
<if test="type != null and type !=''">
|
|
||||||
or type = #{type}
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectByDictId" resultType="com.chaozhanggui.system.cashierservice.entity.SysDictDetail">
|
|
||||||
select * from sys_dict_detail
|
|
||||||
where dict_id = #{dictId}
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
||||||
@@ -1,117 +1,48 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.SysDictMapper">
|
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.SysDictMapper">
|
||||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.SysDict">
|
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.SysDict">
|
||||||
<id column="dict_id" jdbcType="BIGINT" property="dictId" />
|
<id column="dict_id" jdbcType="BIGINT" property="dictId"/>
|
||||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
<result column="dict_name" jdbcType="VARCHAR" property="dictName"/>
|
||||||
<result column="description" jdbcType="VARCHAR" property="description" />
|
<result column="name" jdbcType="VARCHAR" property="name"/>
|
||||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
<result column="value" jdbcType="VARCHAR" property="value"/>
|
||||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
<result column="is_child" jdbcType="INTEGER" property="isChild"/>
|
||||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
</resultMap>
|
||||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
<sql id="Base_Column_List">
|
||||||
</resultMap>
|
dict_id
|
||||||
<sql id="Base_Column_List">
|
, dict_name , name, value, is_child
|
||||||
dict_id, name, description, create_by, update_by, create_time, update_time
|
</sql>
|
||||||
</sql>
|
<sql id="Child_Column_List">
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
dict_id
|
||||||
select
|
, dict_name , name, value
|
||||||
<include refid="Base_Column_List" />
|
</sql>
|
||||||
from sys_dict
|
|
||||||
where dict_id = #{dictId,jdbcType=BIGINT}
|
<select id="selectHot" resultMap="BaseResultMap">
|
||||||
</select>
|
select
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
<include refid="Base_Column_List"/>
|
||||||
delete from sys_dict
|
from sys_dict
|
||||||
where dict_id = #{dictId,jdbcType=BIGINT}
|
where type = 'hot'
|
||||||
</delete>
|
and status =1
|
||||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.SysDict">
|
order by sort
|
||||||
insert into sys_dict (dict_id, name, description,
|
</select>
|
||||||
create_by, update_by, create_time,
|
|
||||||
update_time)
|
<select id="selectByType" resultMap="BaseResultMap">
|
||||||
values (#{dictId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
|
select
|
||||||
#{createBy,jdbcType=VARCHAR}, #{updateBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
<include refid="Base_Column_List"/>
|
||||||
#{updateTime,jdbcType=TIMESTAMP})
|
from sys_dict
|
||||||
</insert>
|
where type = 'common'
|
||||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.SysDict">
|
<if test="type != null and type !=''">
|
||||||
insert into sys_dict
|
or type = #{type}
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
</if>
|
||||||
<if test="dictId != null">
|
and status =1
|
||||||
dict_id,
|
order by sort
|
||||||
</if>
|
</select>
|
||||||
<if test="name != null">
|
|
||||||
name,
|
<select id="selectByDictId" resultMap="BaseResultMap">
|
||||||
</if>
|
select
|
||||||
<if test="description != null">
|
<include refid="Child_Column_List"/>
|
||||||
description,
|
from sys_dict
|
||||||
</if>
|
where dict_id = #{dictId} and status =1
|
||||||
<if test="createBy != null">
|
order by sort
|
||||||
create_by,
|
</select>
|
||||||
</if>
|
|
||||||
<if test="updateBy != null">
|
|
||||||
update_by,
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
|
||||||
create_time,
|
|
||||||
</if>
|
|
||||||
<if test="updateTime != null">
|
|
||||||
update_time,
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="dictId != null">
|
|
||||||
#{dictId,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="name != null">
|
|
||||||
#{name,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="description != null">
|
|
||||||
#{description,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createBy != null">
|
|
||||||
#{createBy,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="updateBy != null">
|
|
||||||
#{updateBy,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
|
||||||
#{createTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="updateTime != null">
|
|
||||||
#{updateTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.SysDict">
|
|
||||||
update sys_dict
|
|
||||||
<set>
|
|
||||||
<if test="name != null">
|
|
||||||
name = #{name,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="description != null">
|
|
||||||
description = #{description,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createBy != null">
|
|
||||||
create_by = #{createBy,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="updateBy != null">
|
|
||||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
|
||||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="updateTime != null">
|
|
||||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
</set>
|
|
||||||
where dict_id = #{dictId,jdbcType=BIGINT}
|
|
||||||
</update>
|
|
||||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.SysDict">
|
|
||||||
update sys_dict
|
|
||||||
set name = #{name,jdbcType=VARCHAR},
|
|
||||||
description = #{description,jdbcType=VARCHAR},
|
|
||||||
create_by = #{createBy,jdbcType=VARCHAR},
|
|
||||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
|
||||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
||||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
|
||||||
where dict_id = #{dictId,jdbcType=BIGINT}
|
|
||||||
</update>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
127
src/main/resources/mapper/TbGroupOrderCouponMapper.xml
Normal file
127
src/main/resources/mapper/TbGroupOrderCouponMapper.xml
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbGroupOrderCouponMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbGroupOrderCoupon" id="TbGroupOrderCouponMap">
|
||||||
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||||
|
<result property="orderId" column="order_id" jdbcType="INTEGER"/>
|
||||||
|
<result property="couponNo" column="coupon_no" jdbcType="VARCHAR"/>
|
||||||
|
<result property="isRefund" column="is_refund" jdbcType="INTEGER"/>
|
||||||
|
<result property="refundAmount" column="refund_amount" jdbcType="NUMERIC"/>
|
||||||
|
<result property="refundReason" column="refund_reason" jdbcType="VARCHAR"/>
|
||||||
|
<result property="refundDesc" column="refund_desc" jdbcType="VARCHAR"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id
|
||||||
|
, order_id, coupon_no, is_refund, refund_amount, refund_reason, refund_desc </sql>
|
||||||
|
|
||||||
|
<!--查询单个-->
|
||||||
|
<select id="queryById" resultMap="TbGroupOrderCouponMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
|
||||||
|
from tb_group_order_coupon
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--查询单个-->
|
||||||
|
<select id="queryByOrderId" resultMap="TbGroupOrderCouponMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
|
||||||
|
from tb_group_order_coupon
|
||||||
|
where order_id = #{orderId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="queryNoRefundByOrderId" resultMap="TbGroupOrderCouponMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
|
||||||
|
from tb_group_order_coupon
|
||||||
|
where order_id = #{orderId}
|
||||||
|
AND isRefund = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--查询指定行数据-->
|
||||||
|
<select id="queryAll" resultMap="TbGroupOrderCouponMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
|
||||||
|
from tb_group_order_coupon
|
||||||
|
<where>
|
||||||
|
<if test="id != null">
|
||||||
|
and id = #{id}
|
||||||
|
</if>
|
||||||
|
<if test="orderId != null">
|
||||||
|
and order_id = #{orderId}
|
||||||
|
</if>
|
||||||
|
<if test="couponNo != null and couponNo != ''">
|
||||||
|
and coupon_no = #{couponNo}
|
||||||
|
</if>
|
||||||
|
<if test="isRefund != null">
|
||||||
|
and is_refund = #{isRefund}
|
||||||
|
</if>
|
||||||
|
<if test="refundAmount != null">
|
||||||
|
and refund_amount = #{refundAmount}
|
||||||
|
</if>
|
||||||
|
<if test="refundReason != null and refundReason != ''">
|
||||||
|
and refund_reason = #{refundReason}
|
||||||
|
</if>
|
||||||
|
<if test="refundDesc != null and refundDesc != ''">
|
||||||
|
and refund_desc = #{refundDesc}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<!--新增所有列-->
|
||||||
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into tb_group_order_coupon(order_id, coupon_no, is_refund, refund_amount, refund_reason, refund_desc)
|
||||||
|
values (#{orderId}, #{couponNo}, #{isRefund}, #{refundAmount}, #{refundReason}, #{refundDesc})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into tb_group_order_coupon(order_id, coupon_no, is_refund, refund_amount, refund_reason, refund_desc)
|
||||||
|
values
|
||||||
|
<foreach collection="entities" item="entity" separator=",">
|
||||||
|
(#{entity.orderId}, #{entity.couponNo}, #{entity.isRefund}, #{entity.refundAmount}, #{entity.refundReason},
|
||||||
|
#{entity.refundDesc})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!--通过主键修改数据-->
|
||||||
|
<update id="update">
|
||||||
|
update tb_group_order_coupon
|
||||||
|
<set>
|
||||||
|
<if test="orderId != null">
|
||||||
|
order_id = #{orderId},
|
||||||
|
</if>
|
||||||
|
<if test="couponNo != null and couponNo != ''">
|
||||||
|
coupon_no = #{couponNo},
|
||||||
|
</if>
|
||||||
|
<if test="isRefund != null">
|
||||||
|
is_refund = #{isRefund},
|
||||||
|
</if>
|
||||||
|
<if test="refundAmount != null">
|
||||||
|
refund_amount = #{refundAmount},
|
||||||
|
</if>
|
||||||
|
<if test="refundReason != null and refundReason != ''">
|
||||||
|
refund_reason = #{refundReason},
|
||||||
|
</if>
|
||||||
|
<if test="refundDesc != null and refundDesc != ''">
|
||||||
|
refund_desc = #{refundDesc},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!--通过主键删除-->
|
||||||
|
<delete id="deleteById">
|
||||||
|
delete
|
||||||
|
from tb_group_order_coupon
|
||||||
|
where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
||||||
@@ -5,18 +5,20 @@
|
|||||||
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbGroupOrderInfo" id="TbGroupOrderInfoMap">
|
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbGroupOrderInfo" id="TbGroupOrderInfoMap">
|
||||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||||
<result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
|
<result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
|
||||||
|
<result property="merchantId" column="merchant_id" jdbcType="INTEGER"/>
|
||||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||||
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
||||||
<result property="proId" column="pro_id" jdbcType="INTEGER"/>
|
<result property="proId" column="pro_id" jdbcType="INTEGER"/>
|
||||||
<result property="proName" column="pro_name" jdbcType="VARCHAR"/>
|
|
||||||
<result property="proImg" column="pro_img" jdbcType="VARCHAR"/>
|
<result property="proImg" column="pro_img" jdbcType="VARCHAR"/>
|
||||||
<result property="couponNo" column="coupon_no" jdbcType="VARCHAR"/>
|
<result property="proName" column="pro_name" jdbcType="VARCHAR"/>
|
||||||
<result property="couponUrl" column="coupon_url" jdbcType="VARCHAR"/>
|
|
||||||
<result property="expDate" column="exp_date" jdbcType="TIMESTAMP"/>
|
<result property="expDate" column="exp_date" jdbcType="TIMESTAMP"/>
|
||||||
<result property="orderType" column="order_type" jdbcType="VARCHAR"/>
|
<result property="orderType" column="order_type" jdbcType="VARCHAR"/>
|
||||||
|
<result property="payType" column="pay_type" jdbcType="VARCHAR"/>
|
||||||
<result property="orderAmount" column="order_amount" jdbcType="NUMERIC"/>
|
<result property="orderAmount" column="order_amount" jdbcType="NUMERIC"/>
|
||||||
<result property="saveAmount" column="save_amount" jdbcType="NUMERIC"/>
|
<result property="saveAmount" column="save_amount" jdbcType="NUMERIC"/>
|
||||||
<result property="payAmount" column="pay_amount" jdbcType="NUMERIC"/>
|
<result property="payAmount" column="pay_amount" jdbcType="NUMERIC"/>
|
||||||
|
<result property="refundAmount" column="refund_amount" jdbcType="NUMERIC"/>
|
||||||
|
<result property="refundNumber" column="refund_number" jdbcType="INTEGER"/>
|
||||||
<result property="number" column="number" jdbcType="INTEGER"/>
|
<result property="number" column="number" jdbcType="INTEGER"/>
|
||||||
<result property="status" column="status" jdbcType="VARCHAR"/>
|
<result property="status" column="status" jdbcType="VARCHAR"/>
|
||||||
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
<result property="remark" column="remark" jdbcType="VARCHAR"/>
|
||||||
@@ -24,18 +26,20 @@
|
|||||||
<result property="payTime" column="pay_time" jdbcType="TIMESTAMP"/>
|
<result property="payTime" column="pay_time" jdbcType="TIMESTAMP"/>
|
||||||
<result property="refundAble" column="refund_able" jdbcType="INTEGER"/>
|
<result property="refundAble" column="refund_able" jdbcType="INTEGER"/>
|
||||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="verifier" column="verifier" jdbcType="VARCHAR"/>
|
||||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||||
<result property="payOrderNo" column="pay_order_no" jdbcType="VARCHAR"/>
|
<result property="payOrderNo" column="pay_order_no" jdbcType="VARCHAR"/>
|
||||||
<result property="tradeDay" column="trade_day" jdbcType="TIMESTAMP"/>
|
<result property="tradeDay" column="trade_day" jdbcType="TIMESTAMP"/>
|
||||||
<result property="source" column="source" jdbcType="INTEGER"/>
|
<result property="source" column="source" jdbcType="INTEGER"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id
|
id
|
||||||
, order_no, shop_id, user_id, pro_id, pro_name,pro_img, coupon_no, coupon_url, exp_date, order_type, order_amount, save_amount, pay_amount, number, status, remark, phone, pay_time, refund_able, create_time, update_time, pay_order_no, trade_day, source </sql>
|
, order_no, merchant_id, shop_id, user_id, pro_id, pro_img, pro_name, exp_date, order_type, pay_type, order_amount, save_amount, pay_amount, refund_amount, refund_number, number, status, remark, phone, pay_time, refund_able, create_time, verifier, update_time, pay_order_no, trade_day, source </sql>
|
||||||
<sql id="List_Column">
|
<sql id="List_Column">
|
||||||
id
|
id
|
||||||
, order_no, pro_name,pro_img,coupon_url,order_amount, pay_amount, number, status </sql>
|
, order_no, pro_name,pro_img,order_amount, pay_amount, number, status </sql>
|
||||||
|
|
||||||
<!--查询单个-->
|
<!--查询单个-->
|
||||||
<select id="queryById" resultMap="TbGroupOrderInfoMap">
|
<select id="queryById" resultMap="TbGroupOrderInfoMap">
|
||||||
@@ -46,6 +50,14 @@
|
|||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByPayOrderNo" resultMap="TbGroupOrderInfoMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
|
||||||
|
from tb_group_order_info
|
||||||
|
where pay_order_no = #{payOrderNO}
|
||||||
|
</select>
|
||||||
|
|
||||||
<!--查询指定行数据-->
|
<!--查询指定行数据-->
|
||||||
<select id="queryAll" resultType="com.chaozhanggui.system.cashierservice.entity.vo.GroupOrderListVo">
|
<select id="queryAll" resultType="com.chaozhanggui.system.cashierservice.entity.vo.GroupOrderListVo">
|
||||||
select
|
select
|
||||||
@@ -66,28 +78,31 @@
|
|||||||
order by create_time desc
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<!--新增所有列-->
|
<!--新增所有列-->
|
||||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||||
insert into tb_group_order_info(order_no, shop_id, user_id, pro_id, pro_name, pro_img, coupon_no, coupon_url,
|
insert into tb_group_order_info(order_no, merchant_id, shop_id, user_id, pro_id, pro_name, pro_img,
|
||||||
exp_date, order_type, order_amount, save_amount, pay_amount, number, status,
|
exp_date, order_type, pay_type, order_amount, save_amount, pay_amount, number,
|
||||||
|
refund_number, status,
|
||||||
remark, phone, pay_time, refund_able, create_time, update_time, pay_order_no,
|
remark, phone, pay_time, refund_able, create_time, update_time, pay_order_no,
|
||||||
trade_day, source)
|
trade_day, source)
|
||||||
values (#{orderNo}, #{shopId}, #{userId}, #{proId}, #{proName}, #{proImg}, #{couponNo}, #{couponUrl},
|
values (#{orderNo}, #{merchantId}, #{shopId}, #{userId}, #{proId}, #{proName}, #{proImg},
|
||||||
#{expDate}, #{orderType}, #{orderAmount}, #{saveAmount}, #{payAmount}, #{number}, #{status}, #{remark},
|
#{expDate}, #{orderType}, #{payType}, #{orderAmount}, #{saveAmount}, #{payAmount}, #{number},
|
||||||
|
#{refundNumber}, #{status}, #{remark},
|
||||||
#{phone}, #{payTime}, #{refundAble}, #{createTime}, #{updateTime}, #{payOrderNo}, #{tradeDay},
|
#{phone}, #{payTime}, #{refundAble}, #{createTime}, #{updateTime}, #{payOrderNo}, #{tradeDay},
|
||||||
#{source})
|
#{source})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
insert into tb_group_order_info(order_no, shop_id, user_id, pro_id, pro_name, pro_img, coupon_no, coupon_url,
|
insert into tb_group_order_info(order_no,merchant_id, shop_id, user_id, pro_id, pro_name, pro_img,
|
||||||
exp_date, order_type, order_amount, save_amount, pay_amount, number, status, remark, phone, pay_time,
|
exp_date, order_type, pay_type, order_amount, save_amount, pay_amount, number, status, remark, phone, pay_time,
|
||||||
refund_able, create_time, update_time, pay_order_no, trade_day, source)
|
refund_able, create_time, update_time, pay_order_no, trade_day, source)
|
||||||
values
|
values
|
||||||
<foreach collection="entities" item="entity" separator=",">
|
<foreach collection="entities" item="entity" separator=",">
|
||||||
(#{entity.orderNo}, #{entity.shopId}, #{entity.userId}, #{entity.proId}, #{entity.proName},#{entity.proImg}
|
(#{entity.orderNo},#{entity.merchantId} #{entity.shopId}, #{entity.userId}, #{entity.proId},
|
||||||
#{entity.couponNo}, #{entity.couponUrl}, #{entity.expDate}, #{entity.orderType},
|
#{entity.proName},#{entity.proImg},
|
||||||
#{entity.orderAmount}, #{entity.saveAmount}, #{entity.payAmount}, #{entity.number}, #{entity.status},
|
#{entity.expDate}, #{entity.orderType},
|
||||||
|
#{entity.payType}, #{entity.orderAmount}, #{entity.saveAmount}, #{entity.payAmount}, #{entity.number},
|
||||||
|
#{entity.status},
|
||||||
#{entity.remark}, #{entity.phone}, #{entity.payTime}, #{entity.refundAble}, #{entity.createTime},
|
#{entity.remark}, #{entity.phone}, #{entity.payTime}, #{entity.refundAble}, #{entity.createTime},
|
||||||
#{entity.updateTime}, #{entity.payOrderNo}, #{entity.tradeDay}, #{entity.source})
|
#{entity.updateTime}, #{entity.payOrderNo}, #{entity.tradeDay}, #{entity.source})
|
||||||
</foreach>
|
</foreach>
|
||||||
@@ -100,6 +115,9 @@
|
|||||||
<if test="orderNo != null and orderNo != ''">
|
<if test="orderNo != null and orderNo != ''">
|
||||||
order_no = #{orderNo},
|
order_no = #{orderNo},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="merchantId != null">
|
||||||
|
merchant_id = #{merchantId},
|
||||||
|
</if>
|
||||||
<if test="shopId != null">
|
<if test="shopId != null">
|
||||||
shop_id = #{shopId},
|
shop_id = #{shopId},
|
||||||
</if>
|
</if>
|
||||||
@@ -115,18 +133,15 @@
|
|||||||
<if test="proImg != null and proImg != ''">
|
<if test="proImg != null and proImg != ''">
|
||||||
pro_img = #{proImg},
|
pro_img = #{proImg},
|
||||||
</if>
|
</if>
|
||||||
<if test="couponNo != null and couponNo != ''">
|
|
||||||
coupon_no = #{couponNo},
|
|
||||||
</if>
|
|
||||||
<if test="couponUrl != null and couponUrl != ''">
|
|
||||||
coupon_url = #{couponUrl},
|
|
||||||
</if>
|
|
||||||
<if test="expDate != null">
|
<if test="expDate != null">
|
||||||
exp_date = #{expDate},
|
exp_date = #{expDate},
|
||||||
</if>
|
</if>
|
||||||
<if test="orderType != null and orderType != ''">
|
<if test="orderType != null and orderType != ''">
|
||||||
order_type = #{orderType},
|
order_type = #{orderType},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="payType != null and payType != ''">
|
||||||
|
pay_type = #{payType},
|
||||||
|
</if>
|
||||||
<if test="orderAmount != null">
|
<if test="orderAmount != null">
|
||||||
order_amount = #{orderAmount},
|
order_amount = #{orderAmount},
|
||||||
</if>
|
</if>
|
||||||
@@ -172,13 +187,5 @@
|
|||||||
</set>
|
</set>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<!--通过主键删除-->
|
|
||||||
<delete id="deleteById">
|
|
||||||
delete
|
|
||||||
from tb_group_order_info
|
|
||||||
where id = #{id}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|||||||
@@ -551,7 +551,6 @@
|
|||||||
|
|
||||||
|
|
||||||
order by a.id desc
|
order by a.id desc
|
||||||
Limit #{page}, #{size}
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectByPayOrderNo" resultMap="BaseResultMap">
|
<select id="selectByPayOrderNo" resultMap="BaseResultMap">
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||||
<result property="shareImg" column="share_img" jdbcType="VARCHAR"/>
|
<result property="shareImg" column="share_img" jdbcType="VARCHAR"/>
|
||||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="value" column="value" jdbcType="VARCHAR"/>
|
||||||
<result property="fontColor" column="font_color" jdbcType="VARCHAR"/>
|
<result property="fontColor" column="font_color" jdbcType="VARCHAR"/>
|
||||||
<result property="backColor" column="back_color" jdbcType="VARCHAR"/>
|
<result property="backColor" column="back_color" jdbcType="VARCHAR"/>
|
||||||
<result property="type" column="type" jdbcType="VARCHAR"/>
|
<result property="type" column="type" jdbcType="VARCHAR"/>
|
||||||
@@ -25,7 +26,7 @@
|
|||||||
<!--查询单个-->
|
<!--查询单个-->
|
||||||
<select id="queryById" resultMap="TbPlatformDictMap">
|
<select id="queryById" resultMap="TbPlatformDictMap">
|
||||||
select
|
select
|
||||||
id, name, type,font_color,back_color, cover_img, share_img, video, video_cover_img, jump_type, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
|
id, name,value, type,font_color,back_color, cover_img, share_img, video, video_cover_img, jump_type, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
|
||||||
from tb_platform_dict
|
from tb_platform_dict
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
@@ -33,17 +34,18 @@
|
|||||||
|
|
||||||
<select id="queryByIdList" resultMap="TbPlatformDictMap">
|
<select id="queryByIdList" resultMap="TbPlatformDictMap">
|
||||||
select
|
select
|
||||||
id, name, type, font_color, back_color, cover_img, share_img, video, video_cover_img, jump_type, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
|
id, name,value, type, font_color, back_color, cover_img, share_img, video, video_cover_img, jump_type, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
|
||||||
from tb_platform_dict
|
from tb_platform_dict
|
||||||
where id IN
|
where id IN
|
||||||
<foreach collection="idList" item="id" open="(" separator="," close=")">
|
<foreach collection="idList" item="id" open="(" separator="," close=")">
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
order by sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryAllByType" resultType="com.chaozhanggui.system.cashierservice.entity.TbPlatformDict">
|
<select id="queryAllByType" resultType="com.chaozhanggui.system.cashierservice.entity.TbPlatformDict">
|
||||||
select
|
select
|
||||||
id, name, type,font_color,back_color, cover_img, share_img, video, video_cover_img, jump_type, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
|
id, name,value, type,font_color,back_color, cover_img, share_img, video, video_cover_img, jump_type, abs_url, created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
|
||||||
from tb_platform_dict
|
from tb_platform_dict
|
||||||
<where>
|
<where>
|
||||||
<if test="type != null and type != ''">
|
<if test="type != null and type != ''">
|
||||||
@@ -56,6 +58,25 @@
|
|||||||
and is_show_mall = 1
|
and is_show_mall = 1
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
order by sort
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="queryGroupByValue" resultType="com.chaozhanggui.system.cashierservice.entity.TbPlatformDict">
|
||||||
|
select
|
||||||
|
id, name,value, type,font_color,back_color, cover_img, share_img, video, video_cover_img, jump_type, abs_url,
|
||||||
|
created_at, updated_at, is_show_cash, is_show_mall, is_show_app, sort
|
||||||
|
from tb_platform_dict
|
||||||
|
<where>
|
||||||
|
value = #{value}
|
||||||
|
and type = 'group'
|
||||||
|
<if test="environment == 'app'">
|
||||||
|
and is_show_app = 1
|
||||||
|
</if>
|
||||||
|
<if test="environment == 'wx'">
|
||||||
|
and is_show_mall = 1
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by sort
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|||||||
@@ -222,4 +222,16 @@
|
|||||||
</if>
|
</if>
|
||||||
order by g.sort asc
|
order by g.sort asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByShopId" resultMap="BaseResultMap">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
tb_product_group
|
||||||
|
where shop_id=#{shopId} and is_show=1
|
||||||
|
<if test="groupId != null">
|
||||||
|
and id = #{groupId}
|
||||||
|
</if>
|
||||||
|
order by g.sort asc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, category_id, spec_id, source_path, brand_id, merchant_id, shop_id, name, short_title,
|
id, category_id, spec_id, source_path, brand_id, merchant_id, shop_id, name, short_title,
|
||||||
type, pack_fee, low_price, low_member_price, unit_id, unit_snap, cover_img, share_img,
|
type, pack_fee, low_price, low_member_price, unit_id, unit_snap, cover_img, share_img, images,
|
||||||
video_cover_img, sort, limit_number, product_score, status, fail_msg, is_recommend,
|
video_cover_img, sort, limit_number, product_score, status, fail_msg, is_recommend,
|
||||||
is_hot, is_new, is_on_sale, is_show, type_enum, is_distribute, is_del, is_stock,
|
is_hot, is_new, is_on_sale, is_show, type_enum, is_distribute, is_del, is_stock,
|
||||||
is_pause_sale, is_free_freight, freight_id, strategy_type, strategy_id, is_vip, is_delete,
|
is_pause_sale, is_free_freight, freight_id, strategy_type, strategy_id, is_vip, is_delete,
|
||||||
@@ -882,6 +882,11 @@
|
|||||||
spec_table_headers = #{specTableHeaders,jdbcType=VARCHAR}
|
spec_table_headers = #{specTableHeaders,jdbcType=VARCHAR}
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="upGroupRealSalesNumber">
|
||||||
|
update tb_product
|
||||||
|
set real_sales_number = real_sales_number + #{number,jdbcType=INTEGER}
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
|
||||||
<select id="selectByIdIn" resultMap="BaseResultMap">
|
<select id="selectByIdIn" resultMap="BaseResultMap">
|
||||||
select *
|
select *
|
||||||
@@ -949,8 +954,8 @@
|
|||||||
pro.cover_img AS proImg,
|
pro.cover_img AS proImg,
|
||||||
pro.real_sales_number AS number
|
pro.real_sales_number AS number
|
||||||
FROM
|
FROM
|
||||||
tb_product pro
|
tb_product pro
|
||||||
LEFT JOIN tb_shop_info AS info ON info.id = pro.shop_id
|
LEFT JOIN tb_shop_info AS info ON info.id = pro.shop_id
|
||||||
<where>
|
<where>
|
||||||
info.`status`='1'
|
info.`status`='1'
|
||||||
AND pro.is_combo = '1'
|
AND pro.is_combo = '1'
|
||||||
@@ -968,14 +973,44 @@
|
|||||||
ORDER BY (ABS(info.lat - #{lat}) + ABS(info.lng - #{lng})) ASC
|
ORDER BY (ABS(info.lat - #{lat}) + ABS(info.lng - #{lng})) ASC
|
||||||
</when>
|
</when>
|
||||||
<when test="orderBy == '2'">
|
<when test="orderBy == '2'">
|
||||||
ORDER BYpro.real_sales_number desc
|
ORDER BY pro.real_sales_number desc
|
||||||
</when>
|
</when>
|
||||||
<when test="orderBy == '3'">
|
<when test="orderBy == '3'">
|
||||||
ORDER BY pro.low_price ASC
|
ORDER BY pro.low_price ASC
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
<otherwise>
|
||||||
ORDER BY pro.id DESC
|
ORDER BY pro.real_sales_number DESC
|
||||||
</otherwise>
|
</otherwise>
|
||||||
</choose>
|
</choose>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selHotGroups" resultType="com.chaozhanggui.system.cashierservice.entity.vo.ShopGroupInfoVo">
|
||||||
|
SELECT
|
||||||
|
info.id AS shopId,
|
||||||
|
info.shop_name AS shopName,
|
||||||
|
info.logo AS shopImg,
|
||||||
|
info.tag AS shopTag,
|
||||||
|
info.lat AS lat,
|
||||||
|
info.lng AS lng,
|
||||||
|
pro.id AS proId,
|
||||||
|
pro.`name` AS proName,
|
||||||
|
pro.cover_img AS proImg,
|
||||||
|
sum(`order`.number) AS number
|
||||||
|
FROM
|
||||||
|
tb_group_order_info AS `order`
|
||||||
|
LEFT JOIN tb_product AS pro ON `order`.pro_id = pro.id
|
||||||
|
LEFT JOIN tb_shop_info AS info ON info.id = `order`.shop_id
|
||||||
|
<where>
|
||||||
|
info.`status`='1'
|
||||||
|
AND info.cities = #{cities}
|
||||||
|
<if test="type != null and type != ''">
|
||||||
|
AND pro.group_category_id LIKE concat('%',#{type,jdbcType=VARCHAR},'%')
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null and startTime != ''">
|
||||||
|
AND `order`.create_time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
group by `order`.pro_id
|
||||||
|
ORDER BY number desc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -396,7 +396,7 @@
|
|||||||
pro.cover_img AS image,
|
pro.cover_img AS image,
|
||||||
sku.origin_price AS originPrice,
|
sku.origin_price AS originPrice,
|
||||||
sku.sale_price AS salePrice,
|
sku.sale_price AS salePrice,
|
||||||
MAX( sku.real_sales_number ) AS realSalesNumber
|
pro.real_sales_number AS realSalesNumber
|
||||||
FROM
|
FROM
|
||||||
tb_product pro
|
tb_product pro
|
||||||
LEFT JOIN tb_product_sku sku ON pro.id = sku.product_id
|
LEFT JOIN tb_product_sku sku ON pro.id = sku.product_id
|
||||||
@@ -415,7 +415,7 @@
|
|||||||
pro.cover_img AS image,
|
pro.cover_img AS image,
|
||||||
sku.origin_price AS originPrice,
|
sku.origin_price AS originPrice,
|
||||||
sku.sale_price AS salePrice,
|
sku.sale_price AS salePrice,
|
||||||
MAX( sku.real_sales_number ) AS realSalesNumber
|
pro.real_sales_number AS realSalesNumber
|
||||||
FROM
|
FROM
|
||||||
tb_product pro
|
tb_product pro
|
||||||
LEFT JOIN tb_product_sku sku ON pro.id = sku.product_id
|
LEFT JOIN tb_product_sku sku ON pro.id = sku.product_id
|
||||||
|
|||||||
@@ -29,6 +29,8 @@
|
|||||||
<result column="type" jdbcType="VARCHAR" property="type"/>
|
<result column="type" jdbcType="VARCHAR" property="type"/>
|
||||||
<result column="industry" jdbcType="VARCHAR" property="industry"/>
|
<result column="industry" jdbcType="VARCHAR" property="industry"/>
|
||||||
<result column="industry_name" jdbcType="VARCHAR" property="industryName"/>
|
<result column="industry_name" jdbcType="VARCHAR" property="industryName"/>
|
||||||
|
<result column="business_start_day" jdbcType="VARCHAR" property="businessStartDay"/>
|
||||||
|
<result column="business_end_day" jdbcType="VARCHAR" property="businessEndDay"/>
|
||||||
<result column="business_time" jdbcType="VARCHAR" property="businessTime"/>
|
<result column="business_time" jdbcType="VARCHAR" property="businessTime"/>
|
||||||
<result column="post_time" jdbcType="VARCHAR" property="postTime"/>
|
<result column="post_time" jdbcType="VARCHAR" property="postTime"/>
|
||||||
<result column="post_amount_line" jdbcType="DECIMAL" property="postAmountLine"/>
|
<result column="post_amount_line" jdbcType="DECIMAL" property="postAmountLine"/>
|
||||||
@@ -56,7 +58,7 @@
|
|||||||
, account, shop_code, sub_title, merchant_id, shop_name, chain_name, back_img,
|
, account, shop_code, sub_title, merchant_id, shop_name, chain_name, back_img,
|
||||||
front_img, contact_name, phone, logo, is_deposit, is_supply, cover_img, share_img,
|
front_img, contact_name, phone, logo, is_deposit, is_supply, cover_img, share_img,
|
||||||
detail, lat, lng, mch_id, register_type, is_wx_ma_independent, address, city, type,
|
detail, lat, lng, mch_id, register_type, is_wx_ma_independent, address, city, type,
|
||||||
industry, industry_name, business_time, post_time, post_amount_line, on_sale, settle_type,
|
industry, industry_name, business_start_day,business_end_day,business_time, post_time, post_amount_line, on_sale, settle_type,
|
||||||
settle_time, enter_at, expire_at, status, average, order_wait_pay_minute, support_device_number,
|
settle_time, enter_at, expire_at, status, average, order_wait_pay_minute, support_device_number,
|
||||||
distribute_level, created_at, updated_at, proxy_id, shop_qrcode, tag,is_open_yhq
|
distribute_level, created_at, updated_at, proxy_id, shop_qrcode, tag,is_open_yhq
|
||||||
</sql>
|
</sql>
|
||||||
@@ -72,6 +74,13 @@
|
|||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selNumByChain" resultType="java.lang.Integer">
|
||||||
|
select
|
||||||
|
count(1)
|
||||||
|
from tb_shop_info
|
||||||
|
where chain_name = #{chainName}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="selShopInfoByGps" resultType="com.chaozhanggui.system.cashierservice.entity.vo.SubShopVo">
|
<select id="selShopInfoByGps" resultType="com.chaozhanggui.system.cashierservice.entity.vo.SubShopVo">
|
||||||
SELECT
|
SELECT
|
||||||
@@ -80,11 +89,14 @@
|
|||||||
tb_shop_info as info
|
tb_shop_info as info
|
||||||
<where>
|
<where>
|
||||||
info.status=1
|
info.status=1
|
||||||
AND info.cities =#{cities}
|
AND (info.cities =#{cities} or info.districts =#{cities})
|
||||||
<if test="rightTopLng != null and rightTopLng != '' and leftBottomLng != null and leftBottomLng != ''">
|
<if test="rightTopLng != null and rightTopLng != '' and leftBottomLng != null and leftBottomLng != ''">
|
||||||
AND info.lng BETWEEN #{leftBottomLng} AND #{rightTopLng}
|
AND info.lng BETWEEN #{leftBottomLng} AND #{rightTopLng}
|
||||||
AND info.lat BETWEEN #{leftBottomLat} AND #{rightTopLat}
|
AND info.lat BETWEEN #{leftBottomLat} AND #{rightTopLat}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="shopName != null and shopName != ''">
|
||||||
|
AND shop_name = #{shopName}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY (ABS(info.lat - #{lat}) + ABS(info.lng - #{lng})) ASC
|
ORDER BY (ABS(info.lat - #{lat}) + ABS(info.lng - #{lng})) ASC
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -35,6 +35,15 @@
|
|||||||
from tb_shop_table
|
from tb_shop_table
|
||||||
where qrcode = #{qrcode}
|
where qrcode = #{qrcode}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="queryShopIdByTableCode" resultType="string">
|
||||||
|
select
|
||||||
|
shop_id
|
||||||
|
from tb_shop_table
|
||||||
|
where qrcode = #{qrcode}
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectShopTableById" resultType="com.chaozhanggui.system.cashierservice.entity.TbShopTable">
|
<select id="selectShopTableById" resultType="com.chaozhanggui.system.cashierservice.entity.TbShopTable">
|
||||||
select
|
select
|
||||||
a.id, a.name, a.shop_id, a.max_capacity, a.sort, a.area_id, a.is_predate, a.predate_amount, a.status,
|
a.id, a.name, a.shop_id, a.max_capacity, a.sort, a.area_id, a.is_predate, a.predate_amount, a.status,
|
||||||
|
|||||||
Reference in New Issue
Block a user