Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c82661351 | ||
|
|
6792450f6b |
39
pom.xml
39
pom.xml
@@ -20,23 +20,11 @@
|
|||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!--Spring boot 测试-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.belerweb</groupId>
|
<groupId>com.belerweb</groupId>
|
||||||
<artifactId >pinyin4j</artifactId>
|
<artifactId >pinyin4j</artifactId>
|
||||||
<version >2.5.1</version >
|
<version >2.5.1</version >
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>p6spy</groupId>
|
|
||||||
<artifactId>p6spy</artifactId>
|
|
||||||
<version>3.8.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
@@ -114,22 +102,6 @@
|
|||||||
<version>1.3.5</version>
|
<version>1.3.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.baomidou</groupId>
|
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
|
||||||
<version>3.3.1</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.mybatis</groupId>
|
|
||||||
<artifactId>mybatis-spring</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-validation</artifactId>
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
@@ -231,12 +203,6 @@
|
|||||||
<groupId>io.netty</groupId>
|
<groupId>io.netty</groupId>
|
||||||
<artifactId>netty-all</artifactId>
|
<artifactId>netty-all</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- 支付宝服务端通用SDK -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alipay.sdk</groupId>
|
|
||||||
<artifactId>alipay-sdk-java</artifactId>
|
|
||||||
<version>4.39.165.ALL</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||||
@@ -248,11 +214,6 @@
|
|||||||
<artifactId>weixin-java-miniapp</artifactId>
|
<artifactId>weixin-java-miniapp</artifactId>
|
||||||
<version>3.8.0</version>
|
<version>3.8.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,134 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.alipayUtil;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.hutool.json.JSONObject;
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import com.alipay.api.AlipayApiException;
|
|
||||||
import com.alipay.api.AlipayClient;
|
|
||||||
import com.alipay.api.AlipayConfig;
|
|
||||||
import com.alipay.api.DefaultAlipayClient;
|
|
||||||
import com.alipay.api.internal.util.AlipayEncrypt;
|
|
||||||
import com.alipay.api.request.AlipaySystemOauthTokenRequest;
|
|
||||||
import com.alipay.api.response.AlipaySystemOauthTokenResponse;
|
|
||||||
import lombok.SneakyThrows;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 支付宝通用SDK工具类
|
|
||||||
*
|
|
||||||
* @author tankaikai
|
|
||||||
* @since 2024-09-23 16:15
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Component
|
|
||||||
public class AlipayUtil {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 网关地址 线上:https://openapi.alipay.com/gateway.do 沙箱:https://openapi.alipaydev.com/gateway.do
|
|
||||||
*/
|
|
||||||
@Value("${alipay.sdk.config.serverUrl}")
|
|
||||||
private String serverUrl;
|
|
||||||
/**
|
|
||||||
* 应用ID
|
|
||||||
*/
|
|
||||||
@Value("${alipay.sdk.config.appId}")
|
|
||||||
private String appId;
|
|
||||||
/**
|
|
||||||
* 应用私钥
|
|
||||||
*/
|
|
||||||
@Value("${alipay.sdk.config.privateKey}")
|
|
||||||
private String privateKey;
|
|
||||||
/**
|
|
||||||
* 支付宝公钥
|
|
||||||
*/
|
|
||||||
@Value("${alipay.sdk.config.alipayPublicKey}")
|
|
||||||
private String alipayPublicKey;
|
|
||||||
/**
|
|
||||||
* 支付宝公钥
|
|
||||||
*/
|
|
||||||
@Value("${alipay.sdk.config.encryptKey}")
|
|
||||||
private String encryptKey;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建支付宝客户端
|
|
||||||
* @return AlipayClient
|
|
||||||
*/
|
|
||||||
@SneakyThrows
|
|
||||||
public AlipayClient createClient() {
|
|
||||||
AlipayConfig alipayConfig = new AlipayConfig();
|
|
||||||
//设置网关地址
|
|
||||||
alipayConfig.setServerUrl(serverUrl);
|
|
||||||
//设置应用ID
|
|
||||||
alipayConfig.setAppId(appId);
|
|
||||||
//设置应用私钥
|
|
||||||
alipayConfig.setPrivateKey(privateKey);
|
|
||||||
//设置支付宝公钥
|
|
||||||
alipayConfig.setAlipayPublicKey(alipayPublicKey);
|
|
||||||
return new DefaultAlipayClient(alipayConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取支付宝用户的openId
|
|
||||||
* @param code 用户信息授权码
|
|
||||||
* @return openId
|
|
||||||
*/
|
|
||||||
public String getOpenId(String code) throws Exception{
|
|
||||||
AlipaySystemOauthTokenRequest req = new AlipaySystemOauthTokenRequest();
|
|
||||||
//SDK已经封装掉了公共参数,这里只需要传入业务参数
|
|
||||||
req.setCode(code);
|
|
||||||
req.setGrantType("authorization_code");
|
|
||||||
//此次只是参数展示,未进行字符串转义,实际情况下请转义
|
|
||||||
//req.setBizContent(" {" + " \"primary_industry_name\":\"IT科技/IT软件与服务\"," + " \"primary_industry_code\":\"10001/20102\"," + " \"secondary_industry_code\":\"10001/20102\"," + " \"secondary_industry_name\":\"IT科技/IT软件与服务\"" + " }");
|
|
||||||
AlipaySystemOauthTokenResponse response;
|
|
||||||
try {
|
|
||||||
response = createClient().execute(req);
|
|
||||||
}catch (AlipayApiException e){
|
|
||||||
log.error("获取支付宝用户信息失败,错误码:{},错误信息:{}", e.getErrCode(), e.getErrMsg());
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
log.info("获取支付宝用户信息成功,返回结果:{}", response.getBody());
|
|
||||||
//调用失败
|
|
||||||
if (!response.isSuccess()) {
|
|
||||||
log.error("获取支付宝用户信息失败,错误码:{},错误信息:{}", response.getSubCode(), response.getSubMsg());
|
|
||||||
throw new AlipayApiException(response.getSubCode(), response.getSubMsg());
|
|
||||||
}
|
|
||||||
//调用成功,则处理业务逻辑,为配合支付系统确定沿用支付宝的老标准使用userId
|
|
||||||
return response.getUserId();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取支付宝用户的手机号码
|
|
||||||
* @param encryptedData 密文
|
|
||||||
* @return mobile
|
|
||||||
*/
|
|
||||||
public String getMobile(String encryptedData) throws Exception{
|
|
||||||
if(StrUtil.isEmpty(encryptedData)){
|
|
||||||
throw new AlipayApiException("加密数据不能为空");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
log.info("解密前的数据,返回结果:{}", encryptedData);
|
|
||||||
String resp = AlipayEncrypt.decryptContent(encryptedData, "AES", encryptKey, "UTF-8");
|
|
||||||
log.info("解密后的数据,返回结果:{}", resp);
|
|
||||||
boolean isJson = JSONUtil.isJson(resp);
|
|
||||||
if(!isJson){
|
|
||||||
throw new AlipayApiException("解密后的数据不是json格式");
|
|
||||||
}
|
|
||||||
JSONObject jsonObject = JSONUtil.parseObj(resp);
|
|
||||||
String code = jsonObject.getStr("code");
|
|
||||||
String msg = jsonObject.getStr("msg");
|
|
||||||
String mobile = jsonObject.getStr("mobile");
|
|
||||||
if("10000".equals(code)){
|
|
||||||
return mobile;
|
|
||||||
}else{
|
|
||||||
throw new AlipayApiException(code,msg);
|
|
||||||
}
|
|
||||||
}catch (AlipayApiException e){
|
|
||||||
log.error("获取支付宝用户的手机号码失败,错误码:{},错误信息:{}", e.getErrCode(), e.getErrMsg());
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.auth;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 三方登录认证来源
|
|
||||||
* @author tankaikai
|
|
||||||
* @since 2024-09-23 17:51
|
|
||||||
*/
|
|
||||||
public enum AuthSource {
|
|
||||||
WECHAT("微信", "wechat"),
|
|
||||||
ALIPAY("支付宝", "alipay");
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
AuthSource(String name, String value) {
|
|
||||||
this.name = name;
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -49,7 +49,6 @@ public class LoginFilter implements Filter {
|
|||||||
|
|
||||||
// "cashierService/login/**",//登录部分接口不校验
|
// "cashierService/login/**",//登录部分接口不校验
|
||||||
"cashierService/login/wx/**",//登录部分接口不校验
|
"cashierService/login/wx/**",//登录部分接口不校验
|
||||||
"cashierService/login/auth/**",//登录部分接口不校验
|
|
||||||
"cashierService/login/app/login",//登录部分接口不校验
|
"cashierService/login/app/login",//登录部分接口不校验
|
||||||
"cashierService/product/queryProduct",
|
"cashierService/product/queryProduct",
|
||||||
"cashierService/product/queryProductSku",
|
"cashierService/product/queryProductSku",
|
||||||
@@ -95,7 +94,7 @@ public class LoginFilter implements Filter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//environment 环境标识 wx alipay app 后续environment不可为空
|
//environment 环境标识 wx app 后续environment不可为空
|
||||||
String environment = request.getHeader("environment");
|
String environment = request.getHeader("environment");
|
||||||
|
|
||||||
// 判断用户TOKEN是否存在
|
// 判断用户TOKEN是否存在
|
||||||
@@ -131,7 +130,7 @@ public class LoginFilter implements Filter {
|
|||||||
String userId = jsonObject1.getString("userId");
|
String userId = jsonObject1.getString("userId");
|
||||||
tokenKey=RedisCst.ONLINE_APP_USER.concat(userId);
|
tokenKey=RedisCst.ONLINE_APP_USER.concat(userId);
|
||||||
//获取redis中的token
|
//获取redis中的token
|
||||||
}else if(environment.equals("wx") || environment.equals("alipay")){
|
}else if(environment.equals("wx")){
|
||||||
//获取当前登录人的用户id
|
//获取当前登录人的用户id
|
||||||
String openId = jsonObject1.getString("openId");
|
String openId = jsonObject1.getString("openId");
|
||||||
if(StringUtils.isBlank(openId)){
|
if(StringUtils.isBlank(openId)){
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.config;
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
public class MyBatisPlusConfig {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.config;
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.core.annotation.Order;
|
|
||||||
import org.springframework.web.filter.CommonsRequestLoggingFilter;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
public class RequestLoggingConfig {
|
|
||||||
@Bean
|
|
||||||
@Order(-9999)
|
|
||||||
public CommonsRequestLoggingFilter logFilter() {
|
|
||||||
CommonsRequestLoggingFilter filter = new CommonsRequestLoggingFilter();
|
|
||||||
// 是否记录请求的查询参数信息
|
|
||||||
filter.setIncludeQueryString(true);
|
|
||||||
// 是否记录请求body内容
|
|
||||||
filter.setIncludePayload(true);
|
|
||||||
filter.setMaxPayloadLength(10000);
|
|
||||||
//是否记录请求header信息
|
|
||||||
filter.setIncludeHeaders(false);
|
|
||||||
// 是否记录请求客户端信息
|
|
||||||
filter.setIncludeClientInfo(true);
|
|
||||||
// 设置日期记录的前缀
|
|
||||||
filter.setBeforeMessagePrefix("\033[32;4m请求开始:");
|
|
||||||
filter.setBeforeMessageSuffix("\033[0m");
|
|
||||||
filter.setAfterMessagePrefix("\033[34m请求结束:");
|
|
||||||
filter.setAfterMessageSuffix("\033[0m");
|
|
||||||
return filter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.constant;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
public interface TableConstant {
|
|
||||||
String CART_SEAT_ID = "-999";
|
|
||||||
|
|
||||||
class ShopTable {
|
|
||||||
@Getter
|
|
||||||
public enum State {
|
|
||||||
IDLE("idle"), CLOSED("closed"), PAYING("paying"), PENDING("pending"), USING("using"), CLEANING("cleaning");
|
|
||||||
private final String value;
|
|
||||||
|
|
||||||
State(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.controller;
|
package com.chaozhanggui.system.cashierservice.controller;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbPlatformDictMapper;
|
import com.chaozhanggui.system.cashierservice.dao.TbPlatformDictMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbShopExtendMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.WxMsgSubDTO;
|
import com.chaozhanggui.system.cashierservice.entity.dto.WxMsgSubDTO;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.vo.DistrictVo;
|
import com.chaozhanggui.system.cashierservice.entity.vo.DistrictVo;
|
||||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||||
import com.chaozhanggui.system.cashierservice.netty.PushToClientChannelHandlerAdapter;
|
|
||||||
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.FileService;
|
import com.chaozhanggui.system.cashierservice.service.FileService;
|
||||||
@@ -26,14 +24,12 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用接口
|
* 通用接口
|
||||||
@@ -54,8 +50,6 @@ public class CommonController {
|
|||||||
private TbPlatformDictMapper platformDictMapper;
|
private TbPlatformDictMapper platformDictMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private FileService fileService;
|
private FileService fileService;
|
||||||
@Resource
|
|
||||||
private TbShopExtendMapper extendMapper;
|
|
||||||
|
|
||||||
private final LoginService loginService;;
|
private final LoginService loginService;;
|
||||||
|
|
||||||
@@ -169,21 +163,6 @@ public class CommonController {
|
|||||||
return new Result(CodeEnum.SUCCESS, fileService.uploadFile(file));
|
return new Result(CodeEnum.SUCCESS, fileService.uploadFile(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("common/shopExtend")
|
|
||||||
public Result getShopExtend(@RequestBody Map<String, String> map) {
|
|
||||||
if (CollectionUtils.isEmpty(map) || !map.containsKey("shopId") || !map.containsKey("autokey")) return new Result(CodeEnum.SUCCESS);
|
|
||||||
return new Result(CodeEnum.SUCCESS, extendMapper.queryByShopIdAndAutoKey(Integer.valueOf(map.get("shopId").toString()),map.get("autokey")));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交班
|
|
||||||
*/
|
|
||||||
@PostMapping("common/handoverData")
|
|
||||||
public Result handoverData(@RequestBody Map<String, String> map) throws Exception{
|
|
||||||
PushToClientChannelHandlerAdapter.getInstance().AppSendInfo(JSONObject.toJSONString(map),map.get("shopId"));
|
|
||||||
return Result.success(CodeEnum.SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查手机号格式是否正确的方法
|
// 检查手机号格式是否正确的方法
|
||||||
private boolean isValidPhoneNumber(String phone) {
|
private boolean isValidPhoneNumber(String phone) {
|
||||||
return phone.matches("^1[3-9]\\d{9}$");
|
return phone.matches("^1[3-9]\\d{9}$");
|
||||||
|
|||||||
@@ -2,10 +2,8 @@ package com.chaozhanggui.system.cashierservice.controller;
|
|||||||
|
|
||||||
import cn.binarywang.wx.miniapp.util.crypt.WxMaCryptUtils;
|
import cn.binarywang.wx.miniapp.util.crypt.WxMaCryptUtils;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alipay.api.AlipayApiException;
|
|
||||||
import com.chaozhanggui.system.cashierservice.alipayUtil.AlipayUtil;
|
|
||||||
import com.chaozhanggui.system.cashierservice.auth.AuthSource;
|
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbMerchantAccountMapper;
|
import com.chaozhanggui.system.cashierservice.dao.TbMerchantAccountMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbMerchantAccount;
|
import com.chaozhanggui.system.cashierservice.entity.TbMerchantAccount;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
|
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
|
||||||
@@ -18,12 +16,10 @@ import com.chaozhanggui.system.cashierservice.service.LoginService;
|
|||||||
import com.chaozhanggui.system.cashierservice.service.OnlineUserService;
|
import com.chaozhanggui.system.cashierservice.service.OnlineUserService;
|
||||||
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.IpUtil;
|
import com.chaozhanggui.system.cashierservice.util.*;
|
||||||
import com.chaozhanggui.system.cashierservice.util.MD5Utils;
|
|
||||||
import com.chaozhanggui.system.cashierservice.util.StringUtil;
|
|
||||||
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
|
||||||
import com.chaozhanggui.system.cashierservice.wxUtil.WechatUtil;
|
import com.chaozhanggui.system.cashierservice.wxUtil.WechatUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
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.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@@ -64,12 +60,11 @@ public class LoginContoller {
|
|||||||
@Autowired
|
@Autowired
|
||||||
RedisUtil redisUtil;
|
RedisUtil redisUtil;
|
||||||
|
|
||||||
@Resource
|
|
||||||
AlipayUtil alipayUtil;
|
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping("/wx/business/login")
|
@RequestMapping("/wx/business/login")
|
||||||
public Result wxBusinessLogin(@RequestParam(value = "code", required = false) String code, @RequestParam(value = "shopId", required = false) String shopId) {
|
public Result wxBusinessLogin(@RequestParam(value = "code", required = false) String code,
|
||||||
|
@RequestParam(value = "shopId", required = false) String shopId
|
||||||
|
) {
|
||||||
|
|
||||||
JSONObject SessionKeyOpenId = WechatUtil.getSessionKeyOrOpenId(code, businessAppId, businessSecrete);
|
JSONObject SessionKeyOpenId = WechatUtil.getSessionKeyOrOpenId(code, businessAppId, businessSecrete);
|
||||||
String openid = SessionKeyOpenId.getString("openid");
|
String openid = SessionKeyOpenId.getString("openid");
|
||||||
@@ -81,7 +76,9 @@ public class LoginContoller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/wx/business/openId")
|
@GetMapping("/wx/business/openId")
|
||||||
public Result getOpenId(@RequestParam String code) {
|
public Result getOpenId(
|
||||||
|
@RequestParam String code
|
||||||
|
) {
|
||||||
JSONObject SessionKeyOpenId = WechatUtil.getSessionKeyOrOpenId(code, customAppId, customSecrete);
|
JSONObject SessionKeyOpenId = WechatUtil.getSessionKeyOrOpenId(code, customAppId, customSecrete);
|
||||||
String openid = SessionKeyOpenId.getString("openid");
|
String openid = SessionKeyOpenId.getString("openid");
|
||||||
if(Objects.isNull(openid)){
|
if(Objects.isNull(openid)){
|
||||||
@@ -98,46 +95,50 @@ public class LoginContoller {
|
|||||||
* @param map
|
* @param map
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/auth/custom/login")
|
@RequestMapping("/wx/custom/login")
|
||||||
public Result authCustomLogin(HttpServletRequest request, @RequestBody Map<String, String> map) {
|
public Result wxCustomLogin(HttpServletRequest request, @RequestBody Map<String, String> map) {
|
||||||
if (ObjectUtil.isNull(map) || ObjectUtil.isEmpty(map) || !map.containsKey("code") || ObjectUtil.isEmpty(map.get("code"))) {
|
if (ObjectUtil.isNull(map) || ObjectUtil.isEmpty(map) || !map.containsKey("code") || ObjectUtil.isEmpty(map.get("code"))) {
|
||||||
Result.fail("code不能为空");
|
Result.fail("code不能为空");
|
||||||
}
|
}
|
||||||
// 三方登录来源 wechat、alipay
|
String code = map.get("code").toString();
|
||||||
String source = map.getOrDefault("source",AuthSource.WECHAT.getValue());
|
String rawData = map.get("rawData");
|
||||||
String code = map.get("code");
|
// String signature = map.get("signature");
|
||||||
if(AuthSource.WECHAT.getValue().equals(source)){
|
// String encryptedData = map.get("encryptedData");
|
||||||
try {
|
// String ivStr = map.get("iv");
|
||||||
|
// String phone = map.get("phone");
|
||||||
|
// 用户非敏感信息:rawData
|
||||||
|
// 签名:signature
|
||||||
|
JSONObject rawDataJson = JSON.parseObject(rawData);
|
||||||
// 1.接收小程序发送的code
|
// 1.接收小程序发送的code
|
||||||
// 2.开发者服务器 登录凭证校验接口 appi + appsecret + code
|
// 2.开发者服务器 登录凭证校验接口 appi + appsecret + code
|
||||||
JSONObject wxResp = WechatUtil.getSessionKeyOrOpenId(code, customAppId, customSecrete);
|
JSONObject SessionKeyOpenId = WechatUtil.getSessionKeyOrOpenId(code, customAppId, customSecrete);
|
||||||
//Integer errCode = wxResp.getInteger("errcode");
|
|
||||||
log.info("微信获取openid响应报文:{}", wxResp.toJSONString());
|
|
||||||
boolean hasOpenId = wxResp.containsKey("openid");
|
|
||||||
if (!hasOpenId) {
|
|
||||||
return Result.fail("登录失败:" + wxResp.getString("errmsg"));
|
|
||||||
}
|
|
||||||
String a = "{\"width\":\"58\",\"printerNum\":\"1\",\"categoryList\":[{\"id\":30,\"name\":\"奶茶\",\"shortName\":null,\"tree\":null,\"pid\":null,\"pic\":null,\"merchantId\":null,\"shopId\":null,\"style\":null,\"isShow\":null,\"detail\":null,\"sort\":null,\"keyWord\":null,\"createdAt\":null,\"updatedAt\":null},{\"id\":35,\"name\":\"酒水饮料\",\"shortName\":null,\"tree\":null,\"pid\":null,\"pic\":null,\"merchantId\":null,\"shopId\":null,\"style\":null,\"isShow\":null,\"detail\":null,\"sort\":null,\"keyWord\":null,\"createdAt\":null,\"updatedAt\":null},{\"id\":65,\"name\":\"火锅\",\"shortName\":null,\"tree\":null,\"pid\":null,\"pic\":null,\"merchantId\":null,\"shopId\":null,\"style\":null,\"isShow\":null,\"detail\":null,\"sort\":null,\"keyWord\":null,\"createdAt\":null,\"updatedAt\":null},{\"id\":95,\"name\":\"串串\",\"shortName\":null,\"tree\":null,\"pid\":null,\"pic\":null,\"merchantId\":null,\"shopId\":null,\"style\":null,\"isShow\":null,\"detail\":null,\"sort\":null,\"keyWord\":null,\"createdAt\":null,\"updatedAt\":null},{\"id\":96,\"name\":\"烧烤\",\"shortName\":null,\"tree\":null,\"pid\":null,\"pic\":null,\"merchantId\":null,\"shopId\":null,\"style\":null,\"isShow\":null,\"detail\":null,\"sort\":null,\"keyWord\":null,\"createdAt\":null,\"updatedAt\":null}],\"model\":\"normal\",\"feet\":\"0\",\"autoCut\":\"1\"}";
|
|
||||||
// 3.接收微信接口服务 获取返回的参数
|
// 3.接收微信接口服务 获取返回的参数
|
||||||
String openid = wxResp.getString("openid");
|
String openid = SessionKeyOpenId.getString("openid");
|
||||||
return loginService.wxCustomLogin(openid, "", "", "", IpUtil.getIpAddr(request));
|
// String sessionKey = SessionKeyOpenId.getString("session_key");
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
// 4.校验签名 小程序发送的签名signature与服务器端生成的签名signature2 = sha1(rawData + sessionKey)
|
||||||
log.error("登录失败:",e);
|
// String signature2 = DigestUtils.sha1Hex(rawData + sessionKey);
|
||||||
}
|
// if (!signature.equals(signature2)) {
|
||||||
}else if(AuthSource.ALIPAY.getValue().equals(source)){
|
// return Result.fail("签名校验失败");
|
||||||
|
// }
|
||||||
|
// String phone = "";
|
||||||
|
// try{
|
||||||
|
// String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr);
|
||||||
|
// if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) {
|
||||||
|
// }// phone =JSONObject.parseObject(data).get("phoneNumber").toString();
|
||||||
|
// }catch (Exception e){
|
||||||
|
// log.info("登录传参:获取手机号失败{}",e.getMessage());
|
||||||
|
// }
|
||||||
|
String nickName = rawDataJson.getString("nickName");
|
||||||
|
String avatarUrl = rawDataJson.getString("avatarUrl");
|
||||||
try {
|
try {
|
||||||
String openId = alipayUtil.getOpenId(code);
|
return loginService.wxCustomLogin(openid, avatarUrl, nickName, "", IpUtil.getIpAddr(request));
|
||||||
return loginService.alipayCustomLogin(openId);
|
|
||||||
}catch (AlipayApiException e){
|
|
||||||
log.error("登录失败:",e);
|
|
||||||
return Result.fail("登录失败:"+e.getErrMsg());
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log.error("登录失败:",e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.fail("登录失败");
|
return Result.fail("登录失败");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -179,27 +180,13 @@ public class LoginContoller {
|
|||||||
// }
|
// }
|
||||||
@RequestMapping("getPhoneNumber")
|
@RequestMapping("getPhoneNumber")
|
||||||
public Result getPhoneNumber(@RequestHeader String openId,@RequestBody Map<String, String> map) {
|
public Result getPhoneNumber(@RequestHeader String openId,@RequestBody Map<String, String> map) {
|
||||||
String encryptedData = map.get("encryptedData");
|
|
||||||
// 三方登录来源 wechat、alipay
|
|
||||||
String source = map.getOrDefault("source",AuthSource.WECHAT.getValue());
|
|
||||||
if (AuthSource.ALIPAY.getValue().equals(source)) {
|
|
||||||
try {
|
|
||||||
String mobile = alipayUtil.getMobile(encryptedData);
|
|
||||||
return Result.success(CodeEnum.SUCCESS, mobile);
|
|
||||||
}catch (AlipayApiException e){
|
|
||||||
log.error("获取手机号失败:",e);
|
|
||||||
return Result.fail("获取手机号失败:"+e.getErrMsg());
|
|
||||||
}catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
log.error("登录手机号失败:",e);
|
|
||||||
return Result.fail("获取手机号失败:未知错误");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isNull(map) || ObjectUtil.isEmpty(map) || !map.containsKey("code") || ObjectUtil.isEmpty(map.get("code"))) {
|
if (ObjectUtil.isNull(map) || ObjectUtil.isEmpty(map) || !map.containsKey("code") || ObjectUtil.isEmpty(map.get("code"))) {
|
||||||
Result.fail("code不能为空");
|
Result.fail("code不能为空");
|
||||||
}
|
}
|
||||||
String code = map.get("code");
|
String code = map.get("code").toString();
|
||||||
|
|
||||||
|
String encryptedData = map.get("encryptedData");
|
||||||
|
|
||||||
String ivStr = map.get("iv");
|
String ivStr = map.get("iv");
|
||||||
if (StringUtils.isBlank(encryptedData) || StringUtils.isBlank(ivStr)) {
|
if (StringUtils.isBlank(encryptedData) || StringUtils.isBlank(ivStr)) {
|
||||||
@@ -267,7 +254,9 @@ public class LoginContoller {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("createCardNo")
|
@GetMapping("createCardNo")
|
||||||
public Result createCardNo(@RequestHeader("openId") String openId, @RequestHeader("token") String token, @RequestHeader("id") String id, @RequestParam("shopId") String shopId) {
|
public Result createCardNo(@RequestHeader("openId") String openId, @RequestHeader("token") String token, @RequestHeader("id") String id,
|
||||||
|
@RequestParam("shopId") String shopId
|
||||||
|
) {
|
||||||
return loginService.createCardNo(id, openId,shopId);
|
return loginService.createCardNo(id, openId,shopId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,7 +267,6 @@ public class LoginContoller {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新用户信息
|
* 更新用户信息
|
||||||
*
|
|
||||||
* @param token
|
* @param token
|
||||||
* @param userInfo
|
* @param userInfo
|
||||||
* @return
|
* @return
|
||||||
@@ -405,7 +393,6 @@ public class LoginContoller {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置资金密码
|
* 重置资金密码
|
||||||
*
|
|
||||||
* @param token
|
* @param token
|
||||||
* @param map
|
* @param map
|
||||||
* @return
|
* @return
|
||||||
@@ -421,7 +408,6 @@ public class LoginContoller {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改密码
|
* 修改密码
|
||||||
*
|
|
||||||
* @param token
|
* @param token
|
||||||
* @param map
|
* @param map
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ package com.chaozhanggui.system.cashierservice.controller;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.Enum.PayTypeConstant;
|
||||||
import com.chaozhanggui.system.cashierservice.interceptor.RequestWrapper;
|
import com.chaozhanggui.system.cashierservice.interceptor.RequestWrapper;
|
||||||
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.util.DateUtils;
|
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
@CrossOrigin(origins = "*")
|
@CrossOrigin(origins = "*")
|
||||||
@RestController
|
@RestController
|
||||||
@@ -66,6 +66,11 @@ public class NotifyController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping("test")
|
||||||
|
public void test(@RequestParam String payOrderNO){
|
||||||
|
payService.test(payOrderNO);
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping("notifyCallBack")
|
@RequestMapping("notifyCallBack")
|
||||||
public String notifyCallBack(HttpServletRequest request){
|
public String notifyCallBack(HttpServletRequest request){
|
||||||
|
|
||||||
@@ -79,7 +84,6 @@ public class NotifyController {
|
|||||||
&& !"0100".equals(object.getStr("payType"))
|
&& !"0100".equals(object.getStr("payType"))
|
||||||
){
|
){
|
||||||
String orderNo=object.getStr("orderNumber");
|
String orderNo=object.getStr("orderNumber");
|
||||||
|
|
||||||
return payService.callBackPay(orderNo);
|
return payService.callBackPay(orderNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,15 +91,6 @@ public class NotifyController {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 支付取消
|
|
||||||
* @return 影响数量
|
|
||||||
*/
|
|
||||||
@PostMapping("cancel")
|
|
||||||
public Result notifyCancel(@RequestBody HashMap<String, Integer> data) {
|
|
||||||
return Result.successWithData(payService.cancelOrder(data.get("orderId")));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping("notifyfstCallBack")
|
@RequestMapping("notifyfstCallBack")
|
||||||
public String notifyfstCallBack(HttpServletRequest request){
|
public String notifyfstCallBack(HttpServletRequest request){
|
||||||
@@ -109,11 +104,7 @@ public class NotifyController {
|
|||||||
if("TRADE_SUCCESS".equals(object.get("state").toString())){
|
if("TRADE_SUCCESS".equals(object.get("state").toString())){
|
||||||
String orderNo=object.get("mchOrderNo").toString();
|
String orderNo=object.get("mchOrderNo").toString();
|
||||||
String tradeNo=object.get("payOrderId").toString();
|
String tradeNo=object.get("payOrderId").toString();
|
||||||
String payType=object.getStr("payType");
|
return payService.callBackPayFST(tradeNo);
|
||||||
return payService.callBackPayFST(tradeNo,payType);
|
|
||||||
}else {
|
|
||||||
String tradeNo=object.get("payOrderId").toString();
|
|
||||||
return String.valueOf(payService.activateOrder(tradeNo));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,15 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.controller;
|
package com.chaozhanggui.system.cashierservice.controller;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import com.chaozhanggui.system.cashierservice.entity.TbShopTable;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.chaozhanggui.system.cashierservice.entity.dto.OrderDto;
|
||||||
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
|
||||||
import com.chaozhanggui.system.cashierservice.service.CartService;
|
|
||||||
import com.chaozhanggui.system.cashierservice.service.OrderService;
|
import com.chaozhanggui.system.cashierservice.service.OrderService;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import com.chaozhanggui.system.cashierservice.util.Utils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@CrossOrigin(origins = "*")
|
@CrossOrigin(origins = "*")
|
||||||
@RestController
|
@RestController
|
||||||
@@ -21,25 +17,19 @@ import java.util.Map;
|
|||||||
@RequestMapping("/order")
|
@RequestMapping("/order")
|
||||||
public class OrderController {
|
public class OrderController {
|
||||||
|
|
||||||
private final OrderService orderService;
|
@Resource
|
||||||
private final CartService cartService;
|
private OrderService orderService;
|
||||||
private final StringRedisTemplate stringRedisTemplate;
|
|
||||||
|
|
||||||
public OrderController(OrderService orderService, CartService cartService, StringRedisTemplate stringRedisTemplate) {
|
|
||||||
this.orderService = orderService;
|
|
||||||
this.cartService = cartService;
|
|
||||||
this.stringRedisTemplate = stringRedisTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加订单
|
* 添加订单
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/creatOrder")
|
@PostMapping("/creatOrder")
|
||||||
public Result createOrder(@RequestHeader String environment, @RequestBody JSONObject jsonObject){
|
public Result createOrder(@RequestBody OrderDto shopTable){
|
||||||
jsonObject.put("environment",environment);
|
if (shopTable.getTableId() == null){
|
||||||
return Utils.runFunAndCheckKey(() -> cartService.createOrder(jsonObject), stringRedisTemplate, RedisCst.getLockKey("CREATE_ORDER_KEY"));
|
return Result.fail("台桌号有误");
|
||||||
// return orderService.createOrder(shopTable.getTableId(),shopTable.getShopId(),shopTable.getUserId());
|
}
|
||||||
|
return orderService.createOrder(shopTable.getTableId(),shopTable.getShopId(),shopTable.getUserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,7 +37,7 @@ public class OrderController {
|
|||||||
* @param orderId
|
* @param orderId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
// @GetMapping ("/orderInfo")
|
@GetMapping ("/orderInfo")
|
||||||
private Result orderInfo(@RequestParam(required = false) Integer orderId){
|
private Result orderInfo(@RequestParam(required = false) Integer orderId){
|
||||||
if (orderId==null) {
|
if (orderId==null) {
|
||||||
return Result.fail("请返回首页订单列表查看");
|
return Result.fail("请返回首页订单列表查看");
|
||||||
@@ -55,33 +45,12 @@ public class OrderController {
|
|||||||
return orderService.orderInfo(orderId);
|
return orderService.orderInfo(orderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单详情
|
|
||||||
* @param orderId 订单id
|
|
||||||
* @return 订单信息
|
|
||||||
*/
|
|
||||||
@GetMapping ("/orderInfo")
|
|
||||||
public Result getCartByOrderId(
|
|
||||||
@RequestParam Integer orderId
|
|
||||||
){
|
|
||||||
return Result.successWithData(orderService.orderDetail(orderId));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/orderList")
|
@GetMapping("/orderList")
|
||||||
private Result orderList(@RequestParam Integer userId,@RequestParam Integer page,
|
private Result orderList(@RequestParam Integer userId,@RequestParam Integer page,
|
||||||
@RequestParam Integer size, @RequestParam String status){
|
@RequestParam Integer size, @RequestParam String status){
|
||||||
return orderService.orderList(userId,page,size,status);
|
return orderService.orderList(userId,page,size,status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/rmOrder")
|
|
||||||
private Result rmOrder(@RequestBody Map<String, Object> map){
|
|
||||||
if (ObjectUtil.isEmpty(map) || map.size() <= 0 || !map.containsKey("orderId") || ObjectUtil.isEmpty(map.get("orderId"))) {
|
|
||||||
return Result.fail("订单号不允许为空");
|
|
||||||
}
|
|
||||||
return orderService.rmOrder(Integer.valueOf(map.get("orderId").toString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/tradeIntegral")
|
@GetMapping("/tradeIntegral")
|
||||||
private Result tradeIntegral(@RequestParam("userId") String userId, @RequestParam("id") String id) throws IOException, ParseException {
|
private Result tradeIntegral(@RequestParam("userId") String userId, @RequestParam("id") String id) throws IOException, ParseException {
|
||||||
return orderService.tradeIntegral(userId,id);
|
return orderService.tradeIntegral(userId,id);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
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 cn.hutool.core.util.StrUtil;
|
|
||||||
import com.chaozhanggui.system.cashierservice.annotation.LimitSubmit;
|
import com.chaozhanggui.system.cashierservice.annotation.LimitSubmit;
|
||||||
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;
|
||||||
@@ -41,17 +40,8 @@ public class PayController {
|
|||||||
return Result.fail("订单号不允许为空");
|
return Result.fail("订单号不允许为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!map.containsKey("payType")) {
|
|
||||||
return Result.fail("支付类型不允许为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
String payType = map.get("payType");
|
|
||||||
if (StrUtil.isEmpty(payType)) {
|
|
||||||
return Result.fail("支付类型不允许为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return payService.payOrder(openId, map.get("orderId"), payType, IpUtil.getIpAddr(request));
|
return payService.payOrder(openId, map.get("orderId"), IpUtil.getIpAddr(request));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -87,8 +77,6 @@ public class PayController {
|
|||||||
String userId = "";
|
String userId = "";
|
||||||
if (environment.equals("wx") && payType.equals("wechatPay")) {
|
if (environment.equals("wx") && payType.equals("wechatPay")) {
|
||||||
userId = TokenUtil.parseParamFromToken(token).getString("openId");
|
userId = TokenUtil.parseParamFromToken(token).getString("openId");
|
||||||
} else if("aliPay".equals(payType)){
|
|
||||||
userId = TokenUtil.parseParamFromToken(token).getString("openId");
|
|
||||||
} else {
|
} else {
|
||||||
userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,7 @@ package com.chaozhanggui.system.cashierservice.controller;
|
|||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.chaozhanggui.system.cashierservice.constant.TableConstant;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.ChoseCountDTO;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.ChoseEatModelDTO;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.QuerySpecDTO;
|
import com.chaozhanggui.system.cashierservice.entity.dto.QuerySpecDTO;
|
||||||
import com.chaozhanggui.system.cashierservice.service.CartService;
|
import com.chaozhanggui.system.cashierservice.service.CartService;
|
||||||
import com.chaozhanggui.system.cashierservice.service.ProductService;
|
import com.chaozhanggui.system.cashierservice.service.ProductService;
|
||||||
@@ -15,13 +10,8 @@ import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
|||||||
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.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@CrossOrigin(origins = "*")
|
@CrossOrigin(origins = "*")
|
||||||
@@ -46,15 +36,11 @@ public class ProductController {
|
|||||||
public Result queryShopIdByTableCode(
|
public Result queryShopIdByTableCode(
|
||||||
@RequestHeader("openId") String openId,
|
@RequestHeader("openId") String openId,
|
||||||
@RequestHeader("id") String userId,
|
@RequestHeader("id") String userId,
|
||||||
@RequestParam(required = false) String lat,
|
@RequestParam String lat,
|
||||||
@RequestParam(required = false) String lng,
|
@RequestParam String lng,
|
||||||
@RequestParam(required = false) String code,
|
@RequestParam("code") String code
|
||||||
@RequestParam(required = false) Integer shopId
|
|
||||||
) {
|
) {
|
||||||
if (shopId == null && StrUtil.isBlank(code)) {
|
return productService.queryShopIdByTableCode(userId, openId, code,lat,lng);
|
||||||
return Result.fail("参数缺失");
|
|
||||||
}
|
|
||||||
return productService.queryShopIdByTableCode(userId, openId, code,lat,lng, shopId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,13 +50,12 @@ public class ProductController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("queryProduct")
|
@RequestMapping("queryProduct")
|
||||||
public Result queryProduct(@RequestHeader("id") String userId,@RequestBody Map<String, String> map) {
|
public Result queryProduct(@RequestBody Map<String, String> map) {
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(map) || map.size() <= 0 || !map.containsKey("shopId")) {
|
if (ObjectUtil.isEmpty(map) || map.size() <= 0 || !map.containsKey("shopId")) {
|
||||||
return Result.fail("参数错误");
|
return Result.fail("参数错误");
|
||||||
}
|
}
|
||||||
return productService.queryProduct(
|
return productService.queryProduct(
|
||||||
userId,
|
|
||||||
map.get("shopId").toString(),
|
map.get("shopId").toString(),
|
||||||
(map.containsKey("productGroupId") && ObjectUtil.isNotEmpty(map.get("productGroupId"))) ? map.get("productGroupId").toString() : "");
|
(map.containsKey("productGroupId") && ObjectUtil.isNotEmpty(map.get("productGroupId"))) ? map.get("productGroupId").toString() : "");
|
||||||
}
|
}
|
||||||
@@ -96,10 +81,9 @@ public class ProductController {
|
|||||||
@RequestParam(value = "code", required = false) String code,
|
@RequestParam(value = "code", required = false) String code,
|
||||||
@RequestParam("shopId") String shopId,
|
@RequestParam("shopId") String shopId,
|
||||||
@RequestParam("productId") String productId,
|
@RequestParam("productId") String productId,
|
||||||
@RequestParam("spec_tag") String spec_tag,
|
@RequestParam("spec_tag") String spec_tag
|
||||||
@RequestParam("isVip") String isVip
|
|
||||||
) {
|
) {
|
||||||
return productService.queryProductSku(code,shopId, productId, spec_tag,isVip);
|
return productService.queryProductSku(code,shopId, productId, spec_tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("addCart")
|
@PostMapping("addCart")
|
||||||
@@ -108,32 +92,6 @@ public class ProductController {
|
|||||||
return cartService.createCart(jsonObject);
|
return cartService.createCart(jsonObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 餐位费选择
|
|
||||||
* @return 餐位费信息
|
|
||||||
*/
|
|
||||||
@PostMapping("/choseCount")
|
|
||||||
public Result choseCount(@Validated @RequestBody ChoseCountDTO choseCountDTO) {
|
|
||||||
return Result.success(CodeEnum.SUCCESS, productService.choseCount(choseCountDTO));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/choseEatModel")
|
|
||||||
public Result choseEatModel(@Validated @RequestBody ChoseEatModelDTO choseEatModelDTO) {
|
|
||||||
List<TbCashierCart> cashierCartList = cartService.choseEatModel(choseEatModelDTO);
|
|
||||||
BigDecimal amount = BigDecimal.ZERO;
|
|
||||||
ArrayList<TbCashierCart> cashierCarts = new ArrayList<>();
|
|
||||||
for (TbCashierCart item : cashierCartList) {
|
|
||||||
if (!TableConstant.CART_SEAT_ID.equals(item.getProductId())) {
|
|
||||||
cashierCarts.add(item);
|
|
||||||
}
|
|
||||||
amount = amount.add(item.getTotalAmount());
|
|
||||||
}
|
|
||||||
HashMap<String, Object> data = new HashMap<>();
|
|
||||||
data.put("amount", amount);
|
|
||||||
data.put("info", cashierCarts);
|
|
||||||
return Result.success(CodeEnum.SUCCESS, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("cleanCart")
|
@PostMapping("cleanCart")
|
||||||
public Result cleanCart(@RequestBody JSONObject jsonObject) {
|
public Result cleanCart(@RequestBody JSONObject jsonObject) {
|
||||||
log.info("清空购物车数据:{}", jsonObject);
|
log.info("清空购物车数据:{}", jsonObject);
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.controller;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.BaseCallTableDTO;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.CallSubMsgDTO;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.CancelCallQueueDTO;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.TakeNumberDTO;
|
|
||||||
import com.chaozhanggui.system.cashierservice.service.TbCallService;
|
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 叫号
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/callTable")
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class TbCallTableController {
|
|
||||||
|
|
||||||
private final TbCallService tbCallService;
|
|
||||||
|
|
||||||
@PostMapping("takeNumber")
|
|
||||||
public Result takeNumber(
|
|
||||||
@Validated @RequestBody TakeNumberDTO takeNumberDTO
|
|
||||||
) {
|
|
||||||
return Result.successWithData(tbCallService.takeNumber(takeNumberDTO));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 排号列表
|
|
||||||
* @param openId openId
|
|
||||||
* @param shopId 店铺id
|
|
||||||
* @return data
|
|
||||||
*/
|
|
||||||
@GetMapping("queue")
|
|
||||||
public Result get(
|
|
||||||
@RequestParam String openId,
|
|
||||||
@RequestParam Integer shopId,
|
|
||||||
@RequestParam(required = false) Integer queueId
|
|
||||||
) {
|
|
||||||
return Result.successWithData(tbCallService.getList(shopId, openId, queueId));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
public Result getList(
|
|
||||||
@RequestParam Integer shopId
|
|
||||||
) {
|
|
||||||
return Result.successWithData(tbCallService.getAllInfo(shopId));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/cancel")
|
|
||||||
public Result cancel(
|
|
||||||
@Validated @RequestBody CancelCallQueueDTO cancelCallQueueDTO
|
|
||||||
) {
|
|
||||||
return Result.successWithData(tbCallService.cancel(cancelCallQueueDTO));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("state")
|
|
||||||
public Result getState(
|
|
||||||
@RequestParam String openId,
|
|
||||||
@RequestParam Integer shopId,
|
|
||||||
@RequestParam(required = false) Integer queueId
|
|
||||||
) {
|
|
||||||
return Result.successWithData(tbCallService.getState(openId, shopId, queueId));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("subMsg")
|
|
||||||
public Result subMsg(
|
|
||||||
@Validated @RequestBody CallSubMsgDTO subMsgDTO
|
|
||||||
) {
|
|
||||||
return Result.successWithData(tbCallService.subMsg(subMsgDTO));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.controller;
|
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.UserCouponDto;
|
|
||||||
import com.chaozhanggui.system.cashierservice.service.TbUserCouponsService;
|
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("userConpons")
|
|
||||||
public class TbUserCouponsController {
|
|
||||||
/**
|
|
||||||
* 服务对象
|
|
||||||
*/
|
|
||||||
@Autowired
|
|
||||||
private TbUserCouponsService tbUserCouponsService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询优惠卷
|
|
||||||
* @param conponDto
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RequestMapping("find")
|
|
||||||
public Result queryByPage(@RequestBody UserCouponDto conponDto) {
|
|
||||||
return tbUserCouponsService.queryByPage(conponDto);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -65,20 +65,9 @@ public class UserContoller {
|
|||||||
|
|
||||||
@PostMapping("/openMember")
|
@PostMapping("/openMember")
|
||||||
public Result openMember(@RequestBody OpenMemberVo memberVo){
|
public Result openMember(@RequestBody OpenMemberVo memberVo){
|
||||||
if(StringUtils.isBlank(memberVo.getTelephone())){
|
|
||||||
return Result.fail("手机号不可为空");
|
|
||||||
}
|
|
||||||
return userService.openMember(memberVo);
|
return userService.openMember(memberVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/upVipPhont")
|
|
||||||
public Result upVipPhont(@RequestBody OpenMemberVo memberVo){
|
|
||||||
if(StringUtils.isBlank(memberVo.getTelephone())){
|
|
||||||
return Result.fail("手机号不可为空");
|
|
||||||
}
|
|
||||||
return userService.upVipPhont(memberVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/shopUserInfo")
|
@GetMapping("/shopUserInfo")
|
||||||
public Result shopUserInfo(@RequestParam("userId") String userId, @RequestHeader("openId") String openId, @RequestParam("shopId") String shopId) throws Exception {
|
public Result shopUserInfo(@RequestParam("userId") String userId, @RequestHeader("openId") String openId, @RequestParam("shopId") String shopId) throws Exception {
|
||||||
if(shopId.equals("undefined")){
|
if(shopId.equals("undefined")){
|
||||||
@@ -133,7 +122,6 @@ public class UserContoller {
|
|||||||
shopUser.setLng(tbShopInfo.getLng());
|
shopUser.setLng(tbShopInfo.getLng());
|
||||||
shopUser.setLat(tbShopInfo.getLat());
|
shopUser.setLat(tbShopInfo.getLat());
|
||||||
shopUser.setAddress(tbShopInfo.getAddress());
|
shopUser.setAddress(tbShopInfo.getAddress());
|
||||||
shopUser.setIsUser(tbShopInfo.getIsCustom());
|
|
||||||
}
|
}
|
||||||
return Result.success(CodeEnum.SUCCESS, shopUser);
|
return Result.success(CodeEnum.SUCCESS, shopUser);
|
||||||
}
|
}
|
||||||
@@ -175,9 +163,14 @@ public class UserContoller {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取订阅当前用户店库存预警消息的二维码
|
* 获取订阅当前用户店库存预警消息的二维码
|
||||||
|
*
|
||||||
|
* @param shopId
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/subQrCode")
|
@GetMapping("/subQrCode")
|
||||||
public Result getSubQrCode(@RequestParam String shopId) throws Exception {
|
public Result getSubQrCode(
|
||||||
|
@RequestParam String shopId
|
||||||
|
) throws Exception {
|
||||||
String url = userService.getSubQrCode(shopId);
|
String url = userService.getSubQrCode(shopId);
|
||||||
return Result.successWithData(url);
|
return Result.successWithData(url);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,78 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.dao;
|
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateInRecord;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbProduct;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbUserCoupons;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.vo.UserCouponVo;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 活动商品赠送表(TbActivateInRecord)表数据库访问层
|
|
||||||
*
|
|
||||||
* @author ww
|
|
||||||
* @since 2024-08-22 11:13:40
|
|
||||||
*/
|
|
||||||
public interface TbActivateInRecordMapper {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过ID查询单条数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
TbActivateInRecord queryById(Integer id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询数据
|
|
||||||
*
|
|
||||||
* @param tbActivateInRecord 查询条件
|
|
||||||
* @return 对象列表
|
|
||||||
*/
|
|
||||||
List<TbActivateInRecord> queryAll(TbActivateInRecord tbActivateInRecord);
|
|
||||||
|
|
||||||
List<TbProduct> queryByVipIdAndShopId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId);
|
|
||||||
List<UserCouponVo> queryVipPro(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId,@Param("shopName")String shopName);
|
|
||||||
int queryByVipIdAndShopIdAndProId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
|
|
||||||
List<TbActivateInRecord> queryAllByVipIdAndShopIdAndProId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
|
|
||||||
|
|
||||||
int countCouponNum(@Param("userId") Integer userId);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增数据
|
|
||||||
*
|
|
||||||
* @param tbActivateInRecord 实例对象
|
|
||||||
* @return 影响行数
|
|
||||||
*/
|
|
||||||
int insert(TbActivateInRecord tbActivateInRecord);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量新增数据(MyBatis原生foreach方法)
|
|
||||||
*
|
|
||||||
* @param entities List<TbActivateInRecord> 实例对象列表
|
|
||||||
* @return 影响行数
|
|
||||||
*/
|
|
||||||
int insertBatch(@Param("entities") List<TbActivateInRecord> entities);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改数据
|
|
||||||
*
|
|
||||||
* @param tbActivateInRecord 实例对象
|
|
||||||
* @return 影响行数
|
|
||||||
*/
|
|
||||||
int update(TbActivateInRecord tbActivateInRecord);
|
|
||||||
|
|
||||||
int updateOverNumById(@Param("id")Integer id,@Param("overNum")Integer overNum);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过主键删除数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 影响行数
|
|
||||||
*/
|
|
||||||
int deleteById(Integer id);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -11,19 +11,19 @@ import java.util.List;
|
|||||||
@Component
|
@Component
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface TbActivateMapper {
|
public interface TbActivateMapper {
|
||||||
// int deleteByPrimaryKey(Integer id);
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
// int insert(TbActivate record);
|
int insert(TbActivate record);
|
||||||
|
|
||||||
// int insertSelective(TbActivate record);
|
int insertSelective(TbActivate record);
|
||||||
|
|
||||||
TbActivate selectByPrimaryKey(Integer id);
|
TbActivate selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
// int updateByPrimaryKeySelective(TbActivate record);
|
int updateByPrimaryKeySelective(TbActivate record);
|
||||||
|
|
||||||
// int updateByPrimaryKey(TbActivate record);
|
int updateByPrimaryKey(TbActivate record);
|
||||||
|
|
||||||
TbActivate selectByAmount(@Param("shopId") String shopId,@Param("amount") BigDecimal amount);
|
TbActivate selectByAmount(@Param("shopId") String shopId,@Param("amount") BigDecimal amount);
|
||||||
|
|
||||||
List<TbActivate> selectByShopId(String shopId);
|
List<TbActivate> selectByShpopId(String shopId);
|
||||||
}
|
}
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.dao;
|
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateOutRecord;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.vo.UserCouponVo;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 活动赠送商品使用记录表(TbActivateOutRecord)表数据库访问层
|
|
||||||
*
|
|
||||||
* @author ww
|
|
||||||
* @since 2024-08-22 11:21:56
|
|
||||||
*/
|
|
||||||
public interface TbActivateOutRecordMapper {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过ID查询单条数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
TbActivateOutRecord queryById(Integer id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询数据
|
|
||||||
*
|
|
||||||
* @param tbActivateOutRecord 查询条件
|
|
||||||
* @return 对象列表
|
|
||||||
*/
|
|
||||||
List<TbActivateOutRecord> queryAll(TbActivateOutRecord tbActivateOutRecord);
|
|
||||||
|
|
||||||
List<UserCouponVo> queryVipPro(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId, @Param("shopName") String shopName);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增数据
|
|
||||||
*
|
|
||||||
* @param tbActivateOutRecord 实例对象
|
|
||||||
* @return 影响行数
|
|
||||||
*/
|
|
||||||
int insert(TbActivateOutRecord tbActivateOutRecord);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量新增数据(MyBatis原生foreach方法)
|
|
||||||
*
|
|
||||||
* @param entities List<TbActivateOutRecord> 实例对象列表
|
|
||||||
* @return 影响行数
|
|
||||||
*/
|
|
||||||
int insertBatch(@Param("entities") List<TbActivateOutRecord> entities);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改数据
|
|
||||||
*
|
|
||||||
* @param tbActivateOutRecord 实例对象
|
|
||||||
* @return 影响行数
|
|
||||||
*/
|
|
||||||
int update(TbActivateOutRecord tbActivateOutRecord);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据订单id 将数据状态变为
|
|
||||||
* @param orderId 订单Id
|
|
||||||
* @param status 状态
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
int updateByOrderIdAndStatus(@Param("orderId")Integer orderId,@Param("status")String status);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过主键删除数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 影响行数
|
|
||||||
*/
|
|
||||||
int deleteById(Integer id);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.dao;
|
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateProduct;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 活动赠送商品表(TbActivateProduct)表数据库访问层
|
|
||||||
*
|
|
||||||
* @author ww
|
|
||||||
* @since 2024-08-20 15:14:55
|
|
||||||
*/
|
|
||||||
public interface TbActivateProductMapper {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过ID查询单条数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
TbActivateProduct queryById(Integer id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询数据
|
|
||||||
*
|
|
||||||
* @param tbActivateProduct 查询条件
|
|
||||||
* @return 对象列表
|
|
||||||
*/
|
|
||||||
List<TbActivateProduct> queryAll(TbActivateProduct tbActivateProduct);
|
|
||||||
|
|
||||||
List<TbActivateProduct> queryAllByActivateId(Integer activateId);
|
|
||||||
List<String> queryProsByActivateId(Integer activateId);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增数据
|
|
||||||
*
|
|
||||||
* @param tbActivateProduct 实例对象
|
|
||||||
* @return 影响行数
|
|
||||||
*/
|
|
||||||
int insert(TbActivateProduct tbActivateProduct);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量新增数据(MyBatis原生foreach方法)
|
|
||||||
*
|
|
||||||
* @param entities List<TbActivateProduct> 实例对象列表
|
|
||||||
* @return 影响行数
|
|
||||||
*/
|
|
||||||
int insertBatch(@Param("entities") List<TbActivateProduct> entities);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改数据
|
|
||||||
*
|
|
||||||
* @param tbActivateProduct 实例对象
|
|
||||||
* @return 影响行数
|
|
||||||
*/
|
|
||||||
int update(TbActivateProduct tbActivateProduct);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过主键删除数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 影响行数
|
|
||||||
*/
|
|
||||||
int deleteById(Integer id);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -56,6 +56,5 @@ public interface TbCashierCartMapper {
|
|||||||
List<TbCashierCart> selectByOrderId(@Param("orderId") String orderId,@Param("status") String status);
|
List<TbCashierCart> selectByOrderId(@Param("orderId") String orderId,@Param("status") String status);
|
||||||
|
|
||||||
void updateStatusByTableId(@Param("tableId")String tableId,@Param("status") String status);
|
void updateStatusByTableId(@Param("tableId")String tableId,@Param("status") String status);
|
||||||
void updateStatusByOrderIdForMini(@Param("tableId")String tableId,@Param("status") String status);
|
|
||||||
void updateStatusById(@Param("id")Integer id,@Param("status") String status);
|
void updateStatusById(@Param("id")Integer id,@Param("status") String status);
|
||||||
}
|
}
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.dao;
|
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbConsInfo;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@Mapper
|
|
||||||
public interface TbConsInfoMapper {
|
|
||||||
int deleteByPrimaryKey(Integer id);
|
|
||||||
|
|
||||||
int insert(TbConsInfo record);
|
|
||||||
|
|
||||||
int insertSelective(TbConsInfo record);
|
|
||||||
|
|
||||||
TbConsInfo selectByPrimaryKey(Integer id);
|
|
||||||
|
|
||||||
int updateByPrimaryKeySelective(TbConsInfo record);
|
|
||||||
|
|
||||||
int updateByPrimaryKey(TbConsInfo record);
|
|
||||||
|
|
||||||
int countAll();
|
|
||||||
|
|
||||||
List<TbConsInfo> selectAllInfo();
|
|
||||||
}
|
|
||||||
@@ -11,10 +11,6 @@ import java.util.List;
|
|||||||
@Component
|
@Component
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface TbOrderInfoMapper {
|
public interface TbOrderInfoMapper {
|
||||||
|
|
||||||
/**
|
|
||||||
* 逻辑删除
|
|
||||||
*/
|
|
||||||
int deleteByPrimaryKey(Integer id);
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
int insert(TbOrderInfo record);
|
int insert(TbOrderInfo record);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public interface TbProductMapper {
|
|||||||
|
|
||||||
List<TbProduct> selectByIds(@Param("list") List<String> ids);
|
List<TbProduct> selectByIds(@Param("list") List<String> ids);
|
||||||
Integer selectByQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId);
|
Integer selectByQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId);
|
||||||
Integer selectByCodeAndSkuId(@Param("code") String code,@Param("skuId") Integer skuId,@Param("shopId") String shopId,@Param("isVip") String isVip);
|
Integer selectByCodeAndSkuId(@Param("code") String code,@Param("skuId") Integer skuId,@Param("shopId") String shopId);
|
||||||
Integer selectByNewQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId,@Param("list") List<String> list);
|
Integer selectByNewQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId,@Param("list") List<String> list);
|
||||||
|
|
||||||
List<ShopGroupInfoVo> selGroups(@Param("proName") String proName,@Param("type") String type,
|
List<ShopGroupInfoVo> selGroups(@Param("proName") String proName,@Param("type") String type,
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.dao;
|
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbProskuCon;
|
|
||||||
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 TbProskuConMapper {
|
|
||||||
int deleteByPrimaryKey(Integer id);
|
|
||||||
|
|
||||||
int insert(TbProskuCon record);
|
|
||||||
|
|
||||||
int insertSelective(TbProskuCon record);
|
|
||||||
|
|
||||||
TbProskuCon selectByPrimaryKey(Integer id);
|
|
||||||
|
|
||||||
int updateByPrimaryKeySelective(TbProskuCon record);
|
|
||||||
|
|
||||||
int updateByPrimaryKey(TbProskuCon record);
|
|
||||||
|
|
||||||
|
|
||||||
List<TbProskuCon> selectBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
|
||||||
List<TbProskuCon> selectBySkuIdAndShopIdAngCheck(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
|
||||||
|
|
||||||
|
|
||||||
List<Integer> selectIdBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
|
||||||
|
|
||||||
List<TbProskuCon> selectByShopIdAndSkuIdAndProductId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
|
|
||||||
List<TbProskuCon> selectByShopIdAndSkuIdAndProductIdAndCheck(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -17,7 +17,7 @@ public interface TbShopAdDao {
|
|||||||
*
|
*
|
||||||
* @return 对象列表
|
* @return 对象列表
|
||||||
*/
|
*/
|
||||||
@Select("select * from tb_shop_ad where (shop_id = #{songId} or shop_id = 1) and status=1")
|
@Select("select * from fycashier.tb_shop_ad where (shop_id = #{songId} or shop_id = 1) and status=1")
|
||||||
List<TbShopAd> shopAdList(Integer shopId);
|
List<TbShopAd> shopAdList(Integer shopId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.dao;
|
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbShopExtend;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 店铺扩展信息(TbShopExtend)表数据库访问层
|
|
||||||
*
|
|
||||||
* @author ww
|
|
||||||
* @since 2024-08-21 09:40:25
|
|
||||||
*/
|
|
||||||
public interface TbShopExtendMapper {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过ID查询单条数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
TbShopExtend queryById(Integer id);
|
|
||||||
|
|
||||||
TbShopExtend queryByShopIdAndAutoKey(Integer shopId,String autokey);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询数据
|
|
||||||
*
|
|
||||||
* @param tbShopExtend 查询条件
|
|
||||||
* @return 对象列表
|
|
||||||
*/
|
|
||||||
List<TbShopExtend> queryAll(TbShopExtend tbShopExtend);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -30,10 +30,10 @@ public interface TbShopSongMapper {
|
|||||||
|
|
||||||
List<TbShopSong> selectAllAndSearch(Integer shopId, String keyWord);
|
List<TbShopSong> selectAllAndSearch(Integer shopId, String keyWord);
|
||||||
|
|
||||||
@Select("select * from tb_shop_song where id=#{songId} and status=1")
|
@Select("select * from fycashier.tb_shop_song where id=#{songId} and status=1")
|
||||||
TbShopSong selectById(@Param("songId") Integer songId);
|
TbShopSong selectById(@Param("songId") Integer songId);
|
||||||
|
|
||||||
|
|
||||||
@Update("update tb_shop_song set sales_number=sales_number+#{num} where id=#{id}")
|
@Update("update fycashier.tb_shop_song set sales_number=sales_number+#{num} where id=#{id}")
|
||||||
int incrNum(@Param("num") Integer num,@Param("id") Integer id);
|
int incrNum(@Param("num") Integer num,@Param("id") Integer id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public interface TbShopSongOrderMapper {
|
|||||||
" AND a.id=#{id}")
|
" AND a.id=#{id}")
|
||||||
Map<String, Object> selectByUserIdAndId(@Param("openId") String openId, @Param("id") Integer id);
|
Map<String, Object> selectByUserIdAndId(@Param("openId") String openId, @Param("id") Integer id);
|
||||||
|
|
||||||
@Select("select * from tb_shop_song_order where order_no=#{orderNo};")
|
@Select("select * from fycashier.tb_shop_song_order where order_no=#{orderNo};")
|
||||||
TbShopSongOrder selectByOrderNo(@Param("orderNo") String orderNo);
|
TbShopSongOrder selectByOrderNo(@Param("orderNo") String orderNo);
|
||||||
|
|
||||||
@Delete("DELETE FROM tb_shop_song_order\n" +
|
@Delete("DELETE FROM tb_shop_song_order\n" +
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -33,8 +32,6 @@ public interface TbShopUserMapper {
|
|||||||
TbShopUser selectByPhoneAndShopId(@Param("phone") String phone,@Param("shopId") String shopId);
|
TbShopUser selectByPhoneAndShopId(@Param("phone") String phone,@Param("shopId") String shopId);
|
||||||
TbShopUser selectPCByPhoneAndShopId(@Param("phone") String phone,@Param("shopId") String shopId);
|
TbShopUser selectPCByPhoneAndShopId(@Param("phone") String phone,@Param("shopId") String shopId);
|
||||||
List<TbShopUser> selectAllByUserId(@Param("userId") String userId);
|
List<TbShopUser> selectAllByUserId(@Param("userId") String userId);
|
||||||
List<TbShopUser> selectVipByUserId(@Param("userId") Integer userId);
|
|
||||||
BigDecimal countAmount(@Param("userId") Integer userId);
|
|
||||||
|
|
||||||
|
|
||||||
List<ShopUserListVo> selectByUserId(@Param("userId") String userId, @Param("shopId") String shopId);
|
List<ShopUserListVo> selectByUserId(@Param("userId") String userId, @Param("shopId") String shopId);
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.dao;
|
package com.chaozhanggui.system.cashierservice.dao;
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbUserCoupons;
|
import com.chaozhanggui.system.cashierservice.entity.TbUserCoupons;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.UserCouponDto;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.vo.UserCouponVo;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -20,7 +18,6 @@ public interface TbUserCouponsMapper {
|
|||||||
int insertSelective(TbUserCoupons record);
|
int insertSelective(TbUserCoupons record);
|
||||||
|
|
||||||
TbUserCoupons selectByPrimaryKey(Integer id);
|
TbUserCoupons selectByPrimaryKey(Integer id);
|
||||||
List<UserCouponVo> queryAllSelective(UserCouponDto record);
|
|
||||||
|
|
||||||
int updateByPrimaryKeySelective(TbUserCoupons record);
|
int updateByPrimaryKeySelective(TbUserCoupons record);
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.Enum;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订餐用餐类型枚举
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
public enum OrderUseTypeEnum {
|
|
||||||
TAKEOUT("takeout"),
|
|
||||||
DINE_IN_AFTER("dine-in-after"),
|
|
||||||
DINE_IN_BEFORE("dine-in-before");
|
|
||||||
private final String value;
|
|
||||||
|
|
||||||
OrderUseTypeEnum(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.Enum;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
public enum PlatformTypeEnum {
|
|
||||||
MINI_APP("miniapp");
|
|
||||||
private final String value;
|
|
||||||
|
|
||||||
PlatformTypeEnum(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.Enum;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 店铺就餐类型
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
public enum ShopInfoEatModelEnum {
|
|
||||||
TAKE_OUT("take-out"),
|
|
||||||
DINE_IN("dine-in");
|
|
||||||
|
|
||||||
private final String value;
|
|
||||||
|
|
||||||
ShopInfoEatModelEnum(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.Enum;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 店铺注册类型枚举
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
public enum ShopInfoRegisterlEnum {
|
|
||||||
// 快餐版
|
|
||||||
MUNCHIES("munchies"),
|
|
||||||
// 餐饮版
|
|
||||||
RESTAURANT("restaurant");
|
|
||||||
|
|
||||||
private final String value;
|
|
||||||
|
|
||||||
ShopInfoRegisterlEnum(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +1,7 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity;
|
package com.chaozhanggui.system.cashierservice.entity;
|
||||||
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class TbActivate implements Serializable {
|
public class TbActivate implements Serializable {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
@@ -22,10 +18,6 @@ public class TbActivate implements Serializable {
|
|||||||
|
|
||||||
private String isDel;
|
private String isDel;
|
||||||
|
|
||||||
//是否赠送商品 0否 1是
|
|
||||||
private Integer isGiftPro;
|
|
||||||
private List<String> gives;
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
@@ -83,24 +75,4 @@ public class TbActivate implements Serializable {
|
|||||||
public void setIsDel(String isDel) {
|
public void setIsDel(String isDel) {
|
||||||
this.isDel = isDel == null ? null : isDel.trim();
|
this.isDel = isDel == null ? null : isDel.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getIsGiftPro() {
|
|
||||||
return isGiftPro;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsGiftPro(Integer isGiftPro) {
|
|
||||||
this.isGiftPro = isGiftPro;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getGives() {
|
|
||||||
return gives;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGives(List<String> gives) {
|
|
||||||
if(CollectionUtils.isEmpty(gives)){
|
|
||||||
this.gives = new ArrayList<>();
|
|
||||||
}else {
|
|
||||||
this.gives = gives;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,140 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 活动商品赠送表(TbActivateInRecord)实体类
|
|
||||||
*
|
|
||||||
* @author ww
|
|
||||||
* @since 2024-08-22 11:13:40
|
|
||||||
*/
|
|
||||||
public class TbActivateInRecord implements Serializable {
|
|
||||||
private static final long serialVersionUID = -35515830201618782L;
|
|
||||||
|
|
||||||
private Integer id;
|
|
||||||
/**
|
|
||||||
* 会员id
|
|
||||||
*/
|
|
||||||
private Integer vipUserId;
|
|
||||||
/**
|
|
||||||
* 商品id
|
|
||||||
*/
|
|
||||||
private Integer proId;
|
|
||||||
/**
|
|
||||||
* 赠送数量
|
|
||||||
*/
|
|
||||||
private Integer num;
|
|
||||||
/**
|
|
||||||
* 未使用数量
|
|
||||||
*/
|
|
||||||
private Integer overNum;
|
|
||||||
/**
|
|
||||||
* 店铺id
|
|
||||||
*/
|
|
||||||
private Integer shopId;
|
|
||||||
/**
|
|
||||||
* 来源活动id
|
|
||||||
*/
|
|
||||||
private Integer sourceActId;
|
|
||||||
|
|
||||||
private Integer sourceFlowId;
|
|
||||||
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
public TbActivateInRecord(Integer vipUserId, Integer proId, Integer num, Integer shopId, Integer sourceActId,Integer sourceFlowId) {
|
|
||||||
this.vipUserId = vipUserId;
|
|
||||||
this.proId = proId;
|
|
||||||
this.num = num;
|
|
||||||
this.overNum = num;
|
|
||||||
this.shopId = shopId;
|
|
||||||
this.sourceActId = sourceActId;
|
|
||||||
this.sourceFlowId = sourceFlowId;
|
|
||||||
this.createTime=new Date();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getVipUserId() {
|
|
||||||
return vipUserId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVipUserId(Integer vipUserId) {
|
|
||||||
this.vipUserId = vipUserId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getProId() {
|
|
||||||
return proId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProId(Integer proId) {
|
|
||||||
this.proId = proId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getNum() {
|
|
||||||
return num;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNum(Integer num) {
|
|
||||||
this.num = num;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getOverNum() {
|
|
||||||
return overNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOverNum(Integer overNum) {
|
|
||||||
this.overNum = overNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getShopId() {
|
|
||||||
return shopId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShopId(Integer shopId) {
|
|
||||||
this.shopId = shopId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getSourceActId() {
|
|
||||||
return sourceActId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSourceActId(Integer sourceActId) {
|
|
||||||
this.sourceActId = sourceActId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getSourceFlowId() {
|
|
||||||
return sourceFlowId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSourceFlowId(Integer sourceFlowId) {
|
|
||||||
this.sourceFlowId = sourceFlowId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateTime(Date createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getUpdateTime() {
|
|
||||||
return updateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdateTime(Date updateTime) {
|
|
||||||
this.updateTime = updateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,125 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 活动赠送商品使用记录表(TbActivateOutRecord)实体类
|
|
||||||
*
|
|
||||||
* @author ww
|
|
||||||
* @since 2024-08-22 11:21:56
|
|
||||||
*/
|
|
||||||
public class TbActivateOutRecord implements Serializable {
|
|
||||||
private static final long serialVersionUID = -54399746948905097L;
|
|
||||||
|
|
||||||
private Integer id;
|
|
||||||
/**
|
|
||||||
* 商品赠送Id
|
|
||||||
*/
|
|
||||||
private Integer giveId;
|
|
||||||
/**
|
|
||||||
* 商品id
|
|
||||||
*/
|
|
||||||
private Integer proId;
|
|
||||||
/**
|
|
||||||
* 使用数量
|
|
||||||
*/
|
|
||||||
private Integer useNum;
|
|
||||||
/**
|
|
||||||
* 退单量
|
|
||||||
*/
|
|
||||||
private Integer refNum;
|
|
||||||
/**
|
|
||||||
* 订单id
|
|
||||||
*/
|
|
||||||
private String orderId;
|
|
||||||
//新建: create, 完成: closed, 取消:cancel,
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
public TbActivateOutRecord(Integer giveId, Integer proId, Integer useNum, String orderId, String status) {
|
|
||||||
this.giveId = giveId;
|
|
||||||
this.proId = proId;
|
|
||||||
this.useNum = useNum;
|
|
||||||
this.orderId = orderId;
|
|
||||||
this.status = status;
|
|
||||||
this.createTime = new Date();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getGiveId() {
|
|
||||||
return giveId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGiveId(Integer giveId) {
|
|
||||||
this.giveId = giveId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getProId() {
|
|
||||||
return proId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProId(Integer proId) {
|
|
||||||
this.proId = proId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getUseNum() {
|
|
||||||
return useNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUseNum(Integer useNum) {
|
|
||||||
this.useNum = useNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getRefNum() {
|
|
||||||
return refNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRefNum(Integer refNum) {
|
|
||||||
this.refNum = refNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(String status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOrderId() {
|
|
||||||
return orderId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrderId(String orderId) {
|
|
||||||
this.orderId = orderId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateTime(Date createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getUpdateTime() {
|
|
||||||
return updateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdateTime(Date updateTime) {
|
|
||||||
this.updateTime = updateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 活动赠送商品表(TbActivateProduct)实体类
|
|
||||||
*
|
|
||||||
* @author ww
|
|
||||||
* @since 2024-08-20 15:15:01
|
|
||||||
*/
|
|
||||||
public class TbActivateProduct implements Serializable {
|
|
||||||
private static final long serialVersionUID = 592370528166603965L;
|
|
||||||
|
|
||||||
private Integer id;
|
|
||||||
/**
|
|
||||||
* 活动Id
|
|
||||||
*/
|
|
||||||
private Integer activateId;
|
|
||||||
/**
|
|
||||||
* 商品id
|
|
||||||
*/
|
|
||||||
private Integer productId;
|
|
||||||
/**
|
|
||||||
* 数量
|
|
||||||
*/
|
|
||||||
private Integer num;
|
|
||||||
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getActivateId() {
|
|
||||||
return activateId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setActivateId(Integer activateId) {
|
|
||||||
this.activateId = activateId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getProductId() {
|
|
||||||
return productId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductId(Integer productId) {
|
|
||||||
this.productId = productId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getNum() {
|
|
||||||
return num;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNum(Integer num) {
|
|
||||||
this.num = num;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateTime(Date createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getUpdateTime() {
|
|
||||||
return updateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdateTime(Date updateTime) {
|
|
||||||
this.updateTime = updateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,213 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 叫号排号表
|
|
||||||
* @TableName tb_call_queue
|
|
||||||
*/
|
|
||||||
@TableName(value ="tb_call_queue")
|
|
||||||
@Data
|
|
||||||
public class TbCallQueue implements Serializable {
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@TableId(type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 叫号台桌类型id
|
|
||||||
*/
|
|
||||||
private Integer callTableId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 手机号
|
|
||||||
*/
|
|
||||||
private String phone;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 姓名
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 店铺名称
|
|
||||||
*/
|
|
||||||
private String shopName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 店铺id
|
|
||||||
*/
|
|
||||||
private Integer shopId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* -1已取消 0排队中 1叫号中 2已入座 3 已过号
|
|
||||||
*/
|
|
||||||
private Integer state;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 排号时间
|
|
||||||
*/
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 叫号时间
|
|
||||||
*/
|
|
||||||
private Date callTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 叫号次数
|
|
||||||
*/
|
|
||||||
private Integer callCount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 过号时间
|
|
||||||
*/
|
|
||||||
private Date passTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取消时间
|
|
||||||
*/
|
|
||||||
private Date cancelTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String note;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private Integer userId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private String openId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订阅提醒 0未订阅 1已订阅
|
|
||||||
*/
|
|
||||||
private Integer subState;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 确认时间
|
|
||||||
*/
|
|
||||||
private Date confirmTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 叫号号码
|
|
||||||
*/
|
|
||||||
private String callNum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建年月日
|
|
||||||
*/
|
|
||||||
private String createDay;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否已经顺延
|
|
||||||
*/
|
|
||||||
private Integer isPostpone;
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object that) {
|
|
||||||
if (this == that) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (that == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != that.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
TbCallQueue other = (TbCallQueue) that;
|
|
||||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
|
||||||
&& (this.getCallTableId() == null ? other.getCallTableId() == null : this.getCallTableId().equals(other.getCallTableId()))
|
|
||||||
&& (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone()))
|
|
||||||
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
|
|
||||||
&& (this.getShopName() == null ? other.getShopName() == null : this.getShopName().equals(other.getShopName()))
|
|
||||||
&& (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId()))
|
|
||||||
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
|
|
||||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
|
|
||||||
&& (this.getCallTime() == null ? other.getCallTime() == null : this.getCallTime().equals(other.getCallTime()))
|
|
||||||
&& (this.getCallCount() == null ? other.getCallCount() == null : this.getCallCount().equals(other.getCallCount()))
|
|
||||||
&& (this.getPassTime() == null ? other.getPassTime() == null : this.getPassTime().equals(other.getPassTime()))
|
|
||||||
&& (this.getCancelTime() == null ? other.getCancelTime() == null : this.getCancelTime().equals(other.getCancelTime()))
|
|
||||||
&& (this.getNote() == null ? other.getNote() == null : this.getNote().equals(other.getNote()))
|
|
||||||
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
|
|
||||||
&& (this.getOpenId() == null ? other.getOpenId() == null : this.getOpenId().equals(other.getOpenId()))
|
|
||||||
&& (this.getSubState() == null ? other.getSubState() == null : this.getSubState().equals(other.getSubState()))
|
|
||||||
&& (this.getConfirmTime() == null ? other.getConfirmTime() == null : this.getConfirmTime().equals(other.getConfirmTime()))
|
|
||||||
&& (this.getCallNum() == null ? other.getCallNum() == null : this.getCallNum().equals(other.getCallNum()))
|
|
||||||
&& (this.getCreateDay() == null ? other.getCreateDay() == null : this.getCreateDay().equals(other.getCreateDay()))
|
|
||||||
&& (this.getIsPostpone() == null ? other.getIsPostpone() == null : this.getIsPostpone().equals(other.getIsPostpone()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
|
||||||
result = prime * result + ((getCallTableId() == null) ? 0 : getCallTableId().hashCode());
|
|
||||||
result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode());
|
|
||||||
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
|
|
||||||
result = prime * result + ((getShopName() == null) ? 0 : getShopName().hashCode());
|
|
||||||
result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode());
|
|
||||||
result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
|
|
||||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
|
|
||||||
result = prime * result + ((getCallTime() == null) ? 0 : getCallTime().hashCode());
|
|
||||||
result = prime * result + ((getCallCount() == null) ? 0 : getCallCount().hashCode());
|
|
||||||
result = prime * result + ((getPassTime() == null) ? 0 : getPassTime().hashCode());
|
|
||||||
result = prime * result + ((getCancelTime() == null) ? 0 : getCancelTime().hashCode());
|
|
||||||
result = prime * result + ((getNote() == null) ? 0 : getNote().hashCode());
|
|
||||||
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
|
|
||||||
result = prime * result + ((getOpenId() == null) ? 0 : getOpenId().hashCode());
|
|
||||||
result = prime * result + ((getSubState() == null) ? 0 : getSubState().hashCode());
|
|
||||||
result = prime * result + ((getConfirmTime() == null) ? 0 : getConfirmTime().hashCode());
|
|
||||||
result = prime * result + ((getCallNum() == null) ? 0 : getCallNum().hashCode());
|
|
||||||
result = prime * result + ((getCreateDay() == null) ? 0 : getCreateDay().hashCode());
|
|
||||||
result = prime * result + ((getIsPostpone() == null) ? 0 : getIsPostpone().hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append(getClass().getSimpleName());
|
|
||||||
sb.append(" [");
|
|
||||||
sb.append("Hash = ").append(hashCode());
|
|
||||||
sb.append(", id=").append(id);
|
|
||||||
sb.append(", callTableId=").append(callTableId);
|
|
||||||
sb.append(", phone=").append(phone);
|
|
||||||
sb.append(", name=").append(name);
|
|
||||||
sb.append(", shopName=").append(shopName);
|
|
||||||
sb.append(", shopId=").append(shopId);
|
|
||||||
sb.append(", state=").append(state);
|
|
||||||
sb.append(", createTime=").append(createTime);
|
|
||||||
sb.append(", callTime=").append(callTime);
|
|
||||||
sb.append(", callCount=").append(callCount);
|
|
||||||
sb.append(", passTime=").append(passTime);
|
|
||||||
sb.append(", cancelTime=").append(cancelTime);
|
|
||||||
sb.append(", note=").append(note);
|
|
||||||
sb.append(", userId=").append(userId);
|
|
||||||
sb.append(", openId=").append(openId);
|
|
||||||
sb.append(", subState=").append(subState);
|
|
||||||
sb.append(", confirmTime=").append(confirmTime);
|
|
||||||
sb.append(", callNum=").append(callNum);
|
|
||||||
sb.append(", createDay=").append(createDay);
|
|
||||||
sb.append(", isPostpone=").append(isPostpone);
|
|
||||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
|
||||||
sb.append("]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @TableName tb_call_table
|
|
||||||
*/
|
|
||||||
@TableName(value ="tb_call_table")
|
|
||||||
@Data
|
|
||||||
public class TbCallTable implements Serializable {
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@TableId(type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 描述
|
|
||||||
*/
|
|
||||||
private String note;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 等待时间分钟
|
|
||||||
*/
|
|
||||||
private Integer waitTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 前缀
|
|
||||||
*/
|
|
||||||
private String prefix;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 起始号码
|
|
||||||
*/
|
|
||||||
private Integer start;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 临近几桌提醒
|
|
||||||
*/
|
|
||||||
private Integer nearNum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 0禁用 1使用
|
|
||||||
*/
|
|
||||||
private Integer state;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 店铺id
|
|
||||||
*/
|
|
||||||
private Integer shopId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 二维码地址
|
|
||||||
*/
|
|
||||||
private String qrcode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object that) {
|
|
||||||
if (this == that) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (that == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != that.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
TbCallTable other = (TbCallTable) that;
|
|
||||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
|
||||||
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
|
|
||||||
&& (this.getNote() == null ? other.getNote() == null : this.getNote().equals(other.getNote()))
|
|
||||||
&& (this.getWaitTime() == null ? other.getWaitTime() == null : this.getWaitTime().equals(other.getWaitTime()))
|
|
||||||
&& (this.getPrefix() == null ? other.getPrefix() == null : this.getPrefix().equals(other.getPrefix()))
|
|
||||||
&& (this.getStart() == null ? other.getStart() == null : this.getStart().equals(other.getStart()))
|
|
||||||
&& (this.getNearNum() == null ? other.getNearNum() == null : this.getNearNum().equals(other.getNearNum()))
|
|
||||||
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
|
|
||||||
&& (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId()))
|
|
||||||
&& (this.getQrcode() == null ? other.getQrcode() == null : this.getQrcode().equals(other.getQrcode()))
|
|
||||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
|
|
||||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
|
||||||
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
|
|
||||||
result = prime * result + ((getNote() == null) ? 0 : getNote().hashCode());
|
|
||||||
result = prime * result + ((getWaitTime() == null) ? 0 : getWaitTime().hashCode());
|
|
||||||
result = prime * result + ((getPrefix() == null) ? 0 : getPrefix().hashCode());
|
|
||||||
result = prime * result + ((getStart() == null) ? 0 : getStart().hashCode());
|
|
||||||
result = prime * result + ((getNearNum() == null) ? 0 : getNearNum().hashCode());
|
|
||||||
result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
|
|
||||||
result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode());
|
|
||||||
result = prime * result + ((getQrcode() == null) ? 0 : getQrcode().hashCode());
|
|
||||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
|
|
||||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append(getClass().getSimpleName());
|
|
||||||
sb.append(" [");
|
|
||||||
sb.append("Hash = ").append(hashCode());
|
|
||||||
sb.append(", id=").append(id);
|
|
||||||
sb.append(", name=").append(name);
|
|
||||||
sb.append(", note=").append(note);
|
|
||||||
sb.append(", waitTime=").append(waitTime);
|
|
||||||
sb.append(", prefix=").append(prefix);
|
|
||||||
sb.append(", start=").append(start);
|
|
||||||
sb.append(", nearNum=").append(nearNum);
|
|
||||||
sb.append(", state=").append(state);
|
|
||||||
sb.append(", shopId=").append(shopId);
|
|
||||||
sb.append(", qrcode=").append(qrcode);
|
|
||||||
sb.append(", createTime=").append(createTime);
|
|
||||||
sb.append(", updateTime=").append(updateTime);
|
|
||||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
|
||||||
sb.append("]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity;
|
package com.chaozhanggui.system.cashierservice.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@@ -11,7 +8,6 @@ import java.math.BigDecimal;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class TbCashierCart implements Serializable {
|
public class TbCashierCart implements Serializable {
|
||||||
@TableId(type = IdType.AUTO)
|
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
private String masterId;
|
private String masterId;
|
||||||
@@ -62,14 +58,7 @@ public class TbCashierCart implements Serializable {
|
|||||||
private Long updatedAt;
|
private Long updatedAt;
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
private String tableId;
|
private String tableId;
|
||||||
private Byte isVip;
|
|
||||||
@TableField(exist = false)
|
|
||||||
private TbProductSpec tbProductSpec;
|
private TbProductSpec tbProductSpec;
|
||||||
private String note;
|
|
||||||
|
|
||||||
private String platformType;
|
|
||||||
private String useType;
|
|
||||||
private Integer placeNum;
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|||||||
@@ -1,169 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class TbConsInfo implements Serializable {
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
private Integer shopId;
|
|
||||||
|
|
||||||
private Integer conTypeId;
|
|
||||||
|
|
||||||
private String conTypeName;
|
|
||||||
|
|
||||||
private String conCode;
|
|
||||||
|
|
||||||
private String conName;
|
|
||||||
|
|
||||||
private BigDecimal stockNumber;
|
|
||||||
|
|
||||||
private String conUnit;
|
|
||||||
|
|
||||||
private BigDecimal lasterInStock;
|
|
||||||
|
|
||||||
private BigDecimal conWarning;
|
|
||||||
|
|
||||||
private BigDecimal stockConsume;
|
|
||||||
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
private BigDecimal price;
|
|
||||||
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
private String isCheck;
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getShopId() {
|
|
||||||
return shopId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShopId(Integer shopId) {
|
|
||||||
this.shopId = shopId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getConTypeId() {
|
|
||||||
return conTypeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConTypeId(Integer conTypeId) {
|
|
||||||
this.conTypeId = conTypeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getConTypeName() {
|
|
||||||
return conTypeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConTypeName(String conTypeName) {
|
|
||||||
this.conTypeName = conTypeName == null ? null : conTypeName.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getConCode() {
|
|
||||||
return conCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConCode(String conCode) {
|
|
||||||
this.conCode = conCode == null ? null : conCode.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getConName() {
|
|
||||||
return conName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConName(String conName) {
|
|
||||||
this.conName = conName == null ? null : conName.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getStockNumber() {
|
|
||||||
return stockNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStockNumber(BigDecimal stockNumber) {
|
|
||||||
this.stockNumber = stockNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getConUnit() {
|
|
||||||
return conUnit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConUnit(String conUnit) {
|
|
||||||
this.conUnit = conUnit == null ? null : conUnit.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getLasterInStock() {
|
|
||||||
return lasterInStock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLasterInStock(BigDecimal lasterInStock) {
|
|
||||||
this.lasterInStock = lasterInStock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getConWarning() {
|
|
||||||
return conWarning;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConWarning(BigDecimal conWarning) {
|
|
||||||
this.conWarning = conWarning;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateTime(Date createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getUpdateTime() {
|
|
||||||
return updateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdateTime(Date updateTime) {
|
|
||||||
this.updateTime = updateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getStockConsume() {
|
|
||||||
return stockConsume;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStockConsume(BigDecimal stockConsume) {
|
|
||||||
this.stockConsume = stockConsume;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(String status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getPrice() {
|
|
||||||
return price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrice(BigDecimal price) {
|
|
||||||
this.price = price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIsCheck() {
|
|
||||||
return isCheck;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsCheck(String isCheck) {
|
|
||||||
this.isCheck = isCheck;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,8 +23,6 @@ public class TbMerchantThirdApply implements Serializable {
|
|||||||
|
|
||||||
private String smallAppid;
|
private String smallAppid;
|
||||||
|
|
||||||
private String alipaySmallAppid;
|
|
||||||
|
|
||||||
private String storeId;
|
private String storeId;
|
||||||
|
|
||||||
|
|
||||||
@@ -119,12 +117,4 @@ public class TbMerchantThirdApply implements Serializable {
|
|||||||
public void setStoreId(String storeId) {
|
public void setStoreId(String storeId) {
|
||||||
this.storeId = storeId;
|
this.storeId = storeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAlipaySmallAppid() {
|
|
||||||
return alipaySmallAppid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAlipaySmallAppid(String alipaySmallAppid) {
|
|
||||||
this.alipaySmallAppid = alipaySmallAppid;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity;
|
package com.chaozhanggui.system.cashierservice.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -21,8 +20,6 @@ public class TbOrderDetail implements Serializable {
|
|||||||
|
|
||||||
private Integer num;
|
private Integer num;
|
||||||
|
|
||||||
private Byte isVip;
|
|
||||||
|
|
||||||
private String productName;
|
private String productName;
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
@@ -38,13 +35,6 @@ public class TbOrderDetail implements Serializable {
|
|||||||
|
|
||||||
private BigDecimal priceAmount;
|
private BigDecimal priceAmount;
|
||||||
private BigDecimal packAmount;
|
private BigDecimal packAmount;
|
||||||
@TableField(exist = false)
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
private Integer cartId;
|
|
||||||
private Integer placeNum;
|
|
||||||
private String useType;
|
|
||||||
private String note;
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity;
|
package com.chaozhanggui.system.cashierservice.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -11,7 +8,6 @@ import java.util.List;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class TbOrderInfo implements Serializable {
|
public class TbOrderInfo implements Serializable {
|
||||||
@TableId(type = IdType.AUTO)
|
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
//订单号
|
//订单号
|
||||||
@@ -62,15 +58,11 @@ public class TbOrderInfo implements Serializable {
|
|||||||
private Byte isVip;
|
private Byte isVip;
|
||||||
|
|
||||||
private String memberId;
|
private String memberId;
|
||||||
@TableField(exist = false)
|
|
||||||
private String userName;
|
private String userName;
|
||||||
@TableField(exist = false)
|
|
||||||
private String memberName;
|
private String memberName;
|
||||||
@TableField(exist = false)
|
|
||||||
private String zdNo;
|
private String zdNo;
|
||||||
|
|
||||||
private String userId;
|
private String userId;
|
||||||
@TableField(exist = false)
|
|
||||||
private String imgUrl;
|
private String imgUrl;
|
||||||
|
|
||||||
private Integer productScore;
|
private Integer productScore;
|
||||||
@@ -105,32 +97,16 @@ public class TbOrderInfo implements Serializable {
|
|||||||
private String masterId;
|
private String masterId;
|
||||||
private String isBuyCoupon;
|
private String isBuyCoupon;
|
||||||
private String isUseCoupon;
|
private String isUseCoupon;
|
||||||
@TableField(exist = false)
|
|
||||||
private Integer totalNumber;
|
private Integer totalNumber;
|
||||||
@TableField(exist = false)
|
|
||||||
private List<TbOrderDetail> detailList;
|
private List<TbOrderDetail> detailList;
|
||||||
@TableField(exist = false)
|
|
||||||
private String winnnerNo;
|
private String winnnerNo;
|
||||||
@TableField(exist = false)
|
|
||||||
private String isWinner;
|
private String isWinner;
|
||||||
@TableField(exist = false)
|
|
||||||
private String shopName;
|
|
||||||
|
|
||||||
private String useType;
|
|
||||||
|
|
||||||
// 下单次数
|
|
||||||
private Integer placeNum;
|
|
||||||
|
|
||||||
private Integer seatCount;
|
|
||||||
private BigDecimal seatAmount;
|
|
||||||
|
|
||||||
|
|
||||||
//根据状态返回 需付款 已付款 未付款 已退
|
//根据状态返回 需付款 已付款 未付款 已退
|
||||||
@TableField(exist = false)
|
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
public void setDescription(String shopName) {
|
public void setDescription() {
|
||||||
this.shopName = shopName;
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case "closed":
|
case "closed":
|
||||||
this.description = "已付款";
|
this.description = "已付款";
|
||||||
|
|||||||
@@ -35,14 +35,6 @@ public class TbPrintMachine implements Serializable {
|
|||||||
|
|
||||||
private String productId;
|
private String productId;
|
||||||
|
|
||||||
private String receiptSize;
|
|
||||||
private String classifyPrint;
|
|
||||||
private String tablePrint;
|
|
||||||
private String printQty;
|
|
||||||
private String printMethod;
|
|
||||||
private String printType;
|
|
||||||
private String printReceipt;
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
@@ -172,60 +164,4 @@ public class TbPrintMachine implements Serializable {
|
|||||||
public void setProductId(String productId) {
|
public void setProductId(String productId) {
|
||||||
this.productId = productId == null ? null : productId.trim();
|
this.productId = productId == null ? null : productId.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReceiptSize() {
|
|
||||||
return receiptSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReceiptSize(String receiptSize) {
|
|
||||||
this.receiptSize = receiptSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getClassifyPrint() {
|
|
||||||
return classifyPrint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setClassifyPrint(String classifyPrint) {
|
|
||||||
this.classifyPrint = classifyPrint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTablePrint() {
|
|
||||||
return tablePrint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTablePrint(String tablePrint) {
|
|
||||||
this.tablePrint = tablePrint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPrintQty() {
|
|
||||||
return printQty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrintQty(String printQty) {
|
|
||||||
this.printQty = printQty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPrintMethod() {
|
|
||||||
return printMethod;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrintMethod(String printMethod) {
|
|
||||||
this.printMethod = printMethod;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPrintType() {
|
|
||||||
return printType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrintType(String printType) {
|
|
||||||
this.printType = printType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPrintReceipt() {
|
|
||||||
return printReceipt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrintReceipt(String printReceipt) {
|
|
||||||
this.printReceipt = printReceipt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -66,6 +66,11 @@ public class TbProduct implements Serializable {
|
|||||||
|
|
||||||
private String typeEnum;
|
private String typeEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否共享库存
|
||||||
|
*/
|
||||||
|
private Byte isDistribute;
|
||||||
|
|
||||||
private Byte isDel;
|
private Byte isDel;
|
||||||
|
|
||||||
private Byte isStock;
|
private Byte isStock;
|
||||||
@@ -135,9 +140,6 @@ public class TbProduct implements Serializable {
|
|||||||
//是否可售 1 可售 0非可售
|
//是否可售 1 可售 0非可售
|
||||||
private Integer isSale = 1;
|
private Integer isSale = 1;
|
||||||
|
|
||||||
private Integer warnLine = 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getImages() {
|
public String getImages() {
|
||||||
return images;
|
return images;
|
||||||
@@ -401,6 +403,13 @@ public class TbProduct implements Serializable {
|
|||||||
this.typeEnum = typeEnum == null ? null : typeEnum.trim();
|
this.typeEnum = typeEnum == null ? null : typeEnum.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Byte getIsDistribute() {
|
||||||
|
return isDistribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsDistribute(Byte isDistribute) {
|
||||||
|
this.isDistribute = isDistribute;
|
||||||
|
}
|
||||||
|
|
||||||
public Byte getIsDel() {
|
public Byte getIsDel() {
|
||||||
return isDel;
|
return isDel;
|
||||||
@@ -674,12 +683,4 @@ public class TbProduct implements Serializable {
|
|||||||
public void setIsSale(Integer isSale) {
|
public void setIsSale(Integer isSale) {
|
||||||
this.isSale = isSale;
|
this.isSale = isSale;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getWarnLine() {
|
|
||||||
return warnLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWarnLine(Integer warnLine) {
|
|
||||||
this.warnLine = warnLine;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public class TbProductSku implements Serializable {
|
|||||||
|
|
||||||
private String coverImg;
|
private String coverImg;
|
||||||
|
|
||||||
|
private Integer warnLine;
|
||||||
|
|
||||||
private Double weight;
|
private Double weight;
|
||||||
|
|
||||||
@@ -174,6 +175,14 @@ public class TbProductSku implements Serializable {
|
|||||||
this.coverImg = coverImg == null ? null : coverImg.trim();
|
this.coverImg = coverImg == null ? null : coverImg.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getWarnLine() {
|
||||||
|
return warnLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWarnLine(Integer warnLine) {
|
||||||
|
this.warnLine = warnLine;
|
||||||
|
}
|
||||||
|
|
||||||
public Double getWeight() {
|
public Double getWeight() {
|
||||||
return weight;
|
return weight;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,89 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class TbProskuCon implements Serializable {
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
private Integer shopId;
|
|
||||||
|
|
||||||
private Integer productId;
|
|
||||||
|
|
||||||
private Integer productSkuId;
|
|
||||||
|
|
||||||
private Integer conInfoId;
|
|
||||||
|
|
||||||
private BigDecimal surplusStock;
|
|
||||||
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getShopId() {
|
|
||||||
return shopId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShopId(Integer shopId) {
|
|
||||||
this.shopId = shopId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getProductId() {
|
|
||||||
return productId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductId(Integer productId) {
|
|
||||||
this.productId = productId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getProductSkuId() {
|
|
||||||
return productSkuId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductSkuId(Integer productSkuId) {
|
|
||||||
this.productSkuId = productSkuId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getConInfoId() {
|
|
||||||
return conInfoId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConInfoId(Integer conInfoId) {
|
|
||||||
this.conInfoId = conInfoId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getSurplusStock() {
|
|
||||||
return surplusStock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSurplusStock(BigDecimal surplusStock) {
|
|
||||||
this.surplusStock = surplusStock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(String status) {
|
|
||||||
this.status = status == null ? null : status.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateTime(Date createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 店铺扩展信息(TbShopExtend)实体类
|
|
||||||
*
|
|
||||||
* @author ww
|
|
||||||
* @since 2024-08-21 09:40:26
|
|
||||||
*/
|
|
||||||
public class TbShopExtend implements Serializable {
|
|
||||||
private static final long serialVersionUID = -25782280496188600L;
|
|
||||||
/**
|
|
||||||
* 自增id
|
|
||||||
*/
|
|
||||||
private Integer id;
|
|
||||||
/**
|
|
||||||
* 商户Id
|
|
||||||
*/
|
|
||||||
private Integer shopId;
|
|
||||||
/**
|
|
||||||
* img:图片;text:文本;
|
|
||||||
*/
|
|
||||||
private String type;
|
|
||||||
/**
|
|
||||||
* 描述
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
/**
|
|
||||||
* 自定义key
|
|
||||||
*/
|
|
||||||
private String autokey;
|
|
||||||
/**
|
|
||||||
* 值
|
|
||||||
*/
|
|
||||||
private String value;
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
private Date updateTime;
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getShopId() {
|
|
||||||
return shopId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShopId(Integer shopId) {
|
|
||||||
this.shopId = shopId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAutokey() {
|
|
||||||
return autokey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAutokey(String autokey) {
|
|
||||||
this.autokey = autokey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getUpdateTime() {
|
|
||||||
return updateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdateTime(Date updateTime) {
|
|
||||||
this.updateTime = updateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateTime(Date createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -112,16 +112,6 @@ public class TbShopInfo implements Serializable {
|
|||||||
private String districts;
|
private String districts;
|
||||||
|
|
||||||
private String isCustom;
|
private String isCustom;
|
||||||
//是否开启桌位费 0否1是
|
|
||||||
private Integer isTableFee;
|
|
||||||
//桌位费
|
|
||||||
private BigDecimal tableFee;
|
|
||||||
//就餐模式 堂食 dine-in 外带 take-out
|
|
||||||
private String eatModel;
|
|
||||||
//程序码(零点八零首页)
|
|
||||||
private String smallQrcode;
|
|
||||||
//店铺收款码
|
|
||||||
private String paymentQrcode;
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,8 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity;
|
package com.chaozhanggui.system.cashierservice.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class TbShopTable implements Serializable {
|
public class TbShopTable implements Serializable {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@@ -41,26 +36,144 @@ public class TbShopTable implements Serializable {
|
|||||||
|
|
||||||
private String qrcode;
|
private String qrcode;
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String areaname;
|
private String areaname;
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private Integer orderId;
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private boolean isChoseCount;
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private Integer seatNum;
|
|
||||||
|
|
||||||
private Integer autoClear;
|
|
||||||
private Date useTime;
|
|
||||||
private Date endTime;
|
|
||||||
private Integer productNum;
|
|
||||||
private BigDecimal totalAmount;
|
|
||||||
private BigDecimal realAmount;
|
|
||||||
private Integer useNum;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String getAreaname() {
|
||||||
|
return areaname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAreaname(String areaname) {
|
||||||
|
this.areaname = areaname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getQrcode() {
|
||||||
|
return qrcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQrcode(String qrcode) {
|
||||||
|
this.qrcode = qrcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name == null ? null : name.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getShopId() {
|
||||||
|
return shopId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShopId(Integer shopId) {
|
||||||
|
this.shopId = shopId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMaxCapacity() {
|
||||||
|
return maxCapacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxCapacity(Integer maxCapacity) {
|
||||||
|
this.maxCapacity = maxCapacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSort() {
|
||||||
|
return sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSort(Integer sort) {
|
||||||
|
this.sort = sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getAreaId() {
|
||||||
|
return areaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAreaId(Integer areaId) {
|
||||||
|
this.areaId = areaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Byte getIsPredate() {
|
||||||
|
return isPredate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsPredate(Byte isPredate) {
|
||||||
|
this.isPredate = isPredate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getPredateAmount() {
|
||||||
|
return predateAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPredateAmount(BigDecimal predateAmount) {
|
||||||
|
this.predateAmount = predateAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status == null ? null : status.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Byte getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(Byte type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAmount(BigDecimal amount) {
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getPerhour() {
|
||||||
|
return perhour;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPerhour(BigDecimal perhour) {
|
||||||
|
this.perhour = perhour;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getView() {
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setView(String view) {
|
||||||
|
this.view = view == null ? null : view.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCreatedAt() {
|
||||||
|
return createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedAt(Long createdAt) {
|
||||||
|
this.createdAt = createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUpdatedAt() {
|
||||||
|
return updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdatedAt(Long updatedAt) {
|
||||||
|
this.updatedAt = updatedAt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,6 @@ import org.springframework.data.annotation.Transient;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.Timestamp;
|
|
||||||
|
|
||||||
public class TbShopUser implements Serializable {
|
public class TbShopUser implements Serializable {
|
||||||
private String id;
|
private String id;
|
||||||
@@ -74,7 +73,7 @@ public class TbShopUser implements Serializable {
|
|||||||
@Transient
|
@Transient
|
||||||
private String isUser;
|
private String isUser;
|
||||||
|
|
||||||
private Timestamp joinTime;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -321,44 +320,4 @@ public class TbShopUser implements Serializable {
|
|||||||
public void setMiniOpenId(String miniOpenId) {
|
public void setMiniOpenId(String miniOpenId) {
|
||||||
this.miniOpenId = miniOpenId == null ? null : miniOpenId.trim();
|
this.miniOpenId = miniOpenId == null ? null : miniOpenId.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIsUser() {
|
|
||||||
return isUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsUser(String isUser) {
|
|
||||||
this.isUser = isUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLat() {
|
|
||||||
return lat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLat(String lat) {
|
|
||||||
this.lat = lat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLng() {
|
|
||||||
return lng;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLng(String lng) {
|
|
||||||
this.lng = lng;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAddress() {
|
|
||||||
return address;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAddress(String address) {
|
|
||||||
this.address = address;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Timestamp getJoinTime() {
|
|
||||||
return joinTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJoinTime(Timestamp joinTime) {
|
|
||||||
this.joinTime = joinTime;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -21,11 +21,6 @@ public class TbShopUserFlow implements Serializable {
|
|||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
|
||||||
private String isReturn;
|
|
||||||
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
@@ -91,20 +86,4 @@ public class TbShopUserFlow implements Serializable {
|
|||||||
public void setType(String type) {
|
public void setType(String type) {
|
||||||
this.type = type == null ? null : type.trim();
|
this.type = type == null ? null : type.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIsReturn() {
|
|
||||||
return isReturn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsReturn(String isReturn) {
|
|
||||||
this.isReturn = isReturn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRemark() {
|
|
||||||
return remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRemark(String remark) {
|
|
||||||
this.remark = remark;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,6 @@ public class TbUserCoupons implements Serializable{
|
|||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
private String userId;
|
private String userId;
|
||||||
private String detail;
|
|
||||||
private Integer orderId;
|
private Integer orderId;
|
||||||
|
|
||||||
private BigDecimal couponsPrice;
|
private BigDecimal couponsPrice;
|
||||||
|
|||||||
@@ -102,10 +102,6 @@ public class TbUserInfo implements Serializable {
|
|||||||
private String pwd;
|
private String pwd;
|
||||||
|
|
||||||
private String custPhone="400-6666-389";
|
private String custPhone="400-6666-389";
|
||||||
//优惠卷数量
|
|
||||||
private Integer couponAll = 0;
|
|
||||||
//储值数量
|
|
||||||
private BigDecimal balanceAll = BigDecimal.ZERO;
|
|
||||||
|
|
||||||
|
|
||||||
public String getAvatar() {
|
public String getAvatar() {
|
||||||
@@ -509,20 +505,4 @@ public class TbUserInfo implements Serializable {
|
|||||||
public void setPwd(String pwd) {
|
public void setPwd(String pwd) {
|
||||||
this.pwd = pwd;
|
this.pwd = pwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getCouponAll() {
|
|
||||||
return couponAll;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCouponAll(Integer couponAll) {
|
|
||||||
this.couponAll = couponAll;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getBalanceAll() {
|
|
||||||
return balanceAll;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBalanceAll(BigDecimal balanceAll) {
|
|
||||||
this.balanceAll = balanceAll;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class BaseCallTableDTO {
|
|
||||||
@NotNull
|
|
||||||
private Integer callTableId;
|
|
||||||
@NotNull
|
|
||||||
private Integer shopId;
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class CallNumPrintDTO {
|
|
||||||
private Integer callQueueId;
|
|
||||||
private Integer shopId;
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class CallSubMsgDTO {
|
|
||||||
@NotNull
|
|
||||||
private Integer queueId;
|
|
||||||
@NotEmpty
|
|
||||||
private String openId;
|
|
||||||
@NotNull
|
|
||||||
private Integer shopId;
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class CancelCallQueueDTO {
|
|
||||||
@NotNull
|
|
||||||
private Integer queueId;
|
|
||||||
@NotNull
|
|
||||||
private Integer shopId;
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.Min;
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class ChoseCountDTO {
|
|
||||||
@NotNull
|
|
||||||
private Integer shopId;
|
|
||||||
@NotEmpty
|
|
||||||
private String tableId;
|
|
||||||
@NotNull
|
|
||||||
@Min(1)
|
|
||||||
private Integer num;
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.Max;
|
|
||||||
import javax.validation.constraints.Min;
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class ChoseEatModelDTO {
|
|
||||||
@NotNull
|
|
||||||
private Integer shopId;
|
|
||||||
private String tableId;
|
|
||||||
@NotNull
|
|
||||||
@Max(1)
|
|
||||||
@Min(0)
|
|
||||||
// 0切换店内 1切换外带
|
|
||||||
private Integer type;
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class ShopEatTypeInfoDTO {
|
|
||||||
private boolean isTakeout;
|
|
||||||
private boolean isMunchies;
|
|
||||||
private boolean isDineInAfter;
|
|
||||||
private boolean isDineInBefore;
|
|
||||||
private TbShopInfo shopInfo;
|
|
||||||
private String useType;
|
|
||||||
private boolean isOpenTakeout;
|
|
||||||
private boolean isOpenDineIn;
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import javax.validation.constraints.Pattern;
|
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
|
||||||
public class TakeNumberDTO extends BaseCallTableDTO{
|
|
||||||
@NotBlank
|
|
||||||
@Pattern(regexp = "^1\\d{10}$|^(0\\d{2,3}-?|\\(0\\d{2,3}\\))?[1-9]\\d{4,7}(-\\d{1,8})?$",message = "手机号码格式错误")
|
|
||||||
private String phone;
|
|
||||||
private String note;
|
|
||||||
private String name;
|
|
||||||
@NotBlank
|
|
||||||
private String openId;
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class UserCouponDto extends BasePageDto{
|
|
||||||
private Integer userId;
|
|
||||||
private Integer status;
|
|
||||||
private Integer shopId;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class CallQueueInfoVO {
|
|
||||||
private Integer id;
|
|
||||||
private String tableName;
|
|
||||||
private String tableNote;
|
|
||||||
private Integer waitingCount;
|
|
||||||
private Integer waitTime;
|
|
||||||
private Integer state;
|
|
||||||
private String callNum;
|
|
||||||
private String shopState;
|
|
||||||
private String shopName;
|
|
||||||
private String logo;
|
|
||||||
}
|
|
||||||
@@ -6,8 +6,10 @@ import lombok.Data;
|
|||||||
public class OpenMemberVo {
|
public class OpenMemberVo {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private Integer shopId;
|
private Integer shopId;
|
||||||
private String telephone;
|
|
||||||
private String nickName;
|
|
||||||
private String birthDay;
|
|
||||||
private String headImg;
|
private String headImg;
|
||||||
|
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
private String telephone;
|
||||||
|
private String birthDay;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,9 +37,4 @@ public class OrderVo {
|
|||||||
|
|
||||||
private String outNumber;
|
private String outNumber;
|
||||||
|
|
||||||
private String useType;
|
|
||||||
|
|
||||||
private Integer shopId;
|
|
||||||
private String qrcode;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class UserCouponVo {
|
|
||||||
/**
|
|
||||||
* 2 会员商品卷
|
|
||||||
*/
|
|
||||||
private Integer type;
|
|
||||||
/**
|
|
||||||
* 卷描述
|
|
||||||
*/
|
|
||||||
private String detail;
|
|
||||||
private String shopId;
|
|
||||||
private String shopName;
|
|
||||||
private String orderId;
|
|
||||||
/**
|
|
||||||
* 优惠金额
|
|
||||||
*/
|
|
||||||
private BigDecimal couponsPrice = BigDecimal.ZERO;
|
|
||||||
/**
|
|
||||||
* 多少可用
|
|
||||||
*/
|
|
||||||
private BigDecimal couponsAmount = BigDecimal.ZERO;
|
|
||||||
/**
|
|
||||||
* 数量
|
|
||||||
*/
|
|
||||||
private Integer num;
|
|
||||||
/**
|
|
||||||
* 卷状态 0 未使用
|
|
||||||
*/
|
|
||||||
private String status;
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbProduct;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class VipProductsLimits extends TbProduct {
|
|
||||||
|
|
||||||
private Integer vipLimitNumber;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -14,11 +14,7 @@ import java.util.List;
|
|||||||
@WebFilter(urlPatterns = {"/cashierService/*"},filterName = "customFilter")
|
@WebFilter(urlPatterns = {"/cashierService/*"},filterName = "customFilter")
|
||||||
public class CustomFilter implements Filter {
|
public class CustomFilter implements Filter {
|
||||||
|
|
||||||
private static final List<String> unFilterUrlList =
|
private static final List<String> unFilterUrlList= Arrays.asList("/cashierService/notify/notifyCallBack","/cashierService/notify/memberInCallBack");
|
||||||
Arrays.asList(
|
|
||||||
"/cashierService/notify/notifyCallBack",
|
|
||||||
"/cashierService/notify/memberInCallBack"
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
private boolean isfilter(String url){
|
private boolean isfilter(String url){
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbOrderInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Administrator
|
|
||||||
* @description 针对表【tb_call_queue】的数据库操作Mapper
|
|
||||||
* @createDate 2024-09-13 13:44:26
|
|
||||||
* @Entity com.chaozhanggui.system.cashierservice.entity.TbCallQueue
|
|
||||||
*/
|
|
||||||
public interface MpCashierCartMapper extends BaseMapper<TbCashierCart> {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbOrderDetail;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbOrderInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Administrator
|
|
||||||
* @description 针对表【tb_call_queue】的数据库操作Mapper
|
|
||||||
* @createDate 2024-09-13 13:44:26
|
|
||||||
* @Entity com.chaozhanggui.system.cashierservice.entity.TbCallQueue
|
|
||||||
*/
|
|
||||||
public interface MpOrderDetailMapper extends BaseMapper<TbOrderDetail> {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbOrderInfo;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Administrator
|
|
||||||
* @description 针对表【tb_call_queue】的数据库操作Mapper
|
|
||||||
* @createDate 2024-09-13 13:44:26
|
|
||||||
* @Entity com.chaozhanggui.system.cashierservice.entity.TbCallQueue
|
|
||||||
*/
|
|
||||||
public interface MpOrderInfoMapper extends BaseMapper<TbOrderInfo> {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbCallQueue;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.vo.CallQueueInfoVO;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Administrator
|
|
||||||
* @description 针对表【tb_call_queue】的数据库操作Mapper
|
|
||||||
* @createDate 2024-09-13 13:44:26
|
|
||||||
* @Entity com.chaozhanggui.system.cashierservice.entity.TbCallQueue
|
|
||||||
*/
|
|
||||||
public interface MpShopInfoMapper extends BaseMapper<TbShopInfo> {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbShopTable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Administrator
|
|
||||||
* @description 针对表【tb_call_queue】的数据库操作Mapper
|
|
||||||
* @createDate 2024-09-13 13:44:26
|
|
||||||
* @Entity com.chaozhanggui.system.cashierservice.entity.TbCallQueue
|
|
||||||
*/
|
|
||||||
public interface MpShopTableMapper extends BaseMapper<TbShopTable> {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.mapper;
|
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbCallQueue;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.vo.CallQueueInfoVO;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Administrator
|
|
||||||
* @description 针对表【tb_call_queue】的数据库操作Mapper
|
|
||||||
* @createDate 2024-09-13 13:44:26
|
|
||||||
* @Entity com.chaozhanggui.system.cashierservice.entity.TbCallQueue
|
|
||||||
*/
|
|
||||||
public interface TbCallQueueMapper extends BaseMapper<TbCallQueue> {
|
|
||||||
|
|
||||||
List<CallQueueInfoVO> selectInfoByOpenId(Integer shopId, String openId, String today, Integer queueId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.mapper;
|
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbCallTable;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Administrator
|
|
||||||
* @description 针对表【tb_call_table】的数据库操作Mapper
|
|
||||||
* @createDate 2024-09-13 13:44:34
|
|
||||||
* @Entity com.chaozhanggui.system.cashierservice.entity.TbCallTable
|
|
||||||
*/
|
|
||||||
public interface TbCallTableMapper extends BaseMapper<TbCallTable> {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.mpservice;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.chaozhanggui.system.cashierservice.constant.TableConstant;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbShopTable;
|
|
||||||
|
|
||||||
public interface MpShopTableService extends IService<TbShopTable> {
|
|
||||||
/**
|
|
||||||
* 根据台桌id修改台桌状态
|
|
||||||
* @param tableId qrcode
|
|
||||||
* @param state 状态
|
|
||||||
*/
|
|
||||||
boolean updateStateByQrcode(String tableId, TableConstant.ShopTable.State state);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据qrcode获取台桌
|
|
||||||
* @param tableId qrcode
|
|
||||||
*/
|
|
||||||
TbShopTable selectByQrcode(String tableId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 清除台桌状态
|
|
||||||
* @param tableId 台桌id
|
|
||||||
*/
|
|
||||||
boolean clearTableState(String tableId);
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.mpservice.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.chaozhanggui.system.cashierservice.constant.TableConstant;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbShopTable;
|
|
||||||
import com.chaozhanggui.system.cashierservice.mapper.MpShopTableMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.mpservice.MpShopTableService;
|
|
||||||
import org.springframework.context.annotation.Primary;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@Primary
|
|
||||||
public class MpShopTableServiceImpl extends ServiceImpl<MpShopTableMapper, TbShopTable> implements MpShopTableService {
|
|
||||||
@Override
|
|
||||||
public boolean updateStateByQrcode(String tableId, TableConstant.ShopTable.State state) {
|
|
||||||
return update(new LambdaUpdateWrapper<TbShopTable>()
|
|
||||||
.eq(TbShopTable::getQrcode, tableId)
|
|
||||||
.set(TbShopTable::getStatus, state.getValue()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TbShopTable selectByQrcode(String tableId) {
|
|
||||||
return getOne(new LambdaQueryWrapper<TbShopTable>()
|
|
||||||
.eq(TbShopTable::getQrcode, tableId));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean clearTableState(String tableId) {
|
|
||||||
TbShopTable shopTable = selectByQrcode(tableId);
|
|
||||||
if (shopTable.getAutoClear() != null && shopTable.getAutoClear() == 1) {
|
|
||||||
return update(new LambdaUpdateWrapper<TbShopTable>()
|
|
||||||
.eq(TbShopTable::getQrcode, tableId)
|
|
||||||
.set(TbShopTable::getUseTime, null)
|
|
||||||
.set(TbShopTable::getProductNum, 0)
|
|
||||||
.set(TbShopTable::getTotalAmount, 0)
|
|
||||||
.set(TbShopTable::getRealAmount, 0)
|
|
||||||
.set(TbShopTable::getUseNum, 0)
|
|
||||||
.set(TbShopTable::getStatus, TableConstant.ShopTable.State.CLEANING.getValue()));
|
|
||||||
}else {
|
|
||||||
return updateStateByQrcode(tableId, TableConstant.ShopTable.State.CLEANING);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,13 +3,11 @@ package com.chaozhanggui.system.cashierservice.netty;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
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.entity.dto.ShopEatTypeInfoDTO;
|
|
||||||
import com.chaozhanggui.system.cashierservice.netty.config.NettyChannelHandlerAdapter;
|
import com.chaozhanggui.system.cashierservice.netty.config.NettyChannelHandlerAdapter;
|
||||||
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;
|
||||||
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.util.ShopUtils;
|
|
||||||
import com.chaozhanggui.system.cashierservice.util.SpringUtils;
|
import com.chaozhanggui.system.cashierservice.util.SpringUtils;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
import io.netty.channel.ChannelHandler.Sharable;
|
import io.netty.channel.ChannelHandler.Sharable;
|
||||||
@@ -19,8 +17,6 @@ import io.netty.handler.timeout.IdleState;
|
|||||||
import io.netty.handler.timeout.IdleStateEvent;
|
import io.netty.handler.timeout.IdleStateEvent;
|
||||||
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.context.annotation.Lazy;
|
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -39,9 +35,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
public class PushToAppChannelHandlerAdapter extends NettyChannelHandlerAdapter {
|
public class PushToAppChannelHandlerAdapter extends NettyChannelHandlerAdapter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 台桌下单为: TAKEOUT_TABLE_CART:shopId:tableID
|
* [tableID-shopId, [userId, ctx]]
|
||||||
* 店内自取为: DINE_IN_TABLE_CART:shopId:userId
|
|
||||||
* [shopId:tableID, [userId, ctx]]
|
|
||||||
*/
|
*/
|
||||||
private static Map<String, ConcurrentHashMap<String, ChannelHandlerContext>> webSocketMap = new HashMap<>();
|
private static Map<String, ConcurrentHashMap<String, ChannelHandlerContext>> webSocketMap = new HashMap<>();
|
||||||
|
|
||||||
@@ -57,9 +51,6 @@ public class PushToAppChannelHandlerAdapter extends NettyChannelHandlerAdapter {
|
|||||||
private RabbitProducer a;
|
private RabbitProducer a;
|
||||||
//注入为空
|
//注入为空
|
||||||
public static RabbitProducer rabbitProducer;
|
public static RabbitProducer rabbitProducer;
|
||||||
|
|
||||||
private ShopUtils shopUtils = SpringUtils.getBean(ShopUtils.class);
|
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void b() {
|
public void b() {
|
||||||
rabbitProducer = this.a;
|
rabbitProducer = this.a;
|
||||||
@@ -97,14 +88,13 @@ public class PushToAppChannelHandlerAdapter extends NettyChannelHandlerAdapter {
|
|||||||
// 遍历webSocketMap,查找并移除对应的ChannelHandlerContext
|
// 遍历webSocketMap,查找并移除对应的ChannelHandlerContext
|
||||||
String key = ctxToUserIdMap.get(ctx);
|
String key = ctxToUserIdMap.get(ctx);
|
||||||
if (StringUtils.isNotBlank(key)) {
|
if (StringUtils.isNotBlank(key)) {
|
||||||
String[] split = key.split("-");
|
String[] split = key.split(":");
|
||||||
ConcurrentHashMap<String, ChannelHandlerContext> tableMap = webSocketMap.get(split[0]);
|
ConcurrentHashMap<String, ChannelHandlerContext> tableMap = webSocketMap.get(split[0]);
|
||||||
if (tableMap != null && !tableMap.isEmpty() && tableMap.size() > 0) {
|
if (tableMap != null && !tableMap.isEmpty() && tableMap.size() > 0) {
|
||||||
tableMap.remove(split[1]);
|
tableMap.remove(split[1]);
|
||||||
if (tableMap.isEmpty() || tableMap.size() == 0) {
|
if (tableMap.isEmpty() || tableMap.size() == 0) {
|
||||||
webSocketMap.remove(split[0]);
|
webSocketMap.remove(split[0]);
|
||||||
// 删除购物车缓存
|
redisUtils.deleteByKey(RedisCst.TABLE_CART.concat(split[0]));
|
||||||
redisUtils.deleteByKey(split[0]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,14 +133,12 @@ public class PushToAppChannelHandlerAdapter extends NettyChannelHandlerAdapter {
|
|||||||
channelInactive(ctx);
|
channelInactive(ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
String key = tableId + "-" + shopId;
|
||||||
ShopEatTypeInfoDTO eatModel = shopUtils.getEatModel(tableId, shopId);
|
log.info("netty连接 接收到数据 建立连接参数 param:{}",jsonObject);
|
||||||
String tableCartKey = RedisCst.getTableCartKey(shopId, eatModel.isOpenDineIn() ? tableId : null, Integer.valueOf(userId));
|
|
||||||
log.info("netty连接 接收到数据 建立连接参数 key: {} param:{}", tableCartKey, jsonObject);
|
|
||||||
this.tableId=tableId;
|
this.tableId=tableId;
|
||||||
this.shopId=shopId;
|
this.shopId=shopId;
|
||||||
if (webSocketMap.containsKey(tableCartKey)) {
|
if (webSocketMap.containsKey(key)) {
|
||||||
ConcurrentHashMap<String, ChannelHandlerContext> userSocketMap = webSocketMap.get(tableCartKey);
|
ConcurrentHashMap<String, ChannelHandlerContext> userSocketMap = webSocketMap.get(key);
|
||||||
ChannelHandlerContext channelHandlerContext = userSocketMap.get(userId);
|
ChannelHandlerContext channelHandlerContext = userSocketMap.get(userId);
|
||||||
if (channelHandlerContext != null) {
|
if (channelHandlerContext != null) {
|
||||||
channelHandlerContext.close();
|
channelHandlerContext.close();
|
||||||
@@ -159,9 +147,9 @@ public class PushToAppChannelHandlerAdapter extends NettyChannelHandlerAdapter {
|
|||||||
} else {
|
} else {
|
||||||
ConcurrentHashMap<String, ChannelHandlerContext> userSocketMap = new ConcurrentHashMap<>();
|
ConcurrentHashMap<String, ChannelHandlerContext> userSocketMap = new ConcurrentHashMap<>();
|
||||||
userSocketMap.put(userId, ctx);
|
userSocketMap.put(userId, ctx);
|
||||||
webSocketMap.put(tableCartKey,userSocketMap);
|
webSocketMap.put(key,userSocketMap);
|
||||||
}
|
}
|
||||||
ctxToUserIdMap.put(ctx, tableCartKey + "-" + userId);
|
ctxToUserIdMap.put(ctx, key + ":" + userId);
|
||||||
JSONObject jsonObject1 = new JSONObject();
|
JSONObject jsonObject1 = new JSONObject();
|
||||||
jsonObject1.put("status", "success");
|
jsonObject1.put("status", "success");
|
||||||
jsonObject1.put("msg", "连接成功");
|
jsonObject1.put("msg", "连接成功");
|
||||||
@@ -175,13 +163,11 @@ public class PushToAppChannelHandlerAdapter extends NettyChannelHandlerAdapter {
|
|||||||
log.info("netty连接 接收到接口数据:meg:{}",msg);
|
log.info("netty连接 接收到接口数据:meg:{}",msg);
|
||||||
jsonObject.put("tableId", this.tableId);
|
jsonObject.put("tableId", this.tableId);
|
||||||
jsonObject.put("shopId", this.shopId);
|
jsonObject.put("shopId", this.shopId);
|
||||||
Integer userId = jsonObject.getInteger("userId");
|
|
||||||
if("sku".equals(type)){
|
if("sku".equals(type)){
|
||||||
String tableCartKey = RedisCst.getTableCartKey(shopId, tableId, userId);
|
boolean exist = redisUtils.exists(RedisCst.TABLE_CART.concat(jsonObject.getString("tableId").concat("-").concat(shopId)));
|
||||||
boolean exist = redisUtils.exists(tableCartKey);
|
|
||||||
Integer num = 0;
|
Integer num = 0;
|
||||||
if (exist){
|
if (exist){
|
||||||
String message = redisUtils.getMessage(tableCartKey);
|
String message = redisUtils.getMessage(RedisCst.TABLE_CART.concat(jsonObject.getString("tableId").concat("-").concat(shopId)));
|
||||||
JSONArray array = JSON.parseArray(message);
|
JSONArray array = JSON.parseArray(message);
|
||||||
for (int i = 0; i < array.size(); i++) {
|
for (int i = 0; i < array.size(); i++) {
|
||||||
JSONObject object = array.getJSONObject(i);
|
JSONObject object = array.getJSONObject(i);
|
||||||
@@ -240,12 +226,11 @@ public class PushToAppChannelHandlerAdapter extends NettyChannelHandlerAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Async
|
@Async
|
||||||
public void AppSendInfo(String message, String redisKey,String userId, boolean userFlag) {
|
public void AppSendInfo(String message, String tableId,String userId, boolean userFlag) {
|
||||||
log.info("netty连接 发送消息 key:{} userId:{} userFlag:{} message:{}",redisKey,userId,userFlag, JSONUtil.toJSONString(message));
|
log.info("netty连接 发送消息 tableId:{} userId:{} userFlag:{} message:{}",tableId,userId,userFlag, JSONUtil.toJSONString(message));
|
||||||
log.info("当前已连接队列信息: {}", webSocketMap);
|
|
||||||
if (userFlag) {
|
if (userFlag) {
|
||||||
if (webSocketMap.containsKey(redisKey)) {
|
if (webSocketMap.containsKey(tableId)) {
|
||||||
ConcurrentHashMap<String, ChannelHandlerContext> webSockets = webSocketMap.get(redisKey);
|
ConcurrentHashMap<String, ChannelHandlerContext> webSockets = webSocketMap.get(tableId);
|
||||||
if(!webSockets.isEmpty()){
|
if(!webSockets.isEmpty()){
|
||||||
if (StringUtils.isNotBlank(userId)) {
|
if (StringUtils.isNotBlank(userId)) {
|
||||||
ChannelHandlerContext ctx = webSockets.get(userId);
|
ChannelHandlerContext ctx = webSockets.get(userId);
|
||||||
@@ -256,15 +241,15 @@ public class PushToAppChannelHandlerAdapter extends NettyChannelHandlerAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (StringUtils.isEmpty(redisKey)) {
|
if (StringUtils.isEmpty(tableId)) {
|
||||||
// 向所有用户发送信息
|
// 向所有用户发送信息
|
||||||
for (ConcurrentHashMap<String, ChannelHandlerContext> value : webSocketMap.values()) {
|
for (ConcurrentHashMap<String, ChannelHandlerContext> value : webSocketMap.values()) {
|
||||||
for (ChannelHandlerContext ctx : value.values()) {
|
for (ChannelHandlerContext ctx : value.values()) {
|
||||||
sendMesToApp(message,ctx);
|
sendMesToApp(message,ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (webSocketMap.containsKey(redisKey)) {
|
} else if (webSocketMap.containsKey(tableId)) {
|
||||||
ConcurrentHashMap<String, ChannelHandlerContext> webSockets = webSocketMap.get(redisKey);
|
ConcurrentHashMap<String, ChannelHandlerContext> webSockets = webSocketMap.get(tableId);
|
||||||
if(!webSockets.isEmpty()) {
|
if(!webSockets.isEmpty()) {
|
||||||
for (String user : webSockets.keySet()) {
|
for (String user : webSockets.keySet()) {
|
||||||
ChannelHandlerContext ctx = webSockets.get(user);
|
ChannelHandlerContext ctx = webSockets.get(user);
|
||||||
@@ -276,7 +261,7 @@ public class PushToAppChannelHandlerAdapter extends NettyChannelHandlerAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
log.info("netty连接 发送消息 桌码群发 tableId:{} 失败",redisKey);
|
log.info("netty连接 发送消息 桌码群发 tableId:{} 失败",tableId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,19 +160,6 @@ public class PushToClientChannelHandlerAdapter extends NettyChannelHandlerAdapte
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Async
|
|
||||||
public void AppSendInfo(String message, String shopId) {
|
|
||||||
log.info("长链接发送交班数据。");
|
|
||||||
ConcurrentHashMap<String, ChannelHandlerContext> webSockets = webSocketMap.get(shopId);
|
|
||||||
if (webSockets != null) {
|
|
||||||
for (ChannelHandlerContext ctx : webSockets.values()) {
|
|
||||||
sendMesToApp(message, ctx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//发送打印消息 有重发机制
|
|
||||||
public void AppSendInfoV1(String shopId, String orderNo, JSONObject message) {
|
public void AppSendInfoV1(String shopId, String orderNo, JSONObject message) {
|
||||||
log.info("netty连接client 发送消息 shopId:{} clientId:{} userFlag:{} message:{}", shopId, message.get("orderInfo"));
|
log.info("netty连接client 发送消息 shopId:{} clientId:{} userFlag:{} message:{}", shopId, message.get("orderInfo"));
|
||||||
retryQueue.computeIfAbsent(shopId, k -> new ConcurrentLinkedQueue<>()).offer(message);
|
retryQueue.computeIfAbsent(shopId, k -> new ConcurrentLinkedQueue<>()).offer(message);
|
||||||
|
|||||||
@@ -3,12 +3,10 @@ package com.chaozhanggui.system.cashierservice.rabbit;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
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.entity.dto.ShopEatTypeInfoDTO;
|
|
||||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||||
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.CartService;
|
import com.chaozhanggui.system.cashierservice.service.CartService;
|
||||||
import com.chaozhanggui.system.cashierservice.util.ShopUtils;
|
|
||||||
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.amqp.rabbit.annotation.RabbitHandler;
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
@@ -28,9 +26,6 @@ public class CartConsumer {
|
|||||||
private RedisUtil redisUtil;
|
private RedisUtil redisUtil;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CartService cartService;
|
private CartService cartService;
|
||||||
@Autowired
|
|
||||||
private ShopUtils shopUtils;
|
|
||||||
|
|
||||||
@RabbitHandler
|
@RabbitHandler
|
||||||
@RabbitListener(queues = {"${queue}"})
|
@RabbitListener(queues = {"${queue}"})
|
||||||
public void listener(String message) {
|
public void listener(String message) {
|
||||||
@@ -39,7 +34,6 @@ public class CartConsumer {
|
|||||||
JSONObject jsonObject = JSON.parseObject(message);
|
JSONObject jsonObject = JSON.parseObject(message);
|
||||||
String tableId = jsonObject.getString("tableId");
|
String tableId = jsonObject.getString("tableId");
|
||||||
String shopId = jsonObject.getString("shopId");
|
String shopId = jsonObject.getString("shopId");
|
||||||
Integer userId = jsonObject.getInteger("userId");
|
|
||||||
if (jsonObject.getString("type").equals("initCart") ) {
|
if (jsonObject.getString("type").equals("initCart") ) {
|
||||||
cartService.initCart(jsonObject);
|
cartService.initCart(jsonObject);
|
||||||
}
|
}
|
||||||
@@ -52,8 +46,16 @@ public class CartConsumer {
|
|||||||
else if (jsonObject.getString("type").equals("queryCart") ) {
|
else if (jsonObject.getString("type").equals("queryCart") ) {
|
||||||
cartService.queryCart(jsonObject);
|
cartService.queryCart(jsonObject);
|
||||||
} else if(jsonObject.getString("type").equals("createOrder")){
|
} else if(jsonObject.getString("type").equals("createOrder")){
|
||||||
|
String cartDetail = redisUtil.getMessage(RedisCst.TABLE_CART.concat(tableId).concat("-").concat(shopId));
|
||||||
|
if (StringUtils.isEmpty(cartDetail)){
|
||||||
|
log.info("createOrder购物车为空");
|
||||||
|
throw new MsgException("购物车为空无法下单");
|
||||||
|
}
|
||||||
|
JSONArray array = JSON.parseArray(cartDetail);
|
||||||
|
if (array.size() > 0){
|
||||||
cartService.createOrder(jsonObject);
|
cartService.createOrder(jsonObject);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// else if(jsonObject.getString("type").equals("clearCart")){
|
// else if(jsonObject.getString("type").equals("clearCart")){
|
||||||
// cartService.clearCart(jsonObject);
|
// cartService.clearCart(jsonObject);
|
||||||
// }
|
// }
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.rabbit;
|
package com.chaozhanggui.system.cashierservice.rabbit;
|
||||||
|
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
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.model.CategoryInfo;
|
import com.chaozhanggui.system.cashierservice.model.CategoryInfo;
|
||||||
import com.chaozhanggui.system.cashierservice.model.OrderDetailPO;
|
import com.chaozhanggui.system.cashierservice.model.OrderDetailPO;
|
||||||
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
|
||||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||||
import com.chaozhanggui.system.cashierservice.util.FeieyunPrintUtil;
|
import com.chaozhanggui.system.cashierservice.util.FeieyunPrintUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
||||||
@@ -16,18 +14,12 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@@ -55,10 +47,6 @@ public class PrintMechineConsumer {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TbOrderDetailMapper tbOrderDetailMapper;
|
private TbOrderDetailMapper tbOrderDetailMapper;
|
||||||
@Autowired
|
|
||||||
private RedisTemplate<Object, Object> redisTemplate2;
|
|
||||||
@Autowired
|
|
||||||
private StringRedisTemplate stringRedisTemplate;
|
|
||||||
|
|
||||||
@RabbitHandler
|
@RabbitHandler
|
||||||
public void listener(String message) {
|
public void listener(String message) {
|
||||||
@@ -86,10 +74,7 @@ public class PrintMechineConsumer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("打印机列表,{}", ArrayUtil.toString(list));
|
list.parallelStream().forEach(tbPrintMachineWithBLOBs->{
|
||||||
log.info("待打印订单信息, {}", orderInfo);
|
|
||||||
|
|
||||||
list.forEach(tbPrintMachineWithBLOBs -> {
|
|
||||||
if (!"network".equals(tbPrintMachineWithBLOBs.getConnectionType())) {
|
if (!"network".equals(tbPrintMachineWithBLOBs.getConnectionType())) {
|
||||||
log.error("非网络打印机:{},{}",tbPrintMachineWithBLOBs.getAddress(),tbPrintMachineWithBLOBs.getConnectionType());
|
log.error("非网络打印机:{},{}",tbPrintMachineWithBLOBs.getAddress(),tbPrintMachineWithBLOBs.getConnectionType());
|
||||||
return;
|
return;
|
||||||
@@ -101,11 +86,16 @@ public class PrintMechineConsumer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String model = tbPrintMachineWithBLOBs.getPrintMethod();
|
JSONObject config = JSONObject.parseObject(tbPrintMachineWithBLOBs.getConfig());
|
||||||
|
String model = config.getString("model");
|
||||||
|
|
||||||
String printerNum = StrUtil.isEmpty(tbPrintMachineWithBLOBs.getPrintQty()) ? "1" : tbPrintMachineWithBLOBs.getPrintQty().split("\\^")[1];
|
String printerNum = config.getString("printerNum");
|
||||||
|
|
||||||
List<CategoryInfo> categoryInfos = JSONUtil.parseJSONStr2TList(StrUtil.emptyToDefault(tbPrintMachineWithBLOBs.getCategoryList(), "[]"), CategoryInfo.class);
|
String feet = config.getString("feet");
|
||||||
|
|
||||||
|
String autoCut = config.getString("autoCut");
|
||||||
|
|
||||||
|
List<CategoryInfo> categoryInfos=JSONUtil.parseJSONStr2TList(config.getJSONArray("categoryList").toString(),CategoryInfo.class);
|
||||||
|
|
||||||
switch (tbPrintMachineWithBLOBs.getContentType()){
|
switch (tbPrintMachineWithBLOBs.getContentType()){
|
||||||
case "yxyPrinter":
|
case "yxyPrinter":
|
||||||
@@ -126,53 +116,23 @@ public class PrintMechineConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 仅打印制作单「厨房」
|
* 博时结云打印机
|
||||||
|
* @param tbPrintMachineWithBLOBs
|
||||||
|
* @param model
|
||||||
|
* @param orderInfo
|
||||||
|
* @param shopInfo
|
||||||
|
* @param printerNum
|
||||||
*/
|
*/
|
||||||
private void onlyKitchenForYxy(String orderId, TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, TbOrderInfo orderInfo, String printerNum, List<CategoryInfo> categoryInfos) {
|
private void yxyPrinter(TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs,String model,TbOrderInfo orderInfo,TbShopInfo shopInfo,String printerNum, List<CategoryInfo> categoryInfos){
|
||||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, "final");
|
String orderId=orderInfo.getId().toString();
|
||||||
log.info("一菜一品打印,待打印信息:{}", cashierCarts);
|
|
||||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
|
||||||
|
|
||||||
|
|
||||||
cashierCarts.parallelStream().forEach(it -> {
|
switch (tbPrintMachineWithBLOBs.getSubType()) {
|
||||||
|
case "label": //标签打印机
|
||||||
// 取餐号不为空为代客下单
|
break;
|
||||||
if ("postPay".equals(orderInfo.getUseType()) && StrUtil.isNotBlank(it.getMasterId())) {
|
case "cash": //小票打印机
|
||||||
log.info("--------------------代客下单 打印一菜一品");
|
switch (model) {
|
||||||
printTicket(Integer.valueOf(orderId), categoryInfos, tbPrintMachineWithBLOBs, orderInfo);
|
case "normal": //普通出单
|
||||||
return;
|
|
||||||
}
|
|
||||||
log.info("--------------------非代客下单 打印一菜一品");
|
|
||||||
|
|
||||||
String categoryId;
|
|
||||||
if (ObjectUtil.isEmpty(it.getCategoryId())) {
|
|
||||||
categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
|
||||||
} else {
|
|
||||||
categoryId = it.getCategoryId();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Long count = categoryInfos.stream().filter(c ->
|
|
||||||
c.getId().toString().equals(categoryId)
|
|
||||||
).count();
|
|
||||||
|
|
||||||
if (count > 0) {
|
|
||||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
|
||||||
String remark = "";
|
|
||||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
|
||||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
|
||||||
}
|
|
||||||
String data = PrinterUtils.getPrintData(orderInfo.getTableName(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber(), remark);
|
|
||||||
PrinterUtils.printTickets(1, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 仅打印结算单「前台」
|
|
||||||
*/
|
|
||||||
private void onlyFrontDeskForYxy(String orderId, TbOrderInfo orderInfo, String printerNum, TbShopInfo shopInfo, TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, List<CategoryInfo> categoryInfos) {
|
|
||||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(),"final");
|
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(),"final");
|
||||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||||
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
||||||
@@ -218,150 +178,92 @@ public class PrintMechineConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "one": //一菜一品
|
||||||
|
cashierCarts = tbCashierCartMapper.selectByOrderId(orderId,"final");
|
||||||
|
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||||
|
|
||||||
|
cashierCarts.parallelStream().forEach(it -> {
|
||||||
|
|
||||||
|
String categoryId;
|
||||||
|
if(ObjectUtil.isEmpty(it.getCategoryId())){
|
||||||
|
categoryId= tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||||
|
} else {
|
||||||
|
categoryId = it.getCategoryId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 博时结云打印机
|
Long count= categoryInfos.stream().filter(c->
|
||||||
*
|
c.getId().toString().equals(categoryId)
|
||||||
* @param tbPrintMachineWithBLOBs
|
).count();
|
||||||
* @param model
|
|
||||||
* @param orderInfo
|
if(count>0){
|
||||||
* @param shopInfo
|
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||||
* @param printerNum
|
String remark = "";
|
||||||
*/
|
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||||
private void yxyPrinter(TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, String model, TbOrderInfo orderInfo, TbShopInfo shopInfo, String printerNum, List<CategoryInfo> categoryInfos) {
|
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||||
String orderId = orderInfo.getId().toString();
|
|
||||||
switch (tbPrintMachineWithBLOBs.getSubType()) {
|
|
||||||
case "label": //标签打印机
|
|
||||||
break;
|
|
||||||
case "cash": //小票打印机
|
|
||||||
if ("normal".equals(model)) {
|
|
||||||
onlyFrontDeskForYxy(orderId, orderInfo, printerNum, shopInfo, tbPrintMachineWithBLOBs, categoryInfos);
|
|
||||||
} else if ("one".equals(model)) {
|
|
||||||
onlyKitchenForYxy(orderId, tbPrintMachineWithBLOBs, orderInfo, printerNum, categoryInfos);
|
|
||||||
} else if ("all".equals(model)) {
|
|
||||||
onlyFrontDeskForYxy(orderId, orderInfo, printerNum, shopInfo, tbPrintMachineWithBLOBs, categoryInfos);
|
|
||||||
onlyKitchenForYxy(orderId, tbPrintMachineWithBLOBs, orderInfo, printerNum, categoryInfos);
|
|
||||||
}
|
}
|
||||||
|
String data = PrinterUtils.getPrintData(orderInfo.getTableName(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber(), remark);
|
||||||
|
PrinterUtils.printTickets(1, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "category": //分类出单
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "kitchen": //出品打印机
|
case "kitchen": //出品打印机
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void printTicket(Integer orderId, List<CategoryInfo> categoryInfos, TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, TbOrderInfo orderInfo) {
|
|
||||||
String printKey = RedisCst.ORDER_PRINT_PRO + orderId;
|
|
||||||
AtomicReference<Set<Object>> printProductSet = new AtomicReference<>(redisTemplate2.opsForSet().members(printKey));
|
|
||||||
List<TbOrderDetail> tbOrderDetails = tbOrderDetailMapper.selectAllByOrderId(orderId);
|
|
||||||
log.info("--------------------订单detail列表: {}", tbOrderDetails);
|
|
||||||
log.info("--------------------缓存打印printProductSet: {}", printProductSet);
|
|
||||||
if (!tbOrderDetails.isEmpty()) {
|
|
||||||
|
|
||||||
// 重置打印数据
|
|
||||||
redisTemplate2.delete(printKey);
|
|
||||||
tbOrderDetails.forEach(it -> {
|
|
||||||
log.info("开始打印一菜一品票据,:{}", it.getProductName());
|
|
||||||
String categoryId = tbProductMapper.selectByPrimaryKey(it.getProductId()).getCategoryId();
|
|
||||||
|
|
||||||
long count = categoryInfos.stream().filter(c ->
|
|
||||||
|
private void fePrinter(TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs,String model,TbOrderInfo orderInfo,TbShopInfo shopInfo,String printerNum, List<CategoryInfo> categoryInfos){
|
||||||
|
String orderId=orderInfo.getId().toString();
|
||||||
|
switch (tbPrintMachineWithBLOBs.getSubType()) {
|
||||||
|
case "label": //标签打印机
|
||||||
|
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(),"final");
|
||||||
|
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||||
|
cashierCarts.parallelStream().forEach(it->{
|
||||||
|
|
||||||
|
String categoryId;
|
||||||
|
if(ObjectUtil.isEmpty(it.getCategoryId())){
|
||||||
|
categoryId= tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||||
|
} else {
|
||||||
|
categoryId = it.getCategoryId();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Long count= categoryInfos.stream().filter(c->
|
||||||
c.getId().toString().equals(categoryId)
|
c.getId().toString().equals(categoryId)
|
||||||
).count();
|
).count();
|
||||||
|
|
||||||
log.info("获取当前类别是否未打印类别:{}", count);
|
|
||||||
if(count>0) {
|
if(count>0) {
|
||||||
|
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||||
// 统计已打数量
|
|
||||||
int printerNum = 0;
|
|
||||||
boolean isReturn = false;
|
|
||||||
String key = RedisCst.ORDER_PRINT + orderId + ":" + it.getProductId() + ":" + it.getProductSkuId();
|
|
||||||
String info = stringRedisTemplate.opsForValue().get(key);
|
|
||||||
stringRedisTemplate.opsForValue().set(key, String.valueOf(it.getNum()), 60 * 60 * 24, TimeUnit.SECONDS);
|
|
||||||
|
|
||||||
log.info("--------------------已打印数量: {}", info);
|
|
||||||
|
|
||||||
// 删除已打印数据
|
|
||||||
if (printProductSet.get() != null) {
|
|
||||||
printProductSet.set(printProductSet.get().stream().filter(r -> {
|
|
||||||
TbOrderDetail detail = (TbOrderDetail) r;
|
|
||||||
return !detail.getProductSkuId().equals(it.getProductSkuId()) || !detail.getProductId().equals(it.getProductId());
|
|
||||||
}).collect(Collectors.toSet()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (info != null) {
|
|
||||||
isReturn = it.getNum() - Integer.parseInt(info) < 0;
|
|
||||||
printerNum = it.getNum() - Integer.parseInt(info);
|
|
||||||
} else {
|
|
||||||
printerNum = it.getNum();
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info("--------------------isReturn: {}, 数量: {}", isReturn, printerNum);
|
|
||||||
|
|
||||||
|
|
||||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(it.getProductSkuId());
|
|
||||||
String remark = "";
|
String remark = "";
|
||||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将已打印信息加入redis
|
for(int i=0;i<it.getNumber();i++){
|
||||||
it.setRemark(remark);
|
FeieyunPrintUtil.printLabelMsg(tbPrintMachineWithBLOBs.getAddress(), orderInfo.getTableName(), it.getName(), 1, DateUtils.getTimes(new Date(orderInfo.getCreatedAt())), it.getSalePrice().toPlainString(), remark);
|
||||||
redisTemplate2.opsForSet().add(printKey, it);
|
|
||||||
redisTemplate2.expire(printKey, 24, TimeUnit.HOURS);
|
|
||||||
|
|
||||||
// 已打印不再打印
|
|
||||||
if (info != null && printerNum == 0) {
|
|
||||||
log.info("--------------------------订单已打印,跳过打印");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String data;
|
|
||||||
String voiceJson;
|
|
||||||
if (isReturn) {
|
|
||||||
|
|
||||||
data = PrinterUtils.getPrintData("return",
|
|
||||||
StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getMasterId() : orderInfo.getTableName(),
|
|
||||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), Math.abs(printerNum), remark);
|
|
||||||
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
|
|
||||||
|
|
||||||
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
data = PrinterUtils.getPrintData("", orderInfo.getMasterId(),
|
|
||||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(),
|
|
||||||
printerNum, remark);
|
|
||||||
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
|
||||||
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 已删除的商品打印退款信息
|
break;
|
||||||
if (printProductSet.get() != null) {
|
case "cash": //小票打印机
|
||||||
printProductSet.get().forEach(item -> {
|
switch (model) {
|
||||||
log.info("已删除订单,打印退款票据, {}", item);
|
case "normal": //普通出单
|
||||||
TbOrderDetail orderDetail = (TbOrderDetail) item;
|
|
||||||
String data = PrinterUtils.getPrintData("return",
|
|
||||||
StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getMasterId() : orderInfo.getTableName(),
|
|
||||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum(), orderDetail.getRemark());
|
|
||||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
|
|
||||||
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
|
|
||||||
|
|
||||||
String key = RedisCst.ORDER_PRINT + orderId + ":" + orderDetail.getProductId() + ":" + orderDetail.getProductSkuId();
|
|
||||||
log.info("删除商品数量记录key, {}", key);
|
|
||||||
stringRedisTemplate.delete(key);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 仅打印结算单「前台」
|
|
||||||
*/
|
|
||||||
private void onlyFrontDeskForFe(String orderId, TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, String model, TbOrderInfo orderInfo, TbShopInfo shopInfo, String printerNum, List<CategoryInfo> categoryInfos) {
|
|
||||||
if ("return".equals(orderInfo.getOrderType())) {
|
if ("return".equals(orderInfo.getOrderType())) {
|
||||||
List<TbOrderDetail> tbOrderDetails = tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));
|
List<TbOrderDetail> tbOrderDetails = tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));
|
||||||
if (ObjectUtil.isNotEmpty(tbOrderDetails) && tbOrderDetails.size() > 0) {
|
if (ObjectUtil.isNotEmpty(tbOrderDetails) && tbOrderDetails.size() > 0) {
|
||||||
@@ -407,7 +309,7 @@ public class PrintMechineConsumer {
|
|||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(), "final");
|
cashierCarts = cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(), "final");
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||||
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
||||||
@@ -458,13 +360,11 @@ public class PrintMechineConsumer {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
break;
|
||||||
* 仅打印制作单「厨房」
|
case "one": //一菜一品
|
||||||
*/
|
|
||||||
private void onlyKitchenForFe(String orderId, TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, String model, TbOrderInfo orderInfo, TbShopInfo shopInfo, String printerNum, List<CategoryInfo> categoryInfos) {
|
cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, "final");
|
||||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, "final");
|
|
||||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||||
|
|
||||||
cashierCarts.parallelStream().forEach(it -> {
|
cashierCarts.parallelStream().forEach(it -> {
|
||||||
@@ -492,54 +392,6 @@ public class PrintMechineConsumer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void fePrinter(TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, String model, TbOrderInfo orderInfo, TbShopInfo shopInfo, String printerNum, List<CategoryInfo> categoryInfos) {
|
|
||||||
String orderId = orderInfo.getId().toString();
|
|
||||||
switch (tbPrintMachineWithBLOBs.getSubType()) {
|
|
||||||
case "label": //标签打印机
|
|
||||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(), "final");
|
|
||||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
|
||||||
cashierCarts.parallelStream().forEach(it -> {
|
|
||||||
|
|
||||||
String categoryId;
|
|
||||||
if (ObjectUtil.isEmpty(it.getCategoryId())) {
|
|
||||||
categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
|
||||||
} else {
|
|
||||||
categoryId = it.getCategoryId();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Long count = categoryInfos.stream().filter(c ->
|
|
||||||
c.getId().toString().equals(categoryId)
|
|
||||||
).count();
|
|
||||||
|
|
||||||
|
|
||||||
if (count > 0) {
|
|
||||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
|
||||||
String remark = "";
|
|
||||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
|
||||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < it.getNumber(); i++) {
|
|
||||||
FeieyunPrintUtil.printLabelMsg(tbPrintMachineWithBLOBs.getAddress(), orderInfo.getTableName(), it.getName(), 1, DateUtils.getTimes(new Date(orderInfo.getCreatedAt())), it.getSalePrice().toPlainString(), remark);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "cash": //小票打印机
|
|
||||||
if ("normal".equals(model)) {
|
|
||||||
onlyFrontDeskForFe(orderId, tbPrintMachineWithBLOBs, model, orderInfo, shopInfo, printerNum, categoryInfos);
|
|
||||||
} else if ("one".equals(model)) {
|
|
||||||
onlyKitchenForFe(orderId, tbPrintMachineWithBLOBs, model, orderInfo, shopInfo, printerNum, categoryInfos);
|
|
||||||
} else if ("all".equals(model)) {
|
|
||||||
onlyFrontDeskForFe(orderId, tbPrintMachineWithBLOBs, model, orderInfo, shopInfo, printerNum, categoryInfos);
|
|
||||||
onlyKitchenForFe(orderId, tbPrintMachineWithBLOBs, model, orderInfo, shopInfo, printerNum, categoryInfos);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "kitchen": //出品打印机
|
case "kitchen": //出品打印机
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -62,23 +62,4 @@ public interface RabbitConstants {
|
|||||||
// 库存记录交换机
|
// 库存记录交换机
|
||||||
String EXCHANGE_STOCK_RECORD = "exchange.stock.record";
|
String EXCHANGE_STOCK_RECORD = "exchange.stock.record";
|
||||||
String ROUTING_STOCK_RECORD_SALE = "routing.stock.record.sale";
|
String ROUTING_STOCK_RECORD_SALE = "routing.stock.record.sale";
|
||||||
|
|
||||||
|
|
||||||
public static final String BALANCE_PUT="balance_put";
|
|
||||||
public static final String BALANCE_QUEUE_PUT="balance_queue_put";
|
|
||||||
|
|
||||||
public static final String BALANCE_ROUTINGKEY_PUT="balance_routingkey_put";
|
|
||||||
|
|
||||||
|
|
||||||
// 菜品打印
|
|
||||||
String EXCHANGE_PRINT = "exchange.print";
|
|
||||||
String ROUTING_KEY_PRINT_DISHES = "routing.dishes.print";
|
|
||||||
|
|
||||||
// 订单打印
|
|
||||||
String QUEUE_PRINT_PLACE = "queue.place.order.print";
|
|
||||||
String ROUTING_KEY_PRINT_PLACE = "routing.place.order.print";
|
|
||||||
|
|
||||||
// 排队小票打印
|
|
||||||
String QUEUE_PRINT_CALL_TABLE = "queue.print.call.table";
|
|
||||||
String ROUTING_KEY_CALL_TABLE = "routing.call.table";
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,15 +58,6 @@ public class RabbitProducer implements RabbitTemplate.ConfirmCallback {
|
|||||||
rabbitTemplate.convertAndSend(RabbitConstants.CONS_MSG_COLLECT_PUT, RabbitConstants.CONS_MSG_COLLECT_ROUTINGKEY_PUT, content, correlationId);
|
rabbitTemplate.convertAndSend(RabbitConstants.CONS_MSG_COLLECT_PUT, RabbitConstants.CONS_MSG_COLLECT_ROUTINGKEY_PUT, content, correlationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void balance(String content){
|
|
||||||
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
|
|
||||||
rabbitTemplate.convertAndSend(RabbitConstants.BALANCE_PUT, RabbitConstants.BALANCE_ROUTINGKEY_PUT, content, correlationId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
|
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
|
||||||
logger.info(" 回调id:" + correlationData);
|
logger.info(" 回调id:" + correlationData);
|
||||||
|
|||||||
@@ -96,11 +96,4 @@ public class RedisConfig {
|
|||||||
template.setValueSerializer(new StringRedisSerializer(Charset.forName("UTF-8")));
|
template.setValueSerializer(new StringRedisSerializer(Charset.forName("UTF-8")));
|
||||||
return template;
|
return template;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
public RedisTemplate<Object, Object> redisTemplate2(RedisConnectionFactory factory) {
|
|
||||||
RedisTemplate<Object, Object> template = new RedisTemplate<>();
|
|
||||||
template.setConnectionFactory(factory);
|
|
||||||
return template;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.redis;
|
package com.chaozhanggui.system.cashierservice.redis;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
/** 功能描述:redis前缀
|
||||||
|
|
||||||
/**
|
|
||||||
* 功能描述:redis前缀
|
|
||||||
*
|
|
||||||
* @params:
|
* @params:
|
||||||
* @return:
|
* @return:
|
||||||
* @Author: wgc
|
* @Author: wgc
|
||||||
@@ -17,7 +13,7 @@ public class RedisCst {
|
|||||||
public static final String PHONE_LIMIT = "PHONE_LIMIT:";
|
public static final String PHONE_LIMIT = "PHONE_LIMIT:";
|
||||||
public static final String ONLINE_APP_USER = "ONLINE_APP_USER:";
|
public static final String ONLINE_APP_USER = "ONLINE_APP_USER:";
|
||||||
public static final String LDBL_APP_VERSION = "LDBL_APP_VERSION:";
|
public static final String LDBL_APP_VERSION = "LDBL_APP_VERSION:";
|
||||||
// public static final String TABLE_CART = "TABLE:CART:";
|
public static final String TABLE_CART = "TABLE:CART:";
|
||||||
public static final String ORDER_EXPIRED = "ORDER:EXPIRED:";
|
public static final String ORDER_EXPIRED = "ORDER:EXPIRED:";
|
||||||
public static final String TABLE_ORDER = "TABLE:ORDER:";
|
public static final String TABLE_ORDER = "TABLE:ORDER:";
|
||||||
public static final String PRODUCT = "PRODUCT:";
|
public static final String PRODUCT = "PRODUCT:";
|
||||||
@@ -30,60 +26,4 @@ public class RedisCst {
|
|||||||
public static final String CREATE_ORDER_LOCK = "CREATE_ORDER_LOCK:";
|
public static final String CREATE_ORDER_LOCK = "CREATE_ORDER_LOCK:";
|
||||||
public static final String SEND_STOCK_WARN_MSG = "SEND_STOCK_WARN_MSG:";
|
public static final String SEND_STOCK_WARN_MSG = "SEND_STOCK_WARN_MSG:";
|
||||||
public static final String SONG_PAY_LOCK = "song_pay_lock:";
|
public static final String SONG_PAY_LOCK = "song_pay_lock:";
|
||||||
public static final String ORDER_PRINT_PRO = "ORDER_PRINT_PRODUCT:";
|
|
||||||
public static final String ORDER_PRINT = "ORDER_PRINT:";
|
|
||||||
// 选择人数锁
|
|
||||||
public static final String CHOSE_TABLE_COUNT = "CHOSE_TABLE_COUNT";
|
|
||||||
|
|
||||||
static final String CURRENT_TABLE_ORDER = "CURRENT_TABLE_ORDER:";
|
|
||||||
|
|
||||||
// 排队取号全局号码
|
|
||||||
public static final String TABLE_CALL_NUMBER = "TABLE_CALL_NUMBER:";
|
|
||||||
|
|
||||||
// 全局锁
|
|
||||||
public static final String LOCK_KEY = "LOCK:";
|
|
||||||
|
|
||||||
// 外带购物车缓存
|
|
||||||
public static final String TAKEOUT_TABLE_CART = "TAKEOUT_TABLE_CART:";
|
|
||||||
// 店内就餐购物车缓存
|
|
||||||
public static final String DINE_IN_TABLE_CART = "DINE_IN_TABLE_CART:";
|
|
||||||
// 当前台桌人数
|
|
||||||
public static final String CURRENT_TABLE_SEAR_COUNT = "CURRENT_TABLE_SEAR_COUNT:";
|
|
||||||
|
|
||||||
|
|
||||||
public static String getCurrentOrderKey(String tableId, String shopId) {
|
|
||||||
return CURRENT_TABLE_ORDER + shopId + ":" + tableId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getTableCallNumKey(Integer shopId, Integer callTableId) {
|
|
||||||
return TABLE_CALL_NUMBER + shopId + ":" + callTableId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getLockKey(String sign, Object... args) {
|
|
||||||
StringBuilder key = new StringBuilder(LOCK_KEY + ":" + sign + ":");
|
|
||||||
for (Object arg : args) {
|
|
||||||
key.append(":").append(arg.toString());
|
|
||||||
}
|
|
||||||
return key.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getTakeoutTableCartKey(String shopId, Object userId) {
|
|
||||||
return TAKEOUT_TABLE_CART + shopId + ":" + userId;
|
|
||||||
// return DINE_IN_TABLE_CART + shopId + ":" + userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getDineInTableCartKey(String shopId, String tableId) {
|
|
||||||
return DINE_IN_TABLE_CART + shopId + ":" + tableId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getTableCartKey(String shopId, String tableId, Object userId) {
|
|
||||||
if (StrUtil.isBlank(tableId)) {
|
|
||||||
return getTakeoutTableCartKey(shopId, userId);
|
|
||||||
}
|
|
||||||
return getDineInTableCartKey(shopId, tableId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getCurrentTableSeatCount(Object shopId, String tableId) {
|
|
||||||
return CURRENT_TABLE_SEAR_COUNT + (shopId + ":" + tableId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@ package com.chaozhanggui.system.cashierservice.service;
|
|||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
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.model.CategoryInfo;
|
import com.chaozhanggui.system.cashierservice.model.CategoryInfo;
|
||||||
@@ -46,6 +46,8 @@ public class CloudPrinterService {
|
|||||||
private TbOrderDetailMapper tbOrderDetailMapper;
|
private TbOrderDetailMapper tbOrderDetailMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Result printReceipt(String type,String orderId,Boolean ispre){
|
public Result printReceipt(String type,String orderId,Boolean ispre){
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -80,12 +82,16 @@ public class CloudPrinterService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSONObject config = JSONObject.parseObject(tbPrintMachineWithBLOBs.getConfig());
|
||||||
|
String model = config.getString("model");
|
||||||
|
|
||||||
String model = tbPrintMachineWithBLOBs.getPrintMethod();
|
String printerNum = config.getString("printerNum");
|
||||||
|
|
||||||
String printerNum = StrUtil.isEmpty(tbPrintMachineWithBLOBs.getPrintQty()) ? "1" : tbPrintMachineWithBLOBs.getPrintQty().split("\\^")[1];
|
String feet = config.getString("feet");
|
||||||
|
|
||||||
List<CategoryInfo> categoryInfos = JSONUtil.parseJSONStr2TList(StrUtil.emptyToDefault(tbPrintMachineWithBLOBs.getCategoryList(), "[]"), CategoryInfo.class);
|
String autoCut = config.getString("autoCut");
|
||||||
|
|
||||||
|
List<CategoryInfo> categoryInfos=JSONUtil.parseJSONStr2TList(config.getJSONArray("categoryList").toString(),CategoryInfo.class);
|
||||||
|
|
||||||
switch (tbPrintMachineWithBLOBs.getContentType()){
|
switch (tbPrintMachineWithBLOBs.getContentType()){
|
||||||
case "yxyPrinter":
|
case "yxyPrinter":
|
||||||
@@ -106,10 +112,27 @@ public class CloudPrinterService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 仅打印结算单「前台」
|
* 博时结云打印机
|
||||||
|
* @param tbPrintMachineWithBLOBs
|
||||||
|
* @param model
|
||||||
|
* @param orderInfo
|
||||||
|
* @param shopInfo
|
||||||
|
* @param printerNum
|
||||||
*/
|
*/
|
||||||
private void onlyFrontDeskForYxy(String orderId, TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, String model, TbOrderInfo orderInfo, TbShopInfo shopInfo, String printerNum, List<CategoryInfo> categoryInfos) {
|
private void yxyPrinter(TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs,String model,TbOrderInfo orderInfo,TbShopInfo shopInfo,String printerNum, List<CategoryInfo> categoryInfos){
|
||||||
|
String orderId=orderInfo.getId().toString();
|
||||||
|
|
||||||
|
|
||||||
|
switch (tbPrintMachineWithBLOBs.getSubType()) {
|
||||||
|
case "label": //标签打印机
|
||||||
|
break;
|
||||||
|
case "cash": //小票打印机
|
||||||
|
switch (model) {
|
||||||
|
case "normal": //普通出单
|
||||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(),"final");
|
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(),"final");
|
||||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||||
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
||||||
@@ -154,13 +177,10 @@ public class CloudPrinterService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
break;
|
||||||
* 仅打印制作单「厨房」
|
case "one": //一菜一品
|
||||||
*/
|
cashierCarts = tbCashierCartMapper.selectByOrderId(orderId,"final");
|
||||||
private void onlyKitchenForYxy(String orderId, TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, String model, TbOrderInfo orderInfo, TbShopInfo shopInfo, String printerNum, List<CategoryInfo> categoryInfos) {
|
|
||||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, "final");
|
|
||||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||||
|
|
||||||
cashierCarts.parallelStream().forEach(it -> {
|
cashierCarts.parallelStream().forEach(it -> {
|
||||||
@@ -188,42 +208,61 @@ public class CloudPrinterService {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 博时结云打印机
|
|
||||||
*
|
|
||||||
* @param tbPrintMachineWithBLOBs
|
|
||||||
* @param model
|
|
||||||
* @param orderInfo
|
|
||||||
* @param shopInfo
|
|
||||||
* @param printerNum
|
|
||||||
*/
|
|
||||||
private void yxyPrinter(TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, String model, TbOrderInfo orderInfo, TbShopInfo shopInfo, String printerNum, List<CategoryInfo> categoryInfos) {
|
|
||||||
String orderId = orderInfo.getId().toString();
|
|
||||||
switch (tbPrintMachineWithBLOBs.getSubType()) {
|
|
||||||
case "label": //标签打印机
|
|
||||||
break;
|
break;
|
||||||
case "cash": //小票打印机
|
case "category": //分类出单
|
||||||
if ("normal".equals(model)) {
|
break;
|
||||||
onlyFrontDeskForYxy(orderId, tbPrintMachineWithBLOBs, model, orderInfo, shopInfo, printerNum, categoryInfos);
|
|
||||||
} else if ("one".equals(model)) {
|
|
||||||
onlyKitchenForYxy(orderId, tbPrintMachineWithBLOBs, model, orderInfo, shopInfo, printerNum, categoryInfos);
|
|
||||||
} else if ("all".equals(model)) {
|
|
||||||
onlyFrontDeskForYxy(orderId, tbPrintMachineWithBLOBs, model, orderInfo, shopInfo, printerNum, categoryInfos);
|
|
||||||
onlyKitchenForYxy(orderId, tbPrintMachineWithBLOBs, model, orderInfo, shopInfo, printerNum, categoryInfos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "kitchen": //出品打印机
|
case "kitchen": //出品打印机
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 仅打印结算单「前台」
|
|
||||||
*/
|
|
||||||
private void onlyFrontDeskForFe(String orderId, TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, String model, TbOrderInfo orderInfo, TbShopInfo shopInfo, String printerNum, List<CategoryInfo> categoryInfos) {
|
private void fePrinter(TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs,String model,TbOrderInfo orderInfo,TbShopInfo shopInfo,String printerNum, List<CategoryInfo> categoryInfos){
|
||||||
|
String orderId=orderInfo.getId().toString();
|
||||||
|
switch (tbPrintMachineWithBLOBs.getSubType()) {
|
||||||
|
case "label": //标签打印机
|
||||||
|
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(),"final");
|
||||||
|
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||||
|
cashierCarts.parallelStream().forEach(it->{
|
||||||
|
|
||||||
|
String categoryId;
|
||||||
|
if(ObjectUtil.isEmpty(it.getCategoryId())){
|
||||||
|
categoryId= tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||||
|
} else {
|
||||||
|
categoryId = it.getCategoryId();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Long count= categoryInfos.stream().filter(c->
|
||||||
|
c.getId().toString().equals(categoryId)
|
||||||
|
).count();
|
||||||
|
|
||||||
|
|
||||||
|
if(count>0) {
|
||||||
|
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||||
|
String remark = "";
|
||||||
|
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||||
|
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i=0;i<it.getNumber();i++){
|
||||||
|
FeieyunPrintUtil.printLabelMsg(tbPrintMachineWithBLOBs.getAddress(), orderInfo.getTableName(), it.getName(), 1, DateUtils.getTimes(new Date(orderInfo.getCreatedAt())), it.getSalePrice().toPlainString(), remark);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "cash": //小票打印机
|
||||||
|
switch (model) {
|
||||||
|
case "normal": //普通出单
|
||||||
|
|
||||||
if ("return".equals(orderInfo.getOrderType())) {
|
if ("return".equals(orderInfo.getOrderType())) {
|
||||||
List<TbOrderDetail> tbOrderDetails = tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));
|
List<TbOrderDetail> tbOrderDetails = tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));
|
||||||
if (ObjectUtil.isNotEmpty(tbOrderDetails) && tbOrderDetails.size() > 0) {
|
if (ObjectUtil.isNotEmpty(tbOrderDetails) && tbOrderDetails.size() > 0) {
|
||||||
@@ -269,7 +308,7 @@ public class CloudPrinterService {
|
|||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(), "final");
|
cashierCarts = cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(), "final");
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||||
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
||||||
@@ -320,13 +359,11 @@ public class CloudPrinterService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
break;
|
||||||
* 仅打印制作单「厨房」
|
case "one": //一菜一品
|
||||||
*/
|
|
||||||
private void onlyKitchenForFe(String orderId, TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, String model, TbOrderInfo orderInfo, TbShopInfo shopInfo, String printerNum, List<CategoryInfo> categoryInfos) {
|
cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, "final");
|
||||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, "final");
|
|
||||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||||
|
|
||||||
cashierCarts.parallelStream().forEach(it -> {
|
cashierCarts.parallelStream().forEach(it -> {
|
||||||
@@ -354,54 +391,6 @@ public class CloudPrinterService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void fePrinter(TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, String model, TbOrderInfo orderInfo, TbShopInfo shopInfo, String printerNum, List<CategoryInfo> categoryInfos) {
|
|
||||||
String orderId = orderInfo.getId().toString();
|
|
||||||
switch (tbPrintMachineWithBLOBs.getSubType()) {
|
|
||||||
case "label": //标签打印机
|
|
||||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(), "final");
|
|
||||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
|
||||||
cashierCarts.parallelStream().forEach(it -> {
|
|
||||||
|
|
||||||
String categoryId;
|
|
||||||
if (ObjectUtil.isEmpty(it.getCategoryId())) {
|
|
||||||
categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
|
||||||
} else {
|
|
||||||
categoryId = it.getCategoryId();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Long count = categoryInfos.stream().filter(c ->
|
|
||||||
c.getId().toString().equals(categoryId)
|
|
||||||
).count();
|
|
||||||
|
|
||||||
|
|
||||||
if (count > 0) {
|
|
||||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
|
||||||
String remark = "";
|
|
||||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
|
||||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < it.getNumber(); i++) {
|
|
||||||
FeieyunPrintUtil.printLabelMsg(tbPrintMachineWithBLOBs.getAddress(), orderInfo.getTableName(), it.getName(), 1, DateUtils.getTimes(new Date(orderInfo.getCreatedAt())), it.getSalePrice().toPlainString(), remark);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "cash": //小票打印机
|
|
||||||
if ("normal".equals(model)) {
|
|
||||||
onlyFrontDeskForFe(orderId, tbPrintMachineWithBLOBs, model, orderInfo, shopInfo, printerNum, categoryInfos);
|
|
||||||
} else if ("one".equals(model)) {
|
|
||||||
onlyKitchenForFe(orderId, tbPrintMachineWithBLOBs, model, orderInfo, shopInfo, printerNum, categoryInfos);
|
|
||||||
} else if ("all".equals(model)) {
|
|
||||||
onlyFrontDeskForFe(orderId, tbPrintMachineWithBLOBs, model, orderInfo, shopInfo, printerNum, categoryInfos);
|
|
||||||
onlyKitchenForFe(orderId, tbPrintMachineWithBLOBs, model, orderInfo, shopInfo, printerNum, categoryInfos);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "kitchen": //出品打印机
|
case "kitchen": //出品打印机
|
||||||
break;
|
break;
|
||||||
@@ -409,4 +398,6 @@ public class CloudPrinterService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.service;
|
package com.chaozhanggui.system.cashierservice.service;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbShopOpenId;
|
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbShopUser;
|
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg;
|
|
||||||
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.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
@@ -24,7 +24,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.Timestamp;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -38,9 +37,6 @@ public class LoginService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TbShopUserMapper tbShopUserMapper;
|
private TbShopUserMapper tbShopUserMapper;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TbActivateInRecordMapper inRecordMapper;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TbShopTableMapper tbShopTableMapper;
|
private TbShopTableMapper tbShopTableMapper;
|
||||||
|
|
||||||
@@ -145,7 +141,9 @@ public class LoginService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildNewUserInfo(TbUserInfo userInfo) {
|
public Result wxCustomLogin(String openId, String headImage, String nickName, String telephone, String ip) {
|
||||||
|
TbUserInfo userInfo = tbUserInfoMapper.selectByOpenId(openId);
|
||||||
|
if (ObjectUtil.isNull(userInfo)) {
|
||||||
userInfo = new TbUserInfo();
|
userInfo = new TbUserInfo();
|
||||||
userInfo.setAmount(BigDecimal.ZERO);
|
userInfo.setAmount(BigDecimal.ZERO);
|
||||||
userInfo.setChargeAmount(BigDecimal.ZERO);
|
userInfo.setChargeAmount(BigDecimal.ZERO);
|
||||||
@@ -154,63 +152,23 @@ public class LoginService {
|
|||||||
userInfo.setConsumeAmount(BigDecimal.ZERO);
|
userInfo.setConsumeAmount(BigDecimal.ZERO);
|
||||||
userInfo.setTotalScore(0);
|
userInfo.setTotalScore(0);
|
||||||
userInfo.setLockScore(0);
|
userInfo.setLockScore(0);
|
||||||
userInfo.setHeadImg("");
|
userInfo.setHeadImg(ObjectUtil.isNotNull(headImage) ? headImage : "");
|
||||||
userInfo.setNickName("");
|
userInfo.setNickName(ObjectUtil.isNotNull(nickName) ? nickName : "微信用户");
|
||||||
userInfo.setTelephone("");
|
userInfo.setTelephone(ObjectUtil.isNotNull(telephone) ? telephone : "");
|
||||||
|
userInfo.setMiniAppOpenId(openId);
|
||||||
userInfo.setStatus(Byte.parseByte("1"));
|
userInfo.setStatus(Byte.parseByte("1"));
|
||||||
userInfo.setParentType("PERSON");
|
userInfo.setParentType("PERSON");
|
||||||
userInfo.setIsResource(Byte.parseByte("0"));
|
userInfo.setIsResource(Byte.parseByte("0"));
|
||||||
userInfo.setIsOnline(Byte.parseByte("0"));
|
userInfo.setIsOnline(Byte.parseByte("0"));
|
||||||
userInfo.setIsVip(Byte.parseByte("0"));
|
userInfo.setIsVip(Byte.parseByte("0"));
|
||||||
|
userInfo.setSourcePath("WECHAT-APP");
|
||||||
userInfo.setIsAttentionMp(Byte.parseByte("0"));
|
userInfo.setIsAttentionMp(Byte.parseByte("0"));
|
||||||
|
userInfo.setSearchWord("||微信用户");
|
||||||
userInfo.setIsPwd("0");
|
userInfo.setIsPwd("0");
|
||||||
userInfo.setPwd(MD5Utils.md5("123456"));
|
userInfo.setPwd(MD5Utils.md5("123456"));
|
||||||
userInfo.setCreatedAt(System.currentTimeMillis());
|
userInfo.setCreatedAt(System.currentTimeMillis());
|
||||||
userInfo.setLastLogInAt(System.currentTimeMillis());
|
userInfo.setLastLogInAt(System.currentTimeMillis());
|
||||||
userInfo.setUpdatedAt(System.currentTimeMillis());
|
userInfo.setUpdatedAt(System.currentTimeMillis());
|
||||||
}
|
|
||||||
|
|
||||||
public Result wxCustomLogin(String openId, String headImage, String nickName, String telephone, String ip) {
|
|
||||||
TbUserInfo userInfo = tbUserInfoMapper.selectByOpenId(openId);
|
|
||||||
if (ObjectUtil.isNull(userInfo)) {
|
|
||||||
userInfo = new TbUserInfo();
|
|
||||||
buildNewUserInfo(userInfo);
|
|
||||||
userInfo.setHeadImg(ObjectUtil.isNotNull(headImage) ? headImage : "");
|
|
||||||
userInfo.setNickName(ObjectUtil.isNotNull(nickName) ? nickName : "微信用户");
|
|
||||||
userInfo.setTelephone(ObjectUtil.isNotNull(telephone) ? telephone : "");
|
|
||||||
userInfo.setSourcePath("WECHAT-APP");
|
|
||||||
userInfo.setSearchWord("||微信用户");
|
|
||||||
userInfo.setMiniAppOpenId(openId);
|
|
||||||
tbUserInfoMapper.insert(userInfo);
|
|
||||||
} else {
|
|
||||||
userInfo.setUpdatedAt(System.currentTimeMillis());
|
|
||||||
userInfo.setLastLogInAt(System.currentTimeMillis());
|
|
||||||
tbUserInfoMapper.updateByPrimaryKeySelective(userInfo);
|
|
||||||
}
|
|
||||||
//生成token 信息
|
|
||||||
String token = TokenUtil.generateToken(userInfo.getId(), userInfo.getMiniAppOpenId(), userInfo.getTelephone(), userInfo.getNickName());
|
|
||||||
Map<String, Object> map = new HashMap<>();
|
|
||||||
map.put("token", token);
|
|
||||||
map.put("userInfo", userInfo);
|
|
||||||
redisUtil.saveMessage(RedisCst.ONLINE_USER.concat(openId), JSON.toJSONString(map), 60 * 60 * 24 * 30L);
|
|
||||||
log.info("登录传参 结果:" + JSONUtil.toJSONString(map));
|
|
||||||
return Result.success(CodeEnum.SUCCESS, map);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 支付宝用户登录
|
|
||||||
* @param openId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Result alipayCustomLogin(String openId) {
|
|
||||||
TbUserInfo userInfo = tbUserInfoMapper.selectByOpenId(openId);
|
|
||||||
if (ObjectUtil.isNull(userInfo)) {
|
|
||||||
userInfo = new TbUserInfo();
|
|
||||||
buildNewUserInfo(userInfo);
|
|
||||||
userInfo.setNickName("支付宝用户");
|
|
||||||
userInfo.setSourcePath("ALIPAY-APP");
|
|
||||||
userInfo.setSearchWord("||支付宝用户");
|
|
||||||
userInfo.setMiniAppOpenId(openId);
|
|
||||||
tbUserInfoMapper.insert(userInfo);
|
tbUserInfoMapper.insert(userInfo);
|
||||||
} else {
|
} else {
|
||||||
userInfo.setUpdatedAt(System.currentTimeMillis());
|
userInfo.setUpdatedAt(System.currentTimeMillis());
|
||||||
@@ -502,9 +460,6 @@ public class LoginService {
|
|||||||
if (tbUserInfo == null) {
|
if (tbUserInfo == null) {
|
||||||
return Result.success(CodeEnum.ENCRYPT, new ArrayList());
|
return Result.success(CodeEnum.ENCRYPT, new ArrayList());
|
||||||
}
|
}
|
||||||
tbUserInfo.setBalanceAll(tbShopUserMapper.countAmount(userId));
|
|
||||||
tbUserInfo.setCouponAll(inRecordMapper.countCouponNum(userId));
|
|
||||||
|
|
||||||
return Result.success(CodeEnum.ENCRYPT, tbUserInfo);
|
return Result.success(CodeEnum.ENCRYPT, tbUserInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,7 +477,6 @@ public class LoginService {
|
|||||||
TbShopUser tbShopUserSM = tbShopUserMapper.selectByUserIdAndShopId(userInfo.getId().toString(), shopId);
|
TbShopUser tbShopUserSM = tbShopUserMapper.selectByUserIdAndShopId(userInfo.getId().toString(), shopId);
|
||||||
if (tbShopUserSM != null) {
|
if (tbShopUserSM != null) {
|
||||||
tbShopUserSM.setIsVip(Byte.parseByte("1"));
|
tbShopUserSM.setIsVip(Byte.parseByte("1"));
|
||||||
tbShopUserSM.setJoinTime(new Timestamp(System.currentTimeMillis()));
|
|
||||||
tbShopUserSM.setTelephone(phone);
|
tbShopUserSM.setTelephone(phone);
|
||||||
tbShopUserSM.setUpdatedAt(System.currentTimeMillis());
|
tbShopUserSM.setUpdatedAt(System.currentTimeMillis());
|
||||||
tbShopUserMapper.updateByPrimaryKey(tbShopUserSM);
|
tbShopUserMapper.updateByPrimaryKey(tbShopUserSM);
|
||||||
@@ -545,7 +499,6 @@ public class LoginService {
|
|||||||
shopUser.setTelephone(userInfo.getTelephone());
|
shopUser.setTelephone(userInfo.getTelephone());
|
||||||
shopUser.setAmount(BigDecimal.ZERO);
|
shopUser.setAmount(BigDecimal.ZERO);
|
||||||
shopUser.setIsVip(Byte.parseByte("1"));
|
shopUser.setIsVip(Byte.parseByte("1"));
|
||||||
shopUser.setJoinTime(new Timestamp(System.currentTimeMillis()));
|
|
||||||
shopUser.setCreditAmount(BigDecimal.ZERO);
|
shopUser.setCreditAmount(BigDecimal.ZERO);
|
||||||
shopUser.setConsumeAmount(BigDecimal.ZERO);
|
shopUser.setConsumeAmount(BigDecimal.ZERO);
|
||||||
shopUser.setConsumeNumber(0);
|
shopUser.setConsumeNumber(0);
|
||||||
@@ -584,23 +537,21 @@ public class LoginService {
|
|||||||
) {
|
) {
|
||||||
return Result.fail("参数错误");
|
return Result.fail("参数错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
TbUserInfo userInfo = tbUserInfoMapper.selectByPrimaryKey(Integer.valueOf(userId));
|
TbUserInfo userInfo = tbUserInfoMapper.selectByPrimaryKey(Integer.valueOf(userId));
|
||||||
String phone = userInfo.getTelephone();
|
boolean flag = validate(map.get("code").toString(), userInfo.getTelephone());
|
||||||
if (map.containsKey("vipId")) {
|
if (!flag) {
|
||||||
TbShopUser tbShopUser = tbShopUserMapper.selectByPrimaryKey(map.get("vipId").toString());
|
return Result.fail("验证码错误");
|
||||||
phone = tbShopUser.getTelephone();
|
|
||||||
}
|
}
|
||||||
if (StringUtils.isBlank(phone)) return Result.fail("设置密码失败,手机号获取为空");
|
|
||||||
|
|
||||||
boolean flag = validate(map.get("code").toString(), phone);
|
|
||||||
|
|
||||||
if (!flag) return Result.fail("验证码错误");
|
|
||||||
|
|
||||||
userInfo.setIsPwd("1");
|
userInfo.setIsPwd("1");
|
||||||
userInfo.setPwd(MD5Utils.md5(map.get("pwd").toString()));
|
userInfo.setPwd(MD5Utils.md5(map.get("pwd").toString()));
|
||||||
userInfo.setUpdatedAt(System.currentTimeMillis());
|
userInfo.setUpdatedAt(System.currentTimeMillis());
|
||||||
tbUserInfoMapper.updateByPrimaryKey(userInfo);
|
tbUserInfoMapper.updateByPrimaryKey(userInfo);
|
||||||
|
|
||||||
return Result.success(CodeEnum.SUCCESS);
|
return Result.success(CodeEnum.SUCCESS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -630,4 +581,11 @@ public class LoginService {
|
|||||||
return Result.success(CodeEnum.SUCCESS);
|
return Result.success(CodeEnum.SUCCESS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
System.out.println(RandomUtil.randomNumbers(10));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,11 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.service;
|
package com.chaozhanggui.system.cashierservice.service;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.constant.TableConstant;
|
|
||||||
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.ShopEatTypeInfoDTO;
|
|
||||||
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.mapper.MpCashierCartMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.mapper.MpOrderDetailMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.mapper.MpOrderInfoMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.mapper.MpShopInfoMapper;
|
|
||||||
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;
|
||||||
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
|
||||||
@@ -35,10 +25,11 @@ import javax.annotation.Resource;
|
|||||||
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.util.*;
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 12847
|
* @author 12847
|
||||||
@@ -87,15 +78,6 @@ public class OrderService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TbOrderInfoMapper tbOrderInfoMapper;
|
private TbOrderInfoMapper tbOrderInfoMapper;
|
||||||
@Autowired
|
|
||||||
private MpCashierCartMapper mpCashierCartMapper;
|
|
||||||
@Autowired
|
|
||||||
private MpOrderDetailMapper mpOrderDetailMapper;
|
|
||||||
@Autowired
|
|
||||||
private MpOrderInfoMapper mpOrderInfoMapper;
|
|
||||||
@Autowired
|
|
||||||
private MpShopInfoMapper mpShopInfoMapper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建订单
|
* 创建订单
|
||||||
*
|
*
|
||||||
@@ -226,20 +208,10 @@ public class OrderService {
|
|||||||
orderVo.setOrderId(orderInfo.getId());
|
orderVo.setOrderId(orderInfo.getId());
|
||||||
orderVo.setSendType(orderInfo.getSendType());
|
orderVo.setSendType(orderInfo.getSendType());
|
||||||
orderVo.setOutNumber(orderInfo.getOutNumber());
|
orderVo.setOutNumber(orderInfo.getOutNumber());
|
||||||
orderVo.setUseType(orderInfo.getUseType());
|
|
||||||
orderVo.setShopId(Integer.valueOf(orderInfo.getShopId()));
|
|
||||||
|
|
||||||
return Result.success(CodeEnum.ENCRYPT, orderVo);
|
return Result.success(CodeEnum.ENCRYPT, orderVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result rmOrder(Integer orderId) {
|
|
||||||
int i = orderInfoMapper.deleteByPrimaryKey(orderId);
|
|
||||||
if (i > 0) {
|
|
||||||
return Result.success(CodeEnum.SUCCESS);
|
|
||||||
}
|
|
||||||
return Result.fail("删除失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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);
|
||||||
@@ -248,14 +220,10 @@ public class OrderService {
|
|||||||
// }
|
// }
|
||||||
PageHelper.startPage(page, size);
|
PageHelper.startPage(page, size);
|
||||||
List<TbOrderInfo> tbOrderInfos = orderInfoMapper.selectByUserId(userId, status);
|
List<TbOrderInfo> tbOrderInfos = orderInfoMapper.selectByUserId(userId, status);
|
||||||
String shopName = "";
|
|
||||||
for (TbOrderInfo orderInfo : tbOrderInfos) {
|
for (TbOrderInfo orderInfo : tbOrderInfos) {
|
||||||
TbShopInfo tbShopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getShopId()));
|
orderInfo.setDescription();
|
||||||
shopName = tbShopInfo.getShopName();
|
List<TbOrderDetail> list = tbOrderDetailMapper.selectAllByOrderId(orderInfo.getId());
|
||||||
orderInfo.setDescription(shopName);
|
|
||||||
List<TbOrderDetail> list = mpOrderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
|
||||||
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
|
||||||
.ne(TbOrderDetail::getProductId, TableConstant.CART_SEAT_ID));
|
|
||||||
int num = 0;
|
int num = 0;
|
||||||
for (TbOrderDetail orderDetail : list) {
|
for (TbOrderDetail orderDetail : list) {
|
||||||
num = num + orderDetail.getNum();
|
num = num + orderDetail.getNum();
|
||||||
@@ -454,88 +422,4 @@ public class OrderService {
|
|||||||
}
|
}
|
||||||
return Result.success(CodeEnum.SUCCESS);
|
return Result.success(CodeEnum.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object orderDetail(Integer orderId) {
|
|
||||||
|
|
||||||
TbOrderInfo orderInfo = mpOrderInfoMapper.selectOne(new LambdaQueryWrapper<TbOrderInfo>()
|
|
||||||
.eq(TbOrderInfo::getId, orderId));
|
|
||||||
|
|
||||||
if (orderInfo == null) {
|
|
||||||
return Result.fail("订单不存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
TbShopInfo tbShopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getShopId()));
|
|
||||||
if (tbShopInfo == null) {
|
|
||||||
return Result.fail("店铺不存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
LambdaQueryWrapper<TbOrderDetail> queryWrapper = new LambdaQueryWrapper<TbOrderDetail>()
|
|
||||||
.eq(TbOrderDetail::getShopId, orderInfo.getShopId())
|
|
||||||
.ne(TbOrderDetail::getProductId, TableConstant.CART_SEAT_ID)
|
|
||||||
.eq(TbOrderDetail::getOrderId, orderId);
|
|
||||||
|
|
||||||
List<TbOrderDetail> list = mpOrderDetailMapper.selectList(queryWrapper);
|
|
||||||
AtomicReference<TbOrderDetail> mealCashierCart = new AtomicReference<>();
|
|
||||||
list.forEach(item -> {
|
|
||||||
item.setPlaceNum(item.getPlaceNum() == null ? 0 : item.getPlaceNum());
|
|
||||||
if (item.getProductId() == -999) {
|
|
||||||
mealCashierCart.set(item);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 根据placeNum进行分组
|
|
||||||
Map<Integer, List<TbOrderDetail>> groupedByPlaceNum = list.stream()
|
|
||||||
.collect(Collectors.groupingBy(TbOrderDetail::getPlaceNum));
|
|
||||||
|
|
||||||
ArrayList<HashMap<String, Object>> dataList = new ArrayList<>();
|
|
||||||
groupedByPlaceNum.forEach((k, v) -> {
|
|
||||||
HashMap<String, Object> item = new HashMap<>();
|
|
||||||
item.put("placeNum", k);
|
|
||||||
item.put("placeTime", v.isEmpty() ? null : DateUtil.format(v.get(0).getCreateTime(), "HH:mm:ss"));
|
|
||||||
BigDecimal totalPrice = BigDecimal.ZERO;
|
|
||||||
for (TbOrderDetail d : v) {
|
|
||||||
totalPrice = totalPrice.add(d.getPriceAmount());
|
|
||||||
}
|
|
||||||
item.put("info", v);
|
|
||||||
item.put("totalAmount", totalPrice);
|
|
||||||
dataList.add(item);
|
|
||||||
});
|
|
||||||
|
|
||||||
TbShopTable tbShopTable = shopTableMapper.selectQRcode(orderInfo.getTableId());
|
|
||||||
|
|
||||||
OrderVo orderVo = new OrderVo();
|
|
||||||
orderVo.setName(tbShopInfo.getShopName());
|
|
||||||
orderVo.setStatus(orderInfo.getStatus());
|
|
||||||
//TODO 增加商家二维码
|
|
||||||
orderVo.setShopQrcode(tbShopInfo.getShopQrcode());
|
|
||||||
orderVo.setDetails(list);
|
|
||||||
orderVo.setOrderNo(orderInfo.getOrderNo());
|
|
||||||
orderVo.setTime(orderInfo.getCreatedAt());
|
|
||||||
if (orderInfo.getStatus().equals("paying") || orderInfo.getStatus().equals("unpaid")) {
|
|
||||||
long totalSeconds = orderInfo.getCreatedAt() + 15 * 60 * 1000l - System.currentTimeMillis();
|
|
||||||
if(totalSeconds>0){
|
|
||||||
orderVo.setExpiredMinutes(totalSeconds/1000 / 60);
|
|
||||||
orderVo.setExpiredSeconds(totalSeconds/1000 % 60);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
orderVo.setPayAmount(orderInfo.getOrderAmount());
|
|
||||||
orderVo.setTableName(tbShopTable == null ? "" : tbShopTable.getName());
|
|
||||||
orderVo.setOrderType(orderInfo.getOrderType());
|
|
||||||
orderVo.setOrderId(orderInfo.getId());
|
|
||||||
orderVo.setSendType(orderInfo.getSendType());
|
|
||||||
orderVo.setOutNumber(orderInfo.getOutNumber());
|
|
||||||
orderVo.setUseType(orderInfo.getUseType());
|
|
||||||
orderVo.setShopId(Integer.valueOf(orderInfo.getShopId()));
|
|
||||||
TbShopInfo shopInfo = mpShopInfoMapper.selectById(orderInfo.getShopId());
|
|
||||||
orderVo.setQrcode(shopInfo == null ? null : shopInfo.getShopQrcode());
|
|
||||||
Map<String, Object> map = new HashMap<>();
|
|
||||||
// 餐位费
|
|
||||||
map.put("seatFee", mealCashierCart);
|
|
||||||
map.put("detailList", dataList);
|
|
||||||
map.put("orderInfo", orderInfo);
|
|
||||||
map.putAll(BeanUtil.beanToMap(orderVo, false, false));
|
|
||||||
map.put("createdAt", DateUtil.formatDateTime(DateUtil.date(orderInfo.getCreatedAt())));
|
|
||||||
map.put("paidTime", orderInfo.getPaidTime() == null ? null : DateUtil.formatDateTime(DateUtil.date(orderInfo.getPaidTime())));
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,25 +2,15 @@ package com.chaozhanggui.system.cashierservice.service;
|
|||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.constant.TableConstant;
|
|
||||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.Enum.OrderUseTypeEnum;
|
|
||||||
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.entity.dto.ReturnGroupOrderDto;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.ShopEatTypeInfoDTO;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.vo.ShopUserListVo;
|
import com.chaozhanggui.system.cashierservice.entity.vo.ShopUserListVo;
|
||||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||||
import com.chaozhanggui.system.cashierservice.mapper.MpCashierCartMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.mapper.MpOrderDetailMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.mapper.MpOrderInfoMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.model.PayReq;
|
import com.chaozhanggui.system.cashierservice.model.PayReq;
|
||||||
import com.chaozhanggui.system.cashierservice.model.TradeQueryReq;
|
import com.chaozhanggui.system.cashierservice.model.TradeQueryReq;
|
||||||
import com.chaozhanggui.system.cashierservice.mpservice.MpShopTableService;
|
|
||||||
import com.chaozhanggui.system.cashierservice.netty.PushToClientChannelHandlerAdapter;
|
import com.chaozhanggui.system.cashierservice.netty.PushToClientChannelHandlerAdapter;
|
||||||
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;
|
||||||
@@ -41,7 +31,6 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -50,7 +39,6 @@ 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.sql.Timestamp;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -83,10 +71,6 @@ public class PayService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TbShopPayTypeMapper tbShopPayTypeMapper;
|
TbShopPayTypeMapper tbShopPayTypeMapper;
|
||||||
@Autowired
|
|
||||||
private TbActivateProductMapper actProductMapper;
|
|
||||||
@Resource
|
|
||||||
private TbActivateInRecordMapper activateInRecordMapper;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TbShopSongOrderMapper tbShopSongOrderMapper;
|
private TbShopSongOrderMapper tbShopSongOrderMapper;
|
||||||
@@ -127,10 +111,6 @@ public class PayService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TbShopUserFlowMapper tbShopUserFlowMapper;
|
TbShopUserFlowMapper tbShopUserFlowMapper;
|
||||||
@Resource
|
|
||||||
private TbActivateInRecordService activateInRecordService;
|
|
||||||
@Autowired
|
|
||||||
private TbActivateOutRecordMapper outRecordMapper;
|
|
||||||
|
|
||||||
@Value("${thirdPay.payType}")
|
@Value("${thirdPay.payType}")
|
||||||
private String thirdPayType;
|
private String thirdPayType;
|
||||||
@@ -169,47 +149,14 @@ public class PayService {
|
|||||||
private final TbShopSongOrderService shopSongOrderService;
|
private final TbShopSongOrderService shopSongOrderService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private MQUtils mQUtils;
|
private MQUtils mQUtils;
|
||||||
@Autowired
|
|
||||||
private StringRedisTemplate stringRedisTemplate;
|
|
||||||
@Autowired
|
|
||||||
private ShopUtils shopUtils;
|
|
||||||
@Autowired
|
|
||||||
private MpOrderDetailMapper mpOrderDetailMapper;
|
|
||||||
@Autowired
|
|
||||||
private MpOrderInfoMapper mpOrderInfoMapper;
|
|
||||||
@Autowired
|
|
||||||
private MpCashierCartMapper mpCashierCartMapper;
|
|
||||||
|
|
||||||
private final MpShopTableService mpShopTableService;
|
public PayService(@Qualifier("tbShopSongOrderServiceImpl") TbShopSongOrderService shopSongOrderService) {
|
||||||
|
|
||||||
public PayService(@Qualifier("tbShopSongOrderServiceImpl") TbShopSongOrderService shopSongOrderService, MpShopTableService mpShopTableService) {
|
|
||||||
this.shopSongOrderService = shopSongOrderService;
|
this.shopSongOrderService = shopSongOrderService;
|
||||||
this.mpShopTableService = mpShopTableService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public Result payOrderTest(String openId, String orderId, String payType, String ip) throws Exception {
|
|
||||||
//thirdUrl;
|
|
||||||
String appId = "66e3dd399a7621f45a6293c1";
|
|
||||||
String reqbody = "茉莉蜜茶";
|
|
||||||
BigDecimal money = new BigDecimal("0.10");
|
|
||||||
long amount = money.setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue();
|
|
||||||
payType = "ALIPAY";
|
|
||||||
String smallAppid = "2021004145625815";
|
|
||||||
openId = "2088812533865205";
|
|
||||||
ip = "1.80.208.76";
|
|
||||||
String timesSS = DateUtils.getsdfTimesSS();
|
|
||||||
String storeId = "S2409148611";
|
|
||||||
//callFSTBack
|
|
||||||
//null
|
|
||||||
String appToken = "jVQs9aBIFOj1mh2ioDp5RLiNBLcQoRnhniH9xlyc3ZKmDcwOpDargyEIYASCePtbA4hyJ5aeH841HfBA4rEKFsxl5AJjGcQa7qT28qU0SPN6v9dNzKYK1eTyvSw6mNBh";
|
|
||||||
PublicResp<WxScanPayResp> wxScanPayResp = thirdPayService.scanpay(thirdUrl, appId, reqbody, reqbody, amount, payType, smallAppid, openId, ip, timesSS, storeId, callFSTBack, null, appToken);
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
|
||||||
return Result.success(CodeEnum.SUCCESS, mapper.readTree(wxScanPayResp.getObjData().getPayInfo()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Result payOrder(String openId, String orderId, String payType, String ip) throws Exception {
|
public Result payOrder(String openId, String orderId, String ip) throws Exception {
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(openId) || Objects.isNull(openId)) {
|
if (ObjectUtil.isEmpty(openId) || Objects.isNull(openId)) {
|
||||||
return Result.fail("付款用户[userId]参数不能为空");
|
return Result.fail("付款用户[userId]参数不能为空");
|
||||||
@@ -220,7 +167,7 @@ public class PayService {
|
|||||||
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 (!OrderUseTypeEnum.DINE_IN_AFTER.getValue().equals(orderInfo.getUseType()) && System.currentTimeMillis() - orderInfo.getCreatedAt() > 60 * 15 * 1000) {
|
if (System.currentTimeMillis() - orderInfo.getCreatedAt() > 60 * 15 * 1000) {
|
||||||
return Result.fail("订单十五分钟内有效,当前已超时,请重新下单。");
|
return Result.fail("订单十五分钟内有效,当前已超时,请重新下单。");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,6 +175,7 @@ public class PayService {
|
|||||||
return Result.fail("没有对应的商户");
|
return Result.fail("没有对应的商户");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, null);
|
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, null);
|
||||||
if (ObjectUtil.isEmpty(cashierCarts) || ObjectUtil.isNull(cashierCarts)) {
|
if (ObjectUtil.isEmpty(cashierCarts) || ObjectUtil.isNull(cashierCarts)) {
|
||||||
return Result.fail("购物车信息不存在");
|
return Result.fail("购物车信息不存在");
|
||||||
@@ -238,16 +186,13 @@ public class PayService {
|
|||||||
body.append(cashierCart.getName());
|
body.append(cashierCart.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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("支付通道不存在");
|
||||||
}
|
}
|
||||||
if ("aliPay".equals(payType) && StrUtil.isBlank(thirdApply.getAlipaySmallAppid())) {
|
|
||||||
return Result.fail("店铺未配置支付宝小程序appId");
|
|
||||||
}
|
|
||||||
|
|
||||||
String userId = String.valueOf(TokenUtil.getUserId());
|
|
||||||
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();
|
||||||
@@ -255,12 +200,8 @@ public class PayService {
|
|||||||
payment.setAmount(orderInfo.getOrderAmount());
|
payment.setAmount(orderInfo.getOrderAmount());
|
||||||
payment.setPaidAmount(orderInfo.getPayAmount());
|
payment.setPaidAmount(orderInfo.getPayAmount());
|
||||||
payment.setHasRefundAmount(BigDecimal.ZERO);
|
payment.setHasRefundAmount(BigDecimal.ZERO);
|
||||||
if ("wechatPay".equals(payType)) {
|
|
||||||
payment.setPayName("微信支付");
|
payment.setPayName("微信支付");
|
||||||
} else if ("aliPay".equals(payType)) {
|
payment.setPayType("wechatPay");
|
||||||
payment.setPayName("支付宝支付");
|
|
||||||
}
|
|
||||||
payment.setPayType(payType);
|
|
||||||
payment.setReceived(payment.getAmount());
|
payment.setReceived(payment.getAmount());
|
||||||
payment.setChangeFee(BigDecimal.ZERO);
|
payment.setChangeFee(BigDecimal.ZERO);
|
||||||
payment.setMemberId(orderInfo.getMemberId());
|
payment.setMemberId(orderInfo.getMemberId());
|
||||||
@@ -269,12 +210,6 @@ public class PayService {
|
|||||||
payment.setCreatedAt(System.currentTimeMillis());
|
payment.setCreatedAt(System.currentTimeMillis());
|
||||||
tbOrderPaymentMapper.insert(payment);
|
tbOrderPaymentMapper.insert(payment);
|
||||||
} else {
|
} else {
|
||||||
if (payType.equals("wechatPay")) {
|
|
||||||
payment.setPayName("微信支付");
|
|
||||||
} else if (payType.equals("aliPay")) {
|
|
||||||
payment.setPayName("支付宝支付");
|
|
||||||
}
|
|
||||||
payment.setPayType(payType);
|
|
||||||
payment.setUpdatedAt(System.currentTimeMillis());
|
payment.setUpdatedAt(System.currentTimeMillis());
|
||||||
tbOrderPaymentMapper.updateByPrimaryKey(payment);
|
tbOrderPaymentMapper.updateByPrimaryKey(payment);
|
||||||
}
|
}
|
||||||
@@ -306,11 +241,12 @@ public class PayService {
|
|||||||
tbOrderPaymentMapper.updateByPrimaryKeySelective(payment);
|
tbOrderPaymentMapper.updateByPrimaryKeySelective(payment);
|
||||||
orderInfo.setStatus("paying");
|
orderInfo.setStatus("paying");
|
||||||
orderInfo.setPayOrderNo(payment.getTradeNumber());
|
orderInfo.setPayOrderNo(payment.getTradeNumber());
|
||||||
orderInfo.setUserId(userId);
|
|
||||||
|
|
||||||
tbOrderInfoMapper.updateByPrimaryKey(orderInfo);
|
tbOrderInfoMapper.updateByPrimaryKey(orderInfo);
|
||||||
|
String key = RedisCst.TABLE_CART.concat(orderInfo.getTableId()).concat("-").concat(orderInfo.getShopId());
|
||||||
//清除缓存购物车数据
|
//清除缓存购物车数据
|
||||||
redisUtil.deleteByKey(RedisCst.getTableCartKey(orderInfo.getTableId(), orderInfo.getTableId(), orderInfo.getUserId()));
|
redisUtil.deleteByKey(key);
|
||||||
JSONObject jsonObject1 = new JSONObject();
|
JSONObject jsonObject1 = new JSONObject();
|
||||||
jsonObject1.put("status", "success");
|
jsonObject1.put("status", "success");
|
||||||
jsonObject1.put("msg", "成功");
|
jsonObject1.put("msg", "成功");
|
||||||
@@ -333,27 +269,10 @@ public class PayService {
|
|||||||
reqbody = body.toString();
|
reqbody = body.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
String smallAppid = thirdApply.getSmallAppid();
|
PublicResp<WxScanPayResp> publicResp = thirdPayService.scanpay(thirdUrl, thirdApply.getAppId(),
|
||||||
String appId = thirdApply.getAppId();
|
reqbody, reqbody,
|
||||||
String appToken = thirdApply.getAppToken();
|
|
||||||
if ("aliPay".equals(payType)){
|
|
||||||
smallAppid = thirdApply.getAlipaySmallAppid();
|
|
||||||
}
|
|
||||||
String convertPayType = "aliPay".equals(payType) ? "ALIPAY" : "WECHAT";
|
|
||||||
PublicResp<WxScanPayResp> publicResp = thirdPayService.scanpay(thirdUrl,
|
|
||||||
appId,
|
|
||||||
reqbody,
|
|
||||||
reqbody,
|
|
||||||
payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue(),
|
payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue(),
|
||||||
convertPayType,
|
"WECHAT", thirdApply.getSmallAppid(), openId, ip, DateUtils.getsdfTimesSS(), thirdApply.getStoreId(), callFSTBack, null, thirdApply.getAppToken());
|
||||||
smallAppid,
|
|
||||||
openId,
|
|
||||||
ip,
|
|
||||||
DateUtils.getsdfTimesSS(),
|
|
||||||
thirdApply.getStoreId(),
|
|
||||||
callFSTBack,
|
|
||||||
null,
|
|
||||||
appToken);
|
|
||||||
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
|
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
|
||||||
if ("000000".equals(publicResp.getCode())) {
|
if ("000000".equals(publicResp.getCode())) {
|
||||||
WxScanPayResp wxScanPayResp = publicResp.getObjData();
|
WxScanPayResp wxScanPayResp = publicResp.getObjData();
|
||||||
@@ -363,11 +282,12 @@ public class PayService {
|
|||||||
tbOrderPaymentMapper.updateByPrimaryKeySelective(payment);
|
tbOrderPaymentMapper.updateByPrimaryKeySelective(payment);
|
||||||
orderInfo.setStatus("paying");
|
orderInfo.setStatus("paying");
|
||||||
orderInfo.setPayOrderNo(payment.getTradeNumber());
|
orderInfo.setPayOrderNo(payment.getTradeNumber());
|
||||||
orderInfo.setUserId(userId);
|
|
||||||
|
|
||||||
tbOrderInfoMapper.updateByPrimaryKey(orderInfo);
|
tbOrderInfoMapper.updateByPrimaryKey(orderInfo);
|
||||||
|
String key = RedisCst.TABLE_CART.concat(orderInfo.getTableId()).concat("-").concat(orderInfo.getShopId());
|
||||||
//清除缓存购物车数据
|
//清除缓存购物车数据
|
||||||
redisUtil.deleteByKey(RedisCst.getTableCartKey(orderInfo.getShopId(), orderInfo.getTableId(), orderInfo.getUserId()));
|
redisUtil.deleteByKey(key);
|
||||||
JSONObject jsonObject1 = new JSONObject();
|
JSONObject jsonObject1 = new JSONObject();
|
||||||
jsonObject1.put("status", "success");
|
jsonObject1.put("status", "success");
|
||||||
jsonObject1.put("msg", "成功");
|
jsonObject1.put("msg", "成功");
|
||||||
@@ -401,11 +321,11 @@ public class PayService {
|
|||||||
if (ObjectUtil.isEmpty(orderInfo)) {
|
if (ObjectUtil.isEmpty(orderInfo)) {
|
||||||
return Result.fail("订单信息不存在");
|
return Result.fail("订单信息不存在");
|
||||||
}
|
}
|
||||||
|
if (System.currentTimeMillis() - orderInfo.getCreatedAt() > 60 * 15 * 1000) {
|
||||||
if (!OrderUseTypeEnum.DINE_IN_AFTER.getValue().equals(orderInfo.getUseType()) && System.currentTimeMillis() - orderInfo.getCreatedAt() > 60 * 15 * 1000) {
|
|
||||||
return Result.fail("订单十五分钟内有效,当前已超时,请重新下单。");
|
return Result.fail("订单十五分钟内有效,当前已超时,请重新下单。");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TbUserInfo userInfo = tbUserInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getUserId()));
|
TbUserInfo userInfo = tbUserInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getUserId()));
|
||||||
if (ObjectUtil.isEmpty(userInfo)) {
|
if (ObjectUtil.isEmpty(userInfo)) {
|
||||||
return Result.fail("未获取到用户信息");
|
return Result.fail("未获取到用户信息");
|
||||||
@@ -452,12 +372,11 @@ public class PayService {
|
|||||||
TbShopUserFlow flow = new TbShopUserFlow();
|
TbShopUserFlow flow = new TbShopUserFlow();
|
||||||
flow.setShopUserId(Integer.valueOf(user.getId()));
|
flow.setShopUserId(Integer.valueOf(user.getId()));
|
||||||
flow.setBizCode("accountPay");
|
flow.setBizCode("accountPay");
|
||||||
flow.setBizName("余额支付");
|
flow.setBizName("会员储值卡支付");
|
||||||
flow.setType("-");
|
flow.setType("-");
|
||||||
flow.setAmount(orderInfo.getOrderAmount());
|
flow.setAmount(orderInfo.getOrderAmount());
|
||||||
flow.setBalance(user.getAmount());
|
flow.setBalance(user.getAmount());
|
||||||
flow.setCreateTime(new Date());
|
flow.setCreateTime(new Date());
|
||||||
flow.setIsReturn("0");
|
|
||||||
tbShopUserFlowMapper.insert(flow);
|
tbShopUserFlowMapper.insert(flow);
|
||||||
|
|
||||||
|
|
||||||
@@ -465,22 +384,16 @@ public class PayService {
|
|||||||
orderInfo.setMemberId(memberId);
|
orderInfo.setMemberId(memberId);
|
||||||
orderInfo.setPayType("deposit");
|
orderInfo.setPayType("deposit");
|
||||||
orderInfo.setStatus("closed");
|
orderInfo.setStatus("closed");
|
||||||
orderInfo.setPaidTime(System.currentTimeMillis());
|
|
||||||
orderInfo.setPayOrderNo("deposit".concat(SnowFlakeUtil.generateOrderNo()));
|
orderInfo.setPayOrderNo("deposit".concat(SnowFlakeUtil.generateOrderNo()));
|
||||||
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
||||||
//更新购物车状态
|
//更新购物车状态
|
||||||
int cartCount = mpCashierCartMapper.update(null, new LambdaUpdateWrapper<TbCashierCart>()
|
int cartCount = tbCashierCartMapper.updateStatusByOrderId(orderId, "final");
|
||||||
.eq(TbCashierCart::getOrderId, orderId)
|
|
||||||
.eq(TbCashierCart::getUseType, orderInfo.getUseType())
|
|
||||||
.in(TbCashierCart::getStatus, "create", "closed")
|
|
||||||
.set(TbCashierCart::getStatus, "final"));
|
|
||||||
|
|
||||||
mpOrderDetailMapper.update(null, new LambdaUpdateWrapper<TbOrderDetail>().eq(TbOrderDetail::getId, orderId)
|
|
||||||
.eq(TbOrderDetail::getUseType, orderInfo.getUseType())
|
|
||||||
.eq(TbOrderDetail::getStatus, "unpaid")
|
|
||||||
.set(TbOrderDetail::getStatus, "closed"));
|
|
||||||
|
|
||||||
outRecordMapper.updateByOrderIdAndStatus(orderInfo.getId(), "closed");
|
tbOrderDetailMapper.updateStatusByOrderId(Integer.valueOf(orderId), "closed");
|
||||||
|
|
||||||
|
tbOrderDetailMapper.updateStatusByOrderIdAndStatus(Integer.valueOf(orderId), "closed");
|
||||||
|
|
||||||
log.info("更新购物车:{}", cartCount);
|
log.info("更新购物车:{}", cartCount);
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
@@ -490,16 +403,7 @@ public class PayService {
|
|||||||
|
|
||||||
producer.putOrderCollect(jsonObject.toJSONString());
|
producer.putOrderCollect(jsonObject.toJSONString());
|
||||||
|
|
||||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(orderInfo.getTableId(), orderInfo.getShopId());
|
producer.printMechine(orderId);
|
||||||
List<TbOrderDetail> detailList = mpOrderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
|
||||||
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
|
||||||
.eq(TbOrderDetail::getStatus, "closed"));
|
|
||||||
// 打印消息
|
|
||||||
if (!shopEatTypeInfoDTO.isDineInAfter()) {
|
|
||||||
mQUtils.printDishesTicket(orderInfo.getId(), false, detailList.toArray(new TbOrderDetail[0]));
|
|
||||||
}
|
|
||||||
mQUtils.printPlaceTicket(orderInfo.getId(), false);
|
|
||||||
// producer.printMechine(orderId);
|
|
||||||
sendOrderToClient(orderInfo);
|
sendOrderToClient(orderInfo);
|
||||||
|
|
||||||
// 发送mq消息并保存库存记录
|
// 发送mq消息并保存库存记录
|
||||||
@@ -507,28 +411,6 @@ public class PayService {
|
|||||||
data.put("orderId", orderInfo.getId());
|
data.put("orderId", orderInfo.getId());
|
||||||
data.put("plat", "miniApp");
|
data.put("plat", "miniApp");
|
||||||
mQUtils.sendStockSaleMsg(data);
|
mQUtils.sendStockSaleMsg(data);
|
||||||
|
|
||||||
|
|
||||||
JSONObject baObj = new JSONObject();
|
|
||||||
baObj.put("userId", userInfo.getId());
|
|
||||||
baObj.put("shopId", user.getShopId());
|
|
||||||
baObj.put("amount", orderInfo.getOrderAmount());
|
|
||||||
baObj.put("balance", user.getAmount());
|
|
||||||
baObj.put("type", "消费");
|
|
||||||
baObj.put("time", flow.getCreateTime());
|
|
||||||
producer.balance(baObj.toString());
|
|
||||||
|
|
||||||
// 为代客下单清楚当前台桌最新订单
|
|
||||||
String currentOrderKey = RedisCst.getCurrentOrderKey(orderInfo.getTableId(), orderInfo.getShopId());
|
|
||||||
String currentOrderId = stringRedisTemplate.opsForValue().get(currentOrderKey);
|
|
||||||
if (currentOrderId != null && currentOrderId.equals(orderId)) {
|
|
||||||
stringRedisTemplate.delete(currentOrderKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 重置台桌状态
|
|
||||||
if (StrUtil.isNotBlank(orderInfo.getTableId())) {
|
|
||||||
mpShopTableService.clearTableState(orderInfo.getTableId());
|
|
||||||
}
|
|
||||||
return Result.success(CodeEnum.SUCCESS, "1");
|
return Result.success(CodeEnum.SUCCESS, "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -575,7 +457,6 @@ public class PayService {
|
|||||||
flow.setAmount(orderInfo.getOrderAmount());
|
flow.setAmount(orderInfo.getOrderAmount());
|
||||||
flow.setBalance(user.getAmount());
|
flow.setBalance(user.getAmount());
|
||||||
flow.setCreateTime(new Date());
|
flow.setCreateTime(new Date());
|
||||||
flow.setIsReturn("0");
|
|
||||||
tbShopUserFlowMapper.insert(flow);
|
tbShopUserFlowMapper.insert(flow);
|
||||||
|
|
||||||
for (int i = 0; i < orderInfo.getNumber(); i++) {
|
for (int i = 0; i < orderInfo.getNumber(); i++) {
|
||||||
@@ -614,11 +495,6 @@ public class PayService {
|
|||||||
if (ObjectUtil.isEmpty(thirdApply) || ObjectUtil.isNull(thirdApply)) {
|
if (ObjectUtil.isEmpty(thirdApply) || ObjectUtil.isNull(thirdApply)) {
|
||||||
return Result.fail("支付通道不存在");
|
return Result.fail("支付通道不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("aliPay".equals(payType) && StrUtil.isBlank(thirdApply.getAlipaySmallAppid())) {
|
|
||||||
return Result.fail("店铺未配置支付宝小程序appId");
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuffer body = new StringBuffer();
|
StringBuffer body = new StringBuffer();
|
||||||
body.append(orderInfo.getProName());
|
body.append(orderInfo.getProName());
|
||||||
TbOrderPayment payment = tbOrderPaymentMapper.selectByOrderId(orderInfo.getOrderNo());
|
TbOrderPayment payment = tbOrderPaymentMapper.selectByOrderId(orderInfo.getOrderNo());
|
||||||
@@ -696,21 +572,14 @@ public class PayService {
|
|||||||
} else {
|
} else {
|
||||||
reqbody = body.toString();
|
reqbody = body.toString();
|
||||||
}
|
}
|
||||||
String smallAppid = thirdApply.getSmallAppid();
|
|
||||||
String appId = thirdApply.getAppId();
|
|
||||||
String appToken = thirdApply.getAppToken();
|
|
||||||
if ("aliPay".equals(payType)){
|
|
||||||
smallAppid = thirdApply.getAlipaySmallAppid();
|
|
||||||
}
|
|
||||||
String convertPayType = "aliPay".equals(payType) ? "ALIPAY" : "WECHAT";
|
|
||||||
PublicResp<WxScanPayResp> publicResp = thirdPayService.scanpay(
|
PublicResp<WxScanPayResp> publicResp = thirdPayService.scanpay(
|
||||||
thirdUrl,
|
thirdUrl,
|
||||||
appId,
|
thirdApply.getAppId(),
|
||||||
reqbody,
|
reqbody,
|
||||||
reqbody,
|
reqbody,
|
||||||
payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue(),
|
payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue(),
|
||||||
convertPayType,
|
"WECHAT",
|
||||||
smallAppid,
|
thirdApply.getSmallAppid(),
|
||||||
userId,
|
userId,
|
||||||
ip,
|
ip,
|
||||||
// orderInfo.getOrderNo(),
|
// orderInfo.getOrderNo(),
|
||||||
@@ -718,7 +587,7 @@ public class PayService {
|
|||||||
thirdApply.getStoreId(),
|
thirdApply.getStoreId(),
|
||||||
callBackGroupurl,
|
callBackGroupurl,
|
||||||
null,
|
null,
|
||||||
appToken);
|
thirdApply.getAppToken());
|
||||||
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
|
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
|
||||||
if ("000000".equals(publicResp.getCode())) {
|
if ("000000".equals(publicResp.getCode())) {
|
||||||
WxScanPayResp wxScanPayResp = publicResp.getObjData();
|
WxScanPayResp wxScanPayResp = publicResp.getObjData();
|
||||||
@@ -803,8 +672,6 @@ public class PayService {
|
|||||||
orderInfo.setPayType("wx_lite");
|
orderInfo.setPayType("wx_lite");
|
||||||
orderInfo.setPayOrderNo(payment.getTradeNumber());
|
orderInfo.setPayOrderNo(payment.getTradeNumber());
|
||||||
orderInfo.setPayAmount(orderInfo.getOrderAmount());
|
orderInfo.setPayAmount(orderInfo.getOrderAmount());
|
||||||
orderInfo.setPaidTime(System.currentTimeMillis());
|
|
||||||
orderInfo.setUserId(String.valueOf(TokenUtil.getUserId()));
|
|
||||||
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
||||||
|
|
||||||
|
|
||||||
@@ -817,16 +684,7 @@ public class PayService {
|
|||||||
|
|
||||||
|
|
||||||
log.info("发送打印数据");
|
log.info("发送打印数据");
|
||||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(orderInfo.getTableId(), orderInfo.getShopId());
|
producer.printMechine(orderInfo.getId() + "");
|
||||||
List<TbOrderDetail> detailList = mpOrderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
|
||||||
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
|
||||||
.eq(TbOrderDetail::getStatus, "closed"));
|
|
||||||
// 打印消息
|
|
||||||
if (!shopEatTypeInfoDTO.isDineInAfter()) {
|
|
||||||
mQUtils.printDishesTicket(orderInfo.getId(), false, detailList.toArray(new TbOrderDetail[0]));
|
|
||||||
}
|
|
||||||
mQUtils.printPlaceTicket(orderInfo.getId(), false);
|
|
||||||
// producer.printMechine(orderInfo.getId() + "");
|
|
||||||
|
|
||||||
return Result.success(CodeEnum.SUCCESS, orderId);
|
return Result.success(CodeEnum.SUCCESS, orderId);
|
||||||
case "2": //退款成功
|
case "2": //退款成功
|
||||||
@@ -847,8 +705,7 @@ public class PayService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PublicResp<OrderStatusQueryResp> publicResp = thirdPayService.queryOrder(thirdUrl, thirdApply.getAppId(),
|
PublicResp<OrderStatusQueryResp> publicResp = thirdPayService.queryOrder(thirdUrl, thirdApply.getAppId(), payment.getTradeNumber(), null, thirdApply.getAppToken());
|
||||||
payment.getTradeNumber(), null, thirdApply.getAppToken());
|
|
||||||
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
|
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
|
||||||
if ("000000".equals(publicResp.getCode())) {
|
if ("000000".equals(publicResp.getCode())) {
|
||||||
String cartStatus = "";
|
String cartStatus = "";
|
||||||
@@ -867,8 +724,6 @@ public class PayService {
|
|||||||
orderInfo.setPayType("wx_lite");
|
orderInfo.setPayType("wx_lite");
|
||||||
orderInfo.setPayOrderNo(payment.getTradeNumber());
|
orderInfo.setPayOrderNo(payment.getTradeNumber());
|
||||||
orderInfo.setPayAmount(orderInfo.getOrderAmount());
|
orderInfo.setPayAmount(orderInfo.getOrderAmount());
|
||||||
orderInfo.setPaidTime(System.currentTimeMillis());
|
|
||||||
orderInfo.setUserId(String.valueOf(TokenUtil.getUserId()));
|
|
||||||
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
||||||
|
|
||||||
|
|
||||||
@@ -881,16 +736,7 @@ public class PayService {
|
|||||||
|
|
||||||
|
|
||||||
log.info("发送打印数据");
|
log.info("发送打印数据");
|
||||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(orderInfo.getTableId(), orderInfo.getShopId());
|
producer.printMechine(orderInfo.getId() + "");
|
||||||
List<TbOrderDetail> detailList = mpOrderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
|
||||||
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
|
||||||
.eq(TbOrderDetail::getStatus, "closed"));
|
|
||||||
// 打印消息
|
|
||||||
if (!shopEatTypeInfoDTO.isDineInAfter()) {
|
|
||||||
mQUtils.printDishesTicket(orderInfo.getId(), false, detailList.toArray(new TbOrderDetail[0]));
|
|
||||||
}
|
|
||||||
mQUtils.printPlaceTicket(orderInfo.getId(), false);
|
|
||||||
// producer.printMechine(orderInfo.getId() + "");
|
|
||||||
sendOrderToClient(orderInfo);
|
sendOrderToClient(orderInfo);
|
||||||
redisUtil.deleteByKey(RedisCst.ORDER_EXPIRED.concat(orderInfo.getId().toString()));
|
redisUtil.deleteByKey(RedisCst.ORDER_EXPIRED.concat(orderInfo.getId().toString()));
|
||||||
return Result.success(CodeEnum.SUCCESS, orderId);
|
return Result.success(CodeEnum.SUCCESS, orderId);
|
||||||
@@ -1022,13 +868,12 @@ public class PayService {
|
|||||||
|
|
||||||
//更新子单状态
|
//更新子单状态
|
||||||
tbOrderDetailMapper.updateStatusByOrderIdAndStatus(orderInfo.getId(), "closed");
|
tbOrderDetailMapper.updateStatusByOrderIdAndStatus(orderInfo.getId(), "closed");
|
||||||
outRecordMapper.updateByOrderIdAndStatus(orderInfo.getId(), "closed");
|
|
||||||
//修改主单状态
|
//修改主单状态
|
||||||
orderInfo.setStatus("closed");
|
orderInfo.setStatus("closed");
|
||||||
orderInfo.setPayType("wx_lite");
|
orderInfo.setPayType("wx_lite");
|
||||||
orderInfo.setPayOrderNo(payOrderNO);
|
orderInfo.setPayOrderNo(payOrderNO);
|
||||||
orderInfo.setPayAmount(orderInfo.getOrderAmount());
|
orderInfo.setPayAmount(orderInfo.getOrderAmount());
|
||||||
orderInfo.setPaidTime(System.currentTimeMillis());
|
|
||||||
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
||||||
|
|
||||||
|
|
||||||
@@ -1040,26 +885,10 @@ public class PayService {
|
|||||||
producer.putOrderCollect(jsonObject.toJSONString());
|
producer.putOrderCollect(jsonObject.toJSONString());
|
||||||
|
|
||||||
log.info("发送打印数据");
|
log.info("发送打印数据");
|
||||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(orderInfo.getTableId(), orderInfo.getShopId());
|
producer.printMechine(orderInfo.getId() + "");
|
||||||
List<TbOrderDetail> detailList = mpOrderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
|
||||||
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
|
||||||
.eq(TbOrderDetail::getStatus, "closed"));
|
|
||||||
// 打印消息
|
|
||||||
if (!shopEatTypeInfoDTO.isDineInAfter()) {
|
|
||||||
mQUtils.printDishesTicket(orderInfo.getId(), false, detailList.toArray(new TbOrderDetail[0]));
|
|
||||||
}
|
|
||||||
mQUtils.printPlaceTicket(orderInfo.getId(), false);
|
|
||||||
// producer.printMechine(orderInfo.getId() + "");
|
|
||||||
sendOrderToClient(orderInfo);
|
sendOrderToClient(orderInfo);
|
||||||
redisUtil.deleteByKey(RedisCst.ORDER_EXPIRED.concat(orderInfo.getId().toString()));
|
redisUtil.deleteByKey(RedisCst.ORDER_EXPIRED.concat(orderInfo.getId().toString()));
|
||||||
|
|
||||||
// 为代客下单清除当前台桌最新订单
|
|
||||||
String currentOrderKey = RedisCst.getCurrentOrderKey(orderInfo.getTableId(), orderInfo.getShopId());
|
|
||||||
String currentOrderId = stringRedisTemplate.opsForValue().get(currentOrderKey);
|
|
||||||
if (currentOrderId != null && currentOrderId.equals(orderInfo.getId().toString())) {
|
|
||||||
stringRedisTemplate.delete(currentOrderKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 发送mq消息并保存库存记录
|
// 发送mq消息并保存库存记录
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
data.put("orderId", orderInfo.getId());
|
data.put("orderId", orderInfo.getId());
|
||||||
@@ -1073,41 +902,27 @@ public class PayService {
|
|||||||
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public String callBackPayFST(String payOrderNO,String payType) {
|
public String callBackPayFST(String payOrderNO) {
|
||||||
TbOrderInfo orderInfo = tbOrderInfoMapper.selectByPayOrderNo(payOrderNO);
|
TbOrderInfo orderInfo = tbOrderInfoMapper.selectByPayOrderNo(payOrderNO);
|
||||||
if (ObjectUtil.isEmpty(orderInfo)) {
|
if (ObjectUtil.isEmpty(orderInfo)) {
|
||||||
return "订单信息不存在";
|
return "订单信息不存在";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("paying".equals(orderInfo.getStatus())) {
|
if ("paying".equals(orderInfo.getStatus())) {
|
||||||
|
int cartCount = tbCashierCartMapper.updateStatusByOrderId(orderInfo.getId().toString(), "final");
|
||||||
|
|
||||||
|
|
||||||
int cartCount = mpCashierCartMapper.update(null, new LambdaUpdateWrapper<TbCashierCart>()
|
|
||||||
.eq(TbCashierCart::getOrderId, orderInfo.getId())
|
|
||||||
.eq(TbCashierCart::getUseType, orderInfo.getUseType())
|
|
||||||
.in(TbCashierCart::getStatus, "create", "closed")
|
|
||||||
.set(TbCashierCart::getStatus, "final"));
|
|
||||||
log.info("更新购物车:{}", cartCount);
|
log.info("更新购物车:{}", cartCount);
|
||||||
|
|
||||||
//更新子单状态
|
//更新子单状态
|
||||||
|
tbOrderDetailMapper.updateStatusByOrderIdAndStatus(orderInfo.getId(), "closed");
|
||||||
mpOrderDetailMapper.update(null, new LambdaUpdateWrapper<TbOrderDetail>().eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
|
||||||
.eq(TbOrderDetail::getUseType, orderInfo.getUseType())
|
|
||||||
.in(TbOrderDetail::getStatus, "unpaid")
|
|
||||||
.set(TbOrderDetail::getStatus, "closed"));
|
|
||||||
|
|
||||||
//修改主单状态
|
//修改主单状态
|
||||||
orderInfo.setStatus("closed");
|
orderInfo.setStatus("closed");
|
||||||
if("alipay".equalsIgnoreCase(payType)){
|
|
||||||
orderInfo.setPayType("ali_lite");
|
|
||||||
}else if("wechat".equalsIgnoreCase(payType)){
|
|
||||||
orderInfo.setPayType("wx_lite");
|
orderInfo.setPayType("wx_lite");
|
||||||
}
|
|
||||||
orderInfo.setPayOrderNo(payOrderNO);
|
orderInfo.setPayOrderNo(payOrderNO);
|
||||||
orderInfo.setPayAmount(orderInfo.getOrderAmount());
|
orderInfo.setPayAmount(orderInfo.getOrderAmount());
|
||||||
orderInfo.setPaidTime(System.currentTimeMillis());
|
|
||||||
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
||||||
outRecordMapper.updateByOrderIdAndStatus(orderInfo.getId(), "closed");
|
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("token", 0);
|
jsonObject.put("token", 0);
|
||||||
@@ -1117,16 +932,7 @@ public class PayService {
|
|||||||
producer.putOrderCollect(jsonObject.toJSONString());
|
producer.putOrderCollect(jsonObject.toJSONString());
|
||||||
|
|
||||||
log.info("发送打印数据");
|
log.info("发送打印数据");
|
||||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(orderInfo.getTableId(), orderInfo.getShopId());
|
producer.printMechine(orderInfo.getId() + "");
|
||||||
List<TbOrderDetail> detailList = mpOrderDetailMapper.selectList(new LambdaQueryWrapper<TbOrderDetail>()
|
|
||||||
.eq(TbOrderDetail::getOrderId, orderInfo.getId())
|
|
||||||
.eq(TbOrderDetail::getStatus, "closed"));
|
|
||||||
// 打印消息
|
|
||||||
if (!shopEatTypeInfoDTO.isDineInAfter()) {
|
|
||||||
mQUtils.printDishesTicket(orderInfo.getId(), false, detailList.toArray(new TbOrderDetail[0]));
|
|
||||||
}
|
|
||||||
mQUtils.printPlaceTicket(orderInfo.getId(), false);
|
|
||||||
// producer.printMechine(orderInfo.getId() + "");
|
|
||||||
JSONObject coupons = new JSONObject();
|
JSONObject coupons = new JSONObject();
|
||||||
coupons.put("type", "buy");
|
coupons.put("type", "buy");
|
||||||
coupons.put("orderId", orderInfo.getId().toString());
|
coupons.put("orderId", orderInfo.getId().toString());
|
||||||
@@ -1134,23 +940,11 @@ public class PayService {
|
|||||||
sendOrderToClient(orderInfo);
|
sendOrderToClient(orderInfo);
|
||||||
redisUtil.deleteByKey(RedisCst.ORDER_EXPIRED.concat(orderInfo.getId().toString()));
|
redisUtil.deleteByKey(RedisCst.ORDER_EXPIRED.concat(orderInfo.getId().toString()));
|
||||||
|
|
||||||
// 为代客下单清楚当前台桌最新订单
|
|
||||||
String currentOrderKey = RedisCst.getCurrentOrderKey(orderInfo.getTableId(), orderInfo.getShopId());
|
|
||||||
String currentOrderId = stringRedisTemplate.opsForValue().get(currentOrderKey);
|
|
||||||
if (currentOrderId != null && currentOrderId.equals(orderInfo.getId().toString())) {
|
|
||||||
stringRedisTemplate.delete(currentOrderKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 发送mq消息并保存库存记录
|
// 发送mq消息并保存库存记录
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
data.put("orderId", orderInfo.getId());
|
data.put("orderId", orderInfo.getId());
|
||||||
data.put("plat", "miniApp");
|
data.put("plat", "miniApp");
|
||||||
mQUtils.sendStockSaleMsg(data);
|
mQUtils.sendStockSaleMsg(data);
|
||||||
|
|
||||||
// 重置台桌状态
|
|
||||||
if (StrUtil.isNotBlank(orderInfo.getTableId())) {
|
|
||||||
mpShopTableService.clearTableState(orderInfo.getTableId());
|
|
||||||
}
|
|
||||||
return "SUCCESS";
|
return "SUCCESS";
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1188,12 +982,7 @@ public class PayService {
|
|||||||
|
|
||||||
public Result getActivate(String shopId, int page, int pageSize) {
|
public Result getActivate(String shopId, int page, int pageSize) {
|
||||||
PageHelper.startPage(page, pageSize);
|
PageHelper.startPage(page, pageSize);
|
||||||
List<TbActivate> list = tbActivateMapper.selectByShopId(shopId);
|
List<TbActivate> list = tbActivateMapper.selectByShpopId(shopId);
|
||||||
for (TbActivate tbActivate : list) {
|
|
||||||
if (tbActivate.getIsGiftPro() == 1) {
|
|
||||||
tbActivate.setGives(actProductMapper.queryProsByActivateId(tbActivate.getId()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PageInfo pageInfo = new PageInfo(list);
|
PageInfo pageInfo = new PageInfo(list);
|
||||||
return Result.success(CodeEnum.SUCCESS, pageInfo);
|
return Result.success(CodeEnum.SUCCESS, pageInfo);
|
||||||
}
|
}
|
||||||
@@ -1273,7 +1062,6 @@ public class PayService {
|
|||||||
|
|
||||||
if (!"1".equals(tbShopUser.getIsVip().toString())) {
|
if (!"1".equals(tbShopUser.getIsVip().toString())) {
|
||||||
tbShopUser.setIsVip(Byte.parseByte("1"));
|
tbShopUser.setIsVip(Byte.parseByte("1"));
|
||||||
tbShopUser.setJoinTime(new Timestamp(System.currentTimeMillis()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//修改客户资金
|
//修改客户资金
|
||||||
@@ -1290,59 +1078,43 @@ public class PayService {
|
|||||||
flow.setAmount(memberIn.getAmount());
|
flow.setAmount(memberIn.getAmount());
|
||||||
flow.setBalance(tbShopUser.getAmount());
|
flow.setBalance(tbShopUser.getAmount());
|
||||||
flow.setCreateTime(new Date());
|
flow.setCreateTime(new Date());
|
||||||
flow.setIsReturn("0");
|
|
||||||
tbShopUserFlowMapper.insert(flow);
|
tbShopUserFlowMapper.insert(flow);
|
||||||
//会员活动
|
TbActivate activate = tbActivateMapper.selectByAmount(tbShopUser.getShopId(), memberIn.getAmount());
|
||||||
giveActivate(tbShopUser, memberIn.getAmount(), flow.getId());
|
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
|
||||||
jsonObject.put("shopId", memberIn.getShopId());
|
|
||||||
jsonObject.put("type", "wxMemberIn");
|
|
||||||
jsonObject.put("amount", memberIn.getAmount());
|
|
||||||
producer.putOrderCollect(jsonObject.toJSONString());
|
|
||||||
return "success";
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal giveActivate(TbShopUser tbShopUser, BigDecimal memAmount, Integer flowId) {
|
|
||||||
TbActivate activate = tbActivateMapper.selectByAmount(tbShopUser.getShopId(), memAmount);
|
|
||||||
if (ObjectUtil.isNotEmpty(activate) && ObjectUtil.isNotNull(activate)) {
|
if (ObjectUtil.isNotEmpty(activate) && ObjectUtil.isNotNull(activate)) {
|
||||||
if (activate.getIsGiftPro() != null && activate.getIsGiftPro() == 1) {
|
|
||||||
List<TbActivateProduct> tbActivateProducts = actProductMapper.queryAllByActivateId(activate.getId());
|
|
||||||
List<TbActivateInRecord> actGiveRecords = new ArrayList<>();
|
|
||||||
for (TbActivateProduct actPro : tbActivateProducts) {
|
|
||||||
TbActivateInRecord record = new TbActivateInRecord(Integer.valueOf(tbShopUser.getId()), actPro.getProductId(), actPro.getNum(), Integer.valueOf(tbShopUser.getShopId()), activate.getId(), flowId);
|
|
||||||
actGiveRecords.add(record);
|
|
||||||
}
|
|
||||||
activateInRecordMapper.insertBatch(actGiveRecords);
|
|
||||||
}
|
|
||||||
BigDecimal amount = BigDecimal.ZERO;
|
BigDecimal amount = BigDecimal.ZERO;
|
||||||
switch (activate.getHandselType()) {
|
switch (activate.getHandselType()) {
|
||||||
case "GD":
|
case "GD":
|
||||||
amount = activate.getHandselNum();
|
amount = activate.getHandselNum();
|
||||||
break;
|
break;
|
||||||
case "RATIO":
|
case "RATIO":
|
||||||
amount = memAmount.multiply(activate.getHandselNum());
|
amount = memberIn.getAmount().multiply(activate.getHandselNum());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tbShopUser.setAmount(tbShopUser.getAmount().add(amount));
|
tbShopUser.setAmount(tbShopUser.getAmount().add(amount));
|
||||||
tbShopUser.setUpdatedAt(System.currentTimeMillis());
|
tbShopUser.setUpdatedAt(System.currentTimeMillis());
|
||||||
tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser);
|
tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser);
|
||||||
|
|
||||||
TbShopUserFlow flow = new TbShopUserFlow();
|
flow = new TbShopUserFlow();
|
||||||
flow.setShopUserId(Integer.valueOf(tbShopUser.getId()));
|
flow.setShopUserId(Integer.valueOf(tbShopUser.getId()));
|
||||||
flow.setBizCode("scanMemberAwardIn");
|
flow.setBizCode("scanMemberAwardIn");
|
||||||
flow.setBizName("充值活动奖励");
|
flow.setBizName("会员充值奖励");
|
||||||
flow.setType("+");
|
flow.setType("+");
|
||||||
flow.setAmount(amount);
|
flow.setAmount(amount);
|
||||||
flow.setBalance(tbShopUser.getAmount());
|
flow.setBalance(tbShopUser.getAmount());
|
||||||
flow.setCreateTime(new Date());
|
flow.setCreateTime(new Date());
|
||||||
flow.setIsReturn("0");
|
|
||||||
tbShopUserFlowMapper.insert(flow);
|
tbShopUserFlowMapper.insert(flow);
|
||||||
return amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("shopId", memberIn.getShopId());
|
||||||
|
jsonObject.put("type", "wxMemberIn");
|
||||||
|
jsonObject.put("amount", memberIn.getAmount());
|
||||||
|
producer.putOrderCollect(jsonObject.toJSONString());
|
||||||
|
|
||||||
|
}
|
||||||
|
return "success";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1372,7 +1144,6 @@ public class PayService {
|
|||||||
tbShopUser.setTelephone(userInfo.getTelephone());
|
tbShopUser.setTelephone(userInfo.getTelephone());
|
||||||
tbShopUser.setCode(RandomUtil.randomNumbers(8));
|
tbShopUser.setCode(RandomUtil.randomNumbers(8));
|
||||||
tbShopUser.setIsVip(Byte.parseByte("1"));
|
tbShopUser.setIsVip(Byte.parseByte("1"));
|
||||||
tbShopUser.setJoinTime(new Timestamp(System.currentTimeMillis()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//修改客户资金
|
//修改客户资金
|
||||||
@@ -1389,27 +1160,42 @@ public class PayService {
|
|||||||
flow.setAmount(memberIn.getAmount());
|
flow.setAmount(memberIn.getAmount());
|
||||||
flow.setBalance(tbShopUser.getAmount());
|
flow.setBalance(tbShopUser.getAmount());
|
||||||
flow.setCreateTime(new Date());
|
flow.setCreateTime(new Date());
|
||||||
flow.setRemark(payOrderNO);
|
|
||||||
flow.setIsReturn("0");
|
|
||||||
tbShopUserFlowMapper.insert(flow);
|
tbShopUserFlowMapper.insert(flow);
|
||||||
//会员活动
|
|
||||||
BigDecimal awardAmount = giveActivate(tbShopUser, memberIn.getAmount(), flow.getId());
|
TbActivate activate = tbActivateMapper.selectByAmount(tbShopUser.getShopId(), memberIn.getAmount());
|
||||||
|
if (ObjectUtil.isNotEmpty(activate) && ObjectUtil.isNotNull(activate)) {
|
||||||
|
BigDecimal amount = BigDecimal.ZERO;
|
||||||
|
switch (activate.getHandselType()) {
|
||||||
|
case "GD":
|
||||||
|
amount = activate.getHandselNum();
|
||||||
|
break;
|
||||||
|
case "RATIO":
|
||||||
|
amount = memberIn.getAmount().multiply(activate.getHandselNum());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tbShopUser.setAmount(tbShopUser.getAmount().add(amount));
|
||||||
|
tbShopUser.setUpdatedAt(System.currentTimeMillis());
|
||||||
|
tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser);
|
||||||
|
|
||||||
|
flow = new TbShopUserFlow();
|
||||||
|
flow.setShopUserId(Integer.valueOf(tbShopUser.getId()));
|
||||||
|
flow.setBizCode("scanMemberAwardIn");
|
||||||
|
flow.setType("+");
|
||||||
|
flow.setBizName("充值活动奖励");
|
||||||
|
flow.setAmount(amount);
|
||||||
|
flow.setBalance(tbShopUser.getAmount());
|
||||||
|
flow.setCreateTime(new Date());
|
||||||
|
tbShopUserFlowMapper.insert(flow);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("shopId", memberIn.getShopId());
|
jsonObject.put("shopId", memberIn.getShopId());
|
||||||
jsonObject.put("type", "wxMemberIn");
|
jsonObject.put("type", "wxMemberIn");
|
||||||
jsonObject.put("amount", memberIn.getAmount());
|
jsonObject.put("amount", memberIn.getAmount());
|
||||||
producer.putOrderCollect(jsonObject.toJSONString());
|
producer.putOrderCollect(jsonObject.toJSONString());
|
||||||
|
|
||||||
|
|
||||||
JSONObject baObj = new JSONObject();
|
|
||||||
baObj.put("userId", tbShopUser.getUserId());
|
|
||||||
baObj.put("shopId", tbShopUser.getShopId());
|
|
||||||
baObj.put("amount", ObjectUtil.isNull(awardAmount) ? memberIn.getAmount() : memberIn.getAmount().add(awardAmount));
|
|
||||||
baObj.put("balance", tbShopUser.getAmount());
|
|
||||||
baObj.put("type", "充值");
|
|
||||||
baObj.put("time", flow.getCreateTime());
|
|
||||||
producer.balance(baObj.toString());
|
|
||||||
|
|
||||||
return "SUCCESS";
|
return "SUCCESS";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1442,6 +1228,7 @@ public class PayService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Result paySongOrder(String openId, String shopId, Integer orderId, String ip, TbMerchantThirdApply thirdApply) throws JsonProcessingException {
|
public Result paySongOrder(String openId, String shopId, Integer orderId, String ip, TbMerchantThirdApply thirdApply) throws JsonProcessingException {
|
||||||
if (ObjectUtil.isEmpty(openId) || Objects.isNull(openId)) {
|
if (ObjectUtil.isEmpty(openId) || Objects.isNull(openId)) {
|
||||||
return Result.fail("付款用户[openId]参数不能为空");
|
return Result.fail("付款用户[openId]参数不能为空");
|
||||||
@@ -1511,26 +1298,6 @@ public class PayService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 重新激活支付中的订单
|
|
||||||
*
|
|
||||||
* @param tradeNo
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int activateOrder(String tradeNo) {
|
|
||||||
return mpOrderInfoMapper.update(null, new LambdaUpdateWrapper<TbOrderInfo>()
|
|
||||||
.eq(TbOrderInfo::getOrderNo, tradeNo)
|
|
||||||
.eq(TbOrderInfo::getStatus, "paying")
|
|
||||||
.set(TbOrderInfo::getStatus, "unpaid"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public int cancelOrder(Integer orderId) {
|
|
||||||
return mpOrderInfoMapper.update(null, new LambdaUpdateWrapper<TbOrderInfo>()
|
|
||||||
.eq(TbOrderInfo::getId, orderId)
|
|
||||||
.eq(TbOrderInfo::getStatus, "paying")
|
|
||||||
.set(TbOrderInfo::getStatus, "unpaid"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// public Result returnOrder(){
|
// public Result returnOrder(){
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,29 +1,17 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.service;
|
package com.chaozhanggui.system.cashierservice.service;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.chaozhanggui.system.cashierservice.constant.TableConstant;
|
|
||||||
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.Enum.OrderUseTypeEnum;
|
import com.chaozhanggui.system.cashierservice.entity.dto.HomeDto;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.Enum.PlatformTypeEnum;
|
import com.chaozhanggui.system.cashierservice.entity.dto.QuerySpecDTO;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.Enum.ShopInfoEatModelEnum;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.*;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.vo.*;
|
import com.chaozhanggui.system.cashierservice.entity.vo.*;
|
||||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||||
import com.chaozhanggui.system.cashierservice.mapper.MpCashierCartMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.mapper.MpOrderInfoMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.mapper.MpShopTableMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
|
|
||||||
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.*;
|
import com.chaozhanggui.system.cashierservice.util.*;
|
||||||
@@ -34,7 +22,6 @@ import lombok.Data;
|
|||||||
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.data.redis.core.StringRedisTemplate;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
@@ -88,85 +75,25 @@ public class ProductService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TbUserInfoMapper tbUserInfoMapper;
|
private TbUserInfoMapper tbUserInfoMapper;
|
||||||
|
|
||||||
@Autowired
|
public Result queryShopIdByTableCode(String userId, String openId, String code, String lat, String lng) {
|
||||||
private TbProskuConMapper tbProskuConMapper;
|
if (StringUtils.isBlank(code)) return Result.fail("桌码信息为空");
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TbConsInfoMapper tbConsInfoMapper;
|
|
||||||
@Resource
|
|
||||||
private TbActivateInRecordService activateInRecordService;
|
|
||||||
|
|
||||||
private final ShopUtils shopUtils;
|
|
||||||
@Autowired
|
|
||||||
private MpShopTableMapper mpShopTableMapper;
|
|
||||||
@Autowired
|
|
||||||
private MpCashierCartMapper mpCashierCartMapper;
|
|
||||||
@Autowired
|
|
||||||
private MpOrderInfoMapper mpOrderInfoMapper;
|
|
||||||
@Autowired
|
|
||||||
private RedisUtil redisUtil;
|
|
||||||
@Autowired
|
|
||||||
private StringRedisTemplate stringRedisTemplate;
|
|
||||||
|
|
||||||
public ProductService(ShopUtils shopUtils) {
|
|
||||||
this.shopUtils = shopUtils;
|
|
||||||
}
|
|
||||||
|
|
||||||
private TbOrderInfo getCurrentOrder(ShopEatTypeInfoDTO eatTypeInfoDTO, String tableId, Object shopId) {
|
|
||||||
// 获取当前台桌最新订单,先付款模式不获取
|
|
||||||
if (eatTypeInfoDTO.isDineInBefore()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
List<TbOrderInfo> orderInfoList = mpOrderInfoMapper.selectPage(new Page<>(1, 1), new LambdaQueryWrapper<TbOrderInfo>()
|
|
||||||
.eq(TbOrderInfo::getStatus, "unpaid")
|
|
||||||
.eq(TbOrderInfo::getUseType, eatTypeInfoDTO.getUseType())
|
|
||||||
.eq(TbOrderInfo::getShopId, shopId)
|
|
||||||
.gt(TbOrderInfo::getCreatedAt, DateUtil.date().getTime() - 1000 * 60 * 60 * 24)
|
|
||||||
.eq(TbOrderInfo::getTableId, tableId)
|
|
||||||
.orderByDesc(TbOrderInfo::getId)).getRecords();
|
|
||||||
return orderInfoList.isEmpty() ? null : orderInfoList.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Result queryShopIdByTableCode(String userId, String openId, String code, String lat, String lng, Integer shopId) {
|
|
||||||
if (StringUtils.isBlank(lat) || lat.equals("undefined")) {
|
if (StringUtils.isBlank(lat) || lat.equals("undefined")) {
|
||||||
lat = "34.343207";
|
lat = "34.343207";
|
||||||
lng = "108.939645";
|
lng = "108.939645";
|
||||||
}
|
}
|
||||||
TbShopTable tbShopTable = null;
|
TbShopTable tbShopTable = tbShopTableMapper.selectQRcode(code);
|
||||||
if (StrUtil.isNotBlank(code)) {
|
|
||||||
tbShopTable = tbShopTableMapper.selectQRcode(code);
|
|
||||||
if (tbShopTable == null) {
|
if (tbShopTable == null) {
|
||||||
return Result.fail("台桌信息不存在");
|
return Result.fail("台桌信息不存在");
|
||||||
}
|
}
|
||||||
}
|
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(tbShopTable.getShopId());
|
||||||
|
|
||||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(shopId != null ? shopId : tbShopTable.getShopId());
|
|
||||||
String distance = LocationUtils.getDistanceString(
|
String distance = LocationUtils.getDistanceString(
|
||||||
Double.parseDouble(lng), Double.parseDouble(lat),
|
Double.parseDouble(lng), Double.parseDouble(lat),
|
||||||
Double.parseDouble(shopInfo.getLng()), Double.parseDouble(shopInfo.getLat()));
|
Double.parseDouble(shopInfo.getLng()), Double.parseDouble(shopInfo.getLat()));
|
||||||
ConcurrentMap<String, Object> concurrentMap = new ConcurrentHashMap<>();
|
ConcurrentMap<String, Object> concurrentMap = new ConcurrentHashMap<>();
|
||||||
|
concurrentMap.put("shopTableInfo", tbShopTable);
|
||||||
// 获取当前台桌最新订单id
|
|
||||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.getEatModel(code, shopInfo.getId());
|
|
||||||
if (tbShopTable != null) {
|
|
||||||
if (shopEatTypeInfoDTO.isOpenDineIn()) {
|
|
||||||
TbOrderInfo order = getCurrentOrder(shopEatTypeInfoDTO, code, shopInfo.getId());
|
|
||||||
tbShopTable.setOrderId(order == null ? null : order.getId());
|
|
||||||
TbCashierCart seatCartInfo = getSeatCartInfo(tbShopTable.getShopId(), tbShopTable.getQrcode(), shopEatTypeInfoDTO);
|
|
||||||
tbShopTable.setChoseCount((shopInfo.getIsTableFee() != null && shopInfo.getIsTableFee().equals(1)) || (seatCartInfo != null && (seatCartInfo.getNumber() != null)));
|
|
||||||
tbShopTable.setSeatNum(seatCartInfo != null ? seatCartInfo.getNumber() : 0);
|
|
||||||
}else {
|
|
||||||
shopEatTypeInfoDTO.setUseType(OrderUseTypeEnum.TAKEOUT.getValue());
|
|
||||||
TbOrderInfo order = getCurrentOrder(shopEatTypeInfoDTO, code, shopInfo.getId());
|
|
||||||
tbShopTable.setOrderId(order == null ? null : order.getId());
|
|
||||||
tbShopTable.setChoseCount(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
concurrentMap.put("shopTableInfo", tbShopTable == null ? "" : tbShopTable);
|
|
||||||
concurrentMap.put("storeInfo", shopInfo);
|
concurrentMap.put("storeInfo", shopInfo);
|
||||||
concurrentMap.put("distance", distance);
|
concurrentMap.put("distance", distance);
|
||||||
TbShopUser shopUser = tbShopUserMapper.selectByUserIdAndShopId(userId, shopId != null ? shopId.toString() : tbShopTable.getShopId().toString());
|
TbShopUser shopUser = tbShopUserMapper.selectByUserIdAndShopId(userId, tbShopTable.getShopId().toString());
|
||||||
try {
|
try {
|
||||||
if (ObjectUtil.isEmpty(shopUser)) {
|
if (ObjectUtil.isEmpty(shopUser)) {
|
||||||
TbUserInfo tbUserInfo = tbUserInfoMapper.selectByPrimaryKey(Integer.valueOf(userId));
|
TbUserInfo tbUserInfo = tbUserInfoMapper.selectByPrimaryKey(Integer.valueOf(userId));
|
||||||
@@ -187,7 +114,7 @@ public class ProductService {
|
|||||||
shopUser.setConsumeNumber(0);
|
shopUser.setConsumeNumber(0);
|
||||||
shopUser.setLevelConsume(BigDecimal.ZERO);
|
shopUser.setLevelConsume(BigDecimal.ZERO);
|
||||||
shopUser.setStatus(Byte.parseByte("1"));
|
shopUser.setStatus(Byte.parseByte("1"));
|
||||||
shopUser.setShopId(shopId != null ? shopId.toString() : tbShopTable.getShopId().toString());
|
shopUser.setShopId(tbShopTable.getShopId().toString());
|
||||||
shopUser.setUserId(userId);
|
shopUser.setUserId(userId);
|
||||||
shopUser.setMiniOpenId(openId);
|
shopUser.setMiniOpenId(openId);
|
||||||
shopUser.setCreatedAt(System.currentTimeMillis());
|
shopUser.setCreatedAt(System.currentTimeMillis());
|
||||||
@@ -209,41 +136,32 @@ public class ProductService {
|
|||||||
return Result.success(CodeEnum.SUCCESS, concurrentMap);
|
return Result.success(CodeEnum.SUCCESS, concurrentMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result queryProduct(String userId,String shopId, String productGroupId) {
|
public Result queryProduct(String shopId, String productGroupId) {
|
||||||
ConcurrentMap<String, Object> concurrentMap = new ConcurrentHashMap<>();
|
ConcurrentMap<String, Object> concurrentMap = new ConcurrentHashMap<>();
|
||||||
Integer id = ObjectUtil.isNotEmpty(productGroupId) ? Integer.valueOf(productGroupId) : null;
|
Integer id = ObjectUtil.isNotEmpty(productGroupId) ? Integer.valueOf(productGroupId) : null;
|
||||||
//招牌菜
|
//招牌菜
|
||||||
List<TbProduct> tbProducts = tbProductMapper.selectIsSpecialty(Integer.valueOf(shopId));
|
List<TbProduct> tbProducts = tbProductMapper.selectIsSpecialty(Integer.valueOf(shopId));
|
||||||
concurrentMap.put("hots", handleDate(tbProducts,true,1,false));
|
concurrentMap.put("hots", handleDate(tbProducts,true,1));
|
||||||
List<TbProductGroup> groupList = tbProductGroupMapper.selectByShopId(shopId, id);
|
List<TbProductGroup> groupList = tbProductGroupMapper.selectByShopId(shopId, id);
|
||||||
if (ObjectUtil.isNotEmpty(groupList) && groupList.size() > 0) {
|
if (ObjectUtil.isNotEmpty(groupList) && groupList.size() > 0) {
|
||||||
//热销
|
//热销
|
||||||
TbProductGroup hot = new TbProductGroup();
|
TbProductGroup hot = new TbProductGroup();
|
||||||
hot.setName("热销");
|
hot.setName("热销");
|
||||||
List<TbProduct> hots = tbProductMapper.selectHot(shopId);
|
List<TbProduct> hots = tbProductMapper.selectHot(shopId);
|
||||||
hot.setProducts(handleDate(hots,true,1,false));
|
hot.setProducts(handleDate(hots,true,1));
|
||||||
//商品
|
//商品
|
||||||
groupList.parallelStream().forEach(g -> {
|
groupList.parallelStream().forEach(g -> {
|
||||||
if (g.getUseTime()==1) g.setIsSale(getIsSale(g.getSaleStartTime(),g.getSaleEndTime()));
|
if (g.getUseTime()==1) g.setIsSale(getIsSale(g.getSaleStartTime(),g.getSaleEndTime()));
|
||||||
String in = g.getProductIds().substring(1, g.getProductIds().length() - 1);
|
String in = g.getProductIds().substring(1, g.getProductIds().length() - 1);
|
||||||
if (ObjectUtil.isNotEmpty(in) && ObjectUtil.isNotNull(in)) {
|
if (ObjectUtil.isNotEmpty(in) && ObjectUtil.isNotNull(in)) {
|
||||||
|
// List<TbProduct> products = tbProductMapper.selectByIdIn(in);
|
||||||
List<TbProduct> products = tbProductMapper.selectByIdInAndCheck(in);
|
List<TbProduct> products = tbProductMapper.selectByIdInAndCheck(in);
|
||||||
g.setProducts(handleDate(products,false,g.getIsSale(),false));
|
g.setProducts(handleDate(products,false,g.getIsSale()));
|
||||||
} else {
|
} else {
|
||||||
g.setProducts(new ArrayList<>());
|
g.setProducts(new ArrayList<>());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
groupList.sort(Comparator.comparingInt(TbProductGroup::getIsSale).reversed());
|
groupList.sort(Comparator.comparingInt(TbProductGroup::getIsSale).reversed());
|
||||||
TbShopUser tbShopUser = tbShopUserMapper.selectByUserIdAndShopId(userId, shopId);
|
|
||||||
if (tbShopUser != null) {
|
|
||||||
TbProductGroup vipProGroup = new TbProductGroup();
|
|
||||||
vipProGroup.setName("会员商品");
|
|
||||||
List<TbProduct> vipPros = activateInRecordService.queryByVipIdAndShopId(Integer.valueOf(tbShopUser.getId()), Integer.valueOf(shopId));
|
|
||||||
if(!CollectionUtils.isEmpty(vipPros)){
|
|
||||||
vipProGroup.setProducts(handleDate(vipPros, true, 1, true));
|
|
||||||
groupList.add(0, vipProGroup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
groupList.add(0, hot);
|
groupList.add(0, hot);
|
||||||
concurrentMap.put("productInfo", groupList);
|
concurrentMap.put("productInfo", groupList);
|
||||||
}
|
}
|
||||||
@@ -298,8 +216,7 @@ public class ProductService {
|
|||||||
|
|
||||||
// 重组有效规格数据
|
// 重组有效规格数据
|
||||||
String tagSnap = skuResult != null ? skuResult.getTagSnap() : null;
|
String tagSnap = skuResult != null ? skuResult.getTagSnap() : null;
|
||||||
// List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectGroundingByProId(querySpecDTO.getProductId());
|
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectGroundingByProId(querySpecDTO.getProductId());
|
||||||
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectSku(String.valueOf(querySpecDTO.getProductId()));
|
|
||||||
|
|
||||||
JSONArray finalSnap = new JSONArray();
|
JSONArray finalSnap = new JSONArray();
|
||||||
// if (tagSnap != null) {
|
// if (tagSnap != null) {
|
||||||
@@ -381,17 +298,11 @@ public class ProductService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<HashMap<String, Object>> specList = new ArrayList<>();
|
ArrayList<HashMap<String, Object>> specList = new ArrayList<>();
|
||||||
HashMap<String, TbProductSku> unGroundingMap = new HashMap<>();
|
|
||||||
tbProductSkus.forEach(item -> {
|
tbProductSkus.forEach(item -> {
|
||||||
if (item.getIsGrounding() == 1) {
|
|
||||||
HashMap<String, Object> itemMap = new HashMap<>();
|
HashMap<String, Object> itemMap = new HashMap<>();
|
||||||
itemMap.put("specSnap", item.getSpecSnap());
|
itemMap.put("specSnap", item.getSpecSnap());
|
||||||
itemMap.put("skuId", item.getId());
|
itemMap.put("skuId", item.getId());
|
||||||
itemMap.put("info", item);
|
|
||||||
specList.add(itemMap);
|
specList.add(itemMap);
|
||||||
}else {
|
|
||||||
unGroundingMap.put(item.getSpecSnap(), item);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -401,14 +312,6 @@ public class ProductService {
|
|||||||
for (HashMap<String, Object> spec : specList) {
|
for (HashMap<String, Object> spec : specList) {
|
||||||
if (res.equals(spec.get("specSnap").toString())) {
|
if (res.equals(spec.get("specSnap").toString())) {
|
||||||
spec.put("isGrounding", true);
|
spec.put("isGrounding", true);
|
||||||
TbProductSku sku = (TbProductSku) spec.get("info");
|
|
||||||
if (sku != null) {
|
|
||||||
tbProduct.setIsPauseSale(sku.getIsPauseSale().byteValue());
|
|
||||||
checkPauseSale(tbProduct, new ArrayList<>(Collections.singletonList(sku)), true);
|
|
||||||
spec.put("isPauseSale", tbProduct.getIsPauseSale());
|
|
||||||
}else {
|
|
||||||
spec.put("isPauseSale", 1);
|
|
||||||
}
|
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -418,14 +321,6 @@ public class ProductService {
|
|||||||
itemMap.put("specSnap", res);
|
itemMap.put("specSnap", res);
|
||||||
itemMap.put("skuId", null);
|
itemMap.put("skuId", null);
|
||||||
itemMap.put("isGrounding", false);
|
itemMap.put("isGrounding", false);
|
||||||
TbProductSku sku = unGroundingMap.get("specSnap");
|
|
||||||
if (sku != null) {
|
|
||||||
tbProduct.setIsPauseSale(sku.getIsPauseSale().byteValue());
|
|
||||||
checkPauseSale(tbProduct, Collections.singletonList(sku), true);
|
|
||||||
itemMap.put("isPauseSale", tbProduct.getIsPauseSale());
|
|
||||||
}else {
|
|
||||||
itemMap.put("isPauseSale", 1);
|
|
||||||
}
|
|
||||||
otherVal.add(itemMap);
|
otherVal.add(itemMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -452,11 +347,9 @@ public class ProductService {
|
|||||||
* @param check 是否校验可售
|
* @param check 是否校验可售
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<TbProduct> handleDate(List<TbProduct> products,boolean check,Integer isSale,boolean isVip){
|
public List<TbProduct> handleDate(List<TbProduct> products,boolean check,Integer isSale){
|
||||||
if (!CollectionUtils.isEmpty(products)) {
|
if (!CollectionUtils.isEmpty(products)) {
|
||||||
products.parallelStream().forEach(it -> {
|
products.parallelStream().forEach(it -> {
|
||||||
TbShopUnit tbShopUnit = unitMapper.selectByPrimaryKey(Integer.valueOf(it.getUnitId()));
|
|
||||||
it.setUnitSnap(tbShopUnit != null ? tbShopUnit.getName() : "");
|
|
||||||
if(check){
|
if(check){
|
||||||
List<TbProductGroup> tbProductGroups = tbProductGroupMapper.selectByProductId(it.getShopId(), it.getId().toString());
|
List<TbProductGroup> tbProductGroups = tbProductGroupMapper.selectByProductId(it.getShopId(), it.getId().toString());
|
||||||
for (TbProductGroup g : tbProductGroups) {
|
for (TbProductGroup g : tbProductGroups) {
|
||||||
@@ -470,16 +363,18 @@ public class ProductService {
|
|||||||
}else {
|
}else {
|
||||||
it.setIsSale(isSale);
|
it.setIsSale(isSale);
|
||||||
}
|
}
|
||||||
|
TbShopUnit tbShopUnit = unitMapper.selectByPrimaryKey(Integer.valueOf(it.getUnitId()));
|
||||||
|
it.setUnitSnap(tbShopUnit != null ? tbShopUnit.getName() : "");
|
||||||
//购物车数量
|
//购物车数量
|
||||||
it.setCartNumber("0");
|
it.setCartNumber("0");
|
||||||
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectGroundingByProId(it.getId());
|
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectGroundingByProId(it.getId());
|
||||||
TbProductSkuResult skuResult = tbProductSkuResultMapper.selectByPrimaryKey(it.getId());
|
TbProductSkuResult skuResult = tbProductSkuResultMapper.selectByPrimaryKey(it.getId());
|
||||||
|
|
||||||
//判断库存及耗材
|
// 上下架对应的sku
|
||||||
checkPauseSale(it,tbProductSkus, false);
|
// HashSet<String> specSet = new HashSet<>();
|
||||||
|
|
||||||
AtomicDouble sum = new AtomicDouble(0.0);
|
AtomicDouble sum = new AtomicDouble(0.0);
|
||||||
BigDecimal lowerPrice = null;
|
BigDecimal lowerPrice = null;
|
||||||
|
BigDecimal lowMemberPrice = null;
|
||||||
for (TbProductSku item : tbProductSkus) {
|
for (TbProductSku item : tbProductSkus) {
|
||||||
if (item.getRealSalesNumber() != null) {
|
if (item.getRealSalesNumber() != null) {
|
||||||
sum.addAndGet(item.getRealSalesNumber());
|
sum.addAndGet(item.getRealSalesNumber());
|
||||||
@@ -487,19 +382,25 @@ public class ProductService {
|
|||||||
if (lowerPrice == null || lowerPrice.compareTo(item.getSalePrice()) > 0) {
|
if (lowerPrice == null || lowerPrice.compareTo(item.getSalePrice()) > 0) {
|
||||||
lowerPrice = item.getSalePrice();
|
lowerPrice = item.getSalePrice();
|
||||||
}
|
}
|
||||||
|
if (lowMemberPrice == null || lowMemberPrice.compareTo(item.getMemberPrice()) > 0) {
|
||||||
|
lowMemberPrice = item.getMemberPrice();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 销量
|
// 销量
|
||||||
it.setStockNumber(sum.intValue());
|
it.setStockNumber(sum.intValue());
|
||||||
|
|
||||||
|
// 售价
|
||||||
if (lowerPrice == null) {
|
if (lowerPrice == null) {
|
||||||
lowerPrice = BigDecimal.ZERO;
|
lowerPrice = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
//售价
|
|
||||||
it.setLowPrice(lowerPrice);
|
it.setLowPrice(lowerPrice);
|
||||||
it.setProductSkuResult(skuResult);
|
|
||||||
if (isVip) {
|
// 会员价
|
||||||
it.setLowPrice(BigDecimal.ZERO);
|
if (lowMemberPrice == null) {
|
||||||
it.setIsVip(Byte.parseByte("1"));
|
lowMemberPrice = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
|
it.setLowMemberPrice(lowMemberPrice);
|
||||||
|
it.setProductSkuResult(skuResult);
|
||||||
});
|
});
|
||||||
return products;
|
return products;
|
||||||
}else {
|
}else {
|
||||||
@@ -507,43 +408,9 @@ public class ProductService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkPauseSale(TbProduct tbProduct, List<TbProductSku> skus, boolean isSingle) {
|
|
||||||
if (tbProduct.getIsStock() == 1) {//库存开关 1开启
|
|
||||||
if (tbProduct.getStockNumber() != null && tbProduct.getStockNumber() <= 0) {
|
|
||||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isSingle && tbProduct.getIsPauseSale() == 1) {
|
public Result queryProductSku(String code, String shopId, String productId, String spec_tag) {
|
||||||
return;
|
if (ObjectUtil.isEmpty(shopId) || ObjectUtil.isEmpty(productId)) {
|
||||||
}
|
|
||||||
Iterator<TbProductSku> iterator = skus.iterator();
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
TbProductSku tbProductSku = iterator.next();
|
|
||||||
List<TbProskuCon> proskuConList = tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(Integer.valueOf(tbProductSku.getId()), Integer.valueOf(tbProductSku.getShopId()), Integer.valueOf(tbProductSku.getProductId()));
|
|
||||||
if (Objects.nonNull(proskuConList) && proskuConList.size() > 0) {
|
|
||||||
for (TbProskuCon proskuCon : proskuConList) {
|
|
||||||
if ("1".equals(proskuCon.getStatus())) {
|
|
||||||
TbConsInfo consInfo = tbConsInfoMapper.selectByPrimaryKey(proskuCon.getConInfoId());
|
|
||||||
if ("1".equals(consInfo.getIsCheck())) {
|
|
||||||
if (N.gt(proskuCon.getSurplusStock(), consInfo.getStockNumber().abs().subtract(consInfo.getStockConsume().abs()))) {
|
|
||||||
iterator.remove();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (CollectionUtils.isEmpty(skus)) {
|
|
||||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Result queryProductSku(String code, String shopId, String productId, String spec_tag,String isVip) {
|
|
||||||
if (ObjectUtil.isEmpty(shopId) || ObjectUtil.isEmpty(productId) || StringUtils.isEmpty(isVip)|| isVip.equals("undefined") ) {
|
|
||||||
return Result.fail("参数错误");
|
return Result.fail("参数错误");
|
||||||
}
|
}
|
||||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByShopIdAndProductIdAndSpec(shopId, productId, spec_tag);
|
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByShopIdAndProductIdAndSpec(shopId, productId, spec_tag);
|
||||||
@@ -556,7 +423,7 @@ public class ProductService {
|
|||||||
tbProductSkuWithBLOBs.setId(null);
|
tbProductSkuWithBLOBs.setId(null);
|
||||||
}else {
|
}else {
|
||||||
if (StringUtils.isNotBlank(code)) {
|
if (StringUtils.isNotBlank(code)) {
|
||||||
Integer sum = tbProductMapper.selectByCodeAndSkuId(code, tbProductSkuWithBLOBs.getId(), shopId,isVip);
|
Integer sum = tbProductMapper.selectByCodeAndSkuId(code, tbProductSkuWithBLOBs.getId(), shopId);
|
||||||
tbProductSkuWithBLOBs.setNumber(sum);
|
tbProductSkuWithBLOBs.setNumber(sum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -836,133 +703,39 @@ public class ProductService {
|
|||||||
* @param buyNum 购买数量
|
* @param buyNum 购买数量
|
||||||
*/
|
*/
|
||||||
public void updateStock(TbProduct tbProduct, TbProductSkuWithBLOBs tbProductSkuWithBLOBs, Integer buyNum) {
|
public void updateStock(TbProduct tbProduct, TbProductSkuWithBLOBs tbProductSkuWithBLOBs, Integer buyNum) {
|
||||||
|
if (tbProduct.getIsDistribute() == 1) {
|
||||||
if (tbProductMapper.decrStock(String.valueOf(tbProduct.getId()), buyNum) < 1) {
|
if (tbProductMapper.decrStock(String.valueOf(tbProduct.getId()), buyNum) < 1) {
|
||||||
throw new MsgException("库存修改失败,请稍后再试");
|
throw new MsgException("库存修改失败,请稍后再试");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (tbProductSkuMapper.decrStock(String.valueOf(tbProductSkuWithBLOBs.getId()), buyNum) < 1) {
|
||||||
|
throw new MsgException("库存修改失败,请稍后再试");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateStock(String id, Integer skuId, Integer buyNum) {
|
public void updateStock(String id, Integer skuId, Integer buyNum, boolean isDistribute) {
|
||||||
|
if (isDistribute) {
|
||||||
if (tbProductMapper.decrStock(String.valueOf(id), buyNum) < 1) {
|
if (tbProductMapper.decrStock(String.valueOf(id), buyNum) < 1) {
|
||||||
throw new MsgException("库存不足,下单失败");
|
throw new MsgException("库存不足,下单失败");
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
if (tbProductSkuMapper.decrStock(String.valueOf(skuId), buyNum) < 1) {
|
||||||
public void updateStockAndNoCheck(String id, Integer skuId, Integer buyNum) {
|
|
||||||
if (tbProductMapper.decrStockUnCheck(String.valueOf(id), buyNum) < 1) {
|
|
||||||
throw new MsgException("库存不足,下单失败");
|
throw new MsgException("库存不足,下单失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TbCashierCart choseCount(ChoseCountDTO choseCountDTO) {
|
|
||||||
return Utils.runFunAndCheckKey(() -> {
|
|
||||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(choseCountDTO.getTableId(), choseCountDTO.getShopId());
|
|
||||||
|
|
||||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(choseCountDTO.getShopId());
|
|
||||||
if (shopInfo == null) throw new MsgException("店铺信息不存在");
|
|
||||||
|
|
||||||
if (shopInfo.getIsTableFee() != null && shopInfo.getIsTableFee() == 1) {
|
|
||||||
throw new MsgException("当前店铺无需选择餐位费");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>()
|
public void updateStockAndNoCheck(String id, Integer skuId, Integer buyNum, boolean isDistribute) {
|
||||||
.eq(TbShopTable::getQrcode, choseCountDTO.getTableId()));
|
if (isDistribute) {
|
||||||
if (shopTable == null) {
|
if (tbProductMapper.decrStockUnCheck(String.valueOf(id), buyNum) < 1) {
|
||||||
throw new MsgException("台桌不存在");
|
throw new MsgException("库存不足,下单失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shopTable.getMaxCapacity() < choseCountDTO.getNum()) {
|
|
||||||
throw new MsgException("当前台桌最大人数为: " + shopTable.getMaxCapacity());
|
|
||||||
}
|
|
||||||
|
|
||||||
Integer userId = TokenUtil.getUserId();
|
|
||||||
|
|
||||||
TbCashierCart tbCashierCart = getSeatCartInfo(choseCountDTO.getShopId(), choseCountDTO.getTableId(), shopEatTypeInfoDTO);
|
|
||||||
|
|
||||||
if (tbCashierCart == null) {
|
|
||||||
tbCashierCart = new TbCashierCart();
|
|
||||||
tbCashierCart.setStatus("create");
|
|
||||||
tbCashierCart.setCreatedAt(System.currentTimeMillis());
|
|
||||||
tbCashierCart.setTableId(choseCountDTO.getTableId());
|
|
||||||
tbCashierCart.setName("客座费");
|
|
||||||
tbCashierCart.setSalePrice(shopInfo.getTableFee());
|
|
||||||
tbCashierCart.setShopId(String.valueOf(choseCountDTO.getShopId()));
|
|
||||||
tbCashierCart.setTradeDay(DateUtils.getDay());
|
|
||||||
tbCashierCart.setStatus("create");
|
|
||||||
tbCashierCart.setTotalAmount(new BigDecimal(choseCountDTO.getNum()).multiply(shopInfo.getTableFee()));
|
|
||||||
tbCashierCart.setPlaceNum(1);
|
|
||||||
tbCashierCart.setProductId(TableConstant.CART_SEAT_ID);
|
|
||||||
tbCashierCart.setSkuId(TableConstant.CART_SEAT_ID);
|
|
||||||
tbCashierCart.setPackFee(BigDecimal.ZERO);
|
|
||||||
tbCashierCart.setNumber(choseCountDTO.getNum());
|
|
||||||
tbCashierCart.setTotalNumber(choseCountDTO.getNum());
|
|
||||||
tbCashierCart.setUseType(shopEatTypeInfoDTO.getUseType());
|
|
||||||
tbCashierCart.setPlatformType(PlatformTypeEnum.MINI_APP.getValue());
|
|
||||||
tbCashierCart.setUserId(userId);
|
|
||||||
mpCashierCartMapper.insert(tbCashierCart);
|
|
||||||
} else {
|
} else {
|
||||||
tbCashierCart.setTotalAmount(new BigDecimal(choseCountDTO.getNum()).multiply(shopInfo.getTableFee()));
|
if (tbProductSkuMapper.decrStockUnCheck(String.valueOf(skuId), buyNum) < 1) {
|
||||||
tbCashierCart.setNumber(choseCountDTO.getNum());
|
throw new MsgException("库存不足,下单失败");
|
||||||
tbCashierCart.setTotalNumber(choseCountDTO.getNum());
|
|
||||||
tbCashierCart.setUseType(shopEatTypeInfoDTO.getUseType());
|
|
||||||
tbCashierCart.setPlatformType(PlatformTypeEnum.MINI_APP.getValue());
|
|
||||||
tbCashierCart.setUserId(userId);
|
|
||||||
mpCashierCartMapper.updateById(tbCashierCart);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将数据加入缓存
|
|
||||||
String tableCartKey = RedisCst.getTableCartKey(String.valueOf(choseCountDTO.getShopId()), choseCountDTO.getTableId(), userId);
|
|
||||||
String message = redisUtil.getMessage(tableCartKey);
|
|
||||||
JSONArray jsonArray;
|
|
||||||
if (StrUtil.isNotBlank(message)) {
|
|
||||||
jsonArray = JSONObject.parseArray(message);
|
|
||||||
}else {
|
|
||||||
jsonArray = new JSONArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
long count = jsonArray.stream().filter(item -> TableConstant.CART_SEAT_ID.equals(((JSONObject) item).getString("productId"))).count();
|
|
||||||
if (count < 1) {
|
|
||||||
jsonArray.add(tbCashierCart);
|
|
||||||
redisUtil.saveMessage(tableCartKey, jsonArray.toJSONString());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 保存就餐人数信息
|
|
||||||
redisUtil.saveMessage(RedisCst.getCurrentTableSeatCount(choseCountDTO.getShopId(), choseCountDTO.getTableId()),
|
|
||||||
JSONObject.toJSONString(tbCashierCart), 60L * 60 * 12);
|
|
||||||
return tbCashierCart;
|
|
||||||
}, stringRedisTemplate, RedisCst.getLockKey(RedisCst.CHOSE_TABLE_COUNT, choseCountDTO.getShopId(), choseCountDTO.getTableId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
private TbCashierCart getSeatCartInfo(Object shopId, String tableId, ShopEatTypeInfoDTO shopEatTypeInfoDTO) {
|
|
||||||
LambdaQueryWrapper<TbCashierCart> query = new LambdaQueryWrapper<TbCashierCart>()
|
|
||||||
.eq(TbCashierCart::getShopId, shopId)
|
|
||||||
.eq(TbCashierCart::getProductId, TableConstant.CART_SEAT_ID)
|
|
||||||
.eq(TbCashierCart::getSkuId, TableConstant.CART_SEAT_ID)
|
|
||||||
.eq(TbCashierCart::getStatus, "create")
|
|
||||||
.gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime())
|
|
||||||
// .and(r -> r.eq(TbCashierCart::getUserId, userId).or().isNull(TbCashierCart::getUserId))
|
|
||||||
.eq(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType())
|
|
||||||
.eq(TbCashierCart::getTableId, tableId)
|
|
||||||
.orderByDesc(TbCashierCart::getId);
|
|
||||||
List<TbCashierCart> cashierCartList = mpCashierCartMapper.selectList(query);
|
|
||||||
return cashierCartList.isEmpty() ? null : cashierCartList.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object choseEatModel(ChoseEatModelDTO choseTableDTO) {
|
|
||||||
ShopEatTypeInfoDTO shopEatTypeInfoDTO = shopUtils.checkEatModel(choseTableDTO.getTableId(), choseTableDTO.getShopId());
|
|
||||||
if (!shopEatTypeInfoDTO.isTakeout()) {
|
|
||||||
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper<TbShopTable>()
|
|
||||||
.notIn(TbShopTable::getStatus, "closed", "cleaning")
|
|
||||||
.eq(TbShopTable::getQrcode, choseTableDTO.getTableId()));
|
|
||||||
|
|
||||||
if (shopTable == null) {
|
|
||||||
throw new MsgException("台桌未开台或不存在");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mpCashierCartMapper.update(null, new LambdaUpdateWrapper<TbCashierCart>()
|
|
||||||
.eq(TbCashierCart::getShopId, choseTableDTO.getShopId())
|
|
||||||
.isNull(TbCashierCart::getUseType)
|
|
||||||
.eq(TbCashierCart::getStatus, "create")
|
|
||||||
.set(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType())) ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.service;
|
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateInRecord;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbProduct;
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.PageRequest;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 活动商品赠送表(TbActivateInRecord)表服务接口
|
|
||||||
*
|
|
||||||
* @author ww
|
|
||||||
* @since 2024-08-22 11:13:40
|
|
||||||
*/
|
|
||||||
public interface TbActivateInRecordService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过ID查询单条数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
TbActivateInRecord queryById(Integer id);
|
|
||||||
|
|
||||||
List<TbProduct> queryByVipIdAndShopId(Integer vipUserId, Integer shopId);
|
|
||||||
int queryByVipIdAndShopIdAndProId(Integer vipUserId, Integer shopId,Integer productId);
|
|
||||||
List<TbActivateInRecord> queryAllByVipIdAndShopIdAndProId(Integer vipUserId, Integer shopId,Integer productId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增数据
|
|
||||||
*
|
|
||||||
* @param tbActivateInRecord 实例对象
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
TbActivateInRecord insert(TbActivateInRecord tbActivateInRecord);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改数据
|
|
||||||
*
|
|
||||||
* @param tbActivateInRecord 实例对象
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
TbActivateInRecord update(TbActivateInRecord tbActivateInRecord);
|
|
||||||
|
|
||||||
int updateOverNumById(Integer id,Integer overNum);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过主键删除数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 是否成功
|
|
||||||
*/
|
|
||||||
boolean deleteById(Integer id);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.service;
|
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateOutRecord;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 活动赠送商品使用记录表(TbActivateOutRecord)表服务接口
|
|
||||||
*
|
|
||||||
* @author ww
|
|
||||||
* @since 2024-08-22 11:21:56
|
|
||||||
*/
|
|
||||||
public interface TbActivateOutRecordService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过ID查询单条数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
TbActivateOutRecord queryById(Integer id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增数据
|
|
||||||
*
|
|
||||||
* @param tbActivateOutRecord 实例对象
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
TbActivateOutRecord insert(TbActivateOutRecord tbActivateOutRecord);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改数据
|
|
||||||
*
|
|
||||||
* @param tbActivateOutRecord 实例对象
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
TbActivateOutRecord update(TbActivateOutRecord tbActivateOutRecord);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过主键删除数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 是否成功
|
|
||||||
*/
|
|
||||||
boolean deleteById(Integer id);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.service;
|
|
||||||
|
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateProduct;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 活动赠送商品表(TbActivateProduct)表服务接口
|
|
||||||
*
|
|
||||||
* @author ww
|
|
||||||
* @since 2024-08-20 15:15:01
|
|
||||||
*/
|
|
||||||
public interface TbActivateProductService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过ID查询单条数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
TbActivateProduct queryById(Integer id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增数据
|
|
||||||
*
|
|
||||||
* @param tbActivateProduct 实例对象
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
TbActivateProduct insert(TbActivateProduct tbActivateProduct);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改数据
|
|
||||||
*
|
|
||||||
* @param tbActivateProduct 实例对象
|
|
||||||
* @return 实例对象
|
|
||||||
*/
|
|
||||||
TbActivateProduct update(TbActivateProduct tbActivateProduct);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过主键删除数据
|
|
||||||
*
|
|
||||||
* @param id 主键
|
|
||||||
* @return 是否成功
|
|
||||||
*/
|
|
||||||
boolean deleteById(Integer id);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.service;
|
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbCallQueue;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Administrator
|
|
||||||
* @description 针对表【tb_call_queue】的数据库操作Service
|
|
||||||
* @createDate 2024-09-13 13:44:26
|
|
||||||
*/
|
|
||||||
public interface TbCallQueueService extends IService<TbCallQueue> {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.service;
|
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.CallSubMsgDTO;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.CancelCallQueueDTO;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.TakeNumberDTO;
|
|
||||||
|
|
||||||
public interface TbCallService {
|
|
||||||
Object takeNumber(TakeNumberDTO takeNumberDTO);
|
|
||||||
|
|
||||||
Object getList(Integer shopId, String openId, Integer queueId);
|
|
||||||
|
|
||||||
Object getAllInfo(Integer shopId);
|
|
||||||
|
|
||||||
Object cancel(CancelCallQueueDTO cancelCallQueueDTO);
|
|
||||||
|
|
||||||
Object getState(String openId, Integer shopId, Integer queueId);
|
|
||||||
|
|
||||||
Object subMsg(CallSubMsgDTO subMsgDTO);
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user