Commit beaa18f9 by 田超

Merge branch 'feature/1005004' into 'master'

feat:[1005009]授权码校验

See merge request rays/pcloud-book!1353
parents 032d23cd 5cf75141
...@@ -8,6 +8,7 @@ import com.pcloud.readercenter.applet.entity.AppletQuestion; ...@@ -8,6 +8,7 @@ import com.pcloud.readercenter.applet.entity.AppletQuestion;
import com.pcloud.readercenter.applet.service.AppletUserService; import com.pcloud.readercenter.applet.service.AppletUserService;
import com.pcloud.readercenter.rmall.entity.RmallBookMoneyRecord; import com.pcloud.readercenter.rmall.entity.RmallBookMoneyRecord;
import com.pcloud.readercenter.rmall.service.RmallBookMoneyRecordService; import com.pcloud.readercenter.rmall.service.RmallBookMoneyRecordService;
import com.pcloud.readercenter.unionuser.service.RaysUnionUserService;
import com.pcloud.readercenter.userlabel.dto.UserGradeLabelIdDTO; import com.pcloud.readercenter.userlabel.dto.UserGradeLabelIdDTO;
import com.pcloud.readercenter.userlabel.service.UserLabelService; import com.pcloud.readercenter.userlabel.service.UserLabelService;
import com.pcloud.readercenter.wechat.dto.NickNameAndOpenIdDto; import com.pcloud.readercenter.wechat.dto.NickNameAndOpenIdDto;
...@@ -68,6 +69,8 @@ public class ReaderConsr { ...@@ -68,6 +69,8 @@ public class ReaderConsr {
private AppletUserService appletUserService; private AppletUserService appletUserService;
@Autowired @Autowired
private UserLabelService userLabelService; private UserLabelService userLabelService;
@Autowired
private RaysUnionUserService raysUnionUserService;
public WechatUser getWechatUser(Long wechatUserId) throws BizException { public WechatUser getWechatUser(Long wechatUserId) throws BizException {
if (wechatUserId == null) { if (wechatUserId == null) {
...@@ -450,6 +453,16 @@ public class ReaderConsr { ...@@ -450,6 +453,16 @@ public class ReaderConsr {
LOGGER.error("appletUserService.updateUserClassify"+e.getMessage(), e); LOGGER.error("appletUserService.updateUserClassify"+e.getMessage(), e);
} }
} }
public List<Long> getAllUnionUser(Long wechatUserId) {
try {
return ResponseHandleUtil.parseList(raysUnionUserService.getAllUnionUser(wechatUserId), Long.class);
} catch (Exception e) {
LOGGER.error("调用raysUnionUserService.getAllUnionUser失败"+e.getMessage(), e);
}
return Arrays.asList(wechatUserId);
}
} }
...@@ -177,7 +177,8 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz { ...@@ -177,7 +177,8 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
@Override @Override
@ParamLog("校验用户是否已经授权") @ParamLog("校验用户是否已经授权")
public Boolean checkIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId, Integer authBookType) { public Boolean checkIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId, Integer authBookType) {
return bookAuthUserDao.getIsHaveAuth(bookId, channelId, adviserId, wechatUserId, authBookType); List<Long> wechatUserIdList = readerConsr.getAllUnionUser(wechatUserId);
return bookAuthUserDao.getIsHaveAuth(bookId, channelId, adviserId, wechatUserIdList, authBookType);
} }
@Override @Override
......
...@@ -36,7 +36,7 @@ public interface BookAuthUserDao extends BaseDao<BookAuthUser> { ...@@ -36,7 +36,7 @@ public interface BookAuthUserDao extends BaseDao<BookAuthUser> {
/** /**
* 校验是否已经授权 * 校验是否已经授权
*/ */
Boolean getIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId, Integer authBookType); Boolean getIsHaveAuth(Long bookId, Long channelId, Long adviserId, List<Long> wechatUserIdList, Integer authBookType);
/** /**
* 根据月份获取授权用户信息 * 根据月份获取授权用户信息
......
...@@ -51,12 +51,12 @@ public class BookAuthUserDaoImpl extends BaseDaoImpl<BookAuthUser> implements Bo ...@@ -51,12 +51,12 @@ public class BookAuthUserDaoImpl extends BaseDaoImpl<BookAuthUser> implements Bo
} }
@Override @Override
public Boolean getIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId, Integer authBookType) { public Boolean getIsHaveAuth(Long bookId, Long channelId, Long adviserId, List<Long> wechatUserIdList, Integer authBookType) {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId); paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId); paramMap.put("channelId", channelId);
paramMap.put("adviserId",adviserId); paramMap.put("adviserId",adviserId);
paramMap.put("wechatUserId",wechatUserId); paramMap.put("wechatUserIdList",wechatUserIdList);
if(authBookType == null || authBookType.equals(0)) { if(authBookType == null || authBookType.equals(0)) {
paramMap.put("isPaperBook", 1); paramMap.put("isPaperBook", 1);
} else { } else {
......
...@@ -62,7 +62,10 @@ ...@@ -62,7 +62,10 @@
AND AND
ADVISER_ID = #{adviserId, jdbcType=BIGINT} ADVISER_ID = #{adviserId, jdbcType=BIGINT}
AND AND
WECHAT_USER_ID = #{wechatUserId} WECHAT_USER_ID in
<foreach collection="wechatUserIdList" open="(" close=")" item="item" separator="," index="index">
#{item}
</foreach>
<if test="isPaperBook != null"> <if test="isPaperBook != null">
AND AND
is_paper_book = #{isPaperBook} is_paper_book = #{isPaperBook}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment