Commit 2404f1fe by lihao

APP社群购买bug修改

parent ab2deb0e
......@@ -15,6 +15,7 @@ import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ListUtils;
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.entity.WechatUser;
import com.pcloud.readercenter.wechat.service.WechatUserService;
......@@ -32,6 +33,8 @@ public class ReaderConsr {
@Autowired
private WechatUserService wechatUserService;
@Autowired
private AppUserService appUserService;
public WechatUser getWechatUser(Long wechatUserId) throws BizException {
if (wechatUserId == null) {
......@@ -94,6 +97,17 @@ public class ReaderConsr {
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 {
List<ListClassify4WechatVO> listClassify4Wechat(Long bookGroupId, Long wechatUserId);
/**
* APP获取分类信息
*/
List<ListClassify4WechatVO> listClassify4APP(Long bookGroupId, Long wechatUserId);
/**
* 批量获取分类信息
*/
List<GroupClassifyQrcodeDTO> listClassifyQrcodeInfo(List<Long> classifyIds);
......
......@@ -107,6 +107,7 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
......@@ -583,12 +584,29 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
//获取头像信息
//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;
}
@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)) {
return;
}
......@@ -597,7 +615,7 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
classifyIds.add(listClassify4WechatVO.getClassifyId());
}
//根据二维码获取二维码基本信息
List<Long> buyClassifyIds = bookClassifyBuyRecordDao.checkUsersBuy(classifyIds, wechatUserId);
List<Long> buyClassifyIds = bookClassifyBuyRecordDao.checkUsersBuy(classifyIds, wechatUserIds);
if (ListUtils.isEmpty(buyClassifyIds)) {
return;
}
......
......@@ -23,5 +23,5 @@ public interface BookClassifyBuyRecordDao extends BaseDao<BookClassifyBuyRecord>
* @Desr:校验用户是否购买
* @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
}
@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<>();
paramMap.put("wechatUserId", wechatUserId);
paramMap.put("wechatUserIds", wechatUserIds);
paramMap.put("classifyIds", classifyId);
return this.getSqlSession().selectList(this.getStatement("checkUsersBuy"), paramMap);
}
......
......@@ -131,6 +131,14 @@ public interface BookGroupClassifyFacade {
@GetMapping("getClassifyAndUserCount")
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")
@RequestMapping(value = "getGroupQrcode4ClassifyWechat", method = RequestMethod.GET)
......
......@@ -113,6 +113,14 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade {
}
@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")
public ResponseDto<GroupQrcode4ClassifyVO> getGroupQrcode4ClassifyWechat(@CookieValue("userInfo") String userInfo, @RequestParam("classifyId") Long classifyId) {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
......
......@@ -61,7 +61,10 @@
from
book_classify_buy_record
where
wechat_user_id = #{wechatUserId,jdbcType=BIGINT}
wechat_user_id in
<foreach collection = "wechatUserIds" index="index" item = "item" open = "(" separator= "," close = ")">
${item}
</foreach>
and
classify_Id in
<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