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;
|
package com.chaozhanggui.system.cashierservice;
|
||||||
|
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.task.ConsInfoTask;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -45,7 +44,6 @@ public class Shell {
|
|||||||
@Bean
|
@Bean
|
||||||
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
|
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
|
||||||
return (args) -> {
|
return (args) -> {
|
||||||
// ctx.getBean(ConsInfoTask.class).init();
|
|
||||||
logger.info("=========================启动完成==========================");
|
logger.info("=========================启动完成==========================");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,4 +51,13 @@ public class LoginContoller {
|
|||||||
@RequestHeader("clientType") String clientType){
|
@RequestHeader("clientType") String clientType){
|
||||||
return loginService.getShopInfo(token);
|
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");
|
String userId = jsonObject.getString("accountId");
|
||||||
return orderService.createCart(cartVo.getMasterId(),cartVo.getProductId(),cartVo.getShopId(),
|
return orderService.createCart(cartVo.getMasterId(),cartVo.getProductId(),cartVo.getShopId(),
|
||||||
cartVo.getSkuId(),cartVo.getNumber(),userId,clientType,cartVo.getCartId(),cartVo.getIsGift(),
|
cartVo.getSkuId(),cartVo.getNumber(),userId,clientType,cartVo.getCartId(),cartVo.getIsGift(),
|
||||||
cartVo.getIsPack(),cartVo.getUuid(),cartVo.getType(), cartVo.getTableId(), cartVo.getVipUserId());
|
cartVo.getIsPack(),cartVo.getUuid(),cartVo.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@MyLog(value = "查询购物车信息", tag = LogTag.CART)
|
@MyLog(value = "查询购物车信息", tag = LogTag.CART)
|
||||||
@@ -43,14 +43,13 @@ public class OrderController {
|
|||||||
@RequestHeader("loginName") String loginName,
|
@RequestHeader("loginName") String loginName,
|
||||||
@RequestHeader("clientType") String clientType,
|
@RequestHeader("clientType") String clientType,
|
||||||
@RequestParam(value = "masterId", required = false) String masterId,
|
@RequestParam(value = "masterId", required = false) String masterId,
|
||||||
@RequestParam(required = false) Integer tableId,
|
@RequestParam(required = false) String tableId,
|
||||||
@RequestParam(required = false) Integer vipUserId,
|
|
||||||
@RequestParam("shopId") String shopId
|
@RequestParam("shopId") String shopId
|
||||||
){
|
){
|
||||||
if (tableId == null && StrUtil.isBlank(masterId)) {
|
if (tableId == null && StrUtil.isBlank(masterId)) {
|
||||||
return Result.fail("masterId和tableId不能同 时为空");
|
return Result.fail("masterId和tableId不能同时为空");
|
||||||
}
|
}
|
||||||
return orderService.queryCart(masterId,shopId, tableId, vipUserId);
|
return orderService.queryCart(masterId,shopId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -58,6 +57,7 @@ public class OrderController {
|
|||||||
public Result delCart(@RequestHeader("token") String token,
|
public Result delCart(@RequestHeader("token") String token,
|
||||||
@RequestHeader("loginName") String loginName,
|
@RequestHeader("loginName") String loginName,
|
||||||
@RequestHeader("clientType") String clientType,
|
@RequestHeader("clientType") String clientType,
|
||||||
|
@RequestParam(required = false) String tableId,
|
||||||
@RequestParam(value = "masterId", required = false) String masterId,
|
@RequestParam(value = "masterId", required = false) String masterId,
|
||||||
@RequestParam("cartId") Integer cartId
|
@RequestParam("cartId") Integer cartId
|
||||||
){
|
){
|
||||||
|
|||||||
@@ -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.ProductStatusDTO;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.ProductStockDTO;
|
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.service.ProductService;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
@@ -58,6 +59,15 @@ public class ProductController {
|
|||||||
return productService.queryCommodityInfo(shopId,categoryId,commdityName,page,pageSize,masterId);
|
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")
|
@GetMapping(value = "queryNewCommodityInfo")
|
||||||
public Result queryNewCommodityInfo(
|
public Result queryNewCommodityInfo(
|
||||||
@RequestHeader("token") String token,
|
@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.TbCashierCart;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.po.CartPo;
|
import com.chaozhanggui.system.cashierservice.entity.po.CartPo;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.po.QueryCartPo;
|
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.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -30,8 +32,8 @@ public interface TbCashierCartMapper {
|
|||||||
TbCashierCart selectByDetail(@Param("masterId") String masterId, @Param("productId") String productId,
|
TbCashierCart selectByDetail(@Param("masterId") String masterId, @Param("productId") String productId,
|
||||||
@Param("shopId") String shopId, @Param("skuId") String skuId, @Param("day") String day,@Param("uuid") String uuid);
|
@Param("shopId") String shopId, @Param("skuId") String skuId, @Param("day") String day,@Param("uuid") String uuid);
|
||||||
|
|
||||||
TbCashierCart selectDetailByQrcode(@Param("tableId") Integer tableId, @Param("productId") String productId,
|
TbCashierCart selectDetailByQrcode(@Param("tableId") String tableId, @Param("productId") String productId,
|
||||||
@Param("shopId") String shopId, @Param("skuId") String skuId, @Param("userId") Integer userId);
|
@Param("shopId") String shopId, @Param("skuId") String skuId, @Param("uuid") String uuid);
|
||||||
|
|
||||||
List<TbCashierCart> selectByMaskerId(@Param("masterId")String masterId, @Param("shopId")Integer shopId,@Param("status") String status,@Param("day") String day);
|
List<TbCashierCart> selectByMaskerId(@Param("masterId")String masterId, @Param("shopId")Integer shopId,@Param("status") String status,@Param("day") String day);
|
||||||
|
|
||||||
@@ -45,12 +47,7 @@ public interface TbCashierCartMapper {
|
|||||||
@Param("status") String status, @Param("day") String day, @Param("uuid") String uuid);
|
@Param("status") String status, @Param("day") String day, @Param("uuid") String uuid);
|
||||||
|
|
||||||
List<TbCashierCart> selectAllCreateOrder(@Param("masterId") String masterId, @Param("shopId") Integer shopId,
|
List<TbCashierCart> selectAllCreateOrder(@Param("masterId") String masterId, @Param("shopId") Integer shopId,
|
||||||
@Param("day") String day, @Param("status") String status,
|
@Param("day") String day, @Param("status") String status,@Param("uuid") String uuid);
|
||||||
@Param("uuid") String uuid);
|
|
||||||
|
|
||||||
List<TbCashierCart> selectAllCreateOrder2(@Param("masterId") String masterId, @Param("shopId") Integer shopId,
|
|
||||||
@Param("day") String day, @Param("status") String status,
|
|
||||||
@Param("uuid") String uuid, @Param("tableId") Integer tableId, @Param("vipUserId") Integer vipUserId);
|
|
||||||
List<CartPo> selectCartList( @Param("cartId") String shopId);
|
List<CartPo> selectCartList( @Param("cartId") String shopId);
|
||||||
|
|
||||||
int updateByOrderId(@Param("orderId") String orderId,@Param("status") String status);
|
int updateByOrderId(@Param("orderId") String orderId,@Param("status") String status);
|
||||||
@@ -69,7 +66,10 @@ public interface TbCashierCartMapper {
|
|||||||
|
|
||||||
List<TbCashierCart> selectByOrderId(@Param("orderId") String orderId,@Param("status") String status);
|
List<TbCashierCart> selectByOrderId(@Param("orderId") String orderId,@Param("status") String status);
|
||||||
|
|
||||||
List<TbCashierCart> selectActivateByQrcode(@Param("tableId") Integer tableId, @Param("shopId") Integer shopId, @Param("userId") Integer userId);
|
List<TbCashierCart> selectActivateByQrcode(@Param("tableId") String tableId, @Param("shopId") Integer shopId);
|
||||||
|
|
||||||
QueryCartPo selectProductNumByQrcode(@Param("tableId") Integer tableId, @Param("shopId") Integer shopId, @Param("vipUserId") Integer vipUserId);
|
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} ")
|
@Update("update tb_product_sku set stock_number=stock_number-#{num} WHERE id=#{id} ")
|
||||||
int decrStockUnCheck(String id, int num);
|
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);
|
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}")
|
@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}")
|
@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);
|
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,11 +24,13 @@ public interface TbProskuConMapper {
|
|||||||
|
|
||||||
|
|
||||||
List<TbProskuCon> selectBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
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<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> 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")
|
@Select("select * from tb_shop_open_id where shop_id=#{shopId} and status=1")
|
||||||
List<TbShopOpenId> selectByShopId(Integer integer);
|
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);
|
List<TbShopOpenId> selectStateByShopIdAndType(@Param("shopId") String shopId, @Param("type") int type);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ public class TbConsInfo implements Serializable {
|
|||||||
|
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
private String isCheck;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
@@ -156,4 +158,12 @@ public class TbConsInfo implements Serializable {
|
|||||||
public void setPrice(BigDecimal price) {
|
public void setPrice(BigDecimal price) {
|
||||||
this.price = 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;
|
package com.chaozhanggui.system.cashierservice.entity;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
public class TbProductWithBLOBs extends TbProduct implements Serializable {
|
public class TbProductWithBLOBs extends TbProduct implements Serializable {
|
||||||
|
private Object groundingSpecInfo;
|
||||||
private String images;
|
private String images;
|
||||||
|
|
||||||
private String video;
|
private String video;
|
||||||
@@ -20,58 +24,34 @@ public class TbProductWithBLOBs extends TbProduct implements Serializable {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public List<?> getSkuList() {
|
public void setGroundingSpecInfo(Object groundingSpecInfo) {
|
||||||
return skuList;
|
this.groundingSpecInfo = groundingSpecInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSkuList(List<?> skuList) {
|
public void setSkuList(List<?> skuList) {
|
||||||
this.skuList = skuList;
|
this.skuList = skuList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getImages() {
|
|
||||||
return images;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImages(String images) {
|
public void setImages(String images) {
|
||||||
this.images = images == null ? null : images.trim();
|
this.images = images == null ? null : images.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVideo() {
|
|
||||||
return video;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVideo(String video) {
|
public void setVideo(String video) {
|
||||||
this.video = video == null ? null : video.trim();
|
this.video = video == null ? null : video.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNotice() {
|
|
||||||
return notice;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNotice(String notice) {
|
public void setNotice(String notice) {
|
||||||
this.notice = notice == null ? null : notice.trim();
|
this.notice = notice == null ? null : notice.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGroupSnap() {
|
|
||||||
return groupSnap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGroupSnap(String groupSnap) {
|
public void setGroupSnap(String groupSnap) {
|
||||||
this.groupSnap = groupSnap == null ? null : groupSnap.trim();
|
this.groupSnap = groupSnap == null ? null : groupSnap.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSpecInfo() {
|
|
||||||
return specInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpecInfo(String specInfo) {
|
public void setSpecInfo(String specInfo) {
|
||||||
this.specInfo = specInfo == null ? null : specInfo.trim();
|
this.specInfo = specInfo == null ? null : specInfo.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSelectSpec() {
|
|
||||||
return selectSpec;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSelectSpec(String selectSpec) {
|
public void setSelectSpec(String selectSpec) {
|
||||||
this.selectSpec = selectSpec == null ? null : selectSpec.trim();
|
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;
|
||||||
|
}
|
||||||
@@ -8,8 +8,7 @@ public class CartVo {
|
|||||||
|
|
||||||
// orderId不为空为代客下单
|
// orderId不为空为代客下单
|
||||||
private String masterId;
|
private String masterId;
|
||||||
private Integer tableId;
|
private String tableId;
|
||||||
private Integer vipUserId;
|
|
||||||
private String shopId;
|
private String shopId;
|
||||||
private Integer skuId;
|
private Integer skuId;
|
||||||
private Integer number;
|
private Integer number;
|
||||||
|
|||||||
@@ -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) {
|
if (Objects.isNull(tbProskuCons) || tbProskuCons.size() <= 0) {
|
||||||
log.info("耗材信息未配置");
|
log.info("耗材信息未配置或未开启校验");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +124,8 @@ public class ConsMsgConsumer {
|
|||||||
log.info("耗材名称: {}, conwarning:{},stockNumber:{}",tbConsInfo.getConName(),
|
log.info("耗材名称: {}, conwarning:{},stockNumber:{}",tbConsInfo.getConName(),
|
||||||
tbConsInfo.getConWarning(),tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()));
|
tbConsInfo.getConWarning(),tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()));
|
||||||
if (N.egt(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);
|
log.info("待推送openId列表: {}", tbUserShopMsgs);
|
||||||
if (Objects.nonNull(tbUserShopMsgs) && tbUserShopMsgs.size()>0) {
|
if (Objects.nonNull(tbUserShopMsgs) && tbUserShopMsgs.size()>0) {
|
||||||
tbUserShopMsgs.parallelStream().forEach(tbUserShopMsg->{
|
tbUserShopMsgs.parallelStream().forEach(tbUserShopMsg->{
|
||||||
@@ -133,7 +135,8 @@ public class ConsMsgConsumer {
|
|||||||
log.info("开始推送耗材模板消息,rediskey:{}", value);
|
log.info("开始推送耗材模板消息,rediskey:{}", value);
|
||||||
if (Objects.isNull(value)) {
|
if (Objects.isNull(value)) {
|
||||||
JSONObject jsonObject = wxAccountUtil.sendStockWarnMsg("耗材库存不足", tbConsInfo.getConName(),
|
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) {
|
if (jsonObject != null) {
|
||||||
log.info("写入redis:{}",key);
|
log.info("写入redis:{}",key);
|
||||||
redisUtil.saveMessage(key, "1", 30 * 60);
|
redisUtil.saveMessage(key, "1", 30 * 60);
|
||||||
|
|||||||
@@ -47,4 +47,8 @@ public interface RabbitConstants {
|
|||||||
|
|
||||||
String EXCHANGE_STOCK_RECORD = "exchange.stock.record";
|
String EXCHANGE_STOCK_RECORD = "exchange.stock.record";
|
||||||
String ROUTING_STOCK_RECORD_SALE = "routing.stock.record.sale";
|
String ROUTING_STOCK_RECORD_SALE = "routing.stock.record.sale";
|
||||||
|
|
||||||
|
// 库存记录
|
||||||
|
public static final String 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) {
|
public <T> void sendStockSaleMsg(T data) {
|
||||||
sendMsg(RabbitConstants.EXCHANGE_STOCK_RECORD, RabbitConstants.ROUTING_STOCK_RECORD_SALE, 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<>();
|
List<TbConsInfoFlow> consInfoFlows=new ArrayList<>();
|
||||||
|
|
||||||
for (TbOrderDetail orderDetail : orderDetails) {
|
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){
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (TbProskuCon proskuCon : proskuCons) {
|
for (TbProskuCon proskuCon : proskuCons) {
|
||||||
TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(proskuCon.getConInfoId());
|
TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(proskuCon.getConInfoId());
|
||||||
if(Objects.nonNull(tbConsInfo)&&"1".equals(tbConsInfo.getStatus())){
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -191,4 +192,23 @@ public class LoginService {
|
|||||||
|
|
||||||
return Result.success(SUCCESS,shopInfo);
|
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;
|
package com.chaozhanggui.system.cashierservice.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.thread.ThreadUtil;
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@@ -26,6 +26,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.Timestamp;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@@ -77,6 +78,12 @@ public class OrderService {
|
|||||||
|
|
||||||
private final TbShopOpenIdMapper shopOpenIdMapper;
|
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<Integer>> codeMap = new ConcurrentHashMap<>();
|
||||||
private static ConcurrentHashMap<String, HashSet<String>> userMap = new ConcurrentHashMap<>();
|
private static ConcurrentHashMap<String, HashSet<String>> userMap = new ConcurrentHashMap<>();
|
||||||
@@ -92,7 +99,7 @@ public class OrderService {
|
|||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Result createCart(String masterId, String productId, String shopId, Integer skuId, Integer number,
|
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, Integer tableId, Integer vipId) {
|
String userId, String clientType, Integer cartId, String isGift, String isPack, String uuid, String type) {
|
||||||
if (Objects.isNull(number) || number < 0) {
|
if (Objects.isNull(number) || number < 0) {
|
||||||
return Result.fail(CodeEnum.NUMBER);
|
return Result.fail(CodeEnum.NUMBER);
|
||||||
}
|
}
|
||||||
@@ -121,6 +128,32 @@ public class OrderService {
|
|||||||
return Result.fail(CodeEnum.PRODUCTSKUERROR);
|
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);
|
String exists = redisUtil.getMessage(RedisCst.ORDER_CART_EXISTS + cartId);
|
||||||
|
|
||||||
// 首次加入购物车,并且拥有起售数,设置为起售数
|
// 首次加入购物车,并且拥有起售数,设置为起售数
|
||||||
@@ -145,6 +178,7 @@ public class OrderService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isEmpty(masterId)) {
|
||||||
boolean flag = redisUtil.exists("SHOP:CODE:" + clientType + ":" + shopId);
|
boolean flag = redisUtil.exists("SHOP:CODE:" + clientType + ":" + shopId);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
String code = redisUtil.getMessage("SHOP:CODE:" + clientType + ":" + shopId).toString();
|
String code = redisUtil.getMessage("SHOP:CODE:" + clientType + ":" + shopId).toString();
|
||||||
@@ -156,36 +190,50 @@ public class OrderService {
|
|||||||
redisUtil.saveMessage("SHOP:CODE:" + clientType + ":" + shopId, "1");
|
redisUtil.saveMessage("SHOP:CODE:" + clientType + ":" + shopId, "1");
|
||||||
masterId = "#" + String.format("%03d", 1);
|
masterId = "#" + String.format("%03d", 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TbCashierCart cart = cashierCartMapper.selectByPrimaryKey(cartId);
|
TbCashierCart cart = cashierCartMapper.selectByPrimaryKey(cartId);
|
||||||
if (Objects.nonNull(cart)) {
|
if (Objects.nonNull(cart)) {
|
||||||
cart.setSkuId(skuId.toString());
|
|
||||||
cart.setNumber(number);
|
//查询现有规格商品
|
||||||
cart.setIsGift(isGift);
|
if("edit".equals(type)&&!cart.getSkuId().equals(skuId.toString())){
|
||||||
cart.setIsPack(isPack);
|
TbCashierCart cashierCart = cashierCartMapper.selectByDetail(masterId, productId, shopId, skuId.toString(), DateUtils.getDay(), uuid);
|
||||||
if (isPack.equals("false")){
|
if(Objects.nonNull(cashierCart)){
|
||||||
cart.setPackFee(BigDecimal.ZERO);
|
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 {
|
}else {
|
||||||
cart.setPackFee(new BigDecimal(number).multiply(product.getPackFee()));
|
cart.setSkuId(skuId.toString());
|
||||||
}
|
cart.setNumber(number);
|
||||||
if (isGift.equals("false")) {
|
cart.setIsGift(isGift);
|
||||||
cart.setTotalAmount(new BigDecimal(number).multiply(skuWithBLOBs.getSalePrice()).add(cart.getPackFee()));
|
cart.setIsPack(isPack);
|
||||||
} else {
|
if (isPack.equals("false")){
|
||||||
cart.setTotalAmount(BigDecimal.ZERO);
|
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 {
|
} else {
|
||||||
List<TbCashierCart> list = userId == null && tableId == null ? cashierCartMapper.selectALlByMasterId(masterId, "create")
|
List<TbCashierCart> list = cashierCartMapper.selectALlByMasterId(masterId, "create");
|
||||||
: cashierCartMapper.selectActivateByQrcode(tableId, Integer.valueOf(shopId), vipId);
|
TbCashierCart cashierCart = cashierCartMapper.selectByDetail(masterId, productId, shopId, skuId.toString(), DateUtils.getDay(), uuid);
|
||||||
|
|
||||||
TbCashierCart cashierCart = userId == null && tableId == null ? cashierCartMapper.selectByDetail(masterId, productId, shopId, skuId.toString(), DateUtils.getDay(), uuid)
|
|
||||||
: cashierCartMapper.selectDetailByQrcode(tableId, productId, shopId, skuId.toString(), vipId);
|
|
||||||
|
|
||||||
if (number > 0) {
|
if (number > 0) {
|
||||||
if (Objects.isNull(cashierCart)) {
|
if (Objects.isNull(cashierCart)) {
|
||||||
cashierCart = new TbCashierCart();
|
cashierCart = new TbCashierCart();
|
||||||
@@ -193,9 +241,6 @@ public class OrderService {
|
|||||||
cashierCart.setCreatedAt(System.currentTimeMillis());
|
cashierCart.setCreatedAt(System.currentTimeMillis());
|
||||||
cashierCart.setIsSku(product.getTypeEnum());
|
cashierCart.setIsSku(product.getTypeEnum());
|
||||||
cashierCart.setMasterId(masterId);
|
cashierCart.setMasterId(masterId);
|
||||||
if (tableId != null) {
|
|
||||||
cashierCart.setTableId(String.valueOf(tableId));
|
|
||||||
}
|
|
||||||
cashierCart.setUuid(uuid);
|
cashierCart.setUuid(uuid);
|
||||||
cashierCart.setMerchantId(userId);
|
cashierCart.setMerchantId(userId);
|
||||||
cashierCart.setName(product.getName());
|
cashierCart.setName(product.getName());
|
||||||
@@ -207,7 +252,6 @@ public class OrderService {
|
|||||||
cashierCart.setStatus("create");
|
cashierCart.setStatus("create");
|
||||||
cashierCart.setIsPack(isPack);
|
cashierCart.setIsPack(isPack);
|
||||||
cashierCart.setIsGift(isGift);
|
cashierCart.setIsGift(isGift);
|
||||||
cashierCart.setUserId(vipId == null ? Integer.valueOf(userId) : vipId);
|
|
||||||
if (isGift.equals("false")) {
|
if (isGift.equals("false")) {
|
||||||
cashierCart.setTotalAmount(new BigDecimal(number).multiply(skuWithBLOBs.getSalePrice()));
|
cashierCart.setTotalAmount(new BigDecimal(number).multiply(skuWithBLOBs.getSalePrice()));
|
||||||
} else {
|
} else {
|
||||||
@@ -221,6 +265,7 @@ public class OrderService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
cashierCart.setTotalNumber(number);
|
cashierCart.setTotalNumber(number);
|
||||||
|
cashierCart.setUserId(Integer.valueOf(userId));
|
||||||
cashierCart.setNumber(number);
|
cashierCart.setNumber(number);
|
||||||
cashierCart.setUuid(uuid);
|
cashierCart.setUuid(uuid);
|
||||||
cashierCart.setCategoryId(product.getCategoryId());
|
cashierCart.setCategoryId(product.getCategoryId());
|
||||||
@@ -257,9 +302,7 @@ public class OrderService {
|
|||||||
skuWithBLOBs.setUpdatedAt(System.currentTimeMillis());
|
skuWithBLOBs.setUpdatedAt(System.currentTimeMillis());
|
||||||
tbProductSkuMapper.updateByPrimaryKey(skuWithBLOBs);
|
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()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -272,7 +315,8 @@ public class OrderService {
|
|||||||
* @param productSku sku
|
* @param productSku sku
|
||||||
*/
|
*/
|
||||||
private void checkWarnLineAndSendMsg(TbProductSku productSku, TbProduct product, Integer shopId, Integer num) {
|
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) {
|
if (productSku.getWarnLine() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -300,22 +344,16 @@ public class OrderService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result queryCart(String masterId, String shopId, Integer tableId, Integer vipUserId) {
|
public Result queryCart(String masterId, String shopId) {
|
||||||
if (StringUtils.isEmpty(shopId)) {
|
if (StringUtils.isEmpty(shopId)) {
|
||||||
return Result.fail(CodeEnum.SHOPINFONOEXIST);
|
return Result.fail(CodeEnum.SHOPINFONOEXIST);
|
||||||
}
|
}
|
||||||
String day = DateUtils.getDay();
|
String day = DateUtils.getDay();
|
||||||
|
List<TbCashierCart> list = cashierCartMapper.selectByMaskerId(masterId, Integer.valueOf(shopId),"create",day);
|
||||||
List<TbCashierCart> list;
|
if (list.size() < 1){
|
||||||
if (tableId != null) {
|
|
||||||
list = cashierCartMapper.selectActivateByQrcode(tableId, Integer.valueOf(shopId), vipUserId);
|
|
||||||
}else {
|
|
||||||
list = cashierCartMapper.selectByMaskerId(masterId, Integer.valueOf(shopId),"create",day);
|
|
||||||
}
|
|
||||||
if (StrUtil.isNotBlank(masterId) && list.isEmpty()){
|
|
||||||
list = cashierCartMapper.selectByMaskerId(masterId, Integer.valueOf(shopId), "refund",day);
|
list = cashierCartMapper.selectByMaskerId(masterId, Integer.valueOf(shopId), "refund",day);
|
||||||
if (!list.isEmpty()){
|
if (list.size() > 0){
|
||||||
if (list.isEmpty()) {
|
if (list.size() < 1) {
|
||||||
return Result.fail(CodeEnum.CARTJH);
|
return Result.fail(CodeEnum.CARTJH);
|
||||||
}
|
}
|
||||||
int orderId = 0;
|
int orderId = 0;
|
||||||
@@ -357,13 +395,7 @@ public class OrderService {
|
|||||||
}
|
}
|
||||||
// TbProductSkuResult skuResult = tbProductSkuResultMapper.selectByPr imaryKey(Integer.valueOf(cashierCart.getProductId()));
|
// TbProductSkuResult skuResult = tbProductSkuResultMapper.selectByPr imaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||||
}
|
}
|
||||||
|
QueryCartPo queryCartPo = cashierCartMapper.selectProductNumByMarketId(day, shopId, masterId);
|
||||||
QueryCartPo queryCartPo;
|
|
||||||
if (tableId == null) {
|
|
||||||
queryCartPo = cashierCartMapper.selectProductNumByMarketId(day, shopId, masterId);
|
|
||||||
}else {
|
|
||||||
queryCartPo = cashierCartMapper.selectProductNumByQrcode(tableId, Integer.valueOf(shopId), vipUserId);
|
|
||||||
}
|
|
||||||
queryCartPo.setPackAmount(packAmount);
|
queryCartPo.setPackAmount(packAmount);
|
||||||
queryCartPo.setTotalAmount(totalAmount);
|
queryCartPo.setTotalAmount(totalAmount);
|
||||||
// queryCartPo.setTotalAmount(totalAmount.add(packAmount));
|
// queryCartPo.setTotalAmount(totalAmount.add(packAmount));
|
||||||
@@ -406,7 +438,7 @@ public class OrderService {
|
|||||||
List<String> skuIds=new ArrayList<>();
|
List<String> skuIds=new ArrayList<>();
|
||||||
skuIds.add(cashierCart.getSkuId());
|
skuIds.add(cashierCart.getSkuId());
|
||||||
|
|
||||||
cashierCartMapper.deleteByCartIdOrTableId(masterId, cartId, null);
|
cashierCartMapper.deleteByCartId(masterId, cartId);
|
||||||
|
|
||||||
return Result.success(CodeEnum.SUCCESS);
|
return Result.success(CodeEnum.SUCCESS);
|
||||||
}
|
}
|
||||||
@@ -534,7 +566,6 @@ public class OrderService {
|
|||||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||||
TbProductSkuWithBLOBs skuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
|
TbProductSkuWithBLOBs skuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
|
||||||
|
|
||||||
log.info("下单,开始校验库存预警,购物车id:{}", cashierCart.getId());
|
|
||||||
CompletableFuture.runAsync(() -> checkWarnLineAndSendMsg(skuWithBLOBs, product, Integer.valueOf(cashierCart.getShopId()), cashierCart.getNumber()));
|
CompletableFuture.runAsync(() -> checkWarnLineAndSendMsg(skuWithBLOBs, product, Integer.valueOf(cashierCart.getShopId()), cashierCart.getNumber()));
|
||||||
|
|
||||||
// 已经添加的商品,修改数量
|
// 已经添加的商品,修改数量
|
||||||
@@ -789,7 +820,6 @@ public class OrderService {
|
|||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
redisUtil.deleteByKey("SHOP:CODE:USER:" + clientType + ":" + shopId + ":" + day + userId);
|
redisUtil.deleteByKey("SHOP:CODE:USER:" + clientType + ":" + shopId + ":" + day + userId);
|
||||||
;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -851,8 +881,7 @@ public class OrderService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Result clearCart(CartVo cartVo) {
|
public Result clearCart(CartVo cartVo) {
|
||||||
String day = DateUtils.getDay();
|
String day = DateUtils.getDay();
|
||||||
List<TbCashierCart> list = cashierCartMapper.selectAllCreateOrder2(
|
List<TbCashierCart> list = cashierCartMapper.selectAllCreateOrder(cartVo.getMasterId(), Integer.valueOf(cartVo.getShopId()), day, "create", cartVo.getUuid());
|
||||||
cartVo.getMasterId(), Integer.valueOf(cartVo.getShopId()), day, "create", cartVo.getUuid(), cartVo.getTableId(), cartVo.getVipUserId());
|
|
||||||
int orderId = 0;
|
int orderId = 0;
|
||||||
List<ProductSkuPo> productSkuPos=new ArrayList<>();
|
List<ProductSkuPo> productSkuPos=new ArrayList<>();
|
||||||
List<String> skuIds=new ArrayList<>();
|
List<String> skuIds=new ArrayList<>();
|
||||||
|
|||||||
@@ -9,9 +9,11 @@ import com.chaozhanggui.system.cashierservice.dao.*;
|
|||||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.ProductStatusDTO;
|
import com.chaozhanggui.system.cashierservice.entity.dto.ProductStatusDTO;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.ProductStockDTO;
|
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.entity.vo.ShopCategoryVo;
|
||||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||||
import com.chaozhanggui.system.cashierservice.interceptor.LimitSubmitAspect;
|
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.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||||
@@ -46,6 +48,12 @@ public class ProductService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private LimitSubmitAspect limitSubmitAspect;
|
private LimitSubmitAspect limitSubmitAspect;
|
||||||
|
|
||||||
|
private final RabbitProducer producer;
|
||||||
|
|
||||||
|
public ProductService(RabbitProducer producer) {
|
||||||
|
this.producer = producer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Result queryCategory(String shopId,Integer page,Integer pageSize){
|
public Result queryCategory(String shopId,Integer page,Integer pageSize){
|
||||||
PageHelperUtil.startPage(page, pageSize);
|
PageHelperUtil.startPage(page, pageSize);
|
||||||
@@ -127,72 +135,20 @@ public class ProductService {
|
|||||||
it.setTbProductSpec(tbProductSpec);
|
it.setTbProductSpec(tbProductSpec);
|
||||||
|
|
||||||
TbProductSkuResult skuResult=tbProductSkuResultMapper.selectByPrimaryKey(it.getId());
|
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);
|
it.setProductSkuResult(skuResult);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 查询sku信息
|
// 查询sku信息
|
||||||
List<TbProductSku> skuWithBLOBs = tbProductSkuMapper.selectByProductCheckGrounding(it.getId());
|
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.setSkuList(skuWithBLOBs);
|
||||||
|
|
||||||
|
it.setGroundingSpecInfo(querySpec(Integer.valueOf(shopId), it.getId()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
PageInfo pageInfo=new PageInfo(tbProductWithBLOBs);
|
PageInfo pageInfo=new PageInfo(tbProductWithBLOBs);
|
||||||
@@ -251,6 +207,92 @@ public class ProductService {
|
|||||||
}else {
|
}else {
|
||||||
tbProductMapper.updateStock(productStockDTO.getShopId(), productStockDTO.getProductId(), productStockDTO.getStock());
|
tbProductMapper.updateStock(productStockDTO.getShopId(), productStockDTO.getProductId(), productStockDTO.getStock());
|
||||||
tbProductSkuMapper.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) {
|
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);
|
TbShopMsgState shopMsgState = shopMsgStateMapper.selectByType(typeEnum.getType(), shopId);
|
||||||
if (shopMsgState == null || shopMsgState.getState().equals(0)) {
|
if (shopMsgState == null || shopMsgState.getState().equals(0)) {
|
||||||
log.info("店铺未开启推送:{}", shopMsgState);
|
log.info("店铺未开启推送:{}", shopMsgState);
|
||||||
|
|||||||
@@ -65,8 +65,8 @@
|
|||||||
<include refid="Base_Column_List"/>
|
<include refid="Base_Column_List"/>
|
||||||
from tb_cashier_cart where table_id = #{tableId} and product_id = #{productId} and shop_id = #{shopId} and
|
from tb_cashier_cart where table_id = #{tableId} and product_id = #{productId} and shop_id = #{shopId} and
|
||||||
sku_id = #{skuId}
|
sku_id = #{skuId}
|
||||||
<if test="userId != null">
|
<if test="uuid != null">
|
||||||
and user_id = #{userId}
|
and uuid = #{uuid}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectByMaskerId" resultType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
<select id="selectByMaskerId" resultType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
||||||
@@ -91,27 +91,6 @@
|
|||||||
and trade_day = #{day}
|
and trade_day = #{day}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectAllCreateOrder2" resultType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
|
||||||
select
|
|
||||||
<include refid="Base_Column_List"/>
|
|
||||||
from tb_cashier_cart where shop_id = #{shopId} and status = #{status}
|
|
||||||
<if test="uuid != null and uuid != ''">
|
|
||||||
and uuid = #{uuid}
|
|
||||||
</if>
|
|
||||||
<if test="day != null and day !=''">
|
|
||||||
and trade_day = #{day}
|
|
||||||
</if>
|
|
||||||
<if test="tableId != null and vipUserId != null">
|
|
||||||
and (table_id = #{tableId} or user_id=#{vipUserId})
|
|
||||||
</if>
|
|
||||||
<if test="tableId != null and vipUserId == null">
|
|
||||||
and table_id = #{tableId} and master_id = #{masterId}
|
|
||||||
</if>
|
|
||||||
<if test="tableId == null and vipUserId == null">
|
|
||||||
and master_id = #{masterId}
|
|
||||||
</if>
|
|
||||||
</select>
|
|
||||||
<select id="selectProductNumByMarketId" resultType="com.chaozhanggui.system.cashierservice.entity.po.QueryCartPo">
|
<select id="selectProductNumByMarketId" resultType="com.chaozhanggui.system.cashierservice.entity.po.QueryCartPo">
|
||||||
select ifnull(count(*),0) as productNum,ifnull(sum(number),0)as productSum from (select count(*),number from tb_cashier_cart where trade_day = #{day} and master_id = #{masterId} and shop_id = #{shopId} group by product_id ) a
|
select ifnull(count(*),0) as productNum,ifnull(sum(number),0)as productSum from (select count(*),number from tb_cashier_cart where trade_day = #{day} and master_id = #{masterId} and shop_id = #{shopId} group by product_id ) a
|
||||||
</select>
|
</select>
|
||||||
@@ -429,22 +408,13 @@
|
|||||||
|
|
||||||
<select id="selectActivateByQrcode"
|
<select id="selectActivateByQrcode"
|
||||||
resultType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
resultType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
||||||
select * from tb_cashier_cart where shop_id = #{shopId} and status = 'create'
|
select * from tb_cashier_cart where table_id = #{tableId} and shop_id = #{shopId} and status = 'create'
|
||||||
and table_id = #{tableId}
|
|
||||||
<if test="userId != null">
|
|
||||||
and user_id=#{userId}
|
|
||||||
</if>
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
<select id="selectProductNumByQrcode"
|
<select id="selectProductNumByQrcode"
|
||||||
resultType="com.chaozhanggui.system.cashierservice.entity.po.QueryCartPo">
|
resultType="com.chaozhanggui.system.cashierservice.entity.po.QueryCartPo">
|
||||||
select ifnull(count(*),0) as productNum,ifnull(sum(number),0)as productSum
|
select ifnull(count(*),0) as productNum,ifnull(sum(number),0)as productSum
|
||||||
from (select count(*),number
|
from (select count(*),number
|
||||||
from tb_cashier_cart where table_id = #{tableId} and shop_id = #{shopId}
|
from tb_cashier_cart where table_id = #{qrcode} and shop_id = #{shopId} group by product_id ) a
|
||||||
<if test="vipUserId != null">
|
|
||||||
and user_id=#{vipUserId}
|
|
||||||
</if>
|
|
||||||
group by product_id ) a
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,10 +17,13 @@
|
|||||||
<result column="con_warning" jdbcType="DECIMAL" property="conWarning" />
|
<result column="con_warning" jdbcType="DECIMAL" property="conWarning" />
|
||||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
|
<result column="is_check" jdbcType="VARCHAR" property="isCheck" />
|
||||||
|
|
||||||
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Base_Column_List">
|
<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,
|
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>
|
</sql>
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
|
|||||||
@@ -123,6 +123,12 @@
|
|||||||
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and status=1
|
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and status=1
|
||||||
</select>
|
</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 id="selectIdBySkuIdAndShopId" resultType="java.lang.Integer">
|
||||||
SELECT
|
SELECT
|
||||||
p.con_info_id
|
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 * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and product_id=#{productId} and status=1
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
Reference in New Issue
Block a user