移除wechatAccessToken类

master
qi_liang 6 years ago
parent 291fc81385
commit a5889f996d
  1. 9
      src/main/java/com/lq/cms/service/impl/WechatUserServiceImpl.java
  2. 3
      src/main/java/com/lq/dao/WechatUserDao.java

@ -12,6 +12,7 @@ import com.lq.dao.WechatUserDao;
import com.lq.entity.WechatAccessToken;
import com.lq.entity.WechatInfo;
import com.lq.entity.WechatUser;
import com.lq.wechat.util.accessToken.AccessTokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -28,15 +29,17 @@ public class WechatUserServiceImpl extends BaseServiceImpl<WechatUser> implement
@Autowired
private WechatUserDao wechatUserDao;
@Autowired
private WechatAccesstokenDao wechatAccesstokenDao;
private AccessTokenUtil accessTokenUtil;
@Override
public WechatUser saveWechatUser(String openId, WechatInfo wechatInfo) {
WechatUser wechatUser = wechatUserDao.getByOpenId(openId);
if (wechatUser==null){
wechatUser = new WechatUser();
WechatAccessToken wechatAccessToken = wechatAccesstokenDao.getByWechatInfoIdAndTokenType(wechatInfo.getId(), WechatAccessTokenTypeEnum.CURRENCY.getValue());
// WechatAccessToken wechatAccessToken = wechatAccesstokenDao.getByWechatInfoIdAndTokenType(wechatInfo.getId(), WechatAccessTokenTypeEnum.CURRENCY.getValue());
String accessToken = accessTokenUtil.getAccessToken(wechatInfo);
wechatUser.setWechatInfoId(wechatInfo.getId());
wechatUserDao.save(wechatUser);
}
return wechatUser;

@ -4,6 +4,7 @@ import com.lq.cms.dao.AdminBaseDao;
import com.lq.cms.vo.AdminBaseVo;
import com.lq.code.dao.BaseDao;
import com.lq.entity.WechatUser;
import org.apache.ibatis.annotations.Param;
/**
* @Author: qi
@ -12,5 +13,5 @@ import com.lq.entity.WechatUser;
*/
public interface WechatUserDao extends BaseDao<WechatUser>{
WechatUser getByOpenId(String openId);
WechatUser getByOpenId(@Param("openId") String openId);
}

Loading…
Cancel
Save