Commit 5bf15988 by 高鹏

Merge branch 'raysapp' into 'master'

APP社群购买bug修改

See merge request rays/pcloud-book!285
parents ab2deb0e 2404f1fe
...@@ -15,6 +15,7 @@ import com.pcloud.common.core.aspect.ParamLog; ...@@ -15,6 +15,7 @@ import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil; import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.readercenter.appUser.service.AppUserService;
import com.pcloud.readercenter.wechat.dto.WechatUserRobotDto; import com.pcloud.readercenter.wechat.dto.WechatUserRobotDto;
import com.pcloud.readercenter.wechat.entity.WechatUser; import com.pcloud.readercenter.wechat.entity.WechatUser;
import com.pcloud.readercenter.wechat.service.WechatUserService; import com.pcloud.readercenter.wechat.service.WechatUserService;
...@@ -32,6 +33,8 @@ public class ReaderConsr { ...@@ -32,6 +33,8 @@ public class ReaderConsr {
@Autowired @Autowired
private WechatUserService wechatUserService; private WechatUserService wechatUserService;
@Autowired
private AppUserService appUserService;
public WechatUser getWechatUser(Long wechatUserId) throws BizException { public WechatUser getWechatUser(Long wechatUserId) throws BizException {
if (wechatUserId == null) { if (wechatUserId == null) {
...@@ -94,6 +97,17 @@ public class ReaderConsr { ...@@ -94,6 +97,17 @@ public class ReaderConsr {
return null; return null;
} }
@ParamLog(value = "APP获取wechatUserId集合", isAfterReturn = false)
public List<Long> getAppWechatUserIds(Long wechatUserId) {
List<Long> list = ResponseHandleUtil.parseList(appUserService.getBusWechatUserIdByAppUserId(wechatUserId),Long.class);
if(ListUtils.isEmpty(list)) {
list.add(-1L);
}
return list;
}
} }
...@@ -138,6 +138,11 @@ public interface BookGroupClassifyBiz { ...@@ -138,6 +138,11 @@ public interface BookGroupClassifyBiz {
List<ListClassify4WechatVO> listClassify4Wechat(Long bookGroupId, Long wechatUserId); List<ListClassify4WechatVO> listClassify4Wechat(Long bookGroupId, Long wechatUserId);
/** /**
* APP获取分类信息
*/
List<ListClassify4WechatVO> listClassify4APP(Long bookGroupId, Long wechatUserId);
/**
* 批量获取分类信息 * 批量获取分类信息
*/ */
List<GroupClassifyQrcodeDTO> listClassifyQrcodeInfo(List<Long> classifyIds); List<GroupClassifyQrcodeDTO> listClassifyQrcodeInfo(List<Long> classifyIds);
......
...@@ -107,6 +107,7 @@ import org.springframework.util.CollectionUtils; ...@@ -107,6 +107,7 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -583,12 +584,29 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -583,12 +584,29 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
//获取头像信息 //获取头像信息
//setUserHeader(listClassify4WechatVOS); //setUserHeader(listClassify4WechatVOS);
//设置是否购买 //设置是否购买
setIsBuy(listClassify4WechatVOS, wechatUserId); setIsBuy(listClassify4WechatVOS, Collections.singletonList(wechatUserId));
return listClassify4WechatVOS;
}
@Override
@ParamLog("APP获取分类信息")
public List<ListClassify4WechatVO> listClassify4APP(Long bookGroupId, Long wechatUserId) {
List<Long> appWechatUserIds = readerConsr.getAppWechatUserIds(wechatUserId);
//获取排序方式
Integer rankType = bookGroupBiz.getRankType(bookGroupId);
List<ListClassify4WechatVO> listClassify4WechatVOS = bookGroupClassifyDao.listClassify4Wechat(bookGroupId, rankType);
if (listClassify4WechatVOS == null) {
return new ArrayList<>();
}
//设置二维码信息
setGroupQrcodeInfo(listClassify4WechatVOS);
//设置是否购买
setIsBuy(listClassify4WechatVOS, appWechatUserIds);
return listClassify4WechatVOS; return listClassify4WechatVOS;
} }
@ParamLog(value = "设置是否购买", isBefore = false) @ParamLog(value = "设置是否购买", isBefore = false)
private void setIsBuy(List<ListClassify4WechatVO> listClassify4Wechats, Long wechatUserId) { private void setIsBuy(List<ListClassify4WechatVO> listClassify4Wechats, List<Long> wechatUserIds) {
if (ListUtils.isEmpty(listClassify4Wechats)) { if (ListUtils.isEmpty(listClassify4Wechats)) {
return; return;
} }
...@@ -597,7 +615,7 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -597,7 +615,7 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
classifyIds.add(listClassify4WechatVO.getClassifyId()); classifyIds.add(listClassify4WechatVO.getClassifyId());
} }
//根据二维码获取二维码基本信息 //根据二维码获取二维码基本信息
List<Long> buyClassifyIds = bookClassifyBuyRecordDao.checkUsersBuy(classifyIds, wechatUserId); List<Long> buyClassifyIds = bookClassifyBuyRecordDao.checkUsersBuy(classifyIds, wechatUserIds);
if (ListUtils.isEmpty(buyClassifyIds)) { if (ListUtils.isEmpty(buyClassifyIds)) {
return; return;
} }
......
...@@ -23,5 +23,5 @@ public interface BookClassifyBuyRecordDao extends BaseDao<BookClassifyBuyRecord> ...@@ -23,5 +23,5 @@ public interface BookClassifyBuyRecordDao extends BaseDao<BookClassifyBuyRecord>
* @Desr:校验用户是否购买 * @Desr:校验用户是否购买
* @Date:2019/4/19 12:01 * @Date:2019/4/19 12:01
*/ */
List<Long> checkUsersBuy(List<Long> classifyIds, Long wechatUserId); List<Long> checkUsersBuy(List<Long> classifyIds, List<Long> wechatUserIds);
} }
...@@ -26,9 +26,9 @@ public class BookClassifyBuyRecordDaoImpl extends BaseDaoImpl<BookClassifyBuyRec ...@@ -26,9 +26,9 @@ public class BookClassifyBuyRecordDaoImpl extends BaseDaoImpl<BookClassifyBuyRec
} }
@Override @Override
public List<Long> checkUsersBuy(List<Long> classifyId, Long wechatUserId) { public List<Long> checkUsersBuy(List<Long> classifyId, List<Long> wechatUserIds) {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("wechatUserId", wechatUserId); paramMap.put("wechatUserIds", wechatUserIds);
paramMap.put("classifyIds", classifyId); paramMap.put("classifyIds", classifyId);
return this.getSqlSession().selectList(this.getStatement("checkUsersBuy"), paramMap); return this.getSqlSession().selectList(this.getStatement("checkUsersBuy"), paramMap);
} }
......
...@@ -131,6 +131,14 @@ public interface BookGroupClassifyFacade { ...@@ -131,6 +131,14 @@ public interface BookGroupClassifyFacade {
@GetMapping("getClassifyAndUserCount") @GetMapping("getClassifyAndUserCount")
ResponseDto<List<ListClassify4WechatVO>> listClassify4Wechat(@CookieValue("userInfo") String userInfo, @RequestParam("bookGroupId") Long bookGroupId); ResponseDto<List<ListClassify4WechatVO>> listClassify4Wechat(@CookieValue("userInfo") String userInfo, @RequestParam("bookGroupId") Long bookGroupId);
@ApiOperation(value = "现代纸书APP获取群分类", httpMethod = "GET")
@RequestMapping(value = "listClassify4APP", method = RequestMethod.GET)
@ApiImplicitParams({@ApiImplicitParam(name = "userInfo", value = "userInfo", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "bookGroupId", value = "社群书ID", dataType = "Long", paramType = "query")
})
@GetMapping("listClassify4APP")
ResponseDto<List<ListClassify4WechatVO>> listClassify4APP(@CookieValue("userInfo") String userInfo, @RequestParam("bookGroupId") Long bookGroupId);
@ApiOperation(value = "客户端根据群分类获取二维码", httpMethod = "GET") @ApiOperation(value = "客户端根据群分类获取二维码", httpMethod = "GET")
@RequestMapping(value = "getGroupQrcode4ClassifyWechat", method = RequestMethod.GET) @RequestMapping(value = "getGroupQrcode4ClassifyWechat", method = RequestMethod.GET)
......
...@@ -113,6 +113,14 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade { ...@@ -113,6 +113,14 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade {
} }
@Override @Override
@GetMapping("listClassify4APP")
public ResponseDto<List<ListClassify4WechatVO>> listClassify4APP(@CookieValue("userInfo") String userInfo, @RequestParam("bookGroupId") Long bookGroupId) {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
List<ListClassify4WechatVO> listClassify4WechatVOS = bookGroupClassifyBiz.listClassify4APP(bookGroupId, wechatUserId);
return new ResponseDto<>(listClassify4WechatVOS);
}
@Override
@GetMapping("getGroupQrcode4ClassifyWechat") @GetMapping("getGroupQrcode4ClassifyWechat")
public ResponseDto<GroupQrcode4ClassifyVO> getGroupQrcode4ClassifyWechat(@CookieValue("userInfo") String userInfo, @RequestParam("classifyId") Long classifyId) { public ResponseDto<GroupQrcode4ClassifyVO> getGroupQrcode4ClassifyWechat(@CookieValue("userInfo") String userInfo, @RequestParam("classifyId") Long classifyId) {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID); Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
......
...@@ -57,11 +57,14 @@ ...@@ -57,11 +57,14 @@
<select id="checkUsersBuy" resultType = "Long" parameterType="map"> <select id="checkUsersBuy" resultType = "Long" parameterType="map">
select select
classify_Id classify_Id
from from
book_classify_buy_record book_classify_buy_record
where where
wechat_user_id = #{wechatUserId,jdbcType=BIGINT} wechat_user_id in
<foreach collection = "wechatUserIds" index="index" item = "item" open = "(" separator= "," close = ")">
${item}
</foreach>
and and
classify_Id in classify_Id in
<foreach collection = "classifyIds" index="index" item = "item" open = "(" separator= "," close = ")"> <foreach collection = "classifyIds" index="index" item = "item" open = "(" separator= "," close = ")">
......
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