Commit 1691339b by 阮思源

解决冲突

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