2 Commits
tkk ... gyj

Author SHA1 Message Date
GYJ
9c82661351 商品会员价 2024-11-01 10:12:13 +08:00
GYJ
6792450f6b Merge branch 'refs/heads/dev' into gyj 2024-11-01 10:00:25 +08:00
85 changed files with 440 additions and 3880 deletions

View File

@@ -203,12 +203,6 @@
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
</dependency>
<!-- 支付宝服务端通用SDK -->
<dependency>
<groupId>com.alipay.sdk</groupId>
<artifactId>alipay-sdk-java</artifactId>
<version>4.39.165.ALL</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}

View File

@@ -49,7 +49,6 @@ public class LoginFilter implements Filter {
// "cashierService/login/**",//登录部分接口不校验
"cashierService/login/wx/**",//登录部分接口不校验
"cashierService/login/auth/**",//登录部分接口不校验
"cashierService/login/app/login",//登录部分接口不校验
"cashierService/product/queryProduct",
"cashierService/product/queryProductSku",
@@ -95,7 +94,7 @@ public class LoginFilter implements Filter {
return;
}
//environment 环境标识 wx alipay app 后续environment不可为空
//environment 环境标识 wx app 后续environment不可为空
String environment = request.getHeader("environment");
// 判断用户TOKEN是否存在
@@ -131,7 +130,7 @@ public class LoginFilter implements Filter {
String userId = jsonObject1.getString("userId");
tokenKey=RedisCst.ONLINE_APP_USER.concat(userId);
//获取redis中的token
}else if(environment.equals("wx") || environment.equals("alipay")){
}else if(environment.equals("wx")){
//获取当前登录人的用户id
String openId = jsonObject1.getString("openId");
if(StringUtils.isBlank(openId)){

View File

@@ -2,7 +2,6 @@ package com.chaozhanggui.system.cashierservice.controller;
import cn.hutool.core.util.StrUtil;
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.dto.WxMsgSubDTO;
import com.chaozhanggui.system.cashierservice.entity.vo.DistrictVo;
@@ -25,14 +24,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* 通用接口
@@ -53,8 +50,6 @@ public class CommonController {
private TbPlatformDictMapper platformDictMapper;
@Resource
private FileService fileService;
@Resource
private TbShopExtendMapper extendMapper;
private final LoginService loginService;;
@@ -168,12 +163,6 @@ public class CommonController {
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")));
}
// 检查手机号格式是否正确的方法
private boolean isValidPhoneNumber(String phone) {
return phone.matches("^1[3-9]\\d{9}$");

View File

@@ -2,10 +2,8 @@ package com.chaozhanggui.system.cashierservice.controller;
import cn.binarywang.wx.miniapp.util.crypt.WxMaCryptUtils;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
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.entity.TbMerchantAccount;
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.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.IpUtil;
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.util.*;
import com.chaozhanggui.system.cashierservice.wxUtil.WechatUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -64,27 +60,28 @@ public class LoginContoller {
@Autowired
RedisUtil redisUtil;
@Resource
AlipayUtil alipayUtil;
@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);
String openid = SessionKeyOpenId.getString("openid");
if (Objects.isNull(openid)) {
if(Objects.isNull(openid)){
return Result.fail("获取微信id失败");
}
return loginService.wxBusinessLogin(openid, shopId);
return loginService.wxBusinessLogin(openid,shopId);
}
@GetMapping("/wx/business/openId")
public Result getOpenId(@RequestParam String code) {
public Result getOpenId(
@RequestParam String code
) {
JSONObject SessionKeyOpenId = WechatUtil.getSessionKeyOrOpenId(code, customAppId, customSecrete);
String openid = SessionKeyOpenId.getString("openid");
if (Objects.isNull(openid)) {
if(Objects.isNull(openid)){
return Result.fail("获取微信id失败");
}
@@ -98,46 +95,50 @@ public class LoginContoller {
* @param map
* @return
*/
@RequestMapping("/auth/custom/login")
public Result authCustomLogin(HttpServletRequest request, @RequestBody Map<String, String> map) {
@RequestMapping("/wx/custom/login")
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"))) {
Result.fail("code不能为空");
}
// 三方登录来源 wechat、alipay
String source = map.getOrDefault("source",AuthSource.WECHAT.getValue());
String code = map.get("code");
if(AuthSource.WECHAT.getValue().equals(source)){
try {
// 1.接收小程序发送的code
// 2.开发者服务器 登录凭证校验接口 appi + appsecret + code
JSONObject wxResp = 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.接收微信接口服务 获取返回的参数
String openid = wxResp.getString("openid");
return loginService.wxCustomLogin(openid, "", "", "", IpUtil.getIpAddr(request));
} catch (Exception e) {
e.printStackTrace();
log.error("登录失败:",e);
}
}else if(AuthSource.ALIPAY.getValue().equals(source)){
try {
String openId = alipayUtil.getOpenId(code);
return loginService.alipayCustomLogin(openId);
}catch (AlipayApiException e){
log.error("登录失败:",e);
return Result.fail("登录失败:"+e.getErrMsg());
}catch (Exception e){
e.printStackTrace();
log.error("登录失败:",e);
}
String code = map.get("code").toString();
String rawData = map.get("rawData");
// String signature = map.get("signature");
// String encryptedData = map.get("encryptedData");
// String ivStr = map.get("iv");
// String phone = map.get("phone");
// 用户非敏感信息rawData
// 签名signature
JSONObject rawDataJson = JSON.parseObject(rawData);
// 1.接收小程序发送的code
// 2.开发者服务器 登录凭证校验接口 appi + appsecret + code
JSONObject SessionKeyOpenId = WechatUtil.getSessionKeyOrOpenId(code, customAppId, customSecrete);
// 3.接收微信接口服务 获取返回的参数
String openid = SessionKeyOpenId.getString("openid");
// String sessionKey = SessionKeyOpenId.getString("session_key");
// 4.校验签名 小程序发送的签名signature与服务器端生成的签名signature2 = sha1(rawData + sessionKey)
// String signature2 = DigestUtils.sha1Hex(rawData + sessionKey);
// if (!signature.equals(signature2)) {
// 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 {
return loginService.wxCustomLogin(openid, avatarUrl, nickName, "", IpUtil.getIpAddr(request));
} catch (Exception e) {
e.printStackTrace();
}
return Result.fail("登录失败");
}
@@ -178,28 +179,14 @@ public class LoginContoller {
// return Result.fail("获取手机号失败,请重试!");
// }
@RequestMapping("getPhoneNumber")
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("获取手机号失败:未知错误");
}
}
public Result getPhoneNumber(@RequestHeader String openId,@RequestBody Map<String, String> map) {
if (ObjectUtil.isNull(map) || ObjectUtil.isEmpty(map) || !map.containsKey("code") || ObjectUtil.isEmpty(map.get("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");
if (StringUtils.isBlank(encryptedData) || StringUtils.isBlank(ivStr)) {
@@ -214,14 +201,14 @@ public class LoginContoller {
try {
if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) {
// if (!map.containsKey("shopId") || ObjectUtil.isEmpty(map.get("shopId"))) {
return Result.success(CodeEnum.SUCCESS, JSONObject.parseObject(data).get("phoneNumber"));
return Result.success(CodeEnum.SUCCESS, JSONObject.parseObject(data).get("phoneNumber"));
// }
// log.info("登录传参 获取手机号成功 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,JSONObject.parseObject(data).get("phoneNumber"));
// return loginService.upPhone(openId,JSONObject.parseObject(data).get("phoneNumber").toString(),map.get("shopId").toString());
}
} catch (Exception e) {
} catch (Exception e){
// e.printStackTrace();
log.info("登录传参 获取手机号失败 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},", sessionKey, encryptedData, ivStr, data);
log.info("登录传参 获取手机号失败 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,data);
}
return Result.fail("获取手机号失败,请重试!");
}
@@ -267,8 +254,10 @@ public class LoginContoller {
* @return
*/
@GetMapping("createCardNo")
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);
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);
}
@GetMapping("/userInfo")
@@ -278,7 +267,6 @@ public class LoginContoller {
/**
* 更新用户信息
*
* @param token
* @param userInfo
* @return
@@ -293,16 +281,16 @@ public class LoginContoller {
}
@PostMapping(value = "/upPass")
public Result upPass(@RequestHeader String token, @RequestBody UserPassDto passVo) {
public Result upPass(@RequestHeader String token,@RequestBody UserPassDto passVo){
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
String newPass = MD5Utils.MD5Encode(passVo.getNewPass(), "utf-8");
if (ObjectUtil.isNull(passVo.getCode())) {
String oldPass = MD5Utils.MD5Encode(passVo.getOldPass(), "utf-8");
return loginService.upPass(userId, oldPass, newPass);
return loginService.upPass(userId,oldPass, newPass);
} else {
boolean tf = loginService.validate(passVo.getCode(), passVo.getPhone());
if (tf) {
TbUserInfo userInfo = new TbUserInfo();
TbUserInfo userInfo=new TbUserInfo();
userInfo.setId(Integer.valueOf(userId));
userInfo.setPassword(newPass);
return loginService.upUserInfo(userInfo);
@@ -313,16 +301,16 @@ public class LoginContoller {
}
@PostMapping(value = "modityPass")
public Result modityPass(@RequestHeader String token, @RequestBody UserPassDto passVo) {
public Result modityPass(@RequestHeader String token,@RequestBody UserPassDto passVo){
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
String newPass = MD5Utils.MD5Encode(passVo.getNewPass(), "utf-8");
if (ObjectUtil.isNull(passVo.getCode())) {
String oldPass = MD5Utils.MD5Encode(passVo.getOldPass(), "utf-8");
return loginService.upPass(userId, oldPass, newPass);
return loginService.upPass(userId,oldPass, newPass);
} else {
boolean tf = loginService.validate(passVo.getCode(), passVo.getPhone());
if (tf) {
TbUserInfo userInfo = new TbUserInfo();
TbUserInfo userInfo=new TbUserInfo();
userInfo.setId(Integer.valueOf(userId));
userInfo.setPassword(newPass);
return loginService.upUserInfo(userInfo);
@@ -371,12 +359,12 @@ public class LoginContoller {
}
//验证密码
String mdPasswordString = MD5Utils.MD5Encode(authUserDto.getPassword(), "utf-8");
return loginService.appLogin(authUserDto.getUsername(), openid, mdPasswordString);
return loginService.appLogin(authUserDto.getUsername(),openid, mdPasswordString);
} else {
// tf = true;
tf = loginService.validate(authUserDto.getCode(), authUserDto.getUsername());
if (tf) {
return loginService.appLogin(authUserDto.getUsername(), openid, null);
return loginService.appLogin(authUserDto.getUsername(),openid, null);
} else {
return Result.fail("验证码输入有误");
}
@@ -405,31 +393,29 @@ public class LoginContoller {
/**
* 重置资金密码
*
* @param token
* @param map
* @return
*/
@RequestMapping("resetPwd")
public Result resetPwd(@RequestHeader String token, @RequestBody Map<String, Object> map) {
public Result resetPwd(@RequestHeader String token,@RequestBody Map<String, Object> map){
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
return loginService.resetPwd(userId, map);
return loginService.resetPwd(userId,map);
}
/**
* 修改密码
*
* @param token
* @param map
* @return
*/
@RequestMapping("mpdifyPwd")
public Result mpdifyPwd(@RequestHeader String token, @RequestBody Map<String, Object> map) {
public Result mpdifyPwd(@RequestHeader String token,@RequestBody Map<String, Object> map){
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
return loginService.modifyPwd(userId, map);
return loginService.modifyPwd(userId,map);
}

View File

@@ -66,6 +66,11 @@ public class NotifyController {
}
@RequestMapping("test")
public void test(@RequestParam String payOrderNO){
payService.test(payOrderNO);
}
@RequestMapping("notifyCallBack")
public String notifyCallBack(HttpServletRequest request){

View File

@@ -1,6 +1,5 @@
package com.chaozhanggui.system.cashierservice.controller;
import cn.hutool.core.util.ObjectUtil;
import com.chaozhanggui.system.cashierservice.entity.TbShopTable;
import com.chaozhanggui.system.cashierservice.entity.dto.OrderDto;
import com.chaozhanggui.system.cashierservice.service.OrderService;
@@ -11,7 +10,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.IOException;
import java.text.ParseException;
import java.util.Map;
@CrossOrigin(origins = "*")
@RestController
@@ -53,14 +51,6 @@ public class OrderController {
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")
private Result tradeIntegral(@RequestParam("userId") String userId, @RequestParam("id") String id) throws IOException, ParseException {
return orderService.tradeIntegral(userId,id);

View File

@@ -1,7 +1,6 @@
package com.chaozhanggui.system.cashierservice.controller;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.chaozhanggui.system.cashierservice.annotation.LimitSubmit;
import com.chaozhanggui.system.cashierservice.service.PayService;
import com.chaozhanggui.system.cashierservice.sign.Result;
@@ -41,17 +40,8 @@ public class PayController {
return Result.fail("订单号不允许为空");
}
if (!map.containsKey("payType")) {
return Result.fail("支付类型不允许为空");
}
String payType = map.get("payType");
if (StrUtil.isEmpty(payType)) {
return Result.fail("支付类型不允许为空");
}
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) {
e.printStackTrace();
}
@@ -87,8 +77,6 @@ public class PayController {
String userId = "";
if (environment.equals("wx") && payType.equals("wechatPay")) {
userId = TokenUtil.parseParamFromToken(token).getString("openId");
} else if("aliPay".equals(payType)){
userId = TokenUtil.parseParamFromToken(token).getString("openId");
} else {
userId = TokenUtil.parseParamFromToken(token).getString("userId");
}

View File

@@ -50,13 +50,12 @@ public class ProductController {
* @return
*/
@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")) {
return Result.fail("参数错误");
}
return productService.queryProduct(
userId,
map.get("shopId").toString(),
(map.containsKey("productGroupId") && ObjectUtil.isNotEmpty(map.get("productGroupId"))) ? map.get("productGroupId").toString() : "");
}
@@ -82,10 +81,9 @@ public class ProductController {
@RequestParam(value = "code", required = false) String code,
@RequestParam("shopId") String shopId,
@RequestParam("productId") String productId,
@RequestParam("spec_tag") String spec_tag,
@RequestParam("isVip") String isVip
@RequestParam("spec_tag") String spec_tag
) {
return productService.queryProductSku(code,shopId, productId, spec_tag,isVip);
return productService.queryProductSku(code,shopId, productId, spec_tag);
}
@PostMapping("addCart")

View File

@@ -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);
}
}

View File

@@ -65,20 +65,9 @@ public class UserContoller {
@PostMapping("/openMember")
public Result openMember(@RequestBody OpenMemberVo memberVo){
if(StringUtils.isBlank(memberVo.getTelephone())){
return Result.fail("手机号不可为空");
}
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")
public Result shopUserInfo(@RequestParam("userId") String userId, @RequestHeader("openId") String openId, @RequestParam("shopId") String shopId) throws Exception {
if(shopId.equals("undefined")){
@@ -133,7 +122,6 @@ public class UserContoller {
shopUser.setLng(tbShopInfo.getLng());
shopUser.setLat(tbShopInfo.getLat());
shopUser.setAddress(tbShopInfo.getAddress());
shopUser.setIsUser(tbShopInfo.getIsCustom());
}
return Result.success(CodeEnum.SUCCESS, shopUser);
}

View File

@@ -1,75 +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);
/**
* 新增数据
*
* @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);
}

View File

@@ -11,19 +11,19 @@ import java.util.List;
@Component
@Mapper
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);
// 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);
List<TbActivate> selectByShopId(String shopId);
List<TbActivate> selectByShpopId(String shopId);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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();
}

View File

@@ -11,10 +11,6 @@ import java.util.List;
@Component
@Mapper
public interface TbOrderInfoMapper {
/**
* 逻辑删除
*/
int deleteByPrimaryKey(Integer id);
int insert(TbOrderInfo record);

View File

@@ -26,7 +26,7 @@ public interface TbProductMapper {
List<TbProduct> selectByIds(@Param("list") List<String> ids);
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);
List<ShopGroupInfoVo> selGroups(@Param("proName") String proName,@Param("type") String type,

View File

@@ -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);
}

View File

@@ -17,7 +17,7 @@ public interface TbShopAdDao {
*
* @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);
}

View File

@@ -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);
}

View File

@@ -30,10 +30,10 @@ public interface TbShopSongMapper {
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);
@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);
}

View File

@@ -48,7 +48,7 @@ public interface TbShopSongOrderMapper {
" AND a.id=#{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);
@Delete("DELETE FROM tb_shop_song_order\n" +

View File

@@ -1,8 +1,6 @@
package com.chaozhanggui.system.cashierservice.dao;
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.Param;
import org.springframework.stereotype.Component;
@@ -20,7 +18,6 @@ public interface TbUserCouponsMapper {
int insertSelective(TbUserCoupons record);
TbUserCoupons selectByPrimaryKey(Integer id);
List<UserCouponVo> queryAllSelective(UserCouponDto record);
int updateByPrimaryKeySelective(TbUserCoupons record);

View File

@@ -1,11 +1,7 @@
package com.chaozhanggui.system.cashierservice.entity;
import org.springframework.util.CollectionUtils;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class TbActivate implements Serializable {
private Integer id;
@@ -22,10 +18,6 @@ public class TbActivate implements Serializable {
private String isDel;
//是否赠送商品 0否 1是
private Integer isGiftPro;
private List<String> gives;
private static final long serialVersionUID = 1L;
public Integer getId() {
@@ -83,24 +75,4 @@ public class TbActivate implements Serializable {
public void setIsDel(String isDel) {
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;
}
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -58,7 +58,6 @@ public class TbCashierCart implements Serializable {
private Long updatedAt;
private Integer userId;
private String tableId;
private Byte isVip;
private TbProductSpec tbProductSpec;
private static final long serialVersionUID = 1L;

View File

@@ -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;
}
}

View File

@@ -23,8 +23,6 @@ public class TbMerchantThirdApply implements Serializable {
private String smallAppid;
private String alipaySmallAppid;
private String storeId;
@@ -119,12 +117,4 @@ public class TbMerchantThirdApply implements Serializable {
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public String getAlipaySmallAppid() {
return alipaySmallAppid;
}
public void setAlipaySmallAppid(String alipaySmallAppid) {
this.alipaySmallAppid = alipaySmallAppid;
}
}

View File

@@ -20,8 +20,6 @@ public class TbOrderDetail implements Serializable {
private Integer num;
private Byte isVip;
private String productName;
private String status;
@@ -37,7 +35,6 @@ public class TbOrderDetail implements Serializable {
private BigDecimal priceAmount;
private BigDecimal packAmount;
private String remark;
private static final long serialVersionUID = 1L;
}
}

View File

@@ -101,16 +101,12 @@ public class TbOrderInfo implements Serializable {
private List<TbOrderDetail> detailList;
private String winnnerNo;
private String isWinner;
private String shopName;
private String useType;
//根据状态返回 需付款 已付款 未付款 已退
private String description;
public void setDescription(String shopName) {
this.shopName = shopName;
public void setDescription() {
switch (status) {
case "closed":
this.description = "已付款";
@@ -190,4 +186,4 @@ public class TbOrderInfo implements Serializable {
this.createdAt = System.currentTimeMillis();
this.isAccepted = 1;
}
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -320,36 +320,4 @@ public class TbShopUser implements Serializable {
public void setMiniOpenId(String miniOpenId) {
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;
}
}

View File

@@ -21,11 +21,6 @@ public class TbShopUserFlow implements Serializable {
private String type;
private String isReturn;
private String remark;
private static final long serialVersionUID = 1L;
public Integer getId() {
@@ -91,20 +86,4 @@ public class TbShopUserFlow implements Serializable {
public void setType(String type) {
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;
}
}

View File

@@ -7,11 +7,10 @@ import java.math.BigDecimal;
import java.util.Date;
@Data
public class TbUserCoupons implements Serializable{
public class TbUserCoupons implements Serializable {
private Integer id;
private String userId;
private String detail;
private Integer orderId;
private BigDecimal couponsPrice;

View File

@@ -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;
}

View File

@@ -6,8 +6,10 @@ import lombok.Data;
public class OpenMemberVo {
private Integer id;
private Integer shopId;
private String telephone;
private String nickName;
private String birthDay;
private String headImg;
private String nickName;
private String telephone;
private String birthDay;
}

View File

@@ -1,34 +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 shopName;
/**
* 优惠金额
*/
private BigDecimal couponsPrice = BigDecimal.ZERO;
/**
* 多少可用
*/
private BigDecimal couponsAmount = BigDecimal.ZERO;
/**
* 数量
*/
private Integer num;
/**
* 卷状态 0 未使用
*/
private String status;
}

View File

@@ -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;
}

View File

@@ -1,14 +1,11 @@
package com.chaozhanggui.system.cashierservice.rabbit;
import cn.hutool.core.util.ArrayUtil;
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.entity.*;
import com.chaozhanggui.system.cashierservice.model.CategoryInfo;
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.FeieyunPrintUtil;
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
@@ -17,15 +14,12 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
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.Service;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Slf4j
@Component
@@ -53,10 +47,6 @@ public class PrintMechineConsumer {
@Autowired
private TbOrderDetailMapper tbOrderDetailMapper;
@Autowired
private RedisTemplate<Object, Object> redisTemplate2;
@Autowired
private StringRedisTemplate stringRedisTemplate;
@RabbitHandler
public void listener(String message) {
@@ -84,9 +74,6 @@ public class PrintMechineConsumer {
return;
}
log.info("打印机列表,{}", ArrayUtil.toString(list));
log.info("待打印订单信息, {}", orderInfo);
list.parallelStream().forEach(tbPrintMachineWithBLOBs->{
if (!"network".equals(tbPrintMachineWithBLOBs.getConnectionType())) {
log.error("非网络打印机:{},{}",tbPrintMachineWithBLOBs.getAddress(),tbPrintMachineWithBLOBs.getConnectionType());
@@ -195,20 +182,10 @@ public class PrintMechineConsumer {
break;
case "one": //一菜一品
cashierCarts = tbCashierCartMapper.selectByOrderId(orderId,"final");
log.info("一菜一品打印,待打印信息:{}", cashierCarts);
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
cashierCarts.parallelStream().forEach(it -> {
// 取餐号不为空为代客下单
if ("postPay".equals(orderInfo.getUseType()) && StrUtil.isNotBlank(it.getMasterId())) {
log.info("--------------------代客下单 打印一菜一品");
printTicket(Integer.valueOf(orderId), categoryInfos, tbPrintMachineWithBLOBs, orderInfo);
return;
}
log.info("--------------------非代客下单 打印一菜一品");
String categoryId;
if(ObjectUtil.isEmpty(it.getCategoryId())){
categoryId= tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
@@ -243,115 +220,6 @@ public class PrintMechineConsumer {
}
}
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 ->
c.getId().toString().equals(categoryId)
).count();
log.info("获取当前类别是否未打印类别:{}", count);
if (count > 0) {
// 统计已打数量
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 = "";
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
remark = tbProductSkuWithBLOBs.getSpecSnap();
}
// 将已打印信息加入redis
it.setRemark(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);
}
}
});
}
// 已删除的商品打印退款信息
if (printProductSet.get() != null) {
printProductSet.get().forEach(item -> {
log.info("已删除订单,打印退款票据, {}", item);
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);
});
}
}

View File

@@ -62,10 +62,4 @@ public interface RabbitConstants {
// 库存记录交换机
String EXCHANGE_STOCK_RECORD = "exchange.stock.record";
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";
}

View File

@@ -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);
}
public void balance(String content){
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
rabbitTemplate.convertAndSend(RabbitConstants.BALANCE_PUT, RabbitConstants.BALANCE_ROUTINGKEY_PUT, content, correlationId);
}
@Override
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
logger.info(" 回调id:" + correlationData);

View File

@@ -96,11 +96,4 @@ public class RedisConfig {
template.setValueSerializer(new StringRedisSerializer(Charset.forName("UTF-8")));
return template;
}
@Bean
public RedisTemplate<Object, Object> redisTemplate2(RedisConnectionFactory factory) {
RedisTemplate<Object, Object> template = new RedisTemplate<>();
template.setConnectionFactory(factory);
return template;
}
}

View File

@@ -26,13 +26,4 @@ public class RedisCst {
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 SONG_PAY_LOCK = "song_pay_lock:";
public static final String ORDER_PRINT_PRO = "ORDER_PRINT_PRODUCT:";
public static final String ORDER_PRINT = "ORDER_PRINT:";
static String CURRENT_TABLE_ORDER = "CURRENT_TABLE_ORDER:";
public static String getCurrentOrderKey(String tableId, String shopId) {
return CURRENT_TABLE_ORDER + shopId + ":" + tableId;
}
}

View File

@@ -25,12 +25,10 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.Instant;
@@ -59,9 +57,6 @@ public class CartService {
private TbMerchantAccountMapper merchantAccountMapper;
@Autowired
private TbUserInfoMapper userInfoMapper;
@Autowired
private TbShopUserMapper shopUserMapper;
@Autowired
private TbOrderDetailMapper orderDetailMapper;
@Autowired
@@ -76,10 +71,6 @@ public class CartService {
private final WxAccountUtil wxAccountUtil;
private final TbShopOpenIdMapper shopOpenIdMapper;
@Resource
private TbActivateInRecordService activateInRecordService;
@Autowired
private TbActivateOutRecordMapper outRecordMapper;
@Autowired
private RabbitProducer producer;
@@ -94,16 +85,7 @@ public class CartService {
private final RedisTemplate<String, Object> redisTemplate;
private final StringRedisTemplate stringRedisTemplate;
@Autowired
private TbProskuConMapper tbProskuConMapper;
@Autowired
TbConsInfoMapper tbConsInfoMapper;
public CartService(TbUserShopMsgMapper tbUserShopMsgMapper, WechatUtil wechatUtil, WxAccountUtil wxAccountUtil, TbShopOpenIdMapper shopOpenIdMapper, ProductService productService, TbProductMapper tbProductMapper, RedisTemplate<String, Object> redisTemplate, StringRedisTemplate stringRedisTemplate) {
public CartService(TbUserShopMsgMapper tbUserShopMsgMapper, WechatUtil wechatUtil, WxAccountUtil wxAccountUtil, TbShopOpenIdMapper shopOpenIdMapper, ProductService productService, TbProductMapper tbProductMapper, RedisTemplate<String, Object> redisTemplate) {
this.tbUserShopMsgMapper = tbUserShopMsgMapper;
this.wechatUtil = wechatUtil;
this.wxAccountUtil = wxAccountUtil;
@@ -111,7 +93,6 @@ public class CartService {
this.productService = productService;
this.tbProductMapper = tbProductMapper;
this.redisTemplate = redisTemplate;
this.stringRedisTemplate = stringRedisTemplate;
}
public void initCart(JSONObject jsonObject) {
@@ -134,7 +115,6 @@ public class CartService {
if (!CollectionUtils.isEmpty(tbCashierCarts)) {
for (TbCashierCart cashierCart : tbCashierCarts) {
array.add(cashierCart);
if(cashierCart.getIsVip().equals((byte) 1)) continue;
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
}
redisUtil.saveMessage(RedisCst.TABLE_CART.concat(key), array.toString());
@@ -161,9 +141,8 @@ public class CartService {
String skuId = jsonObject.getString("skuId");
Integer type = jsonObject.getInteger("type");
Integer buyNum = jsonObject.getInteger("num");
Integer isVip = jsonObject.getInteger("isVip");
if (StringUtils.isBlank(tableId) || StringUtils.isBlank(shopId) || StringUtils.isBlank(productId)
|| StringUtils.isBlank(skuId) || type == null || buyNum == null) {
|| StringUtils.isBlank(skuId) || type==null || buyNum == null) {
return Result.fail("参数缺失");
}
String key = tableId + "-" + shopId;
@@ -174,39 +153,24 @@ public class CartService {
}
// 判断商品是否已下架
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = productSkuMapper.selectByPrimaryKey(Integer.valueOf(skuId));
if (tbProductSkuWithBLOBs == null || tbProductSkuWithBLOBs.getIsGrounding().equals(0)) {
rmCart(jsonObject, skuId, key);
if (tbProductSkuWithBLOBs ==null || tbProductSkuWithBLOBs.getIsGrounding().equals(0)) {
rmCart(jsonObject,skuId,key);
return Result.fail("商品已下架");
}
if (tbProduct.getIsStock() == 1) {
// 1:共享库存 0:独立库存
if (Integer.valueOf(tbProduct.getIsDistribute()).equals(1)) {
if (tbProduct.getIsPauseSale() == 1) {//是否售罄
rmCart(jsonObject, skuId, key);
rmCart(jsonObject,skuId,key);
return Result.fail("该商品已售罄");
}
} else {
if (tbProductSkuWithBLOBs.getIsPauseSale() == 1) {//是否售罄
rmCart(jsonObject, skuId, key);
rmCart(jsonObject,skuId,key);
return Result.fail("该商品已售罄");
}
}
}
List<TbProskuCon> proskuConList = tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(Integer.valueOf(skuId), Integer.valueOf(shopId), Integer.valueOf(productId));
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()))) {
return Result.fail("商品:".concat(tbProduct.getName()).concat("对应的:").concat(consInfo.getConName()).concat("耗材不足"));
}
}
}
}
}
JSONArray jsonArray = new JSONArray();
BigDecimal amount = BigDecimal.ZERO;
try{
@@ -215,7 +179,7 @@ public class CartService {
if (Objects.isNull(array) || array.isEmpty()) {
if (type == 1) {
TbCashierCart cashierCart = addCart(productId, skuId,
jsonObject.getInteger("userId"), buyNum, tableId, shopId,isVip);
jsonObject.getInteger("userId"), buyNum, tableId, shopId);
jsonArray.add(cashierCart);
amount = amount.add(new BigDecimal(cashierCart.getNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
}
@@ -224,21 +188,15 @@ public class CartService {
for (int i = 0; i < array.size(); i++) {
JSONObject object = array.getJSONObject(i);
TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(object.toJSONString(), TbCashierCart.class);
if (cashierCart.getSkuId().equals(skuId) && cashierCart.getIsVip().intValue() == isVip) {
if (cashierCart.getSkuId().equals(skuId)) {
cashierCart.setTotalNumber(buyNum);
cashierCart.setNumber(buyNum);
if (type == 0 && isVip == 0 && tbProductSkuWithBLOBs.getSuit() != null
&& tbProductSkuWithBLOBs.getSuit() > 1 && cashierCart.getNumber() < tbProductSkuWithBLOBs.getSuit()) {
if (type == 0 && tbProductSkuWithBLOBs.getSuit() != null && tbProductSkuWithBLOBs.getSuit() > 1 && cashierCart.getNumber() < tbProductSkuWithBLOBs.getSuit()) {
cashierCartMapper.deleteByPrimaryKey(cashierCart.getId());
continue;
}
if (cashierCart.getNumber() > 0) {
if (isVip == 1) {
cashierCart.setTotalAmount(BigDecimal.ZERO);
} else {
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
}
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
cashierCart.setUpdatedAt(Instant.now().toEpochMilli());
cashierCartMapper.updateByPrimaryKeySelective(cashierCart);
} else {
@@ -252,7 +210,7 @@ public class CartService {
}
if (flag && type == 1) {
TbCashierCart cashierCart = addCart(productId, skuId,
jsonObject.getInteger("userId"), buyNum, tableId, shopId,isVip);
jsonObject.getInteger("userId"), buyNum, tableId, shopId);
jsonArray.add(cashierCart);
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
}
@@ -260,11 +218,9 @@ public class CartService {
} else {
if (type == 1) {
TbCashierCart cashierCart = addCart(productId, skuId,
jsonObject.getInteger("userId"), buyNum, tableId, shopId,isVip);
jsonObject.getInteger("userId"), buyNum, tableId, shopId);
jsonArray.add(cashierCart);
if (isVip != 1) {
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
}
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
}
}
}catch (MsgException e){
@@ -282,7 +238,7 @@ public class CartService {
jsonObject1.put("reqData", jsonObject);
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, "", false);
} catch (Exception e) {
log.error("长链接错误 createCart {}", e.getMessage());
log.error("长链接错误 createCart{}", e.getMessage());
}
return Result.success(CodeEnum.SUCCESS);
}
@@ -397,13 +353,13 @@ public class CartService {
}
}
private TbCashierCart addCart(String productId, String skuId, Integer userId, Integer num, String tableId, String shopId,Integer isVip) throws Exception{
private TbCashierCart addCart(String productId, String skuId, Integer userId, Integer num, String tableId, String shopId) throws Exception{
try {
TbProduct product = productMapper.selectById(Integer.valueOf(productId));
String key = tableId + "-" + shopId;
TbProductSkuWithBLOBs productSku = productSkuMapper.selectByPrimaryKey(Integer.valueOf(skuId));
TbCashierCart cashierCart = new TbCashierCart();
if (productSku.getSuit() != null && productSku.getSuit() > 1 && isVip != 1) {
if (productSku.getSuit() != null && productSku.getSuit() > 1) {
if (product.getIsStock() == 1) {
boolean isSale = false;
// 1:共享库存 0:独立库存
@@ -453,14 +409,7 @@ public class CartService {
cashierCart.setUpdatedAt(Instant.now().toEpochMilli());
cashierCart.setPackFee(BigDecimal.ZERO);
cashierCart.setRefundNumber(0);
if(isVip==1){
cashierCart.setIsVip(Byte.parseByte("1"));
cashierCart.setTotalAmount(BigDecimal.ZERO);
cashierCart.setSalePrice(BigDecimal.ZERO);
}else {
cashierCart.setIsVip(Byte.parseByte("0"));
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(productSku.getSalePrice().add(cashierCart.getPackFee())));
}
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(productSku.getSalePrice().add(cashierCart.getPackFee())));
cashierCartMapper.insert(cashierCart);
@@ -473,7 +422,7 @@ public class CartService {
return cashierCart;
} catch (Exception e) {
log.error("长链接错误 addCart {}", e.getMessage());
log.error("长链接错误 addCart{}", e.getMessage());
throw e;
}
}
@@ -504,36 +453,9 @@ public class CartService {
if (tbUserInfo == null) {
MsgException.throwException("生成订单失败");
}
TbShopUser tbShopUser = shopUserMapper.selectByUserIdAndShopId(userId, shopId);
boolean isVip= false;
if (tbShopUser != null && tbShopUser.getIsVip().equals((byte) 1)) {
isVip=true;
}
//校验 库存 耗材
for (int i = 0; i < array.size(); i++) {
JSONObject object = array.getJSONObject(i);
TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(object.toJSONString(), TbCashierCart.class);
if (cashierCart.getIsVip().equals((byte) 1)) {
if (isVip) {
int i1 = activateInRecordService.queryByVipIdAndShopIdAndProId(
Integer.valueOf(tbShopUser.getId()), Integer.valueOf(shopId), Integer.valueOf(cashierCart.getProductId()));
if (i1 < cashierCart.getTotalNumber()) {
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("status", "fail");
jsonObject1.put("msg", "会员商品[" + cashierCart.getName() + "],可下单数量为" + i1);
jsonObject1.put("data", new ArrayList<>());
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, jsonObject.getString("userId"), true);
return;
}
} else {
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("status", "fail");
jsonObject1.put("msg", "非会员用户不可下单会员商品");
jsonObject1.put("data", new ArrayList<>());
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, jsonObject.getString("userId"), true);
return;
}
}
TbProductSkuWithBLOBs tbProduct = productSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
TbProduct tbProduct1 = tbProductMapper.selectById(Integer.valueOf(tbProduct.getProductId()));
@@ -592,7 +514,6 @@ public class CartService {
orderDetail.setPackAmount(cashierCart.getPackFee());
orderDetail.setProductImg(cashierCart.getCoverImg());
orderDetail.setStatus("unpaid");
orderDetail.setIsVip(cashierCart.getIsVip());
if (StringUtils.isNotEmpty(cashierCart.getOrderId())) {
orderId = Integer.valueOf(cashierCart.getOrderId());
}
@@ -606,8 +527,6 @@ public class CartService {
TbShopTable shopTable = shopTableMapper.selectQRcode(jsonObject.getString("tableId"));
//生成订单
TbOrderInfo orderInfo = orderInfoMapper.selectByPrimaryKey(orderId);
//优惠卷
String isBuyYhq = "false";
String isuseYhq = "false";
if (jsonObject.containsKey("isYhq") && jsonObject.getString("isYhq").equals("1")) {
@@ -655,7 +574,28 @@ public class CartService {
couponAmount = userCoupons.getCouponsAmount();
} else {
TbUserCoupons userCoupons = userCouponsMapper.selectByPrimaryKey(couponsId);
if (Objects.isNull(userCoupons) || !userCoupons.getStatus().equals("0")) {
log.info("开始处理订单");
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("status", "fail");
jsonObject1.put("msg", "优惠券已使用");
jsonObject1.put("type", jsonObject.getString("type"));
jsonObject1.put("data", "");
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, jsonObject.getString("userId"), true);
log.info("消息推送");
return;
}
if (N.gt(userCoupons.getCouponsAmount(), totalAmount)) {
log.info("开始处理订单");
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("status", "fail");
jsonObject1.put("msg", "订单金额小于优惠价金额");
jsonObject1.put("type", jsonObject.getString("type"));
jsonObject1.put("data", "");
PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), key, jsonObject.getString("userId"), true);
log.info("消息推送");
return;
}
totalAmount = totalAmount.subtract(userCoupons.getCouponsAmount());
userCoupons.setStatus("1");
userCoupons.setEndTime(DateUtils.getNewDate(new Date(), 5, 30));
@@ -692,7 +632,6 @@ public class CartService {
orderInfo.setIsBuyCoupon(isBuyYhq);
orderInfo.setIsUseCoupon(isuseYhq);
orderInfo.setRemark(remark);
orderInfo.setUserId(userId);
orderInfoMapper.updateByPrimaryKeySelective(orderInfo);
} else {
@@ -704,7 +643,6 @@ public class CartService {
orderInfo.setIsUseCoupon(isuseYhq);
orderInfo.setUserCouponAmount(couponAmount);
orderInfo.setRemark(remark);
orderInfo.setUserId(userId);
JSONObject object = new JSONObject();
String outNumber = redisUtil.getMessage(RedisCst.OUT_NUMBER.concat(jsonObject.getString("shopId")));
@@ -733,30 +671,9 @@ public class CartService {
orderDetail.setOrderId(orderId);
orderDetailMapper.insert(orderDetail);
}
List<TbActivateOutRecord> outRecords = new ArrayList<>();
for (int i = 0; i < array.size(); i++) {
JSONObject object = array.getJSONObject(i);
TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(object.toJSONString(), TbCashierCart.class);
if (cashierCart.getIsVip().equals((byte) 1)) {
List<TbActivateInRecord> actInRecords = activateInRecordService.queryAllByVipIdAndShopIdAndProId(
Integer.valueOf(tbShopUser.getId()), Integer.valueOf(orderInfo.getShopId()), Integer.valueOf(cashierCart.getProductId()));
Integer totalNumber = cashierCart.getTotalNumber();
for (TbActivateInRecord actInRecord : actInRecords) {
if (totalNumber > 0) {
if (actInRecord.getOverNum() > totalNumber) {
TbActivateOutRecord outRecord = new TbActivateOutRecord(actInRecord.getId(), actInRecord.getProId(), totalNumber, orderInfo.getId().toString(), "create");
outRecords.add(outRecord);
activateInRecordService.updateOverNumById(actInRecord.getId(), actInRecord.getOverNum() - totalNumber);
break;
} else {
TbActivateOutRecord outRecord = new TbActivateOutRecord(actInRecord.getId(), actInRecord.getProId(), actInRecord.getOverNum(), orderInfo.getId().toString(), "create");
outRecords.add(outRecord);
activateInRecordService.updateOverNumById(actInRecord.getId(), 0);
totalNumber = totalNumber - actInRecord.getOverNum();
}
}
}
}
cashierCart.setUpdatedAt(System.currentTimeMillis());
cashierCart.setOrderId(orderId + "");
cashierCart.setStatus("closed");
@@ -766,7 +683,7 @@ public class CartService {
}
if(!CollectionUtils.isEmpty(outRecords)) outRecordMapper.insertBatch(outRecords);
// 发送mq消息
JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("orderId", orderInfo.getId());
@@ -808,7 +725,7 @@ public class CartService {
} catch (Exception e) {
log.info("长链接错误 createOrder{}", e.getMessage());
log.info("长链接错误 addCart{}", e.getMessage());
e.printStackTrace();
}
}

View File

@@ -1,14 +1,14 @@
package com.chaozhanggui.system.cashierservice.service;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.TbShopOpenId;
import com.chaozhanggui.system.cashierservice.entity.TbShopUser;
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
import com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg;
import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.exception.MsgException;
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
import com.chaozhanggui.system.cashierservice.redis.RedisUtil;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
@@ -141,72 +141,34 @@ public class LoginService {
}
private void buildNewUserInfo(TbUserInfo userInfo) {
userInfo = new TbUserInfo();
userInfo.setAmount(BigDecimal.ZERO);
userInfo.setChargeAmount(BigDecimal.ZERO);
userInfo.setLineOfCredit(BigDecimal.ZERO);
userInfo.setConsumeNumber(0);
userInfo.setConsumeAmount(BigDecimal.ZERO);
userInfo.setTotalScore(0);
userInfo.setLockScore(0);
userInfo.setHeadImg("");
userInfo.setNickName("");
userInfo.setTelephone("");
userInfo.setStatus(Byte.parseByte("1"));
userInfo.setParentType("PERSON");
userInfo.setIsResource(Byte.parseByte("0"));
userInfo.setIsOnline(Byte.parseByte("0"));
userInfo.setIsVip(Byte.parseByte("0"));
userInfo.setIsAttentionMp(Byte.parseByte("0"));
userInfo.setIsPwd("0");
userInfo.setPwd(MD5Utils.md5("123456"));
userInfo.setCreatedAt(System.currentTimeMillis());
userInfo.setLastLogInAt(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.setAmount(BigDecimal.ZERO);
userInfo.setChargeAmount(BigDecimal.ZERO);
userInfo.setLineOfCredit(BigDecimal.ZERO);
userInfo.setConsumeNumber(0);
userInfo.setConsumeAmount(BigDecimal.ZERO);
userInfo.setTotalScore(0);
userInfo.setLockScore(0);
userInfo.setHeadImg(ObjectUtil.isNotNull(headImage) ? headImage : "");
userInfo.setNickName(ObjectUtil.isNotNull(nickName) ? nickName : "微信用户");
userInfo.setTelephone(ObjectUtil.isNotNull(telephone) ? telephone : "");
userInfo.setMiniAppOpenId(openId);
userInfo.setStatus(Byte.parseByte("1"));
userInfo.setParentType("PERSON");
userInfo.setIsResource(Byte.parseByte("0"));
userInfo.setIsOnline(Byte.parseByte("0"));
userInfo.setIsVip(Byte.parseByte("0"));
userInfo.setSourcePath("WECHAT-APP");
userInfo.setIsAttentionMp(Byte.parseByte("0"));
userInfo.setSearchWord("||微信用户");
userInfo.setMiniAppOpenId(openId);
tbUserInfoMapper.insert(userInfo);
} else {
userInfo.setUpdatedAt(System.currentTimeMillis());
userInfo.setIsPwd("0");
userInfo.setPwd(MD5Utils.md5("123456"));
userInfo.setCreatedAt(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);
userInfo.setUpdatedAt(System.currentTimeMillis());
tbUserInfoMapper.insert(userInfo);
} else {
userInfo.setUpdatedAt(System.currentTimeMillis());
@@ -575,23 +537,21 @@ public class LoginService {
) {
return Result.fail("参数错误");
}
TbUserInfo userInfo = tbUserInfoMapper.selectByPrimaryKey(Integer.valueOf(userId));
String phone = userInfo.getTelephone();
if (map.containsKey("vipId")) {
TbShopUser tbShopUser = tbShopUserMapper.selectByPrimaryKey(map.get("vipId").toString());
phone = tbShopUser.getTelephone();
boolean flag = validate(map.get("code").toString(), userInfo.getTelephone());
if (!flag) {
return Result.fail("验证码错误");
}
if (StringUtils.isBlank(phone)) return Result.fail("设置密码失败,手机号获取为空");
boolean flag = validate(map.get("code").toString(), phone);
if (!flag) return Result.fail("验证码错误");
userInfo.setIsPwd("1");
userInfo.setPwd(MD5Utils.md5(map.get("pwd").toString()));
userInfo.setUpdatedAt(System.currentTimeMillis());
tbUserInfoMapper.updateByPrimaryKey(userInfo);
return Result.success(CodeEnum.SUCCESS);
}
@@ -621,4 +581,11 @@ public class LoginService {
return Result.success(CodeEnum.SUCCESS);
}
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
System.out.println(RandomUtil.randomNumbers(10));
}
}
}

View File

@@ -212,14 +212,6 @@ public class OrderService {
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) {
// TbUserInfo tbUserInfo = userInfoMapper.selectByPrimaryKey(userId);
@@ -228,11 +220,9 @@ public class OrderService {
// }
PageHelper.startPage(page, size);
List<TbOrderInfo> tbOrderInfos = orderInfoMapper.selectByUserId(userId, status);
String shopName = "";
for (TbOrderInfo orderInfo : tbOrderInfos) {
TbShopInfo tbShopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getShopId()));
shopName = tbShopInfo.getShopName();
orderInfo.setDescription(shopName);
orderInfo.setDescription();
List<TbOrderDetail> list = tbOrderDetailMapper.selectAllByOrderId(orderInfo.getId());
int num = 0;
for (TbOrderDetail orderDetail : list) {

View File

@@ -2,7 +2,6 @@ package com.chaozhanggui.system.cashierservice.service;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.dao.*;
@@ -32,7 +31,6 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -73,10 +71,6 @@ public class PayService {
@Autowired
TbShopPayTypeMapper tbShopPayTypeMapper;
@Autowired
private TbActivateProductMapper actProductMapper;
@Resource
private TbActivateInRecordMapper activateInRecordMapper;
@Autowired
private TbShopSongOrderMapper tbShopSongOrderMapper;
@@ -117,10 +111,6 @@ public class PayService {
@Autowired
TbShopUserFlowMapper tbShopUserFlowMapper;
@Resource
private TbActivateInRecordService activateInRecordService;
@Autowired
private TbActivateOutRecordMapper outRecordMapper;
@Value("${thirdPay.payType}")
private String thirdPayType;
@@ -159,36 +149,14 @@ public class PayService {
private final TbShopSongOrderService shopSongOrderService;
@Autowired
private MQUtils mQUtils;
@Autowired
private StringRedisTemplate stringRedisTemplate;
public PayService(@Qualifier("tbShopSongOrderServiceImpl") TbShopSongOrderService shopSongOrderService) {
this.shopSongOrderService = shopSongOrderService;
}
@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)
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)) {
return Result.fail("付款用户[userId]参数不能为空");
@@ -225,10 +193,6 @@ public class PayService {
return Result.fail("支付通道不存在");
}
if ("aliPay".equals(payType) && StrUtil.isBlank(thirdApply.getAlipaySmallAppid())) {
return Result.fail("店铺未配置支付宝小程序appId");
}
TbOrderPayment payment = tbOrderPaymentMapper.selectByOrderId(orderId);
if (ObjectUtil.isEmpty(payment) || payment == null) {
payment = new TbOrderPayment();
@@ -236,12 +200,8 @@ public class PayService {
payment.setAmount(orderInfo.getOrderAmount());
payment.setPaidAmount(orderInfo.getPayAmount());
payment.setHasRefundAmount(BigDecimal.ZERO);
if ("wechatPay".equals(payType)) {
payment.setPayName("微信支付");
} else if ("aliPay".equals(payType)) {
payment.setPayName("支付宝支付");
}
payment.setPayType(payType);
payment.setPayName("微信支付");
payment.setPayType("wechatPay");
payment.setReceived(payment.getAmount());
payment.setChangeFee(BigDecimal.ZERO);
payment.setMemberId(orderInfo.getMemberId());
@@ -250,12 +210,6 @@ public class PayService {
payment.setCreatedAt(System.currentTimeMillis());
tbOrderPaymentMapper.insert(payment);
} else {
if (payType.equals("wechatPay")) {
payment.setPayName("微信支付");
} else if (payType.equals("aliPay")) {
payment.setPayName("支付宝支付");
}
payment.setPayType(payType);
payment.setUpdatedAt(System.currentTimeMillis());
tbOrderPaymentMapper.updateByPrimaryKey(payment);
}
@@ -315,27 +269,10 @@ public class PayService {
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(thirdUrl,
appId,
reqbody,
reqbody,
PublicResp<WxScanPayResp> publicResp = thirdPayService.scanpay(thirdUrl, thirdApply.getAppId(),
reqbody, reqbody,
payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue(),
convertPayType,
smallAppid,
openId,
ip,
DateUtils.getsdfTimesSS(),
thirdApply.getStoreId(),
callFSTBack,
null,
appToken);
"WECHAT", thirdApply.getSmallAppid(), openId, ip, DateUtils.getsdfTimesSS(), thirdApply.getStoreId(), callFSTBack, null, thirdApply.getAppToken());
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
if ("000000".equals(publicResp.getCode())) {
WxScanPayResp wxScanPayResp = publicResp.getObjData();
@@ -384,7 +321,6 @@ public class PayService {
if (ObjectUtil.isEmpty(orderInfo)) {
return Result.fail("订单信息不存在");
}
if (System.currentTimeMillis() - orderInfo.getCreatedAt() > 60 * 15 * 1000) {
return Result.fail("订单十五分钟内有效,当前已超时,请重新下单。");
}
@@ -436,12 +372,11 @@ public class PayService {
TbShopUserFlow flow = new TbShopUserFlow();
flow.setShopUserId(Integer.valueOf(user.getId()));
flow.setBizCode("accountPay");
flow.setBizName("余额支付");
flow.setBizName("会员储值卡支付");
flow.setType("-");
flow.setAmount(orderInfo.getOrderAmount());
flow.setBalance(user.getAmount());
flow.setCreateTime(new Date());
flow.setIsReturn("0");
tbShopUserFlowMapper.insert(flow);
@@ -449,7 +384,6 @@ public class PayService {
orderInfo.setMemberId(memberId);
orderInfo.setPayType("deposit");
orderInfo.setStatus("closed");
orderInfo.setPaidTime(System.currentTimeMillis());
orderInfo.setPayOrderNo("deposit".concat(SnowFlakeUtil.generateOrderNo()));
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
//更新购物车状态
@@ -459,7 +393,7 @@ public class PayService {
tbOrderDetailMapper.updateStatusByOrderId(Integer.valueOf(orderId), "closed");
tbOrderDetailMapper.updateStatusByOrderIdAndStatus(Integer.valueOf(orderId), "closed");
outRecordMapper.updateByOrderIdAndStatus(orderInfo.getId(), "closed");
log.info("更新购物车:{}", cartCount);
JSONObject jsonObject = new JSONObject();
@@ -477,24 +411,6 @@ public class PayService {
data.put("orderId", orderInfo.getId());
data.put("plat", "miniApp");
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);
}
return Result.success(CodeEnum.SUCCESS, "1");
}
@@ -541,7 +457,6 @@ public class PayService {
flow.setAmount(orderInfo.getOrderAmount());
flow.setBalance(user.getAmount());
flow.setCreateTime(new Date());
flow.setIsReturn("0");
tbShopUserFlowMapper.insert(flow);
for (int i = 0; i < orderInfo.getNumber(); i++) {
@@ -580,11 +495,6 @@ public class PayService {
if (ObjectUtil.isEmpty(thirdApply) || ObjectUtil.isNull(thirdApply)) {
return Result.fail("支付通道不存在");
}
if ("aliPay".equals(payType) && StrUtil.isBlank(thirdApply.getAlipaySmallAppid())) {
return Result.fail("店铺未配置支付宝小程序appId");
}
StringBuffer body = new StringBuffer();
body.append(orderInfo.getProName());
TbOrderPayment payment = tbOrderPaymentMapper.selectByOrderId(orderInfo.getOrderNo());
@@ -662,21 +572,14 @@ public class PayService {
} else {
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(
thirdUrl,
appId,
thirdApply.getAppId(),
reqbody,
reqbody,
payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue(),
convertPayType,
smallAppid,
"WECHAT",
thirdApply.getSmallAppid(),
userId,
ip,
// orderInfo.getOrderNo(),
@@ -684,7 +587,7 @@ public class PayService {
thirdApply.getStoreId(),
callBackGroupurl,
null,
appToken);
thirdApply.getAppToken());
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
if ("000000".equals(publicResp.getCode())) {
WxScanPayResp wxScanPayResp = publicResp.getObjData();
@@ -769,7 +672,6 @@ public class PayService {
orderInfo.setPayType("wx_lite");
orderInfo.setPayOrderNo(payment.getTradeNumber());
orderInfo.setPayAmount(orderInfo.getOrderAmount());
orderInfo.setPaidTime(System.currentTimeMillis());
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
@@ -822,7 +724,6 @@ public class PayService {
orderInfo.setPayType("wx_lite");
orderInfo.setPayOrderNo(payment.getTradeNumber());
orderInfo.setPayAmount(orderInfo.getOrderAmount());
orderInfo.setPaidTime(System.currentTimeMillis());
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
@@ -967,13 +868,12 @@ public class PayService {
//更新子单状态
tbOrderDetailMapper.updateStatusByOrderIdAndStatus(orderInfo.getId(), "closed");
outRecordMapper.updateByOrderIdAndStatus(orderInfo.getId(), "closed");
//修改主单状态
orderInfo.setStatus("closed");
orderInfo.setPayType("wx_lite");
orderInfo.setPayOrderNo(payOrderNO);
orderInfo.setPayAmount(orderInfo.getOrderAmount());
orderInfo.setPaidTime(System.currentTimeMillis());
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
@@ -989,13 +889,6 @@ public class PayService {
sendOrderToClient(orderInfo);
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消息并保存库存记录
JSONObject data = new JSONObject();
data.put("orderId", orderInfo.getId());
@@ -1028,9 +921,8 @@ public class PayService {
orderInfo.setPayType("wx_lite");
orderInfo.setPayOrderNo(payOrderNO);
orderInfo.setPayAmount(orderInfo.getOrderAmount());
orderInfo.setPaidTime(System.currentTimeMillis());
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
outRecordMapper.updateByOrderIdAndStatus(orderInfo.getId(), "closed");
JSONObject jsonObject = new JSONObject();
jsonObject.put("token", 0);
@@ -1048,13 +940,6 @@ public class PayService {
sendOrderToClient(orderInfo);
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消息并保存库存记录
JSONObject data = new JSONObject();
data.put("orderId", orderInfo.getId());
@@ -1097,12 +982,7 @@ public class PayService {
public Result getActivate(String shopId, int page, int pageSize) {
PageHelper.startPage(page, pageSize);
List<TbActivate> list = tbActivateMapper.selectByShopId(shopId);
for (TbActivate tbActivate : list) {
if (tbActivate.getIsGiftPro() == 1) {
tbActivate.setGives(actProductMapper.queryProsByActivateId(tbActivate.getId()));
}
}
List<TbActivate> list = tbActivateMapper.selectByShpopId(shopId);
PageInfo pageInfo = new PageInfo(list);
return Result.success(CodeEnum.SUCCESS, pageInfo);
}
@@ -1198,59 +1078,43 @@ public class PayService {
flow.setAmount(memberIn.getAmount());
flow.setBalance(tbShopUser.getAmount());
flow.setCreateTime(new Date());
flow.setIsReturn("0");
tbShopUserFlowMapper.insert(flow);
//会员活动
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);
TbActivate activate = tbActivateMapper.selectByAmount(tbShopUser.getShopId(), memberIn.getAmount());
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;
switch (activate.getHandselType()) {
case "GD":
amount = activate.getHandselNum();
break;
case "RATIO":
amount = memAmount.multiply(activate.getHandselNum());
amount = memberIn.getAmount().multiply(activate.getHandselNum());
break;
}
tbShopUser.setAmount(tbShopUser.getAmount().add(amount));
tbShopUser.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser);
TbShopUserFlow flow = new TbShopUserFlow();
flow = new TbShopUserFlow();
flow.setShopUserId(Integer.valueOf(tbShopUser.getId()));
flow.setBizCode("scanMemberAwardIn");
flow.setBizName("充值活动奖励");
flow.setBizName("会员充值奖励");
flow.setType("+");
flow.setAmount(amount);
flow.setBalance(tbShopUser.getAmount());
flow.setCreateTime(new Date());
flow.setIsReturn("0");
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";
}
@@ -1296,27 +1160,42 @@ public class PayService {
flow.setAmount(memberIn.getAmount());
flow.setBalance(tbShopUser.getAmount());
flow.setCreateTime(new Date());
flow.setRemark(payOrderNO);
flow.setIsReturn("0");
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.put("shopId", memberIn.getShopId());
jsonObject.put("type", "wxMemberIn");
jsonObject.put("amount", memberIn.getAmount());
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";
}
@@ -1349,6 +1228,7 @@ public class PayService {
}
public Result paySongOrder(String openId, String shopId, Integer orderId, String ip, TbMerchantThirdApply thirdApply) throws JsonProcessingException {
if (ObjectUtil.isEmpty(openId) || Objects.isNull(openId)) {
return Result.fail("付款用户[openId]参数不能为空");

View File

@@ -75,14 +75,6 @@ public class ProductService {
@Autowired
private TbUserInfoMapper tbUserInfoMapper;
@Autowired
private TbProskuConMapper tbProskuConMapper;
@Autowired
private TbConsInfoMapper tbConsInfoMapper;
@Resource
private TbActivateInRecordService activateInRecordService;
public Result queryShopIdByTableCode(String userId, String openId, String code, String lat, String lng) {
if (StringUtils.isBlank(code)) return Result.fail("桌码信息为空");
if (StringUtils.isBlank(lat) || lat.equals("undefined")) {
@@ -144,41 +136,32 @@ public class ProductService {
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<>();
Integer id = ObjectUtil.isNotEmpty(productGroupId) ? Integer.valueOf(productGroupId) : null;
//招牌菜
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);
if (ObjectUtil.isNotEmpty(groupList) && groupList.size() > 0) {
//热销
TbProductGroup hot = new TbProductGroup();
hot.setName("热销");
List<TbProduct> hots = tbProductMapper.selectHot(shopId);
hot.setProducts(handleDate(hots,true,1,false));
hot.setProducts(handleDate(hots,true,1));
//商品
groupList.parallelStream().forEach(g -> {
if (g.getUseTime()==1) g.setIsSale(getIsSale(g.getSaleStartTime(),g.getSaleEndTime()));
String in = g.getProductIds().substring(1, g.getProductIds().length() - 1);
if (ObjectUtil.isNotEmpty(in) && ObjectUtil.isNotNull(in)) {
// List<TbProduct> products = tbProductMapper.selectByIdIn(in);
List<TbProduct> products = tbProductMapper.selectByIdInAndCheck(in);
g.setProducts(handleDate(products,false,g.getIsSale(),false));
g.setProducts(handleDate(products,false,g.getIsSale()));
} else {
g.setProducts(new ArrayList<>());
}
});
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);
concurrentMap.put("productInfo", groupList);
}
@@ -233,8 +216,7 @@ public class ProductService {
// 重组有效规格数据
String tagSnap = skuResult != null ? skuResult.getTagSnap() : null;
// List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectGroundingByProId(querySpecDTO.getProductId());
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectSku(String.valueOf(querySpecDTO.getProductId()));
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectGroundingByProId(querySpecDTO.getProductId());
JSONArray finalSnap = new JSONArray();
// if (tagSnap != null) {
@@ -316,17 +298,11 @@ public class ProductService {
}
ArrayList<HashMap<String, Object>> specList = new ArrayList<>();
HashMap<String, TbProductSku> unGroundingMap = new HashMap<>();
tbProductSkus.forEach(item -> {
if (item.getIsGrounding() == 1) {
HashMap<String, Object> itemMap = new HashMap<>();
itemMap.put("specSnap", item.getSpecSnap());
itemMap.put("skuId", item.getId());
itemMap.put("info", item);
specList.add(itemMap);
}else {
unGroundingMap.put(item.getSpecSnap(), item);
}
HashMap<String, Object> itemMap = new HashMap<>();
itemMap.put("specSnap", item.getSpecSnap());
itemMap.put("skuId", item.getId());
specList.add(itemMap);
});
@@ -336,14 +312,6 @@ public class ProductService {
for (HashMap<String, Object> spec : specList) {
if (res.equals(spec.get("specSnap").toString())) {
spec.put("isGrounding", true);
TbProductSku sku = (TbProductSku) spec.get("info");
if (sku != null) {
tbProduct.setIsPauseSale(tbProduct.getIsDistribute() == 1 ? tbProduct.getIsPauseSale() : sku.getIsPauseSale().byteValue());
checkPauseSale(tbProduct, new ArrayList<>(Collections.singletonList(sku)), true);
spec.put("isPauseSale", tbProduct.getIsPauseSale());
}else {
spec.put("isPauseSale", 1);
}
found = true;
break;
}
@@ -353,14 +321,6 @@ public class ProductService {
itemMap.put("specSnap", res);
itemMap.put("skuId", null);
itemMap.put("isGrounding", false);
TbProductSku sku = unGroundingMap.get("specSnap");
if (sku != null) {
tbProduct.setIsPauseSale(tbProduct.getIsDistribute() == 1 ? tbProduct.getIsPauseSale() : sku.getIsPauseSale().byteValue());
checkPauseSale(tbProduct, Collections.singletonList(sku), true);
itemMap.put("isPauseSale", tbProduct.getIsPauseSale());
}else {
itemMap.put("isPauseSale", 1);
}
otherVal.add(itemMap);
}
}
@@ -387,7 +347,7 @@ public class ProductService {
* @param check 是否校验可售
* @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)) {
products.parallelStream().forEach(it -> {
if(check){
@@ -409,11 +369,12 @@ public class ProductService {
it.setCartNumber("0");
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectGroundingByProId(it.getId());
TbProductSkuResult skuResult = tbProductSkuResultMapper.selectByPrimaryKey(it.getId());
//判断库存及耗材
checkPauseSale(it,tbProductSkus, false);
// 上下架对应的sku
// HashSet<String> specSet = new HashSet<>();
AtomicDouble sum = new AtomicDouble(0.0);
BigDecimal lowerPrice = null;
BigDecimal lowMemberPrice = null;
for (TbProductSku item : tbProductSkus) {
if (item.getRealSalesNumber() != null) {
sum.addAndGet(item.getRealSalesNumber());
@@ -421,19 +382,25 @@ public class ProductService {
if (lowerPrice == null || lowerPrice.compareTo(item.getSalePrice()) > 0) {
lowerPrice = item.getSalePrice();
}
if (lowMemberPrice == null || lowMemberPrice.compareTo(item.getMemberPrice()) > 0) {
lowMemberPrice = item.getMemberPrice();
}
}
//销量
// 销量
it.setStockNumber(sum.intValue());
// 售价
if (lowerPrice == null) {
lowerPrice = BigDecimal.ZERO;
}
//售价
it.setLowPrice(lowerPrice);
it.setProductSkuResult(skuResult);
if (isVip) {
it.setLowPrice(BigDecimal.ZERO);
it.setIsVip(Byte.parseByte("1"));
// 会员价
if (lowMemberPrice == null) {
lowMemberPrice = BigDecimal.ZERO;
}
it.setLowMemberPrice(lowMemberPrice);
it.setProductSkuResult(skuResult);
});
return products;
}else {
@@ -441,63 +408,9 @@ public class ProductService {
}
}
public void checkPauseSale(TbProduct tbProduct, List<TbProductSku> skus, boolean isSingle) {
if (tbProduct.getIsStock() == 1) {//库存开关 1开启
if (Integer.valueOf(tbProduct.getIsDistribute()).equals(1)) {//共享库存 1开启
if (tbProduct.getStockNumber() != null && tbProduct.getStockNumber() <= 0) {
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
return;
}
if (isSingle && tbProduct.getIsPauseSale() == 1) {
return;
}
} else {
if (isSingle && !skus.stream().filter(res -> res.getIsPauseSale().equals(1)).collect(Collectors.toList()).isEmpty()) {
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
return;
}
if (!tbProduct.getTypeEnum().equals("sku")) {
if (skus.stream().anyMatch(sku -> sku.getStockNumber() != null && sku.getStockNumber() <= 0)){
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
return;
}
} else {
skus.removeIf(sku -> sku.getStockNumber() != null && sku.getStockNumber() <= 0);
if (CollectionUtils.isEmpty(skus)) {
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
return;
}
}
}
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") ) {
public Result queryProductSku(String code, String shopId, String productId, String spec_tag) {
if (ObjectUtil.isEmpty(shopId) || ObjectUtil.isEmpty(productId)) {
return Result.fail("参数错误");
}
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByShopIdAndProductIdAndSpec(shopId, productId, spec_tag);
@@ -510,7 +423,7 @@ public class ProductService {
tbProductSkuWithBLOBs.setId(null);
}else {
if (StringUtils.isNotBlank(code)) {
Integer sum = tbProductMapper.selectByCodeAndSkuId(code, tbProductSkuWithBLOBs.getId(), shopId,isVip);
Integer sum = tbProductMapper.selectByCodeAndSkuId(code, tbProductSkuWithBLOBs.getId(), shopId);
tbProductSkuWithBLOBs.setNumber(sum);
}
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -1,22 +0,0 @@
package com.chaozhanggui.system.cashierservice.service;
import com.chaozhanggui.system.cashierservice.entity.dto.UserCouponDto;
import com.chaozhanggui.system.cashierservice.sign.Result;
/**
* (TbUserCoupons)表服务接口
*
* @author ww
* @since 2024-09-02 13:38:20
*/
public interface TbUserCouponsService {
/**
* 分页查询
*
* @param tbUserCoupons 筛选条件
* @return 查询结果
*/
Result queryByPage(UserCouponDto tbUserCoupons);
}

View File

@@ -1,6 +1,5 @@
package com.chaozhanggui.system.cashierservice.service;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.hutool.extra.qrcode.QrConfig;
@@ -22,7 +21,6 @@ import com.chaozhanggui.system.cashierservice.wxUtil.WxAccountUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.io.Resource;
@@ -273,57 +271,25 @@ public class UserService {
}
public Result openMember(OpenMemberVo memberVo) {
TbShopUser tbShopUser = shopUserMapper.selectByUserIdAndShopId(memberVo.getId().toString(), memberVo.getShopId().toString());
if (tbShopUser != null) {
tbShopUser.setName(StringUtils.isNotBlank(memberVo.getNickName()) ? memberVo.getNickName() : null);
tbShopUser.setHeadImg(StringUtils.isNotBlank(memberVo.getHeadImg()) ? memberVo.getHeadImg() : null);
TbUserInfo userInfo = new TbUserInfo();
userInfo.setId(memberVo.getId());
userInfo.setHeadImg(memberVo.getHeadImg());
userInfo.setNickName(memberVo.getNickName());
userInfo.setTelephone(memberVo.getTelephone());
userInfo.setBirthDay(memberVo.getBirthDay());
userInfoMapper.updateByPrimaryKeySelective(userInfo);
List<TbShopUser> tbShopUsers = shopUserMapper.selectAllByUserId(memberVo.getId().toString());
for (TbShopUser tbShopUser : tbShopUsers) {
tbShopUser.setTelephone(memberVo.getTelephone());
tbShopUser.setBirthDay(StringUtils.isNotBlank(memberVo.getBirthDay()) ? memberVo.getBirthDay() : null);
tbShopUser.setIsVip(Byte.parseByte("1"));
shopUserMapper.updateByPrimaryKeySelective(tbShopUser);
} else {
TbUserInfo tbUserInfo = userInfoMapper.selectByPrimaryKey(memberVo.getId());
tbShopUser = shopUserMapper.selectPCByPhoneAndShopId(memberVo.getTelephone(), memberVo.getShopId().toString());
if (tbShopUser != null) {
tbShopUser.setName(StringUtils.isNotBlank(memberVo.getNickName()) ? memberVo.getNickName() : null);
tbShopUser.setHeadImg(StringUtils.isNotBlank(memberVo.getHeadImg()) ? memberVo.getHeadImg() : null);
tbShopUser.setTelephone(memberVo.getTelephone());
tbShopUser.setBirthDay(StringUtils.isNotBlank(memberVo.getBirthDay()) ? memberVo.getBirthDay() : null);
tbShopUser.setUserId(tbUserInfo.getId().toString());
tbShopUser.setMiniOpenId(tbUserInfo.getMiniAppOpenId());
shopUserMapper.updateByPrimaryKeySelective(tbShopUser);
return Result.success(CodeEnum.SUCCESS);
}
tbShopUser = new TbShopUser();
tbShopUser.setName(StringUtils.isNotBlank(memberVo.getNickName()) ? memberVo.getNickName() : null);
tbShopUser.setSex(Byte.parseByte("1"));
tbShopUser.setBirthDay(StringUtils.isNotBlank(memberVo.getBirthDay()) ? memberVo.getBirthDay() : null);
tbShopUser.setLevel(Byte.parseByte("1"));
String dynamicCode = RandomUtil.randomNumbers(8);
tbShopUser.setCode(dynamicCode);
tbShopUser.setTelephone(memberVo.getTelephone());
tbShopUser.setAmount(BigDecimal.ZERO);
tbShopUser.setIsVip(Byte.parseByte("1"));
tbShopUser.setCreditAmount(BigDecimal.ZERO);
tbShopUser.setConsumeAmount(BigDecimal.ZERO);
tbShopUser.setConsumeNumber(0);
tbShopUser.setLevelConsume(BigDecimal.ZERO);
tbShopUser.setStatus(Byte.parseByte("1"));
tbShopUser.setShopId(memberVo.getShopId().toString());
tbShopUser.setUserId(tbUserInfo.getId().toString());
tbShopUser.setMiniOpenId(tbUserInfo.getMiniAppOpenId());
tbShopUser.setCreatedAt(System.currentTimeMillis());
tbShopUser.setUpdatedAt(System.currentTimeMillis());
shopUserMapper.insertSelective(tbShopUser);
shopUserMapper.updateByPrimaryKey(tbShopUser);
}
return Result.success(CodeEnum.SUCCESS);
}
public Result upVipPhont(OpenMemberVo memberVo) {
TbShopUser shopUser = new TbShopUser();
shopUser.setId(memberVo.getId().toString());
shopUser.setTelephone(memberVo.getTelephone());
shopUserMapper.updateByPrimaryKeySelective(shopUser);
TbShopUser tbShopUser = shopUserMapper.selectByUserIdAndShopId(memberVo.getId().toString(), memberVo.getShopId().toString());
tbShopUser.setName(memberVo.getNickName());
tbShopUser.setHeadImg(memberVo.getHeadImg());
tbShopUser.setTelephone(memberVo.getTelephone());
tbShopUser.setBirthDay(memberVo.getBirthDay());
tbShopUser.setIsVip(Byte.parseByte("1"));
shopUserMapper.updateByPrimaryKey(tbShopUser);
return Result.success(CodeEnum.SUCCESS);
}
}

View File

@@ -1,91 +0,0 @@
package com.chaozhanggui.system.cashierservice.service.impl;
import com.chaozhanggui.system.cashierservice.dao.TbActivateInRecordMapper;
import com.chaozhanggui.system.cashierservice.entity.TbActivateInRecord;
import com.chaozhanggui.system.cashierservice.entity.TbProduct;
import com.chaozhanggui.system.cashierservice.service.TbActivateInRecordService;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 活动商品赠送表(TbActivateInRecord)表服务实现类
*
* @author ww
* @since 2024-08-22 11:13:40
*/
@Service
@Primary
public class TbActivateInRecordServiceImpl implements TbActivateInRecordService {
@Resource
private TbActivateInRecordMapper tbActivateInRecordMapper;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public TbActivateInRecord queryById(Integer id) {
return this.tbActivateInRecordMapper.queryById(id);
}
@Override
public List<TbProduct> queryByVipIdAndShopId(Integer vipUserId, Integer shopId) {
return tbActivateInRecordMapper.queryByVipIdAndShopId(vipUserId, shopId);
}
@Override
public int queryByVipIdAndShopIdAndProId(Integer vipUserId, Integer shopId,Integer productId){
return tbActivateInRecordMapper.queryByVipIdAndShopIdAndProId(vipUserId,shopId,productId);
}
@Override
public List<TbActivateInRecord> queryAllByVipIdAndShopIdAndProId(Integer vipUserId, Integer shopId,Integer productId){
return tbActivateInRecordMapper.queryAllByVipIdAndShopIdAndProId(vipUserId,shopId,productId);
}
/**
* 新增数据
*
* @param tbActivateInRecord 实例对象
* @return 实例对象
*/
@Override
public TbActivateInRecord insert(TbActivateInRecord tbActivateInRecord) {
this.tbActivateInRecordMapper.insert(tbActivateInRecord);
return tbActivateInRecord;
}
/**
* 修改数据
*
* @param tbActivateInRecord 实例对象
* @return 实例对象
*/
@Override
public TbActivateInRecord update(TbActivateInRecord tbActivateInRecord) {
this.tbActivateInRecordMapper.update(tbActivateInRecord);
return this.queryById(tbActivateInRecord.getId());
}
@Override
public int updateOverNumById(Integer id,Integer overNum){
return tbActivateInRecordMapper.updateOverNumById(id,overNum);
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Integer id) {
return this.tbActivateInRecordMapper.deleteById(id) > 0;
}
}

View File

@@ -1,69 +0,0 @@
package com.chaozhanggui.system.cashierservice.service.impl;
import com.chaozhanggui.system.cashierservice.entity.TbActivateOutRecord;
import com.chaozhanggui.system.cashierservice.dao.TbActivateOutRecordMapper;
import com.chaozhanggui.system.cashierservice.service.TbActivateOutRecordService;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 活动赠送商品使用记录表(TbActivateOutRecord)表服务实现类
*
* @author ww
* @since 2024-08-22 11:21:56
*/
@Service
@Primary
public class TbActivateOutRecordServiceImpl implements TbActivateOutRecordService {
@Resource
private TbActivateOutRecordMapper tbActivateOutRecordMapper;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public TbActivateOutRecord queryById(Integer id) {
return this.tbActivateOutRecordMapper.queryById(id);
}
/**
* 新增数据
*
* @param tbActivateOutRecord 实例对象
* @return 实例对象
*/
@Override
public TbActivateOutRecord insert(TbActivateOutRecord tbActivateOutRecord) {
this.tbActivateOutRecordMapper.insert(tbActivateOutRecord);
return tbActivateOutRecord;
}
/**
* 修改数据
*
* @param tbActivateOutRecord 实例对象
* @return 实例对象
*/
@Override
public TbActivateOutRecord update(TbActivateOutRecord tbActivateOutRecord) {
this.tbActivateOutRecordMapper.update(tbActivateOutRecord);
return this.queryById(tbActivateOutRecord.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Integer id) {
return this.tbActivateOutRecordMapper.deleteById(id) > 0;
}
}

View File

@@ -1,69 +0,0 @@
package com.chaozhanggui.system.cashierservice.service.impl;
import com.chaozhanggui.system.cashierservice.dao.TbActivateProductMapper;
import com.chaozhanggui.system.cashierservice.entity.TbActivateProduct;
import com.chaozhanggui.system.cashierservice.service.TbActivateProductService;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 活动赠送商品表(TbActivateProduct)表服务实现类
*
* @author ww
* @since 2024-08-20 15:15:02
*/
@Service
@Primary
public class TbActivateProductServiceImpl implements TbActivateProductService {
@Resource
private TbActivateProductMapper tbActivateProductMapper;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public TbActivateProduct queryById(Integer id) {
return this.tbActivateProductMapper.queryById(id);
}
/**
* 新增数据
*
* @param tbActivateProduct 实例对象
* @return 实例对象
*/
@Override
public TbActivateProduct insert(TbActivateProduct tbActivateProduct) {
this.tbActivateProductMapper.insert(tbActivateProduct);
return tbActivateProduct;
}
/**
* 修改数据
*
* @param tbActivateProduct 实例对象
* @return 实例对象
*/
@Override
public TbActivateProduct update(TbActivateProduct tbActivateProduct) {
this.tbActivateProductMapper.update(tbActivateProduct);
return this.queryById(tbActivateProduct.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Integer id) {
return this.tbActivateProductMapper.deleteById(id) > 0;
}
}

View File

@@ -1,71 +0,0 @@
package com.chaozhanggui.system.cashierservice.service.impl;
import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
import com.chaozhanggui.system.cashierservice.entity.dto.UserCouponDto;
import com.chaozhanggui.system.cashierservice.entity.vo.ShopUserListVo;
import com.chaozhanggui.system.cashierservice.entity.vo.UserCouponVo;
import com.chaozhanggui.system.cashierservice.service.TbUserCouponsService;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* (TbUserCoupons)表服务实现类
*
* @author ww
* @since 2024-09-02 13:38:20
*/
@Primary
@Service
public class TbUserCouponsServiceImpl implements TbUserCouponsService {
@Resource
private TbUserCouponsMapper tbUserCouponsMapper;
@Resource
private TbActivateInRecordMapper inRecordMapper;
@Resource
private TbActivateOutRecordMapper outRecordMapper;
@Autowired
private TbShopUserMapper tbShopUserMapper;
@Autowired
private TbShopInfoMapper tbShopInfoMapper;
/**
* 分页查询
* @return 查询结果
*/
@Override
public Result queryByPage(UserCouponDto couponDto) {
// PageHelper.startPage(couponDto.getPage(), couponDto.getSize());
// List<TbUserCoupons> result = tbUserCouponsMapper.queryAllSelective(couponDto);
// return new Result(CodeEnum.SUCCESS, new PageInfo<>(result));
// List<UserCouponVo> result = tbUserCouponsMapper.queryAllSelective(couponDto);
List<UserCouponVo> result = new ArrayList<>();
List<ShopUserListVo> tbShopUsers = tbShopUserMapper.selectByUserId(couponDto.getUserId().toString(), couponDto.getShopId()==null?null:couponDto.getShopId().toString());
if (!CollectionUtils.isEmpty(tbShopUsers)) {
tbShopUsers.forEach(s -> {
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(s.getShopId().intValue());
if (couponDto.getStatus()==null || (couponDto.getStatus() != null && couponDto.getStatus() == 0)) {
List<UserCouponVo> unuseCoupon = inRecordMapper.queryVipPro(s.getMemberId().intValue(), s.getShopId().intValue(),shopInfo.getShopName());
result.addAll(unuseCoupon);
}
if (couponDto.getStatus()==null || (couponDto.getStatus() != null && couponDto.getStatus() == 1)) {
List<UserCouponVo> useCoupon = outRecordMapper.queryVipPro(s.getMemberId().intValue(), s.getShopId().intValue(),shopInfo.getShopName());
result.addAll(useCoupon);
}
});
}
return new Result(CodeEnum.SUCCESS, result);
}
}

View File

@@ -2,7 +2,6 @@ package com.chaozhanggui.system.cashierservice.util;
import cn.hutool.core.util.ObjectUtil;
import com.chaozhanggui.system.cashierservice.model.OrderDetailPO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
@@ -15,7 +14,6 @@ import java.util.*;
/**
* 打印机
*/
@Slf4j
public class PrinterUtils {
//请求地址
private static final String URL_STR = "https://ioe.car900.com/v1/openApi/dev/customPrint.json";
@@ -85,41 +83,6 @@ public class PrinterUtils {
return builder.toString();
}
/**
* 厨房打印机
*
* @param pickupNumber
* @param date
* @param productName
* @param number
* @param remark
* @return
*/
public static String getPrintData(String type, String pickupNumber, String date, String productName, Integer number, String remark) {
StringBuilder builder = new StringBuilder();
if ("return".equals(type)) {
builder.append("<C><B>" + pickupNumber + "【退】</B></C><BR><BR>");
} else {
builder.append("<C><B>" + pickupNumber + "</B></C><BR><BR>");
}
builder.append("<S><L>时间: " + date + " </L></S><BR><BR><BR>");
if (productName.length() > 4 || remark.length() > 4) {
builder.append("<CS:32>" + productName + " " + number + "</CS><BR>");
builder.append("<CS:32>" + remark + " </CS><BR>");
} else {
builder.append("<B>" + productName + " " + number + "</B><BR>");
builder.append("<B>" + remark + " </B><BR>");
}
builder.append("<OUT:150>");
builder.append("<PCUT>");
return builder.toString();
}
public static String getCashPrintData(OrderDetailPO detailPO,String type){
StringBuilder sb = new StringBuilder();
@@ -199,46 +162,7 @@ public class PrinterUtils {
/**
* 打印票据
*
* @throws Exception
*/
public static void printTickets(String voiceJson, Integer actWay, Integer cn, String devName, String data) {
log.info("开始请求云享印,请求数据:{}, {}", voiceJson, data);
//设备名称
//行为方式 1:只打印数据 2:只播放信息 3:打印数据并播放信息
// actWay = 3;
// //打印联数
// int cn = 1;
//打印内容
//播报语音数据体,字段参考文档IOT_XY_API11001
String time = String.valueOf(System.currentTimeMillis());
String uuid = UUID.randomUUID().toString();
Map<String, String> param = getToken(time, uuid);
//参数
MultiValueMap<String, Object> multiValueMap = new LinkedMultiValueMap<>();
multiValueMap.add("token", param.get("TOKEN"));
multiValueMap.add("devName", devName);
multiValueMap.add("actWay", actWay);
multiValueMap.add("cn", cn);
multiValueMap.add("data", data);
multiValueMap.add("voiceJson", voiceJson);
multiValueMap.add("appId", APP_ID);
multiValueMap.add("timestamp", time);
multiValueMap.add("requestId", uuid);
multiValueMap.add("userCode", USER_CODE);
RestTemplate restTemplate = new RestTemplate();
HttpHeaders header = new HttpHeaders();
header.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(multiValueMap, header);
String httpResponse = restTemplate.postForObject(URL_STR,
httpEntity, String.class);
System.out.println("map" + httpResponse);
}

View File

@@ -23,11 +23,11 @@ import java.util.Map;
@Slf4j
@Component
public class WxAccountUtil {
// @Value("${wx.ysk.appId}")
@Value("${wx.ysk.appId}")
private static String appId = "wx212769170d2c6b2a";
// @Value("${wx.ysk.secrete}")
@Value("${wx.ysk.secrete}")
private static String secrete = "8492a7e8d55bbb1b57f5c8276ea1add0";
// @Value("${wx.ysk.warnMsgTmpId}")
@Value("${wx.ysk.warnMsgTmpId}")
private static String msgTmpId = "C08OUr80x6wGmUN1zpFhSQ3Sv7VF5vksdZigiEx2pD0";
private final TbShopMsgStateMapper shopMsgStateMapper;

View File

@@ -1,8 +1,11 @@
spring:
datasource:
url: jdbc:mysql://rm-bp1kn7h89nz62cno1ro.mysql.rds.aliyuncs.com:3306/fycashier_test?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true
username: cashier
password: Cashier@1@
# url: jdbc:mysql://121.40.128.145:3306/fycashier?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false
# username: root
# password: mysqlroot@123
url: jdbc:mysql://101.37.12.135:3306/fycashier?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true
username: fycashier
password: Twc6MrzzjBiWSsjh
driver-class-name: com.mysql.cj.jdbc.Driver
initialSize: 5
minIdle: 5

View File

@@ -1,9 +1,8 @@
spring:
datasource:
# 内网地址
url: jdbc:mysql://rm-bp1kn7h89nz62cno1.mysql.rds.aliyuncs.com:3306/fycashier_pre?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true
username: cashier
password: Cashier@1@
url: jdbc:mysql://121.40.128.145:3306/fycashier?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: mysqlroot@123
driver-class-name: com.mysql.cj.jdbc.Driver
initialSize: 5
minIdle: 5
@@ -16,7 +15,7 @@ spring:
# redis数据库索引默认为0我们使用索引为3的数据库避免和其他数据库冲突
database: 0
# redis服务器地址默认为localhost
host: localhost
host: 101.37.12.135
# redis端口默认为6379
port: 6379
# redis访问密码默认为空
@@ -34,11 +33,12 @@ spring:
main:
allow-circular-references: true
rabbitmq:
host: localhost
host: 101.37.12.135
port: 5672
username: admin
password: Czg666888
mybatis:
configuration:
map-underscore-to-camel-case: true
@@ -55,12 +55,9 @@ thirdPay:
callFSTBack: https://wxcashiertest.sxczgkj.cn/cashierService/notify/notifyfstCallBack
songOrderBack: https://wxcashiertest.sxczgkj.cn/cashierService/notify/songOrderCallBack
server:
port: 9888
prod: dev1
queue: cart_queue_putdev1
subscribe:
message:
miniprogramState: trial
port: 9889
prod: devyhq
queue: cart_queue_putdevyhq

View File

@@ -0,0 +1,53 @@
spring:
datasource:
url: jdbc:mysql://121.40.128.145:3306/fycashier?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: mysqlroot@123
driver-class-name: com.mysql.cj.jdbc.Driver
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
logging:
level:
com.chaozhanggui.system.openness: info
redis:
# redis数据库索引默认为0我们使用索引为3的数据库避免和其他数据库冲突
database: 0
# redis服务器地址默认为localhost
host: 101.37.12.135
# redis端口默认为6379
port: 6379
# redis访问密码默认为空
password: 111111
# redis连接超时时间单位为毫秒
timeout: 1000
block-when-exhausted: true
# redis连接池配置
jedis:
pool:
max-active: 8
max-idle: 1024
min-idle: 0
max-wait: -1
main:
allow-circular-references: true
rabbitmq:
host: 101.37.12.135
port: 5672
username: admin
password: Czg666888
mybatis:
configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mapper-locations: classpath:mapper/*.xml
ysk:
url: https://gatewaytestapi.sxczgkj.cn/gate-service/
callBackurl: https://cashierapplet.sxczgkj.cn/cashierService/notify/notifyCallBack
callBackGroupurl: https://cashierapplet.sxczgkj.cn/cashierService/notify/notifyCallBackGroup
callBackIn: https://cashierapplet.sxczgkj.cn/cashierService/notify/memberInCallBack
default: 18710449883

View File

@@ -24,20 +24,7 @@ wx:
appId: wx212769170d2c6b2a
secrete: 8492a7e8d55bbb1b57f5c8276ea1add0
warnMsgTmpId: C08OUr80x6wGmUN1zpFhSQ3Sv7VF5vksdZigiEx2pD0
alipay:
sdk:
config:
serverUrl: https://openapi.alipay.com/gateway.do
appId: 2021004145625815
privateKey: MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCAjDBuS8K/IJb9ui+KuNm/sTUdEiaji4BNpZ92avO1N5JpNlGmac6ec4p3tNFT950sBLcQkClcUpQxUHQzAT6DYNNXOKyvfI/EmcqwCw6PaMNLs/8cV//J2WWZBUhLaOsjKurpm9/3W5MnTh4BGxIfBoeBMA8f8K3BgKdmyKtvIEV2h2cyjsMskdn+g6oNZcmWcms0pvpPHyH46mRaGFhpp0v19wX3WsamGldh1L2VntmaDN3C2XbSrXv90XYp5bEUqwTbLwXpMAlzTibF56d/iqv9oYi8cpAKougUFLOymnbutLNs2tLrEDSFwHcmG2/wbZHybZyYcIgFgv4arf+tAgMBAAECggEAf7hKKlw1y6Z6vvAtalxNZUuRZSfyog3p1bwYWxTavZPQcZ7Zs0lvVDmiO1u5m/7q96BbryY9IhCeUv0H5uF2lhwu/3s9AEL3qTPQkeb6eXxyhhX6A9RfPdM1Qbtg4CQHdHKg4qjP9znSVHwmDZ0y/QaEvdPdQzPjv92u9c2tn4N4x6XyBYcU5gzxiJNnIugCmBgcJo/3H2fgV+XXEhORPvy5of9b4oATHEaLS/8dAS2wuOjhzaGS4MXp3VkXn3XaYjwSzaL03qYWA+xm+aO5sJv8bmqZW7sNVck5o3sPo7cQ4VkBFVzyrRdmJcxcSRJ9MsB9JsrhoKI8pgaXrVie4QKBgQDU2vai0lpBIK/0jzRpPNoqdT8lnafnnWni8nU4kfAh+gCLi+HBPhQRT0kv4unQc2q2/gALE7sgZVO00JGY5a3R0orsojPoUSZlpypGW7GGqKy576NHn0nw4o/PdfysT92VWgt1hlfTf6qfCDhfE9APU+RGvlSWXcT8nxVel3iUaQKBgQCamoJN6+4v+chJvL2nqV8NVVRLp0vDIHxs1QOtKwUodx8Qp1D6CJYtavCXn8aNUFVNQJPJ7TQPpJjXP2rI4SN01weDwx+I+wh8PBGHV6/234R+6TvFgY1PrYgCdfNP4i/E7B4uyEhAxdU73PB8qkqRAeJGok05p7oG71KCOBiYpQKBgEZfGflcuDAeAW5GRhqg3rP4zWa/R7qgZVh9tll8jjp9b96y4XFE99d9MgId8BVVgyt6sEL5Q/2C4ni+F9TH4n6jMADp42VkJuCmsqhOOlP9whU67+2G8Sgtj0QUivPg964f9ffl8XVgGOW5DwIIB9p5btggptCLscufQK5kP545AoGADBvf6tR4wl8w9b2HqTMV08iEIqzGvVC1Dh0c/Zop/EJgN4CzUfIMOSBwGaAVAApzs+pD6QPgGP2OTwWTioo/qa4R05sbxDHNN1XJFa2jhZV6HiqMWOrNs5jm1zJ/zRjtHuJTdtyO9CvKiLbESy9XScY4/8lEfSiK5HIoJzTXkFUCgYAkYkvkW6psJpWj05XWq44UN0n6QOU/Igl35Um/iuOMVhsTmIt09STQVTuzJzfH82+sCqoRsD1blE5unKNUC1DK77aNKTv3Z0dxN9R7FAyfZRiYQXTrbBPBqWjay6FCNxn8e8UsJN4Z6FIV2LGlQI114krSap1MALKLVvnld0NaUQ==
alipayPublicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiQkrz+emAuS1mB3KKDOMmAZRd/BlPbh7fAIHAqAj1+QCZNcV3o2BTLIIqnuKpSlFXDG3uDzp2VsBxcizXuBbFyPGylnD9CgCj5abyh3+FIHPAZ2IM3TtpqImZ0TSPGXrMli4Nir7MvZktgccCqQKCC4o6iaDGz+UwWwJUIPna8fm2tiTZ+KH150CZbKVj4ZGNpBh5XSV/1dRgyQIV9D/EwSbkZ0n6VgKQLJBi0C2UE3QB17aL1Ir6+gDXIDbknN8O7GUD3aMGdThYdSRUb5wp9CZ5qfV7vCS/CgaRo38nhH3NOzkTL+7v0m1ZDHPmqEkn9VzZN6sCQdL7PoAOjHOCwIDAQAB
encryptKey: Hp1TbhOqevbHCA5ji/VlqQ==
decorator:
datasource:
p6spy:
logging: file
log-file: spy.log
log-format: executionTime:%(executionTime) ms | sql:%(sqlSingleLine)
#
spring:
profiles:
@@ -68,7 +55,7 @@ logging:
# web日志
org.springframework.web: debug
# mybatis日志
org.apache.ibatis: debug
org.mybatis: debug
charset:
# 输出控制台编码
console: UTF-8

View File

@@ -1,189 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbActivateInRecordMapper">
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbActivateInRecord" id="TbActivateInRecordMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="vipUserId" column="vip_user_id" jdbcType="INTEGER"/>
<result property="proId" column="pro_id" jdbcType="INTEGER"/>
<result property="num" column="num" jdbcType="INTEGER"/>
<result property="overNum" column="over_num" jdbcType="INTEGER"/>
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
<result property="sourceActId" column="source_act_id" jdbcType="INTEGER"/>
<result property="sourceFlowId" column="source_flow_id" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id
, vip_user_id, pro_id, num, over_num, shop_id, source_act_id, source_flow_id, create_time, update_time </sql>
<!--查询单个-->
<select id="queryById" resultMap="TbActivateInRecordMap">
select
<include refid="Base_Column_List"/>
from tb_activate_in_record
where id = #{id}
</select>
<select id="queryByVipIdAndShopId" resultType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
SELECT
tb_product.*, sum(tb_activate_in_record.over_num) as limitNumber
FROM
tb_activate_in_record
LEFT JOIN tb_product ON tb_activate_in_record.pro_id = tb_product.id
WHERE
vip_user_id = #{vipUserId} and tb_activate_in_record.shop_id = #{shopId}
group by tb_activate_in_record.pro_id
</select>
<select id="queryVipPro" resultType="com.chaozhanggui.system.cashierservice.entity.vo.UserCouponVo">
SELECT tb_product.name as detail,
0 as status,
sum(tb_activate_in_record.over_num) as num,
<choose>
<when test="shopName != null and shopName != ''">#{shopName}</when>
<otherwise>''</otherwise>
</choose> AS shopName,
2 as type
FROM tb_activate_in_record
LEFT JOIN tb_product ON tb_activate_in_record.pro_id = tb_product.id
WHERE vip_user_id = #{vipUserId}
and tb_activate_in_record.shop_id = #{shopId}
and num!=0
group by tb_activate_in_record.pro_id
</select>
<select id="queryByVipIdAndShopIdAndProId" resultType="INTEGER">
SELECT
sum(tb_activate_in_record.num)
FROM
tb_activate_in_record
WHERE
vip_user_id = #{vipUserId} and shop_id = #{shopId} and pro_id = #{productId}
</select>
<select id="queryAllByVipIdAndShopIdAndProId" resultMap="TbActivateInRecordMap">
select
<include refid="Base_Column_List"/>
from tb_activate_in_record
WHERE
vip_user_id = #{vipUserId}
and shop_id = #{shopId}
and pro_id = #{productId}
and over_num > 0
order by create_time
</select>
<!--查询指定行数据-->
<select id="queryAll" resultMap="TbActivateInRecordMap">
select
<include refid="Base_Column_List"/>
from tb_activate_in_record
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="vipUserId != null">
and vip_user_id = #{vipUserId}
</if>
<if test="proId != null">
and pro_id = #{proId}
</if>
<if test="num != null">
and num = #{num}
</if>
<if test="overNum != null">
and over_num = #{overNum}
</if>
<if test="shopId != null">
and shop_id = #{shopId}
</if>
<if test="sourceActId != null">
and source_act_id = #{sourceActId}
</if>
<if test="sourceFlowId != null">
and source_flow_id = #{sourceFlowId}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into tb_activate_in_record(vip_user_id, pro_id, num, over_num, shop_id, source_act_id, source_flow_id,
create_time, update_time)
values (#{vipUserId}, #{proId}, #{num}, #{overNum}, #{shopId}, #{sourceActId}, #{sourceFlowId}, #{createTime},
#{updateTime})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into tb_activate_in_record(vip_user_id, pro_id, num, over_num, shop_id, source_act_id, source_flow_id,
create_time, update_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.vipUserId}, #{entity.proId}, #{entity.num}, #{entity.overNum}, #{entity.shopId},
#{entity.sourceActId}, #{entity.sourceFlowId}, #{entity.createTime}, #{entity.updateTime})
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update tb_activate_in_record
<set>
<if test="vipUserId != null">
vip_user_id = #{vipUserId},
</if>
<if test="proId != null">
pro_id = #{proId},
</if>
<if test="num != null">
num = #{num},
</if>
<if test="overNum != null">
over_num = #{overNum},
</if>
<if test="shopId != null">
shop_id = #{shopId},
</if>
<if test="sourceActId != null">
source_act_id = #{sourceActId},
</if>
<if test="sourceFlowId != null">
source_flow_id = #{sourceFlowId},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
</set>
where id = #{id}
</update>
<update id="updateOverNumById">
update tb_activate_in_record
set
over_num = #{overNum}
where id = #{id};
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from tb_activate_in_record
where id = #{id}
</delete>
</mapper>

View File

@@ -9,10 +9,9 @@
<result column="handsel_num" jdbcType="DECIMAL" property="handselNum" />
<result column="handsel_type" jdbcType="VARCHAR" property="handselType" />
<result column="is_del" jdbcType="VARCHAR" property="isDel" />
<result column="is_gift_pro" jdbcType="INTEGER" property="isGiftPro" />
</resultMap>
<sql id="Base_Column_List">
id, shop_id, min_num, max_num, handsel_num, handsel_type, is_del,is_gift_pro
id, shop_id, min_num, max_num, handsel_num, handsel_type, is_del
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
@@ -117,16 +116,10 @@
</update>
<select id="selectByAmount" resultMap="BaseResultMap">
select *
from tb_activate
where shop_id = #{shopId}
and is_del = 0
and min_num &lt;= #{amount}
and max_num &gt;= #{amount}
order by max_num desc limit 1
</select>
select * from tb_activate where shop_id=#{shopId} and is_del=0 and min_num &lt;= #{amount} and max_num &gt;= #{amount}
</select>
<select id="selectByShopId" resultMap="BaseResultMap">
<select id="selectByShpopId" resultMap="BaseResultMap">
select * from tb_activate where shop_id=#{shopId}
</select>
</mapper>

View File

@@ -1,149 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbActivateOutRecordMapper">
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbActivateOutRecord" id="TbActivateOutRecordMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="giveId" column="give_id" jdbcType="INTEGER"/>
<result property="proId" column="pro_id" jdbcType="INTEGER"/>
<result property="useNum" column="use_num" jdbcType="INTEGER"/>
<result property="refNum" column="ref_num" jdbcType="INTEGER"/>
<result property="orderId" column="order_id" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id
, give_id, pro_id, use_num, ref_num, order_id,status, create_time, update_time </sql>
<!--查询单个-->
<select id="queryById" resultMap="TbActivateOutRecordMap">
select
<include refid="Base_Column_List"/>
from tb_activate_out_record
where id = #{id}
</select>
<select id="queryVipPro" resultType="com.chaozhanggui.system.cashierservice.entity.vo.UserCouponVo">
SELECT tb_product.NAME AS detail,
1 AS status,
tb_activate_out_record.use_num AS num,
<choose>
<when test="shopName != null and shopName != ''">#{shopName}</when>
<otherwise>''</otherwise>
</choose>
AS shopName,
2 AS type
FROM tb_activate_out_record
LEFT JOIN tb_product ON tb_activate_out_record.pro_id = tb_product.id
LEFT JOIN tb_activate_in_record ON tb_activate_in_record.id = tb_activate_out_record.give_id
WHERE vip_user_id = #{vipUserId}
AND tb_activate_in_record.shop_id = #{shopId}
AND tb_activate_out_record.STATUS = 'closed'
</select>
<!--查询指定行数据-->
<select id="queryAll" resultMap="TbActivateOutRecordMap">
select
<include refid="Base_Column_List"/>
from tb_activate_out_record
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="giveId != null">
and give_id = #{giveId}
</if>
<if test="proId != null">
and pro_id = #{proId}
</if>
<if test="useNum != null">
and use_num = #{useNum}
</if>
<if test="refNum != null">
and ref_num = #{refNum}
</if>
<if test="orderId != null and orderId != ''">
and order_id = #{orderId}
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into tb_activate_out_record(give_id, pro_id, use_num, ref_num, order_id, status, create_time, update_time)
values (#{giveId}, #{proId}, #{useNum}, #{refNum}, #{orderId}, #{status} #{createTime}, #{updateTime})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into tb_activate_out_record(give_id, pro_id, use_num, ref_num, order_id, status, create_time, update_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.giveId}, #{entity.proId}, #{entity.useNum}, #{entity.refNum}, #{entity.orderId},
#{entity.status}, #{entity.createTime}, #{entity.updateTime})
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update tb_activate_out_record
<set>
<if test="giveId != null">
give_id = #{giveId},
</if>
<if test="proId != null">
pro_id = #{proId},
</if>
<if test="useNum != null">
use_num = #{useNum},
</if>
<if test="refNum != null">
ref_num = #{refNum},
</if>
<if test="orderId != null and orderId != ''">
order_id = #{orderId},
</if>
<if test="status != null and status != ''">
status = #{status},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
</set>
where id = #{id}
</update>
<update id="updateByOrderIdAndStatus">
update tb_activate_out_record
set
status = 'closed'
where order_id = #{orderId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from tb_activate_out_record
where id = #{id}
</delete>
</mapper>

View File

@@ -1,113 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbActivateProductMapper">
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbActivateProduct" id="TbActivateProductMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="activateId" column="activate_id" jdbcType="INTEGER"/>
<result property="productId" column="product_id" jdbcType="INTEGER"/>
<result property="num" column="num" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, activate_id, product_id, num, create_time, update_time </sql>
<!--查询单个-->
<select id="queryById" resultMap="TbActivateProductMap">
select
<include refid="Base_Column_List"/>
from tb_activate_product
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAll" resultMap="TbActivateProductMap">
select
<include refid="Base_Column_List"/>
from tb_activate_product
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="activateId != null">
and activate_id = #{activateId}
</if>
<if test="productId != null">
and product_id = #{productId}
</if>
<if test="num != null">
and num = #{num}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
</where>
</select>
<select id="queryAllByActivateId" resultMap="TbActivateProductMap">
select
<include refid="Base_Column_List"/>
from tb_activate_product
where
activate_id = #{activateId}
</select>
<select id="queryProsByActivateId" resultType="java.lang.String">
select CONCAT(tb_product.name, '*', SUM(tb_activate_product.num))
from tb_activate_product
LEFT JOIN tb_product ON tb_activate_product.product_id = tb_product.id
where activate_id = #{activateId}
group by tb_activate_product.product_id
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into tb_activate_product(activate_id, product_id, num, create_time, update_time)
values (#{activateId}, #{productId}, #{num}, #{createTime}, #{updateTime})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into tb_activate_product(activate_id, product_id, num, create_time, update_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.activateId}, #{entity.productId}, #{entity.num}, #{entity.createTime}, #{entity.updateTime})
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update tb_activate_product
<set>
<if test="activateId != null">
activate_id = #{activateId},
</if>
<if test="productId != null">
product_id = #{productId},
</if>
<if test="num != null">
num = #{num},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from tb_activate_product where id = #{id}
</delete>
</mapper>

View File

@@ -33,12 +33,11 @@
<result column="pending_at" jdbcType="BIGINT" property="pendingAt"/>
<result column="uuid" jdbcType="VARCHAR" property="uuid"/>
<result column="sku_name" jdbcType="VARCHAR" property="skuName"/>
<result column="is_vip" jdbcType="TINYINT" property="isVip" />
</resultMap>
<sql id="Base_Column_List">
id, master_id, order_id, ref_order_id, total_amount, product_id, cover_img, is_sku,pack_fee,is_pack,is_gift,pending_at,
sku_id, name, sale_price, number, total_number, refund_number, category_id, status,
type, merchant_id, shop_id, created_at, updated_at, user_id, table_id,pack_fee,trade_day,uuid,sku_name,is_vip
type, merchant_id, shop_id, created_at, updated_at, user_id, table_id,pack_fee,trade_day,uuid,sku_name
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
@@ -97,28 +96,25 @@
<delete id="deleteBymasterId">
delete from tb_cashier_cart where master_id = #{masterId} and shop_id = #{shopId} and status = #{status} and trade_day = #{day}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart"
useGeneratedKeys="true" keyProperty="id">
insert into tb_cashier_cart (id, master_id, order_id,
ref_order_id, total_amount, product_id,
cover_img, is_sku, sku_id,
name, sale_price, number,
total_number, refund_number, category_id,
status, type, merchant_id,
shop_id, created_at, updated_at, pack_fee, trade_day, is_pack, is_gift, table_id,
user_id, sku_name, is_vip)
values (#{id,jdbcType=INTEGER}, #{masterId,jdbcType=VARCHAR}, #{orderId,jdbcType=VARCHAR},
#{refOrderId,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL}, #{productId,jdbcType=VARCHAR},
#{coverImg,jdbcType=VARCHAR}, #{isSku,jdbcType=TINYINT}, #{skuId,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{salePrice,jdbcType=DECIMAL}, #{number,jdbcType=REAL},
#{totalNumber,jdbcType=REAL}, #{refundNumber,jdbcType=REAL}, #{categoryId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT}, #{merchantId,jdbcType=VARCHAR},
#{shopId,jdbcType=VARCHAR}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT},
#{packFee,jdbcType=DECIMAL}
, #{tradeDay,jdbcType=VARCHAR}, #{isPack,jdbcType=VARCHAR}, #{isGift,jdbcType=VARCHAR},
#{tableId,jdbcType=VARCHAR}
, #{userId,jdbcType=INTEGER}, #{skuName,jdbcType=VARCHAR}, #{isVip,jdbcType=TINYINT})
</insert>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart" useGeneratedKeys="true" keyProperty="id">
insert into tb_cashier_cart (id, master_id, order_id,
ref_order_id, total_amount, product_id,
cover_img, is_sku, sku_id,
name, sale_price, number,
total_number, refund_number, category_id,
status, type, merchant_id,
shop_id, created_at, updated_at, pack_fee,trade_day,is_pack,is_gift,table_id,user_id,sku_name
)
values (#{id,jdbcType=INTEGER}, #{masterId,jdbcType=VARCHAR}, #{orderId,jdbcType=VARCHAR},
#{refOrderId,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL}, #{productId,jdbcType=VARCHAR},
#{coverImg,jdbcType=VARCHAR}, #{isSku,jdbcType=TINYINT}, #{skuId,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{salePrice,jdbcType=DECIMAL}, #{number,jdbcType=REAL},
#{totalNumber,jdbcType=REAL}, #{refundNumber,jdbcType=REAL}, #{categoryId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT}, #{merchantId,jdbcType=VARCHAR},
#{shopId,jdbcType=VARCHAR}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, #{packFee,jdbcType=DECIMAL}
, #{tradeDay,jdbcType=VARCHAR}, #{isPack,jdbcType=VARCHAR}, #{isGift,jdbcType=VARCHAR}, #{tableId,jdbcType=VARCHAR}, #{userId,jdbcType=INTEGER},#{skuName,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
insert into tb_cashier_cart
<trim prefix="(" suffix=")" suffixOverrides=",">
@@ -185,9 +181,6 @@
<if test="updatedAt != null">
updated_at,
</if>
<if test="isVip != null">
is_vip,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@@ -253,9 +246,6 @@
<if test="updatedAt != null">
#{updatedAt,jdbcType=BIGINT},
</if>
<if test="isVip != null">
#{isVip,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective"
@@ -334,9 +324,6 @@
<if test="isGift != null">
is_gift = #{isGift,jdbcType=BIGINT},
</if>
<if test="isVip != null">
is_vip = #{isVip,jdbcType=TINYINT},
</if>
<if test="isPack != null">
is_pack = #{isPack,jdbcType=VARCHAR},
</if>

View File

@@ -1,194 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbConsInfoMapper">
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
<result column="con_type_id" jdbcType="INTEGER" property="conTypeId" />
<result column="con_type_name" jdbcType="VARCHAR" property="conTypeName" />
<result column="con_code" jdbcType="VARCHAR" property="conCode" />
<result column="con_name" jdbcType="VARCHAR" property="conName" />
<result column="stock_number" jdbcType="DECIMAL" property="stockNumber" />
<result column="price" jdbcType="DECIMAL" property="price" />
<result column="stock_consume" jdbcType="DECIMAL" property="stockConsume" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="con_unit" jdbcType="VARCHAR" property="conUnit" />
<result column="laster_in_stock" jdbcType="DECIMAL" property="lasterInStock" />
<result column="con_warning" jdbcType="DECIMAL" property="conWarning" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_check" jdbcType="VARCHAR" property="isCheck" />
</resultMap>
<sql id="Base_Column_List">
id, shop_id, con_type_id, con_type_name, con_code, con_name, stock_number,price,stock_consume,status, con_unit,
laster_in_stock, con_warning, create_time, update_time,is_check
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tb_cons_info
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_cons_info
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
insert into tb_cons_info (id, shop_id, con_type_id,
con_type_name, con_code, con_name,
stock_number, con_unit, laster_in_stock,
con_warning, create_time, update_time
)
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{conTypeId,jdbcType=INTEGER},
#{conTypeName,jdbcType=VARCHAR}, #{conCode,jdbcType=VARCHAR}, #{conName,jdbcType=VARCHAR},
#{stockNumber,jdbcType=DECIMAL}, #{conUnit,jdbcType=VARCHAR}, #{lasterInStock,jdbcType=DECIMAL},
#{conWarning,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
insert into tb_cons_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="shopId != null">
shop_id,
</if>
<if test="conTypeId != null">
con_type_id,
</if>
<if test="conTypeName != null">
con_type_name,
</if>
<if test="conCode != null">
con_code,
</if>
<if test="conName != null">
con_name,
</if>
<if test="stockNumber != null">
stock_number,
</if>
<if test="conUnit != null">
con_unit,
</if>
<if test="lasterInStock != null">
laster_in_stock,
</if>
<if test="conWarning != null">
con_warning,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="shopId != null">
#{shopId,jdbcType=INTEGER},
</if>
<if test="conTypeId != null">
#{conTypeId,jdbcType=INTEGER},
</if>
<if test="conTypeName != null">
#{conTypeName,jdbcType=VARCHAR},
</if>
<if test="conCode != null">
#{conCode,jdbcType=VARCHAR},
</if>
<if test="conName != null">
#{conName,jdbcType=VARCHAR},
</if>
<if test="stockNumber != null">
#{stockNumber,jdbcType=DECIMAL},
</if>
<if test="conUnit != null">
#{conUnit,jdbcType=VARCHAR},
</if>
<if test="lasterInStock != null">
#{lasterInStock,jdbcType=DECIMAL},
</if>
<if test="conWarning != null">
#{conWarning,jdbcType=DECIMAL},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
update tb_cons_info
<set>
<if test="shopId != null">
shop_id = #{shopId,jdbcType=INTEGER},
</if>
<if test="conTypeId != null">
con_type_id = #{conTypeId,jdbcType=INTEGER},
</if>
<if test="conTypeName != null">
con_type_name = #{conTypeName,jdbcType=VARCHAR},
</if>
<if test="conCode != null">
con_code = #{conCode,jdbcType=VARCHAR},
</if>
<if test="conName != null">
con_name = #{conName,jdbcType=VARCHAR},
</if>
<if test="stockNumber != null">
stock_number = #{stockNumber,jdbcType=DECIMAL},
</if>
<if test="conUnit != null">
con_unit = #{conUnit,jdbcType=VARCHAR},
</if>
<if test="lasterInStock != null">
laster_in_stock = #{lasterInStock,jdbcType=DECIMAL},
</if>
<if test="conWarning != null">
con_warning = #{conWarning,jdbcType=DECIMAL},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
update tb_cons_info
set shop_id = #{shopId,jdbcType=INTEGER},
con_type_id = #{conTypeId,jdbcType=INTEGER},
con_type_name = #{conTypeName,jdbcType=VARCHAR},
con_code = #{conCode,jdbcType=VARCHAR},
con_name = #{conName,jdbcType=VARCHAR},
stock_number = #{stockNumber,jdbcType=DECIMAL},
con_unit = #{conUnit,jdbcType=VARCHAR},
laster_in_stock = #{lasterInStock,jdbcType=DECIMAL},
con_warning = #{conWarning,jdbcType=DECIMAL},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
stock_consume=#{stockConsume,jdbcType=DECIMAL}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="countAll" resultType="int">
select count(id) from tb_cons_info
</select>
<select id="selectAllInfo" resultType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
select * from tb_cons_info order by id desc
</select>
</mapper>

View File

@@ -11,14 +11,13 @@
<result column="created_at" jdbcType="BIGINT" property="createdAt" />
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
<result column="small_appid" jdbcType="VARCHAR" property="smallAppid" />
<result column="alipay_small_appid" jdbcType="VARCHAR" property="alipaySmallAppid" />
<result column="store_id" jdbcType="VARCHAR" property="storeId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbMerchantThirdApply">
<result column="app_token" jdbcType="LONGVARCHAR" property="appToken" />
</resultMap>
<sql id="Base_Column_List">
id, type, app_id, status, pay_password, applyment_state, created_at, updated_at,small_appid,alipay_small_appid,store_id
id, type, app_id, status, pay_password, applyment_state, created_at, updated_at,small_appid,store_id
</sql>
<sql id="Blob_Column_List">
app_token

View File

@@ -8,7 +8,6 @@
<result column="product_id" jdbcType="INTEGER" property="productId"/>
<result column="product_sku_id" jdbcType="INTEGER" property="productSkuId"/>
<result column="num" jdbcType="INTEGER" property="num"/>
<result column="is_vip" jdbcType="TINYINT" property="isVip" />
<result column="product_name" jdbcType="VARCHAR" property="productName"/>
<result column="product_sku_name" jdbcType="VARCHAR" property="productSkuName"/>
<result column="product_img" jdbcType="VARCHAR" property="productImg"/>
@@ -21,7 +20,7 @@
</resultMap>
<sql id="Base_Column_List">
id, order_id, shop_id, product_id, product_sku_id, num, product_name, product_sku_name,
product_img, create_time, update_time, price, price_amount,status,pack_amount,is_vip
product_img, create_time, update_time, price, price_amount,status,pack_amount
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
@@ -44,12 +43,12 @@
product_id, product_sku_id, num,
product_name, product_sku_name, product_img,
create_time, update_time, price,
price_amount,pack_amount,status,is_vip)
price_amount,pack_amount,status)
values (#{id,jdbcType=INTEGER}, #{orderId,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER},
#{productId,jdbcType=INTEGER}, #{productSkuId,jdbcType=INTEGER}, #{num,jdbcType=INTEGER},
#{productName,jdbcType=VARCHAR}, #{productSkuName,jdbcType=VARCHAR}, #{productImg,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{price,jdbcType=DECIMAL},
#{priceAmount,jdbcType=DECIMAL},#{packAmount,jdbcType=DECIMAL},#{status,jdbcType=VARCHAR},#{isVip,jdbcType=TINYINT})
#{priceAmount,jdbcType=DECIMAL},#{packAmount,jdbcType=DECIMAL},#{status,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbOrderDetail">
insert into tb_order_detail
@@ -93,9 +92,6 @@
<if test="priceAmount != null">
price_amount,
</if>
<if test="isVip != null">
is_vip,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@@ -137,9 +133,6 @@
<if test="priceAmount != null">
#{priceAmount,jdbcType=DECIMAL},
</if>
<if test="isVip != null">
#{isVip,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective"
@@ -161,9 +154,6 @@
<if test="num != null">
num = #{num,jdbcType=INTEGER},
</if>
<if test="isVip != null">
is_vip = #{isVip,jdbcType=TINYINT},
</if>
<if test="productName != null">
product_name = #{productName,jdbcType=VARCHAR},
</if>
@@ -207,7 +197,6 @@
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
price = #{price,jdbcType=DECIMAL},
is_vip= #{isVip,jdbcType=TINYINT},
price_amount = #{priceAmount,jdbcType=DECIMAL}
where id = #{id,jdbcType=INTEGER}
</update>

View File

@@ -51,58 +51,53 @@
<result column="out_number" jdbcType="VARCHAR" property="outNumber"/>
</resultMap>
<sql id="Base_Column_List">
id, order_no, settlement_amount, pack_fee, origin_amount, product_amount, amount,
refund_amount, pay_type, pay_amount, order_amount, freight_amount, discount_ratio,
discount_amount, table_id, small_change, send_type, order_type, product_type, status,
billing_id, merchant_id, shop_id, is_vip, member_id, user_id, product_score, deduct_score,
user_coupon_id, user_coupon_amount, refund_able, paid_time, is_effect, is_group,
id, order_no, settlement_amount, pack_fee, origin_amount, product_amount, amount,
refund_amount, pay_type, pay_amount, order_amount, freight_amount, discount_ratio,
discount_amount, table_id, small_change, send_type, order_type, product_type, status,
billing_id, merchant_id, shop_id, is_vip, member_id, user_id, product_score, deduct_score,
user_coupon_id, user_coupon_amount, refund_able, paid_time, is_effect, is_group,
updated_at, `system_time`, created_at, is_accepted, pay_order_no,trade_day,`source`,
remark,master_id,`table_name`,is_buy_coupon,is_use_coupon,out_number
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
*
<include refid="Base_Column_List"/>
from tb_order_info
where id = #{id,jdbcType=INTEGER}
</select>
<!-- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">-->
<!-- delete from tb_order_info-->
<!-- where id = #{id,jdbcType=INTEGER}-->
<!-- </delete>-->
<update id="deleteByPrimaryKey" parameterType="java.lang.Integer">
update tb_order_info
set is_del = 1
where id = #{id,jdbcType=INTEGER}
</update>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_order_info
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbOrderInfo"
useGeneratedKeys="true" keyProperty="id">
insert into tb_order_info (id, order_no, settlement_amount,
pack_fee, origin_amount, product_amount,
amount, refund_amount, pay_type,
pay_amount, order_amount, freight_amount,
discount_ratio, discount_amount, table_id,
small_change, send_type, order_type,
product_type, status, billing_id,
merchant_id, shop_id, is_vip,
member_id, user_id, product_score,
deduct_score, user_coupon_id, user_coupon_amount,
refund_able, paid_time, is_effect,
is_group, updated_at, system_time,
insert into tb_order_info (id, order_no, settlement_amount,
pack_fee, origin_amount, product_amount,
amount, refund_amount, pay_type,
pay_amount, order_amount, freight_amount,
discount_ratio, discount_amount, table_id,
small_change, send_type, order_type,
product_type, status, billing_id,
merchant_id, shop_id, is_vip,
member_id, user_id, product_score,
deduct_score, user_coupon_id, user_coupon_amount,
refund_able, paid_time, is_effect,
is_group, updated_at, system_time,
created_at, is_accepted, pay_order_no,trade_day,source,remark,master_id,table_name,is_buy_coupon,is_use_coupon,out_number
)
values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{settlementAmount,jdbcType=DECIMAL},
#{packFee,jdbcType=DECIMAL}, #{originAmount,jdbcType=DECIMAL}, #{productAmount,jdbcType=DECIMAL},
#{amount,jdbcType=DECIMAL}, #{refundAmount,jdbcType=DECIMAL}, #{payType,jdbcType=VARCHAR},
#{payAmount,jdbcType=DECIMAL}, #{orderAmount,jdbcType=DECIMAL}, #{freightAmount,jdbcType=DECIMAL},
#{discountRatio,jdbcType=DECIMAL}, #{discountAmount,jdbcType=DECIMAL}, #{tableId,jdbcType=VARCHAR},
#{smallChange,jdbcType=DECIMAL}, #{sendType,jdbcType=VARCHAR}, #{orderType,jdbcType=VARCHAR},
#{productType,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{billingId,jdbcType=VARCHAR},
#{merchantId,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{isVip,jdbcType=TINYINT},
#{memberId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{productScore,jdbcType=INTEGER},
#{deductScore,jdbcType=INTEGER}, #{userCouponId,jdbcType=VARCHAR}, #{userCouponAmount,jdbcType=DECIMAL},
#{refundAble,jdbcType=TINYINT}, #{paidTime,jdbcType=BIGINT}, #{isEffect,jdbcType=TINYINT},
#{isGroup,jdbcType=TINYINT}, #{updatedAt,jdbcType=BIGINT}, #{systemTime,jdbcType=BIGINT},
values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{settlementAmount,jdbcType=DECIMAL},
#{packFee,jdbcType=DECIMAL}, #{originAmount,jdbcType=DECIMAL}, #{productAmount,jdbcType=DECIMAL},
#{amount,jdbcType=DECIMAL}, #{refundAmount,jdbcType=DECIMAL}, #{payType,jdbcType=VARCHAR},
#{payAmount,jdbcType=DECIMAL}, #{orderAmount,jdbcType=DECIMAL}, #{freightAmount,jdbcType=DECIMAL},
#{discountRatio,jdbcType=DECIMAL}, #{discountAmount,jdbcType=DECIMAL}, #{tableId,jdbcType=VARCHAR},
#{smallChange,jdbcType=DECIMAL}, #{sendType,jdbcType=VARCHAR}, #{orderType,jdbcType=VARCHAR},
#{productType,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{billingId,jdbcType=VARCHAR},
#{merchantId,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{isVip,jdbcType=TINYINT},
#{memberId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{productScore,jdbcType=INTEGER},
#{deductScore,jdbcType=INTEGER}, #{userCouponId,jdbcType=VARCHAR}, #{userCouponAmount,jdbcType=DECIMAL},
#{refundAble,jdbcType=TINYINT}, #{paidTime,jdbcType=BIGINT}, #{isEffect,jdbcType=TINYINT},
#{isGroup,jdbcType=TINYINT}, #{updatedAt,jdbcType=BIGINT}, #{systemTime,jdbcType=BIGINT},
#{createdAt,jdbcType=BIGINT}, #{isAccepted,jdbcType=TINYINT}, #{payOrderNo,jdbcType=VARCHAR},
#{tradeDay,jdbcType=VARCHAR}, #{source,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR},
#{masterId,jdbcType=VARCHAR}, #{tableName,jdbcType=VARCHAR}, #{isBuyCoupon,jdbcType=VARCHAR}, #{isUseCoupon,jdbcType=VARCHAR},#{outNumber,jdbcType=VARCHAR}
@@ -491,10 +486,9 @@
<if test="isBuyCoupon != null">
is_buy_coupon = #{isBuyCoupon,jdbcType=VARCHAR},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR},
<if test="isUseCoupon != null">
is_use_coupon = #{isUseCoupon,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
@@ -555,7 +549,6 @@
where user_id = #{userId}
and order_type='miniapp'
and is_del != 1
<if test="status != null and status != ''">
<choose>
<when test="status == 'unpaid'">
@@ -583,4 +576,4 @@
left join tb_user_info tui on tui.id = toi.user_id
where toi.user_id = #{userId}
</select>
</mapper>
</mapper>

View File

@@ -1009,7 +1009,6 @@
AND t.sku_id = #{skuId}
AND t.`status` = 'create'
AND t.table_id = #{code}
AND t.is_vip = #{isVip}
</select>
<select id="selectByNewQcode" resultType="java.lang.Integer">
SELECT

View File

@@ -403,7 +403,7 @@
FROM
tb_product_sku
WHERE
product_id = #{productId} and is_del=0
product_id = #{productId}
</select>
<select id="selectSale" resultType="com.chaozhanggui.system.cashierservice.entity.vo.HomeVO">
SELECT

View File

@@ -1,155 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbProskuConMapper">
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
<result column="product_id" jdbcType="INTEGER" property="productId" />
<result column="product_sku_id" jdbcType="INTEGER" property="productSkuId" />
<result column="con_info_id" jdbcType="INTEGER" property="conInfoId" />
<result column="surplus_stock" jdbcType="DECIMAL" property="surplusStock" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Base_Column_List">
id, shop_id,product_id ,product_sku_id, con_info_id, surplus_stock, status, create_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tb_prosku_con
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_prosku_con
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
insert into tb_prosku_con (id, shop_id, product_sku_id,
con_info_id, surplus_stock, status,
create_time)
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{productSkuId,jdbcType=INTEGER},
#{conInfoId,jdbcType=INTEGER}, #{surplusStock,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
insert into tb_prosku_con
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="shopId != null">
shop_id,
</if>
<if test="productSkuId != null">
product_sku_id,
</if>
<if test="conInfoId != null">
con_info_id,
</if>
<if test="surplusStock != null">
surplus_stock,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="shopId != null">
#{shopId,jdbcType=INTEGER},
</if>
<if test="productSkuId != null">
#{productSkuId,jdbcType=INTEGER},
</if>
<if test="conInfoId != null">
#{conInfoId,jdbcType=INTEGER},
</if>
<if test="surplusStock != null">
#{surplusStock,jdbcType=DECIMAL},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
update tb_prosku_con
<set>
<if test="shopId != null">
shop_id = #{shopId,jdbcType=INTEGER},
</if>
<if test="productSkuId != null">
product_sku_id = #{productSkuId,jdbcType=INTEGER},
</if>
<if test="conInfoId != null">
con_info_id = #{conInfoId,jdbcType=INTEGER},
</if>
<if test="surplusStock != null">
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
</if>
<if test="status != null">
status = #{status,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
update tb_prosku_con
set shop_id = #{shopId,jdbcType=INTEGER},
product_sku_id = #{productSkuId,jdbcType=INTEGER},
con_info_id = #{conInfoId,jdbcType=INTEGER},
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
status = #{status,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectBySkuIdAndShopId" resultMap="BaseResultMap">
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and status=1
</select>
<select id="selectBySkuIdAndShopIdAngCheck" resultMap="BaseResultMap">
select a.* from tb_prosku_con as a
left join tb_cons_info as b on a.con_info_id=b.id
where a.product_sku_id=#{skuId} and a.shop_id=#{shopId} and a.status=1 and b.is_check=1
</select>
<select id="selectIdBySkuIdAndShopId" resultType="java.lang.Integer">
SELECT
p.con_info_id
FROM
tb_prosku_con p
WHERE
p.shop_id = #{shopId}
AND p.product_sku_id = #{skuId}
AND p.`status` = 1
group by p.con_info_id
</select>
<select id="selectByShopIdAndSkuIdAndProductId" resultMap="BaseResultMap">
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and product_id=#{productId} and status=1
</select>
<select id="selectByShopIdAndSkuIdAndProductIdAndCheck" resultMap="BaseResultMap">
select a.* from tb_prosku_con as a
left join tb_cons_info as b on a.con_info_id=b.id
where a.product_sku_id=#{skuId} and a.shop_id=#{shopId} and a.product_id=#{productId} and a.status=1 and b.is_check=1
</select>
</mapper>

View File

@@ -1,72 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbShopExtendMapper">
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbShopExtend" id="TbShopExtendMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
<result property="type" column="type" jdbcType="VARCHAR"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="autokey" column="autoKey" jdbcType="VARCHAR"/>
<result property="value" column="value" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id
, shop_id, type, name, autoKey, value, update_time, create_time </sql>
<!--查询单个-->
<select id="queryById" resultMap="TbShopExtendMap">
select
<include refid="Base_Column_List"/>
from tb_shop_extend
where id = #{id}
</select>
<select id="queryByShopIdAndAutoKey" resultMap="TbShopExtendMap">
select
<include refid="Base_Column_List"/>
from tb_shop_extend
where shop_id = #{shopId} and autoKey = #{autokey}
</select>
<!--查询指定行数据-->
<select id="queryAll" resultMap="TbShopExtendMap">
select
<include refid="Base_Column_List"/>
from tb_shop_extend
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="shopId != null">
and shop_id = #{shopId}
</if>
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="name != null and name != ''">
and name = #{name}
</if>
<if test="autokey != null and autokey != ''">
and autoKey = #{autokey}
</if>
<if test="value != null and value != ''">
and value = #{value}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
</where>
</select>
</mapper>

View File

@@ -36,7 +36,7 @@
</select>
<select id="selectAllAndSearch" resultType="com.chaozhanggui.system.cashierservice.entity.TbShopSong">
select *
from tb_shop_song where shop_id=#{shopId}
from fycashier.tb_shop_song where shop_id=#{shopId}
and status=1
<if test="keyWord != null and keyWord != ''">
and name like CONCAT('%',#{keyWord},'%')

View File

@@ -10,11 +10,9 @@
<result column="biz_name" jdbcType="VARCHAR" property="bizName" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="is_return" jdbcType="VARCHAR" property="isReturn" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
</resultMap>
<sql id="Base_Column_List">
id, shop_user_id, amount, balance, biz_code, biz_name, create_time, type,is_return,remark
id, shop_user_id, amount, balance, biz_code, biz_name, create_time, type
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
@@ -26,13 +24,13 @@
delete from tb_shop_user_flow
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopUserFlow" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopUserFlow">
insert into tb_shop_user_flow (id, shop_user_id, amount,
balance, biz_code, biz_name,
create_time, type,is_return,remark)
create_time, type)
values (#{id,jdbcType=INTEGER}, #{shopUserId,jdbcType=INTEGER}, #{amount,jdbcType=DECIMAL},
#{balance,jdbcType=DECIMAL}, #{bizCode,jdbcType=VARCHAR}, #{bizName,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{type,jdbcType=VARCHAR},#{isReturn,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR})
#{createTime,jdbcType=TIMESTAMP}, #{type,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopUserFlow">
insert into tb_shop_user_flow

View File

@@ -414,10 +414,6 @@
select * from tb_shop_user where user_id=#{userId}
</select>
<select id="selectVipByUserId" resultMap="BaseResultMap">
select * from tb_shop_user where user_id=#{userId} and is_vip = 1
</select>
<select id="selectByOpenId" resultType="com.chaozhanggui.system.cashierservice.entity.TbShopUser">
select * from tb_shop_user where mini_open_id = #{openId}
</select>

View File

@@ -4,7 +4,6 @@
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbUserCoupons">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="detail" jdbcType="VARCHAR" property="detail" />
<result column="coupons_price" jdbcType="DECIMAL" property="couponsPrice" />
<result column="coupons_amount" jdbcType="DECIMAL" property="couponsAmount" />
<result column="status" jdbcType="VARCHAR" property="status" />
@@ -14,7 +13,7 @@
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
</resultMap>
<sql id="Base_Column_List">
id, user_id, detail, coupons_price, coupons_amount, status, create_time, update_time, end_time,is_double
id, user_id, coupons_price, coupons_amount, status, create_time, update_time, end_time,is_double
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
@@ -22,21 +21,6 @@
from tb_user_coupons
where id = #{id,jdbcType=INTEGER}
</select>
<select id="queryAllSelective" resultMap="BaseResultMap">
select
detail,coupons_price as couponsPrice,coupons_amount as couponsAmount,status,1 as num,0 as type
from tb_user_coupons
<where>
<if test="userId != null and userId != ''">
and user_id = #{userId}
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
</where>
</select>
<select id="selectByUserId" resultType="com.chaozhanggui.system.cashierservice.entity.TbUserCoupons">
select * from tb_user_coupons where user_id = #{userId}
<if test="status != null and status != ''">
@@ -60,10 +44,10 @@
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserCoupons" useGeneratedKeys="true" keyProperty="id">
insert into tb_user_coupons (id, user_id, detail, coupons_price,
insert into tb_user_coupons (id, user_id, coupons_price,
coupons_amount, status, create_time,
update_time, end_time,is_double)
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR}, #{detail,jdbcType=VARCHAR}, #{couponsPrice,jdbcType=DECIMAL},
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR}, #{couponsPrice,jdbcType=DECIMAL},
#{couponsAmount,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{isDouble,jdbcType=VARCHAR})
</insert>
@@ -76,9 +60,6 @@
<if test="userId != null">
user_id,
</if>
<if test="detail != null">
detail,
</if>
<if test="couponsPrice != null">
coupons_price,
</if>
@@ -105,9 +86,6 @@
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="detail != null">
#{detail,jdbcType=VARCHAR},
</if>
<if test="couponsPrice != null">
#{couponsPrice,jdbcType=DECIMAL},
</if>
@@ -134,9 +112,6 @@
<if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if test="detail != null">
detail = #{detail,jdbcType=VARCHAR},
</if>
<if test="couponsPrice != null">
coupons_price = #{couponsPrice,jdbcType=DECIMAL},
</if>
@@ -162,7 +137,6 @@
update tb_user_coupons
set user_id = #{userId,jdbcType=VARCHAR},
coupons_price = #{couponsPrice,jdbcType=DECIMAL},
detail = #{detail,jdbcType=VARCHAR},
coupons_amount = #{couponsAmount,jdbcType=DECIMAL},
status = #{status,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},