Commit fa47d90d by 田超

Merge branch 'feature/1003157' into 'master'

feat: [1003157] 为编辑已有社群定义所属地区标签,小程序获取地理位置依据位置推群

See merge request rays/pcloud-book!807
parents 0ff2ea88 3645c765
package com.pcloud.book.record.service.impl; package com.pcloud.book.record.service;
import com.aliyun.oss.HttpMethod; import com.aliyun.oss.HttpMethod;
import com.pcloud.book.record.entity.BookBrowseRecord; import com.pcloud.book.record.entity.BookBrowseRecord;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(value = "pcloud-service-book", qualifier = "bookBrowseRecordPcloud", path = "book/v1.0/bookBrowseRecordService") @FeignClient(value = "pcloud-service-book", qualifier = "bookBrowseRecordPcloud", path = "book/v1.0/bookBrowseRecordService")
public interface BookBrowseRecordService { public interface BookBrowseRecordService {
...@@ -14,4 +16,6 @@ public interface BookBrowseRecordService { ...@@ -14,4 +16,6 @@ public interface BookBrowseRecordService {
@RequestMapping(value = "addBookRecord", method = RequestMethod.POST) @RequestMapping(value = "addBookRecord", method = RequestMethod.POST)
public void addBookRecord(@RequestBody BookBrowseRecord bookBrowseRecord); public void addBookRecord(@RequestBody BookBrowseRecord bookBrowseRecord);
@RequestMapping(value = "getCityByIP", method = RequestMethod.GET)
public ResponseEntity<ResponseDto<BookBrowseRecord>> getCityByIP(@RequestParam("ip") String ip);
} }
...@@ -196,6 +196,17 @@ public class ReaderConsr { ...@@ -196,6 +196,17 @@ public class ReaderConsr {
return openId; return openId;
} }
public String getCityCodeByWechatUserId(Long wechatUserId) {
LOGGER.info("根据wechatUserId查询cityCode:{}", wechatUserId);
String cityCode = null;
try {
cityCode = ResponseHandleUtil.parseResponse(appUserService.getCityCodeByWechatUserId(wechatUserId), String.class);
LOGGER.info("根据wechatUserId查询cityCode结束:{}", cityCode);
} catch (BizException e) {
throw new BizException(e.getCode(), e.getMessage());
}
return cityCode;
}
} }
...@@ -279,7 +279,7 @@ public interface BookGroupClassifyBiz { ...@@ -279,7 +279,7 @@ public interface BookGroupClassifyBiz {
* 平台端分页获取群分类 * 平台端分页获取群分类
* *
*/ */
PageBeanNew<PcloudBookGroupClassifyVO> listGroupClassify4Pcloud(String name, Long proLabelId, Long depLabelId,Long purLabelId,Long firstClassifyId,Long gradeLabelId,Long subjectLabelId,Long agentId,Long adviserId, Integer currentPage, Integer numPerPage); PageBeanNew<PcloudBookGroupClassifyVO> listGroupClassify4Pcloud(String name, Long proLabelId, Long depLabelId,Long purLabelId,Long firstClassifyId,Long gradeLabelId,Long subjectLabelId,Long agentId,Long adviserId, Integer currentPage, Integer numPerPage, String cityCode);
List<ListClassify4WechatDTO> listClassify4Heals(List<Long> classifyIds, Long wechatUserId); List<ListClassify4WechatDTO> listClassify4Heals(List<Long> classifyIds, Long wechatUserId);
......
package com.pcloud.book.group.biz; package com.pcloud.book.group.biz;
import com.pcloud.book.applet.dto.AppletGroupManageDTO;
import com.pcloud.book.group.dto.GroupAndUserNumberDTO; import com.pcloud.book.group.dto.GroupAndUserNumberDTO;
import com.pcloud.book.group.dto.GroupQrcodeInfo4Advertising; import com.pcloud.book.group.dto.GroupQrcodeInfo4Advertising;
import com.pcloud.book.group.dto.GroupQrcodeInfoDTO; import com.pcloud.book.group.dto.GroupQrcodeInfoDTO;
...@@ -241,4 +242,13 @@ public interface GroupQrcodeBiz { ...@@ -241,4 +242,13 @@ public interface GroupQrcodeBiz {
void updateRoomManager(UpdateRoomManagerVO updateRoomManagerVO); void updateRoomManager(UpdateRoomManagerVO updateRoomManagerVO);
ClassifyQrcodeVO getGroupQrcodeInfo(String groupQrCode, Long classifyId); ClassifyQrcodeVO getGroupQrcodeInfo(String groupQrCode, Long classifyId);
/**
* 获取微信用户的位置相关社群
* @param wechatUserId
* @param numPerPage
* @param currentPage
* @return
*/
PageBeanNew<AppletGroupManageDTO> getLocalGroup(Long wechatUserId, Integer numPerPage, Integer currentPage);
} }
package com.pcloud.book.group.biz.impl; package com.pcloud.book.group.biz.impl;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.constant.BookConstant; import com.pcloud.book.book.constant.BookConstant;
...@@ -80,6 +81,8 @@ import com.pcloud.book.keywords.dao.BookKeywordDao; ...@@ -80,6 +81,8 @@ import com.pcloud.book.keywords.dao.BookKeywordDao;
import com.pcloud.book.keywords.dao.KeywordDao; import com.pcloud.book.keywords.dao.KeywordDao;
import com.pcloud.book.keywords.entity.BookKeyword; import com.pcloud.book.keywords.entity.BookKeyword;
import com.pcloud.book.keywords.entity.Keyword; import com.pcloud.book.keywords.entity.Keyword;
import com.pcloud.book.record.biz.BookBrowseRecordBiz;
import com.pcloud.book.record.entity.RegionMap;
import com.pcloud.book.util.common.ThreadPoolUtils; import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.book.util.properties.BookProps; import com.pcloud.book.util.properties.BookProps;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
...@@ -204,6 +207,8 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -204,6 +207,8 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
private KeywordDao keywordDao; private KeywordDao keywordDao;
@Autowired @Autowired
private BookDao bookDao; private BookDao bookDao;
@Autowired
private BookBrowseRecordBiz bookBrowseRecordBiz;
@Override @Override
...@@ -434,6 +439,23 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -434,6 +439,23 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
if (ListUtils.isEmpty(classifys)) { if (ListUtils.isEmpty(classifys)) {
return new ArrayList<>(); return new ArrayList<>();
} }
List<String> cityCodes = classifys.stream().filter(e -> null != e.getCityCode()).
map(e -> e.getCityCode()).distinct().collect(Collectors.toList());
if (ListUtils.isEmpty(cityCodes)) {
return classifys;
}
Map<String, RegionMap> regionMapMap = bookBrowseRecordBiz.getCitysByCodes(cityCodes);
if (MapUtils.isNotEmpty(regionMapMap)){
classifys.forEach(listClassifyVO -> {
if (null == listClassifyVO.getCityCode()) {
return;
}
RegionMap regionMap = regionMapMap.get(listClassifyVO.getCityCode());
if (regionMapMap.containsKey(listClassifyVO.getCityCode()) && null != regionMap){
listClassifyVO.setCityName(regionMap.getRegionName());
}
});
}
return classifys; return classifys;
} }
...@@ -485,6 +507,13 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -485,6 +507,13 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
if (bookGroupDTO != null) { if (bookGroupDTO != null) {
classifyVO.setJoinGroupType(bookGroupDTO.getJoinGroupType()); classifyVO.setJoinGroupType(bookGroupDTO.getJoinGroupType());
} }
String cityCode = classifyVO.getCityCode();
if (null != cityCode) {
Map<String, RegionMap> regionMapMap = bookBrowseRecordBiz.getCitysByCodes(Lists.newArrayList(cityCode));
if (MapUtils.isNotEmpty(regionMapMap) && null != regionMapMap.get(cityCode)){
classifyVO.setCityName(regionMapMap.get(cityCode).getRegionName());
}
}
} }
return classifyVO; return classifyVO;
} }
...@@ -1399,10 +1428,11 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -1399,10 +1428,11 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
} }
@Override @Override
public PageBeanNew<PcloudBookGroupClassifyVO> listGroupClassify4Pcloud(String name, Long proLabelId, Long depLabelId,Long purLabelId,Long firstClassifyId,Long gradeLabelId,Long subjectLabelId,Long agentId,Long adviserId, Integer currentPage, Integer numPerPage) { public PageBeanNew<PcloudBookGroupClassifyVO> listGroupClassify4Pcloud(String name, Long proLabelId, Long depLabelId,Long purLabelId,Long firstClassifyId,Long gradeLabelId,Long subjectLabelId,Long agentId,Long adviserId, Integer currentPage, Integer numPerPage
, String cityCode) {
// 根据数命查bookid // 根据数命查bookid
List<Long> ids = new ArrayList<>(); List<Long> ids = new ArrayList<>();
if (!StringUtil.isEmpty(name)){ if (!StringUtil.isEmpty(name)) {
ids = bookDao.getBookIdsByBookName(name); ids = bookDao.getBookIdsByBookName(name);
} }
PageParam pageParam = new PageParam(currentPage, numPerPage); PageParam pageParam = new PageParam(currentPage, numPerPage);
...@@ -1417,6 +1447,7 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -1417,6 +1447,7 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
map.put("subjectLabelId", subjectLabelId); map.put("subjectLabelId", subjectLabelId);
map.put("agentId", agentId); map.put("agentId", agentId);
map.put("adviserId", adviserId); map.put("adviserId", adviserId);
map.put("cityCode", cityCode);
PageBeanNew<PcloudBookGroupClassifyVO> pageBeanNew = bookGroupClassifyDao.listPageNew(pageParam, map, "listGroupClassify4Pcloud"); PageBeanNew<PcloudBookGroupClassifyVO> pageBeanNew = bookGroupClassifyDao.listPageNew(pageParam, map, "listGroupClassify4Pcloud");
pageBeanNew.getRecordList().forEach(item->{ pageBeanNew.getRecordList().forEach(item->{
...@@ -1429,10 +1460,33 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -1429,10 +1460,33 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
item.setAgentName(agentName); item.setAgentName(agentName);
}); });
if (null != pageBeanNew && !ListUtils.isEmpty(pageBeanNew.getRecordList())){
setCityName(pageBeanNew.getRecordList());
}
return pageBeanNew; return pageBeanNew;
} }
private void setCityName(List<PcloudBookGroupClassifyVO> recordList) {
log.info("设置城市名称");
if (ListUtils.isEmpty(recordList)){
return;
}
List<String> cityCodes = recordList.stream().map(e -> e.getCityCode()).distinct().collect(Collectors.toList());
if (ListUtils.isEmpty(cityCodes)) {
return;
}
Map<String, RegionMap> regionMapMap = bookBrowseRecordBiz.getCitysByCodes(cityCodes);
if (MapUtils.isNotEmpty(regionMapMap)){
recordList.forEach(classifyVO -> {
RegionMap regionMap = regionMapMap.get(classifyVO.getCityCode());
if (regionMapMap.containsKey(classifyVO.getCityCode()) && null != regionMap){
classifyVO.setCityName(regionMap.getRegionName());
}
});
}
}
@Override @Override
public List<ListClassify4WechatDTO> listClassify4Heals(List<Long> classifyIds, Long wechatUserId) { public List<ListClassify4WechatDTO> listClassify4Heals(List<Long> classifyIds, Long wechatUserId) {
if(ListUtils.isEmpty(classifyIds)){ if(ListUtils.isEmpty(classifyIds)){
......
...@@ -5,6 +5,7 @@ import com.google.common.collect.Maps; ...@@ -5,6 +5,7 @@ import com.google.common.collect.Maps;
import com.pcloud.book.advertising.biz.AdvertisingSpaceBiz; import com.pcloud.book.advertising.biz.AdvertisingSpaceBiz;
import com.pcloud.book.advertising.biz.GroupTagBiz; import com.pcloud.book.advertising.biz.GroupTagBiz;
import com.pcloud.book.advertising.dto.QrcodeAdvertisingSpaceCountDTO; import com.pcloud.book.advertising.dto.QrcodeAdvertisingSpaceCountDTO;
import com.pcloud.book.applet.dto.AppletGroupManageDTO;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.label.LabelConsr; import com.pcloud.book.consumer.label.LabelConsr;
import com.pcloud.book.consumer.reader.ReaderConsr; import com.pcloud.book.consumer.reader.ReaderConsr;
...@@ -48,7 +49,9 @@ import com.pcloud.book.keywords.dao.BookKeywordRecordDao; ...@@ -48,7 +49,9 @@ import com.pcloud.book.keywords.dao.BookKeywordRecordDao;
import com.pcloud.book.keywords.dto.KeywordUserCountDTO; import com.pcloud.book.keywords.dto.KeywordUserCountDTO;
import com.pcloud.book.push.dao.PushGroupDao; import com.pcloud.book.push.dao.PushGroupDao;
import com.pcloud.book.push.entity.PushGroup; import com.pcloud.book.push.entity.PushGroup;
import com.pcloud.book.reading.check.ParamCheck;
import com.pcloud.book.riddle.dto.GroupRiddleDTO; import com.pcloud.book.riddle.dto.GroupRiddleDTO;
import com.pcloud.book.skill.biz.PcloudGroupActivityBiz;
import com.pcloud.book.util.common.ThreadPoolUtils; import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.common.constant.CacheConstant; import com.pcloud.common.constant.CacheConstant;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
...@@ -129,6 +132,8 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz { ...@@ -129,6 +132,8 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
private AmqpTemplate amqpTemplate; private AmqpTemplate amqpTemplate;
@Autowired @Autowired
private GroupMemberService groupMemberService; private GroupMemberService groupMemberService;
@Autowired
private PcloudGroupActivityBiz pcloudGroupActivityBiz;
@Override @Override
...@@ -999,4 +1004,15 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz { ...@@ -999,4 +1004,15 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
} }
return ret; return ret;
} }
@Override
@ParamLog(value = "获取微信用户的位置相关社群", isAfterReturn = false)
public PageBeanNew<AppletGroupManageDTO> getLocalGroup(Long wechatUserId, Integer numPerPage, Integer currentPage) {
if (currentPage == null || currentPage < 0 || numPerPage == null || numPerPage <= 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "分页参数错误!");
}
PageBeanNew<AppletGroupManageDTO> appletGroupManageDTOPageBeanNew = pcloudGroupActivityBiz.getLocalGroup(wechatUserId, numPerPage
, currentPage);
return appletGroupManageDTOPageBeanNew;
}
} }
...@@ -3,6 +3,7 @@ package com.pcloud.book.group.entity; ...@@ -3,6 +3,7 @@ package com.pcloud.book.group.entity;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -104,6 +105,18 @@ public class BookGroupClassify extends BaseEntity { ...@@ -104,6 +105,18 @@ public class BookGroupClassify extends BaseEntity {
private Integer numPerPage; private Integer numPerPage;
@ApiModelProperty("城市编码")
private String cityCode;
public String getCityCode() {
return cityCode;
}
public void setCityCode(String cityCode) {
this.cityCode = cityCode;
}
@Override @Override
public Long getId() { public Long getId() {
return id; return id;
......
...@@ -285,7 +285,8 @@ public interface BookGroupClassifyFacade { ...@@ -285,7 +285,8 @@ public interface BookGroupClassifyFacade {
@RequestParam(value = "agentId", required = false) @ApiParam("出版社") Long agentId, @RequestParam(value = "agentId", required = false) @ApiParam("出版社") Long agentId,
@RequestParam(value = "adviserId", required = false) @ApiParam("编辑id") Long adviserId, @RequestParam(value = "adviserId", required = false) @ApiParam("编辑id") Long adviserId,
@RequestParam("currentPage") Integer currentPage, @RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage) throws BizException, PermissionException; @RequestParam("numPerPage") Integer numPerPage,
@RequestParam(value = "cityCode",required = false) String cityCode) throws BizException, PermissionException;
@ApiOperation("根据群分类ID获取群二维码") @ApiOperation("根据群分类ID获取群二维码")
@GetMapping("getGroupQrcodeByClassify") @GetMapping("getGroupQrcodeByClassify")
......
package com.pcloud.book.group.facade.impl; package com.pcloud.book.group.facade.impl;
import com.pcloud.book.applet.dto.AppletGroupManageDTO;
import com.pcloud.book.group.biz.BookGroupBiz; import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz; import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.biz.GroupQrcodeBiz; import com.pcloud.book.group.biz.GroupQrcodeBiz;
...@@ -15,6 +16,7 @@ import com.pcloud.common.exceptions.BizException; ...@@ -15,6 +16,7 @@ import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.permission.PermissionException; import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.BeanUtils; import com.pcloud.common.utils.BeanUtils;
import com.pcloud.common.utils.NumberUtil;
import com.pcloud.common.utils.SessionUtil; import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie; import com.pcloud.common.utils.cookie.Cookie;
...@@ -304,7 +306,7 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade { ...@@ -304,7 +306,7 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade {
@Override @Override
@GetMapping("listGroupClassify4Pcloud") @GetMapping("listGroupClassify4Pcloud")
public ResponseDto<PageBeanNew<PcloudBookGroupClassifyVO>> listGroupClassify4Pcloud( public ResponseDto<PageBeanNew<PcloudBookGroupClassifyVO>> listGroupClassify4Pcloud(
@RequestHeader("token") @ApiParam("token信息") String token, @RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "name", required = false) @ApiParam("群分类名 | 书刊名") String name, @RequestParam(value = "name", required = false) @ApiParam("群分类名 | 书刊名") String name,
@RequestParam(value = "proLabelId", required = false) @ApiParam("专业标签") Long proLabelId, @RequestParam(value = "proLabelId", required = false) @ApiParam("专业标签") Long proLabelId,
...@@ -316,11 +318,12 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade { ...@@ -316,11 +318,12 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade {
@RequestParam(value = "agentId", required = false) @ApiParam("出版社") Long agentId, @RequestParam(value = "agentId", required = false) @ApiParam("出版社") Long agentId,
@RequestParam(value = "adviserId", required = false) @ApiParam("编辑id") Long adviserId, @RequestParam(value = "adviserId", required = false) @ApiParam("编辑id") Long adviserId,
@RequestParam("currentPage") Integer currentPage, @RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage @RequestParam("numPerPage") Integer numPerPage,
@RequestParam(value = "cityCode",required = false) String cityCode
) throws BizException, PermissionException { ) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID); SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(bookGroupClassifyBiz.listGroupClassify4Pcloud(name, proLabelId, depLabelId, purLabelId, return new ResponseDto<>(bookGroupClassifyBiz.listGroupClassify4Pcloud(name, proLabelId, depLabelId, purLabelId,
firstClassifyId, gradeLabelId, subjectLabelId, agentId,adviserId,currentPage, numPerPage)); firstClassifyId, gradeLabelId, subjectLabelId, agentId,adviserId,currentPage, numPerPage,cityCode));
} }
@Override @Override
...@@ -343,4 +346,18 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade { ...@@ -343,4 +346,18 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade {
List<BookGroupClassifyDTO> list = bookGroupClassifyBiz.getBookGroupClassifyByClassifyIds(classifyIds); List<BookGroupClassifyDTO> list = bookGroupClassifyBiz.getBookGroupClassifyByClassifyIds(classifyIds);
return new ResponseDto<>(list); return new ResponseDto<>(list);
} }
@GetMapping("getLocalGroup")
public ResponseDto<PageBeanNew<AppletGroupManageDTO>> getLocalGroup(@CookieValue("userInfo") String userInfo,
@RequestParam("numPerPage") Integer numPerPage,
@RequestParam("currentPage") Integer currentPage) throws BizException,
PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
if (!NumberUtil.isNumber(wechatUserId)) {
throw new PermissionException("wechatUseId为空");
}
return new ResponseDto<PageBeanNew<AppletGroupManageDTO>>(groupQrcodeBiz.getLocalGroup(wechatUserId, numPerPage, currentPage));
}
} }
...@@ -31,6 +31,17 @@ public class AddClassifyVO { ...@@ -31,6 +31,17 @@ public class AddClassifyVO {
@ApiModelProperty("换群数量") @ApiModelProperty("换群数量")
private Integer changeNumber; private Integer changeNumber;
@ApiModelProperty("城市编码")
private String cityCode;
public String getCityCode() {
return cityCode;
}
public void setCityCode(String cityCode) {
this.cityCode = cityCode;
}
public String getClassify() { public String getClassify() {
return classify; return classify;
} }
...@@ -97,6 +108,7 @@ public class AddClassifyVO { ...@@ -97,6 +108,7 @@ public class AddClassifyVO {
", classifyIntroduce='" + classifyIntroduce + '\'' + ", classifyIntroduce='" + classifyIntroduce + '\'' +
", price=" + price + ", price=" + price +
", changeNumber=" + changeNumber + ", changeNumber=" + changeNumber +
", cityCode='" + cityCode + '\'' +
'}'; '}';
} }
} }
...@@ -57,6 +57,28 @@ public class ClassifyVO implements Serializable { ...@@ -57,6 +57,28 @@ public class ClassifyVO implements Serializable {
@ApiModelProperty("进群方式:1群二维码,2客服机器人") @ApiModelProperty("进群方式:1群二维码,2客服机器人")
private Integer joinGroupType; private Integer joinGroupType;
@ApiModelProperty("城市编码")
private String cityCode;
@ApiModelProperty("城市名称")
private String cityName;
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public String getCityCode() {
return cityCode;
}
public void setCityCode(String cityCode) {
this.cityCode = cityCode;
}
public Integer getRank() { public Integer getRank() {
return rank; return rank;
} }
......
...@@ -51,6 +51,28 @@ public class ListClassifyVO implements Serializable { ...@@ -51,6 +51,28 @@ public class ListClassifyVO implements Serializable {
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
private Date createdTime; private Date createdTime;
@ApiModelProperty("城市编码")
private String cityCode;
@ApiModelProperty("城市名称")
private String cityName;
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public String getCityCode() {
return cityCode;
}
public void setCityCode(String cityCode) {
this.cityCode = cityCode;
}
public Integer getRank() { public Integer getRank() {
return rank; return rank;
} }
......
...@@ -38,6 +38,27 @@ public class PcloudBookGroupClassifyVO { ...@@ -38,6 +38,27 @@ public class PcloudBookGroupClassifyVO {
private String phone; private String phone;
@ApiModelProperty("图片") @ApiModelProperty("图片")
private String groupPic; private String groupPic;
@ApiModelProperty("城市编码")
private String cityCode;
@ApiModelProperty("城市名称")
private String cityName;
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public String getCityCode() {
return cityCode;
}
public void setCityCode(String cityCode) {
this.cityCode = cityCode;
}
public Integer getId() { public Integer getId() {
return id; return id;
......
...@@ -32,4 +32,8 @@ public interface BookBrowseRecordBiz { ...@@ -32,4 +32,8 @@ public interface BookBrowseRecordBiz {
Map<String, List<RegionMap>> getCitysByPY(String keyword); Map<String, List<RegionMap>> getCitysByPY(String keyword);
void handleOldData(); void handleOldData();
Map<String, RegionMap> getCitysByCodes(List<String> cityCodes);
BookBrowseRecord getCityByIP(String ip);
} }
...@@ -300,6 +300,24 @@ public class BookBrowseRecordBizImpl implements BookBrowseRecordBiz { ...@@ -300,6 +300,24 @@ public class BookBrowseRecordBizImpl implements BookBrowseRecordBiz {
} }
@Override
@ParamLog("根据cityCodes获取相应城市")
public Map<String, RegionMap> getCitysByCodes(List<String> cityCodes) {
if (ListUtils.isEmpty(cityCodes)){
return new HashMap<>();
}
return regionMapMapper.getCitysByCodes(cityCodes);
}
@Override
@ParamLog("通过ip获取城市")
public BookBrowseRecord getCityByIP(String ip) {
BookBrowseRecord bookBrowseRecord = new BookBrowseRecord();
bookBrowseRecord.setIp(ip);
this.getAreaByIP(bookBrowseRecord);
return bookBrowseRecord;
}
private void getAreaByIP(BookBrowseRecord bookBrowseRecord) { private void getAreaByIP(BookBrowseRecord bookBrowseRecord) {
String host = "https://api01.aliyun.venuscn.com"; String host = "https://api01.aliyun.venuscn.com";
String path = "/ip"; String path = "/ip";
......
package com.pcloud.book.record.entity; package com.pcloud.book.record.entity;
import com.pcloud.common.utils.string.StringUtil;
import lombok.Data;
@Data
public class RegionMap { public class RegionMap {
private Long id; private Long id;
private Integer regionCode; private String regionCode;
private Integer level; private Integer level;
...@@ -15,59 +19,4 @@ public class RegionMap { ...@@ -15,59 +19,4 @@ public class RegionMap {
private String shortName; private String shortName;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getRegionCode() {
return regionCode;
}
public void setRegionCode(Integer regionCode) {
this.regionCode = regionCode;
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public String getRegionName() {
return regionName;
}
public void setRegionName(String regionName) {
this.regionName = regionName == null ? null : regionName.trim();
}
public String getAlphabet() {
return alphabet;
}
public void setAlphabet(String alphabet) {
this.alphabet = alphabet == null ? null : alphabet.trim();
}
public Integer getParentId() {
return parentId;
}
public void setParentId(Integer parentId) {
this.parentId = parentId;
}
public String getShortName() {
return shortName;
}
public void setShortName(String shortName) {
this.shortName = shortName == null ? null : shortName.trim();
}
} }
\ No newline at end of file
...@@ -2,6 +2,8 @@ package com.pcloud.book.record.mapper; ...@@ -2,6 +2,8 @@ package com.pcloud.book.record.mapper;
import com.pcloud.book.record.entity.RegionMap; import com.pcloud.book.record.entity.RegionMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -20,4 +22,7 @@ public interface RegionMapMapper { ...@@ -20,4 +22,7 @@ public interface RegionMapMapper {
int updateByPrimaryKey(RegionMap record); int updateByPrimaryKey(RegionMap record);
List<RegionMap> getCitysByPY(@Param("keyword") String keyword); List<RegionMap> getCitysByPY(@Param("keyword") String keyword);
@MapKey("regionCode")
Map<String, RegionMap> getCitysByCodes(List<String> cityCodes);
} }
\ No newline at end of file
package com.pcloud.book.record.service.impl; package com.pcloud.book.record.service.impl;
import com.pcloud.book.book.entity.Book;
import com.pcloud.book.record.biz.BookBrowseRecordBiz; import com.pcloud.book.record.biz.BookBrowseRecordBiz;
import com.pcloud.book.record.entity.BookBrowseRecord; import com.pcloud.book.record.entity.BookBrowseRecord;
import com.pcloud.book.record.service.BookBrowseRecordService;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.utils.ResponseHandleUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
/** /**
...@@ -29,4 +33,10 @@ public class BookBrowseRecordServiceImpl implements BookBrowseRecordService { ...@@ -29,4 +33,10 @@ public class BookBrowseRecordServiceImpl implements BookBrowseRecordService {
bookBrowseRecordBiz.addBookRecord(bookBrowseRecord); bookBrowseRecordBiz.addBookRecord(bookBrowseRecord);
} }
@Override
@RequestMapping(value = "getCityByIP", method = RequestMethod.GET)
public ResponseEntity<ResponseDto<BookBrowseRecord>> getCityByIP(@RequestParam("ip") String ip) {
return ResponseHandleUtil.toResponse(bookBrowseRecordBiz.getCityByIP(ip));
}
} }
\ No newline at end of file
...@@ -105,4 +105,6 @@ public interface PcloudGroupActivityBiz { ...@@ -105,4 +105,6 @@ public interface PcloudGroupActivityBiz {
void updateActivityShowState(UpdateActivityShowStateDTO showStateDTO); void updateActivityShowState(UpdateActivityShowStateDTO showStateDTO);
Map<Long, GroupActivity4AppletDTO> getByIds4Now(List<Long> groupIds); Map<Long, GroupActivity4AppletDTO> getByIds4Now(List<Long> groupIds);
PageBeanNew<AppletGroupManageDTO> getLocalGroup(Long wechatUserId, Integer numPerPage, Integer currentPage);
} }
...@@ -602,4 +602,41 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz { ...@@ -602,4 +602,41 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
return pcloudGroupActivityDao.getById(id); return pcloudGroupActivityDao.getById(id);
} }
@Override
public PageBeanNew<AppletGroupManageDTO> getLocalGroup(Long wechatUserId, Integer numPerPage, Integer currentPage) {
String cityCode = readerConsr.getCityCodeByWechatUserId(wechatUserId);
if (StringUtil.isEmpty(cityCode)) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
}
Map<String, Object> map = new HashMap<>();
map.put("cityCode", cityCode);
PageBeanNew<AppletGroupManageDTO> pageBeanNew = pcloudGroupActivityDao
.listPageNew(new PageParam(currentPage, numPerPage), map, "getLocalGroup");
if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
}
for (AppletGroupManageDTO activity4AppletDTO : pageBeanNew.getRecordList()) {
activity4AppletDTO.setStatus(0);
// 付费群 查询用户是否已经购买过该群分类
if (activity4AppletDTO.getPrice().compareTo(BigDecimal.ZERO) > 0) {
if (bookClassifyBuyRecordDao.checkUserBuy(wechatUserId, activity4AppletDTO.getClassifyId())) {
activity4AppletDTO.setStatus(1);
}
}
String filterStr = StringUtilParent.replaceHtml(activity4AppletDTO.getDesc());
String subStr = filterStr.length() > 60 ? filterStr.substring(0, 60) + "..." : filterStr;
activity4AppletDTO.setCutDesc(subStr);
// 通过 classifyId 获取群二维码链接
String groupQrCode = groupQrcodeBiz.getChangeGroupQrCode(activity4AppletDTO.getClassifyId());
// 通过群二维码链接反查群ID
ClassifyQrcodeVO groupQrcodeInfo = groupQrcodeBiz.getGroupQrcodeInfo(groupQrCode, activity4AppletDTO.getClassifyId());
//头像、对话
List<String> headUrlList = appletGroupSearchRecordBiz.getHeadUrlList(groupQrcodeInfo.getUserNumber(), groupQrcodeInfo.getId());
activity4AppletDTO.setHeadUrlList(headUrlList);
List<AppletGroupStatementDTO> statementDTOS = appletGroupSearchRecordBiz.getStatementList(groupQrcodeInfo.getUserNumber(), headUrlList, groupQrcodeInfo.getId());
activity4AppletDTO.setStatementDTOList(statementDTOS);
}
return pageBeanNew;
}
} }
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
change_number, change_number,
create_user, create_user,
create_time, create_time,
city_code
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{bookId,jdbcType=BIGINT}, #{bookId,jdbcType=BIGINT},
...@@ -71,6 +72,7 @@ ...@@ -71,6 +72,7 @@
#{changeNumber,jdbcType=BIGINT}, #{changeNumber,jdbcType=BIGINT},
#{createUser,jdbcType=BIGINT}, #{createUser,jdbcType=BIGINT},
NOW(), NOW(),
#{cityCode}
</trim> </trim>
</insert> </insert>
...@@ -114,6 +116,9 @@ ...@@ -114,6 +116,9 @@
<if test="changeNumber!=null"> <if test="changeNumber!=null">
change_number = #{changeNumber}, change_number = #{changeNumber},
</if> </if>
<if test="cityCode != null">
city_code = #{cityCode},
</if>
update_time = NOW() update_time = NOW()
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
...@@ -182,7 +187,8 @@ ...@@ -182,7 +187,8 @@
classify_introduce classifyIntroduce, classify_introduce classifyIntroduce,
price, price,
change_number changeNumber, change_number changeNumber,
create_user createUser create_user createUser,
city_code cityCode
from from
book_group_classify book_group_classify
where where
...@@ -216,7 +222,8 @@ ...@@ -216,7 +222,8 @@
price, price,
change_number changeNumber, change_number changeNumber,
rank, rank,
create_time createdTime create_time createdTime,
city_code cityCode
from from
book_group_classify book_group_classify
where where
...@@ -233,7 +240,8 @@ ...@@ -233,7 +240,8 @@
rank, rank,
count(1) qrcodeNumber, count(1) qrcodeNumber,
IFNULL(SUM(user_number),0) userNumberTotal, IFNULL(SUM(user_number),0) userNumberTotal,
c.create_time createdTime c.create_time createdTime,
city_code cityCode
from from
book_group_classify c left join book_group_qrcode q on c.id = q.classify_id book_group_classify c left join book_group_qrcode q on c.id = q.classify_id
where where
...@@ -1118,6 +1126,7 @@ ...@@ -1118,6 +1126,7 @@
a.create_user as adviserId, a.create_user as adviserId,
count(b.classify_id) AS groupCount, count(b.classify_id) AS groupCount,
c.agent_id as agentId c.agent_id as agentId
city_code cityCode
FROM FROM
book_group_classify a book_group_classify a
LEFT JOIN book_group_qrcode b ON a.id = b.classify_id AND b.is_delete = 0 AND a.is_delete = 0 LEFT JOIN book_group_qrcode b ON a.id = b.classify_id AND b.is_delete = 0 AND a.is_delete = 0
...@@ -1142,6 +1151,9 @@ ...@@ -1142,6 +1151,9 @@
<if test="depLabelId!=null"> <if test="depLabelId!=null">
AND c.dep_label_id = #{depLabelId} AND c.dep_label_id = #{depLabelId}
</if> </if>
<if test="cityCode != null">
and city_code = #{cityCode}
</if>
<if test="purLabelId!=null"> <if test="purLabelId!=null">
AND c.pur_label_id = #{purLabelId} AND c.pur_label_id = #{purLabelId}
</if> </if>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<mapper namespace="com.pcloud.book.record.mapper.RegionMapMapper" > <mapper namespace="com.pcloud.book.record.mapper.RegionMapMapper" >
<resultMap id="BaseResultMap" type="com.pcloud.book.record.entity.RegionMap" > <resultMap id="BaseResultMap" type="com.pcloud.book.record.entity.RegionMap" >
<id column="id" property="id" jdbcType="BIGINT" /> <id column="id" property="id" jdbcType="BIGINT" />
<result column="region_code" property="regionCode" jdbcType="INTEGER" /> <result column="region_code" property="regionCode" jdbcType="VARCHAR" />
<result column="level" property="level" jdbcType="INTEGER" /> <result column="level" property="level" jdbcType="INTEGER" />
<result column="region_name" property="regionName" jdbcType="VARCHAR" /> <result column="region_name" property="regionName" jdbcType="VARCHAR" />
<result column="alphabet" property="alphabet" jdbcType="CHAR" /> <result column="alphabet" property="alphabet" jdbcType="CHAR" />
...@@ -31,6 +31,18 @@ ...@@ -31,6 +31,18 @@
</where> </where>
order by region_code order by region_code
</select> </select>
<select id="getCitysByCodes" resultMap="BaseResultMap" parameterType="list">
select
<include refid="Base_Column_List"/>
from
region_map
where
region_code
in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" > <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from region_map delete from region_map
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
......
...@@ -563,7 +563,9 @@ ...@@ -563,7 +563,9 @@
ORDER BY a.id DESC ORDER BY a.id DESC
</select> </select>
<select id="getLocalGroup" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletGroupManageDTO">
<select id="getLocalGroup" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletGroupManageDTO">
SELECT SELECT
a.id, a.id,
a.id groupActivityId, a.id groupActivityId,
......
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