1.推送校验状态
This commit is contained in:
parent
5a0112132d
commit
b0243a9ddd
|
|
@ -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.getIsPack(),cartVo.getUuid(),cartVo.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@MyLog(value = "查询购物车信息", tag = LogTag.CART)
|
@MyLog(value = "查询购物车信息", tag = LogTag.CART)
|
||||||
|
|
@ -49,7 +49,7 @@ public class OrderController {
|
||||||
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);
|
return orderService.queryCart(masterId,shopId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -61,7 +61,7 @@ public class OrderController {
|
||||||
@RequestParam(value = "masterId", required = false) String masterId,
|
@RequestParam(value = "masterId", required = false) String masterId,
|
||||||
@RequestParam("cartId") Integer cartId
|
@RequestParam("cartId") Integer cartId
|
||||||
){
|
){
|
||||||
return orderService.delCart(masterId,cartId, tableId);
|
return orderService.delCart(masterId,cartId);
|
||||||
}
|
}
|
||||||
@GetMapping("/createCode")
|
@GetMapping("/createCode")
|
||||||
public Result createCode(@RequestHeader("token") String token,
|
public Result createCode(@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;
|
||||||
|
|
@ -67,4 +69,7 @@ public interface TbCashierCartMapper {
|
||||||
List<TbCashierCart> selectActivateByQrcode(@Param("tableId") String tableId, @Param("shopId") Integer shopId);
|
List<TbCashierCart> selectActivateByQrcode(@Param("tableId") String tableId, @Param("shopId") Integer shopId);
|
||||||
|
|
||||||
QueryCartPo selectProductNumByQrcode(@Param("qrcode") String qrcode, @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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,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<TbShopOpenId> tbUserShopMsgs = shopOpenIdMapper.selectStateByShopIdAndType(product.getShopId(), ShopWxMsgTypeEnum.CONSUMABLES_MSG.getType());
|
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 +134,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);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||||
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;
|
||||||
|
import com.chaozhanggui.system.cashierservice.bean.ShopWxMsgTypeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.po.*;
|
import com.chaozhanggui.system.cashierservice.entity.po.*;
|
||||||
|
|
@ -337,7 +338,7 @@ public class OrderService {
|
||||||
List<TbShopOpenId> shopOpenIds = shopOpenIdMapper.selectByShopId(Integer.valueOf(product.getShopId()));
|
List<TbShopOpenId> shopOpenIds = shopOpenIdMapper.selectByShopId(Integer.valueOf(product.getShopId()));
|
||||||
shopOpenIds.forEach(item -> {
|
shopOpenIds.forEach(item -> {
|
||||||
wxAccountUtil.sendStockWarnMsg("商品库存不足", product.getName(),
|
wxAccountUtil.sendStockWarnMsg("商品库存不足", product.getName(),
|
||||||
product.getIsDistribute() == 1 ? product.getStockNumber()-num : (int) (productSku.getStockNumber() - num), item.getOpenId());
|
product.getIsDistribute() == 1 ? product.getStockNumber()-num : (int) (productSku.getStockNumber() - num), item.getOpenId(), ShopWxMsgTypeEnum.STOCK_MSG, shopId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue