Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 46133d7d16 | |||
| 61157d730c | |||
| cee4643925 | |||
| 38b03b556c | |||
| df75a74822 | |||
| dad47eb0c8 | |||
| b0243a9ddd | |||
| 5a0112132d | |||
|
|
4a0a548565 | ||
|
|
6c6a447a5e | ||
| 146cb0f00b | |||
|
|
dc6df17a3f | ||
|
|
780707e55c | ||
|
|
b5bc0f2e0a | ||
| e640226629 | |||
|
|
d93bfd24a1 |
@@ -1,7 +1,6 @@
|
||||
package com.chaozhanggui.system.cashierservice;
|
||||
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.task.ConsInfoTask;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -45,7 +44,6 @@ public class Shell {
|
||||
@Bean
|
||||
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
|
||||
return (args) -> {
|
||||
// ctx.getBean(ConsInfoTask.class).init();
|
||||
logger.info("=========================启动完成==========================");
|
||||
};
|
||||
}
|
||||
|
||||
@@ -51,4 +51,13 @@ public class LoginContoller {
|
||||
@RequestHeader("clientType") String clientType){
|
||||
return loginService.getShopInfo(token);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "getStaffDiscount")
|
||||
public Result getStaffDiscount(@RequestHeader("token") String token,
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType){
|
||||
return loginService.getStaffDiscount(token);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class OrderController {
|
||||
String userId = jsonObject.getString("accountId");
|
||||
return orderService.createCart(cartVo.getMasterId(),cartVo.getProductId(),cartVo.getShopId(),
|
||||
cartVo.getSkuId(),cartVo.getNumber(),userId,clientType,cartVo.getCartId(),cartVo.getIsGift(),
|
||||
cartVo.getIsPack(),cartVo.getUuid(),cartVo.getType(), cartVo.getTableId());
|
||||
cartVo.getIsPack(),cartVo.getUuid(),cartVo.getType());
|
||||
}
|
||||
|
||||
@MyLog(value = "查询购物车信息", tag = LogTag.CART)
|
||||
@@ -49,7 +49,7 @@ public class OrderController {
|
||||
if (tableId == null && StrUtil.isBlank(masterId)) {
|
||||
return Result.fail("masterId和tableId不能同时为空");
|
||||
}
|
||||
return orderService.queryCart(masterId,shopId, tableId);
|
||||
return orderService.queryCart(masterId,shopId);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public class OrderController {
|
||||
@RequestParam(value = "masterId", required = false) String masterId,
|
||||
@RequestParam("cartId") Integer cartId
|
||||
){
|
||||
return orderService.delCart(masterId,cartId, tableId);
|
||||
return orderService.delCart(masterId,cartId);
|
||||
}
|
||||
@GetMapping("/createCode")
|
||||
public Result createCode(@RequestHeader("token") String token,
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ProductStatusDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ProductStockDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.QuerySpecDTO;
|
||||
import com.chaozhanggui.system.cashierservice.service.ProductService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
@@ -58,6 +59,15 @@ public class ProductController {
|
||||
return productService.queryCommodityInfo(shopId,categoryId,commdityName,page,pageSize,masterId);
|
||||
}
|
||||
|
||||
@GetMapping("querySpec")
|
||||
public Result querySpec(
|
||||
@RequestParam Integer shopId,
|
||||
@RequestParam Integer productId
|
||||
) {
|
||||
return Result.success(CodeEnum.SUCCESS, productService.querySpec(shopId, productId));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "queryNewCommodityInfo")
|
||||
public Result queryNewCommodityInfo(
|
||||
@RequestHeader("token") String token,
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.chaozhanggui.system.cashierservice.dao;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.CartPo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.QueryCartPo;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
@@ -67,4 +69,7 @@ public interface TbCashierCartMapper {
|
||||
List<TbCashierCart> selectActivateByQrcode(@Param("tableId") String tableId, @Param("shopId") Integer shopId);
|
||||
|
||||
QueryCartPo selectProductNumByQrcode(@Param("qrcode") String qrcode, @Param("shopId") Integer shopId);
|
||||
|
||||
@Delete("delete from tb_cashier_cart where master_id=#{masterId} and id=#{cartId}")
|
||||
int deleteByCartId(@Param("masterId") String masterId, @Param("cartId")Integer cartId);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public interface TbProductSkuMapper {
|
||||
@Update("update tb_product_sku set stock_number=stock_number-#{num} WHERE id=#{id} ")
|
||||
int decrStockUnCheck(String id, int num);
|
||||
|
||||
@Select("select * from tb_product_sku where is_grounding=1 and product_id=#{id}")
|
||||
@Select("select * from tb_product_sku where is_grounding=1 and product_id=#{id} and is_del=0")
|
||||
List<TbProductSku> selectByProductCheckGrounding(@Param("id") Integer id);
|
||||
|
||||
@Select("select * from tb_product_sku where is_grounding=1 and is_del=0 and product_id=#{id}")
|
||||
@@ -62,4 +62,7 @@ public interface TbProductSkuMapper {
|
||||
|
||||
@Update("update tb_product_sku set stock_number=#{stock} where product_id=#{skuId} and shop_id=#{shopId}")
|
||||
int updateStock(@Param("shopId") Integer shopId, @Param("skuId") Integer skuId, @Param("stock") Integer stock);
|
||||
|
||||
@Select("select * from tb_product_sku where product_id=#{id} and is_del=0")
|
||||
List<TbProductSku> selectByProductId(Integer id);
|
||||
}
|
||||
|
||||
@@ -24,12 +24,14 @@ public interface TbProskuConMapper {
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ public interface TbShopOpenIdMapper {
|
||||
@Select("select * from tb_shop_open_id where shop_id=#{shopId} and status=1")
|
||||
List<TbShopOpenId> selectByShopId(Integer integer);
|
||||
|
||||
@Select("select * from tb_shop_open_id where shop_id=#{shopId} and status=1 and (type=#{type} or type=-1);")
|
||||
@Select("select * from tb_shop_open_id where shop_id=#{shopId} and status=1 and (type=#{type} or type=-1) group by open_id;")
|
||||
List<TbShopOpenId> selectStateByShopIdAndType(@Param("shopId") String shopId, @Param("type") int type);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ public class TbConsInfo implements Serializable {
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private String isCheck;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
@@ -156,4 +158,12 @@ public class TbConsInfo implements Serializable {
|
||||
public void setPrice(BigDecimal price) {
|
||||
this.price = price;
|
||||
}
|
||||
}
|
||||
|
||||
public String getIsCheck() {
|
||||
return isCheck;
|
||||
}
|
||||
|
||||
public void setIsCheck(String isCheck) {
|
||||
this.isCheck = isCheck;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
public class TbProductWithBLOBs extends TbProduct implements Serializable {
|
||||
private Object groundingSpecInfo;
|
||||
private String images;
|
||||
|
||||
private String video;
|
||||
@@ -20,58 +24,34 @@ public class TbProductWithBLOBs extends TbProduct implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public List<?> getSkuList() {
|
||||
return skuList;
|
||||
public void setGroundingSpecInfo(Object groundingSpecInfo) {
|
||||
this.groundingSpecInfo = groundingSpecInfo;
|
||||
}
|
||||
|
||||
public void setSkuList(List<?> skuList) {
|
||||
this.skuList = skuList;
|
||||
}
|
||||
|
||||
public String getImages() {
|
||||
return images;
|
||||
}
|
||||
|
||||
public void setImages(String images) {
|
||||
this.images = images == null ? null : images.trim();
|
||||
}
|
||||
|
||||
public String getVideo() {
|
||||
return video;
|
||||
}
|
||||
|
||||
public void setVideo(String video) {
|
||||
this.video = video == null ? null : video.trim();
|
||||
}
|
||||
|
||||
public String getNotice() {
|
||||
return notice;
|
||||
}
|
||||
|
||||
public void setNotice(String notice) {
|
||||
this.notice = notice == null ? null : notice.trim();
|
||||
}
|
||||
|
||||
public String getGroupSnap() {
|
||||
return groupSnap;
|
||||
}
|
||||
|
||||
public void setGroupSnap(String groupSnap) {
|
||||
this.groupSnap = groupSnap == null ? null : groupSnap.trim();
|
||||
}
|
||||
|
||||
public String getSpecInfo() {
|
||||
return specInfo;
|
||||
}
|
||||
|
||||
public void setSpecInfo(String specInfo) {
|
||||
this.specInfo = specInfo == null ? null : specInfo.trim();
|
||||
}
|
||||
|
||||
public String getSelectSpec() {
|
||||
return selectSpec;
|
||||
}
|
||||
|
||||
public void setSelectSpec(String selectSpec) {
|
||||
this.selectSpec = selectSpec == null ? null : selectSpec.trim();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class QuerySpecDTO {
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
private Integer productId;
|
||||
}
|
||||
@@ -94,9 +94,10 @@ public class ConsMsgConsumer {
|
||||
}
|
||||
|
||||
|
||||
List<TbProskuCon> tbProskuCons = tbProskuConMapper.selectBySkuIdAndShopId(skuId, shopId);
|
||||
// List<TbProskuCon> tbProskuCons = tbProskuConMapper.selectBySkuIdAndShopId(skuId, shopId);
|
||||
List<TbProskuCon> tbProskuCons = tbProskuConMapper.selectBySkuIdAndShopIdAngCheck(skuId, shopId);
|
||||
if (Objects.isNull(tbProskuCons) || tbProskuCons.size() <= 0) {
|
||||
log.info("耗材信息未配置");
|
||||
log.info("耗材信息未配置或未开启校验");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -123,7 +124,8 @@ public class ConsMsgConsumer {
|
||||
log.info("耗材名称: {}, conwarning:{},stockNumber:{}",tbConsInfo.getConName(),
|
||||
tbConsInfo.getConWarning(),tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()));
|
||||
if (N.egt(tbConsInfo.getConWarning(), tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()))) {
|
||||
List<TbUserShopMsg> tbUserShopMsgs = tbUserShopMsgMapper.selectAllByShopId(tbConsInfo.getShopId());
|
||||
List<TbShopOpenId> tbUserShopMsgs = shopOpenIdMapper
|
||||
.selectStateByShopIdAndType(product.getShopId(), ShopWxMsgTypeEnum.CONSUMABLES_MSG.getType());
|
||||
log.info("待推送openId列表: {}", tbUserShopMsgs);
|
||||
if (Objects.nonNull(tbUserShopMsgs) && tbUserShopMsgs.size()>0) {
|
||||
tbUserShopMsgs.parallelStream().forEach(tbUserShopMsg->{
|
||||
@@ -133,7 +135,8 @@ public class ConsMsgConsumer {
|
||||
log.info("开始推送耗材模板消息,rediskey:{}", value);
|
||||
if (Objects.isNull(value)) {
|
||||
JSONObject jsonObject = wxAccountUtil.sendStockWarnMsg("耗材库存不足", tbConsInfo.getConName(),
|
||||
tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()).toBigInteger().intValue(), tbUserShopMsg.getOpenId(), ShopWxMsgTypeEnum.CONSUMABLES_MSG, shopId);
|
||||
tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()).toBigInteger().intValue(), tbUserShopMsg.getOpenId(),
|
||||
ShopWxMsgTypeEnum.CONSUMABLES_MSG, shopId);
|
||||
if (jsonObject != null) {
|
||||
log.info("写入redis:{}",key);
|
||||
redisUtil.saveMessage(key, "1", 30 * 60);
|
||||
|
||||
@@ -47,4 +47,8 @@ public interface RabbitConstants {
|
||||
|
||||
String EXCHANGE_STOCK_RECORD = "exchange.stock.record";
|
||||
String ROUTING_STOCK_RECORD_SALE = "routing.stock.record.sale";
|
||||
|
||||
// 库存记录
|
||||
public static final String QUEUE_STOCK_RECORD = "queue.stock.record";
|
||||
public static final String ROUTING_STOCK_RECORD= "routing.stock.record";
|
||||
}
|
||||
|
||||
@@ -71,4 +71,9 @@ public class RabbitProducer implements RabbitTemplate.ConfirmCallback {
|
||||
public <T> void sendStockSaleMsg(T data) {
|
||||
sendMsg(RabbitConstants.EXCHANGE_STOCK_RECORD, RabbitConstants.ROUTING_STOCK_RECORD_SALE, data, "商品售出增加库存记录");
|
||||
}
|
||||
|
||||
public <T> void sendStockRecordMsg(T data) {
|
||||
sendMsg(RabbitConstants.EXCHANGE_STOCK_RECORD, RabbitConstants.ROUTING_STOCK_RECORD, data, "增加库存记录");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,11 +66,13 @@ public class ConsService {
|
||||
List<TbConsInfoFlow> consInfoFlows=new ArrayList<>();
|
||||
|
||||
for (TbOrderDetail orderDetail : orderDetails) {
|
||||
List<TbProskuCon> proskuCons= tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
// List<TbProskuCon> proskuCons= tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
List<TbProskuCon> proskuCons= tbProskuConMapper.selectByShopIdAndSkuIdAndProductIdAndCheck(orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
if(Objects.isNull(proskuCons)||proskuCons.size()<=0){
|
||||
log.info("不存在的耗材信息配置:orderId:{},skuId:{},shopId:{},productId:{}",orderDetail.getOrderId(),orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
log.info("耗材信息未配置或未开启校验:orderId:{},skuId:{},shopId:{},productId:{}",orderDetail.getOrderId(),orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
continue;
|
||||
}
|
||||
|
||||
for (TbProskuCon proskuCon : proskuCons) {
|
||||
TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(proskuCon.getConInfoId());
|
||||
if(Objects.nonNull(tbConsInfo)&&"1".equals(tbConsInfo.getStatus())){
|
||||
|
||||
@@ -14,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
@@ -191,4 +192,23 @@ public class LoginService {
|
||||
|
||||
return Result.success(SUCCESS,shopInfo);
|
||||
}
|
||||
|
||||
|
||||
public Result getStaffDiscount(String token){
|
||||
|
||||
JSONObject jsonObject= TokenUtil.parseParamFromToken(token);
|
||||
if(Objects.isNull(jsonObject)){
|
||||
return Result.fail(CodeEnum.TOKENTERROR);
|
||||
}
|
||||
|
||||
Integer staffId=Integer.valueOf(jsonObject.getString("staffId"));
|
||||
|
||||
TbPlussShopStaff staff= tbPlussShopStaffMapper.selectByPrimaryKey(staffId);
|
||||
if(Objects.nonNull(staff)&&Objects.nonNull(staff.getMaxDiscountAmount())){
|
||||
return Result.success(SUCCESS,staff.getMaxDiscountAmount());
|
||||
}
|
||||
|
||||
return Result.success(SUCCESS, BigDecimal.ZERO);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -26,6 +26,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -77,6 +78,12 @@ public class OrderService {
|
||||
|
||||
private final TbShopOpenIdMapper shopOpenIdMapper;
|
||||
|
||||
@Autowired
|
||||
private TbProskuConMapper tbProskuConMapper;
|
||||
|
||||
@Autowired
|
||||
TbConsInfoMapper tbConsInfoMapper;
|
||||
|
||||
|
||||
private static ConcurrentHashMap<String, HashSet<Integer>> codeMap = new ConcurrentHashMap<>();
|
||||
private static ConcurrentHashMap<String, HashSet<String>> userMap = new ConcurrentHashMap<>();
|
||||
@@ -92,7 +99,7 @@ public class OrderService {
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result createCart(String masterId, String productId, String shopId, Integer skuId, Integer number,
|
||||
String userId, String clientType, Integer cartId, String isGift, String isPack, String uuid, String type, String qrcode) {
|
||||
String userId, String clientType, Integer cartId, String isGift, String isPack, String uuid, String type) {
|
||||
if (Objects.isNull(number) || number < 0) {
|
||||
return Result.fail(CodeEnum.NUMBER);
|
||||
}
|
||||
@@ -121,6 +128,32 @@ public class OrderService {
|
||||
return Result.fail(CodeEnum.PRODUCTSKUERROR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<TbProskuCon> proskuConList= tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(skuId,shopInfo.getId(),product.getId());
|
||||
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.egt(proskuCon.getSurplusStock(),consInfo.getStockNumber().abs().subtract(consInfo.getStockConsume().abs()))){
|
||||
return Result.fail("商品:".concat(product.getName()).concat("对应的:").concat(consInfo.getConName()).concat("耗材不足"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String exists = redisUtil.getMessage(RedisCst.ORDER_CART_EXISTS + cartId);
|
||||
|
||||
// 首次加入购物车,并且拥有起售数,设置为起售数
|
||||
@@ -129,7 +162,7 @@ public class OrderService {
|
||||
// 低于起售,删除商品
|
||||
}else if (exists != null && skuWithBLOBs.getSuit() != null && skuWithBLOBs.getSuit() != 0 && number < skuWithBLOBs.getSuit()){
|
||||
redisUtil.deleteByKey(RedisCst.ORDER_CART_EXISTS + cartId);
|
||||
delCart(masterId, cartId, qrcode);
|
||||
delCart(masterId, cartId);
|
||||
return Result.success(CodeEnum.SUCCESS, masterId);
|
||||
}
|
||||
|
||||
@@ -145,7 +178,7 @@ public class OrderService {
|
||||
}
|
||||
}
|
||||
|
||||
if (qrcode == null && StringUtils.isEmpty(masterId)) {
|
||||
if (StringUtils.isEmpty(masterId)) {
|
||||
boolean flag = redisUtil.exists("SHOP:CODE:" + clientType + ":" + shopId);
|
||||
if (flag) {
|
||||
String code = redisUtil.getMessage("SHOP:CODE:" + clientType + ":" + shopId).toString();
|
||||
@@ -158,47 +191,56 @@ public class OrderService {
|
||||
masterId = "#" + String.format("%03d", 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TbCashierCart cart = cashierCartMapper.selectByPrimaryKey(cartId);
|
||||
if (Objects.nonNull(cart)) {
|
||||
cart.setSkuId(skuId.toString());
|
||||
cart.setNumber(number);
|
||||
cart.setIsGift(isGift);
|
||||
cart.setIsPack(isPack);
|
||||
if (isPack.equals("false")){
|
||||
cart.setPackFee(BigDecimal.ZERO);
|
||||
|
||||
//查询现有规格商品
|
||||
if("edit".equals(type)&&!cart.getSkuId().equals(skuId.toString())){
|
||||
TbCashierCart cashierCart = cashierCartMapper.selectByDetail(masterId, productId, shopId, skuId.toString(), DateUtils.getDay(), uuid);
|
||||
if(Objects.nonNull(cashierCart)){
|
||||
cashierCart.setNumber(cashierCart.getNumber()+number);
|
||||
cashierCart.setTotalNumber(cashierCart.getNumber()+number);
|
||||
cashierCart.setUpdatedAt(System.currentTimeMillis());
|
||||
cashierCartMapper.updateByPrimaryKey(cashierCart);
|
||||
|
||||
cashierCartMapper.deleteByPrimaryKey(cart.getId());
|
||||
redisUtil.deleteByKey(RedisCst.ORDER_CART_EXISTS + cart.getId());
|
||||
cart=cashierCart;
|
||||
}
|
||||
}else {
|
||||
cart.setPackFee(new BigDecimal(number).multiply(product.getPackFee()));
|
||||
}
|
||||
if (isGift.equals("false")) {
|
||||
cart.setTotalAmount(new BigDecimal(number).multiply(skuWithBLOBs.getSalePrice()).add(cart.getPackFee()));
|
||||
} else {
|
||||
cart.setTotalAmount(BigDecimal.ZERO);
|
||||
cart.setSkuId(skuId.toString());
|
||||
cart.setNumber(number);
|
||||
cart.setIsGift(isGift);
|
||||
cart.setIsPack(isPack);
|
||||
if (isPack.equals("false")){
|
||||
cart.setPackFee(BigDecimal.ZERO);
|
||||
}else {
|
||||
cart.setPackFee(new BigDecimal(number).multiply(product.getPackFee()));
|
||||
}
|
||||
if (isGift.equals("false")) {
|
||||
cart.setTotalAmount(new BigDecimal(number).multiply(skuWithBLOBs.getSalePrice()).add(cart.getPackFee()));
|
||||
} else {
|
||||
cart.setTotalAmount(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
cart.setTotalNumber(number);
|
||||
cart.setUuid(uuid);
|
||||
cashierCartMapper.updateByPrimaryKeySelective(cart);
|
||||
}
|
||||
|
||||
cart.setTotalNumber(number);
|
||||
cart.setUuid(uuid);
|
||||
cashierCartMapper.updateByPrimaryKeySelective(cart);
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
List<TbCashierCart> list = StrUtil.isNotBlank(masterId) ? cashierCartMapper.selectALlByMasterId(masterId, "create")
|
||||
: cashierCartMapper.selectActivateByQrcode(qrcode, Integer.valueOf(shopId));
|
||||
|
||||
TbCashierCart cashierCart = StrUtil.isNotBlank(masterId) ? cashierCartMapper.selectByDetail(masterId, productId, shopId, skuId.toString(), DateUtils.getDay(), uuid)
|
||||
: cashierCartMapper.selectDetailByQrcode(qrcode, productId, shopId, skuId.toString(), uuid);
|
||||
|
||||
List<TbCashierCart> list = cashierCartMapper.selectALlByMasterId(masterId, "create");
|
||||
TbCashierCart cashierCart = cashierCartMapper.selectByDetail(masterId, productId, shopId, skuId.toString(), DateUtils.getDay(), uuid);
|
||||
if (number > 0) {
|
||||
if (Objects.isNull(cashierCart)) {
|
||||
cashierCart = new TbCashierCart();
|
||||
cashierCart.setCoverImg(product.getCoverImg());
|
||||
cashierCart.setCreatedAt(System.currentTimeMillis());
|
||||
cashierCart.setIsSku(product.getTypeEnum());
|
||||
if (qrcode != null) {
|
||||
cashierCart.setTableId(qrcode);
|
||||
}else {
|
||||
cashierCart.setMasterId(masterId);
|
||||
}
|
||||
cashierCart.setMasterId(masterId);
|
||||
cashierCart.setUuid(uuid);
|
||||
cashierCart.setMerchantId(userId);
|
||||
cashierCart.setName(product.getName());
|
||||
@@ -260,9 +302,7 @@ public class OrderService {
|
||||
skuWithBLOBs.setUpdatedAt(System.currentTimeMillis());
|
||||
tbProductSkuMapper.updateByPrimaryKey(skuWithBLOBs);
|
||||
|
||||
if (StrUtil.isNotBlank(masterId)) {
|
||||
redisUtil.saveMessage("SHOP:CODE:SET" + clientType + ":" + shopId + ":" + DateUtils.getDay(), masterId.substring(1,masterId.length()));
|
||||
}
|
||||
redisUtil.saveMessage("SHOP:CODE:SET" + clientType + ":" + shopId + ":" + DateUtils.getDay(),masterId.substring(1,masterId.length()));
|
||||
|
||||
|
||||
|
||||
@@ -275,7 +315,8 @@ public class OrderService {
|
||||
* @param productSku sku
|
||||
*/
|
||||
private void checkWarnLineAndSendMsg(TbProductSku productSku, TbProduct product, Integer shopId, Integer num) {
|
||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(shopId);
|
||||
log.info("下单,开始校验库存预警,商品信息:{}, {}, {}", product, productSku, num);
|
||||
|
||||
if (productSku.getWarnLine() == null) {
|
||||
return;
|
||||
}
|
||||
@@ -303,22 +344,16 @@ public class OrderService {
|
||||
}
|
||||
}
|
||||
|
||||
public Result queryCart(String masterId, String shopId, String qrcode) {
|
||||
public Result queryCart(String masterId, String shopId) {
|
||||
if (StringUtils.isEmpty(shopId)) {
|
||||
return Result.fail(CodeEnum.SHOPINFONOEXIST);
|
||||
}
|
||||
String day = DateUtils.getDay();
|
||||
|
||||
List<TbCashierCart> list;
|
||||
if (StrUtil.isBlank(masterId)) {
|
||||
list = cashierCartMapper.selectActivateByQrcode(qrcode, Integer.valueOf(shopId));
|
||||
}else {
|
||||
list = cashierCartMapper.selectByMaskerId(masterId, Integer.valueOf(shopId),"create",day);
|
||||
}
|
||||
if (StrUtil.isNotBlank(masterId) && list.isEmpty()){
|
||||
List<TbCashierCart> list = cashierCartMapper.selectByMaskerId(masterId, Integer.valueOf(shopId),"create",day);
|
||||
if (list.size() < 1){
|
||||
list = cashierCartMapper.selectByMaskerId(masterId, Integer.valueOf(shopId), "refund",day);
|
||||
if (!list.isEmpty()){
|
||||
if (list.isEmpty()) {
|
||||
if (list.size() > 0){
|
||||
if (list.size() < 1) {
|
||||
return Result.fail(CodeEnum.CARTJH);
|
||||
}
|
||||
int orderId = 0;
|
||||
@@ -360,13 +395,7 @@ public class OrderService {
|
||||
}
|
||||
// TbProductSkuResult skuResult = tbProductSkuResultMapper.selectByPr imaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
}
|
||||
|
||||
QueryCartPo queryCartPo;
|
||||
if (StrUtil.isNotBlank(masterId)) {
|
||||
queryCartPo = cashierCartMapper.selectProductNumByMarketId(day, shopId, masterId);
|
||||
}else {
|
||||
queryCartPo = cashierCartMapper.selectProductNumByQrcode(qrcode, Integer.valueOf(shopId));
|
||||
}
|
||||
QueryCartPo queryCartPo = cashierCartMapper.selectProductNumByMarketId(day, shopId, masterId);
|
||||
queryCartPo.setPackAmount(packAmount);
|
||||
queryCartPo.setTotalAmount(totalAmount);
|
||||
// queryCartPo.setTotalAmount(totalAmount.add(packAmount));
|
||||
@@ -377,7 +406,7 @@ public class OrderService {
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result delCart(String masterId, Integer cartId, String qrcode) {
|
||||
public Result delCart(String masterId, Integer cartId) {
|
||||
|
||||
|
||||
TbCashierCart cashierCart=cashierCartMapper.selectByPrimaryKey(cartId);
|
||||
@@ -409,7 +438,7 @@ public class OrderService {
|
||||
List<String> skuIds=new ArrayList<>();
|
||||
skuIds.add(cashierCart.getSkuId());
|
||||
|
||||
cashierCartMapper.deleteByCartIdOrTableId(masterId, cartId, qrcode);
|
||||
cashierCartMapper.deleteByCartId(masterId, cartId);
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
@@ -537,7 +566,6 @@ public class OrderService {
|
||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
TbProductSkuWithBLOBs skuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
|
||||
|
||||
log.info("下单,开始校验库存预警,购物车id:{}", cashierCart.getId());
|
||||
CompletableFuture.runAsync(() -> checkWarnLineAndSendMsg(skuWithBLOBs, product, Integer.valueOf(cashierCart.getShopId()), cashierCart.getNumber()));
|
||||
|
||||
// 已经添加的商品,修改数量
|
||||
@@ -792,7 +820,6 @@ public class OrderService {
|
||||
|
||||
if (flag) {
|
||||
redisUtil.deleteByKey("SHOP:CODE:USER:" + clientType + ":" + shopId + ":" + day + userId);
|
||||
;
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
@@ -9,9 +9,11 @@ import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ProductStatusDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ProductStockDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.QuerySpecDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ShopCategoryVo;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.interceptor.LimitSubmitAspect;
|
||||
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||
@@ -46,6 +48,12 @@ public class ProductService {
|
||||
@Autowired
|
||||
private LimitSubmitAspect limitSubmitAspect;
|
||||
|
||||
private final RabbitProducer producer;
|
||||
|
||||
public ProductService(RabbitProducer producer) {
|
||||
this.producer = producer;
|
||||
}
|
||||
|
||||
|
||||
public Result queryCategory(String shopId,Integer page,Integer pageSize){
|
||||
PageHelperUtil.startPage(page, pageSize);
|
||||
@@ -127,72 +135,20 @@ public class ProductService {
|
||||
it.setTbProductSpec(tbProductSpec);
|
||||
|
||||
TbProductSkuResult skuResult=tbProductSkuResultMapper.selectByPrimaryKey(it.getId());
|
||||
|
||||
|
||||
// 上下架对应的sku
|
||||
String selectSpec = it.getSelectSpec();
|
||||
|
||||
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectGroundingByProId(it.getId());
|
||||
HashSet<String> specSet = new HashSet<>();
|
||||
tbProductSkus.forEach(item -> {
|
||||
String specSnap = item.getSpecSnap();
|
||||
if (specSnap != null) {
|
||||
specSet.addAll(Arrays.asList(specSnap.split(",")));
|
||||
}
|
||||
});
|
||||
String tagSnap = skuResult != null ? skuResult.getTagSnap() : null;
|
||||
if (tagSnap != null) {
|
||||
JSONArray tagSnaps = JSONObject.parseArray(tagSnap);
|
||||
JSONObject snapJSON;
|
||||
|
||||
JSONArray finalSnap = new JSONArray();
|
||||
|
||||
HashMap<String, String> snapMap = new HashMap<>();
|
||||
for (Object snap : tagSnaps) {
|
||||
StringBuilder finalValues = new StringBuilder();
|
||||
snapJSON = (JSONObject) snap;
|
||||
String values = snapJSON.getString("value");
|
||||
if (StrUtil.isNotBlank(values)) {
|
||||
String[] valueList = values.split(",");
|
||||
for (String value : valueList) {
|
||||
if (specSet.contains(value)) {
|
||||
finalValues.append(value).append(",");
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(finalValues.toString())) {
|
||||
finalValues = new StringBuilder(StrUtil.removeSuffix(finalValues.toString(), ","));
|
||||
snapJSON.put("value", finalValues.toString());
|
||||
finalSnap.add(snapJSON);
|
||||
snapMap.put(snapJSON.getString("name"), snapJSON.getString("value"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (selectSpec != null) {
|
||||
JSONArray selectSpecJSON = JSONObject.parseArray(selectSpec);
|
||||
for (Object selectSpecInfo : selectSpecJSON) {
|
||||
JSONObject specInfo = (JSONObject) selectSpecInfo;
|
||||
String name = snapMap.get(specInfo.getString("name"));
|
||||
if (name != null) {
|
||||
specInfo.put("value", name.split(","));
|
||||
specInfo.put("selectSpecResult", name.split(","));
|
||||
}
|
||||
}
|
||||
|
||||
it.setSelectSpec(selectSpecJSON.toJSONString());
|
||||
}
|
||||
|
||||
skuResult.setTagSnap(finalSnap.toJSONString());
|
||||
}
|
||||
it.setProductSkuResult(skuResult);
|
||||
|
||||
|
||||
|
||||
// 查询sku信息
|
||||
List<TbProductSku> skuWithBLOBs = tbProductSkuMapper.selectByProductCheckGrounding(it.getId());
|
||||
List<TbProductSku> skus = tbProductSkuMapper.selectByProductId(it.getId());
|
||||
if (it.getIsDistribute() == 0) {
|
||||
int num = 0;
|
||||
for (TbProductSku item : skus) {
|
||||
num += item.getStockNumber();
|
||||
}
|
||||
it.setStockNumber(num);
|
||||
}
|
||||
it.setSkuList(skuWithBLOBs);
|
||||
|
||||
it.setGroundingSpecInfo(querySpec(Integer.valueOf(shopId), it.getId()));
|
||||
});
|
||||
}
|
||||
PageInfo pageInfo=new PageInfo(tbProductWithBLOBs);
|
||||
@@ -251,6 +207,92 @@ public class ProductService {
|
||||
}else {
|
||||
tbProductMapper.updateStock(productStockDTO.getShopId(), productStockDTO.getProductId(), productStockDTO.getStock());
|
||||
tbProductSkuMapper.updateStock(productStockDTO.getShopId(), productStockDTO.getProductId(), productStockDTO.getStock());
|
||||
|
||||
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectByProductId(product.getId());
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("shopId", productStockDTO.getShopId());
|
||||
data.put("skuId", tbProductSkus.isEmpty() ? null : tbProductSkus.get(0).getId());
|
||||
data.put("productId", productStockDTO.getProductId());
|
||||
data.put("type", "pc收银机修改库存");
|
||||
data.put("subType", product.getStockNumber() > productStockDTO.getStock() ? -1 : 1);
|
||||
data.put("number",productStockDTO.getStock() - product.getStockNumber());
|
||||
producer.sendStockRecordMsg(data);
|
||||
}
|
||||
}
|
||||
|
||||
private static void generateCombinations(List<List<String>> valuesList, int index, List<String> current, List<String> result) {
|
||||
if (index == valuesList.size()) {
|
||||
result.add(String.join(",", current));
|
||||
return;
|
||||
}
|
||||
|
||||
for (String value : valuesList.get(index)) {
|
||||
current.add(value);
|
||||
generateCombinations(valuesList, index + 1, current, result);
|
||||
current.remove(current.size() - 1); // 回溯
|
||||
}
|
||||
}
|
||||
|
||||
public Object querySpec(Integer shopId, Integer productId) {
|
||||
TbProduct tbProduct = tbProductMapper.selectByPrimaryKey(productId);
|
||||
if (tbProduct == null) {
|
||||
throw new MsgException("商品不存在");
|
||||
}
|
||||
TbProductSkuResult skuResult = tbProductSkuResultMapper.selectByPrimaryKey(productId);
|
||||
|
||||
// 重组有效规格数据
|
||||
String tagSnap = skuResult != null ? skuResult.getTagSnap() : null;
|
||||
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectGroundingByProId(productId);
|
||||
|
||||
JSONArray finalSnap = new JSONArray();
|
||||
|
||||
List<String> result = new ArrayList<>();
|
||||
if (tagSnap != null) {
|
||||
JSONArray tagSnaps = JSONObject.parseArray(tagSnap);
|
||||
List<List<String>> valuesList = new ArrayList<>();
|
||||
|
||||
// 提取所有 value 的列表
|
||||
for (int i = 0; i < tagSnaps.size(); i++) {
|
||||
JSONObject jsonObject = tagSnaps.getJSONObject(i);
|
||||
if (jsonObject.containsKey("value")) {
|
||||
String[] values = jsonObject.getString("value").split(",");
|
||||
valuesList.add(Arrays.asList(values));
|
||||
}
|
||||
}
|
||||
// 生成所有可能的排列组合
|
||||
generateCombinations(valuesList, 0, new ArrayList<>(), result);
|
||||
|
||||
}
|
||||
|
||||
ArrayList<HashMap<String, Object>> specList = new ArrayList<>();
|
||||
tbProductSkus.forEach(item -> {
|
||||
HashMap<String, Object> itemMap = new HashMap<>();
|
||||
itemMap.put("specSnap", item.getSpecSnap());
|
||||
itemMap.put("skuId", item.getId());
|
||||
specList.add(itemMap);
|
||||
});
|
||||
|
||||
|
||||
ArrayList<HashMap<String, Object>> otherVal = new ArrayList<>();
|
||||
for (String res : result) {
|
||||
boolean found = false;
|
||||
for (HashMap<String, Object> spec : specList) {
|
||||
if (res.equals(spec.get("specSnap").toString())) {
|
||||
spec.put("isGrounding", true);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
HashMap<String, Object> itemMap = new HashMap<>();
|
||||
itemMap.put("specSnap", res);
|
||||
itemMap.put("skuId", null);
|
||||
itemMap.put("isGrounding", false);
|
||||
otherVal.add(itemMap);
|
||||
}
|
||||
}
|
||||
specList.addAll(otherVal);
|
||||
return specList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -101,6 +101,11 @@ public class WxAccountUtil {
|
||||
}
|
||||
|
||||
public JSONObject sendStockWarnMsg(String shopName, String productName, Integer stock, String toUserOpenId, ShopWxMsgTypeEnum typeEnum, Integer shopId) {
|
||||
TbShopMsgState allState = shopMsgStateMapper.selectByType(ShopWxMsgTypeEnum.ALL_MSG.getType(), shopId);
|
||||
if (allState == null || allState.getState().equals(0)) {
|
||||
log.info("店铺未开启全局推送:{}", allState);
|
||||
return null;
|
||||
}
|
||||
TbShopMsgState shopMsgState = shopMsgStateMapper.selectByType(typeEnum.getType(), shopId);
|
||||
if (shopMsgState == null || shopMsgState.getState().equals(0)) {
|
||||
log.info("店铺未开启推送:{}", shopMsgState);
|
||||
|
||||
@@ -17,10 +17,13 @@
|
||||
<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
|
||||
laster_in_stock, con_warning, create_time, update_time,is_check
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
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
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_prosku_con
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
@@ -25,11 +25,11 @@
|
||||
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,
|
||||
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},
|
||||
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">
|
||||
@@ -123,6 +123,12 @@
|
||||
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
|
||||
@@ -139,4 +145,11 @@
|
||||
|
||||
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and product_id=#{productId} and status=1
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
<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>
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
<result column="icon" jdbcType="VARCHAR" property="icon" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, pay_type, pay_name, is_show_shortcut, shop_id, is_refundable, is_open_cash_drawer,
|
||||
id, pay_type, pay_name, is_show_shortcut, shop_id, is_refundable, is_open_cash_drawer,
|
||||
is_system, is_ideal, is_display, sorts, created_at, updated_at, icon
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_shop_pay_type
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
@@ -32,15 +32,15 @@
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopPayType">
|
||||
insert into tb_shop_pay_type (id, pay_type, pay_name,
|
||||
is_show_shortcut, shop_id, is_refundable,
|
||||
is_open_cash_drawer, is_system, is_ideal,
|
||||
is_display, sorts, created_at,
|
||||
insert into tb_shop_pay_type (id, pay_type, pay_name,
|
||||
is_show_shortcut, shop_id, is_refundable,
|
||||
is_open_cash_drawer, is_system, is_ideal,
|
||||
is_display, sorts, created_at,
|
||||
updated_at, icon)
|
||||
values (#{id,jdbcType=INTEGER}, #{payType,jdbcType=VARCHAR}, #{payName,jdbcType=VARCHAR},
|
||||
#{isShowShortcut,jdbcType=TINYINT}, #{shopId,jdbcType=VARCHAR}, #{isRefundable,jdbcType=TINYINT},
|
||||
#{isOpenCashDrawer,jdbcType=TINYINT}, #{isSystem,jdbcType=TINYINT}, #{isIdeal,jdbcType=TINYINT},
|
||||
#{isDisplay,jdbcType=TINYINT}, #{sorts,jdbcType=INTEGER}, #{createdAt,jdbcType=BIGINT},
|
||||
values (#{id,jdbcType=INTEGER}, #{payType,jdbcType=VARCHAR}, #{payName,jdbcType=VARCHAR},
|
||||
#{isShowShortcut,jdbcType=TINYINT}, #{shopId,jdbcType=VARCHAR}, #{isRefundable,jdbcType=TINYINT},
|
||||
#{isOpenCashDrawer,jdbcType=TINYINT}, #{isSystem,jdbcType=TINYINT}, #{isIdeal,jdbcType=TINYINT},
|
||||
#{isDisplay,jdbcType=TINYINT}, #{sorts,jdbcType=INTEGER}, #{createdAt,jdbcType=BIGINT},
|
||||
#{updatedAt,jdbcType=BIGINT}, #{icon,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopPayType">
|
||||
@@ -205,4 +205,4 @@
|
||||
|
||||
select count(id) from tb_shop_pay_type where shop_id=#{shopId} and is_display=1 and pay_type=#{payType}
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user