Commit 1691339b by 阮思源

解决冲突

parents 6d916141 61765155
......@@ -9,7 +9,6 @@
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-book</artifactId>
<version>${pcloud-facade-book.version}</version>
<packaging>jar</packaging>
<name>pcloud-facade-book</name>
......
......@@ -28,5 +28,7 @@ public interface BookClockInfoService {
@RequestMapping(value = "/dealOldData4WeixinClock", method = RequestMethod.GET)
void dealOldData4WeixinClock();
@ApiOperation(value = "处理关联作品的打卡的旧数据", httpMethod = "GET")
@RequestMapping(value = "/dealOldData4WeixinAtt", method = RequestMethod.GET)
void dealOldData4WeixinAtt();
}
package com.pcloud.book.copyright.dto;
import com.pcloud.common.dto.BaseDto;
import java.util.Date;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @author lihao
* @date 2019/9/3 17:02
*/
@ApiModel
public class CheckUserAuthDTO extends BaseDto {
private static final long serialVersionUID = -2646713544720373882L;
@ApiModelProperty("图书标识")
private Long bookId;
@ApiModelProperty("运营标识")
private Long channelId;
@ApiModelProperty("编辑标识")
private Long adviserId;
@ApiModelProperty("微信用户列表")
private List<Long> wechatUserIds;
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getAdviserId() {
return adviserId;
}
public void setAdviserId(Long adviserId) {
this.adviserId = adviserId;
}
public List<Long> getWechatUserIds() {
return wechatUserIds;
}
public void setWechatUserIds(List<Long> wechatUserIds) {
this.wechatUserIds = wechatUserIds;
}
@Override
public String toString() {
return "CheckUserAuthDTO{" +
"bookId=" + bookId +
", channelId=" + channelId +
", adviserId=" + adviserId +
", wechatUserIds=" + wechatUserIds +
'}';
}
}
......@@ -2,6 +2,7 @@ package com.pcloud.book.copyright.service;
import com.pcloud.book.copyright.dto.BookAuthInfoCountDTO;
import com.pcloud.book.copyright.dto.BookAuthTotalCountDTO;
import com.pcloud.book.copyright.dto.CheckUserAuthDTO;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import io.swagger.annotations.Api;
......@@ -26,13 +27,13 @@ public interface BookAuthInfoService {
@ApiOperation(value = "获取图书授权金价格", httpMethod = "GET")
@RequestMapping(value = "/getBookAuthPrice", method = RequestMethod.GET)
ResponseEntity<ResponseDto<BigDecimal>> getBookAuthPrice(@RequestParam("bookId") Long bookId, @RequestParam("channelId")Long channelId, @RequestParam("adviserId")Long adviserId)
throws BizException;
ResponseEntity<ResponseDto<BigDecimal>> getBookAuthPrice(@RequestParam("bookId") Long bookId, @RequestParam("channelId")Long channelId,
@RequestParam("adviserId")Long adviserId) throws BizException;
@ApiOperation(value = "获取图书授权统计信息", httpMethod = "GET")
@RequestMapping(value = "/getBookAuthInfoCount", method = RequestMethod.GET)
ResponseEntity<ResponseDto<BookAuthInfoCountDTO>> getBookAuthInfoCount(@RequestParam("bookId") Long bookId, @RequestParam("channelId")Long channelId, @RequestParam("adviserId")Long adviserId, @RequestParam("monthDate") String monthDate)
throws BizException;
ResponseEntity<ResponseDto<BookAuthInfoCountDTO>> getBookAuthInfoCount(@RequestParam("bookId") Long bookId, @RequestParam("channelId")Long channelId,
@RequestParam("adviserId")Long adviserId, @RequestParam("monthDate") String monthDate) throws BizException;
@ApiOperation(value = "获取图书授权总统计信息", httpMethod = "GET")
@RequestMapping(value = "/getBookAuthTotalCount", method = RequestMethod.GET)
......@@ -41,4 +42,15 @@ public interface BookAuthInfoService {
@ApiOperation(value = "根据获取图书授权总统计信息", httpMethod = "POST")
@RequestMapping(value = "/getBookAuthTotalCount4Adviser", method = RequestMethod.POST)
ResponseEntity<ResponseDto<BookAuthTotalCountDTO>> getBookAuthTotalCount4Adviser(@RequestBody List<Long> adviserIds) throws BizException;
@ApiOperation(value = "校验用户是否授权过(进群)", httpMethod = "POST")
@RequestMapping(value = "/checkUserIsHaveAuth", method = RequestMethod.POST)
ResponseEntity<ResponseDto<Boolean>> checkUserIsHaveAuth(@RequestBody CheckUserAuthDTO checkUserAuthDTO) throws BizException;
@ApiOperation(value = "获取社群书授权金价格", httpMethod = "GET")
@RequestMapping(value = "/getGroupBookAuthPrice", method = RequestMethod.GET)
ResponseEntity<ResponseDto<BigDecimal>> getGroupBookAuthPrice(@RequestParam("bookId") Long bookId, @RequestParam("channelId")Long channelId,
@RequestParam("adviserId")Long adviserId) throws BizException;
}
......@@ -51,6 +51,11 @@ public class GroupClassifyQrcodeDTO implements Serializable {
private String qrCodeUrl;
/**
* 群名称
*/
private String groupName;
/**
* 是否开启群学习报告
*/
private Boolean hasOpenLearningReport;
......@@ -59,6 +64,11 @@ public class GroupClassifyQrcodeDTO implements Serializable {
*/
private Integer joinGroupType;
/**
* 切群人数
*/
private Integer changeNumber;
public Long getBookId() {
return bookId;
}
......@@ -131,6 +141,14 @@ public class GroupClassifyQrcodeDTO implements Serializable {
this.qrCodeUrl = qrCodeUrl;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public Boolean getHasOpenLearningReport() {
return hasOpenLearningReport;
}
......@@ -147,6 +165,14 @@ public class GroupClassifyQrcodeDTO implements Serializable {
this.joinGroupType = joinGroupType;
}
public Integer getChangeNumber() {
return changeNumber;
}
public void setChangeNumber(Integer changeNumber) {
this.changeNumber = changeNumber;
}
@Override
public String toString() {
return "GroupClassifyQrcodeDTO{" +
......@@ -159,8 +185,10 @@ public class GroupClassifyQrcodeDTO implements Serializable {
", weixinQrcodeId=" + weixinQrcodeId +
", price=" + price +
", qrCodeUrl='" + qrCodeUrl + '\'' +
", groupName='" + groupName + '\'' +
", hasOpenLearningReport=" + hasOpenLearningReport +
", joinGroupType=" + joinGroupType +
", changeNumber=" + changeNumber +
'}';
}
}
......@@ -22,5 +22,13 @@ public class RiddleConstant {
*/
public static final String JOB_NAME_RIDDLE_EXPIRE = "judgeRiddleTime";
/**
* 每个谜语后的规则提示
*/
public static final String rule_notice = "敲重点!如果答错了,我是不会回复的哦。";
/**
* 关键词说明
*/
public static final String introduce = "猜谜语,简单有趣的小游戏。连续答对5题,所有群成员可获得精美礼券";
}
package com.pcloud.book.riddle.enums;
/**
* @描述:点击记录
* @作者:zhuyajie
* @创建时间:16:39 2019/8/29
* @版本:1.0
*/
public enum RiddleClickTypeEnum {
/**
* 点击链接
*/
link(1),
/**
* 许愿
*/
wish(2),
/**
* 立即使用
*/
use(3);
private Integer code;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
RiddleClickTypeEnum(Integer code) {
this.code = code;
}
}
......@@ -19,7 +19,11 @@ public enum RiddleRecordStatusEnum {
/**
*进行中
*/
underway(2);
underway(2),
/**
* 通关结束
*/
over(3);
private Integer code;
......@@ -34,4 +38,6 @@ public enum RiddleRecordStatusEnum {
RiddleRecordStatusEnum(Integer code) {
this.code = code;
}
public static final Integer[] GAME_END = {end.code, over.code};
}
......@@ -9,8 +9,6 @@
<groupId>com.pcloud.service</groupId>
<artifactId>pcloud-service-book</artifactId>
<version>${pcloud-service-book.version}</version>
<packaging>jar</packaging>
<name>pcloud-service-book</name>
......@@ -26,7 +24,7 @@
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-book</artifactId>
<version>${pcloud-facade-book.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<!--内部调用依赖-->
......@@ -51,140 +49,140 @@
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-usercenter</artifactId>
<version>${pcloud-facade-usercenter.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-resourcecenter</artifactId>
<version>${pcloud-facade-resourcecenter.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-channelcenter</artifactId>
<version>${pcloud-facade-channelcenter.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-tradecenter</artifactId>
<version>${pcloud-facade-tradecenter.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-comment</artifactId>
<version>${pcloud-facade-comment.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-message</artifactId>
<version>${pcloud-facade-message.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-quartz</artifactId>
<version>${pcloud-facade-quartz.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-analysisengine</artifactId>
<version>${pcloud-facade-analysisengine.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-commoncenter</artifactId>
<version>${pcloud-facade-commoncenter.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-voicemessage</artifactId>
<version>${pcloud-facade-voicemessage.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-settlementcenter</artifactId>
<version>${pcloud-facade-settlement.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-appcenter</artifactId>
<version>${pcloud-facade-appcenter.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-raystask</artifactId>
<version>${pcloud-facade-raystask.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-contentcenter</artifactId>
<version>${pcloud-facade-contentcenter.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-readercenter</artifactId>
<version>${pcloud-facade-readercenter.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-labelcenter</artifactId>
<version>${pcloud-facade-labelcenter.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-wechatgroup</artifactId>
<version>${pcloud-facade-wechatgroup.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-promotion</artifactId>
<version>${pcloud-facade-promotion.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-audioapp</artifactId>
<version>${pcloud-facade-audioapp.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-videolesson</artifactId>
<version>${pcloud-facade-videolesson.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-liveapp</artifactId>
<version>${pcloud-facade-liveapp.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-shareimage</artifactId>
<version>${pcloud-facade-shareimage.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
<groupId>com.pcloud.facade</groupId>
<artifactId>pcloud-facade-convert</artifactId>
<version>${pcloud-facade-convert.version}</version>
<version>${pcloud-facade.version}</version>
</dependency>
<dependency>
......
......@@ -106,4 +106,11 @@ public interface GroupMasterTagBiz {
* @return
*/
List<Long> getTagBookIds4AdMatser(Long masterId);
/**
* 已标记的书标记新的群
* @param classifyId
* @param qrcodeId
*/
public void addTagByBookGroup(Long classifyId, Long qrcodeId);
}
......@@ -2380,13 +2380,13 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
partyConsr.updateLoginAccount(advertisingMaster.getLoginName(), advertisingMaster.getPassword(), loginId);
}*/
//账号修改通过子账号完成
if (null == loginId) {
LOGGER.error("广告主" + masterId + "是品牌方结算,子账号为空");
}
// if (null == loginId) {
// LOGGER.error("广告主" + masterId + "是品牌方结算,子账号为空");
// }
} else {
if (null != master.getLoginId()) {//删除账号,标记记录
// partyConsr.deleteLoginAccount(master.getLoginId());
advertisingMaster.setLoginId(null);
partyConsr.deleteLoginAccount(master.getLoginId());
advertisingMaster.setLoginId(123l);
advertisingGroupTagDao.deleteByMasterId(masterId);
}
}
......
......@@ -17,18 +17,22 @@ import com.pcloud.book.consumer.common.ExportConsr;
import com.pcloud.book.consumer.label.LabelConsr;
import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.vo.ClassifyVO;
import com.pcloud.common.core.biz.MessageBiz;
import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.core.dto.SendNotifyDto;
import com.pcloud.common.core.enums.NotifyOriginTypeEnum;
import com.pcloud.common.entity.UploadResultInfo;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.common.utils.zip.CompressUtils;
import com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto;
import org.apache.commons.collections.MapUtils;
......@@ -77,6 +81,8 @@ public class GroupMasterTagBizImpl implements GroupMasterTagBiz {
private ExportConsr exportConsr;
@Autowired
private MessageBiz messageBiz;
@Autowired
private BookGroupClassifyBiz bookGroupClassifyBiz;
@Override
public PageBeanNew<GroupMasterDTO> listPageGroupMaster(Integer currentPage, Integer numPerPage, Map<String, Object> paramMap) {
......@@ -393,12 +399,31 @@ public class GroupMasterTagBizImpl implements GroupMasterTagBiz {
return;
}
EXECUTOR_SINGLE_SERVICE.execute(() -> {
String fileName = "微信群导出_" + DateUtils.getShortDateStr();
String fileName = "微信群二维码导出_" + DateUtils.getShortDateStr();
Boolean isSuccess = true;
String fileUrl = "";
try {
setLabelName(list);
fileUrl = exportGroupList4Master(list, fileName);
// setLabelName(list);
// fileUrl = exportGroupList4Master(list, fileName);
//导出二维码
Map<String, List<String[]>> zipFileMap = new HashMap<>();
List<String[]> qrcodePicUrls = new ArrayList<String[]>();
Integer noName = 0;
for (GroupMasterDTO masterDTO : list) {
String qrcodeUrl = masterDTO.getQrcodeUrl() == null ? null : masterDTO.getQrcodeUrl().replace("oss.5rs.me", "file.5rs.me");
String qrcodeName;//二维码命名
if (!StringUtil.isEmpty(masterDTO.getGroupName())) {
qrcodeName = masterDTO.getGroupName();
} else {
noName = noName + 1;
qrcodeName = "未命名" + noName;
}
String[] qrcodePicurl = {qrcodeName, qrcodeUrl};
qrcodePicUrls.add(qrcodePicurl);
}
zipFileMap.put(fileName, qrcodePicUrls);
UploadResultInfo zipUrlInfo = CompressUtils.zipByCatalog(zipFileMap, fileName);
fileUrl = zipUrlInfo != null ? zipUrlInfo.getUrl() : null;
} catch (Exception e) {
log.error("生成导出文件失败" + e.getMessage(), e);
isSuccess = false;
......@@ -548,4 +573,26 @@ public class GroupMasterTagBizImpl implements GroupMasterTagBiz {
List<Long> bookIds = advertisingGroupTagDao.getBookIdsByMasterId(masterId);
return bookIds;
}
@Override
public void addTagByBookGroup(Long classifyId, Long qrcodeId) {
ClassifyVO classifyVO = bookGroupClassifyBiz.getClassify(classifyId);
if (null == classifyVO){
return;
}
Long bookId = classifyVO.getBookId();
List<Long> masterIds = advertisingGroupTagDao.getMasterIdsByBookId(bookId);
if (ListUtils.isEmpty(masterIds)) {
return;
}
List<AdvertisingGroupTag> list = new ArrayList<>();
for (Long masterId : masterIds) {
AdvertisingGroupTag tag = new AdvertisingGroupTag();
tag.setGroupQrcodeId(qrcodeId);
tag.setTagBookId(bookId);
tag.setMasterId(masterId);
list.add(tag);
}
advertisingGroupTagDao.insert(list);
}
}
......@@ -52,4 +52,11 @@ public interface AdvertisingGroupTagDao extends BaseDao<AdvertisingGroupTag> {
* @return
*/
List<String> getTagWxGroupIdsByMasterId(Long masterId);
/**
* 根据书查标记的广告主
* @param bookId
* @return
*/
List<Long> getMasterIdsByBookId(Long bookId);
}
......@@ -51,4 +51,9 @@ public class AdvertisingGroupTagDaoImpl extends BaseDaoImpl<AdvertisingGroupTag>
public List<String> getTagWxGroupIdsByMasterId(Long masterId) {
return getSessionTemplate().selectList(getStatement("getTagWxGroupIdsByMasterId"), masterId);
}
@Override
public List<Long> getMasterIdsByBookId(Long bookId) {
return getSessionTemplate().selectList(getStatement("getMasterIdsByBookId"), bookId);
}
}
......@@ -12,6 +12,7 @@ import com.pcloud.book.book.dto.BookInfoAnalysicsDTO;
import com.pcloud.book.book.dto.BookInfoAndAuthStatusDTO;
import com.pcloud.book.book.entity.Book;
import com.pcloud.book.book.vo.ListNoAuthBookParam;
import com.pcloud.book.book.vo.ListNoAuthGroupBookParam;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageBeanNew;
......@@ -550,6 +551,14 @@ public interface BookBiz {
PageBeanNew listNoAuthBook(ListNoAuthBookParam listNoAuthBookParam, Long adviserId);
/**
* 获取未设置授权的社群书
* @param listNoAuthGroupBookParam
* @param adviserId
* @return
*/
PageBeanNew listNoAuthGroupBook(ListNoAuthGroupBookParam listNoAuthGroupBookParam, Long adviserId);
/**
* 获取图书基本信息与授权状态
*/
BookInfoAndAuthStatusDTO getBaseAndAuthStatus(Long bookId, Long channelId, Long adviserId);
......
......@@ -39,6 +39,7 @@ import com.pcloud.book.book.entity.BookAdviser;
import com.pcloud.book.book.set.BookSet;
import com.pcloud.book.book.tools.BookTools;
import com.pcloud.book.book.vo.ListNoAuthBookParam;
import com.pcloud.book.book.vo.ListNoAuthGroupBookParam;
import com.pcloud.book.consumer.analysisengine.SceneRecordConsr;
import com.pcloud.book.consumer.app.AssistTempletConsr;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
......@@ -1673,6 +1674,28 @@ public class BookBizImpl implements BookBiz {
}
@Override
@ParamLog("未设置版权保护的社群书")
public PageBeanNew listNoAuthGroupBook(ListNoAuthGroupBookParam listNoAuthGroupBookParam, Long adviserId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adviserId", adviserId);
paramMap.put("channelId", listNoAuthGroupBookParam.getChannelId());
paramMap.put("name", listNoAuthGroupBookParam.getName() != null && "".equals(listNoAuthGroupBookParam.getName().trim()) ? null : listNoAuthGroupBookParam.getName());
paramMap.put("typeCode", listNoAuthGroupBookParam.getTypeCode() != null && "".equals(listNoAuthGroupBookParam.getTypeCode().trim()) ? null : listNoAuthGroupBookParam.getTypeCode());
paramMap.put("templetId", listNoAuthGroupBookParam.getTempletId());
paramMap.put("secondTempletIds", Optional.ofNullable(listNoAuthGroupBookParam.getSecondTempletId()).map(Lists::newArrayList).orElse(Lists.newArrayList()));
PageParam pageParam = new PageParam(listNoAuthGroupBookParam.getCurrentPage(), listNoAuthGroupBookParam.getNumPerPage());
PageBeanNew pageBean = bookDao.listPageNew(pageParam, paramMap, "listNoAuthGroupBook");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBeanNew(listNoAuthGroupBookParam.getCurrentPage(), listNoAuthGroupBookParam.getNumPerPage(), new ArrayList<>());
}
//设置类型名称
bookSet.setTempletNames(pageBean.getRecordList());
//设置运营平台名称
bookSet.setChannelName(pageBean.getRecordList());
return pageBean;
}
@Override
@ParamLog("获取图书基本信息与授权状态")
public BookInfoAndAuthStatusDTO getBaseAndAuthStatus(Long bookId, Long channelId, Long adviserId) {
BookDto book = getBaseById(bookId);
......@@ -1683,7 +1706,7 @@ public class BookBizImpl implements BookBiz {
BookInfoAndAuthStatusDTO bookInfoAndAuthStatusDTO = new BookInfoAndAuthStatusDTO();
BeanUtils.copyProperties(book, bookInfoAndAuthStatusDTO);
//获取授权状态
BookAuthInfoVO infoByBook = bookAuthInfoBiz.getInfoByBook(bookId, channelId, adviserId);
BookAuthInfoVO infoByBook = bookAuthInfoBiz.getInfoByBook(bookId, channelId, adviserId, null);
if (infoByBook != null) {
BeanUtils.copyProperties(infoByBook, bookInfoAndAuthStatusDTO);
}
......
......@@ -7,6 +7,7 @@ import com.pcloud.book.book.dto.BookAssocCount;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.book.entity.Book;
import com.pcloud.book.book.vo.ListNoAuthBookParam;
import com.pcloud.book.book.vo.ListNoAuthGroupBookParam;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean;
......@@ -560,4 +561,9 @@ public interface BookFacade {
@ApiOperation(value = "获取未设置正版授权的图书", httpMethod = "POST")
ResponseDto<PageBeanNew> listNoAuthBook(@RequestHeader("token") String token,
@RequestBody ListNoAuthBookParam listNoAuthBookParam) throws PermissionException;
@RequestMapping(value = "listNoAuthGroupBook", method = RequestMethod.POST)
@ApiOperation(value = "获取未设置正版授权的社群书", httpMethod = "POST")
ResponseDto<PageBeanNew> listNoAuthGroupBook(@RequestHeader("token") String token,
@RequestBody ListNoAuthGroupBookParam listNoAuthGroupBookParam) throws PermissionException;
}
......@@ -11,6 +11,7 @@ import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.book.entity.Book;
import com.pcloud.book.book.facade.BookFacade;
import com.pcloud.book.book.vo.ListNoAuthBookParam;
import com.pcloud.book.book.vo.ListNoAuthGroupBookParam;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean;
......@@ -746,4 +747,14 @@ public class BookFacadeImpl implements BookFacade {
PageBeanNew pageBeanNew = bookBiz.listNoAuthBook(listNoAuthBookParam, adviserId);
return new ResponseDto<PageBeanNew>(null == pageBeanNew ? new PageBeanNew():pageBeanNew);
}
@Override
@RequestMapping(value = "listNoAuthGroupBook", method = RequestMethod.POST)
public ResponseDto<PageBeanNew> listNoAuthGroupBook(@RequestHeader("token") String token,
@RequestBody ListNoAuthGroupBookParam listNoAuthGroupBookParam)
throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
PageBeanNew pageBeanNew = bookBiz.listNoAuthGroupBook(listNoAuthGroupBookParam, adviserId);
return new ResponseDto<PageBeanNew>(null == pageBeanNew ? new PageBeanNew():pageBeanNew);
}
}
package com.pcloud.book.book.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @author lily
* @date 2018/12/3 20:35
*/
@ApiModel
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ListNoAuthGroupBookParam implements Serializable {
@ApiModelProperty("isbn/issn/图书名称")
private String name;
@ApiModelProperty("运营标识")
private Long channelId;
@ApiModelProperty("图书类型标识")
private Long templetId;
@ApiModelProperty("图书类型标识")
private Long secondTempletId;
@ApiModelProperty("当前页")
private Integer currentPage;
@ApiModelProperty("每页条数")
private Integer numPerPage;
@ApiModelProperty("类型")
private String typeCode;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getTempletId() {
return templetId;
}
public Long getSecondTempletId() {
return secondTempletId;
}
public void setSecondTempletId(Long secondTempletId) {
this.secondTempletId = secondTempletId;
}
public void setTempletId(Long templetId) {
this.templetId = templetId;
}
public Integer getCurrentPage() {
return currentPage;
}
public void setCurrentPage(Integer currentPage) {
this.currentPage = currentPage;
}
public Integer getNumPerPage() {
return numPerPage;
}
public void setNumPerPage(Integer numPerPage) {
this.numPerPage = numPerPage;
}
public String getTypeCode() {
return typeCode;
}
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
@Override
public String toString() {
return "ListNoAuthBookParam{" +
"name='" + name + '\'' +
", channelId=" + channelId +
", templetId=" + templetId +
", secondTempletId=" + secondTempletId +
", currentPage=" + currentPage +
", numPerPage=" + numPerPage +
", typeCode='" + typeCode + '\'' +
'}';
}
}
......@@ -71,4 +71,9 @@ public interface BookClockBiz {
* 处理关联应用的打卡的旧数据
*/
void dealOldData4WeixinClock();
/**
* 处理关联作品的打卡的旧数据
*/
void dealOldData4WeixinAtt();
}
......@@ -11,6 +11,8 @@ import com.pcloud.book.clock.dto.BookClockInfoDTO;
import com.pcloud.book.clock.dto.BookClockKeywordDTO;
import com.pcloud.book.clock.dto.BookClockListDTO;
import com.pcloud.book.clock.dto.BookGroupClockDTO;
import com.pcloud.book.clock.dto.BookGroupClockKeywordDTO;
import com.pcloud.book.clock.dto.PushBookClockKeywordDTO;
import com.pcloud.book.clock.entity.BookClockInfo;
import com.pcloud.book.clock.entity.BookClockKeyword;
import com.pcloud.book.clock.entity.BookGroupClock;
......@@ -28,6 +30,11 @@ import com.pcloud.book.group.dao.WeixinQrcodeDao;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookWxQrcodeDTO;
import com.pcloud.book.group.dto.ClassifyDTO;
import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.vo.ClassifyVO;
import com.pcloud.book.keywords.biz.BookKeywordBiz;
import com.pcloud.book.keywords.vo.SetKeywordVO;
import com.pcloud.book.weixinclock.biz.WeixinClockBiz;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
import com.pcloud.common.core.aspect.ParamLog;
......@@ -90,7 +97,9 @@ public class BookClockBizImpl implements BookClockBiz {
private WeixinQrcodeDao weixinQrcodeDao;
@Autowired
private WeixinClockBiz weixinClockBiz;
@Autowired
private BookKeywordBiz bookKeywordBiz;
private ExecutorService timedTask = Executors.newFixedThreadPool(5);
/**
* 关联作品/应用及微信群
......@@ -432,13 +441,13 @@ public class BookClockBizImpl implements BookClockBiz {
weixinClockDto.setClockIntroduction("欢迎加入打卡,每天一次,养成良好习惯");
weixinClockDto.setClockKeyword("每日打卡");
List<BookClockInfoDTO> clockInfoIds = bookClockInfoDao.getAllClockInfoIds();
if(!ListUtils.isEmpty(clockInfoIds)){
for(BookClockInfoDTO bookClockInfoDTO: clockInfoIds){
if (!ListUtils.isEmpty(clockInfoIds)) {
for (BookClockInfoDTO bookClockInfoDTO : clockInfoIds) {
List<Long> list1 = bookGroupClockDao.getClassifyIdsByBookGroupId(bookClockInfoDTO.getBookClockInfoId());
List<Long> list2 = bookGroupClockDao.getClassifyIdsByClassfyId(bookClockInfoDTO.getBookClockInfoId());
list1.addAll(list2);
List<Long> resultList = list1.stream().distinct().collect(Collectors.toList());
if(!ListUtils.isEmpty(resultList)) {
if (!ListUtils.isEmpty(resultList)) {
weixinClockDto.setCreateUser(bookClockInfoDTO.getCreateUser());
weixinClockDto.setLastModifiedUser(bookClockInfoDTO.getCreateUser());
weixinClockDto.setGroupClassifyIds(resultList);
......@@ -448,4 +457,48 @@ public class BookClockBizImpl implements BookClockBiz {
}
}).start();
}
@Override
public void dealOldData4WeixinAtt() {
timedTask.execute(()->{
SetKeywordVO setKeywordVO = new SetKeywordVO();
List<BookClockInfoDTO> clockInfoIds = bookClockInfoDao.getAllAttInfoIds();
if(!ListUtils.isEmpty(clockInfoIds)){
for(BookClockInfoDTO bookClockInfoDTO: clockInfoIds){
List<Long> list1 = bookGroupClockDao.getClassifyIdsByBookGroupId(bookClockInfoDTO.getBookClockInfoId());
List<Long> list2 = bookGroupClockDao.getClassifyIdsByClassfyId(bookClockInfoDTO.getBookClockInfoId());
//关联的关键词
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("bookClockInfoId",bookClockInfoDTO.getBookClockInfoId());
List<BookClockKeywordDTO> bookClockKeywordDTOS = bookClockKeywordDao.getKeywordsByInfoId(paramMap);
if (bookClockKeywordDTOS.size() != 1){
continue;
}
list1.addAll(list2);
List<Long> resultList = list1.stream().distinct().collect(Collectors.toList());
if(!ListUtils.isEmpty(resultList)) {
for (Long id : resultList) {
ClassifyVO classifyVO = bookGroupClassifyDao.getClassify(id);
setKeywordVO.setGuide(bookClockKeywordDTOS.get(0).getGuide());
setKeywordVO.setChannelId(classifyVO.getChannelId());
setKeywordVO.setKeywords(bookClockKeywordDTOS.get(0).getKeyword());
setKeywordVO.setPicUrl(bookClockInfoDTO.getOriginImg());
setKeywordVO.setLinkUrl("/C" + classifyVO.getChannelId() + "/product/display/" + bookClockInfoDTO.getOriginId() + "?adviserId=" + bookClockInfoDTO.getCreateUser() + "&source_type=QRCODE");
setKeywordVO.setDescription("签到打卡");
setKeywordVO.setAddWarehouse(0);
setKeywordVO.setClassifyId(id);
setKeywordVO.setReplyType(1);
setKeywordVO.setReplyType(4);
setKeywordVO.setMatchingRule(0);
setKeywordVO.setBookGroupId(classifyVO.getBookGroupId());
setKeywordVO.setContent(bookClockInfoDTO.getOriginTitle());
setKeywordVO.setServeId(bookClockInfoDTO.getOriginId());
setKeywordVO.setServeType(bookClockInfoDTO.getOriginType());
bookKeywordBiz.insertKeyword(setKeywordVO);
}
}
}
}
});
}
}
......@@ -88,4 +88,5 @@ public interface BookClockInfoDao extends BaseDao<BookClockInfo> {
void deleteBookClockInfo(Map<String, Object> paramMap);
List<BookClockInfoDTO> getAllClockInfoIds();
List<BookClockInfoDTO> getAllAttInfoIds();
}
......@@ -141,5 +141,9 @@ public class BookClockInfoDaoImpl extends BaseDaoImpl<BookClockInfo> implements
return super.sqlSessionTemplate.selectList(getStatement("getAllClockInfoIds"),paramMap);
}
@Override
public List<BookClockInfoDTO> getAllAttInfoIds() {
Map<String,Object> paramMap = new HashMap<>();
return super.sqlSessionTemplate.selectList(getStatement("getAllAttInfoIds"),paramMap);
}
}
......@@ -76,5 +76,10 @@ public class BookClockInfoServiceImpl implements BookClockInfoService {
bookClockBiz.dealOldData4WeixinClock();
}
@Override
@RequestMapping(value = "/dealOldData4WeixinAtt", method = RequestMethod.GET)
public void dealOldData4WeixinAtt() {
bookClockBiz.dealOldData4WeixinAtt();
}
}
......@@ -28,7 +28,7 @@ public interface BookAuthCodeBiz {
/**
* 获取最大批次号
*/
Integer getMaxBatchNum(Long bookId, Long channelId, Long adviserId);
Integer getMaxBatchNum(Long bookId, Long channelId, Long adviserId, Integer authBookType);
/**
* 校验验证码
......@@ -53,7 +53,7 @@ public interface BookAuthCodeBiz {
* @Desr:获取导入记录
* @Date:2019/5/22 18:02
*/
PageBeanNew<ImportRecordVO> importCodeRecord(Long bookId, Long channelId, Long adviserId, Integer currentPage, Integer numPerPage);
PageBeanNew<ImportRecordVO> importCodeRecord(Long bookId, Long channelId, Long adviserId, Integer authBookType, Integer currentPage, Integer numPerPage);
/**
* 获取正版授权码
......@@ -64,7 +64,7 @@ public interface BookAuthCodeBiz {
* @param pageParam
* @return
*/
PageBeanNew<BookAuthCodeDTO> getCodeList(Long bookId, Long channelId, Long adviserId, String keyword, Integer state, PageParam pageParam);
PageBeanNew<BookAuthCodeDTO> getCodeList(Long bookId, Long channelId, Long adviserId, String keyword, Integer state, Integer authBookType, PageParam pageParam);
/**
* 批量删除正版授权码
......@@ -82,5 +82,5 @@ public interface BookAuthCodeBiz {
* @param partyId
* @return
*/
Map<String, Object> getCodeExcel(Long bookId, String codeIds, Long channelId, Long status, String systemCode, Long partyId);
Map<String, Object> getCodeExcel(Long bookId, String codeIds, Long channelId, Long status, String systemCode, Long partyId, Integer authBookType);
}
......@@ -7,6 +7,7 @@ import com.pcloud.book.copyright.vo.BookAuthInfoVO;
import com.pcloud.book.copyright.vo.BookAuthInfoWechatVO;
import com.pcloud.book.copyright.vo.GetAuthInfoParam;
import com.pcloud.book.copyright.vo.ListHaveAuthBookParam;
import com.pcloud.book.copyright.vo.ListHaveAuthGroupBookParam;
import com.pcloud.book.copyright.vo.SetAuthStatusParam;
import com.pcloud.book.copyright.vo.SetAuthOpenParam;
import com.pcloud.book.copyright.vo.SetLocationDescVO;
......@@ -44,12 +45,12 @@ public interface BookAuthInfoBiz {
/**
* 获取图书正版授权基本信息
*/
BookAuthInfoVO getInfoByBook(Long bookId, Long channelId, Long adviserId);
BookAuthInfoVO getInfoByBook(Long bookId, Long channelId, Long adviserId, Integer authBookType);
/**
* 获取图书正版授权基本信息
*/
BookAuthInfoAndServesVO getInfoAndServesByBook(Long bookId, Long channelId, Long adviserId);
BookAuthInfoAndServesVO getInfoAndServesByBook(Long bookId, Long channelId, Long adviserId, Integer authBookType);
/**
* 获取设置够正版授权图书信息
......@@ -58,9 +59,15 @@ public interface BookAuthInfoBiz {
PageBeanNew listHaveSetAuthBook(ListHaveAuthBookParam listHaveAuthBookParam, Long adviserId);
/**
* 获取设置够正版授权社群书信息
* @return
*/
PageBeanNew listHaveSetAuthGroupBook(ListHaveAuthGroupBookParam listHaveAuthGroupBookParam, Long adviserId);
/**
* 获取正版授权金价格
*/
BigDecimal getBookAuthPrice(Long bookId, Long channelId, Long adviserId);
BigDecimal getBookAuthPrice(Long bookId, Long channelId, Long adviserId, Integer authBookType);
/**
* 获取图书授权信息
......@@ -70,7 +77,7 @@ public interface BookAuthInfoBiz {
/**
* 获取图书授权基本信息
*/
BookAuthInfoVO getAuthBookInfo(Long bookId, Long channelId, Long adviserId, Long sceneId);
BookAuthInfoVO getAuthBookInfo(Long bookId, Long channelId, Long adviserId, Long sceneId, Integer authBookType);
/**
* 获取图书授权统计
......
package com.pcloud.book.copyright.biz;
import com.pcloud.book.copyright.dto.CheckUserAuthDTO;
import com.pcloud.book.copyright.entity.BookAuthUser;
import com.pcloud.book.copyright.vo.BookAuthCodeUserVO;
import com.pcloud.book.copyright.vo.BookClickBuyRecordParam;
......@@ -17,7 +18,7 @@ public interface BookAuthUserBiz {
/**
* 获取授权用户数量
*/
BookAuthCodeUserVO getAuthUserCount(Long bookId, Long channelId, Long adviserId);
BookAuthCodeUserVO getAuthUserCount(Long bookId, Long channelId, Long adviserId, Integer authBookType);
/**
* 根据月份获取授权用户数量
......@@ -27,12 +28,12 @@ public interface BookAuthUserBiz {
/**
* 最近30天趋势图
*/
List<ThirtyDayCountVO> listThirtyDay(Long bookId, Long channelId, Long adviserId, String province);
List<ThirtyDayCountVO> listThirtyDay(Long bookId, Long channelId, Long adviserId, String province, Integer authBookType);
/**
* 最近6个月趋势图
*/
List<SixMonthCountVO> listSixMonth(Long bookId, Long channelId, Long adviserId, String province);
List<SixMonthCountVO> listSixMonth(Long bookId, Long channelId, Long adviserId, String province, Integer authBookType);
/**
* 新增用户授权记录
......@@ -42,7 +43,7 @@ public interface BookAuthUserBiz {
/**
* 校验用户是否已经授权
*/
Boolean checkIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId);
Boolean checkIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId, Integer authBookType);
/**
* 获取授权信息总的统计数据
......@@ -58,4 +59,9 @@ public interface BookAuthUserBiz {
* 省份排名前10
*/
List<ProvinceTop10VO> listTop10ByBook(Long bookId, Long channelId, Long adviserId, Integer type);
/**
* 校验用户是否授权(进群)
*/
Boolean checkUserIsHaveAuth(CheckUserAuthDTO checkUserAuthDTO);
}
......@@ -20,6 +20,7 @@ import com.pcloud.book.copyright.dto.BookAuthCodeDTO;
import com.pcloud.book.copyright.entity.BookAuthCode;
import com.pcloud.book.copyright.entity.BookAuthCodeImportRecord;
import com.pcloud.book.copyright.entity.BookAuthUser;
import com.pcloud.book.copyright.enums.AuthBookTypeEnum;
import com.pcloud.book.copyright.tools.ExcelUtil;
import com.pcloud.book.copyright.vo.BookAuthInfoVO;
import com.pcloud.book.copyright.vo.CheckCodeParam;
......@@ -128,8 +129,8 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
}
@Override
public Integer getMaxBatchNum(Long bookId, Long channelId, Long adviserId) {
Integer batchNum = bookAuthCodeDao.getMaxBatchNum(bookId, channelId, adviserId);
public Integer getMaxBatchNum(Long bookId, Long channelId, Long adviserId, Integer authBookType) {
Integer batchNum = bookAuthCodeDao.getMaxBatchNum(bookId, channelId, adviserId, authBookType);
return batchNum;
}
......@@ -137,29 +138,30 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
@Transactional(rollbackFor = Exception.class)
public Integer checkCode(CheckCodeParam checkCodeParam, Long channelId, Long wechatUserId) {
String code = checkCodeParam.getCode();
Integer authBookType = checkCodeParam.getAuthBookType();
if (StringUtils.isEmpty(code) || code.length() != 15) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "此码错误,请重新验证");
}
BookAuthInfoVO authBookInfo = bookAuthInfoBiz.getAuthBookInfo(checkCodeParam.getBookId(), channelId, checkCodeParam.getAdviserId(), checkCodeParam.getSceneId());
BookAuthInfoVO authBookInfo = bookAuthInfoBiz.getAuthBookInfo(checkCodeParam.getBookId(), channelId, checkCodeParam.getAdviserId(), checkCodeParam.getSceneId(), authBookType);
if (authBookInfo == null || BookStatusEnum.NO_SET.value.equals(authBookInfo.getBookStatus())) {
return BookStatusEnum.CodeUseTypeEnum.RIGHT.value;
}
Long bookId = authBookInfo.getBookId();
Long adviserId = authBookInfo.getAdviserId();
//校验用户是否已经授权过
Boolean isHaveAuth = bookAuthUserBiz.checkIsHaveAuth(bookId, channelId, adviserId, wechatUserId);
Boolean isHaveAuth = bookAuthUserBiz.checkIsHaveAuth(bookId, channelId, adviserId, wechatUserId, authBookType);
if (isHaveAuth) {
return BookStatusEnum.CodeUseTypeEnum.RIGHT.value;
}
Boolean isHaveCode = bookAuthCodeDao.getIsHaveCode(bookId, channelId, adviserId, code);
Integer count = bookAuthCodeDao.updateUseCount(bookId, channelId, adviserId, code, authBookInfo.getCodeUseCount());
Boolean isHaveCode = bookAuthCodeDao.getIsHaveCode(bookId, channelId, adviserId, code, authBookType);
Integer count = bookAuthCodeDao.updateUseCount(bookId, channelId, adviserId, code, authBookInfo.getCodeUseCount(), authBookType);
if (count < 1 && isHaveCode) {
return BookStatusEnum.CodeUseTypeEnum.HAVE_USE.value;
} else if (count < 1 && !isHaveCode) {
return BookStatusEnum.CodeUseTypeEnum.NOT_RIGHT.value;
} else {
//新增一条校验成功记录
addUserRecord(bookId, channelId, adviserId, wechatUserId);
addUserRecord(bookId, channelId, adviserId, wechatUserId, authBookType);
return BookStatusEnum.CodeUseTypeEnum.RIGHT.value;
}
}
......@@ -173,7 +175,7 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请选择要进入的服务");
}
//校验图书是否开启保护
BookAuthInfoVO authBookInfo = bookAuthInfoBiz.getAuthBookInfo(checkIsAuthServeParam.getBookId(), channelId, checkIsAuthServeParam.getAdviserId(), checkIsAuthServeParam.getSceneId());
BookAuthInfoVO authBookInfo = bookAuthInfoBiz.getAuthBookInfo(checkIsAuthServeParam.getBookId(), channelId, checkIsAuthServeParam.getAdviserId(), checkIsAuthServeParam.getSceneId(),null);
if (authBookInfo == null || BookStatusEnum.NO_SET.value.equals(authBookInfo.getBookStatus())) {
return false;
}
......@@ -191,7 +193,7 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
return false;
}
//校验用户是否已经授权过
Boolean isHaveAuth = bookAuthUserBiz.checkIsHaveAuth(bookId, channelId, adviserId, wechatUserId);
Boolean isHaveAuth = bookAuthUserBiz.checkIsHaveAuth(bookId, channelId, adviserId, wechatUserId,null);
if (isHaveAuth) {
return false;
} else {
......@@ -210,6 +212,14 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
bookAuthCodeImportRecord.setCreateUser(adviserId);
bookAuthCodeImportRecord.setFileName(fileVO.getFileName());
bookAuthCodeImportRecord.setFileUrl(fileVO.getFileUrl());
Integer authBookType = fileVO.getAuthBookType();
if(authBookType == null || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)) {
bookAuthCodeImportRecord.setIsPaperBook(1);
bookAuthCodeImportRecord.setIsGroupBook(0);
} else {
bookAuthCodeImportRecord.setIsPaperBook(0);
bookAuthCodeImportRecord.setIsGroupBook(1);
}
bookAuthCodeImportRecordDao.insert(bookAuthCodeImportRecord);
ThreadPoolUtils.EXPORT_THREAD_POOL.execute(() -> {
Integer isFinish = 1;
......@@ -219,6 +229,13 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
List<BookAuthCode> bookAuthCodes = new ArrayList<>();
for (int i = 0, size = data.length; i < size; i++) {
BookAuthCode bookAuthCode = new BookAuthCode();
if(authBookType == null || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)) {
bookAuthCode.setIsPaperBook(1);
bookAuthCode.setIsGroupBook(0);
} else {
bookAuthCode.setIsPaperBook(0);
bookAuthCode.setIsGroupBook(1);
}
bookAuthCode.setBookId(fileVO.getBookId());
bookAuthCode.setChannelId(fileVO.getChannelId());
bookAuthCode.setAdviserId(adviserId);
......@@ -272,17 +289,22 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
@Override
@ParamLog("导入记录")
public PageBeanNew<ImportRecordVO> importCodeRecord(Long bookId, Long channelId, Long adviserId, Integer currentPage, Integer numPerPage) {
public PageBeanNew<ImportRecordVO> importCodeRecord(Long bookId, Long channelId, Long adviserId, Integer authBookType, Integer currentPage, Integer numPerPage) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId", adviserId);
if(null == authBookType || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)){
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
PageParam pageParam = new PageParam(currentPage, numPerPage);
return bookAuthCodeImportRecordDao.listPageNew(pageParam, paramMap, "importCodeRecord");
}
@ParamLog("新增一条授权成功记录")
private void addUserRecord(Long bookId, Long channelId, Long adviserId, Long wechatUserId) {
private void addUserRecord(Long bookId, Long channelId, Long adviserId, Long wechatUserId, Integer authBookType) {
BookAuthUser bookAuthUser = new BookAuthUser();
bookAuthUser.setBookId(bookId);
bookAuthUser.setChannelId(channelId);
......@@ -292,6 +314,13 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
WechatUser wechatUser = readerConsr.getWechatUser(wechatUserId);
bookAuthUser.setProvince(wechatUser == null || StringUtil.isEmpty(wechatUser.getWechatUserProvince()) ? "未知" : wechatUser.getWechatUserProvince());
bookAuthUser.setCity(wechatUser == null || StringUtil.isEmpty(wechatUser.getWechatUserCity()) ? "未知" : wechatUser.getWechatUserCity());
if(authBookType == null || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)) {
bookAuthUser.setIsPaperBook(1);
bookAuthUser.setIsGroupBook(0);
} else {
bookAuthUser.setIsGroupBook(1);
bookAuthUser.setIsPaperBook(0);
}
bookAuthUserBiz.insert(bookAuthUser);
}
......@@ -306,13 +335,18 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
*/
@Override
@ParamLog("获取正版授权码")
public PageBeanNew<BookAuthCodeDTO> getCodeList(Long bookId, Long channelId, Long adviserId, String keyword, Integer state, PageParam pageParam) {
public PageBeanNew<BookAuthCodeDTO> getCodeList(Long bookId, Long channelId, Long adviserId, String keyword, Integer state, Integer authBookType, PageParam pageParam) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("bookId",bookId);
paramMap.put("channelId",channelId);
paramMap.put("adviserId",adviserId);
paramMap.put("keyword",StringUtil.isEmpty(keyword)?null:keyword);
paramMap.put("state",state);
if(null == authBookType || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)){
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
return bookAuthCodeDao.listPageNew(pageParam,paramMap,"getCodeList");
}
......@@ -328,7 +362,8 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
@Override
@ParamLog("导出授权码")
public Map<String, Object> getCodeExcel(Long bookId, String codeIds, Long channelId, Long status, String systemCode, Long partyId) {
public Map<String, Object> getCodeExcel(Long bookId, String codeIds, Long channelId, Long status,
String systemCode, Long partyId, Integer authBookType) {
//获取书的基本信息
BookDto bookDto = bookBiz.getBaseById(bookId);
if (null == bookDto || null == bookDto.getBookId()){
......@@ -342,7 +377,7 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
//不管是全部导出还是导出部分,都使用异步处理
if (status == 0) {
EXECUTOR_SERVICE.execute(() -> {
String filePath = this.exportAllFreeCode(finalTitle, rowsName, bookId, channelId, partyId);
String filePath = this.exportAllFreeCode(finalTitle, rowsName, bookId, channelId, partyId, authBookType);
//发送站内信
SendNotifyDto sendNotifyDto = new SendNotifyDto();
sendNotifyDto.setCreatedTime(new Date());
......@@ -432,7 +467,7 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
* @param partyId
* @return
*/
private String exportAllFreeCode(String title, String[] rowsName, Long bookId, Long channelId, Long partyId) {
private String exportAllFreeCode(String title, String[] rowsName, Long bookId, Long channelId, Long partyId, Integer authBookType) {
SXSSFWorkbook wb = new SXSSFWorkbook(200);
int columnNum = rowsName.length;
int rowIndex = 0;
......@@ -463,6 +498,11 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId", partyId);
if(authBookType == null || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)) {
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
int k = 1;
//分批导出
......
......@@ -23,6 +23,7 @@ import com.pcloud.book.copyright.dto.BookAuthTotalCountDTO;
import com.pcloud.book.copyright.entity.BookAuthCode;
import com.pcloud.book.copyright.entity.BookAuthInfo;
import com.pcloud.book.copyright.entity.BookExportRecord;
import com.pcloud.book.copyright.enums.AuthBookTypeEnum;
import com.pcloud.book.copyright.tools.CopyrightTools;
import com.pcloud.book.copyright.vo.BookAuthCodeUserVO;
import com.pcloud.book.copyright.vo.BookAuthInfoAndServesVO;
......@@ -30,6 +31,7 @@ import com.pcloud.book.copyright.vo.BookAuthInfoVO;
import com.pcloud.book.copyright.vo.BookAuthInfoWechatVO;
import com.pcloud.book.copyright.vo.GetAuthInfoParam;
import com.pcloud.book.copyright.vo.ListHaveAuthBookParam;
import com.pcloud.book.copyright.vo.ListHaveAuthGroupBookParam;
import com.pcloud.book.copyright.vo.ServeVO;
import com.pcloud.book.copyright.vo.SetAuthOpenParam;
import com.pcloud.book.copyright.vo.SetAuthStatusParam;
......@@ -107,10 +109,12 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
@Transactional(rollbackFor = Exception.class)
public void setBookAuthOpen(SetAuthOpenParam setAuthOpenParam, Long adviserId) {
checkIsCanExport(setAuthOpenParam, adviserId);
BookAuthInfoVO bookAuthInfoVO = bookAuthInfoDao.getInfoByBook(setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId);
BookAuthInfoVO bookAuthInfoVO = bookAuthInfoDao.getInfoByBook(setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId,
setAuthOpenParam.getAuthBookType());
BookAuthInfo bookAuthInfo = new BookAuthInfo();
BeanUtils.copyProperties(setAuthOpenParam, bookAuthInfo);
if (bookAuthInfoVO == null) {
this.setAuthBookType(bookAuthInfo, setAuthOpenParam.getAuthBookType());
bookAuthInfo.setAdviserId(adviserId);
try {
bookAuthInfoDao.insert(bookAuthInfo);
......@@ -123,12 +127,15 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
bookAuthInfo.setAdviserId(adviserId);
bookAuthInfoDao.updateBaseInfo(bookAuthInfo);
}
//设置图书服务
bookAuthServeBiz.setBookAuthServes(setAuthOpenParam.getServes(), setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId);
if(setAuthOpenParam.getAuthBookType() == null || AuthBookTypeEnum.PAPER_BOOK.value.equals(setAuthOpenParam.getAuthBookType())) {
//设置图书服务(现代纸书)
bookAuthServeBiz.setBookAuthServes(setAuthOpenParam.getServes(), setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId);
}
//异步生成条形码并导出
asynExport(setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId, setAuthOpenParam.getCodeCount(), setAuthOpenParam.getIsHaveBarCode());
String key = CopyrightConstants.BOOK_AUTH_INFO + bookAuthInfo.getBookId() + "-" + bookAuthInfo.getChannelId() + "-" + adviserId;
BookAuthInfoVO bookAuth = bookAuthInfoDao.getInfoByBook(setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId);
asynExport(setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId, setAuthOpenParam.getCodeCount(), setAuthOpenParam.getIsHaveBarCode(),setAuthOpenParam.getAuthBookType());
Integer authBookType = setAuthOpenParam.getAuthBookType() == null ? 0 : setAuthOpenParam.getAuthBookType();
String key = CopyrightConstants.BOOK_AUTH_INFO + bookAuthInfo.getBookId() + "-" + bookAuthInfo.getChannelId() + "-" + adviserId + "-" + authBookType;
BookAuthInfoVO bookAuth = bookAuthInfoDao.getInfoByBook(setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId, setAuthOpenParam.getAuthBookType());
JedisClusterUtils.setJson(key, bookAuth);
}
......@@ -140,14 +147,14 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
if (codeCount == null || codeCount == 0) {
return;
}
Boolean isHaveExport = isHaveExport(setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId);
Boolean isHaveExport = isHaveExport(setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId);// TODO
if (isHaveExport) {
throw new BookBizException(BookBizException.ERROR, "您有正在导出的授权码,请不要重复点击导出。导出之后系统会有站内信通知,请留意下右上角的消息中心!");
}
}
@ParamLog("异步导出")
private void asynExport(Long bookId, Long channelId, Long adviserId, Integer codeCount, Integer isHaveBarCode) {
private void asynExport(Long bookId, Long channelId, Long adviserId, Integer codeCount, Integer isHaveBarCode, Integer authBookType) {
ThreadPoolUtils.EXPORT_THREAD_POOL.execute(() -> {
String commitTime = DateUtils.formatDate(new Date());
String num = "";
......@@ -156,7 +163,7 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
return;
}
//获取批次号
Integer batchNum = bookAuthCodeBiz.getMaxBatchNum(bookId, channelId, adviserId);
Integer batchNum = bookAuthCodeBiz.getMaxBatchNum(bookId, channelId, adviserId, authBookType);// TODO
num = String.format("%04d", batchNum);
//新增导出记录
insertExportRecord(bookId, channelId, adviserId, num);
......@@ -170,6 +177,13 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
List<BookAuthCode> bookAuthCodes = new ArrayList<>();
for (String uuid : uuids) {
BookAuthCode bookAuthCode = new BookAuthCode();
if(authBookType == null || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)) {
bookAuthCode.setIsPaperBook(1);
bookAuthCode.setIsGroupBook(0);
} else {
bookAuthCode.setIsPaperBook(0);
bookAuthCode.setIsGroupBook(1);
}
bookAuthCode.setAdviserId(adviserId);
bookAuthCode.setChannelId(channelId);
bookAuthCode.setBookId(bookId);
......@@ -201,7 +215,7 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
LOGGER.info("url" + noticeUrl);
} catch (Exception e) {
LOGGER.error("导出条形码失败" + e.getMessage(), e);
updateExportRecord(bookId, channelId, adviserId, num, BookStatusEnum.BookExportStatus.FAIL.value);
updateExportRecord(bookId, channelId, adviserId, num, BookStatusEnum.BookExportStatus.FAIL.value); //TODO
}
});
}
......@@ -348,16 +362,20 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
Long bookId = setAuthStatusParam.getBookId();
Long channelId = setAuthStatusParam.getChannelId();
Integer bookStatus = setAuthStatusParam.getBookStatus();
Integer authBookType = setAuthStatusParam.getAuthBookType();
if (bookId == null || channelId == null || adviserId == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "图书不存在");
}
BookAuthInfoVO bookAuthInfo = bookAuthInfoDao.getInfoByBook(bookId, channelId, adviserId);
BookAuthInfoVO bookAuthInfo = bookAuthInfoDao.getInfoByBook(bookId, channelId, adviserId, authBookType);
if (bookAuthInfo == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "图书未开启版权保护");
}
bookAuthInfo.setBookStatus(bookStatus);
bookAuthInfoDao.updateBookStatus(bookAuthInfo.getId(), bookStatus, adviserId);
String key = CopyrightConstants.BOOK_AUTH_INFO + bookAuthInfo.getBookId() + "-" + bookAuthInfo.getChannelId() + "-" + adviserId;
if(authBookType == null) {
authBookType = 0;
}
String key = CopyrightConstants.BOOK_AUTH_INFO + bookAuthInfo.getBookId() + "-" + bookAuthInfo.getChannelId() + "-" + adviserId + "-" + authBookType;
JedisClusterUtils.setJson(key, bookAuthInfo);
}
......@@ -366,10 +384,12 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
public void setBookLocationDesc(SetLocationDescVO setLocationDesc, Long adviserId) {
BookAuthInfo bookAuthInfo = new BookAuthInfo();
BeanUtils.copyProperties(setLocationDesc, bookAuthInfo);
this.setAuthBookType(bookAuthInfo, setLocationDesc.getAuthBookType());
bookAuthInfo.setAdviserId(adviserId);
bookAuthInfoDao.updateLocationDesc(bookAuthInfo);
String key = CopyrightConstants.BOOK_AUTH_INFO + bookAuthInfo.getBookId() + "-" + bookAuthInfo.getChannelId() + "-" + adviserId;
BookAuthInfoVO bookAuthInfoVO = bookAuthInfoDao.getInfoByBook(bookAuthInfo.getBookId(), bookAuthInfo.getChannelId(), adviserId);
Integer authBookType = setLocationDesc.getAuthBookType() == null ? 0 : setLocationDesc.getAuthBookType();
String key = CopyrightConstants.BOOK_AUTH_INFO + bookAuthInfo.getBookId() + "-" + bookAuthInfo.getChannelId() + "-" + adviserId + "-" + authBookType;
BookAuthInfoVO bookAuthInfoVO = bookAuthInfoDao.getInfoByBook(bookAuthInfo.getBookId(), bookAuthInfo.getChannelId(), adviserId, setLocationDesc.getAuthBookType());
JedisClusterUtils.setJson(key, bookAuthInfoVO);
}
......@@ -382,27 +402,31 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
@Override
@ParamLog("获取正版授权书基本信息(REDIS)")
public BookAuthInfoVO getInfoByBook(Long bookId, Long channelId, Long adviserId) {
String key = CopyrightConstants.BOOK_AUTH_INFO + bookId + "-" + channelId + "-" + adviserId;
public BookAuthInfoVO getInfoByBook(Long bookId, Long channelId, Long adviserId, Integer authBookType) {
if(authBookType == null) {
authBookType = 0;
}
String key = CopyrightConstants.BOOK_AUTH_INFO + bookId + "-" + channelId + "-" + adviserId + "-" + authBookType;
BookAuthInfoVO bookAuthInfoVO = JedisClusterUtils.getJson(key, BookAuthInfoVO.class);
if (bookAuthInfoVO == null) {
bookAuthInfoVO = bookAuthInfoDao.getInfoByBook(bookId, channelId, adviserId);
bookAuthInfoVO = bookAuthInfoDao.getInfoByBook(bookId, channelId, adviserId, authBookType);
JedisClusterUtils.setJson(key, bookAuthInfoVO);
}
return bookAuthInfoVO;
}
@Override
@ParamLog("获取正版授权书基本信息与服务")
public BookAuthInfoAndServesVO getInfoAndServesByBook(Long bookId, Long channelId, Long adviserId) {
BookAuthInfoVO bookAuthInfoVO = getInfoByBook(bookId, channelId, adviserId);
public BookAuthInfoAndServesVO getInfoAndServesByBook(Long bookId, Long channelId, Long adviserId, Integer authBookType) {
BookAuthInfoVO bookAuthInfoVO = getInfoByBook(bookId, channelId, adviserId, authBookType);
BookAuthInfoAndServesVO bookAuthInfoAndServesVO = new BookAuthInfoAndServesVO();
BeanUtils.copyProperties(bookAuthInfoVO, bookAuthInfoAndServesVO);
//获取配置得服务
List<ServeVO> serves = bookAuthServeBiz.listServesByBook(bookId, channelId, adviserId);
removeNotInbook(serves, bookId, channelId, adviserId);
bookAuthInfoAndServesVO.setServes(serves);
if(authBookType == null || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)) {
//获取配置得服务
List<ServeVO> serves = bookAuthServeBiz.listServesByBook(bookId, channelId, adviserId);
removeNotInbook(serves, bookId, channelId, adviserId);
bookAuthInfoAndServesVO.setServes(serves);
}
return bookAuthInfoAndServesVO;
}
......@@ -436,6 +460,10 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
paramMap.put("isFundSupport", listHaveAuthBookParam.getIsFundSupport());
paramMap.put("channelId", listHaveAuthBookParam.getChannelId());
paramMap.put("name", listHaveAuthBookParam.getName() != null && "".equals(listHaveAuthBookParam.getName().trim()) ? null : listHaveAuthBookParam.getName());
if(!StringUtil.isEmpty(listHaveAuthBookParam.getName())){
String [] nameList = listHaveAuthBookParam.getName().trim().split("\\s+");
paramMap.put("nameList", Lists.newArrayList(nameList));
}
paramMap.put("typeCode", listHaveAuthBookParam.getTypeCode() != null && "".equals(listHaveAuthBookParam.getTypeCode().trim()) ? null : listHaveAuthBookParam.getTypeCode());
paramMap.put("templetId", listHaveAuthBookParam.getTempletId());
paramMap.put("secondTempletIds", Optional.ofNullable(listHaveAuthBookParam.getSecondTempletId()).map(Lists::newArrayList).orElse(Lists.newArrayList()));
......@@ -448,8 +476,29 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
}
@Override
public BigDecimal getBookAuthPrice(Long bookId, Long channelId, Long adviserId) {
BookAuthInfoVO authInfoVO = bookAuthInfoDao.getInfoByBook(bookId, channelId, adviserId);
@ParamLog("获取设置过正版授权的社群书")
public PageBeanNew listHaveSetAuthGroupBook(ListHaveAuthGroupBookParam listHaveAuthGroupBookParam, Long adviserId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adviserId", adviserId);
paramMap.put("bookStatus", listHaveAuthGroupBookParam.getBookStatus());
paramMap.put("channelId", listHaveAuthGroupBookParam.getChannelId());
paramMap.put("name", listHaveAuthGroupBookParam.getName() != null && "".equals(listHaveAuthGroupBookParam.getName().trim()) ? null : listHaveAuthGroupBookParam.getName());
paramMap.put("typeCode", listHaveAuthGroupBookParam.getTypeCode() != null && "".equals(listHaveAuthGroupBookParam.getTypeCode().trim()) ? null : listHaveAuthGroupBookParam.getTypeCode());
paramMap.put("templetId", listHaveAuthGroupBookParam.getTempletId());
paramMap.put("secondTempletIds", Optional.ofNullable(listHaveAuthGroupBookParam.getSecondTempletId()).map(Lists::newArrayList).orElse(Lists.newArrayList()));
PageParam pageParam = new PageParam(listHaveAuthGroupBookParam.getCurrentPage(), listHaveAuthGroupBookParam.getNumPerPage());
PageBeanNew pageBean = bookAuthInfoDao.listPageNew(pageParam, paramMap, "listHaveSetAuthGroupBook");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBeanNew(listHaveAuthGroupBookParam.getCurrentPage(), listHaveAuthGroupBookParam.getNumPerPage(), new ArrayList<>());
}
return pageBean;
}
@Override
@ParamLog("获取设置过版权保护书刊的价格")
public BigDecimal getBookAuthPrice(Long bookId, Long channelId, Long adviserId, Integer authBookType) {
BookAuthInfoVO authInfoVO = bookAuthInfoDao.getInfoByBook(bookId, channelId, adviserId, authBookType);
if (authInfoVO != null) {
return authInfoVO.getPrice();
}
......@@ -457,12 +506,13 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
}
@Override
@ParamLog("获取授权图书信息(客户端)")
public BookAuthInfoWechatVO getInfoByBook4Wechat(GetAuthInfoParam getAuthInfoParam, Long channelId) {
BookAuthInfoWechatVO bookAuthInfoWechatVO = new BookAuthInfoWechatVO();
Long bookId =getAuthInfoParam.getBookId();
Long adviserId = getAuthInfoParam.getAdviserId();
Long sceneId = getAuthInfoParam.getSceneId();
BookAuthInfoVO authBookInfo = getAuthBookInfo(bookId, channelId, adviserId, sceneId);
BookAuthInfoVO authBookInfo = getAuthBookInfo(bookId, channelId, adviserId, sceneId, getAuthInfoParam.getAuthBookType());
if (authBookInfo != null) {
BeanUtils.copyProperties(authBookInfo, bookAuthInfoWechatVO);
//获取图书基本信息
......@@ -475,7 +525,7 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
@Override
@ParamLog("获取授权图书信息")
public BookAuthInfoVO getAuthBookInfo(Long bookId, Long channelId, Long adviserId, Long sceneId){
public BookAuthInfoVO getAuthBookInfo(Long bookId, Long channelId, Long adviserId, Long sceneId, Integer authBookType){
if(bookId == null && adviserId == null && sceneId == null){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "图书不存在");
}
......@@ -491,13 +541,12 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
if(bookId == null){
return null;
}
BookAuthInfoVO infoByBook = getInfoByBook(bookId, channelId, adviserId);
return infoByBook;
return getInfoByBook(bookId, channelId, adviserId, authBookType);
}
@Override
public BookAuthInfoCountDTO getBookAuthInfoCount(Long bookId, Long channelId, Long adviserId, String monthDate) {
BookAuthInfoCountDTO bookAuthInfoCountDTO = bookAuthInfoDao.getBookAuthCount(bookId, channelId, adviserId);
BookAuthInfoCountDTO bookAuthInfoCountDTO = bookAuthInfoDao.getBookAuthCount(bookId, channelId, adviserId); //TODO
if (bookAuthInfoCountDTO == null) {
return null;
}
......@@ -509,7 +558,7 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
}
@Override
public BookAuthTotalCountDTO getBookAuthTotalCount(List<Long> adviserIds) {
public BookAuthTotalCountDTO getBookAuthTotalCount(List<Long> adviserIds) { //TODO
//获取出版社下的编辑
PartyIdListVO partyIdList4Test = partyConsr.getPartyIdList4Test();
List<Long> removeAdviserIds = partyIdList4Test == null ? null : partyIdList4Test.getAdviserIds();
......@@ -535,7 +584,7 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
@Override
@ParamLog("是否有正在导出的")
public Boolean isHaveExport(Long bookId, Long channelId, Long adviserId) {
Boolean isCanExport = bookExportRecordBiz.isHaveExport(bookId, channelId, adviserId);
Boolean isCanExport = bookExportRecordBiz.isHaveExport(bookId, channelId, adviserId);//TODO
return isCanExport;
}
......@@ -546,4 +595,14 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
bookAuthTotalCountDTO.setTotalCount(0);
bookAuthTotalCountDTO.setClickBuyCount(0);
}
private void setAuthBookType(BookAuthInfo bookAuthInfo, Integer authBookType) {
if(null == authBookType || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)) {
bookAuthInfo.setIsPaperBook(1);
bookAuthInfo.setIsGroupBook(0);
} else {
bookAuthInfo.setIsPaperBook(0);
bookAuthInfo.setIsGroupBook(1);
}
}
}
......@@ -52,6 +52,13 @@ public class BookAuthOrderBizImpl implements BookAuthOrderBiz {
bookAuthOrder.setMoney(genuine.getMoney());
bookAuthOrder.setAccountSettingId(genuine.getOfficialAccountId());
bookAuthOrder.setOrderNum(genuine.getOrderFormMainId().toString());
if(genuine.getIsGroupBook() != null && genuine.getIsGroupBook() .equals(1)) {
bookAuthOrder.setIsGroupBook(1);
bookAuthOrder.setIsPaperBook(0);
} else {
bookAuthOrder.setIsGroupBook(0);
bookAuthOrder.setIsPaperBook(1);
}
bookAuthOrderDao.insert(bookAuthOrder);
//新增用户授权记录
BookAuthUser bookAuthUser = new BookAuthUser();
......
......@@ -4,9 +4,11 @@ import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.copyright.biz.BookAuthUserBiz;
import com.pcloud.book.copyright.dao.BookAuthUserDao;
import com.pcloud.book.copyright.dao.BookClickBuyRecordDao;
import com.pcloud.book.copyright.dto.CheckUserAuthDTO;
import com.pcloud.book.copyright.dto.DateDTO;
import com.pcloud.book.copyright.entity.BookAuthUser;
import com.pcloud.book.copyright.entity.BookClickBuyRecord;
import com.pcloud.book.copyright.enums.AuthBookTypeEnum;
import com.pcloud.book.copyright.tools.CopyrightTools;
import com.pcloud.book.copyright.vo.BookAuthCodeUserVO;
import com.pcloud.book.copyright.vo.BookClickBuyRecordParam;
......@@ -47,11 +49,11 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
@ParamLog(value = "获取授权用户数量")
@Override
public BookAuthCodeUserVO getAuthUserCount(Long bookId, Long channelId, Long adviserId) {
public BookAuthCodeUserVO getAuthUserCount(Long bookId, Long channelId, Long adviserId, Integer authBookType) {
if (bookId == null || channelId == null || adviserId == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "图书不存在");
}
BookAuthCodeUserVO bookAuthCodeUserVO = bookAuthUserDao.getAuthUserCount(bookId, channelId, adviserId);
BookAuthCodeUserVO bookAuthCodeUserVO = bookAuthUserDao.getAuthUserCount(bookId, channelId, adviserId, authBookType);
if (bookAuthCodeUserVO != null) {
bookAuthCodeUserVO.setCodeUserCount(bookAuthCodeUserVO.getTotalCount() - bookAuthCodeUserVO.getPayUserCount());
} else {
......@@ -75,7 +77,7 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
}
@Override
public List<ThirtyDayCountVO> listThirtyDay(Long bookId, Long channelId, Long adviserId, String province) {
public List<ThirtyDayCountVO> listThirtyDay(Long bookId, Long channelId, Long adviserId, String province, Integer authBookType) {
DateDTO date = CopyrightTools.getDateByType(30L);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("startDate", date.getStartTime());
......@@ -84,6 +86,11 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
paramMap.put("channelId", channelId);
paramMap.put("adviserId", adviserId);
paramMap.put("province", province);
if(authBookType == null || authBookType.equals(AuthBookTypeEnum.PAPER_BOOK.value)) {
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
List<ThirtyDayCountVO> thirtyDayCountVOS = bookAuthUserDao.listThirtyDay(paramMap);
setZoreRecord(thirtyDayCountVOS, date.getStartTime(), date.getEndTime());
return thirtyDayCountVOS;
......@@ -118,13 +125,18 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
}
@Override
public List<SixMonthCountVO> listSixMonth(Long bookId, Long channelId, Long adviserId, String province) {
public List<SixMonthCountVO> listSixMonth(Long bookId, Long channelId, Long adviserId, String province, Integer authBookType) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId", adviserId);
paramMap.put("province", province);
paramMap.put("months", CopyrightTools.getLast6Months());
if(authBookType == null || authBookType.equals(AuthBookTypeEnum.PAPER_BOOK.value)) {
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
List<SixMonthCountVO> sixMonthCountVOS = bookAuthUserDao.listSixMonth(paramMap);
setZoreRecord(sixMonthCountVOS);
return sixMonthCountVOS;
......@@ -139,8 +151,8 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
@Override
@ParamLog("校验用户是否已经授权")
public Boolean checkIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId) {
return bookAuthUserDao.getIsHaveAuth(bookId, channelId, adviserId, wechatUserId);
public Boolean checkIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId, Integer authBookType) {
return bookAuthUserDao.getIsHaveAuth(bookId, channelId, adviserId, wechatUserId, authBookType);
}
@Override
......@@ -194,6 +206,25 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
return top10ByBook;
}
@Override
@ParamLog("校验用户是否授权(进群)")
public Boolean checkUserIsHaveAuth(CheckUserAuthDTO checkUserAuthDTO) {
Long bookId = checkUserAuthDTO.getBookId();
Long channelId = checkUserAuthDTO.getChannelId();
Long adviserId = checkUserAuthDTO.getAdviserId();
List<Long> wechatUserIds = checkUserAuthDTO.getWechatUserIds();
if(null == bookId || null == channelId || null == adviserId || ListUtils.isEmpty(wechatUserIds)) {
LOGGER.error("参数缺失!");
return false;
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId", adviserId);
paramMap.put("wechatUserIds", wechatUserIds);
return bookAuthUserDao.checkUserIsHaveAuth(paramMap);
}
/**
* 设置最近6月为空得书
*/
......
......@@ -17,17 +17,17 @@ public interface BookAuthCodeDao extends BaseDao<BookAuthCode> {
/**
* 获取最大批次号
*/
Integer getMaxBatchNum(Long bookId, Long channelId, Long adviserId);
Integer getMaxBatchNum(Long bookId, Long channelId, Long adviserId, Integer authBookType);
/**
* 更新使用次数
*/
Integer updateUseCount(Long bookId, Long channelId, Long adviserId, String code, Integer codeUseCount);
Integer updateUseCount(Long bookId, Long channelId, Long adviserId, String code, Integer codeUseCount, Integer authBookType);
/**
* 获取码数量
*/
Boolean getIsHaveCode(Long bookId, Long channelId, Long adviserId, String code);
Boolean getIsHaveCode(Long bookId, Long channelId, Long adviserId, String code, Integer authBookType);
/**
* 批量删除正版授权码
......
......@@ -27,7 +27,7 @@ public interface BookAuthInfoDao extends BaseDao<BookAuthInfo> {
/**
* 获取图书正版授权信息
*/
BookAuthInfoVO getInfoByBook(Long bookId, Long channelId, Long adviserId);
BookAuthInfoVO getInfoByBook(Long bookId, Long channelId, Long adviserId, Integer authBookType);
/**
* 更新图书版权状态
......
......@@ -18,7 +18,7 @@ public interface BookAuthUserDao extends BaseDao<BookAuthUser> {
/**
* 获取授权用户总数
*/
BookAuthCodeUserVO getAuthUserCount(Long bookId, Long channelId, Long adviserId);
BookAuthCodeUserVO getAuthUserCount(Long bookId, Long channelId, Long adviserId, Integer authBookType);
/**
* 30天趋势图
......@@ -34,7 +34,7 @@ public interface BookAuthUserDao extends BaseDao<BookAuthUser> {
/**
* 校验是否已经授权
*/
Boolean getIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId);
Boolean getIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId, Integer authBookType);
/**
* 根据月份获取授权用户信息
......@@ -50,4 +50,9 @@ public interface BookAuthUserDao extends BaseDao<BookAuthUser> {
* 获取top10的图书
*/
List<ProvinceTop10VO> listTop10ByBook(Map<String, Object> paramMap);
/**
* 校验用户是否授权
*/
Boolean checkUserIsHaveAuth(Map<String, Object> paramMap);
}
......@@ -19,32 +19,47 @@ import java.util.Map;
public class BookAuthCodeDaoImpl extends BaseDaoImpl<BookAuthCode> implements BookAuthCodeDao {
@Override
public Integer getMaxBatchNum(Long bookId, Long channelId, Long adviserId) {
public Integer getMaxBatchNum(Long bookId, Long channelId, Long adviserId, Integer authBookType) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("bookId",bookId);
paramMap.put("channelId",channelId);
paramMap.put("adviserId",adviserId);
if(authBookType == null || authBookType.equals(0)) {
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
return this.getSqlSession().selectOne(this.getStatement("getMaxBatchNum"), paramMap);
}
@Override
public Integer updateUseCount(Long bookId, Long channelId, Long adviserId, String code, Integer codeUseCount) {
public Integer updateUseCount(Long bookId, Long channelId, Long adviserId, String code, Integer codeUseCount, Integer authBookType) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("bookId",bookId);
paramMap.put("channelId",channelId);
paramMap.put("adviserId",adviserId);
paramMap.put("codeUseCount",codeUseCount);
paramMap.put("code",code);
if(authBookType == null || authBookType.equals(0)) {
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
return this.getSqlSession().update(this.getStatement("updateUseCount"), paramMap);
}
@Override
public Boolean getIsHaveCode(Long bookId, Long channelId, Long adviserId, String code) {
public Boolean getIsHaveCode(Long bookId, Long channelId, Long adviserId, String code, Integer authBookType) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("bookId",bookId);
paramMap.put("channelId",channelId);
paramMap.put("adviserId",adviserId);
paramMap.put("code",code);
if(authBookType == null || authBookType.equals(0)) {
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
return this.getSqlSession().selectOne(this.getStatement("getIsHaveCode"), paramMap);
}
......
......@@ -31,11 +31,18 @@ public class BookAuthInfoDaoImpl extends BaseDaoImpl<BookAuthInfo> implements Bo
}
@Override
public BookAuthInfoVO getInfoByBook(Long bookId, Long channelId, Long adviserId) {
public BookAuthInfoVO getInfoByBook(Long bookId, Long channelId, Long adviserId, Integer authBookType) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId", adviserId);
if(authBookType == null || authBookType.equals(0)) {
paramMap.put("isPaperBook", 1);
paramMap.put("isGroupBook", 0);
} else {
paramMap.put("isPaperBook", 0);
paramMap.put("isGroupBook", 1);
}
return this.getSqlSession().selectOne(this.getStatement("getInfoByBook"), paramMap);
}
......
......@@ -25,11 +25,16 @@ public class BookAuthUserDaoImpl extends BaseDaoImpl<BookAuthUser> implements Bo
* 根据类型获取授权用户总数
*/
@Override
public BookAuthCodeUserVO getAuthUserCount(Long bookId, Long channelId, Long adviserId) {
public BookAuthCodeUserVO getAuthUserCount(Long bookId, Long channelId, Long adviserId, Integer authBookType) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId",adviserId);
if(authBookType == null || authBookType.equals(0)) {
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
return this.getSqlSession().selectOne(this.getStatement("getAuthUserCount"), paramMap);
}
......@@ -44,12 +49,17 @@ public class BookAuthUserDaoImpl extends BaseDaoImpl<BookAuthUser> implements Bo
}
@Override
public Boolean getIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId) {
public Boolean getIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId, Integer authBookType) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId",adviserId);
paramMap.put("wechatUserId",wechatUserId);
if(authBookType == null || authBookType.equals(0)) {
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
return this.getSqlSession().selectOne(this.getStatement("getIsHaveAuth"), paramMap);
}
......@@ -78,4 +88,9 @@ public class BookAuthUserDaoImpl extends BaseDaoImpl<BookAuthUser> implements Bo
return this.getSqlSession().selectList(this.getStatement("listTop10ByBook"), paramMap);
}
@Override
public Boolean checkUserIsHaveAuth(Map<String, Object> paramMap) {
return this.getSqlSession().selectOne(this.getStatement("checkUserIsHaveAuth"), paramMap);
}
}
......@@ -51,6 +51,12 @@ public class BookAuthCode extends BaseEntity {
@ApiModelProperty("最后修改时间")
private Date lastModifiedDate;
@ApiModelProperty("是否是现代纸书")
private Integer isPaperBook;
@ApiModelProperty("是否是社群书")
private Integer isGroupBook;
public String getFullCode() {
return fullCode;
}
......@@ -157,6 +163,22 @@ public class BookAuthCode extends BaseEntity {
this.lastModifiedDate = lastModifiedDate;
}
public Integer getIsPaperBook() {
return isPaperBook;
}
public void setIsPaperBook(Integer isPaperBook) {
this.isPaperBook = isPaperBook;
}
public Integer getIsGroupBook() {
return isGroupBook;
}
public void setIsGroupBook(Integer isGroupBook) {
this.isGroupBook = isGroupBook;
}
@Override
public String toString() {
return "BookAuthCode{" +
......@@ -173,6 +195,8 @@ public class BookAuthCode extends BaseEntity {
", createdDate=" + createdDate +
", lastModifiedUser=" + lastModifiedUser +
", lastModifiedDate=" + lastModifiedDate +
", isPaperBook=" + isPaperBook +
", isGroupBook=" + isGroupBook +
'}';
}
}
......@@ -4,6 +4,8 @@ import com.pcloud.common.entity.BaseEntity;
import org.springframework.stereotype.Component;
import io.swagger.annotations.ApiModelProperty;
/**
* @author lily
* @date 2019/5/21 17:39
......@@ -24,6 +26,12 @@ public class BookAuthCodeImportRecord extends BaseEntity {
private Long createUser;
@ApiModelProperty("是否是现代纸书")
private Integer isPaperBook;
@ApiModelProperty("是否是社群书")
private Integer isGroupBook;
public Long getBookId() {
return bookId;
}
......@@ -82,6 +90,22 @@ public class BookAuthCodeImportRecord extends BaseEntity {
this.id = id;
}
public Integer getIsPaperBook() {
return isPaperBook;
}
public void setIsPaperBook(Integer isPaperBook) {
this.isPaperBook = isPaperBook;
}
public Integer getIsGroupBook() {
return isGroupBook;
}
public void setIsGroupBook(Integer isGroupBook) {
this.isGroupBook = isGroupBook;
}
@Override
public String toString() {
return "BookAuthCodeImportRecord{" +
......@@ -92,6 +116,8 @@ public class BookAuthCodeImportRecord extends BaseEntity {
", fileName='" + fileName + '\'' +
", fileUrl='" + fileUrl + '\'' +
", createUser=" + createUser +
", isPaperBook=" + isPaperBook +
", isGroupBook=" + isGroupBook +
'}';
}
}
......@@ -60,6 +60,13 @@ public class BookAuthInfo extends BaseEntity {
@ApiModelProperty("最近关闭时间")
private Date closeTime;
@ApiModelProperty("是否是现代纸书")
private Integer isPaperBook;
@ApiModelProperty("是否是社群书")
private Integer isGroupBook;
@Override
public Long getId() {
return id;
......@@ -190,6 +197,22 @@ public class BookAuthInfo extends BaseEntity {
this.closeTime = closeTime;
}
public Integer getIsPaperBook() {
return isPaperBook;
}
public void setIsPaperBook(Integer isPaperBook) {
this.isPaperBook = isPaperBook;
}
public Integer getIsGroupBook() {
return isGroupBook;
}
public void setIsGroupBook(Integer isGroupBook) {
this.isGroupBook = isGroupBook;
}
@Override
public String toString() {
return "BookAuthInfo{" +
......@@ -209,6 +232,8 @@ public class BookAuthInfo extends BaseEntity {
", lastModifiedDate=" + lastModifiedDate +
", openTime=" + openTime +
", closeTime=" + closeTime +
", isPaperBook=" + isPaperBook +
", isGroupBook=" + isGroupBook +
'}';
}
}
......@@ -45,6 +45,12 @@ public class BookAuthOrder extends BaseEntity {
@ApiModelProperty("创建时间")
private Date createdDate;
@ApiModelProperty("是否是现代纸书")
private Integer isPaperBook;
@ApiModelProperty("是否是社群书")
private Integer isGroupBook;
@Override
public Long getId() {
return id;
......@@ -135,6 +141,22 @@ public class BookAuthOrder extends BaseEntity {
this.paymentSource = paymentSource;
}
public Integer getIsPaperBook() {
return isPaperBook;
}
public void setIsPaperBook(Integer isPaperBook) {
this.isPaperBook = isPaperBook;
}
public Integer getIsGroupBook() {
return isGroupBook;
}
public void setIsGroupBook(Integer isGroupBook) {
this.isGroupBook = isGroupBook;
}
@Override
public String toString() {
return "BookAuthOrder{" +
......@@ -149,6 +171,8 @@ public class BookAuthOrder extends BaseEntity {
", paymentSource=" + paymentSource +
", createdUser=" + createdUser +
", createdDate=" + createdDate +
", isPaperBook=" + isPaperBook +
", isGroupBook=" + isGroupBook +
'}';
}
}
......@@ -54,6 +54,12 @@ public class BookAuthUser extends BaseEntity {
@ApiModelProperty("最后修改时间")
private Date lastModifiedDate;
@ApiModelProperty("是否是现代纸书")
private Integer isPaperBook;
@ApiModelProperty("是否是社群书")
private Integer isGroupBook;
@Override
public Long getId() {
return id;
......@@ -168,6 +174,22 @@ public class BookAuthUser extends BaseEntity {
this.city = city;
}
public Integer getIsPaperBook() {
return isPaperBook;
}
public void setIsPaperBook(Integer isPaperBook) {
this.isPaperBook = isPaperBook;
}
public Integer getIsGroupBook() {
return isGroupBook;
}
public void setIsGroupBook(Integer isGroupBook) {
this.isGroupBook = isGroupBook;
}
@Override
public String toString() {
return "BookAuthUser{" +
......@@ -185,6 +207,8 @@ public class BookAuthUser extends BaseEntity {
", createdDate=" + createdDate +
", lastModifiedUser=" + lastModifiedUser +
", lastModifiedDate=" + lastModifiedDate +
", isPaperBook=" + isPaperBook +
", isGroupBook=" + isGroupBook +
'}';
}
}
package com.pcloud.book.copyright.enums;
public enum AuthBookTypeEnum {
/**
* 现代纸书
*/
PAPER_BOOK(0),
/**
* 社群书
*/
GROUP_BOOK(1);
public final Integer value;
AuthBookTypeEnum(Integer value) {
this.value = value;
}
}
......@@ -49,7 +49,9 @@ public interface BookAuthCodeFacade {
@ApiOperation(value = "授权码导入记录", httpMethod = "GET")
@RequestMapping(value = "importCodeRecord", method = RequestMethod.GET)
ResponseDto<PageBeanNew<ImportRecordVO>> importCodeRecord(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId, @RequestParam("currentPage") Integer currenPage, @RequestParam("numPerPage") Integer numPerPage)
ResponseDto<PageBeanNew<ImportRecordVO>> importCodeRecord(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId,
@RequestParam("channelId") Long channelId, @RequestParam(value = "authBookType", required = false) Integer authBookType,
@RequestParam("currentPage") Integer currenPage, @RequestParam("numPerPage") Integer numPerPage)
throws PermissionException, BizException;
@ApiOperation(value = "获取授权码列表", httpMethod = "GET")
......@@ -59,6 +61,7 @@ public interface BookAuthCodeFacade {
@RequestParam("channelId") Long channelId,
@RequestParam(required = false,value = "keyword")String keyword,
@RequestParam(required = false,value = "state")Integer state,
@RequestParam(required = false,value = "authBookType")Integer authBookType,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage)
throws PermissionException, BizException;
......@@ -95,6 +98,7 @@ public interface BookAuthCodeFacade {
@RequestParam(required = false, value ="bookId") Long bookId,
@RequestParam(required = false, value ="codeIds") String codeIds,
@RequestParam(required = false, value ="channelId") Long channelId,
@RequestParam(required = false, value ="status") Long status )
@RequestParam(required = false, value ="status") Long status,
@RequestParam(required = false,value = "authBookType")Integer authBookType)
throws PermissionException, JsonParseException,BizException;
}
......@@ -5,6 +5,7 @@ import com.pcloud.book.copyright.vo.BookAuthInfoVO;
import com.pcloud.book.copyright.vo.BookAuthInfoWechatVO;
import com.pcloud.book.copyright.vo.GetAuthInfoParam;
import com.pcloud.book.copyright.vo.ListHaveAuthBookParam;
import com.pcloud.book.copyright.vo.ListHaveAuthGroupBookParam;
import com.pcloud.book.copyright.vo.SetAuthStatusParam;
import com.pcloud.book.copyright.vo.SetAuthOpenParam;
import com.pcloud.book.copyright.vo.SetLocationDescVO;
......@@ -50,7 +51,8 @@ public interface BookAuthInfoFacade {
@ApiOperation(value = "获取正版授权信息", httpMethod = "GET")
@RequestMapping(value = "getInfoByBook", method = RequestMethod.GET)
ResponseDto<BookAuthInfoVO> getInfoByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId)
ResponseDto<BookAuthInfoVO> getInfoByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId,
@RequestParam(value = "authBookType", required = false) Integer authBookType)
throws PermissionException, BizException;
@ApiOperation(value = "获取正版授权信息(客户端)", httpMethod = "POST")
......@@ -60,7 +62,8 @@ public interface BookAuthInfoFacade {
@ApiOperation(value = "获取正版授权信息", httpMethod = "GET")
@RequestMapping(value = "getInfoAndServesByBook", method = RequestMethod.GET)
ResponseDto<BookAuthInfoAndServesVO> getInfoAndServesByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId)
ResponseDto<BookAuthInfoAndServesVO> getInfoAndServesByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId,
@RequestParam("channelId") Long channelId, @RequestParam(value = "authBookType", required = false) Integer authBookType)
throws PermissionException, BizException;
......@@ -69,9 +72,15 @@ public interface BookAuthInfoFacade {
ResponseDto<PageBeanNew> listHaveSetAuthBook(@RequestHeader("token") String token, @RequestBody ListHaveAuthBookParam listHaveAuthBookParam)
throws PermissionException, BizException;
@ApiOperation(value = "获取设置过的版权保护社群书信息", httpMethod = "POST")
@RequestMapping(value = "listHaveSetAuthGroupBook", method = RequestMethod.POST)
ResponseDto<PageBeanNew> listHaveSetAuthGroupBook(@RequestHeader("token") String token, @RequestBody ListHaveAuthGroupBookParam listHaveAuthGroupBookParam)
throws PermissionException, BizException;
@ApiOperation(value = "是否有可以导出的", httpMethod = "GET")
@RequestMapping(value = "isHaveExport", method = RequestMethod.GET)
ResponseDto<Boolean> isHaveExport(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId)
ResponseDto<Boolean> isHaveExport(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId,
@RequestParam("channelId") Long channelId)
throws PermissionException, BizException;
}
......@@ -2,14 +2,14 @@ package com.pcloud.book.copyright.facade;
import com.pcloud.book.copyright.vo.BookAuthCodeUserVO;
import com.pcloud.book.copyright.vo.BookClickBuyRecordParam;
import com.pcloud.book.copyright.vo.CheckUserParam;
import com.pcloud.book.copyright.vo.ProvinceTop10VO;
import com.pcloud.book.copyright.vo.SixMonthCountVO;
import com.pcloud.book.copyright.vo.ThirtyDayCountVO;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -20,6 +20,9 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* @author lily
* @date 2018/12/3 10:59
......@@ -29,23 +32,28 @@ public interface BookAuthUserFacade {
@ApiOperation(value = "获取正版授权总人数", httpMethod = "GET")
@RequestMapping(value = "getAuthUserCount", method = RequestMethod.GET)
ResponseDto<BookAuthCodeUserVO> getAuthUserCount(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId)
ResponseDto<BookAuthCodeUserVO> getAuthUserCount(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId,
@RequestParam("channelId") Long channelId, @RequestParam(value = "authBookType", required = false) Integer authBookType)
throws PermissionException, BizException;
@ApiOperation(value = "获取30天趋势图", httpMethod = "GET")
@RequestMapping(value = "listThirtyDay", method = RequestMethod.GET)
ResponseDto<List<ThirtyDayCountVO>> listThirtyDay(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId, @RequestParam(value = "province", required = false) String province)
ResponseDto<List<ThirtyDayCountVO>> listThirtyDay(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId,
@RequestParam("channelId") Long channelId, @RequestParam(value = "province", required = false) String province,
@RequestParam(value = "authBookType", required = false) Integer authBookType)
throws PermissionException, BizException;
@ApiOperation(value = "6个月趋势图", httpMethod = "GET")
@RequestMapping(value = "listSixMonth", method = RequestMethod.GET)
ResponseDto<List<SixMonthCountVO>> listSixMonth(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId, @RequestParam(value = "province", required = false) String province)
ResponseDto<List<SixMonthCountVO>> listSixMonth(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId,
@RequestParam(value = "province", required = false) String province, @RequestParam(value = "authBookType", required = false) Integer authBookType)
throws PermissionException, BizException;
@ApiOperation(value = "省份排名前10(6个月/30天)", httpMethod = "GET")
@RequestMapping(value = "listTop10ByBook", method = RequestMethod.GET)
ResponseDto<List<ProvinceTop10VO>> listTop10ByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId, @RequestParam(value = "type", required = false) Integer type)
ResponseDto<List<ProvinceTop10VO>> listTop10ByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId,
@RequestParam(value = "type", required = false) Integer type)
throws PermissionException, BizException;
......@@ -53,4 +61,9 @@ public interface BookAuthUserFacade {
@ApiOperation("新增点击购买链接记录")
ResponseDto<?> insertClickBuyRecord(@CookieValue("userInfo") String userInfo, @RequestBody BookClickBuyRecordParam bookClickBuyRecordParam)
throws BizException;
@PostMapping("checkIsHaveAuth")
@ApiOperation("校验用户是否授权过")
ResponseDto<?> checkIsHaveAuth(@CookieValue("userInfo") String userInfo, @RequestBody CheckUserParam checkUserParam)
throws BizException;
}
......@@ -81,9 +81,11 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade {
@Override
@GetMapping("importCodeRecord")
public ResponseDto<PageBeanNew<ImportRecordVO>> importCodeRecord(@RequestHeader("token")String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId, @RequestParam("currentPage") Integer currenPage, @RequestParam("numPerPage") Integer numPerPage) throws PermissionException, BizException {
public ResponseDto<PageBeanNew<ImportRecordVO>> importCodeRecord(@RequestHeader("token")String token, @RequestParam("bookId") Long bookId,
@RequestParam("channelId") Long channelId, @RequestParam(value = "authBookType", required = false) Integer authBookType,
@RequestParam("currentPage") Integer currenPage, @RequestParam("numPerPage") Integer numPerPage) throws PermissionException, BizException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
PageBeanNew<ImportRecordVO> pageBean = bookAuthCodeBiz.importCodeRecord(bookId, channelId, adviserId, currenPage, numPerPage);
PageBeanNew<ImportRecordVO> pageBean = bookAuthCodeBiz.importCodeRecord(bookId, channelId, adviserId, authBookType, currenPage, numPerPage);
return new ResponseDto<>(pageBean);
}
......@@ -94,6 +96,7 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade {
@RequestParam(required = false,value = "channelId")Long channelId,
@RequestParam(required = false,value = "keyword")String keyword,
@RequestParam(required = false,value = "state")Integer state,
@RequestParam(required = false,value = "authBookType")Integer authBookType,
@RequestParam(required = false,value = "currentPage")Integer currentPage,
@RequestParam(required = false,value = "numPerPage")Integer numPerPage) throws PermissionException, BizException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
......@@ -104,7 +107,7 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数有误!");
}
PageParam pageParam = new PageParam(currentPage,numPerPage);
return new ResponseDto<>(bookAuthCodeBiz.getCodeList(bookId,channelId,adviserId,keyword,state,pageParam));
return new ResponseDto<>(bookAuthCodeBiz.getCodeList(bookId,channelId,adviserId,keyword,state, authBookType, pageParam));
}
/**
......@@ -131,7 +134,8 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade {
@RequestParam(required = false, value ="bookId") Long bookId,
@RequestParam(required = false, value ="codeIds") String codeIds,
@RequestParam(required = false, value ="channelId") Long channelId,
@RequestParam(required = false, value ="status") Long status )
@RequestParam(required = false, value ="status") Long status,
@RequestParam(required = false,value = "authBookType")Integer authBookType)
throws PermissionException, JsonParseException, BizException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
......@@ -139,7 +143,7 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade {
if (null == status || null == bookId || null == channelId) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数错误");
}
Map<String, Object> map = bookAuthCodeBiz.getCodeExcel(bookId,codeIds, channelId, status, systemCode, partyId);
Map<String, Object> map = bookAuthCodeBiz.getCodeExcel(bookId,codeIds, channelId, status, systemCode, partyId, authBookType);
return new ResponseDto<>(map);
}
}
......@@ -7,6 +7,7 @@ import com.pcloud.book.copyright.vo.BookAuthInfoVO;
import com.pcloud.book.copyright.vo.BookAuthInfoWechatVO;
import com.pcloud.book.copyright.vo.GetAuthInfoParam;
import com.pcloud.book.copyright.vo.ListHaveAuthBookParam;
import com.pcloud.book.copyright.vo.ListHaveAuthGroupBookParam;
import com.pcloud.book.copyright.vo.SetAuthStatusParam;
import com.pcloud.book.copyright.vo.SetAuthOpenParam;
import com.pcloud.book.copyright.vo.SetLocationDescVO;
......@@ -23,6 +24,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
......@@ -71,9 +73,10 @@ public class BookAuthInfoFacadeImpl implements BookAuthInfoFacade {
@Override
@GetMapping("getInfoByBook")
public ResponseDto<BookAuthInfoVO> getInfoByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId) throws PermissionException, BizException {
public ResponseDto<BookAuthInfoVO> getInfoByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId,
@RequestParam(value = "authBookType", required = false) Integer authBookType) throws PermissionException, BizException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
BookAuthInfoVO bookAuthInfoVO = bookAuthInfoBiz.getInfoByBook(bookId, channelId, adviserId);
BookAuthInfoVO bookAuthInfoVO = bookAuthInfoBiz.getInfoByBook(bookId, channelId, adviserId, authBookType);
return new ResponseDto<>(bookAuthInfoVO);
}
......@@ -87,9 +90,10 @@ public class BookAuthInfoFacadeImpl implements BookAuthInfoFacade {
@Override
@GetMapping("getInfoAndServesByBook")
public ResponseDto<BookAuthInfoAndServesVO> getInfoAndServesByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId) throws PermissionException, BizException {
public ResponseDto<BookAuthInfoAndServesVO> getInfoAndServesByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId,
@RequestParam("channelId") Long channelId, @RequestParam(value = "authBookType", required = false) Integer authBookType) throws PermissionException, BizException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
BookAuthInfoAndServesVO bookAuthInfoAndServesVO = bookAuthInfoBiz.getInfoAndServesByBook(bookId, channelId, adviserId);
BookAuthInfoAndServesVO bookAuthInfoAndServesVO = bookAuthInfoBiz.getInfoAndServesByBook(bookId, channelId, adviserId, authBookType);
return new ResponseDto<>(bookAuthInfoAndServesVO);
}
......@@ -103,6 +107,15 @@ public class BookAuthInfoFacadeImpl implements BookAuthInfoFacade {
}
@Override
@RequestMapping(value = "listHaveSetAuthGroupBook", method = RequestMethod.POST)
public ResponseDto<PageBeanNew> listHaveSetAuthGroupBook(@RequestHeader("token") String token, @RequestBody ListHaveAuthGroupBookParam listHaveAuthGroupBookParam)
throws PermissionException, BizException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
PageBeanNew pageBeanNew = bookAuthInfoBiz.listHaveSetAuthGroupBook(listHaveAuthGroupBookParam, adviserId) ;
return new ResponseDto<>(pageBeanNew);
}
@Override
@GetMapping("isHaveExport")
public ResponseDto<Boolean> isHaveExport(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId)
throws PermissionException, BizException {
......
......@@ -4,6 +4,7 @@ import com.pcloud.book.copyright.biz.BookAuthUserBiz;
import com.pcloud.book.copyright.facade.BookAuthUserFacade;
import com.pcloud.book.copyright.vo.BookAuthCodeUserVO;
import com.pcloud.book.copyright.vo.BookClickBuyRecordParam;
import com.pcloud.book.copyright.vo.CheckUserParam;
import com.pcloud.book.copyright.vo.ProvinceTop10VO;
import com.pcloud.book.copyright.vo.SixMonthCountVO;
import com.pcloud.book.copyright.vo.ThirtyDayCountVO;
......@@ -38,28 +39,30 @@ public class BookAuthUserFacadeImpl implements BookAuthUserFacade {
@Override
@ApiOperation(value = "获取正版授权总人数", httpMethod = "GET")
@RequestMapping(value = "getAuthUserCount", method = RequestMethod.GET)
public ResponseDto<BookAuthCodeUserVO> getAuthUserCount(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId) throws PermissionException, BizException {
public ResponseDto<BookAuthCodeUserVO> getAuthUserCount(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId,
@RequestParam("channelId") Long channelId, @RequestParam(value = "authBookType", required = false) Integer authBookType) throws PermissionException, BizException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
BookAuthCodeUserVO bookAuthCodeUserVO = bookAuthUserBiz.getAuthUserCount(bookId, channelId, adviserId);
BookAuthCodeUserVO bookAuthCodeUserVO = bookAuthUserBiz.getAuthUserCount(bookId, channelId, adviserId, authBookType);
return new ResponseDto<>(bookAuthCodeUserVO);
}
@Override
@RequestMapping(value = "listThirtyDay", method = RequestMethod.GET)
public ResponseDto<List<ThirtyDayCountVO>> listThirtyDay(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId
, @RequestParam(value = "province", required = false) String province) throws PermissionException, BizException {
, @RequestParam(value = "province", required = false) String province, @RequestParam(value = "authBookType", required = false) Integer authBookType)
throws PermissionException, BizException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
List<ThirtyDayCountVO> thirtyDayCountVOS = bookAuthUserBiz.listThirtyDay(bookId, channelId, adviserId, province);
List<ThirtyDayCountVO> thirtyDayCountVOS = bookAuthUserBiz.listThirtyDay(bookId, channelId, adviserId, province, authBookType);
return new ResponseDto<>(thirtyDayCountVOS);
}
@Override
@RequestMapping(value = "listSixMonth", method = RequestMethod.GET)
public ResponseDto<List<SixMonthCountVO>> listSixMonth(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId
, @RequestParam(value = "province", required = false) String province)
, @RequestParam(value = "province", required = false) String province, @RequestParam(value = "authBookType", required = false) Integer authBookType)
throws PermissionException, BizException{
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
List<SixMonthCountVO> sixMonthCountVOS = bookAuthUserBiz.listSixMonth(bookId, channelId, adviserId, province);
List<SixMonthCountVO> sixMonthCountVOS = bookAuthUserBiz.listSixMonth(bookId, channelId, adviserId, province, authBookType);
return new ResponseDto<>(sixMonthCountVOS);
}
......@@ -79,4 +82,18 @@ public class BookAuthUserFacadeImpl implements BookAuthUserFacade {
bookAuthUserBiz.insertClickBuyRecord(bookClickBuyRecordParam, channelId, wechatUserId);
return new ResponseDto<>();
}
@PostMapping("checkIsHaveAuth")
public ResponseDto<?> checkIsHaveAuth(@CookieValue("userInfo") String userInfo, @RequestBody CheckUserParam checkUserParam)
throws BizException{
Long bookId = checkUserParam.getBookId();
Long adviserId = checkUserParam.getAdviserId();
Long channelId = checkUserParam.getChannelId();
if(null == channelId) {
channelId = Cookie.getId(userInfo, Cookie._CHANNEL_ID);
}
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
Boolean result = bookAuthUserBiz.checkIsHaveAuth(bookId, channelId, adviserId, wechatUserId, 1);
return new ResponseDto<>(result);
}
}
package com.pcloud.book.copyright.service.impl;
import com.pcloud.book.copyright.biz.BookAuthInfoBiz;
import com.pcloud.book.copyright.biz.BookAuthUserBiz;
import com.pcloud.book.copyright.dto.BookAuthInfoCountDTO;
import com.pcloud.book.copyright.dto.BookAuthTotalCountDTO;
import com.pcloud.book.copyright.dto.CheckUserAuthDTO;
import com.pcloud.book.copyright.service.BookAuthInfoService;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
......@@ -27,17 +29,20 @@ import java.util.List;
public class BookAuthInfoServiceImpl implements BookAuthInfoService {
@Autowired
private BookAuthInfoBiz bookAuthInfoBiz;
@Autowired
private BookAuthUserBiz bookAuthUserBiz;
@Override
@RequestMapping(value = "/getBookAuthPrice", method = RequestMethod.GET)
public ResponseEntity<ResponseDto<BigDecimal>> getBookAuthPrice(@RequestParam("bookId") Long bookId,
@RequestParam("channelId")Long channelId, @RequestParam("adviserId")Long adviserId) throws BizException {
return ResponseHandleUtil.toResponse(bookAuthInfoBiz.getBookAuthPrice(bookId, channelId, adviserId));
return ResponseHandleUtil.toResponse(bookAuthInfoBiz.getBookAuthPrice(bookId, channelId, adviserId, null));
}
@Override
@RequestMapping(value = "/getBookAuthInfoCount", method = RequestMethod.GET)
public ResponseEntity<ResponseDto<BookAuthInfoCountDTO>> getBookAuthInfoCount(@RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId, @RequestParam("adviserId") Long adviserId, @RequestParam(value = "monthDate", required = false) String monthDate) throws BizException {
public ResponseEntity<ResponseDto<BookAuthInfoCountDTO>> getBookAuthInfoCount(@RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId,
@RequestParam("adviserId") Long adviserId, @RequestParam(value = "monthDate", required = false) String monthDate) throws BizException {
BookAuthInfoCountDTO bookAuthInfoCountDTO = bookAuthInfoBiz.getBookAuthInfoCount(bookId, channelId, adviserId, monthDate);
return ResponseHandleUtil.toResponse(bookAuthInfoCountDTO);
}
......@@ -55,4 +60,17 @@ public class BookAuthInfoServiceImpl implements BookAuthInfoService {
BookAuthTotalCountDTO bookAuthTotalCountDTO = bookAuthInfoBiz.getBookAuthTotalCount(adviserIds);
return ResponseHandleUtil.toResponse(bookAuthTotalCountDTO);
}
@Override
@RequestMapping(value = "/checkUserIsHaveAuth", method = RequestMethod.POST)
public ResponseEntity<ResponseDto<Boolean>> checkUserIsHaveAuth(@RequestBody CheckUserAuthDTO checkUserAuthDTO) throws BizException {
return ResponseHandleUtil.toResponse(bookAuthUserBiz.checkUserIsHaveAuth(checkUserAuthDTO));
}
@Override
@RequestMapping(value = "/getGroupBookAuthPrice", method = RequestMethod.GET)
public ResponseEntity<ResponseDto<BigDecimal>> getGroupBookAuthPrice(@RequestParam("bookId") Long bookId,
@RequestParam("channelId")Long channelId, @RequestParam("adviserId")Long adviserId) throws BizException {
return ResponseHandleUtil.toResponse(bookAuthInfoBiz.getBookAuthPrice(bookId, channelId, adviserId, 1));
}
}
......@@ -30,6 +30,9 @@ public class CheckCodeParam implements Serializable {
@ApiModelProperty("运营标识")
private Long channelId;
@ApiModelProperty("书刊类型:0-现代纸书 1-社群书")
private Integer authBookType;
public Long getChannelId() {
return channelId;
}
......@@ -69,6 +72,14 @@ public class CheckCodeParam implements Serializable {
this.adviserId = adviserId;
}
public Integer getAuthBookType() {
return authBookType;
}
public void setAuthBookType(Integer authBookType) {
this.authBookType = authBookType;
}
@Override
public String toString() {
return "CheckCodeParam{" +
......@@ -76,6 +87,8 @@ public class CheckCodeParam implements Serializable {
", sceneId=" + sceneId +
", bookId=" + bookId +
", adviserId=" + adviserId +
", channelId=" + channelId +
", authBookType=" + authBookType +
'}';
}
}
package com.pcloud.book.copyright.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @author lily
* @date 2018/12/5 14:08
*/
@ApiModel
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CheckUserParam implements Serializable {
@ApiModelProperty("图书标识")
private Long bookId;
@ApiModelProperty("编辑标识")
private Long adviserId;
@ApiModelProperty("运营标识")
private Long channelId;
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public Long getAdviserId() {
return adviserId;
}
public void setAdviserId(Long adviserId) {
this.adviserId = adviserId;
}
@Override
public String toString() {
return "CheckCodeParam{" +
", bookId=" + bookId +
", adviserId=" + adviserId +
", channelId=" + channelId +
'}';
}
}
......@@ -15,6 +15,8 @@ public class FileVO implements Serializable {
private String fileName;
private Integer authBookType;
public String getFileName() {
return fileName;
}
......@@ -47,12 +49,22 @@ public class FileVO implements Serializable {
this.fileUrl = fileUrl;
}
public Integer getAuthBookType() {
return authBookType;
}
public void setAuthBookType(Integer authBookType) {
this.authBookType = authBookType;
}
@Override
public String toString() {
return "FileVO{" +
"fileUrl='" + fileUrl + '\'' +
", bookId=" + bookId +
", channelId=" + channelId +
", fileName='" + fileName + '\'' +
", authBookType=" + authBookType +
'}';
}
}
......@@ -22,6 +22,9 @@ public class GetAuthInfoParam implements Serializable {
@ApiModelProperty("编辑标识")
private Long adviserId;
@ApiModelProperty("书刊类型:0-现代纸书 1-社群书")
private Integer authBookType;
public Long getSceneId() {
return sceneId;
}
......@@ -46,12 +49,21 @@ public class GetAuthInfoParam implements Serializable {
this.adviserId = adviserId;
}
public Integer getAuthBookType() {
return authBookType;
}
public void setAuthBookType(Integer authBookType) {
this.authBookType = authBookType;
}
@Override
public String toString() {
return "GetAuthInfoParam{" +
"sceneId=" + sceneId +
", bookId=" + bookId +
", adviserId=" + adviserId +
", authBookType=" + authBookType +
'}';
}
}
package com.pcloud.book.copyright.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @author lihao
* @date 2018/8/26 14:27
*/
@ApiModel
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ListHaveAuthGroupBookParam implements Serializable {
@ApiModelProperty("isbn/issn/图书名称")
private String name;
@ApiModelProperty("运营标识")
private Long channelId;
@ApiModelProperty("图书类型标识")
private Long templetId;
@ApiModelProperty("第二级图书类型标识")
private Long secondTempletId;
@ApiModelProperty("当前页")
private Integer currentPage;
@ApiModelProperty("每页条数")
private Integer numPerPage;
@ApiModelProperty("类型")
private String typeCode;
@ApiModelProperty("社群书状态")
private Integer bookStatus;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getTempletId() {
return templetId;
}
public void setTempletId(Long templetId) {
this.templetId = templetId;
}
public Long getSecondTempletId() {
return secondTempletId;
}
public void setSecondTempletId(Long secondTempletId) {
this.secondTempletId = secondTempletId;
}
public Integer getCurrentPage() {
return currentPage;
}
public void setCurrentPage(Integer currentPage) {
this.currentPage = currentPage;
}
public Integer getNumPerPage() {
return numPerPage;
}
public void setNumPerPage(Integer numPerPage) {
this.numPerPage = numPerPage;
}
public String getTypeCode() {
return typeCode;
}
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
public Integer getBookStatus() {
return bookStatus;
}
public void setBookStatus(Integer bookStatus) {
this.bookStatus = bookStatus;
}
@Override
public String toString() {
return "ListHaveAuthGroupBookParam{" +
"name='" + name + '\'' +
", channelId=" + channelId +
", templetId=" + templetId +
", secondTempletId=" + secondTempletId +
", currentPage=" + currentPage +
", numPerPage=" + numPerPage +
", typeCode='" + typeCode + '\'' +
", bookStatus=" + bookStatus +
'}';
}
}
......@@ -46,6 +46,9 @@ public class SetAuthOpenParam implements Serializable {
@ApiModelProperty("是否包含条形码 C1001121 添加二维码,故该字段2为二维码")
private Integer isHaveBarCode;
@ApiModelProperty("书刊类型:0-现代纸书 1-社群书")
private Integer authBookType;
public List<ServeVO> getServes() {
return serves;
}
......@@ -126,9 +129,17 @@ public class SetAuthOpenParam implements Serializable {
this.isHaveBarCode = isHaveBarCode;
}
public Integer getAuthBookType() {
return authBookType;
}
public void setAuthBookType(Integer authBookType) {
this.authBookType = authBookType;
}
@Override
public String toString() {
return "SetAuthOpenVO{" +
return "SetAuthOpenParam{" +
"bookId=" + bookId +
", channelId=" + channelId +
", price=" + price +
......@@ -138,6 +149,8 @@ public class SetAuthOpenParam implements Serializable {
", bookStatus=" + bookStatus +
", checkType=" + checkType +
", serves=" + serves +
", isHaveBarCode=" + isHaveBarCode +
", authBookType=" + authBookType +
'}';
}
}
......@@ -25,6 +25,9 @@ public class SetAuthStatusParam implements Serializable {
@ApiModelProperty("图书状态")
private Integer bookStatus;
@ApiModelProperty("书刊类型:0-现代纸书 1-社群书")
private Integer authBookType;
public Integer getBookStatus() {
return bookStatus;
}
......@@ -49,12 +52,21 @@ public class SetAuthStatusParam implements Serializable {
this.channelId = channelId;
}
public Integer getAuthBookType() {
return authBookType;
}
public void setAuthBookType(Integer authBookType) {
this.authBookType = authBookType;
}
@Override
public String toString() {
return "SetAuthStatusParam{" +
"bookId=" + bookId +
", channelId=" + channelId +
", bookStatus=" + bookStatus +
", authBookType=" + authBookType +
'}';
}
}
......@@ -23,6 +23,9 @@ public class SetLocationDescVO implements Serializable {
@ApiModelProperty("位置描述")
private String locationDesc;
@ApiModelProperty("书刊类型:0-现代纸书 1-社群书")
private Integer authBookType;
public Long getBookId() {
return bookId;
}
......@@ -47,12 +50,21 @@ public class SetLocationDescVO implements Serializable {
this.locationDesc = locationDesc;
}
public Integer getAuthBookType() {
return authBookType;
}
public void setAuthBookType(Integer authBookType) {
this.authBookType = authBookType;
}
@Override
public String toString() {
return "SetLocationDesc{" +
return "SetLocationDescVO{" +
"bookId=" + bookId +
", channelId=" + channelId +
", locationDesc='" + locationDesc + '\'' +
", authBookType=" + authBookType +
'}';
}
}
package com.pcloud.book.group.biz;
import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.dto.BookClassifyDTO;
import com.pcloud.book.group.dto.BookGroupStatisticDTO;
import com.pcloud.book.group.dto.ClassifyDTO;
import com.pcloud.book.group.dto.ClassifyLearningReportDto;
import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import com.pcloud.book.group.dto.GroupNameAndMaxSeqDTO;
import com.pcloud.book.group.dto.GroupQrcodeBaseDTO;
import com.pcloud.book.group.dto.ProAssocGroupAndUserNumberDTO;
import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.vo.AddClassifyVO;
import com.pcloud.book.group.vo.AdviserClassifyParam;
......@@ -12,6 +19,7 @@ import com.pcloud.book.group.vo.ClassifyAndUserCountVO;
import com.pcloud.book.group.vo.ClassifyNameVO;
import com.pcloud.book.group.vo.ClassifyVO;
import com.pcloud.book.group.vo.GroupQrcode4ClassifyVO;
import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO;
import com.pcloud.book.group.vo.ListBookGroupQrcodeParamVO;
import com.pcloud.book.group.vo.ListClassify4WechatVO;
import com.pcloud.book.group.vo.ListClassifyVO;
......@@ -144,7 +152,7 @@ public interface BookGroupClassifyBiz {
/**
* 用户获取具体进群id
*/
String getWxGroupIdByClassifyIdAndWechatId(Long classifyId, Long wechatUserId);
GroupQrcodeBaseInfoVO getWxGroupIdByClassifyIdAndWechatId(Long classifyId, Long wechatUserId);
/**
* @Author:lili
......
......@@ -23,6 +23,20 @@ import java.util.Map;
public interface GroupQrcodeBiz {
/**
* 更新群人数
*/
Integer updateGroupCount(String wxGroupId, Integer num);
/**
* 查询是否需要切群,若需要则返回新群,不需要则为空前端展示客服二维码
*/
String getChangeGroupQrCode(Long classifyId);
/**
* 直接切群
*/
String changeGroupQrCode(Long classifyId);
/**
* 测试替换群二维码,不发生产
*/
void updateGroupQrcode(UpdateGroupQrcodeRequestVO vo);
......@@ -112,6 +126,21 @@ public interface GroupQrcodeBiz {
* @return
*/
Map<String, GroupQrcodeInfo4Advertising> listGroupQrcodeInfo4Advertising(List<String> wxGroupIds);
/**
* 将二维码改为已满群
* @param weixinQrcodeId
* @param groupQrcodeId
*/
void changeToOverNumber(Long weixinQrcodeId, Long groupQrcodeId);
/**
* 将二维码改为未满群
* @param weixinQrcodeId
* @param groupQrcodeId
*/
void changeToNotOverNumber(Long weixinQrcodeId, Long groupQrcodeId);
/**
* 按条件查微信群
* @param query
......
......@@ -10,6 +10,7 @@ import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.consumer.settlement.SettlementConsr;
import com.pcloud.book.consumer.trade.TradeConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.copyright.biz.BookAuthUserBiz;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.biz.GroupAnnouncementBiz;
......@@ -21,7 +22,21 @@ import com.pcloud.book.group.dao.BookQrcodeUserDao;
import com.pcloud.book.group.dao.JoinGroupCipherDao;
import com.pcloud.book.group.dao.LearningReportBrowseRecordDao;
import com.pcloud.book.group.dao.LearningReportTouchRecordDao;
import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.dto.BookClassifyDTO;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookGroupStatisticDTO;
import com.pcloud.book.group.dto.BookWxQrcodeDTO;
import com.pcloud.book.group.dto.ClassifyDTO;
import com.pcloud.book.group.dto.ClassifyLearningCountDto;
import com.pcloud.book.group.dto.ClassifyLearningReportDto;
import com.pcloud.book.group.dto.GroupAndUserNumberDTO;
import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import com.pcloud.book.group.dto.GroupNameAndMaxSeqDTO;
import com.pcloud.book.group.dto.GroupQrcodeBaseDTO;
import com.pcloud.book.group.dto.GroupQrcodeInfoDTO;
import com.pcloud.book.group.dto.ProAssocGroupAndUserNumberDTO;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.dto.WeixinQrcodeDTO;
import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.entity.BookQrcodeUser;
import com.pcloud.book.group.entity.GroupQrcode;
......@@ -146,6 +161,9 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
@Autowired
private JoinGroupCipherDao joinGroupCipherDao;
@Autowired
private BookAuthUserBiz bookAuthUserBiz;
@Override
@ParamLog("新增分类")
......@@ -181,12 +199,10 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
log.info("[新增分类] : 可用微信群数量:{}个", wechatGroupNum);
throw new BookBizException(BookBizException.PARAM_IS_NULL, "群二维码数量不足,您可以明天再创建群。");
}
}
Integer generation = null;
if (new Integer(2).equals(qrcodeNameAndProId.getJoinGroupType())) {
generation = 3;
}
WeixinQrcodeDTO oneQrcode = weixinQrcodeBiz.getOneQrcode(generation);
if (oneQrcode == null) {
......@@ -544,10 +560,14 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "社群码不存在,请刷新后重试");
}
if (new BigDecimal(0).compareTo(classify.getPrice()) < 0) {
//校验用户是否购买
Boolean isBuy = bookClassifyBuyRecordDao.checkUserBuy(wechatUserId, classifyId);
if (!isBuy) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "您还未购买,请购买后使用!");
//校验用户是否正版授权
Boolean isAuth = bookAuthUserBiz.checkIsHaveAuth(classify.getBookId(), classify.getChannelId(), classify.getCreateUser(), wechatUserId, 1);
if(!isAuth) {
//校验用户是否购买
Boolean isBuy = bookClassifyBuyRecordDao.checkUserBuy(wechatUserId, classifyId);
if (!isBuy) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "您还未购买,请购买后使用!");
}
}
}
......@@ -579,7 +599,8 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
}
@Override
public String getWxGroupIdByClassifyIdAndWechatId(Long classifyId, Long wechatUserId) {
@ParamLog("[getWxGroupIdByClassifyIdAndWechatId]")
public GroupQrcodeBaseInfoVO getWxGroupIdByClassifyIdAndWechatId(Long classifyId, Long wechatUserId) {
if(null == classifyId || null == wechatUserId) {
return null;
}
......@@ -588,7 +609,7 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
return null;
}
final GroupQrcodeBaseInfoVO baseById = this.groupQrcodeBiz.getBaseById(wechat.getGroupQrcodeId());
return (null == baseById) ? null : baseById.getWeixinGroupId();
return baseById;
}
@ParamLog("获取备用二维码")
......@@ -1053,10 +1074,6 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
}
@Override
public BigDecimal getPayPrice(Long qrcodeId, String wxId) {
return joinGroupCipherDao.getPayPrice(wxId, qrcodeId);
}
@ParamLog("拖动排序")
@Transactional(rollbackFor = Exception.class)
......@@ -1069,6 +1086,11 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
}
@Override
public BigDecimal getPayPrice(Long qrcodeId, String wxId) {
return joinGroupCipherDao.getPayPrice(wxId, qrcodeId);
}
@Override
public void clickClassify(Long wechatUserId, Long bookGroupId, Long classifyId) {
bookGroupClassifyDao.addClickClassify(wechatUserId,bookGroupId,classifyId);
}
......@@ -1081,7 +1103,7 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
return new ArrayList<>();
}
return classifyVOS;
}
}
......@@ -3,6 +3,7 @@ package com.pcloud.book.group.biz.impl;
import com.google.common.collect.Maps;
import com.pcloud.book.advertising.biz.AdvertisingSpaceBiz;
import com.pcloud.book.advertising.biz.GroupMasterTagBiz;
import com.pcloud.book.advertising.dto.QrcodeAdvertisingSpaceCountDTO;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.label.LabelConsr;
......@@ -44,6 +45,7 @@ import com.pcloud.book.push.dao.PushGroupDao;
import com.pcloud.book.push.entity.PushGroup;
import com.pcloud.book.riddle.dto.GroupRiddleDTO;
import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.common.constant.CacheConstant;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
......@@ -68,9 +70,11 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
......@@ -110,79 +114,188 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
private LabelConsr labelConsr;
@Autowired
private BookGroupBiz bookGroupBiz;
@Autowired
private GroupMasterTagBiz groupMasterTagBiz;
/**
* 自动更新群人数线程是否开始执行
*/
private static final AtomicBoolean IS_START = new AtomicBoolean(false);
// private static final AtomicBoolean IS_START = new AtomicBoolean(false);
/**
* 处理群人数线程池
*/
private static final ExecutorService SINGLE_THREAD_EXECUTOR = Executors.newSingleThreadExecutor();
// private static final ExecutorService SINGLE_THREAD_EXECUTOR = Executors.newSingleThreadExecutor();
@Override
public Integer updateGroupCount(String wxGroupId, Integer num) {
return groupQrcodeDao.updateGroupCount(wxGroupId, num);
}
/**
* 更新群人数线程
*/
private void updateGroupNum() {
// 若已开始则无需再启动
if(IS_START.get()) {
return;
}
// 若设置时已经为true则代表已经有线程执行成功
final boolean andSet = IS_START.getAndSet(true);
if (andSet) {
return;
// private void updateGroupNum() {
// // 若已开始则无需再启动
// if(IS_START.get()) {
// return;
// }
// // 若设置时已经为true则代表已经有线程执行成功
// final boolean andSet = IS_START.getAndSet(true);
// if (andSet) {
// return;
// }
// SINGLE_THREAD_EXECUTOR.execute(() -> {
// while (true) {
// try{
// if (BookBusinessConstants.GROUP_NUM_DTO_MAP.size() < 1) {
// try {
// Thread.sleep(10000);
// } catch (InterruptedException e) {
// log.error("[updateGroupNum] InterruptedException:{}", e);
// }
// continue;
// }
// log.info("[更新群人数] start GROUP_NUM_DTO_MAP:{}", BookBusinessConstants.GROUP_NUM_DTO_MAP);
// for (Map.Entry<String, AutoUpdateGroupNumDTO> entry : BookBusinessConstants.GROUP_NUM_DTO_MAP.entrySet()) {
// final AutoUpdateGroupNumDTO value = entry.getValue();
// // 没到时间不执行(小于30s并且小于3个人不执行)
// final boolean b = null == value || ((System.currentTimeMillis() + 10) < value.getStartTime().getTime() && value.getNum().get() < 3);
// if(b) {
// log.info("[更新群人数] null == value:{}", entry);
// continue;
// }
// Integer peopleCounts = WxGroupSDK.getPeopleCounts(value.getWxGroupId(), value.getRobotId(), value.getIp());
// if (null == peopleCounts || peopleCounts < 1) {
// log.info("[更新群人数] null == peopleCounts || peopleCounts < 1 entry:{}; peopleCounts:{}", entry, peopleCounts);
// // 若未获取到将其移除
// BookBusinessConstants.GROUP_NUM_DTO_MAP.remove(entry.getKey());
// continue;
// }
// log.info("[更新群人数] entry:{}, peopleCounts:{}", entry, peopleCounts);
// groupQrcodeDao.updateUserNumber(value.getWxGroupId(), peopleCounts);
// BookBusinessConstants.GROUP_NUM_DTO_MAP.remove(entry.getKey());
// try {
// Thread.sleep(1000);
// } catch (InterruptedException e) {
// log.error("[updateGroupNum] InterruptedException:{}", e);
// }
// }
// } catch (Exception e) {
// log.error("[updateGroupNum] : Exception:{}", e);
// }
// try {
// Thread.sleep(10000);
// } catch (InterruptedException e) {
// log.error("[updateGroupNum] InterruptedException:{}", e);
// }
// }
// });
// }
@Override
public String getChangeGroupQrCode(Long classifyId) {
log.info("[前端调用切群接口] getChangeGroupQrCode classifyId:{}", classifyId);
if (Objects.isNull(classifyId)) {
return StringUtil.EMPTY;
}
ClassifyVO classify = bookGroupClassifyBiz.getClassify(classifyId);
if (Objects.isNull(classify)) {
throw new BookBizException(BookBizException.ID_NOT_EXIST, "分类不存在");
}
List<ClassifyQrcodeVO> qrcodeByClassify = groupQrcodeDao.getQrcodeByClassifyId(classifyId);
if (CollectionUtils.isEmpty(qrcodeByClassify)) {
// 如果没有群则新增一个
String url = changeGroupQrCode(classifyId);
log.info("[前端调用切群接口] getChangeGroupQrCode 分类异常没有群 重新分配群classifyId:{} url:{}", classifyId, url);
return url;
}
// 获取使用中的群
List<ClassifyQrcodeVO> collect = qrcodeByClassify.stream().filter(p -> QrcodeStatusEnum.ON_USE.value.equals(p.getQrcodeState())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(collect)) {
// 如果没有使用中群则新增一个
String url = changeGroupQrCode(classifyId);
log.info("[前端调用切群接口] getChangeGroupQrCode 没有使用中的群 重新分配群classifyId:{} url:{}", classifyId, url);
return url;
}
if (collect.size() == 1) {
ClassifyQrcodeVO qrcodeVO = collect.get(0);
if (qrcodeVO.getUserNumber() < classify.getChangeNumber()) {
return qrcodeVO.getQrcodeUrl();
} else {
//将二维码修改为已满群状态
if (qrcodeVO.getUserNumber() >= 100) {
changeToOverNumber(qrcodeVO.getWeixinQrcodeId(), qrcodeVO.getId());
}
// 更新二维码状态
groupQrcodeDao.changeQrcodeState(qrcodeVO.getId(), QrcodeStatusEnum.OVER_NUMBER.value);
// 如果没有群则新增一个
String url = changeGroupQrCode(classifyId);
log.info("[前端调用切群接口] getChangeGroupQrCode 群超出切群人数了,但是没有切群 重新分配群classifyId:{} url:{}", classifyId, url);
return url;
}
}
SINGLE_THREAD_EXECUTOR.execute(() -> {
while (true) {
try{
if (BookBusinessConstants.GROUP_NUM_DTO_MAP.size() < 1) {
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
log.error("[updateGroupNum] InterruptedException:{}", e);
}
continue;
}
log.info("[更新群人数] start GROUP_NUM_DTO_MAP:{}", BookBusinessConstants.GROUP_NUM_DTO_MAP);
for (Map.Entry<String, AutoUpdateGroupNumDTO> entry : BookBusinessConstants.GROUP_NUM_DTO_MAP.entrySet()) {
final AutoUpdateGroupNumDTO value = entry.getValue();
// 没到时间不执行(小于30s并且小于3个人不执行)
final boolean b = null == value || ((System.currentTimeMillis() + 10) < value.getStartTime().getTime() && value.getNum().get() < 3);
if(b) {
log.info("[更新群人数] null == value:{}", entry);
continue;
}
Integer peopleCounts = WxGroupSDK.getPeopleCounts(value.getWxGroupId(), value.getRobotId(), value.getIp());
if (null == peopleCounts || peopleCounts < 1) {
log.info("[更新群人数] null == peopleCounts || peopleCounts < 1 entry:{}; peopleCounts:{}", entry, peopleCounts);
// 若未获取到将其移除
BookBusinessConstants.GROUP_NUM_DTO_MAP.remove(entry.getKey());
continue;
}
log.info("[更新群人数] entry:{}, peopleCounts:{}", entry, peopleCounts);
groupQrcodeDao.updateUserNumber(value.getWxGroupId(), peopleCounts);
BookBusinessConstants.GROUP_NUM_DTO_MAP.remove(entry.getKey());
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
log.error("[updateGroupNum] InterruptedException:{}", e);
}
}
} catch (Exception e) {
log.error("[updateGroupNum] : Exception:{}", e);
String url = null;
for (ClassifyQrcodeVO vo : collect) {
if (vo.getUserNumber() >= classify.getChangeNumber()) {
//将二维码修改为已满群状态
if (vo.getUserNumber() >= 100) {
changeToOverNumber(vo.getWeixinQrcodeId(), vo.getId());
}
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
log.error("[updateGroupNum] InterruptedException:{}", e);
// 更新二维码状态
groupQrcodeDao.changeQrcodeState(vo.getId(), QrcodeStatusEnum.OVER_NUMBER.value);
log.info("[前端调用切群接口] getChangeGroupQrCode 处理超出了但是没有更新状态的群 vo:{}", vo);
}
if (vo.getUserNumber() < classify.getChangeNumber()) {
url = vo.getQrcodeUrl();
}
}
if (Objects.isNull(url)) {
// 如果没有群则新增一个
String qrcodeUrl = changeGroupQrCode(classifyId);
log.info("[前端调用切群接口] getChangeGroupQrCode 没有可用群 重新分配群classifyId:{} url:{}", classifyId, url);
return qrcodeUrl;
}
return url;
}
@Override
public String changeGroupQrCode(Long classifyId) {
return changeGroup(classifyId);
}
private String changeGroup(Long classifyId) {
final String key = CacheConstant.BOOK + "changeGroup:" + classifyId;
final String qrcodeKey = CacheConstant.BOOK + "changeGroupQrCode:" + classifyId;
String url = StringUtil.EMPTY;
final String threadId = Thread.currentThread().getId() + "";
try {
boolean getLock = JedisClusterUtils.setnx(key, threadId);
if (getLock) {
JedisClusterUtils.expire(key, 3);
// 双重校验避免前一个事务未提交
String qrcode = JedisClusterUtils.get(qrcodeKey);
if (StringUtil.isNotBlank(qrcode)) {
return qrcode;
}
// 如果没有群则新增一个
url = addWechatGroup(classifyId, null);
log.info("[直接切群] changeGroupQrCode 直接切群classifyId:{} url:{}", classifyId, url);
// 切群之后将新切群放入缓存5分钟,5分钟内若需要切群则直接从缓存中获取,避免事务未提交,双重判断
JedisClusterUtils.set(qrcodeKey, url, 60 * 5);
} else {
return url;
}
} finally {
String s = JedisClusterUtils.get(key);
if(StringUtil.isNotBlank(s) && s.contains(threadId)) {
JedisClusterUtils.del(key);
}
});
}
return url;
}
@Override
......@@ -214,6 +327,8 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
@ParamLog("新增群二维码")
public Long insert(GroupQrcode groupQrcode) {
groupQrcodeDao.insert(groupQrcode);
//判断广告位标记
groupMasterTagBiz.addTagByBookGroup(groupQrcode.getClassifyId(), groupQrcode.getId());
return groupQrcode.getId();
}
......@@ -326,12 +441,12 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
log.info("[新增一个用户] : robotId is null weixinGroupId:{},memberCount:{},nickName:{},robotId:{}", weixinGroupId, memberCount, nickName, robotId);
robotIdByGroupId = wechatGroupConsr.getRobotIdByGroupId(weixinGroupId);
}
if(robotIdByGroupId != null){
Integer peopleCounts = WxGroupSDK.getPeopleCounts(weixinGroupId, robotIdByGroupId, ip);
if (peopleCounts != null) {
memberCount = peopleCounts;
}
}
// if(robotIdByGroupId != null){
// Integer peopleCounts = WxGroupSDK.getPeopleCounts(weixinGroupId, robotIdByGroupId, ip);
// if (peopleCounts != null) {
// memberCount = peopleCounts;
// }
// }
//获取群基本信息
GroupQrcodeDTO groupQrcodeDTO = groupQrcodeDao.getGroupQrcodeInfo(weixinGroupId);
log.info("[新增一个用户] groupQrcodeDTO:{}", groupQrcodeDTO);
......@@ -339,21 +454,24 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
return;
}
//更新用户数(由于微信有延迟及时更新可能会数据对不上,所以调用方法延迟30s,统一处理)
AutoUpdateGroupNumDTO numDTO = BookBusinessConstants.GROUP_NUM_DTO_MAP.get(weixinGroupId);
if (null == numDTO){
numDTO = new AutoUpdateGroupNumDTO(weixinGroupId, robotId, ip, new Date());
} else {
numDTO.getNum().incrementAndGet();
numDTO.setRobotId(robotId);
numDTO.setIp(ip);
numDTO.setWxGroupId(weixinGroupId);
numDTO.setStartTime(new Date());
}
BookBusinessConstants.GROUP_NUM_DTO_MAP.put(weixinGroupId, numDTO);
// 发消息时获取的群人数更准确memberCount 20190905
// AutoUpdateGroupNumDTO numDTO = BookBusinessConstants.GROUP_NUM_DTO_MAP.get(weixinGroupId);
// if (null == numDTO){
// numDTO = new AutoUpdateGroupNumDTO(weixinGroupId, robotId, ip, new Date());
// } else {
// numDTO.getNum().incrementAndGet();
// numDTO.setRobotId(robotId);
// numDTO.setIp(ip);
// numDTO.setWxGroupId(weixinGroupId);
// numDTO.setStartTime(new Date());
// }
// BookBusinessConstants.GROUP_NUM_DTO_MAP.put(weixinGroupId, numDTO);
// 启动更新群人数线程
if (!IS_START.get()) {
this.updateGroupNum();
}
// if (!IS_START.get()) {
// this.updateGroupNum();
// }
// 新用户进群时系统消息群人数不准,所以从系统中取然后+1,更新群人数操作会在群消息地方处理
memberCount = groupQrcodeDTO.getUserNumber() + 1;
//如果人数超过限制,重新分配群
if (memberCount >= groupQrcodeDTO.getChangeNumber() && QrcodeStatusEnum.ON_USE.value.equals(groupQrcodeDTO.getQrcodeState())) {
//修改状态,重新分配一个群
......@@ -508,7 +626,7 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
*/
@ParamLog("重新分配一个群")
@Transactional(rollbackFor = Exception.class)
public void addWechatGroup(Long classifyId, Long groupQrcodeId) {
public String addWechatGroup(Long classifyId, Long groupQrcodeId) {
Integer generation = null;
ClassifyVO classifyVOOne = bookGroupClassifyBiz.getClassify(classifyId);
if (classifyVOOne != null && classifyVOOne.getBookGroupId() != null) {
......@@ -521,9 +639,13 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
log.info("[重新分配一个群] : oneQrcode:{}", oneQrcode);
if (oneQrcode != null) {
//将二维码改为已满群状态
Integer number = groupQrcodeDao.changeQrcodeState(groupQrcodeId, QrcodeStatusEnum.OVER_NUMBER.value);
Integer number = 0;
if (!Objects.isNull(groupQrcodeId)) {
number = groupQrcodeDao.changeQrcodeState(groupQrcodeId, QrcodeStatusEnum.OVER_NUMBER.value);
}
log.info("[重新分配一个群] : groupQrcodeDao.changeQrcodeState number:{}", number);
if (number > 0){
// 当该分类不存在群的时候分配一个
if (number > 0 || null == groupQrcodeId){
//获取标签对应基本信息
GroupNameAndMaxSeqDTO groupNameAndMaxSeqDTO = bookGroupClassifyBiz.getGroupNameAndMaxSeq(classifyId);
log.info("[重新分配一个群] : groupNameAndMaxSeqDTO:{}", groupNameAndMaxSeqDTO);
......@@ -567,17 +689,28 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
String ip = Optional.ofNullable(groupVersion.get(wechatGroupId)).orElse(new BookWxQrcodeDTO()).getWechatGroupIp();
SendWeixinRequestTools.changeGroupName(oneQrcode.getRobotWxId(), wechatGroupId, groupName, ip);
}
return oneQrcode.getQrcodeUrl();
}
}
return StringUtil.EMPTY;
}
@ParamLog("将二维码改为已满群")
@Transactional(rollbackFor = Exception.class)
public void changeToOverNumber(Long weixinQrcodeId, Long id) {
groupQrcodeDao.updateUseState(id, QrcodeStatusEnum.OVER_NUMBER.value);
@Override
public void changeToOverNumber(Long weixinQrcodeId, Long groupQrcodeId) {
groupQrcodeDao.updateUseState(groupQrcodeId, QrcodeStatusEnum.OVER_NUMBER.value);
weixinQrcodeBiz.updateUseState(weixinQrcodeId, QrcodeStatusEnum.OVER_NUMBER.value);
}
@ParamLog("将二维码改为未满群")
@Transactional(rollbackFor = Exception.class)
@Override
public void changeToNotOverNumber(Long weixinQrcodeId, Long groupQrcodeId) {
groupQrcodeDao.updateUseState(groupQrcodeId, QrcodeStatusEnum.ON_USE.value);
weixinQrcodeBiz.updateUseState(weixinQrcodeId, QrcodeStatusEnum.ON_USE.value);
}
@Override
public List<Long> listQrcodeIdsByLabelQuery(String query, Long proLabelId, Long depLabelId, Long purLabelId) {
Map<String, Object> paramMap = new HashMap<>();
......
......@@ -18,6 +18,8 @@ import java.util.Map;
*/
public interface GroupQrcodeDao extends BaseDao<GroupQrcode> {
Integer updateGroupCount(String wxGroupId, Integer num);
void updateGroupQrcode(Long groupQrcodeId, String qrcodeUrl, Long userId);
List<ListGroupQrcodeResponseVO> listAllGroupQrcode(String groupName);
......@@ -91,6 +93,8 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> {
*/
Integer changeQrcodeState(Long id, Integer qrcode_state);
Integer changeQrcodeStateForNotOver(Long id, Integer qrcode_state);
/**
* @Author:lili
* @Desr:获取群二维码相关信息
......@@ -241,4 +245,6 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> {
List<ClassifyQrcodeVO> getQrcodeByClassify(Long classifyId);
List<ClassifyQrcodeVO> getQrcodeByClassifyId(Long classifyId);
}
......@@ -24,6 +24,15 @@ import java.util.Map;
*/
@Component("groupQrcodeDao")
public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements GroupQrcodeDao {
@Override
public Integer updateGroupCount(String wxGroupId, Integer num) {
final Map<String, Object> map = Maps.newHashMap();
map.put("weixinGroupId", wxGroupId);
map.put("userNumber", num);
return this.getSqlSession().update(this.getStatement("updateGroupCount"), map);
}
@Override
public void updateGroupQrcode(Long groupQrcodeId, String qrcodeUrl, Long userId) {
final Map<String, Object> map = Maps.newHashMap();
......@@ -106,6 +115,15 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou
return this.getSqlSession().update(this.getStatement("changeQrcodeState"), paramMap);
}
@Override
public Integer changeQrcodeStateForNotOver(Long id, Integer qrcodeState) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("id", id);
paramMap.put("qrcodeState", qrcodeState);
return this.getSqlSession().update(this.getStatement("changeQrcodeStateForNotOver"), paramMap);
}
@Override
public Map<Long, GroupQrcodeInfoDTO> listQrcodeInfoByIds(List<Long> groupQrcodeIds) {
return this.getSqlSession().selectMap(this.getStatement("listQrcodeInfoByIds"), groupQrcodeIds, "id");
......@@ -204,6 +222,10 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou
return this.getSqlSession().selectList(this.getStatement("getQrcodeByClassify"), classifyId);
}
public List<ClassifyQrcodeVO> getQrcodeByClassifyId(Long classifyId) {
return this.getSqlSession().selectList(this.getStatement("getQrcodeByClassifyId"), classifyId);
}
@Override
public List<Long> getIdsByBookId(Long bookId) {
return getSessionTemplate().selectList(getStatement("getIdsByBookId"), bookId);
......
......@@ -2,10 +2,13 @@ package com.pcloud.book.group.dto;
import java.io.Serializable;
import lombok.Data;
/**
* @author lily
* @date 2019/4/28 15:02
*/
@Data
public class GroupQrcodeDTO implements Serializable {
/**
......@@ -26,7 +29,7 @@ public class GroupQrcodeDTO implements Serializable {
/**
* 微信群标识
*/
private Long weixinGroupId;
private String weixinGroupId;
/**
* 限制人数
......@@ -34,6 +37,11 @@ public class GroupQrcodeDTO implements Serializable {
private Integer changeNumber;
/**
* 当前群人数
*/
private Integer userNumber;
/**
* 二维码状态
*/
private Integer qrcodeState;
......@@ -43,72 +51,10 @@ public class GroupQrcodeDTO implements Serializable {
*/
private Integer useState;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getWeixinQrcodeId() {
return weixinQrcodeId;
}
public void setWeixinQrcodeId(Long weixinQrcodeId) {
this.weixinQrcodeId = weixinQrcodeId;
}
public Integer getChangeNumber() {
return changeNumber;
}
public void setChangeNumber(Integer changeNumber) {
this.changeNumber = changeNumber;
}
public Integer getQrcodeState() {
return qrcodeState;
}
public void setQrcodeState(Integer qrcodeState) {
this.qrcodeState = qrcodeState;
}
public Integer getUseState() {
return useState;
}
public void setUseState(Integer useState) {
this.useState = useState;
}
public Long getWeixinGroupId() {
return weixinGroupId;
}
public void setWeixinGroupId(Long weixinGroupId) {
this.weixinGroupId = weixinGroupId;
}
public Long getClassifyId() {
return classifyId;
}
/**
* 群名称
*/
private String groupName;
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
@Override
public String toString() {
return "GroupQrcodeDTO{" +
"id=" + id +
", classifyId=" + classifyId +
", weixinQrcodeId=" + weixinQrcodeId +
", weixinGroupId=" + weixinGroupId +
", changeNumber=" + changeNumber +
", qrcodeState=" + qrcodeState +
", useState=" + useState +
'}';
}
}
......@@ -67,6 +67,18 @@ public class GroupQrcodeFacadeImpl implements GroupQrcodeFacade {
return new ResponseDto<>();
}
@GetMapping("getChangeGroupQrCode")
public ResponseDto<String> getChangeGroupQrCode(@RequestParam("classifyId") Long classifyId) {
String qrCodeUrl = groupQrcodeBiz.getChangeGroupQrCode(classifyId);
return new ResponseDto<>(qrCodeUrl);
}
@GetMapping("changeGroupQrCode")
public ResponseDto<String> changeGroupQrCode(@RequestParam("classifyId") Long classifyId) {
String qrCodeUrl = groupQrcodeBiz.changeGroupQrCode(classifyId);
return new ResponseDto<>(qrCodeUrl);
}
@Override
@PostMapping("listQrcodeByClassify")
public ResponseDto<PageBeanNew> listQrcodeByClassify(@RequestHeader("token") String token, @RequestBody ListQrcodeByClassifyParamVO listQrcodeByClassifyParamVO) {
......
......@@ -4,6 +4,7 @@ import com.pcloud.book.clock.dto.BookClockKeywordDTO;
import com.pcloud.book.group.dto.SyncWeixinGroupIdRequestDTO;
import com.pcloud.book.group.dto.UpdateQrDTO;
import com.pcloud.book.keywords.dto.KeywordDTO;
import com.pcloud.book.keywords.dto.KeywordStatusDTO;
import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
import com.pcloud.book.keywords.dto.SendMessageDTO;
import com.pcloud.book.keywords.enums.ReplyTypeEnum;
......@@ -25,6 +26,7 @@ import com.sdk.wxgroup.WxGroupSDK;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Iterator;
......@@ -133,11 +135,19 @@ public class SendWeixinRequestTools {
}
@ParamLog("发送欢迎语消息")
public static void sendGuideMessage(List<ReplyMessageVO> replyMessages, String robotId, String weixinGroupId, String ip, Integer code) {
public static void sendGuideMessage(List<ReplyMessageVO> replyMessages, String robotId, String weixinGroupId, Boolean isGroupRobot, List<KeywordDTO> keywords, KeywordStatusDTO dto, String ip, Integer code) {
//JedisClusterUtils.del("BOOK:WEIXINGROUP:GUIDEUSER" + weixinGroupId);
if (ListUtils.isEmpty(replyMessages)) {
return;
}
StringBuilder sb = new StringBuilder();
if (!CollectionUtils.isEmpty(keywords) && isGroupRobot) {
sb.append("\n\n在群内回复以下关键词:\n");
for (KeywordDTO keyword : keywords) {
sb.append("【").append(keyword.getKeywords()).append("】 ");
}
}
StringBuilder groupKeyword = getGroupKeyword(dto, sb);
int i = 0;
for (ReplyMessageVO replyMessageVO : replyMessages) {
SendMessageDTO sendMessageDTO = new SendMessageDTO();
......@@ -147,9 +157,14 @@ public class SendWeixinRequestTools {
LOGGER.info("发送欢迎语" + nickNameStr);
if (StringUtils.isNotEmpty(nickNameStr)) {
if (ReplyTypeEnum.TEXT.value.equals(sendMessageDTO.getReplyType())) {
sendMessageDTO.setContent(nickNameStr + " " + sendMessageDTO.getContent());
sendMessageDTO.setContent(nickNameStr + " " + sendMessageDTO.getContent() + groupKeyword.toString());
} else {
sendAtMessage(nickNameStr, robotId, weixinGroupId, ip);
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setContent(nickNameStr);
sendTextMessageVO.setAltId(robotId);
sendTextMessageVO.setWxGroupId(weixinGroupId);
sendTextMessageVO.setIp(ip);
WxGroupSDK.sendTextMessage(sendTextMessageVO);
}
}
}
......@@ -191,16 +206,16 @@ public class SendWeixinRequestTools {
}
}
private static void sendAtMessage(String nickNameStr,String robotId,String weixinGroupId, String ip){
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setContent(nickNameStr);
sendTextMessageVO.setAltId(robotId);
sendTextMessageVO.setWxGroupId(weixinGroupId);
sendTextMessageVO.setIp(ip);
WxGroupSDK.sendTextMessage(sendTextMessageVO);
}
// private static void sendAtMessage(String nickNameStr,String robotId,String weixinGroupId, String ip){
//
// SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
// sendTextMessageVO.setContent(nickNameStr);
// sendTextMessageVO.setAltId(robotId);
// sendTextMessageVO.setWxGroupId(weixinGroupId);
// sendTextMessageVO.setIp(ip);
// WxGroupSDK.sendTextMessage(sendTextMessageVO);
//
// }
private static String addLinkParam(String url, Long groupQrcodeId, Long classifyId, Long bookGroupId) {
if (StringUtil.isEmpty(url)) {
......@@ -340,21 +355,47 @@ public class SendWeixinRequestTools {
// WxGroupSDK.sendTextMessage(sendTextMessageVO);
}
public static void sendDefaultMessage(String groupName, String robotId, String weixinGroupId, Boolean isHaveKeywords, String ip) {
String content = getNickNameStr(weixinGroupId);
public static void sendDefaultMessage(String groupName, String robotId, String weixinGroupId, Boolean isHaveKeywords, Boolean isGroupRobot, List<KeywordDTO> keywords, KeywordStatusDTO dto, String ip) {
StringBuilder content = new StringBuilder(getNickNameStr(weixinGroupId));
if (StringUtil.isEmpty(groupName)) {
content += " 欢迎加入本群!";
content.append(" 欢迎加入本群!");
} else {
content += " 欢迎加入" + groupName + "!";
content.append(" 欢迎加入").append(groupName).append("!");
}
if(isHaveKeywords){
content = content + "本群目的为学习交流和学习辅导,线上资源和工具为图书的增值服务,可根据实际情况配合图书一起使用。凭以下关键词领取任务或资源:";
// content = content + "本群目的为学习交流和学习辅导,线上资源和工具为图书的增值服务,可根据实际情况配合图书一起使用。在群内回复以下关键词领取任务或资源:";
content.append("本群目的为学习交流和学习辅导,线上资源和工具为图书的增值服务,可根据实际情况配合图书一起使用。\n\n在群内回复以下关键词:\n");
}
sendTextMessage(content, robotId, weixinGroupId, ip);
if (!CollectionUtils.isEmpty(keywords) && isGroupRobot) {
for (KeywordDTO keyword : keywords) {
content.append("【").append(keyword.getKeywords()).append("】 ");
}
}
StringBuilder groupKeyword = getGroupKeyword(dto, content);
sendTextMessage(groupKeyword.toString(), robotId, weixinGroupId, ip);
}
private static StringBuilder getGroupKeyword(KeywordStatusDTO dto, StringBuilder sb) {
if (!sb.toString().contains("【") && (dto.getClockOpen() || dto.getRiddleOpen() || dto.getReportOpen())) {
sb.append("\n\n在群内回复以下关键词:\n");
}
if (dto.getReportOpen()) {
sb.append("【学习报告】 ");
}
if (dto.getRiddleOpen()) {
sb.append("【猜谜语】 ");
}
if (dto.getClockOpen()) {
sb.append("【").append(dto.getClockKeyword()).append("】 ");
}
if (StringUtil.isNotBlank(sb) && sb.toString().contains("【")) {
sb.append(",领取任务或资源");
}
return sb;
}
private static String getNickNameStr(String weixinGroupId) {
String nameStr = "";
StringBuilder nameStr = new StringBuilder();
Map<String, Integer> nickNames = JedisClusterUtils.getJson("BOOK:WEIXINGROUP:GUIDEUSER" + weixinGroupId, Map.class);
int i = 0;
List<String> names = new ArrayList<>();
......@@ -371,11 +412,11 @@ public class SendWeixinRequestTools {
for (String nickName : names) {
nickNames.remove(nickName);
if (StringUtils.isNotEmpty(nickName)) {
nameStr = nameStr + "@" + nickName + " ";
nameStr.append("@").append(nickName).append(" ");
}
}
JedisClusterUtils.setJson("BOOK:WEIXINGROUP:GUIDEUSER" + weixinGroupId, nickNames, 600);
return nameStr;
return nameStr.toString();
}
@ParamLog("欢迎语中推送关键词信息")
......
......@@ -46,6 +46,9 @@ public class ClassifyQrcodeVO implements Serializable {
@ApiModelProperty("关键词识别次数")
private Integer keywordCount;
@ApiModelProperty(value = "二维码状态", hidden = true)
private Integer qrcodeState;
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
......@@ -145,6 +148,14 @@ public class ClassifyQrcodeVO implements Serializable {
this.createdTime = createdTime;
}
public Integer getQrcodeState() {
return qrcodeState;
}
public void setQrcodeState(Integer qrcodeState) {
this.qrcodeState = qrcodeState;
}
@Override
public String toString() {
return "ClassifyQrcodeVO{" +
......@@ -158,6 +169,7 @@ public class ClassifyQrcodeVO implements Serializable {
", weixinQrcodeId=" + weixinQrcodeId +
", weixinGroupId='" + weixinGroupId + '\'' +
", keywordCount=" + keywordCount +
", qrcodeState=" + qrcodeState +
", createdTime=" + createdTime +
'}';
}
......
......@@ -51,6 +51,9 @@ public class ClassifyVO implements Serializable {
@ApiModelProperty("排序")
private Integer rank;
@ApiModelProperty("创建人")
private Long createUser;
public Integer getRank() {
return rank;
}
......@@ -147,6 +150,14 @@ public class ClassifyVO implements Serializable {
this.productSpecId = productSpecId;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
@Override
public String toString() {
return "ClassifyVO{" +
......@@ -162,6 +173,7 @@ public class ClassifyVO implements Serializable {
", productId=" + productId +
", productSpecId=" + productSpecId +
", rank=" + rank +
", createUser=" + createUser +
'}';
}
}
......@@ -27,4 +27,7 @@ public class GroupQrcodeBaseInfoVO implements Serializable {
@ApiModelProperty(value = "二维码地址", hidden = true)
private String weixinGroupId;
@ApiModelProperty(value = "当前群人数", hidden = true)
private Integer userNumber;
}
......@@ -6,6 +6,7 @@ import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
import com.pcloud.book.keywords.dto.ServiceResourceDTO;
import com.pcloud.book.keywords.vo.*;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.wechatgroup.message.dto.SendTextDTO;
import com.sdk.wxgroup.SendMessageTypeEnum;
import java.util.List;
......@@ -71,7 +72,26 @@ public interface BookKeywordBiz {
* @Desr: 回复关键词消息
* @Date:2019/5/5 16:28
*/
void sendKeywordMessage(String content, String weixinGroupId, String userWxId, String robotId, String ip, Integer code);
void sendKeywordMessage(SendTextDTO sendTextDTO);
/**
* 更新群人数
* @param wxGroupId 微信群id
* @param memberCount 群人数
* @param changeNumber 切群人数
* @param weixinQrcodeId weixin表主键
* @param groupQrcodeId groupQrcode表主键
*/
void updateGroupPeopleCount(String wxGroupId, Integer memberCount, Integer changeNumber, Long weixinQrcodeId, Long groupQrcodeId);
/**
* 修改群名称
* @param weixinGroupId 微信群id
* @param groupName 群名称
* @param robotId 机器人id
* @param ip ip地址
*/
void checkGroupName(String weixinGroupId, String groupName, String robotId, String ip);
/**
* 关键词统计
......
......@@ -2,9 +2,6 @@ package com.pcloud.book.keywords.biz.impl;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.constant.BookConstant;
import com.pcloud.book.clock.check.BookClockCheck;
import com.pcloud.book.clock.dao.BookClockKeywordDao;
import com.pcloud.book.clock.dto.BookClockKeywordDTO;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
......@@ -15,7 +12,11 @@ import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dao.JoinGroupCipherDao;
import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import com.pcloud.book.group.dto.GroupQrcodeDTO;
import com.pcloud.book.group.dto.JoinGroupCipherDTO;
import com.pcloud.book.group.dto.PushAddUserMessageDTO;
import com.pcloud.book.group.entity.AppTouchRecord;
import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.enums.TouchTypeEnum;
......@@ -28,6 +29,7 @@ import com.pcloud.book.keywords.dao.BookGuideReplyDao;
import com.pcloud.book.keywords.dao.KeywordDao;
import com.pcloud.book.keywords.dto.GuideDTO;
import com.pcloud.book.keywords.dto.KeywordDTO;
import com.pcloud.book.keywords.dto.KeywordStatusDTO;
import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
import com.pcloud.book.keywords.entity.BookGuide;
import com.pcloud.book.keywords.entity.BookGuideReply;
......@@ -37,7 +39,6 @@ import com.pcloud.book.keywords.vo.GuideVO;
import com.pcloud.book.keywords.vo.ReplyMessageVO;
import com.pcloud.book.keywords.vo.SetGuideVO;
import com.pcloud.book.keywords.vo.UpdateGuideVO;
import com.pcloud.book.util.properties.BookProps;
import com.pcloud.book.weixinclock.dao.WeixinClockGroupClassifyDao;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
......@@ -46,7 +47,6 @@ import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.wechatgroup.message.dto.AgreeAddUserDTO;
import com.sdk.wxgroup.AddToGroupVO;
import com.sdk.wxgroup.SendGroupInviteVO;
import com.sdk.wxgroup.SendMessageTypeEnum;
import com.sdk.wxgroup.SendTextMessageVO;
......@@ -93,10 +93,6 @@ public class BookGuideBizImpl implements BookGuideBiz {
@Autowired
private AppTouchRecordDao appTouchRecordDao;
@Autowired
private BookClockCheck bookClockCheck;
@Autowired
private BookClockKeywordDao bookClockKeywordDao;
@Autowired
private GroupQrcodeDao groupQrcodeDao;
@Autowired
private BookGroupClassifyDao bookGroupClassifyDao;
......@@ -124,7 +120,12 @@ public class BookGuideBizImpl implements BookGuideBiz {
}
final JoinGroupCipherDTO dto = joinGroupCipherDao.getDTOByCipher(cipher);
//获取群
final String wxGroupId = bookGroupClassifyBiz.getWxGroupIdByClassifyIdAndWechatId(dto.getClassifyId(), dto.getWechatUserId());
final GroupQrcodeBaseInfoVO wxGroup = bookGroupClassifyBiz.getWxGroupIdByClassifyIdAndWechatId(dto.getClassifyId(), dto.getWechatUserId());
if (null == wxGroup) {
log.error("[同意加好友发送欢迎语] : bookGroupClassifyBiz.getWxGroupIdByClassifyIdAndWechatId dto:{}");
throw new BookBizException(BookBizException.ID_NOT_EXIST, "群不存在");
}
String wxGroupId = wxGroup.getWeixinGroupId();
if (agreeAddUserDTO.getFirst() != null && agreeAddUserDTO.getFirst()) {
// 如果是第一次就只发欢迎文案
SendTextMessageVO vo = new SendTextMessageVO();
......@@ -146,17 +147,18 @@ public class BookGuideBizImpl implements BookGuideBiz {
//发关键词列表
SendWeixinRequestTools.sendKeywordsInfoToSelf(keywords, agreeAddUserDTO.getRobotWxId(), agreeAddUserDTO.getUserWxId(), agreeAddUserDTO.getIp());
// 拉群
final Integer peopleCounts = WxGroupSDK.getPeopleCounts(wxGroupId, agreeAddUserDTO.getRobotWxId(), agreeAddUserDTO.getIp());
// final Integer peopleCounts = wxGroup.getUserNumber();
// 邀请好友进群有次数限制,目前测试为每天只能拉30-40人就操作频繁,所以在此加判断,超过30人或者群人数超过30人就发送邀请链接
final String num = JedisClusterUtils.get(BookConstant.WXGROUP_ADD_USER_NUM + agreeAddUserDTO.getRobotWxId());
log.info("[同意加好友发送欢迎语] 拉群 agreeAddUserDTO:{}, wxGroupId:{}, peopleCounts:{}, num:{}", agreeAddUserDTO, wxGroupId, peopleCounts, num);
log.info("[同意加好友发送欢迎语] 拉群 agreeAddUserDTO:{}, wxGroup:{}, num:{}", agreeAddUserDTO, wxGroup, num);
if (StringUtil.isBlank(wxGroupId)) {
log.info("[同意加好友发送欢迎语] 拉群 没有找到群 bookGroupClassifyBiz.getGroupQrcode4ClassifyWechat JoinGroupCipherDTO :{}", dto);
return;
}
// 1001666 刘娜需求-1v1客服机器人,不直接拉人,30人以下也发邀请链接
// 生产环境限制30,其它5和10,全部使用群链接
final boolean isPro = "pro".equalsIgnoreCase(BookProps.getSystemEnv());
if ((!StringUtil.isBlank(num) && Integer.parseInt(num) >= (isPro ? 30 : 5)) || peopleCounts >= (isPro ? 30 : 10)) {
// final boolean isPro = "pro".equalsIgnoreCase(BookProps.getSystemEnv());
// if ((!StringUtil.isBlank(num) && Integer.parseInt(num) >= (isPro ? 30 : 5)) || peopleCounts >= (isPro ? 30 : 10)) {
SendGroupInviteVO sendGroupInviteVO = new SendGroupInviteVO();
sendGroupInviteVO.setAltId(agreeAddUserDTO.getRobotWxId());
sendGroupInviteVO.setWxId(agreeAddUserDTO.getUserWxId());
......@@ -165,16 +167,16 @@ public class BookGuideBizImpl implements BookGuideBiz {
WxGroupSDK.sendGroupInvite(sendGroupInviteVO);
log.info("[同意加好友发送欢迎语] 发送进群链接 sendGroupInviteVO:{}", sendGroupInviteVO);
// 进群之后更新群qrCodeId
updateQrcodeForCipher(wxGroupId, cipher, agreeAddUserDTO.getUserWxId());
return;
}
AddToGroupVO vo1 = new AddToGroupVO();
vo1.setWxGroupId(wxGroupId);
vo1.setWxId(agreeAddUserDTO.getUserWxId());
vo1.setAltId(agreeAddUserDTO.getRobotWxId());
vo1.setIp(agreeAddUserDTO.getIp());
log.info("[同意加好友发送欢迎语 拉群] AddToGroupVO :{}", vo1);
WxGroupSDK.addToGroup(vo1);
// updateQrcodeForCipher(wxGroupId, cipher, agreeAddUserDTO.getUserWxId());
// return;
// }
// AddToGroupVO vo1 = new AddToGroupVO();
// vo1.setWxGroupId(wxGroupId);
// vo1.setWxId(agreeAddUserDTO.getUserWxId());
// vo1.setAltId(agreeAddUserDTO.getRobotWxId());
// vo1.setIp(agreeAddUserDTO.getIp());
// log.info("[同意加好友发送欢迎语 拉群] AddToGroupVO :{}", vo1);
// WxGroupSDK.addToGroup(vo1);
// 进群之后更新群qrCodeId
updateQrcodeForCipher(wxGroupId, cipher, agreeAddUserDTO.getUserWxId());
// 拉一次+1
......@@ -371,59 +373,30 @@ public class BookGuideBizImpl implements BookGuideBiz {
Boolean isHaveKeywords = !ListUtils.isEmpty(keywords);
final Boolean groupRobot = wechatGroupConsr.isGroupRobot(robotId);
log.info("[wechatGroupConsr.isGroupRobot] robotId:{} groupRobot:{}", robotId, groupRobot);
//如果设置了群学习报告,加一个群学习报告的关键词
KeywordStatusDTO dto = pushLearningReport(classifyQrcodeInfo, robotId, weixinGroupId, pushAddUserMessageDTO.getIp());
if (ListUtils.isEmpty(replyMessages)) {
//获取群名称
GroupQrcodeBaseInfoVO groupInfo = groupQrcodeBiz.getBaseById(classifyQrcodeInfo.getGroupQrcodeId());
//推送消息 刘娜需求 1001282 群不推送关键词
// 若非之前的机器人则不回复普通关键词
SendWeixinRequestTools.sendDefaultMessage(groupInfo == null ? "" : groupInfo.getGroupName(), robotId, weixinGroupId, isHaveKeywords, pushAddUserMessageDTO.getIp());
SendWeixinRequestTools.sendDefaultMessage(groupInfo == null ? "" : groupInfo.getGroupName(), robotId, weixinGroupId, isHaveKeywords, groupRobot, keywords, dto, pushAddUserMessageDTO.getIp());
} else {
//处理链接
handleUrl(replyMessages, wechatInfo, classifyQrcodeInfo);
//推送消息
SendWeixinRequestTools.sendGuideMessage(replyMessages, robotId, weixinGroupId, pushAddUserMessageDTO.getIp(), SendMessageTypeEnum.GROUP.getCode());
SendWeixinRequestTools.sendGuideMessage(replyMessages, robotId, weixinGroupId, groupRobot, keywords, dto, pushAddUserMessageDTO.getIp(), SendMessageTypeEnum.GROUP.getCode());
//新增欢迎语应用触发记录
addGuideAppTouchRecord(replyMessages,weixinGroupId,classifyQrcodeInfo.getBookGroupId(),classifyQrcodeInfo.getClassifyId());
}
//获取关键词信息(改成10个了)刘娜需求 1001282 群不推送关键词
if (groupRobot) {
SendWeixinRequestTools.sendKeywordsInfo(keywords, robotId, weixinGroupId, pushAddUserMessageDTO.getIp());
}
//如果设置了群学习报告,加一个群学习报告的关键词
pushLearningReport(classifyQrcodeInfo,robotId, weixinGroupId, pushAddUserMessageDTO.getIp());
if (bookGuide != null && bookGuide.getIsRecommend() != null && bookGuide.getIsRecommend() == 1) {
//推送公众号消息
SendWeixinRequestTools.sendAccountMessage(weixinGroupId, bookGuide.getRecommendLanguage(), robotId, wechatInfo, pushAddUserMessageDTO.getIp());
}
//校验该群是否与微信群打卡有关
/*List<Long> bookClockInfoIdList = bookClockCheck.checkGroupIsClock(classifyQrcodeInfo);
if(!ListUtils.isEmpty(bookClockInfoIdList)){
Map<String,Object> paramMap = new HashMap<>();
int i = 0;
List<BookClockKeywordDTO> bookClockKeywordDTOList = new ArrayList<>();
for (Long bookClockInfoId:bookClockInfoIdList) {
i++;
if(i >= 5){
break;
}
paramMap.put("bookClockInfoId",bookClockInfoId);
List<BookClockKeywordDTO> bookClockKeywordDTOS = bookClockKeywordDao.getKeywordsByInfoId(paramMap);
bookClockKeywordDTOList.addAll(bookClockKeywordDTOS);
if(i%2 == 0){
log.info("欢迎语中推送关键词信息,bookClockKeywordDTOList="+bookClockKeywordDTOList);
SendWeixinRequestTools.sendClockKeywordsInfo(bookClockKeywordDTOList, robotId, weixinGroupId, pushAddUserMessageDTO.getIp());
bookClockKeywordDTOList.clear();
}else if(i == bookClockInfoIdList.size()){
SendWeixinRequestTools.sendClockKeywordsInfo(bookClockKeywordDTOList, robotId, weixinGroupId, pushAddUserMessageDTO.getIp());
bookClockKeywordDTOList.clear();
}
}
}*/
}
@ParamLog("推关学习报告/猜谜语关键词消息")
private void pushLearningReport(GroupClassifyQrcodeDTO classifyQrcodeInfo, String robotId, String weixinGroupId, String ip) {
private KeywordStatusDTO pushLearningReport(GroupClassifyQrcodeDTO classifyQrcodeInfo, String robotId, String weixinGroupId, String ip) {
Boolean reportOpen = false;
Boolean riddleOpen = false;
Boolean clockOpen = false;
......@@ -438,26 +411,32 @@ public class BookGuideBizImpl implements BookGuideBiz {
if (null != weixinClockDto && !StringUtil.isEmpty(weixinClockDto.getClockGuide()) && !StringUtil.isEmpty(weixinClockDto.getClockKeyword())) {
clockOpen = true;
}
if (reportOpen && riddleOpen && clockOpen) {
SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值\n" +
"关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666\n" +
"关键词【" + weixinClockDto.getClockKeyword() + "】\n " + weixinClockDto.getClockGuide(), robotId, weixinGroupId, ip);
} else if (reportOpen && riddleOpen) {
SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值\n" +
"关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666", robotId, weixinGroupId, ip);
} else if (reportOpen && clockOpen) {
SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值\n" +
"关键词【" + weixinClockDto.getClockKeyword() + "】\n " + weixinClockDto.getClockGuide(), robotId, weixinGroupId, ip);
} else if (riddleOpen && clockOpen) {
SendWeixinRequestTools.sendTextMessage("关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666" +
"关键词【" + weixinClockDto.getClockKeyword() + "】\n " + weixinClockDto.getClockGuide(), robotId, weixinGroupId, ip);
} else if (clockOpen) {
SendWeixinRequestTools.sendTextMessage("关键词【" + weixinClockDto.getClockKeyword() + "】\n " + weixinClockDto.getClockGuide(), robotId, weixinGroupId, ip);
} else if (reportOpen) {
SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值", robotId, weixinGroupId, ip);
} else if (riddleOpen) {
SendWeixinRequestTools.sendTextMessage("关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666", robotId, weixinGroupId, ip);
}
KeywordStatusDTO dto = new KeywordStatusDTO();
dto.setReportOpen(reportOpen);
dto.setRiddleOpen(riddleOpen);
dto.setClockOpen(clockOpen);
dto.setClockKeyword(null == weixinClockDto ? StringUtil.EMPTY : weixinClockDto.getClockKeyword());
return dto;
// if (reportOpen && riddleOpen && clockOpen) {
// SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值\n" +
// "关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666\n" +
// "关键词【" + weixinClockDto.getClockKeyword() + "】\n " + weixinClockDto.getClockGuide(), robotId, weixinGroupId, ip);
// } else if (reportOpen && riddleOpen) {
// SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值\n" +
// "关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666", robotId, weixinGroupId, ip);
// } else if (reportOpen && clockOpen) {
// SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值\n" +
// "关键词【" + weixinClockDto.getClockKeyword() + "】\n " + weixinClockDto.getClockGuide(), robotId, weixinGroupId, ip);
// } else if (riddleOpen && clockOpen) {
// SendWeixinRequestTools.sendTextMessage("关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666" +
// "关键词【" + weixinClockDto.getClockKeyword() + "】\n " + weixinClockDto.getClockGuide(), robotId, weixinGroupId, ip);
// } else if (clockOpen) {
// SendWeixinRequestTools.sendTextMessage("关键词【" + weixinClockDto.getClockKeyword() + "】\n " + weixinClockDto.getClockGuide(), robotId, weixinGroupId, ip);
// } else if (reportOpen) {
// SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值", robotId, weixinGroupId, ip);
// } else if (riddleOpen) {
// SendWeixinRequestTools.sendTextMessage("关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666", robotId, weixinGroupId, ip);
// }
}
@Override
......@@ -501,7 +480,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
content += " 欢迎加入" + groupName + "!";
}
if (isHaveKeywords) {
content = content + "本群目的为学习交流和学习辅导,线上资源和工具为图书的增值服务,可根据实际情况配合图书一起使用。以下关键词领取任务或资源:";
content = content + "本群目的为学习交流和学习辅导,线上资源和工具为图书的增值服务,可根据实际情况配合图书一起使用。在群内回复以下关键词领取任务或资源:";
}
replyMessageVO.setContent(content);
replyMessages.add(replyMessageVO);
......
......@@ -13,6 +13,7 @@ import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.biz.GroupQrcodeBiz;
import com.pcloud.book.group.dao.AppTouchRecordDao;
import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookGroupDao;
......@@ -22,6 +23,7 @@ import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import com.pcloud.book.group.dto.JoinGroupCipherDTO;
import com.pcloud.book.group.entity.AppTouchRecord;
import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.enums.QrcodeStatusEnum;
import com.pcloud.book.group.enums.TouchTypeEnum;
import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.group.vo.ClassifyNameVO;
......@@ -46,11 +48,13 @@ import com.pcloud.book.keywords.vo.QrWeixinParam;
import com.pcloud.book.keywords.vo.SetKeywordVO;
import com.pcloud.book.keywords.vo.SetRankVO;
import com.pcloud.book.keywords.vo.UpdateKeywordVO;
import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.channelcenter.base.constants.ChannelEnum;
import com.pcloud.channelcenter.qrcode.service.QrcodeSceneService;
import com.pcloud.channelcenter.qrcode.vo.MessageBookVO;
import com.pcloud.channelcenter.qrcode.vo.QrWeixinParamVO;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.common.constant.CacheConstant;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
......@@ -64,7 +68,10 @@ import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.resourcecenter.product.dto.ProductDto;
import com.pcloud.resourcecenter.product.dto.ProductTypeDto;
import com.pcloud.wechatgroup.group.dto.RobotReplyDTO;
import com.pcloud.wechatgroup.message.dto.SendTextDTO;
import com.sdk.wxgroup.ChangeNameVO;
import com.sdk.wxgroup.SendMessageTypeEnum;
import com.sdk.wxgroup.WxGroupSDK;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.BeanUtils;
......@@ -80,6 +87,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
......@@ -125,12 +133,14 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
private QrcodeSceneService qrcodeSceneService;
@Autowired
private BookGroupBiz bookGroupBiz;
@Autowired
private GroupQrcodeBiz groupQrcodeBiz;
@Override
@ParamLog("新增关键词")
@Transactional(rollbackFor = Exception.class)
public void insertKeyword(SetKeywordVO setKeywordVO) {
if(null == setKeywordVO || setKeywordVO.check()) {
if (null == setKeywordVO || setKeywordVO.check()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "应用/作品信息为空");
}
if (setKeywordVO.getClassifyId() == null) {
......@@ -160,7 +170,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
productConsr.productAutoOnShelves(bookGroupDTO.getChannelId(), productIds);
//新增关键词与分类或者图书的关系
//按群创建
if (setKeywordVO.getSetType() == 1){
if (setKeywordVO.getSetType() == 1) {
BookKeyword bookKeyword = new BookKeyword();
BeanUtils.copyProperties(setKeywordVO, bookKeyword);
bookKeyword.setKeywordId(keyword.getId());
......@@ -176,10 +186,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
bookKeyword.setWarehouseId(warehouseId);
bookKeyword.setIsWarehouse(1);
}
if(null == bookKeyword.getIsWarehouse()){
if (null == bookKeyword.getIsWarehouse()) {
bookKeyword.setIsWarehouse(0);
}
if(null == bookKeyword.getWarehouseId()){
if (null == bookKeyword.getWarehouseId()) {
bookKeyword.setWarehouseId(0L);
}
bookKeyword.setIsEdit(1);
......@@ -221,8 +231,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
// 书入库一遍,同样的就不要入库了
// setKeywordVO.setChannelId(bookGroupDTO.getChannelId());
// final Long warehouseId = bookKeywordWarehouseBiz.addBookKeyword(setKeywordVO);
cKeyword.setWarehouseId(bookKeyword.getWarehouseId());
cKeyword.setIsWarehouse(1);
cKeyword.setWarehouseId(bookKeyword.getWarehouseId());
cKeyword.setIsWarehouse(1);
}
if (null == cKeyword.getIsWarehouse()) {
cKeyword.setIsWarehouse(0);
......@@ -232,7 +242,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
}
if (0 == cKeyword.getClassifyId()) {
cKeyword.setIsEdit(1);
}else {
} else {
cKeyword.setIsEdit(0);
}
bookKeywords.add(cKeyword);
......@@ -246,7 +256,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
}
if (0 == bookKeyword.getClassifyId()) {
bookKeyword.setIsEdit(1);
}else {
} else {
bookKeyword.setIsEdit(0);
}
bookKeywords.add(bookKeyword);
......@@ -292,14 +302,14 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
BeanUtils.copyProperties(updateKeywordVO, v);
if (ChannelEnum.APP.value.equals(updateKeywordVO.getServeType())) {
final AppDto baseById = appConsr.getBaseById(updateKeywordVO.getServeId());
if(null == baseById) {
if (null == baseById) {
throw new BookBizException(BookBizException.ID_NOT_EXIST, "应用不存在");
}
v.setTypeCode(baseById.getTypeCode());
}
if (ChannelEnum.PRODUCT.value.equals(updateKeywordVO.getServeType())) {
final ProductDto proBaseById = productConsr.getProBaseById(updateKeywordVO.getServeId());
if(null == proBaseById) {
if (null == proBaseById) {
throw new BookBizException(BookBizException.ID_NOT_EXIST, "作品不存在");
}
v.setTypeCode(proBaseById.getProductTypeCode());
......@@ -326,17 +336,17 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
@Transactional(rollbackFor = Exception.class)
@ParamLog("删除关键词")
public void deleteKeyword(DeleteKeywordVO deleteKeywordVO, Long partyId) {
if (deleteKeywordVO == null || deleteKeywordVO.getIsEdit() == null || deleteKeywordVO.getKeywordId() == null){
throw new BookBizException(BookBizException.ERROR,"缺少必要参数");
if (deleteKeywordVO == null || deleteKeywordVO.getIsEdit() == null || deleteKeywordVO.getKeywordId() == null) {
throw new BookBizException(BookBizException.ERROR, "缺少必要参数");
}
if (deleteKeywordVO.getClassifyId() == null){
if (deleteKeywordVO.getClassifyId() == null) {
deleteKeywordVO.setClassifyId(0L);
}
if (deleteKeywordVO.getIsEdit() == 1){
if (deleteKeywordVO.getIsEdit() == 1) {
keywordDao.deleteById(deleteKeywordVO.getKeywordId(), partyId);
bookKeywordDao.deleteById(deleteKeywordVO.getKeywordId(), partyId);
}else {
bookKeywordDao.deleteKeywords(deleteKeywordVO.getKeywordId(),deleteKeywordVO.getBookGroupId(),deleteKeywordVO.getClassifyId(),partyId);
} else {
bookKeywordDao.deleteKeywords(deleteKeywordVO.getKeywordId(), deleteKeywordVO.getBookGroupId(), deleteKeywordVO.getClassifyId(), partyId);
}
}
......@@ -372,16 +382,16 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
if ("PRODUCT".equalsIgnoreCase(vo.getServeType())) {
productIds.add(vo.getServeId());
}
if (vo.getIsEdit() == null){
if (vo.getIsEdit() == null) {
vo.setIsEdit(1);
}
}
Map<Long, AppDto> app = Maps.newHashMap();
if(!CollectionUtils.isEmpty(appIds)) {
if (!CollectionUtils.isEmpty(appIds)) {
app = appConsr.mapBaseByIds(appIds);
}
Map<Long, ProductDto> proBasesByIds = Maps.newHashMap();
if(!CollectionUtils.isEmpty(productIds)) {
if (!CollectionUtils.isEmpty(productIds)) {
proBasesByIds = productConsr.getProBasesByIds(productIds);
}
final BookGroupDTO dtoById = bookGroupDao.getDTOById(listKeywordParam.getBookGroupId());
......@@ -426,10 +436,18 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
@Override
@ParamLog("关键词消息回复")
public void sendKeywordMessage(String content, String weixinGroupId, String userWxId, String robotId, String ip, Integer code) {
public void sendKeywordMessage(SendTextDTO sendTextDTO) {
if (Objects.isNull(sendTextDTO)) {
return;
}
// 刘娜需求 1001282 群不推送关键词
if (SendMessageTypeEnum.GROUP.getCode().equals(code)) {
this.sendKeywordMessageToGroup(content, weixinGroupId, userWxId, robotId, ip, code);
final String content = sendTextDTO.getTextContent().trim();
final String userWxId = sendTextDTO.getWechatUserId();
final String ip = sendTextDTO.getIp();
final Integer code = sendTextDTO.getCode();
String robotId = sendTextDTO.getWxId();
if (SendMessageTypeEnum.GROUP.getCode().equals(sendTextDTO.getCode())) {
this.sendKeywordMessageToGroup(sendTextDTO);
return;
}
//个人机器人接收消息的时候,weixinGroupId就是userWxId,也就是用户的id,robotId是接收的机器人的id
......@@ -450,8 +468,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
for (JoinGroupCipherDTO dto : dtos) {
cIds.add(dto.getClassifyId());
bIds.add(dto.getBookGroupId());
classifyToBookGroupMap.put(dto.getClassifyId(),dto.getBookGroupId());
classifyToQrcodeMap.put(dto.getClassifyId(),dto.getQrcodeId());
classifyToBookGroupMap.put(dto.getClassifyId(), dto.getBookGroupId());
classifyToQrcodeMap.put(dto.getClassifyId(), dto.getQrcodeId());
}
final List<Long> classifyIds = Lists.newArrayList(cIds);
List<ReplyKeywordDTO> replyKeywordDTOs = new ArrayList<>();
......@@ -486,7 +504,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
// 处理链接地址
Long classifyId = keywordClassifyIdMap.get(replyKeywordDTO.getKeywordId());
final GroupClassifyQrcodeDTO dto = classifyMap.get(classifyId);
if(null == dto) {
if (null == dto) {
log.info("[关键词消息回复] 分类信息为空 replyKeywordDTO:{}; classifyMap:{}", replyKeywordDTO, classifyMap);
continue;
}
......@@ -527,7 +545,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
for (ReplyKeywordDTO dto : replyKeywordDTOs) {
if (ReplyTypeEnum.APP.value.equals(dto.getReplyType()) || ReplyTypeEnum.LINK.value.equals(dto.getReplyType())) {
sb.append(dto.getKeywords()).append(":").append(dto.getShortLinkUrl()).append("\n");
} else if (ReplyTypeEnum.TEXT.value.equals(dto.getReplyType())){
} else if (ReplyTypeEnum.TEXT.value.equals(dto.getReplyType())) {
sb.append(dto.getKeywords()).append(":").append(dto.getContent()).append("\n");
} else if (ReplyTypeEnum.IMAGE.value.equals(dto.getReplyType())) {
SendWeixinRequestTools.sendKeywordMessage(dto, robotId, userWxId, ip, code);
......@@ -545,7 +563,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
log.info("[关键词消息回复] redisContent:{} insertBookKeywordRecord return", redisContent);
return true;
} else {
JedisClusterUtils.setJson("BOOK:KEYWORD:" + weixinGroupId + "-" + replyKeywordDTO.getKeywordId(), replyKeywordDTO.getKeywordId(), 10);
JedisClusterUtils.setJson("BOOK:KEYWORD:" + weixinGroupId + "-" + replyKeywordDTO.getKeywordId(), replyKeywordDTO.getKeywordId(), 30);
insertBookKeywordRecord(dto, replyKeywordDTO.getKeywordId(), userWxId, weixinGroupId, true);
}
return false;
......@@ -555,11 +573,16 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
* 原有的推送群关键词改为推送个人关键词
*/
@ParamLog("群关键词消息回复")
private void sendKeywordMessageToGroup(String content, String weixinGroupId, String userWxId, String robotId, String ip, Integer code) {
//简单过滤非关键词的词
if (StringUtil.isEmpty(content) || content.length() > 20) {
private void sendKeywordMessageToGroup(SendTextDTO sendTextDTO) {
if (Objects.isNull(sendTextDTO)) {
return;
}
final String content = sendTextDTO.getTextContent().trim();
final String weixinGroupId = sendTextDTO.getWechatGroupId();
final String userWxId = sendTextDTO.getWechatUserId();
final String ip = sendTextDTO.getIp();
final Integer code = sendTextDTO.getCode();
String robotId = sendTextDTO.getWxId();
// 若非之前的机器人则不回复普通关键词
final Boolean groupRobot = wechatGroupConsr.isGroupRobot(robotId);
log.info("[wechatGroupConsr.isGroupRobot] robotId:{} groupRobot:{}", robotId, groupRobot);
......@@ -572,9 +595,13 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
log.info("[关键词消息回复] classifyQrcodeInfo is null");
return;
}
ReplyKeywordDTO replyKeywordDTO ;
//简单过滤非关键词的词
if (StringUtil.isEmpty(content) || content.length() > 20) {
return;
}
ReplyKeywordDTO replyKeywordDTO;
final boolean equals = "群主,来个抽奖".equals(content);
if (equals){
if (equals) {
replyKeywordDTO = keywordDao.getByKeyword("群主,来个抽奖");
} else {
//获取匹配关键词
......@@ -624,6 +651,70 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
}
/**
* 更新群人数
*/
@Override
public void updateGroupPeopleCount(String wxGroupId, Integer memberCount, Integer changeNumber, Long weixinQrcodeId, Long groupQrcodeId) {
log.info("[更新群人数] updateGroupPeopleCount wxGroupId:{} memberCount:{} changeNumber:{} weixinQrcodeId:{} groupQrcodeId:{}", wxGroupId, memberCount, changeNumber, weixinQrcodeId, groupQrcodeId);
if (Objects.isNull(memberCount) || StringUtil.isBlank(wxGroupId)) {
return;
}
String key = CacheConstant.BOOK + "groupPeopleCount:";
String groupPeopleCount = JedisClusterUtils.hget(key, wxGroupId);
log.info("[更新群人数] updateGroupPeopleCount groupPeopleCount:{}", groupPeopleCount);
// 如果没有缓存或者有缓存但是人数与缓存不一致,代表有更新,则更新数据库
final boolean update = StringUtil.isBlank(groupPeopleCount) || (StringUtil.isNotBlank(groupPeopleCount)
&& Integer.parseInt(groupPeopleCount) > 0 && !groupPeopleCount.equals(memberCount + ""));
if (update) {
JedisClusterUtils.hset(key, wxGroupId, memberCount + "");
// 将二维码改为已满群BookKeywordBizImpl
if (memberCount >= changeNumber) {
groupQrcodeDao.changeQrcodeState(groupQrcodeId, QrcodeStatusEnum.OVER_NUMBER.value);
log.info("[更新群人数] 触发更新大于等于状态 wxGroupId:{} memberCount:{} changeNumber:{} weixinQrcodeId:{} groupQrcodeId:{}", wxGroupId, memberCount, changeNumber, weixinQrcodeId, groupQrcodeId);
} else {
groupQrcodeDao.changeQrcodeStateForNotOver(groupQrcodeId, QrcodeStatusEnum.ON_USE.value);
log.info("[更新群人数] 触发更新小于状态 wxGroupId:{} memberCount:{} changeNumber:{} weixinQrcodeId:{} groupQrcodeId:{}", wxGroupId, memberCount, changeNumber, weixinQrcodeId, groupQrcodeId);
}
if (memberCount >= 100) {
groupQrcodeBiz.changeToOverNumber(weixinQrcodeId, groupQrcodeId);
log.info("[更新群人数] 触发更新满群状态 wxGroupId:{} memberCount:{} changeNumber:{} weixinQrcodeId:{} groupQrcodeId:{}", wxGroupId, memberCount, changeNumber, weixinQrcodeId, groupQrcodeId);
groupQrcodeDao.changeQrcodeState(groupQrcodeId, QrcodeStatusEnum.OVER_NUMBER.value);
} else {
groupQrcodeBiz.changeToNotOverNumber(weixinQrcodeId, groupQrcodeId);
log.info("[更新群人数] 触发更新未满群状态 wxGroupId:{} memberCount:{} changeNumber:{} weixinQrcodeId:{} groupQrcodeId:{}", wxGroupId, memberCount, changeNumber, weixinQrcodeId, groupQrcodeId);
}
groupQrcodeBiz.updateGroupCount(wxGroupId, memberCount);
log.info("[成功更新群人数] updateGroupPeopleCount wxGroupId:{} memberCount:{}", wxGroupId, memberCount);
}
}
/**
* 修改群名称
*/
@Override
public void checkGroupName(String weixinGroupId, String groupName, String robotId, String ip) {
log.info("[checkGroupName] weixinGroupId:{} groupName:{} robotId:{} ip:{} groupQrcodeDTO:{}", weixinGroupId, groupQrcodeDao, robotId, ip);
if (StringUtil.isBlank(weixinGroupId) || StringUtil.isBlank(groupName) || StringUtil.isBlank(robotId) || StringUtil.isBlank(ip)) {
return;
}
String key = CacheConstant.BOOK + "CHECKGROUPNAME:";
String s = JedisClusterUtils.hget(key, weixinGroupId);
log.info("[修改群名称] checkGroupName s:{}", s);
if (StringUtil.isBlank(s)) {
ChangeNameVO vo = new ChangeNameVO();
vo.setName(groupName);
vo.setAltId(robotId);
vo.setWxGroupId(weixinGroupId);
vo.setIp(ip);
WxGroupSDK.changeGroupName(vo);
// 改过名之后七天不再改名
JedisClusterUtils.hset(key, weixinGroupId, "1");
JedisClusterUtils.expire(key, 60 * 60 * 24 * 31);
log.info("[修改群名称] checkGroupName vo:{}", vo);
}
}
/**
* 关键词应用触发记录
*/
private void addKeywordAppTouchRecord(ReplyKeywordDTO replyKeywordDTO, String weixinGroupId, Long classifyId, Long bookGroupId) {
......@@ -655,7 +746,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
bookKeywordRecord.setSend(isSend);
if (bookKeywordRecord.getGroupQrcodeId() == null) {
GroupQrcode groupQr = groupQrcodeDao.getGroupQrcodeByGroupId(weixinGroupId);
if (groupQr!=null){
if (groupQr != null) {
bookKeywordRecord.setGroupQrcodeId(groupQr.getId());
}
}
......@@ -724,15 +815,15 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
@Override
public Integer getKeywordCount(Long bookGroupId, Long classifyId) {
if (bookGroupId == null){
if (bookGroupId == null) {
throw new BookBizException(BookBizException.ERROR, "缺少参数bookGroupId");
}
return bookKeywordDao.getKeywordCount(bookGroupId, classifyId);
}
@Override
public List<ServiceResourceDTO> getServiceByWeixinGroup(QrWeixinParam qrWeixinParam,Long classifyId, Long qrcodeId) {
public List<ServiceResourceDTO> getServiceByWeixinGroup(QrWeixinParam qrWeixinParam, Long classifyId, Long qrcodeId) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupId", qrWeixinParam.getBookGroupId());
List<ServiceResourceDTO> serviceResourceDTOS = ResponesUtils.list(bookKeywordDao.listBy(map, "getServiceByWeixinGroup"), ServiceResourceDTO.class);
......@@ -775,7 +866,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
serviceResourceDTOS.removeIf(vo -> (qrWeixinParam.getTypeCode().equals(vo.getTypeCode()) && qrWeixinParam.getServeId().equals(vo.getFromId())));
}
List<ServiceResourceDTO> uniqueResources = serviceResourceDTOS.stream().collect(
Collectors. collectingAndThen(
Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getFromId() + ";" + o.getTypeCode()))), ArrayList::new)
);
return uniqueResources;
......
package com.pcloud.book.keywords.dto;
import lombok.Data;
@Data
public class KeywordStatusDTO {
/**
* 学习报告是否开启
*/
private Boolean reportOpen;
/**
* 猜谜语是否开启
*/
private Boolean riddleOpen;
/**
* 打卡是否开启
*/
private Boolean clockOpen;
/**
* 打卡关键词
*/
private String clockKeyword;
}
......@@ -4,13 +4,19 @@ import com.pcloud.book.clock.biz.BookClockKeywordBiz;
import com.pcloud.book.clock.check.BookClockCheck;
import com.pcloud.book.clock.dto.BookClockInfoDTO;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.biz.GroupQrcodeBiz;
import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import com.pcloud.book.keywords.biz.BookKeywordBiz;
import com.pcloud.book.mq.config.MQTopicConumer;
import com.pcloud.book.riddle.biz.RiddleRecordBiz;
import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.book.weixinclock.biz.WeixinClockBiz;
import com.pcloud.common.constant.CacheConstant;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.wechatgroup.message.dto.SendTextDTO;
import com.sdk.wxgroup.SendMessageTypeEnum;
......@@ -21,6 +27,8 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
/**
......@@ -38,13 +46,13 @@ public class WxGroupSendTextListener {
@Autowired
private WechatGroupConsr wechatGroupConsr;
@Autowired
private BookClockKeywordBiz bookClockKeywordBiz;
@Autowired
private BookClockCheck bookClockCheck;
@Autowired
private RiddleRecordBiz riddleRecordBiz;
@Autowired
private WeixinClockBiz weixinClockBiz;
@Autowired
private GroupQrcodeBiz groupQrcodeBiz;
@Autowired
private BookGroupClassifyBiz bookGroupClassifyBiz;
/**
* 接收微信用户进群消息
......@@ -56,6 +64,8 @@ public class WxGroupSendTextListener {
if (sendTextDTO == null || sendTextDTO.getWechatGroupId() == null || sendTextDTO.getTextContent() == null)
return;
String wechatUserId = sendTextDTO.getWechatUserId();
// 更新群人数和群名称
changeGroupInfo(sendTextDTO);
//校验是否机器人账号
List<String> allRobotWxIds = wechatGroupConsr.listAllRobotWxId();
if (!ListUtils.isEmpty(allRobotWxIds) && !allRobotWxIds.contains(wechatUserId) && !StringUtil.isEmpty(sendTextDTO.getTextContent())) {
......@@ -64,7 +74,7 @@ public class WxGroupSendTextListener {
weixinClockBiz.sendKeywordMessage(sendTextDTO.getTextContent().trim(), wechatUserId, sendTextDTO.getWechatGroupId(), sendTextDTO.getWxId(), sendTextDTO.getIp());
} else {
final long l = System.currentTimeMillis();
bookKeywordBiz.sendKeywordMessage(sendTextDTO.getTextContent().trim(), sendTextDTO.getWechatGroupId(), wechatUserId, sendTextDTO.getWxId(), sendTextDTO.getIp(), sendTextDTO.getCode());
bookKeywordBiz.sendKeywordMessage(sendTextDTO);
log.info("[接收用户发送文本消息] 总耗时:{}ms ", System.currentTimeMillis() - l);
}
//猜谜语
......@@ -75,4 +85,22 @@ public class WxGroupSendTextListener {
}
}
/**
* 更新群人数和群名称
* @param sendTextDTO 群消息DTO
*/
private void changeGroupInfo(SendTextDTO sendTextDTO){
// 异步修改群名称
String finalRobotId = sendTextDTO.getWxId();
ThreadPoolUtils.OTHER_THREAD_POOL.execute(() -> {
final String weixinGroupId = sendTextDTO.getWechatGroupId();
final String ip = sendTextDTO.getIp();
GroupClassifyQrcodeDTO classifyQrcodeInfo = bookGroupClassifyBiz.getClassifyQrcodeInfo(weixinGroupId);
// 处理更新群人数
bookKeywordBiz.updateGroupPeopleCount(weixinGroupId, sendTextDTO.getMemberCount(), classifyQrcodeInfo.getChangeNumber(), classifyQrcodeInfo.getWeixinQrcodeId(), classifyQrcodeInfo.getGroupQrcodeId());
bookKeywordBiz.checkGroupName(weixinGroupId, classifyQrcodeInfo.getGroupName(), finalRobotId, ip);
});
}
}
package com.pcloud.book.riddle.biz;
import com.pcloud.book.riddle.dto.CouponClickDTO;
import com.pcloud.book.riddle.dto.GroupRedisDTO;
import com.pcloud.book.riddle.dto.GroupRiddleDTO;
import com.pcloud.book.riddle.entity.RiddleClickRecord;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.wechatgroup.message.dto.SendTextDTO;
......@@ -67,4 +69,26 @@ public interface RiddleRecordBiz {
* @param groupRedisDTO
*/
public void sendIncorrectMessage(GroupRedisDTO groupRedisDTO);
/**
* 发送优惠券链接
* @param wxGroupId
* @param wxId
* @param ip
*/
public void sendCouponLink(String wxId, String wxGroupId, String ip);
/**
* 礼券点击记录埋点
* @param riddleClickRecord
*/
void addClickTrack(RiddleClickRecord riddleClickRecord);
/**
* 优惠券剩余领取次数
* @param wxGroupId
* @param wechatUserId
* @return
*/
CouponClickDTO getGroupWishCount(String wxGroupId, Long wechatUserId);
}
package com.pcloud.book.riddle.biz.impl;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.biz.GroupQrcodeBiz;
import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.keywords.dao.BookKeywordDao;
import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
import com.pcloud.book.riddle.biz.RiddleRecordBiz;
import com.pcloud.book.riddle.constants.RiddleConstant;
import com.pcloud.book.riddle.dao.RiddleClickRecordDao;
import com.pcloud.book.riddle.dao.RiddleDao;
import com.pcloud.book.riddle.dao.RiddleRecordDao;
import com.pcloud.book.riddle.dao.RiddleReplyDao;
import com.pcloud.book.riddle.dto.CouponClickDTO;
import com.pcloud.book.riddle.dto.GroupRedisDTO;
import com.pcloud.book.riddle.dto.GroupRiddleDTO;
import com.pcloud.book.riddle.dto.UserRankingDTO;
import com.pcloud.book.riddle.entity.Riddle;
import com.pcloud.book.riddle.entity.RiddleClickRecord;
import com.pcloud.book.riddle.entity.RiddleRecord;
import com.pcloud.book.riddle.enums.RiddleClickTypeEnum;
import com.pcloud.book.riddle.enums.RiddleRecordStatusEnum;
import com.pcloud.book.riddle.enums.RiddleReplyTypeEnum;
import com.pcloud.book.riddle.redis.RiddleRedis;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.httpclient.UrlUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.facade.quartz.entity.CallBackParam;
import com.pcloud.facade.quartz.entity.ScheduleJob;
......@@ -33,12 +35,17 @@ import com.sdk.wxgroup.SendMessageTypeEnum;
import com.sdk.wxgroup.SendTextMessageVO;
import com.sdk.wxgroup.WxGroupSDK;
import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -56,7 +63,10 @@ import java.util.TimerTask;
public class RiddleRecordBizImpl implements RiddleRecordBiz {
private static final Logger logger = LoggerFactory.getLogger(RiddleRecordBizImpl.class);
@Value("${wechat.group.link.prefix}")
private String wechatGroupLinkPrefix;
@Value("${system.env}")
private String envStr;
@Autowired
private RiddleDao riddleDao;
@Autowired
......@@ -64,19 +74,15 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
@Autowired
private RiddleReplyDao riddleReplyDao;
@Autowired
private BookGroupClassifyBiz bookGroupClassifyBiz;
@Autowired
private BookKeywordDao bookKeywordDao;
@Autowired
private WechatGroupConsr wechatGroupConsr;
@Autowired
private RiddleRedis riddleRedis;
@Autowired
private GroupQrcodeBiz groupQrcodeBiz;
@Autowired
private GroupQrcodeDao groupQrcodeDao;
@Autowired
private ScheduleService scheduleService;
@Autowired
private RiddleClickRecordDao riddleClickRecordDao;
@Override
......@@ -101,40 +107,16 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
}
}
//历史记录
RiddleRecord riddleRecord = riddleRecordDao.getLastRecordByWxGroupId(wxGroupId);
RiddleRecord riddleRecord = riddleRecordDao.getLastRecordByWxGroupId(wxGroupId, null);
//1该群猜谜语没有记录或已结束
if (null == riddleRecord || (null != riddleRecord && RiddleRecordStatusEnum.end.getCode().equals(riddleRecord.getStatus()))) {
Riddle currentRiddle = null;
Integer finishCount = 0;
if (null != riddleRecord) {
currentRiddle = riddleDao.getById(riddleRecord.getRiddleId());
finishCount = riddleRecord.getFinishCount() == null ? 0 : riddleRecord.getFinishCount();
Integer correctCount = riddleRecordDao.getCorrectCountByGroup(wxGroupId, finishCount);
if (correctCount == 180) {//结束前答对180道,通关次数+1
currentRiddle = null;
finishCount = finishCount + 1;
}
}
if (null == riddleRecord || (null != riddleRecord && ArrayUtils.contains(RiddleRecordStatusEnum.GAME_END, riddleRecord.getStatus()))) {
//1.1关键词“猜谜语” ,游戏开启,计时
if (textContent.equals("猜谜语")) {
startGame(currentRiddle, wxGroupId, wxId, ip, finishCount);
startGame(riddleRecord, wxGroupId, wxId, ip);
}
}
//2猜谜语进行中
else if (null != riddleRecord && !RiddleRecordStatusEnum.end.getCode().equals(riddleRecord.getStatus())) {
//2.1是关键词,不处理
/*Boolean keyWord = false;
GroupClassifyQrcodeDTO classifyQrcodeInfo = bookGroupClassifyBiz.getClassifyQrcodeInfo(wxGroupId);
if (null != classifyQrcodeInfo) {
ReplyKeywordDTO replyKeywordDTO = bookKeywordDao.getKeywordId(classifyQrcodeInfo.getClassifyId(), classifyQrcodeInfo.getBookGroupId(), textContent);
if (null != replyKeywordDTO) {
keyWord = true;
}
}
if (keyWord) {
logger.info("该条信息为关键词,不处理,textContent=" + textContent);
return;
}*/
Integer finishCount = riddleRecord.getFinishCount() == null ? 0 : riddleRecord.getFinishCount();
Long riddleId = riddleRecord.getRiddleId();
Riddle riddle = riddleDao.getById(riddleId);
......@@ -147,23 +129,23 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
insertRecord.setWxGroupId(wxGroupId);
insertRecord.setWxUserId(wxUserId);
insertRecord.setFinishCount(finishCount);
//2.2包含“结束”、“不想玩”,结束游戏
//2.1包含“结束”、“不想玩”,结束游戏
if (textContent.contains("结束") || textContent.contains("不想玩") || textContent.contains("不玩了")) {
endGame(insertRecord, wxGroupId, wxId, ip, riddle.getGrade(), finishCount);
return;
}
//2.3中途参与,上一条答对了发送下一题,否则发送当前题目
//2.2中途参与,上一条答对了发送下一题,否则发送当前题目
if (textContent.equals("猜谜语")) {
midwayIn(riddle, riddleRecord.getCorrect(), wxGroupId, wxId, ip, wxUserId, finishCount);
return;
}
//2.4不知道、提示、答案、正确答案,给提示语
//2.3不知道、提示、答案、正确答案,给提示语
if (textContent.contains("不知道") || textContent.contains("提示") || textContent.contains("答案") || textContent.contains("正确答案")) {
String before = "思考是件有趣的事哦,再想想吧。友情提示:可以问问其他人或者上网查询正确答案哦。";
sendWeixinTextMessage(wxId, wxGroupId, before, ip, wxUserId);
return;
}
//2.5判断答题对错
//2.4判断答题对错
judgeCorrcet(textContent, riddle, insertRecord, wxGroupId, wxId, ip, wxUserId, finishCount);
}
}
......@@ -195,7 +177,7 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
sendTextMessageVO.setAtId(wxUserId);
GroupUserDTO groupUser = wechatGroupConsr.getWxUserInfoByWxUserId(wxUserId);
if (null != groupUser && !StringUtil.isEmpty(groupUser.getNickName())) {
content = "@" + groupUser.getNickName() + "" + content;
content = "@" + groupUser.getNickName() + "" + content;
}
}
sendTextMessageVO.setContent(content);
......@@ -212,7 +194,7 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
if (StringUtil.isEmpty(beforeContent)) {
beforeContent = "接下来请听下一题:";
}
String sendText = beforeContent + riddle.getRiddleContent();
String sendText = beforeContent + riddle.getRiddleContent()+ "\n" + RiddleConstant.rule_notice;
sendWeixinTextMessage(wxId, wxGroupId, sendText, ip, wxUserId);
//添加记录
RiddleRecord insertRecord = new RiddleRecord();
......@@ -243,7 +225,7 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
riddleDTO.setUserNum(participateCountDTO.getUserNum() == 0 ? 0 : participateCountDTO.getUserNum());
riddleDTO.setParticipateCount(participateCountDTO.getParticipateCount() == 0 ? 0 : participateCountDTO.getParticipateCount());
}
RiddleRecord riddleRecord = riddleRecordDao.getLastRecordByWxGroupId(riddleDTO.getWxGroupId());
RiddleRecord riddleRecord = riddleRecordDao.getLastRecordByWxGroupId(riddleDTO.getWxGroupId(), null);
if (null != riddleRecord) {
Riddle riddle = riddleDao.getById(riddleRecord.getRiddleId());
riddleDTO.setGrade(riddle.getGrade());
......@@ -263,19 +245,37 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
/**
* 开启游戏
*/
public void startGame(Riddle currentRiddle, String wxGroupId, String wxId, String ip, Integer finishCount) {
public void startGame(RiddleRecord riddleRecord, String wxGroupId, String wxId, String ip) {
Riddle currentRiddle = null;//要发送的题目
Integer finishCount = 0;//通关次数
Integer correctCount = 0;//答对题数
if (null != riddleRecord) {
finishCount = riddleRecord.getFinishCount() == null ? 0 : riddleRecord.getFinishCount();
//结束取当前题
currentRiddle = riddleDao.getById(riddleRecord.getRiddleId());
if (RiddleRecordStatusEnum.over.getCode().equals(riddleRecord.getStatus())) {//通关结束取下一题
Riddle nextRiddle = riddleDao.getRiddleByGradeAndSeq(currentRiddle.getGrade(), currentRiddle.getSeq());
if (null == nextRiddle && currentRiddle.getGrade() < 3) {//从下一关第一题开始
nextRiddle = riddleDao.getRiddleByGradeAndSeq(currentRiddle.getGrade() + 1, 0);
}
currentRiddle = nextRiddle;
}
correctCount = riddleRecordDao.getCorrectCountByGroup(wxGroupId, finishCount);
Integer total = riddleDao.getCount();
if (correctCount.equals(total)) {//结束前答对所有题,通关次数+1
currentRiddle = null;
finishCount = finishCount + 1;
correctCount = 0;
}
}
//发送规则
String reply = getRandomReply(RiddleReplyTypeEnum.rule.getCode());
Integer correctCount = riddleRecordDao.getCorrectCountByGroup(wxGroupId, finishCount);
if (null != currentRiddle) {
reply = reply + "\n" + "目前处于第" + currentRiddle.getGrade() + "关,已猜对" + correctCount + "题,大家加油。";
} else {
reply = reply + "\n" + "目前处于第1关,已猜对0题,大家加油。";
}
Integer ranking = riddleRecordDao.getGroupRanking(wxGroupId);
reply = reply + "\n" + "目前本群总共猜对" + correctCount + "题,群排名第" + ranking + "名,大家加油。";
sendWeixinTextMessage(wxId, wxGroupId, reply, ip, null);
//发送题目,保存该题目
if (null != currentRiddle) {//发送上次题目
String content = "请听题:" + currentRiddle.getRiddleContent();
String content = "请听题:" + currentRiddle.getRiddleContent() + "\n" + RiddleConstant.rule_notice;
sendWeixinTextMessage(wxId, wxGroupId, content, ip, null);
RiddleRecord insertRecord = new RiddleRecord();
insertRecord.setRiddleId(currentRiddle.getId());
......@@ -290,10 +290,9 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
} else {//从第一题开始
sendNextRiddle(1, 0, wxGroupId, wxId, ip, RiddleRecordStatusEnum.begin, "请听题:", null, finishCount);
}
//开始5分钟/10s计时
//开始5分钟计时
deleteJob(wxGroupId);
addEndQuartzJob(wxGroupId, wxId, ip, wxId);
riddleRedis.addUnderwayGroup(wxGroupId, wxId, ip);
}
/**
......@@ -301,7 +300,8 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
*/
public void endGame(RiddleRecord insertRecord, String wxGroupId, String wxId, String ip, Integer grade, Integer finishCount) {
Integer correctCount = riddleRecordDao.getCorrectCountByGroup(wxGroupId, finishCount);
String text = "好嘞,再见,爱你们哦。目前本群猜对谜语数" + correctCount + "道,处于第" + grade + "关,大家加油。";
Integer ranking = riddleRecordDao.getGroupRanking(wxGroupId);
String text = "好嘞,再见,爱你们哦。目前本群总共猜对" + correctCount + "题,群排名第" + ranking + "名,大家加油。";
//发送结束语
sendWeixinTextMessage(wxId, wxGroupId, text, ip, null);
//保存结束记录
......@@ -310,7 +310,6 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
insertRecord.setCorrect(null);
riddleRecordDao.insert(insertRecord);
deleteJob(wxGroupId);
riddleRedis.deleteUnderwayGroup(wxGroupId);
}
/**
......@@ -324,11 +323,12 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
if (riddle.getGrade() < 3) {//从下一关第一题开始
sendNextRiddle(riddle.getGrade() + 1, 0, wxGroupId, wxId, ip, RiddleRecordStatusEnum.underway, beforeContent, wxUserId, finishCount);
} else {//3关都答完,从头开始
sendNextRiddle(1, 0, wxGroupId, wxId, ip, RiddleRecordStatusEnum.begin, beforeContent, wxUserId, finishCount + 1);
sendNextRiddle(1, 0, wxGroupId, wxId, ip, RiddleRecordStatusEnum.underway, beforeContent, wxUserId, finishCount + 1);
}
}
} else {
sendWeixinTextMessage(wxId, wxGroupId, beforeContent + riddle.getRiddleContent(), ip, wxUserId);
} else {//发送当前题
String content = beforeContent + riddle.getRiddleContent() + "\n" + RiddleConstant.rule_notice;
sendWeixinTextMessage(wxId, wxGroupId, content, ip, wxUserId);
}
deleteJob(wxGroupId);
addEndQuartzJob(wxGroupId, wxId, ip, wxId);
......@@ -343,24 +343,45 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
return;
}
if (textContent.equals(riddle.getAnswer()) || textContent.equals(riddle.getOtherAnswer())) {//答对
//答对文案
String beforeContent = getRandomReply(RiddleReplyTypeEnum.correct.getCode());
//保存答题记录
insertRecord.setMessageContent(textContent);
insertRecord.setCorrect(true);
insertRecord.setStatus(RiddleRecordStatusEnum.underway.getCode());
riddleRecordDao.insert(insertRecord);
//发送下一题
Boolean sendNext = sendNextRiddle(riddle.getGrade(), riddle.getSeq(), wxGroupId, wxId, ip, RiddleRecordStatusEnum.underway, beforeContent, wxUserId, finishCount);
if (!sendNext) {//本关没有下一题
if (riddle.getGrade() < 3) {//从下一关第一题开始
sendNextRiddle(riddle.getGrade() + 1, 0, wxGroupId, wxId, ip, RiddleRecordStatusEnum.underway, beforeContent, wxUserId, finishCount);
} else {//3关都答完
sendWeixinTextMessage(wxId, wxGroupId, getRandomReply(RiddleReplyTypeEnum.finish_end.getCode()), ip, wxUserId);
//游戏开始的记录
RiddleRecord riddleRecord = riddleRecordDao.getLastRecordByWxGroupId(wxGroupId, RiddleRecordStatusEnum.begin.getCode());
Integer correctCount = riddleRecordDao.getCorrectCountByTime(wxGroupId, riddleRecord.getCreateTime());
//连续答对5题发送成绩单及优惠券并结束游戏
if (correctCount != 0 && correctCount % 5 == 0) {
Integer count = riddleRecordDao.getCorrectCountByGroup(wxGroupId, finishCount);
sendResult(wxId, wxGroupId, ip, count, insertRecord, riddleRecord.getCreateTime(), wxUserId);
sendCouponLink(wxId, wxGroupId, ip);
} else {
//发送下一题
String correctContent = getRandomReply(RiddleReplyTypeEnum.correct.getCode());
Boolean sendNext = sendNextRiddle(riddle.getGrade(), riddle.getSeq(), wxGroupId, wxId, ip, RiddleRecordStatusEnum.underway, correctContent, wxUserId, finishCount);
if (!sendNext) {//本关没有下一题
if (riddle.getGrade() < 3) {//从下一关第一题开始
sendNextRiddle(riddle.getGrade() + 1, 0, wxGroupId, wxId, ip, RiddleRecordStatusEnum.underway, correctContent, wxUserId, finishCount);
} else {//3关都答完
String content = getRandomReply(RiddleReplyTypeEnum.finish_end.getCode()) + "\n\n回复关键词“猜谜语”,可重新开始游戏。";
sendWeixinTextMessage(wxId, wxGroupId, content, ip, wxUserId);
sendCouponLink(wxId, wxGroupId, ip);
//结束游戏
RiddleRecord insert = new RiddleRecord();
BeanUtils.copyProperties(insertRecord, insert);
insert.setMessageContent(content);
insert.setStatus(RiddleRecordStatusEnum.over.getCode());
insert.setCorrect(null);
insert.setWxUserId(wxId);
riddleRecordDao.insert(insert);
}
}
deleteJob(wxGroupId);
addEndQuartzJob(wxGroupId, wxId, ip, wxUserId);
}
deleteJob(wxGroupId);
addEndQuartzJob(wxGroupId, wxId, ip, wxUserId);
} else if (riddle.getAnswer().contains(textContent) || textContent.contains(riddle.getAnswer())//部分答对
|| (!StringUtil.isEmpty(riddle.getOtherAnswer()) && textContent.contains(riddle.getOtherAnswer()))) {
//保存答题记录
......@@ -370,6 +391,7 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
riddleRecordDao.insert(insertRecord);
//发送部分答对文案
String beforeContent = getRandomReply(RiddleReplyTypeEnum.partly_correct.getCode());
beforeContent = beforeContent + "谜底是" + riddle.getAnswer().length() + "个字哦。";
sendWeixinTextMessage(wxId, wxGroupId, beforeContent, ip, null);
} else {//答错
......@@ -390,7 +412,7 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
* 自动结束
*/
public void autoEnd(String wxGroupId, String wxId, String ip, String wxUserId) {
RiddleRecord riddleRecord = riddleRecordDao.getLastRecordByWxGroupId(wxGroupId);
RiddleRecord riddleRecord = riddleRecordDao.getLastRecordByWxGroupId(wxGroupId, null);
if (null == riddleRecord) {
logger.info("微信群=" + wxGroupId + "没有猜谜语游戏记录");
return;
......@@ -401,11 +423,13 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
logger.info("谜语=" + riddleId + "不存在");
return;
}
Integer grade = riddle.getGrade();
Integer correctCount = riddleRecordDao.getCorrectCountByGroup(wxGroupId, riddleRecord.getFinishCount());
Integer ranking = riddleRecordDao.getGroupRanking(wxGroupId);
String reply = getRandomReply(RiddleReplyTypeEnum.no_reply_end.getCode());
String text = reply + "目前本群猜对谜语数" + correctCount + "道,处于第" + grade + "关。"
+ "\n" + "大家想玩记得回复关键词“猜谜语”,我等你们哦。";
String text = reply + "目前本群总共猜对" + correctCount + "题,群排名第" + ranking + "名,大家加油。";
if (!text.contains("关键词")) {
text = text + "想玩记得回复关键词“猜谜语”就可以召唤我啦。";
}
//发送结束语
sendWeixinTextMessage(wxId, wxGroupId, text, ip, null);
//保存结束记录
......@@ -418,7 +442,6 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
record.setCorrect(null);
record.setFinishCount(riddleRecord.getFinishCount());
riddleRecordDao.insert(record);
riddleRedis.deleteUnderwayGroup(wxGroupId);
}
......@@ -474,7 +497,7 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
return;
}
String wxGroupId = groupRedisDTO.getWxGroupId();
RiddleRecord record = riddleRecordDao.getLastRecordByWxGroupId(wxGroupId);
RiddleRecord record = riddleRecordDao.getLastRecordByWxGroupId(wxGroupId, null);
if (null == record) {
return;
}
......@@ -496,6 +519,86 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
}
}
@Override
public void sendCouponLink(String wxId, String wxGroupId, String ip) {
try {
Thread.sleep(1000);
}catch (InterruptedException e){
logger.error("线程休眠失败");
}
String link = "https://wechat666." + getDomain(envStr) + "/groupGuessing/guessing?wxGroupId=" + wxGroupId;
link = UrlUtils.getShortUrl4Own(wechatGroupLinkPrefix + "/link?url=" + URLEncoder.encode(link));
String content = "优惠券领取链接(@所有人均可领取哦):\n" + link;
sendWeixinTextMessage(wxId, wxGroupId, content, ip, null);
}
private String getDomain(String envStr) {
String domain = "5rs.me";
switch (envStr) {
case "dev":
domain = "chubanyun.me";
break;
case "test":
domain = "raysgo.com";
break;
case "uat":
domain = "raysyun.com";
break;
case "pro":
domain = "5rs.me";
break;
}
return domain;
}
/**
* 发送成绩单并结束游戏
* @param wxId
* @param wxGroupId
* @param ip
* @param correctCount
*/
@ParamLog("发送用户成绩单")
private void sendResult(String wxId, String wxGroupId, String ip, Integer correctCount, RiddleRecord record, Date startTime, String wxUserId) {
Integer total = riddleDao.getCount();
String reply;
if (correctCount.equals(total)) {//答对所有题
reply = getRandomReply(RiddleReplyTypeEnum.finish_end.getCode()) + "\n\n回复关键词“猜谜语”,可重新开始游戏。";
sendWeixinTextMessage(wxId, wxGroupId, reply, ip, wxUserId);
} else {
String correctContent = "给你点赞,答对本轮游戏最后一题,现在发成绩单咯,下一轮游戏我们不见不散哦。";
sendWeixinTextMessage(wxId, wxGroupId, correctContent, ip, wxUserId);
Integer ranking = riddleRecordDao.getGroupRanking(wxGroupId);
String before = "目前本群总共猜对" + correctCount + "题,群排名第" + ranking + "名,大家加油。\n" +
"--------------------------------\n本轮成绩如下:\n";
List<UserRankingDTO> rankingDTOS = riddleRecordDao.getUserRanking(wxGroupId, startTime);
if (ListUtils.isEmpty(rankingDTOS)) {
logger.error("查询用户排名失败");
return;
}
String content = "";
for (int i = 0; i < rankingDTOS.size(); i++) {
UserRankingDTO rankingDTO = rankingDTOS.get(i);
GroupUserDTO groupUser = wechatGroupConsr.getWxUserInfoByWxUserId(rankingDTO.getWxUserId());
int rank = i + 1;
if (rank == 1) {
content = "第1名:" + rankingDTO.getCount() + "分,@" + groupUser.getNickName() + ",恭喜成为本轮的谜语达人。【鼓掌】【鼓掌】【鼓掌】";
} else {
content = content + "\n第" + rank + "名," + rankingDTO.getCount() + "分,@" + groupUser.getNickName();
}
}
reply = before + content + "\n\n回复关键词“猜谜语”可继续游戏哦。";
sendWeixinTextMessage(wxId, wxGroupId, reply, ip, null);
}
//结束游戏
RiddleRecord insertRecord = new RiddleRecord();
BeanUtils.copyProperties(record, insertRecord);
insertRecord.setMessageContent(reply);
insertRecord.setStatus(RiddleRecordStatusEnum.over.getCode());
insertRecord.setCorrect(null);
insertRecord.setWxUserId(wxId);
riddleRecordDao.insert(insertRecord);
deleteJob(wxGroupId);
}
/**
* 10s后发送答错文案
......@@ -517,4 +620,29 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
}
}
@Override
public void addClickTrack(RiddleClickRecord riddleClickRecord) {
if (RiddleClickTypeEnum.wish.getCode().equals(riddleClickRecord.getClickType())) {
Integer totalCount = riddleRecordDao.getOverTime(riddleClickRecord.getWxGroupId());
Integer useCount = riddleClickRecordDao.getCountByType(riddleClickRecord.getWxGroupId(), riddleClickRecord.getWechatUserId(), RiddleClickTypeEnum.wish.getCode());
if (useCount >= totalCount) {
throw new BookBizException(BookBizException.ERROR, "抽奖次数已使用完");
}
}
riddleClickRecordDao.insert(riddleClickRecord);
}
@Override
public CouponClickDTO getGroupWishCount(String wxGroupId, Long wechatUserId) {
Integer totalCount = riddleRecordDao.getOverTime(wxGroupId);
Integer useCount = riddleClickRecordDao.getCountByType(wxGroupId, wechatUserId, RiddleClickTypeEnum.wish.getCode());
Integer remainCount = 0;
if (useCount < totalCount) {
remainCount = totalCount - useCount;
}
CouponClickDTO dto = new CouponClickDTO();
dto.setTotalCount(totalCount);
dto.setRemainCount(remainCount);
return dto;
}
}
package com.pcloud.book.riddle.dao;
import com.pcloud.book.riddle.entity.RiddleClickRecord;
import com.pcloud.common.core.dao.BaseDao;
/**
* @描述:点击记录
* @作者:zhuyajie
* @创建时间:18:27 2019/8/29
* @版本:1.0
*/
public interface RiddleClickRecordDao extends BaseDao<RiddleClickRecord> {
/**
* 根据类型查使用次数
* @param wxGroupId
* @param wechatUserId
* @param code
* @return
*/
Integer getCountByType(String wxGroupId, Long wechatUserId, Integer code);
}
......@@ -19,4 +19,10 @@ public interface RiddleDao extends BaseDao<Riddle> {
* @return
*/
Riddle getRiddleByGradeAndSeq(Integer grade, Integer seq);
/**
* 获取所有题目数量
* @return
*/
Integer getCount();
}
package com.pcloud.book.riddle.dao;
import com.pcloud.book.riddle.dto.GroupRiddleDTO;
import com.pcloud.book.riddle.dto.UserRankingDTO;
import com.pcloud.book.riddle.entity.RiddleRecord;
import com.pcloud.common.core.dao.BaseDao;
import java.util.Date;
import java.util.List;
/**
* @描述:猜谜记录
* @作者:zhuyajie
......@@ -16,9 +20,10 @@ public interface RiddleRecordDao extends BaseDao<RiddleRecord> {
/**
* 获取上一条猜谜记录
* @param wxGroupId
* @param status 状态
* @return
*/
RiddleRecord getLastRecordByWxGroupId(String wxGroupId);
RiddleRecord getLastRecordByWxGroupId(String wxGroupId, Integer status);
/**
* 获得答对题目数量
......@@ -33,4 +38,39 @@ public interface RiddleRecordDao extends BaseDao<RiddleRecord> {
* @return
*/
public GroupRiddleDTO getParticipateCount(String wxGroupId);
/**
* 获得群排名
* @param wxGroupId
* @return
*/
public Integer getGroupRanking(String wxGroupId);
/**
* 获得用户答题排名
* @param wxGroupId
* @return
*/
public List<UserRankingDTO> getUserRanking(String wxGroupId, Date createTime);
/**
* 根据时间查答对题数
* @param wxGroupId
* @param createTime
* @return
*/
public Integer getCorrectCountByTime(String wxGroupId, Date createTime);
/**
* 连答对5题过关次数
* @param wxGroupId
* @return
*/
public Integer getOverTime(String wxGroupId);
/**
* 获得答对过题目群数
* @return
*/
public Integer getCorrectGroupCount();
}
package com.pcloud.book.riddle.dao.impl;
import com.pcloud.book.riddle.dao.RiddleClickRecordDao;
import com.pcloud.book.riddle.entity.RiddleClickRecord;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* @描述:点击记录
* @作者:zhuyajie
* @创建时间:18:27 2019/8/29
* @版本:1.0
*/
@Component("riddleClickRecordDao")
public class RiddleClickRecordDaoImpl extends BaseDaoImpl<RiddleClickRecord> implements RiddleClickRecordDao {
@Override
public Integer getCountByType(String wxGroupId, Long wechatUserId, Integer code) {
Map<String, Object> map = new HashMap<>();
map.put("wxGroupId", wxGroupId);
map.put("wechatUserId", wechatUserId);
map.put("type", code);
return getSessionTemplate().selectOne(getStatement("getCountByType"), map);
}
}
......@@ -26,4 +26,9 @@ public class RiddleDaoImpl extends BaseDaoImpl<Riddle> implements RiddleDao {
map.put("seq",seq);
return getSessionTemplate().selectOne(getStatement("getRiddleByGradeAndSeq"),map);
}
@Override
public Integer getCount() {
return getSessionTemplate().selectOne(getStatement("getCount"));
}
}
......@@ -2,12 +2,15 @@ package com.pcloud.book.riddle.dao.impl;
import com.pcloud.book.riddle.dao.RiddleRecordDao;
import com.pcloud.book.riddle.dto.GroupRiddleDTO;
import com.pcloud.book.riddle.dto.UserRankingDTO;
import com.pcloud.book.riddle.entity.RiddleRecord;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
......@@ -21,8 +24,11 @@ public class RiddleRecordDaoImpl extends BaseDaoImpl<RiddleRecord> implements Ri
@Override
public RiddleRecord getLastRecordByWxGroupId(String wxGroupId) {
return getSessionTemplate().selectOne(getStatement("getLastRecordByWxGroupId"), wxGroupId);
public RiddleRecord getLastRecordByWxGroupId(String wxGroupId, Integer status) {
Map<String, Object> map = new HashMap<>();
map.put("wxGroupId", wxGroupId);
map.put("status", status);
return getSessionTemplate().selectOne(getStatement("getLastRecordByWxGroupId"), map);
}
@Override
......@@ -37,4 +43,39 @@ public class RiddleRecordDaoImpl extends BaseDaoImpl<RiddleRecord> implements Ri
public GroupRiddleDTO getParticipateCount(String wxGroupId) {
return getSessionTemplate().selectOne(getStatement("getParticipateCount"), wxGroupId);
}
@Override
public Integer getGroupRanking(String wxGroupId) {
Integer ranking = getSessionTemplate().selectOne(getStatement("getGroupRanking"), wxGroupId);
if (null == ranking) {
ranking = getCorrectGroupCount() + 1;
}
return ranking;
}
@Override
public List<UserRankingDTO> getUserRanking(String wxGroupId, Date createTime) {
Map<String, Object> map = new HashMap<>();
map.put("wxGroupId", wxGroupId);
map.put("createTime", createTime);
return getSessionTemplate().selectList(getStatement("getUserRanking"),map);
}
@Override
public Integer getCorrectCountByTime(String wxGroupId, Date createTime) {
Map<String, Object> map = new HashMap<>();
map.put("wxGroupId", wxGroupId);
map.put("createTime", createTime);
return getSessionTemplate().selectOne(getStatement("getCorrectCountByTime"), map);
}
@Override
public Integer getOverTime(String wxGroupId) {
return getSessionTemplate().selectOne(getStatement("getOverTime"), wxGroupId);
}
@Override
public Integer getCorrectGroupCount() {
return getSessionTemplate().selectOne(getStatement("getCorrectGroupCount"));
}
}
package com.pcloud.book.riddle.dto;
import com.pcloud.common.dto.BaseDto;
/**
* @描述:优惠券领取次数
* @作者:zhuyajie
* @创建时间:14:38 2019/8/30
* @版本:1.0
*/
public class CouponClickDTO extends BaseDto {
/**
* 总次数
*/
private Integer totalCount;
/**
* 剩余次数
*/
private Integer remainCount;
public Integer getTotalCount() {
return totalCount;
}
public void setTotalCount(Integer totalCount) {
this.totalCount = totalCount;
}
public Integer getRemainCount() {
return remainCount;
}
public void setRemainCount(Integer remainCount) {
this.remainCount = remainCount;
}
@Override
public String toString() {
return "CouponClickDTO{" +
"totalCount=" + totalCount +
", remainCount=" + remainCount +
'}';
}
}
package com.pcloud.book.riddle.dto;
import com.pcloud.common.dto.BaseDto;
/**
* @描述:答题排名
* @作者:zhuyajie
* @创建时间:9:52 2019/8/29
* @版本:1.0
*/
public class UserRankingDTO extends BaseDto {
/**
* 数量
*/
private Integer count;
/**
* 用户id
*/
private String wxUserId;
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public String getWxUserId() {
return wxUserId;
}
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId;
}
@Override
public String toString() {
return "UserRankingDTO{" +
"count=" + count +
", wxUserId='" + wxUserId + '\'' +
'}';
}
}
package com.pcloud.book.riddle.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* 点击记录
*/
@ApiModel("猜谜语-埋点")
public class RiddleClickRecord extends BaseEntity{
@ApiModelProperty("微信群id")
private String wxGroupId;
@ApiModelProperty("微信用户id")
private Long wechatUserId;
@ApiModelProperty("点击类型(1点击链接2许愿3奖品立即使用)")
private Integer clickType;
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
@ApiModelProperty("创建时间")
private Date createTime;
public String getWxGroupId() {
return wxGroupId;
}
public void setWxGroupId(String wxGroupId) {
this.wxGroupId = wxGroupId == null ? null : wxGroupId.trim();
}
public Long getWechatUserId() {
return wechatUserId;
}
public void setWechatUserId(Long wechatUserId) {
this.wechatUserId = wechatUserId;
}
public Integer getClickType() {
return clickType;
}
public void setClickType(Integer clickType) {
this.clickType = clickType;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public String toString() {
return "RiddleClickRecord{" +
"wxGroupId='" + wxGroupId + '\'' +
", wechatUserId=" + wechatUserId +
", clickType=" + clickType +
", createTime=" + createTime +
'}';
}
}
\ No newline at end of file
......@@ -2,15 +2,20 @@ package com.pcloud.book.riddle.facade;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.riddle.biz.RiddleRecordBiz;
import com.pcloud.book.riddle.dto.CouponClickDTO;
import com.pcloud.book.riddle.dto.GroupRiddleDTO;
import com.pcloud.book.riddle.dto.RiddleOpenDTO;
import com.pcloud.book.riddle.entity.RiddleClickRecord;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.wechatgroup.message.dto.SendTextDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -39,14 +44,14 @@ public class RiddleFacade {
@Autowired
private RiddleRecordBiz riddleRecordBiz;
@ApiOperation("发送信息")
@ApiOperation(value = "发送信息", httpMethod = "POST")
@PostMapping("sendText")
public ResponseDto<?> sendText(@RequestBody @ApiParam SendTextDTO sendTextDTO){
riddleRecordBiz.riddleProcess(sendTextDTO);
return new ResponseDto<>();
}
@ApiOperation("猜谜语详情列表")
@ApiOperation(value = "猜谜语详情列表",httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "name", required = false, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页", required = true, dataType = "int", paramType = "query"),
......@@ -64,7 +69,7 @@ public class RiddleFacade {
return new ResponseDto<>(pageBean);
}
@ApiOperation("更新猜谜语状态")
@ApiOperation(value = "更新猜谜语状态",httpMethod = "POST")
@PostMapping("updateRiddleOpenStatus")
public ResponseDto<?> updateRiddleOpenStatus(@RequestHeader("token") String token, @RequestBody @ApiParam RiddleOpenDTO riddleOpenDTO) throws PermissionException {
SessionUtil.getToken4Redis(token);
......@@ -79,4 +84,32 @@ public class RiddleFacade {
riddleRecordBiz.updateRiddleOpenStatus(qrcodeId, status);
return new ResponseDto<>();
}
@ApiOperation(value = "添加点击记录",httpMethod = "POST")
@PostMapping("addClickTrack")
public ResponseDto<?> addClickTrack(@CookieValue("userInfo") String userInfo, @RequestBody @ApiParam RiddleClickRecord riddleClickRecord){
if (null == riddleClickRecord){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"参数为空");
}
if (StringUtil.isEmpty(riddleClickRecord.getWxGroupId()) || null == riddleClickRecord.getClickType()){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"参数缺失");
}
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
riddleClickRecord.setWechatUserId(wechatUserId);
riddleRecordBiz.addClickTrack(riddleClickRecord);
return new ResponseDto<>();
}
@ApiOperation(value = "群猜谜语优惠券许愿次数", httpMethod = "GET")
@ApiImplicitParam(name = "wxGroupId", value = "wxGroupId", required = false, dataType = "string", paramType = "query")
@GetMapping("getGroupWishCount4Wechat")
public ResponseDto<CouponClickDTO> getGroupWishCount4Wechat(
@CookieValue("userInfo") String userInfo, @RequestParam(value = "wxGroupId", required = false) String wxGroupId) {
if (StringUtil.isEmpty(wxGroupId)) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少群id");
}
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
CouponClickDTO dto = riddleRecordBiz.getGroupWishCount(wxGroupId,wechatUserId);
return new ResponseDto<>(dto);
}
}
......@@ -51,7 +51,7 @@ public class RiddleRedis {
* 添加答题中的群
* @param wxGroupId
*/
public void addUnderwayGroup(String wxGroupId, String wxId, String ip) {
/*public void addUnderwayGroup(String wxGroupId, String wxId, String ip) {
GroupRedisDTO dto = new GroupRedisDTO();
dto.setWxGroupId(wxGroupId);
dto.setWxId(wxId);
......@@ -66,13 +66,13 @@ public class RiddleRedis {
}
}
JedisClusterUtils.setJsonList(underway_group, list);
}
}*/
/**
* 获取答题中的群
* @return
*/
public List<GroupRedisDTO> getUnderwayGroup() {
/* public List<GroupRedisDTO> getUnderwayGroup() {
List<GroupRedisDTO> list = JedisClusterUtils.getJsonList(underway_group, GroupRedisDTO.class);
if (ListUtils.isEmpty(list)) {
list = new ArrayList<>();
......@@ -85,12 +85,12 @@ public class RiddleRedis {
}
return list;
}
*/
/**
* 删除答题中的群
* @param wxGroupId
*/
public void deleteUnderwayGroup(String wxGroupId) {
/*public void deleteUnderwayGroup(String wxGroupId) {
List<GroupRedisDTO> list = getUnderwayGroup();
if (!ListUtils.isEmpty(list)) {
for (int i = 0; i < list.size() && null != list; i++) {
......@@ -109,6 +109,6 @@ public class RiddleRedis {
list.add(dto);
}
JedisClusterUtils.setJsonList(underway_group, list);
}
}*/
}
......@@ -95,4 +95,13 @@
AND q.weixin_group_id IS NOT NULL
</select>
<select id="getMasterIdsByBookId" parameterType="long" resultType="long">
SELECT DISTINCT
master_id
FROM
advertising_group_tag
WHERE
tag_book_id = #{bookId}
AND group_qrcode_id = 0
</select>
</mapper>
\ No newline at end of file
......@@ -103,7 +103,9 @@
master_name = #{masterName,jdbcType=VARCHAR},
</if>
update_time = NOW(),
login_id = #{loginId},
<if test="loginId != null">
login_id = #{loginId},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
......
......@@ -1640,7 +1640,7 @@
LEFT JOIN
BOOK_FUND BF ON BF.BOOK_ID = A.BOOK_ID AND BF.END_TIME <![CDATA[ > ]]> NOW() AND BF.START_TIME <![CDATA[ < ]]> NOW()
</if>
LEFT JOIN book_auth_info I ON I.BOOK_ID = B.BOOK_ID AND I.ADVISER_ID = #{adviserId}
LEFT JOIN book_auth_info I ON I.BOOK_ID = B.BOOK_ID AND I.ADVISER_ID = #{adviserId} AND I.is_paper_book = 1
WHERE
I.ID IS NULL
<if test="typeCode!=null">
......@@ -1692,4 +1692,59 @@
WHERE
B.BOOK_NAME LIKE CONCAT('%',#{keyword},'%') or B.ISBN LIKE CONCAT('%',#{keyword},'%')
</select>
<select id="listNoAuthGroupBook" resultType="noAuthBookVO" parameterType="map">
SELECT
A.book_id AS bookId,
A.channel_id AS channelId,
A.adviser_id AS adviserId,
B.type_code AS typeCode,
T.type_name AS typeName,
B.isbn,
B.book_name AS bookName,
B.cover_img AS coverImg,
B.serial_number AS serialNumber,
A.templet_id AS templetId
FROM
book_group G
INNER JOIN book B ON G.book_id = B.book_id
AND G.create_user = #{adviserId}
AND G.is_delete = 0
AND B.is_delete = 0
INNER JOIN BOOK_ADVISER A ON A.BOOK_ID = B.BOOK_ID
AND A.ADVISER_ID = #{adviserId}
AND A.IS_DELETE = 0
AND B.IS_DELETE = 0
LEFT JOIN BOOK_TYPE T ON B.TYPE_CODE = T.TYPE_CODE
LEFT JOIN book_auth_info I ON I.BOOK_ID = B.BOOK_ID
AND I.ADVISER_ID = #{adviserId} AND I.is_group_book = 1
WHERE
I.ID IS NULL
<if test="typeCode!=null">
AND
B.TYPE_CODE = #{typeCode}
</if>
<if test="channelId!=null">
AND
G.CHANNEL_ID = #{channelId}
</if>
<if test="name != null">
AND
(B.BOOK_NAME LIKE CONCAT('%', #{name}, '%') OR B.ISBN LIKE CONCAT(#{name},'%'))
</if>
<if test="templetId != null">
AND
A.TEMPLET_ID = #{templetId}
</if>
<if test="secondTempletIds!=null and secondTempletIds.size()>0">
AND
A.SECOND_TEMPLET_ID in
<foreach collection="secondTempletIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
GROUP BY G.book_id, G.channel_id
ORDER BY
G.update_time DESC , G.id DESC
</select>
</mapper>
\ No newline at end of file
......@@ -203,5 +203,9 @@
from book_clock_info where origin_type = 'APP'
</select>
<select id="getAllAttInfoIds" parameterType="map" resultMap="BaseResultMapDTO">
select <include refid="Base_Column_List"/>
from book_clock_info where origin_type = 'APP'
</select>
</mapper>
\ No newline at end of file
......@@ -4,13 +4,14 @@
<insert id="batchInsert" useGeneratedKeys="true" parameterType="java.util.List">
INSERT INTO BOOK_AUTH_CODE (
BOOK_ID, CHANNEL_ID,ADVISER_ID,BATCH_NUM,AUTH_CODE,FULL_CODE,CREATE_TYPE,CREATED_USER, CREATED_DATE
BOOK_ID, CHANNEL_ID,ADVISER_ID,BATCH_NUM,AUTH_CODE,FULL_CODE,CREATE_TYPE,CREATED_USER, CREATED_DATE,IS_PAPER_BOOK,IS_GROUP_BOOK
)
VALUES
<foreach collection="list" item="item" index="index" separator="," >
(#{item.bookId,jdbcType=BIGINT}, #{item.channelId,jdbcType=BIGINT}, #{item.adviserId,jdbcType=BIGINT},
#{item.batchNum,jdbcType=VARCHAR},#{item.authCode,jdbcType=VARCHAR},#{item.fullCode,jdbcType=VARCHAR},
#{item.createType,jdbcType=TINYINT},#{item.adviserId,jdbcType=BIGINT}, NOW())
#{item.createType,jdbcType=TINYINT},#{item.adviserId,jdbcType=BIGINT}, NOW(),#{item.isPaperBook,jdbcType=TINYINT},
#{item.isGroupBook,jdbcType=TINYINT})
</foreach>
</insert>
......@@ -26,6 +27,14 @@
CHANNEL_ID = #{channelId, jdbcType=BIGINT}
AND
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
</select>
<update id="updateUseCount" parameterType="map" flushCache="true">
......@@ -44,6 +53,14 @@
FULL_CODE = #{code}
AND
use_count <![CDATA[ < ]]> #{codeUseCount}
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
</update>
<select id="getIsHaveCode" resultType="Boolean" parameterType="map">
......@@ -59,6 +76,14 @@
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
AND
FULL_CODE = #{code}
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
</select>
<select id="getCodeList" parameterType="map" resultType="com.pcloud.book.copyright.dto.BookAuthCodeDTO">
......@@ -92,6 +117,14 @@
</otherwise>
</choose>
</if>
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
order by created_date desc
</select>
......@@ -117,6 +150,14 @@
created_date createdDate
from book_auth_code
where book_id= #{bookId,jdbcType=BIGINT} and channel_id = #{channelId} and adviser_id = #{adviserId}
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
LIMIT #{currentPage},#{numPerPage}
</select>
......
......@@ -4,12 +4,12 @@
<insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="BookAuthCodeImportRecord">
INSERT INTO BOOK_AUTH_CODE_IMPORT_RECORD (
BOOK_ID, CHANNEL_ID,ADVISER_ID,FILE_NAME,FILE_URL,CREATE_USER, CREATE_TIME
BOOK_ID, CHANNEL_ID,ADVISER_ID,FILE_NAME,FILE_URL,CREATE_USER, CREATE_TIME, is_paper_book, is_group_book
)
VALUES
(#{bookId,jdbcType=BIGINT}, #{channelId,jdbcType=BIGINT}, #{adviserId,jdbcType=BIGINT},
#{fileName,jdbcType=VARCHAR},#{fileUrl,jdbcType=VARCHAR},#{createUser,jdbcType=BIGINT},
NOW())
NOW(), #{isPaperBook}, #{isGroupBook})
</insert>
<select id="importCodeRecord" resultType="importRecordVO" parameterType="map">
......@@ -23,6 +23,14 @@
CHANNEL_ID = #{channelId, jdbcType=BIGINT}
AND
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
</select>
<update id="updateState" parameterType="map">
......
......@@ -17,12 +17,14 @@
<insert id="insert" useGeneratedKeys="true" parameterType="bookAuthInfo">
INSERT INTO BOOK_AUTH_INFO(
BOOK_ID, CHANNEL_ID,ADVISER_ID,PRICE,CODE_USE_COUNT,BUY_URL,CHECK_TYPE, CREATED_USER, CREATED_DATE,LAST_MODIFIED_DATE,OPEN_TIME
BOOK_ID, CHANNEL_ID,ADVISER_ID,PRICE,CODE_USE_COUNT,BUY_URL,CHECK_TYPE, CREATED_USER, CREATED_DATE,LAST_MODIFIED_DATE,OPEN_TIME,
is_paper_book, is_group_book
)
VALUES
(#{bookId,jdbcType=BIGINT}, #{channelId,jdbcType=BIGINT}, #{adviserId,jdbcType=BIGINT},
#{price}, #{codeUseCount,jdbcType=BIGINT}, #{buyUrl}, #{checkType},
#{adviserId,jdbcType=BIGINT}, NOW(), NOW(), NOW())
#{adviserId,jdbcType=BIGINT}, NOW(), NOW(), NOW(),
#{isPaperBook}, #{isGroupBook})
</insert>
<select id="getInfoByBook" resultMap="BookAuthInfoMap" parameterType="map">
......@@ -36,6 +38,14 @@
CHANNEL_ID = #{channelId, jdbcType=BIGINT}
AND
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
</select>
<select id="getIsHaveAuthBook" resultType="Boolean" parameterType="Long">
......@@ -49,6 +59,7 @@
ADVISER_ID = #{_parameter, jdbcType=BIGINT}
</select>
<!-- 获取设置过正版授权的图书 -->
<select id="listHaveSetAuthBook" resultType="haveSetAuthBook" parameterType="map">
SELECT
I.ID,A.BOOK_ID as bookId,
......@@ -68,7 +79,7 @@
<if test="isFundSupport != null">
LEFT JOIN BOOK_FUND BF ON BF.BOOK_ID = A.BOOK_ID AND BF.END_TIME <![CDATA[ > ]]> NOW() AND BF.START_TIME <![CDATA[ < ]]> NOW()
</if>
WHERE 1=1
WHERE I.is_paper_book = 1
<if test="typeCode!=null">
AND
B.TYPE_CODE = #{typeCode}
......@@ -83,7 +94,14 @@
</if>
<if test="name != null">
AND
(B.BOOK_NAME LIKE CONCAT('%', #{name}, '%') OR B.ISBN LIKE CONCAT(#{name},'%'))
((B.BOOK_NAME LIKE CONCAT('%', #{name}, '%') OR B.ISBN LIKE CONCAT(#{name},'%'))
<if test="nameList != null and nameList.size > 0">
<foreach collection="nameList" close=" " separator=" " open=" " item="item">
OR
(B.BOOK_NAME LIKE CONCAT('%', '${item}', '%') OR B.ISBN LIKE CONCAT('${item}','%'))
</foreach>
</if>
)
</if>
<if test="isMainEditor != null">
AND
......@@ -108,6 +126,65 @@
I.LAST_MODIFIED_DATE DESC
</select>
<!-- 获取设置过正版授权的社群书 -->
<select id="listHaveSetAuthGroupBook" resultType="haveSetAuthBook" parameterType="map">
SELECT
I.id,
I.book_id AS bookId,
I.channel_id AS channelId,
I.price,
I.adviser_id AS adviserId,
I.book_status AS bookStatus,
B.isbn,
B.book_name AS bookName,
B.cover_img AS coverImg,
B.serial_number AS serialNumber
FROM
book_auth_info I
INNER JOIN book_adviser A ON A.book_id = I.book_id
AND A.channel_id = I.channel_id
AND A.created_user = I.adviser_id
AND A.is_delete = 0
INNER JOIN book_group G ON G.book_id = I.book_id
AND G.channel_id = I.channel_id
AND G.create_user = I.adviser_id
AND G.is_delete = 0
INNER JOIN book B ON I.book_id = B.book_id
AND B.is_delete = 0
WHERE I.is_group_book = 1
AND I.adviser_id = #{adviserId}
<if test="typeCode!=null">
AND
B.type_code = #{typeCode}
</if>
<if test="bookStatus!=null">
AND
I.book_status = #{bookStatus}
</if>
<if test="channelId!=null">
AND
I.channel_id = #{channelId}
</if>
<if test="name != null">
AND
(B.BOOK_NAME LIKE CONCAT('%', #{name}, '%') OR B.ISBN LIKE CONCAT(#{name},'%'))
</if>
<if test="templetId != null">
AND
A.TEMPLET_ID = #{templetId}
</if>
<if test="secondTempletIds != null and secondTempletIds.size() > 0">
AND
A.SECOND_TEMPLET_ID in
<foreach collection="secondTempletIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
GROUP BY A.BOOK_ID, A.CHANNEL_ID
ORDER BY
I.LAST_MODIFIED_DATE DESC
</select>
<update id="updateBookStatus" parameterType="map" flushCache="true">
UPDATE BOOK_AUTH_INFO
SET
......@@ -131,7 +208,18 @@
LAST_MODIFIED_DATE = NOW(),
LAST_MODIFIED_USER = #{adviserId}
WHERE
BOOK_ID = #{bookId} AND CHANNEL_ID = #{channelId} AND ADVISER_ID = #{adviserId}
BOOK_ID = #{bookId}
AND CHANNEL_ID = #{channelId}
AND ADVISER_ID = #{adviserId}
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
</update>
<update id="updateBaseInfo" parameterType="bookAuthInfo" flushCache="true">
UPDATE BOOK_AUTH_INFO
......@@ -167,6 +255,8 @@
CHANNEL_ID = #{channelId, jdbcType=BIGINT}
AND
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
AND
is_paper_book = 1
</select>
<select id="getTotalNum" resultType="Integer" parameterType="map">
......
......@@ -4,9 +4,9 @@
<insert id="insert" useGeneratedKeys="true" parameterType="bookAuthOrder">
INSERT INTO BOOK_AUTH_ORDER(
BOOK_ID, CHANNEL_ID,ADVISER_ID,WECHAT_USER_ID,MONEY,ACCOUNT_SETTING_ID,ORDER_NUM,PAYMENT_SOURCE, CREATED_USER, CREATED_DATE)
BOOK_ID, CHANNEL_ID,ADVISER_ID,WECHAT_USER_ID,MONEY,ACCOUNT_SETTING_ID,ORDER_NUM,PAYMENT_SOURCE, CREATED_USER, CREATED_DATE, is_paper_book, is_group_book)
VALUES
(#{bookId,jdbcType=BIGINT}, #{channelId,jdbcType=BIGINT}, #{adviserId,jdbcType=BIGINT},
#{wechatUserId}, #{money}, #{accountSettingId}, #{orderNum}, #{paymentSource}, #{adviserId}, NOW())
#{wechatUserId}, #{money}, #{accountSettingId}, #{orderNum}, #{paymentSource}, #{adviserId}, NOW(), #{isPaperBook}, #{isGroupBook})
</insert>
</mapper>
\ No newline at end of file
......@@ -4,10 +4,10 @@
<insert id="insert" useGeneratedKeys="true" parameterType="bookAuthUser">
INSERT INTO BOOK_AUTH_USER(
BOOK_ID, CHANNEL_ID,ADVISER_ID,WECHAT_USER_ID,MONTHS,province,city,IS_AUTH_CODE, CREATED_DATE,CREATED_USER, CREATED_TIME)
BOOK_ID, CHANNEL_ID,ADVISER_ID,WECHAT_USER_ID,MONTHS,province,city,IS_AUTH_CODE, CREATED_DATE,CREATED_USER, CREATED_TIME, is_paper_book, is_group_book)
VALUES
(#{bookId,jdbcType=BIGINT}, #{channelId,jdbcType=BIGINT}, #{adviserId,jdbcType=BIGINT},
#{wechatUserId}, #{months}, #{province}, #{city}, #{isAuthCode},NOW(), #{adviserId}, NOW())
#{wechatUserId}, #{months}, #{province}, #{city}, #{isAuthCode},NOW(), #{adviserId}, NOW(), #{isPaperBook}, #{isGroupBook})
</insert>
<select id="getAuthUserCount" resultType="bookAuthCodeUserVO" parameterType="map">
......@@ -22,6 +22,14 @@
CHANNEL_ID = #{channelId, jdbcType=BIGINT}
AND
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
</select>
<select id="getAuthUserCountByMonth" resultType="bookAuthCodeUserVO" parameterType="map">
......@@ -39,7 +47,6 @@
<if test="monthDate!=null">
AND MONTHS = #{monthDate}
</if>
</select>
......@@ -56,6 +63,14 @@
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
AND
WECHAT_USER_ID = #{wechatUserId}
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
</select>
......@@ -76,6 +91,14 @@
<if test="province!=null">
AND PROVINCE = #{province}
</if>
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
GROUP BY created_date
</select>
......@@ -146,7 +169,35 @@
<if test="province!=null">
AND PROVINCE = #{province}
</if>
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
GROUP BY months
</select>
<select id="checkUserIsHaveAuth" resultType="Boolean" parameterType="map">
SELECT
COUNT(1)
FROM
BOOK_AUTH_USER
WHERE
is_group_book = 1
AND
BOOK_ID = #{bookId, jdbcType=BIGINT}
AND
CHANNEL_ID = #{channelId, jdbcType=BIGINT}
AND
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
AND
WECHAT_USER_ID IN
<foreach collection="wechatUserIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
......@@ -176,7 +176,7 @@
classify_introduce classifyIntroduce,
price,
change_number changeNumber,
create_user
create_user createUser
from
book_group_classify
where
......@@ -331,7 +331,9 @@
c.has_open_learning_report hasOpenLearningReport,
q.weixin_qrcode_id weixinQrcodeId,
q.qrcode_url qrCodeUrl,
g.join_group_type joinGroupType
g.join_group_type joinGroupType,
q.group_name groupName,
c.change_number changeNumber
FROM
book_group_classify c
JOIN book_group_qrcode q ON c.id = q.classify_id
......
......@@ -26,6 +26,10 @@
create_user,create_time,update_time,is_delete,riddle_open
</sql>
<update id="updateGroupCount" parameterType="map">
update book_group_qrcode set user_number = #{userNumber} where weixin_group_id = #{weixinGroupId}
</update>
<update id="updateGroupQrcode" parameterType="map" >
update book_group_qrcode set qrcode_url = #{qrcodeUrl}, update_user = #{updateUser}, update_time = now() where id = #{groupQrcodeId}
</update>
......@@ -176,9 +180,9 @@
and id=#{id}
</select>
<select id="getBaseById" parameterType="Long" resultType="GroupQrcodeBaseInfoVO">
<select id="getBaseById" parameterType="Long" resultType="com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO">
select
id groupQrcodeId, group_name groupName,qrcode_url qrcodeUrl, weixin_group_id as weixinGroupId
id groupQrcodeId, group_name groupName,qrcode_url qrcodeUrl, weixin_group_id as weixinGroupId, user_number userNumber
from
book_group_qrcode
where
......@@ -205,6 +209,8 @@
q.qrcode_state qrcodeState,
q.weixin_group_id weixinGroupId,
q.weixin_qrcode_id weixinQrcodeId,
q.group_name groupName,
q.user_number userNumber,
c.id classifyId
FROM
book_group_qrcode q
......@@ -232,6 +238,16 @@
WHERE id = #{id} and qrcode_state = 1
</update>
<update id="changeQrcodeStateForNotOver" parameterType="map">
update
book_group_qrcode
<set>
qrcode_state = #{qrcodeState},
update_time = now()
</set>
WHERE id = #{id} and qrcode_state = 2
</update>
<resultMap id="GroupQrcodeInfoMap" type="GroupQrcodeInfoDTO" >
<result column="id" property="id" jdbcType="BIGINT" />
......@@ -642,4 +658,10 @@
from book_group_qrcode where classify_id = #{classifyId}
</select>
<select id="getQrcodeByClassifyId" parameterType="long" resultType="com.pcloud.book.group.vo.ClassifyQrcodeVO">
select id, classify_id as classifyId, group_name as groupName, user_number as userNumber, weixin_qrcode_id as weixinQrcodeId,
weixin_group_id weixinGroupId, create_time as createdTime, qrcode_state as qrcodeState, qrcode_url as qrcodeUrl
from book_group_qrcode where classify_id = #{classifyId} and is_delete = 0
</select>
</mapper>
\ No newline at end of file
......@@ -40,7 +40,7 @@
and generation=#{generation}
</if>
<if test="generation==null">
and generation in (1,2)
and generation in (1,2,4)
</if>
LIMIT 1
</select>
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.riddle.dao.impl.RiddleClickRecordDaoImpl" >
<resultMap id="BaseResultMap" type="com.pcloud.book.riddle.entity.RiddleClickRecord" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="wx_group_id" property="wxGroupId" jdbcType="VARCHAR" />
<result column="wechat_user_id" property="wechatUserId" jdbcType="BIGINT" />
<result column="click_type" property="clickType" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, wx_group_id, wechat_user_id, click_type, create_time
</sql>
<insert id="insert" parameterType="com.pcloud.book.riddle.entity.RiddleClickRecord" useGeneratedKeys="true" keyProperty="id">
insert into riddle_click_record (wx_group_id, wechat_user_id,
click_type, create_time)
values (#{wxGroupId,jdbcType=VARCHAR}, #{wechatUserId,jdbcType=BIGINT},
#{clickType,jdbcType=INTEGER}, NOW())
</insert>
<select id="getCountByType" parameterType="map" resultType="integer">
SELECT
COUNT(1)
FROM
riddle_click_record
WHERE
wx_group_id = #{wxGroupId}
AND wechat_user_id = #{wechatUserId}
AND click_type = #{type}
</select>
</mapper>
\ No newline at end of file
......@@ -32,6 +32,12 @@
FROM riddle
WHERE id = #{id}
</select>
<select id="getCount" resultType="integer">
SELECT
COUNT(1)
FROM
riddle
</select>
</mapper>
\ No newline at end of file
......@@ -19,19 +19,22 @@
<insert id="insert" parameterType="com.pcloud.book.riddle.entity.RiddleRecord" useGeneratedKeys="true" keyProperty="id">
insert into riddle_record (id, riddle_id, message_content,
insert into riddle_record (riddle_id, message_content,
wx_group_id, wx_user_id, correct, status,
create_time, finish_count)
values (#{id,jdbcType=BIGINT}, #{riddleId,jdbcType=BIGINT}, #{messageContent,jdbcType=VARCHAR},
values (#{riddleId,jdbcType=BIGINT}, #{messageContent,jdbcType=VARCHAR},
#{wxGroupId,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR}, #{correct,jdbcType=BIT}, #{status},
NOW(), #{finishCount})
</insert>
<select id="getLastRecordByWxGroupId" resultMap="BaseResultMap" parameterType="String">
<select id="getLastRecordByWxGroupId" resultMap="BaseResultMap" parameterType="map">
SELECT
<include refid="Base_Column_List"/>
FROM riddle_record
WHERE wx_group_id = #{wxGroupId}
<if test="status != null">
AND `status`= #{status}
</if>
ORDER BY
create_time DESC, id DESC
LIMIT 1
......@@ -39,13 +42,15 @@
<select id="getCorrectCountByGroup" parameterType="map" resultType="Integer">
SELECT
COUNT(DISTINCT riddle_id)
COUNT(DISTINCT riddle_id,finish_count)
FROM
riddle_record
WHERE
wx_group_id = #{wxGroupId}
AND finish_count = #{finishCount}
AND correct = 1
AND correct = 1
<if test="finishCount != null">
AND finish_count = #{finishCount}
</if>
</select>
<select id="getParticipateCount" parameterType="String" resultType="com.pcloud.book.riddle.dto.GroupRiddleDTO">
......@@ -58,5 +63,80 @@
wx_group_id = #{wxGroupId}
AND correct IS NOT NULL
</select>
<select id="getGroupRanking" parameterType="string" resultType="integer">
SELECT
b.rownum
FROM
(
SELECT
t.wx_group_id,
@rownum := @rownum + 1 AS rownum
FROM
(SELECT @rownum := 0) r,
(
SELECT
wx_group_id
FROM
riddle_record
WHERE
correct = 1
GROUP BY
wx_group_id
ORDER BY
COUNT(DISTINCT riddle_id,finish_count) DESC,
create_time DESC
) AS t
) AS b
WHERE
b.wx_group_id = #{wxGroupId}
</select>
<select id="getUserRanking" parameterType="map" resultType="com.pcloud.book.riddle.dto.UserRankingDTO">
SELECT
COUNT(DISTINCT riddle_id,finish_count) count,
wx_user_id wxUserId
FROM
riddle_record
WHERE
wx_group_id = #{wxGroupId}
AND correct = 1
AND create_time > #{createTime}
GROUP BY
wx_user_id
ORDER BY
COUNT(DISTINCT riddle_id,finish_count) DESC
</select>
<select id="getCorrectCountByTime" resultType="integer" parameterType="map">
SELECT
COUNT(DISTINCT riddle_id,finish_count)
FROM
riddle_record
WHERE
wx_group_id = #{wxGroupId}
AND correct = 1
AND create_time > #{createTime}
</select>
<!--连答对5题过关次数-->
<select id="getOverTime" resultType="integer" parameterType="string">
SELECT
COUNT(1)
FROM
riddle_record
WHERE
wx_group_id = #{wxGroupId}
AND `status` = 3
</select>
<select id="getCorrectGroupCount" resultType="integer">
SELECT
COUNT(DISTINCT wx_group_id)
FROM
riddle_record
WHERE
correct = 1
</select>
</mapper>
\ No newline at end of file
......@@ -35,6 +35,7 @@
<pcloud-common-config.version>2.0.0-SNAPSHOT</pcloud-common-config.version>
<pcloud-common-core.version>2.0.0-SNAPSHOT</pcloud-common-core.version>
<wxgroup-sdk.version>1.1.0-SNAPSHOT</wxgroup-sdk.version>
<pcloud-facade.version>2.0.0-SNAPSHOT</pcloud-facade.version>
</properties>
</profile>
......@@ -49,6 +50,7 @@
<pcloud-common-config.version>2.1.0-SNAPSHOT</pcloud-common-config.version>
<pcloud-common-core.version>2.1.0-SNAPSHOT</pcloud-common-core.version>
<wxgroup-sdk.version>1.0.0-SNAPSHOT</wxgroup-sdk.version>
<pcloud-facade.version>2.1.0-SNAPSHOT</pcloud-facade.version>
</properties>
</profile>
......@@ -62,6 +64,7 @@
<pcloud-common-config.version>2.1.0-RELEASE</pcloud-common-config.version>
<pcloud-common-core.version>2.1.0-RELEASE</pcloud-common-core.version>
<wxgroup-sdk.version>1.0.0-RELEASE</wxgroup-sdk.version>
<pcloud-facade.version>2.1.0-RELEASE</pcloud-facade.version>
</properties>
<!-- 设置默认环境 -->
<activation>
......@@ -79,6 +82,7 @@
<pcloud-common-config.version>2.0.0-SNAPSHOT</pcloud-common-config.version>
<pcloud-common-core.version>2.0.0-SNAPSHOT</pcloud-common-core.version>
<wxgroup-sdk.version>1.0.0-SNAPSHOT</wxgroup-sdk.version>
<pcloud-facade.version>2.1.0-SNAPSHOT</pcloud-facade.version>
</properties>
</profile>
......@@ -92,6 +96,7 @@
<pcloud-common-config.version>2.1.1-RELEASE</pcloud-common-config.version>
<pcloud-common-core.version>2.1.1-RELEASE</pcloud-common-core.version>
<wxgroup-sdk.version>1.1.0-SNAPSHOT</wxgroup-sdk.version>
<pcloud-facade.version>2.1.0-RELEASE</pcloud-facade.version>
</properties>
</profile>
......@@ -102,32 +107,6 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Dalston.SR1</spring-cloud.version>
<pcloud-common-web.version>2.1.0-RELEASE</pcloud-common-web.version>
<!-- book -->
<pcloud-facade-book.version>2.1.0-RELEASE</pcloud-facade-book.version>
<pcloud-facade-usercenter.version>2.1.0-RELEASE</pcloud-facade-usercenter.version>
<pcloud-facade-channelcenter.version>2.1.0-RELEASE</pcloud-facade-channelcenter.version>
<pcloud-facade-resourcecenter.version>2.1.0-RELEASE</pcloud-facade-resourcecenter.version>
<pcloud-facade-analysisengine.version>2.1.0-RELEASE</pcloud-facade-analysisengine.version>
<pcloud-facade-quartz.version>2.1.0-RELEASE</pcloud-facade-quartz.version>
<pcloud-facade-appcenter.version>2.1.0-RELEASE</pcloud-facade-appcenter.version>
<pcloud-facade-settlement.version>2.1.0-RELEASE</pcloud-facade-settlement.version>
<pcloud-facade-message.version>2.1.0-RELEASE</pcloud-facade-message.version>
<pcloud-facade-commoncenter.version>2.1.0-RELEASE</pcloud-facade-commoncenter.version>
<pcloud-facade-comment.version>2.1.0-RELEASE</pcloud-facade-comment.version>
<pcloud-facade-voicemessage.version>2.1.0-RELEASE</pcloud-facade-voicemessage.version>
<pcloud-facade-raystask.version>2.1.0-RELEASE</pcloud-facade-raystask.version>
<pcloud-facade-contentcenter.version>2.1.0-RELEASE</pcloud-facade-contentcenter.version>
<pcloud-facade-tradecenter.version>2.1.0-RELEASE</pcloud-facade-tradecenter.version>
<pcloud-facade-readercenter.version>2.1.0-RELEASE</pcloud-facade-readercenter.version>
<pcloud-facade-labelcenter.version>2.1.0-RELEASE</pcloud-facade-labelcenter.version>
<pcloud-facade-wechatgroup.version>2.1.0-RELEASE</pcloud-facade-wechatgroup.version>
<pcloud-facade-promotion.version>2.1.0-RELEASE</pcloud-facade-promotion.version>
<pcloud-facade-audioapp.version>2.1.0-RELEASE</pcloud-facade-audioapp.version>
<pcloud-facade-videolesson.version>2.1.0-RELEASE</pcloud-facade-videolesson.version>
<pcloud-facade-liveapp.version>2.1.0-RELEASE</pcloud-facade-liveapp.version>
<pcloud-facade-shareimage.version>2.1.0-RELEASE</pcloud-facade-shareimage.version>
<pcloud-facade-convert.version>2.1.0-RELEASE</pcloud-facade-convert.version>
</properties>
<dependencyManagement>
......
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