Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	src/main/java/com/chaozhanggui/system/cashierservice/dao/TbUserShopMsgMapper.java
#	src/main/java/com/chaozhanggui/system/cashierservice/entity/TbUserShopMsg.java
#	src/main/resources/mapper/TbUserShopMsgMapper.xml
This commit is contained in:
2024-06-28 14:12:24 +08:00
16 changed files with 259 additions and 184 deletions

View File

@@ -130,6 +130,16 @@ public class CartService {
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = productSkuMapper.selectByPrimaryKey(Integer.valueOf(skuId));
JSONObject objectMsg=new JSONObject();
objectMsg.put("skuId",tbProductSkuWithBLOBs.getId());
objectMsg.put("shopId",Integer.valueOf(shopId));
producer.con_msg(objectMsg.toString());
if (Integer.valueOf(tbProduct.getIsPauseSale()).equals(1)) {
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("status", "fail");
@@ -149,6 +159,11 @@ public class CartService {
redisUtil.saveMessage(RedisCst.PRODUCT + shopId + ":product" + productId, tbProduct.getStockNumber() + "");
}
skuNum = redisUtil.getMessage(RedisCst.PRODUCT + shopId + ":product" + productId);
if (!skuNum.equals(tbProduct.getStockNumber() + "")) {
skuNum = tbProduct.getStockNumber() + "";
redisUtil.saveMessage(RedisCst.PRODUCT + shopId + ":product" + productId, skuNum);
}
} else {
boolean exist = redisUtil.exists(RedisCst.PRODUCT + shopId + ":" + skuId);
if (!exist) {
@@ -156,6 +171,11 @@ public class CartService {
redisUtil.saveMessage(RedisCst.PRODUCT + shopId + ":" + skuId, Math.round(stock) + "");
}
skuNum = redisUtil.getMessage(RedisCst.PRODUCT + shopId + ":" + skuId);
if (!skuNum.equals(Math.round(tbProductSkuWithBLOBs.getStockNumber()) + "")) {
skuNum = Math.round(tbProductSkuWithBLOBs.getStockNumber()) + "";
redisUtil.saveMessage(RedisCst.PRODUCT + shopId + ":product" + productId, skuNum);
}
}
Integer buyNum = jsonObject.getInteger("num");

View File

@@ -53,6 +53,34 @@ public class LoginService {
RedisUtil redisUtil;
@Autowired
TbUserShopMsgMapper tbUserShopMsgMapper;
public Result wxBusinessLogin(String openId,String shopId){
TbUserShopMsg shopMsg= tbUserShopMsgMapper.selectByPrimaryKey(Integer.valueOf(shopId));
if(Objects.isNull(shopMsg)){
shopMsg=new TbUserShopMsg();
shopMsg.setShopId(Integer.valueOf(shopId));
shopMsg.setOpenId(openId);
shopMsg.setCreateTime(new Date());
shopMsg.setStatus("1");
tbUserShopMsgMapper.insert(shopMsg);
}else {
shopMsg.setOpenId(openId);
shopMsg.setUpdateTime(new Date());
tbUserShopMsgMapper.updateByPrimaryKey(shopMsg);
}
return Result.success(CodeEnum.SUCCESS,shopMsg);
}
@Transactional(rollbackFor = Exception.class)
public Result wxCustomLogin(String openId, String headImage, String nickName, String telephone, String ip) throws Exception {
TbUserInfo userInfo = new TbUserInfo();