1.公众号订阅新增type类型

This commit is contained in:
2024-08-02 10:59:53 +08:00
parent ad5cd56596
commit 567a5a0e23
7 changed files with 33 additions and 18 deletions

View File

@@ -4,7 +4,6 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.redis.RedisCst;
@@ -20,7 +19,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.*;
@@ -64,7 +62,7 @@ public class LoginService {
this.shopOpenIdMapper = shopOpenIdMapper;
}
public void addShopId(String openId,String shopId) {
public void addShopId(String openId, String shopId, Integer type) {
TbUserShopMsg shopMsg= tbUserShopMsgMapper.selectByShopIdAndOpenId(Integer.valueOf(shopId),openId);
if(Objects.isNull(shopMsg)){
shopMsg=new TbUserShopMsg();
@@ -76,13 +74,17 @@ public class LoginService {
}
// 为商家绑定openid
if (shopOpenIdMapper.countByOpenId(openId, Integer.valueOf(shopId)) == null) {
TbShopOpenId tbShopOpenId = shopOpenIdMapper.countByOpenId(openId, Integer.valueOf(shopId), type);
if ( tbShopOpenId == null) {
TbShopOpenId shopOpenId = new TbShopOpenId();
shopOpenId.setOpenId(openId);
shopOpenId.setCreateTime(DateUtil.date());
shopOpenId.setShopId(Integer.valueOf(shopId));
shopOpenId.setStatus(1);
shopOpenIdMapper.insert(shopOpenId);
}else {
tbShopOpenId.setUpdateTime(DateUtil.date());
shopOpenIdMapper.updateByPrimaryKeySelective(tbShopOpenId);
}
}
@@ -95,17 +97,17 @@ public class LoginService {
shopMsg.setOpenId(openId);
shopMsg.setCreateTime(new Date());
shopMsg.setStatus("1");
tbUserShopMsgMapper.insert(shopMsg);
// tbUserShopMsgMapper.insert(shopMsg);
}
// 为商家绑定openid
if (shopOpenIdMapper.countByOpenId(openId, Integer.valueOf(shopId)) == null) {
if (shopOpenIdMapper.countByOpenId(openId, Integer.valueOf(shopId), null) == null) {
TbShopOpenId shopOpenId = new TbShopOpenId();
shopOpenId.setOpenId(openId);
shopOpenId.setCreateTime(DateUtil.date());
shopOpenId.setShopId(Integer.valueOf(shopId));
shopOpenId.setStatus(1);
shopOpenIdMapper.insert(shopOpenId);
// shopOpenIdMapper.insert(shopOpenId);
}
return Result.success(CodeEnum.SUCCESS,shopMsg);

View File

@@ -264,7 +264,7 @@ public class UserService {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
Resource resource = resourceLoader.getResource("classpath:/static/logo.jpg");
InputStream inputStream = resource.getInputStream();
QrCodeUtil.generate(wxAccountUtil.getRadarQrCode(Integer.valueOf(shopId)), new QrConfig(500, 500).
QrCodeUtil.generate(wxAccountUtil.getRadarQrCode(Integer.valueOf(shopId), -1), new QrConfig(500, 500).
setImg(ImageIO.read(inputStream)).setErrorCorrection(ErrorCorrectionLevel.H).setRatio(4), "png", outputStream);