Merge branch 'test' into dev
# Conflicts: # src/main/resources/application-pre.yml
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
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;
|
||||
@@ -10,6 +11,7 @@ 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
|
||||
@@ -51,6 +53,14 @@ 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);
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ 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;
|
||||
@@ -31,6 +33,7 @@ public interface TbActivateInRecordMapper {
|
||||
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);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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;
|
||||
@@ -29,6 +30,8 @@ public interface TbActivateOutRecordMapper {
|
||||
*/
|
||||
List<TbActivateOutRecord> queryAll(TbActivateOutRecord tbActivateOutRecord);
|
||||
|
||||
List<UserCouponVo> queryVipPro(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId, @Param("shopName") String shopName);
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
|
||||
@@ -11,6 +11,10 @@ import java.util.List;
|
||||
@Component
|
||||
@Mapper
|
||||
public interface TbOrderInfoMapper {
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*/
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(TbOrderInfo record);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
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;
|
||||
@@ -18,6 +20,7 @@ public interface TbUserCouponsMapper {
|
||||
int insertSelective(TbUserCoupons record);
|
||||
|
||||
TbUserCoupons selectByPrimaryKey(Integer id);
|
||||
List<UserCouponVo> queryAllSelective(UserCouponDto record);
|
||||
|
||||
int updateByPrimaryKeySelective(TbUserCoupons record);
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ public class TbOrderDetail implements Serializable {
|
||||
|
||||
private BigDecimal priceAmount;
|
||||
private BigDecimal packAmount;
|
||||
private String remark;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +103,8 @@ public class TbOrderInfo implements Serializable {
|
||||
private String isWinner;
|
||||
private String shopName;
|
||||
|
||||
private String useType;
|
||||
|
||||
|
||||
//根据状态返回 需付款 已付款 未付款 已退
|
||||
private String description;
|
||||
@@ -188,4 +190,4 @@ public class TbOrderInfo implements Serializable {
|
||||
this.createdAt = System.currentTimeMillis();
|
||||
this.isAccepted = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,11 @@ 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;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
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;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
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;
|
||||
}
|
||||
@@ -1,11 +1,14 @@
|
||||
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;
|
||||
@@ -14,12 +17,15 @@ 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.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -47,6 +53,10 @@ public class PrintMechineConsumer {
|
||||
|
||||
@Autowired
|
||||
private TbOrderDetailMapper tbOrderDetailMapper;
|
||||
@Autowired
|
||||
private RedisTemplate<Object, Object> redisTemplate2;
|
||||
@Autowired
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@RabbitHandler
|
||||
public void listener(String message) {
|
||||
@@ -74,6 +84,9 @@ 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());
|
||||
@@ -182,10 +195,20 @@ 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();
|
||||
@@ -220,6 +243,115 @@ 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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -96,4 +96,11 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,4 +26,13 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ 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;
|
||||
@@ -93,6 +94,8 @@ public class CartService {
|
||||
|
||||
private final RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
private final StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
|
||||
@Autowired
|
||||
private TbProskuConMapper tbProskuConMapper;
|
||||
@@ -100,7 +103,7 @@ public class CartService {
|
||||
@Autowired
|
||||
TbConsInfoMapper tbConsInfoMapper;
|
||||
|
||||
public CartService(TbUserShopMsgMapper tbUserShopMsgMapper, WechatUtil wechatUtil, WxAccountUtil wxAccountUtil, TbShopOpenIdMapper shopOpenIdMapper, ProductService productService, TbProductMapper tbProductMapper, RedisTemplate<String, Object> redisTemplate) {
|
||||
public CartService(TbUserShopMsgMapper tbUserShopMsgMapper, WechatUtil wechatUtil, WxAccountUtil wxAccountUtil, TbShopOpenIdMapper shopOpenIdMapper, ProductService productService, TbProductMapper tbProductMapper, RedisTemplate<String, Object> redisTemplate, StringRedisTemplate stringRedisTemplate) {
|
||||
this.tbUserShopMsgMapper = tbUserShopMsgMapper;
|
||||
this.wechatUtil = wechatUtil;
|
||||
this.wxAccountUtil = wxAccountUtil;
|
||||
@@ -108,6 +111,7 @@ public class CartService {
|
||||
this.productService = productService;
|
||||
this.tbProductMapper = tbProductMapper;
|
||||
this.redisTemplate = redisTemplate;
|
||||
this.stringRedisTemplate = stringRedisTemplate;
|
||||
}
|
||||
|
||||
public void initCart(JSONObject jsonObject) {
|
||||
@@ -224,7 +228,8 @@ public class CartService {
|
||||
if (cashierCart.getSkuId().equals(skuId) && cashierCart.getIsVip().intValue() == isVip) {
|
||||
cashierCart.setTotalNumber(buyNum);
|
||||
cashierCart.setNumber(buyNum);
|
||||
if (type == 0 && isVip == 0 && tbProductSkuWithBLOBs.getSuit() != null && tbProductSkuWithBLOBs.getSuit() > 1 && cashierCart.getNumber() < tbProductSkuWithBLOBs.getSuit()) {
|
||||
if (type == 0 && isVip == 0 && tbProductSkuWithBLOBs.getSuit() != null
|
||||
&& tbProductSkuWithBLOBs.getSuit() > 1 && cashierCart.getNumber() < tbProductSkuWithBLOBs.getSuit()) {
|
||||
cashierCartMapper.deleteByPrimaryKey(cashierCart.getId());
|
||||
continue;
|
||||
}
|
||||
@@ -650,28 +655,7 @@ 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));
|
||||
@@ -708,6 +692,7 @@ public class CartService {
|
||||
orderInfo.setIsBuyCoupon(isBuyYhq);
|
||||
orderInfo.setIsUseCoupon(isuseYhq);
|
||||
orderInfo.setRemark(remark);
|
||||
orderInfo.setUserId(userId);
|
||||
orderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
||||
|
||||
} else {
|
||||
@@ -719,6 +704,7 @@ 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")));
|
||||
|
||||
@@ -212,6 +212,14 @@ 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);
|
||||
|
||||
@@ -31,6 +31,7 @@ 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;
|
||||
@@ -158,6 +159,8 @@ public class PayService {
|
||||
private final TbShopSongOrderService shopSongOrderService;
|
||||
@Autowired
|
||||
private MQUtils mQUtils;
|
||||
@Autowired
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
public PayService(@Qualifier("tbShopSongOrderServiceImpl") TbShopSongOrderService shopSongOrderService) {
|
||||
this.shopSongOrderService = shopSongOrderService;
|
||||
@@ -330,6 +333,7 @@ public class PayService {
|
||||
if (ObjectUtil.isEmpty(orderInfo)) {
|
||||
return Result.fail("订单信息不存在");
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() - orderInfo.getCreatedAt() > 60 * 15 * 1000) {
|
||||
return Result.fail("订单十五分钟内有效,当前已超时,请重新下单。");
|
||||
}
|
||||
@@ -432,10 +436,12 @@ public class PayService {
|
||||
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");
|
||||
}
|
||||
@@ -916,6 +922,13 @@ 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());
|
||||
@@ -967,6 +980,13 @@ 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());
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ 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;
|
||||
@@ -14,6 +15,7 @@ import java.util.*;
|
||||
/**
|
||||
* 打印机
|
||||
*/
|
||||
@Slf4j
|
||||
public class PrinterUtils {
|
||||
//请求地址
|
||||
private static final String URL_STR = "https://ioe.car900.com/v1/openApi/dev/customPrint.json";
|
||||
@@ -83,6 +85,41 @@ 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();
|
||||
@@ -162,7 +199,46 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -55,7 +55,7 @@ logging:
|
||||
# web日志
|
||||
org.springframework.web: debug
|
||||
# mybatis日志
|
||||
org.mybatis: debug
|
||||
org.apache.ibatis: debug
|
||||
charset:
|
||||
# 输出控制台编码
|
||||
console: UTF-8
|
||||
|
||||
@@ -39,6 +39,23 @@
|
||||
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)
|
||||
|
||||
@@ -27,6 +27,25 @@
|
||||
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
|
||||
|
||||
@@ -51,53 +51,58 @@
|
||||
<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>
|
||||
<!-- <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>
|
||||
|
||||
<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}
|
||||
@@ -486,9 +491,10 @@
|
||||
<if test="isBuyCoupon != null">
|
||||
is_buy_coupon = #{isBuyCoupon,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isUseCoupon != null">
|
||||
is_use_coupon = #{isUseCoupon,jdbcType=VARCHAR},
|
||||
<if test="userId != null">
|
||||
user_id = #{userId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
@@ -549,6 +555,7 @@
|
||||
|
||||
where user_id = #{userId}
|
||||
and order_type='miniapp'
|
||||
and is_del != 1
|
||||
<if test="status != null and status != ''">
|
||||
<choose>
|
||||
<when test="status == 'unpaid'">
|
||||
@@ -576,4 +583,4 @@
|
||||
left join tb_user_info tui on tui.id = toi.user_id
|
||||
where toi.user_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@@ -414,6 +414,10 @@
|
||||
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>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<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" />
|
||||
@@ -13,7 +14,7 @@
|
||||
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, user_id, coupons_price, coupons_amount, status, create_time, update_time, end_time,is_double
|
||||
id, user_id, detail, coupons_price, coupons_amount, status, create_time, update_time, end_time,is_double
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
@@ -21,6 +22,21 @@
|
||||
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 != ''">
|
||||
@@ -44,10 +60,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, coupons_price,
|
||||
insert into tb_user_coupons (id, user_id, detail, coupons_price,
|
||||
coupons_amount, status, create_time,
|
||||
update_time, end_time,is_double)
|
||||
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR}, #{couponsPrice,jdbcType=DECIMAL},
|
||||
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR}, #{detail,jdbcType=VARCHAR}, #{couponsPrice,jdbcType=DECIMAL},
|
||||
#{couponsAmount,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{updateTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{isDouble,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
@@ -60,6 +76,9 @@
|
||||
<if test="userId != null">
|
||||
user_id,
|
||||
</if>
|
||||
<if test="detail != null">
|
||||
detail,
|
||||
</if>
|
||||
<if test="couponsPrice != null">
|
||||
coupons_price,
|
||||
</if>
|
||||
@@ -86,6 +105,9 @@
|
||||
<if test="userId != null">
|
||||
#{userId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="detail != null">
|
||||
#{detail,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="couponsPrice != null">
|
||||
#{couponsPrice,jdbcType=DECIMAL},
|
||||
</if>
|
||||
@@ -112,6 +134,9 @@
|
||||
<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>
|
||||
@@ -137,6 +162,7 @@
|
||||
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},
|
||||
|
||||
Reference in New Issue
Block a user