Commit ff1648f3 by 阮思源

Merge branch 'master' of http://begitlab.chubanyun.me/rays/pcloud-book into rsy-feat-1001514

parents f20048be bd1c0493
...@@ -17,6 +17,11 @@ import java.util.Map; ...@@ -17,6 +17,11 @@ import java.util.Map;
public class BookConstant { public class BookConstant {
/** /**
* 微信小号每天拉人次数缓存前缀
*/
public static final String WXGROUP_ADD_USER_NUM = CacheConstant.BOOK + "WXGROUP_ADD_USER_NUM:";
/**
* 图书基础缓存前缀名称 * 图书基础缓存前缀名称
*/ */
public static final String BOOK_CACHE = CacheConstant.BOOK + "BOOK:"; public static final String BOOK_CACHE = CacheConstant.BOOK + "BOOK:";
......
package com.pcloud.book.group.dto;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/12 14:57
**/
public class GroupCipherDTO implements Serializable {
private static final long serialVersionUID = 4254978072223600943L;
@ApiModelProperty("密码")
private String cipher;
@ApiModelProperty("分类id")
private Long classifyId;
@ApiModelProperty("创建人")
private Long wechatUserId;
@ApiModelProperty("使用人微信id")
private String wxId;
@ApiModelProperty("是否使用")
private Boolean hasUsed;
@ApiModelProperty("机器人id")
private String altId;
public String getCipher() {
return cipher;
}
public void setCipher(String cipher) {
this.cipher = cipher;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getWechatUserId() {
return wechatUserId;
}
public void setWechatUserId(Long wechatUserId) {
this.wechatUserId = wechatUserId;
}
public String getWxId() {
return wxId;
}
public void setWxId(String wxId) {
this.wxId = wxId;
}
public Boolean getHasUsed() {
return hasUsed;
}
public void setHasUsed(Boolean hasUsed) {
this.hasUsed = hasUsed;
}
public String getAltId() {
return altId;
}
public void setAltId(String altId) {
this.altId = altId;
}
@Override
public String toString() {
return "GroupCipherDTO{" +
"cipher='" + cipher + '\'' +
", classifyId=" + classifyId +
", wechatUserId=" + wechatUserId +
", wxId='" + wxId + '\'' +
", hasUsed=" + hasUsed +
", altId='" + altId + '\'' +
'}';
}
}
...@@ -54,6 +54,10 @@ public class GroupClassifyQrcodeDTO implements Serializable { ...@@ -54,6 +54,10 @@ public class GroupClassifyQrcodeDTO implements Serializable {
* 是否开启群学习报告 * 是否开启群学习报告
*/ */
private Boolean hasOpenLearningReport; private Boolean hasOpenLearningReport;
/**
* 进群方式:1群二维码,2客服机器人
*/
private Integer joinGroupType;
public Long getBookId() { public Long getBookId() {
return bookId; return bookId;
...@@ -135,6 +139,14 @@ public class GroupClassifyQrcodeDTO implements Serializable { ...@@ -135,6 +139,14 @@ public class GroupClassifyQrcodeDTO implements Serializable {
this.hasOpenLearningReport = hasOpenLearningReport; this.hasOpenLearningReport = hasOpenLearningReport;
} }
public Integer getJoinGroupType() {
return joinGroupType;
}
public void setJoinGroupType(Integer joinGroupType) {
this.joinGroupType = joinGroupType;
}
@Override @Override
public String toString() { public String toString() {
return "GroupClassifyQrcodeDTO{" + return "GroupClassifyQrcodeDTO{" +
...@@ -148,6 +160,7 @@ public class GroupClassifyQrcodeDTO implements Serializable { ...@@ -148,6 +160,7 @@ public class GroupClassifyQrcodeDTO implements Serializable {
", price=" + price + ", price=" + price +
", qrCodeUrl='" + qrCodeUrl + '\'' + ", qrCodeUrl='" + qrCodeUrl + '\'' +
", hasOpenLearningReport=" + hasOpenLearningReport + ", hasOpenLearningReport=" + hasOpenLearningReport +
", joinGroupType=" + joinGroupType +
'}'; '}';
} }
} }
package com.pcloud.book.group.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/7 9:26
**/
@ApiModel("群使用情况模型")
public class GroupUseDTO implements Serializable {
@ApiModelProperty("已使用")
private Integer hasUsed;
@ApiModelProperty("未使用")
private Integer notUsed;
public Integer getHasUsed() {
return hasUsed;
}
public void setHasUsed(Integer hasUsed) {
this.hasUsed = hasUsed;
}
public Integer getNotUsed() {
return notUsed;
}
public void setNotUsed(Integer notUsed) {
this.notUsed = notUsed;
}
@Override
public String toString() {
return "GroupUseDTO{" +
"hasUsed=" + hasUsed +
", notUsed=" + notUsed +
'}';
}
}
package com.pcloud.book.group.dto;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/7 11:23
**/
public class LargeTempletDTO implements Serializable {
private static final long serialVersionUID = -5982946901202138966L;
@ApiModelProperty("大类")
private Integer largeTemplet;
@ApiModelProperty("名称")
private String name;
public Integer getLargeTemplet() {
return largeTemplet;
}
public void setLargeTemplet(Integer largeTemplet) {
this.largeTemplet = largeTemplet;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "LargeTempletDTO{" +
"largeTemplet=" + largeTemplet +
", name='" + name + '\'' +
'}';
}
}
package com.pcloud.book.group.dto;
import java.io.Serializable;
/**
* @author 戴兴
* @description TODO
* @date 2019/8/7 17:13
*/
public class PersonalQrcodeDTO implements Serializable {
private String newQrcodeUrl;
private String oldQrcodeUrl;
public String getNewQrcodeUrl() {
return newQrcodeUrl;
}
public void setNewQrcodeUrl(String newQrcodeUrl) {
this.newQrcodeUrl = newQrcodeUrl;
}
public String getOldQrcodeUrl() {
return oldQrcodeUrl;
}
public void setOldQrcodeUrl(String oldQrcodeUrl) {
this.oldQrcodeUrl = oldQrcodeUrl;
}
@Override
public String toString() {
return "PersonalQrcodeDTO{" +
"newQrcodeUrl='" + newQrcodeUrl + '\'' +
", oldQrcodeUrl='" + oldQrcodeUrl + '\'' +
'}';
}
}
\ No newline at end of file
...@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.PostMapping; ...@@ -13,6 +13,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.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -54,4 +55,8 @@ public interface BookGroupClassifyService { ...@@ -54,4 +55,8 @@ public interface BookGroupClassifyService {
@ApiOperation("过滤被删除的群分类、群二维码") @ApiOperation("过滤被删除的群分类、群二维码")
@PostMapping("filterDeleteId") @PostMapping("filterDeleteId")
ResponseEntity<ResponseDto<List<Long>>> filterDeleteId(@RequestBody List<String >wxGroupIdList); ResponseEntity<ResponseDto<List<Long>>> filterDeleteId(@RequestBody List<String >wxGroupIdList);
@ApiOperation("获取用户支付金额")
@GetMapping("getPayPrice")
ResponseEntity<ResponseDto<BigDecimal>> getPayPrice(@RequestParam("qrcodeId") Long qrcodeId, @RequestParam("wxUserId") String wxUserId);
} }
...@@ -3,12 +3,12 @@ package com.pcloud.book.group.service; ...@@ -3,12 +3,12 @@ package com.pcloud.book.group.service;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.pcloud.book.group.dto.PersonalQrcodeDTO;
import com.pcloud.book.group.dto.GroupCipherDTO;
import com.pcloud.book.group.dto.GroupUseDTO;
import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.pcloud.book.group.dto.BookGroupDTO; import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.dto.StoreFlowInfoDto; import com.pcloud.common.dto.StoreFlowInfoDto;
...@@ -52,4 +52,24 @@ public interface BookGroupService { ...@@ -52,4 +52,24 @@ public interface BookGroupService {
@RequestMapping(value = "getBaseInfoBySceneId",method = RequestMethod.GET) @RequestMapping(value = "getBaseInfoBySceneId",method = RequestMethod.GET)
ResponseEntity<ResponseDto<BookGroupDTO>> getBaseInfoBySceneId(@RequestParam("sceneId")Long sceneId) throws BizException; ResponseEntity<ResponseDto<BookGroupDTO>> getBaseInfoBySceneId(@RequestParam("sceneId")Long sceneId) throws BizException;
@ApiOperation("更新个人二维码")
@RequestMapping(value = "updatePersonQrcode",method = RequestMethod.POST)
void updatePersonQrcode(@RequestBody PersonalQrcodeDTO personalQrcodeDTO) throws BizException;
@ApiOperation("获取暗号状态")
@GetMapping("/getCipherState")
ResponseEntity<ResponseDto<Integer>> getCipherState(@RequestParam("cipher")String cipher) throws BizException;
@ApiOperation("更新暗号状态为已使用")
@GetMapping("/updateCipherStateToUsed")
void updateCipherStateToUsed(@RequestParam("cipher")String cipher, @RequestParam("wxId")String wxId) throws BizException;
@ApiOperation("获取个人二维码方式群已使用和未使用数量")
@PostMapping("/getGroupUse")
ResponseEntity<ResponseDto<GroupUseDTO>> getGroupUse(@RequestBody List<String> altIds) throws BizException;
@ApiOperation("获取暗号基本信息")
@GetMapping("/getJoinGroupCipher")
ResponseEntity<ResponseDto<GroupCipherDTO>> getJoinGroupCipher(@RequestParam("cipher")String cipher) throws BizException;
} }
...@@ -198,4 +198,17 @@ public class BookApplication { ...@@ -198,4 +198,17 @@ public class BookApplication {
public Binding wxGroupLearningReportBind() { public Binding wxGroupLearningReportBind() {
return RabbitMQFactory.bindingExchange(wxGroupLearningReportQueue(), MQTopicProducer.WXGROUP_LEARNING_REPORT); return RabbitMQFactory.bindingExchange(wxGroupLearningReportQueue(), MQTopicProducer.WXGROUP_LEARNING_REPORT);
} }
/**
* 微信个人机器人同意加好友
*/
@Bean
public Queue wxGroupAgreeAddUserQueue() {
return RabbitMQFactory.queueBuilder(MQTopicConumer.WX_AGREE_ADD_USER);
}
@Bean
public Binding wxGroupAgreeAddUserBind() {
return RabbitMQFactory.bindingExchange(wxGroupAgreeAddUserQueue(), MQTopicProducer.WX_AGREE_ADD_USER);
}
} }
package com.pcloud.book.adnews.biz; package com.pcloud.book.adnews.biz;
import com.pcloud.book.adnews.entity.AdNews; import com.pcloud.book.adnews.entity.*;
import com.pcloud.book.adnews.entity.AdNewsSet; import com.pcloud.book.adnews.dto.AdNewsListParam;
import com.pcloud.book.adnews.vo.AdNewsGroupRecordVO;
import com.pcloud.book.adnews.vo.AdNewsMessageStatisticVO;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import java.util.List; import java.util.List;
...@@ -40,10 +42,86 @@ public interface AdNewsBiz { ...@@ -40,10 +42,86 @@ public interface AdNewsBiz {
/** /**
* 获取素材库列表 * 获取素材库列表
*/ */
PageBeanNew<AdNews> getAdNewsList(String title, Long partyId, Integer currentPage, Integer numPerPage); PageBeanNew<AdNews> getAdNewsList(AdNewsListParam adNewsListParam);
/** /**
* 获取编辑已选取的素材库列表 * 获取编辑已选取的素材库列表
*/ */
PageBeanNew<AdNews> getAdNewsChooseList(Long partyId, String title, Boolean hasUsed, Integer currentPage, Integer numPerPage); PageBeanNew<AdNews> getAdNewsChooseList(Long partyId, String title, Boolean hasUsed, Integer currentPage, Integer numPerPage);
/**
* 禁用/允许推送
* @param partyId
* @param adNewsId
* @param hasBan
*/
void saveAdNewsBan( Long partyId, Long adNewsId, Integer hasBan);
/**
* 增加公众号反馈
* @param adNewsWechat
* @return
*/
Long addAdNewsWechat(AdNewsWechat adNewsWechat);
/**
* 获取所有的公众号列表
* @param currentPage
* @param numPerPage
* @return
*/
PageBeanNew<AdNewsWechat> getAdNewsWechatList(Integer currentPage, Integer numPerPage);
/**
* 获取编辑已选择的公众号列表
* @param partyId
* @param currentPage
* @param numPerPage
*/
PageBeanNew<AdNewsWechat> getAdNewsWechatChooseList(Long partyId, Integer currentPage, Integer numPerPage);
/**
* 编辑添加选择的公众号
* @param adNewsWechatIds
* @param partyId
*/
void createAdNewsWechatChooseBatch(List<Long> adNewsWechatIds, Long partyId);
/**
* 编辑移除选择的公众号
* @param adNewsWechatId
* @param partyId
*/
void deleteAdNewsWechatChoose(Long adNewsWechatId, Long partyId);
/**
* 获取早晚报发送记录
* @param partyId
* @param title
* @param beginTime
* @param endTime
* @param proLabelId 专业
* @param depLabelId 深度
* @param purLabelId 目的
* @param currentPage
* @param numPerPage
* @return
*/
PageBeanNew<AdNewsMessageStatisticVO> getAdNewsMessageStatistic(Long partyId, String title, String beginTime, String endTime, Long proLabelId, Long depLabelId, Long purLabelId, Integer currentPage, Integer numPerPage);
/**
* 查询早晚报发送详情
* @param partyId
* @param messageStatisticId
* @return
*/
List<AdNewsGroupRecordVO> getAdNewsGroupRecord(Long partyId, Long messageStatisticId);
/**
* 记录用户点击量
* @param adNewsClickRecord
* @return
*/
Long addAdNewsClickRecord(AdNewsClickRecord adNewsClickRecord);
} }
package com.pcloud.book.adnews.check; package com.pcloud.book.adnews.check;
import com.google.common.base.Enums;
import com.pcloud.book.adnews.entity.AdNewsGroup; import com.pcloud.book.adnews.entity.AdNewsGroup;
import com.pcloud.book.adnews.entity.AdNewsSet; import com.pcloud.book.adnews.entity.AdNewsSet;
import com.pcloud.book.adnews.enums.AdContentFromEnum;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.NumberUtil;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -16,49 +19,52 @@ import org.springframework.stereotype.Component; ...@@ -16,49 +19,52 @@ import org.springframework.stereotype.Component;
public class AdNewsCheck { public class AdNewsCheck {
public void createAdNewsSetCheck(AdNewsSet adNewsSet){ public void createAdNewsSetCheck(AdNewsSet adNewsSet) {
if (adNewsSet==null){ if (adNewsSet == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数错误"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数错误");
} }
if (ListUtils.isEmpty(adNewsSet.getAdNewsGroups())){ if (ListUtils.isEmpty(adNewsSet.getAdNewsGroups())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"发送群分类不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "发送群分类不能为空!");
} }
if (adNewsSet.getSendCount()==null||adNewsSet.getSendCount()<=0){ if (adNewsSet.getSendCount() == null || adNewsSet.getSendCount() <= 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"推送条数不能为空且必须大于0!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "推送条数不能为空且必须大于0!");
} }
if (adNewsSet.getHasMorningOpen()==null){ if (adNewsSet.getHasMorningOpen() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"是否开启早报不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "是否开启早报不能为空!");
} }
if (adNewsSet.getHasEveningOpen()==null){ if (adNewsSet.getHasEveningOpen() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"是否开启晚报不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "是否开启晚报不能为空!");
} }
if (adNewsSet.getHasStartContent()==null){ if (adNewsSet.getHasStartContent() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"是否开启开场语不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "是否开启开场语不能为空!");
} }
if (adNewsSet.getHasEndContent()==null){ if (adNewsSet.getHasEndContent() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"是否开启结束语不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "是否开启结束语不能为空!");
} }
if (adNewsSet.getHasMorningOpen()&&StringUtil.isEmpty(adNewsSet.getMorningTime())){ if (adNewsSet.getHasMorningOpen() && StringUtil.isEmpty(adNewsSet.getMorningTime())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"早报时间不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "早报时间不能为空!");
} }
if (adNewsSet.getHasEveningOpen()&&StringUtil.isEmpty(adNewsSet.getEveningTime())){ if (adNewsSet.getHasEveningOpen() && StringUtil.isEmpty(adNewsSet.getEveningTime())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"晚报时间不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "晚报时间不能为空!");
} }
if (adNewsSet.getHasStartContent()&&StringUtil.isEmpty(adNewsSet.getStartContent())){ if (adNewsSet.getHasStartContent() && StringUtil.isEmpty(adNewsSet.getStartContent())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"开场语不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "开场语不能为空!");
} }
if (adNewsSet.getHasEndContent()&&StringUtil.isEmpty(adNewsSet.getEndContent())){ if (adNewsSet.getHasEndContent() && StringUtil.isEmpty(adNewsSet.getEndContent())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"结束语不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "结束语不能为空!");
} }
for(AdNewsGroup adNewsGroup:adNewsSet.getAdNewsGroups()){ if (adNewsSet.getContentFrom() != AdContentFromEnum.WECHAT.key && adNewsSet.getContentFrom() != AdContentFromEnum.CUSTOM.key) {
if (adNewsGroup==null){ throw new BookBizException(BookBizException.PARAM_IS_ERROR, "请选择早晚报内容来源!");
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"早晚报关联不能为空!");
} }
if (adNewsGroup.getClassifyId()==null){ for (AdNewsGroup adNewsGroup : adNewsSet.getAdNewsGroups()) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"群分类id不能为空!"); if (adNewsGroup == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "早晚报关联不能为空!");
} }
if (adNewsGroup.getBookGroupId()==null){ if (adNewsGroup.getClassifyId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"社群码id不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "群分类id不能为空!");
}
if (adNewsGroup.getBookGroupId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "社群码id不能为空!");
} }
} }
......
package com.pcloud.book.adnews.dao;
import com.pcloud.book.adnews.entity.AdNewsBan;
import com.pcloud.common.core.dao.BaseDao;
/**
* @author zhengyongqiang
* @date 2019/8/12 15:12
*/
public interface AdNewsBanDao extends BaseDao<AdNewsBan> {
void deleteByAdNewsId(Long partyId,Long adNewsId);
}
package com.pcloud.book.adnews.dao;
import com.pcloud.book.adnews.entity.AdNewsClickRecord;
import com.pcloud.common.core.dao.BaseDao;
/**
* @author zhengyongqiang
* @date 2019/8/15 11:10
*/
public interface AdNewsClickRecordDao extends BaseDao<AdNewsClickRecord> {
}
...@@ -6,9 +6,15 @@ import com.pcloud.common.core.dao.BaseDao; ...@@ -6,9 +6,15 @@ import com.pcloud.common.core.dao.BaseDao;
import java.util.List; import java.util.List;
public interface AdNewsGroupDao extends BaseDao<AdNewsGroup> { public interface AdNewsGroupDao extends BaseDao<AdNewsGroup> {
Integer batchInsert(List<AdNewsGroup> adNewsGroups); Integer batchInsert(List<AdNewsGroup> adNewsGroups);
void deleteByAdNewsSetId(Long adNewsSetId); void deleteByAdNewsSetId(Long adNewsSetId);
/**
* 获取勾选关联的社群
* @param adNewsSetId
* @return
*/
List<AdNewsGroup> getListByAdNewsSetId(Long adNewsSetId); List<AdNewsGroup> getListByAdNewsSetId(Long adNewsSetId);
} }
package com.pcloud.book.adnews.dao; package com.pcloud.book.adnews.dao;
import com.pcloud.book.adnews.entity.AdNewsGroupRecord; import com.pcloud.book.adnews.entity.AdNewsGroupRecord;
import com.pcloud.book.adnews.vo.AdNewsGroupRecordVO;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
import java.util.List; import java.util.List;
...@@ -12,4 +13,6 @@ import java.util.List; ...@@ -12,4 +13,6 @@ import java.util.List;
**/ **/
public interface AdNewsGroupRecordDao extends BaseDao<AdNewsGroupRecord> { public interface AdNewsGroupRecordDao extends BaseDao<AdNewsGroupRecord> {
Integer batchInsert(List<AdNewsGroupRecord> adNewsGroupRecords); Integer batchInsert(List<AdNewsGroupRecord> adNewsGroupRecords);
List<AdNewsGroupRecordVO> getAdNewsGroupRecord(Long partyId, Long messageStatisticId);
} }
package com.pcloud.book.adnews.dao;
import com.pcloud.book.adnews.entity.AdNewsMessageStatistic;
import com.pcloud.common.core.dao.BaseDao;
import com.pcloud.common.page.PageBeanNew;
import java.util.List;
/**
* @author zhengyongqiang
* @date 2019/8/13 19:05
*/
public interface AdNewsMessageStatisticDao extends BaseDao<AdNewsMessageStatistic> {
Integer batchInsert(List<AdNewsMessageStatistic> list);
}
package com.pcloud.book.adnews.dao;
import com.pcloud.book.adnews.entity.AdNewsChoose;
import com.pcloud.book.adnews.entity.AdNewsWechatChoose;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* @author zhengyongqiang
* @date 2019/8/7 11:47
*/
public interface AdNewsWechatChooseDao extends BaseDao<AdNewsWechatChoose> {
Integer batchInsert(List<AdNewsWechatChoose> adNewsWechatChooses);
void deleteAdNewsWechatChooseById(Long adNewsWechatId, Long partyId);
void deleteAdNewsWechatChooseByPartyId(Long partyId);
Integer getCountByAdNewsWechatIdsAndPartyId(List<Long> adNewsIds, Long partyId);
}
package com.pcloud.book.adnews.dao;
import com.pcloud.book.adnews.entity.AdNewsWechat;
import com.pcloud.common.core.dao.BaseDao;
/**
* @author zhengyongqiang
* @date 2019/8/7 11:46
*/
public interface AdNewsWechatDao extends BaseDao<AdNewsWechat> {
}
package com.pcloud.book.adnews.dao.impl;
import com.pcloud.book.adnews.dao.AdNewsBanDao;
import com.pcloud.book.adnews.entity.AdNewsBan;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.Map;
/**
* @author zhengyongqiang
* @date 2019/8/12 15:11
*/
@Repository("adnewsBanDao")
public class AdNewsBanDaoImpl extends BaseDaoImpl<AdNewsBan> implements AdNewsBanDao {
@Override
public void deleteByAdNewsId(Long partyId, Long adNewsId) {
Map<String,Object> map = new HashMap<>();
map.put("partyId",partyId);
map.put("adNewsId",adNewsId);
super.getSqlSession().delete(getStatement("deleteByAdNewsId"),map);
}
}
package com.pcloud.book.adnews.dao.impl;
import com.pcloud.book.adnews.dao.AdNewsClickRecordDao;
import com.pcloud.book.adnews.entity.AdNewsClickRecord;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
/**
* @author zhengyongqiang
* @date 2019/8/15 11:10
*/
@Repository("adNewsClickRecordDao")
public class AdNewsClickRecordDaoImpl extends BaseDaoImpl<AdNewsClickRecord> implements AdNewsClickRecordDao {
}
...@@ -2,10 +2,13 @@ package com.pcloud.book.adnews.dao.impl; ...@@ -2,10 +2,13 @@ package com.pcloud.book.adnews.dao.impl;
import com.pcloud.book.adnews.dao.AdNewsGroupRecordDao; import com.pcloud.book.adnews.dao.AdNewsGroupRecordDao;
import com.pcloud.book.adnews.entity.AdNewsGroupRecord; import com.pcloud.book.adnews.entity.AdNewsGroupRecord;
import com.pcloud.book.adnews.vo.AdNewsGroupRecordVO;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Description * @Description
...@@ -18,4 +21,12 @@ public class AdNewsGroupRecordDaoImpl extends BaseDaoImpl<AdNewsGroupRecord> imp ...@@ -18,4 +21,12 @@ public class AdNewsGroupRecordDaoImpl extends BaseDaoImpl<AdNewsGroupRecord> imp
public Integer batchInsert(List<AdNewsGroupRecord> list) { public Integer batchInsert(List<AdNewsGroupRecord> list) {
return super.getSqlSession().insert(getStatement("batchInsert"), list); return super.getSqlSession().insert(getStatement("batchInsert"), list);
} }
@Override
public List<AdNewsGroupRecordVO> getAdNewsGroupRecord(Long partyId, Long messageStatisticId) {
Map<String,Object> map = new HashMap<>();
map.put("partyId",partyId );
map.put("messageStatisticId",messageStatisticId );
return super.getSqlSession().selectList(getStatement("getAdNewsGroupRecord"),map);
}
} }
package com.pcloud.book.adnews.dao.impl;
import com.pcloud.book.adnews.dao.AdNewsMessageStatisticDao;
import com.pcloud.book.adnews.entity.AdNewsGroupRecord;
import com.pcloud.book.adnews.entity.AdNewsMessageStatistic;
import com.pcloud.common.core.dao.BaseDaoImpl;
import com.pcloud.common.page.PageBeanNew;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author zhengyongqiang
* @date 2019/8/13 19:05
*/
@Repository("adNewsMessageStatisticDao")
public class AdNewsMessageStatisticDaoImpl extends BaseDaoImpl<AdNewsMessageStatistic> implements AdNewsMessageStatisticDao {
@Override
public Integer batchInsert(List<AdNewsMessageStatistic> list) {
return super.getSqlSession().insert(getStatement("batchInsert"), list);
}
}
package com.pcloud.book.adnews.dao.impl;
import com.pcloud.book.adnews.dao.AdNewsWechatChooseDao;
import com.pcloud.book.adnews.entity.AdNewsWechatChoose;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author zhengyongqiang
* @date 2019/8/7 11:52
*/
@Repository("adNewsWechatChooseDao")
public class AdNewsWechatChooseDaoImpl extends BaseDaoImpl<AdNewsWechatChoose> implements AdNewsWechatChooseDao {
@Override
public Integer batchInsert(List<AdNewsWechatChoose> adNewsWechatChooses) {
return super.getSqlSession().insert(getStatement("batchInsert"),adNewsWechatChooses);
}
@Override
public void deleteAdNewsWechatChooseById(Long adNewsWechatId, Long partyId) {
Map<String, Object> map = new HashMap<>();
map.put("adNewsWechatId", adNewsWechatId);
map.put("partyId", partyId);
super.getSqlSession().delete(getStatement("deleteAdNewsWechatChooseById"), map);
}
@Override
public void deleteAdNewsWechatChooseByPartyId(Long partyId) {
Map<String, Object> map = new HashMap<>();
map.put("partyId", partyId);
super.getSqlSession().delete(getStatement("deleteAdNewsWechatChooseByPartyId"), map);
}
@Override
public Integer getCountByAdNewsWechatIdsAndPartyId(List<Long> adNewsWechatIds, Long partyId) {
Map<String, Object> map = new HashMap<>();
map.put("adNewsWechatIds", adNewsWechatIds);
map.put("partyId", partyId);
return super.getSqlSession().selectOne(getStatement("getCountByAdNewsWechatIdsAndPartyId"), map);
}
}
package com.pcloud.book.adnews.dao.impl;
import com.pcloud.book.adnews.dao.AdNewsWechatDao;
import com.pcloud.book.adnews.entity.AdNewsWechat;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
/**
* @author zhengyongqiang
* @date 2019/8/7 11:52
*/
@Repository("adNewsWechatDao")
public class AdNewsWechatDaoImpl extends BaseDaoImpl<AdNewsWechat> implements AdNewsWechatDao {
}
package com.pcloud.book.adnews.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import java.util.List;
/**
* @author zhengyongqiang
* @date 2019/8/12 11:33
*/
@Data
@ApiModel("查询素材列表")
public class AdNewsListParam {
@ApiModelProperty("当前人")
private Long partyId;
@ApiModelProperty ("标题")
private String title;
@ApiModelProperty("开始时间")
private String beginTime;
@ApiModelProperty("结束时间")
private String endTime;
@ApiModelProperty ("公众号id")
private List<Long> adNewsWechatIds;
@ApiModelProperty("已被禁用;0:没禁用; 1:已禁用;")
private Integer hasBan;
@ApiModelProperty("使用状态;0:未使用; 1:已使用;")
private Integer hasUsed;
@ApiModelProperty("当前页")
private Integer currentPage;
@ApiModelProperty("每页展示条数")
private Integer numPerPage;
}
...@@ -38,6 +38,12 @@ public class AdNews extends BaseEntity { ...@@ -38,6 +38,12 @@ public class AdNews extends BaseEntity {
@ApiModelProperty("是否使用") @ApiModelProperty("是否使用")
private Boolean hasUsed; private Boolean hasUsed;
@ApiModelProperty("是否禁用")
private Boolean hasBan ;
@ApiModelProperty("公众号")
private String wechatName;
public String getType() { public String getType() {
return type; return type;
} }
...@@ -102,6 +108,22 @@ public class AdNews extends BaseEntity { ...@@ -102,6 +108,22 @@ public class AdNews extends BaseEntity {
this.hasUsed = hasUsed; this.hasUsed = hasUsed;
} }
public Boolean getHasBan() {
return hasBan;
}
public void setHasBan(Boolean hasBan) {
this.hasBan = hasBan;
}
public String getWechatName() {
return wechatName;
}
public void setWechatName(String wechatName) {
this.wechatName = wechatName;
}
@Override @Override
public String toString() { public String toString() {
return "AdNews{" + return "AdNews{" +
...@@ -113,6 +135,8 @@ public class AdNews extends BaseEntity { ...@@ -113,6 +135,8 @@ public class AdNews extends BaseEntity {
", shortUrl='" + shortUrl + '\'' + ", shortUrl='" + shortUrl + '\'' +
", newsDate='" + newsDate + '\'' + ", newsDate='" + newsDate + '\'' +
", hasUsed=" + hasUsed + ", hasUsed=" + hasUsed +
"} " + super.toString(); ", hasBan=" + hasBan +
", wechatName='" + wechatName + '\'' +
'}';
} }
} }
package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhengyongqiang
* @date 2019/8/12 15:13
*/
@ApiModel("禁止推送")
@Data
public class AdNewsBan extends BaseEntity {
private static final long serialVersionUID = -5102664638916548405L;
@ApiModelProperty("编辑id")
private Long adviserId;
@ApiModelProperty("新闻id")
private Long adNewsId;
}
package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhengyongqiang
* @date 2019/8/15 11:02
*/
@Data
@ApiModel("记录点击量")
public class AdNewsClickRecord extends BaseEntity {
private static final long serialVersionUID = -3879628889314992714L;
@ApiModelProperty("微信统计记录id")
private Long messageStatisticId;
@ApiModelProperty("微信记录详情id")
private Long groupRecordId;
@ApiModelProperty("微信用户id")
private Long wechatUserId;
}
...@@ -3,12 +3,14 @@ package com.pcloud.book.adnews.entity; ...@@ -3,12 +3,14 @@ package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/** /**
* @Description * @Description
* @Author ruansiyuan * @Author ruansiyuan
* @Date 2019/7/17 15:20 * @Date 2019/7/17 15:20
**/ **/
@Data
@ApiModel("编辑新闻群关联") @ApiModel("编辑新闻群关联")
public class AdNewsGroup extends BaseEntity { public class AdNewsGroup extends BaseEntity {
...@@ -32,63 +34,7 @@ public class AdNewsGroup extends BaseEntity { ...@@ -32,63 +34,7 @@ public class AdNewsGroup extends BaseEntity {
@ApiModelProperty("修改人") @ApiModelProperty("修改人")
private Long updateUser; private Long updateUser;
public Long getClassifyId() { @ApiModelProperty("分类")
return classifyId; private String classify;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public Long getAdNewsSetId() {
return adNewsSetId;
}
public void setAdNewsSetId(Long adNewsSetId) {
this.adNewsSetId = adNewsSetId;
}
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
@Override
public String toString() {
return "AdNewsGroup{" +
"classifyId=" + classifyId +
", bookGroupId=" + bookGroupId +
", adNewsSetId=" + adNewsSetId +
", isDelete=" + isDelete +
", createUser=" + createUser +
", updateUser=" + updateUser +
"} " + super.toString();
}
} }
...@@ -3,6 +3,7 @@ package com.pcloud.book.adnews.entity; ...@@ -3,6 +3,7 @@ package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/** /**
* @Description * @Description
...@@ -10,10 +11,14 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -10,10 +11,14 @@ import io.swagger.annotations.ApiModelProperty;
* @Date 2019/7/17 15:55 * @Date 2019/7/17 15:55
**/ **/
@ApiModel("编辑新闻发送记录") @ApiModel("编辑新闻发送记录")
@Data
public class AdNewsGroupRecord extends BaseEntity{ public class AdNewsGroupRecord extends BaseEntity{
private static final long serialVersionUID = -3271071194854381077L; private static final long serialVersionUID = -3271071194854381077L;
@ApiModelProperty("消息统计表id")
private Long messageStatisticId;
@ApiModelProperty("群id") @ApiModelProperty("群id")
private Long qrcodeId; private Long qrcodeId;
...@@ -35,72 +40,12 @@ public class AdNewsGroupRecord extends BaseEntity{ ...@@ -35,72 +40,12 @@ public class AdNewsGroupRecord extends BaseEntity{
@ApiModelProperty("修改人") @ApiModelProperty("修改人")
private Long updateUser; private Long updateUser;
public Long getQrcodeId() { @ApiModelProperty("自定义内容")
return qrcodeId; private String customContent;
}
public void setQrcodeId(Long qrcodeId) {
this.qrcodeId = qrcodeId;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public Long getAdNewsId() {
return adNewsId;
}
public void setAdNewsId(Long adNewsId) {
this.adNewsId = adNewsId;
}
public Long getAdNewsSetId() {
return adNewsSetId;
}
public void setAdNewsSetId(Long adNewsSetId) {
this.adNewsSetId = adNewsSetId;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) { @ApiModelProperty("内容类型,0:早报;1:晚报")
this.updateUser = updateUser; private Integer contentType;
}
@Override @ApiModelProperty("insert时父子表标识")
public String toString() { Integer insertMark;
return "AdNewsGroupRecord{" +
"qrcodeId=" + qrcodeId +
", classifyId=" + classifyId +
", bookGroupId=" + bookGroupId +
", adNewsId=" + adNewsId +
", adNewsSetId=" + adNewsSetId +
", createUser=" + createUser +
", updateUser=" + updateUser +
"} " + super.toString();
}
} }
package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhengyongqiang
* @date 2019/8/13 18:51
*/
@ApiModel("消息记录统计表")
@Data
public class AdNewsMessageStatistic extends BaseEntity {
private static final long serialVersionUID = 5892129036072748567L;
@ApiModelProperty("群id")
private Long qrcodeId;
@ApiModelProperty("分类id")
private Long classifyId;
@ApiModelProperty("社群码id")
private Long bookGroupId;
@ApiModelProperty("编辑新闻设置id")
private Long adNewsSetId;
@ApiModelProperty("内容来源")
private Integer contentFrom;
@ApiModelProperty("发送消息数")
private Integer messageCount;
@ApiModelProperty("创建人")
private Long createUser;
@ApiModelProperty("insert时父子表标识")
private Integer insertMark;
}
...@@ -3,6 +3,7 @@ package com.pcloud.book.adnews.entity; ...@@ -3,6 +3,7 @@ package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List; import java.util.List;
...@@ -11,6 +12,7 @@ import java.util.List; ...@@ -11,6 +12,7 @@ import java.util.List;
* @Author ruansiyuan * @Author ruansiyuan
* @Date 2019/7/17 16:13 * @Date 2019/7/17 16:13
**/ **/
@Data
@ApiModel("编辑新闻发送记录") @ApiModel("编辑新闻发送记录")
public class AdNewsSet extends BaseEntity { public class AdNewsSet extends BaseEntity {
...@@ -49,132 +51,21 @@ public class AdNewsSet extends BaseEntity { ...@@ -49,132 +51,21 @@ public class AdNewsSet extends BaseEntity {
@ApiModelProperty("修改人") @ApiModelProperty("修改人")
private Long updateUser; private Long updateUser;
@ApiModelProperty("内容来源")
private Integer contentFrom;
@ApiModelProperty("早报内容")
private String morningContent;
@ApiModelProperty("晚报内容")
private String eveningContent;
@ApiModelProperty("内容类型")
private Integer contentType;
@ApiModelProperty("分类关联集合") @ApiModelProperty("分类关联集合")
private List<AdNewsGroup> adNewsGroups; private List<AdNewsGroup> adNewsGroups;
@ApiModelProperty("分类id集合") @ApiModelProperty("分类id集合")
private List<Long> classifyIds; private List<Long> classifyIds;
public String getMorningTime() {
return morningTime;
}
public void setMorningTime(String morningTime) {
this.morningTime = morningTime;
}
public String getEveningTime() {
return eveningTime;
}
public void setEveningTime(String eveningTime) {
this.eveningTime = eveningTime;
}
public Boolean getHasMorningOpen() {
return hasMorningOpen;
}
public void setHasMorningOpen(Boolean hasMorningOpen) {
this.hasMorningOpen = hasMorningOpen;
}
public Boolean getHasEveningOpen() {
return hasEveningOpen;
}
public void setHasEveningOpen(Boolean hasEveningOpen) {
this.hasEveningOpen = hasEveningOpen;
}
public Integer getSendCount() {
return sendCount;
}
public void setSendCount(Integer sendCount) {
this.sendCount = sendCount;
}
public String getStartContent() {
return startContent;
}
public void setStartContent(String startContent) {
this.startContent = startContent;
}
public String getEndContent() {
return endContent;
}
public void setEndContent(String endContent) {
this.endContent = endContent;
}
public Boolean getHasStartContent() {
return hasStartContent;
}
public void setHasStartContent(Boolean hasStartContent) {
this.hasStartContent = hasStartContent;
}
public Boolean getHasEndContent() {
return hasEndContent;
}
public void setHasEndContent(Boolean hasEndContent) {
this.hasEndContent = hasEndContent;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
public List<AdNewsGroup> getAdNewsGroups() {
return adNewsGroups;
}
public void setAdNewsGroups(List<AdNewsGroup> adNewsGroups) {
this.adNewsGroups = adNewsGroups;
}
public List<Long> getClassifyIds() {
return classifyIds;
}
public void setClassifyIds(List<Long> classifyIds) {
this.classifyIds = classifyIds;
}
@Override
public String toString() {
return "AdNewsSet{" +
"morningTime='" + morningTime + '\'' +
", eveningTime='" + eveningTime + '\'' +
", hasMorningOpen=" + hasMorningOpen +
", hasEveningOpen=" + hasEveningOpen +
", sendCount=" + sendCount +
", startContent='" + startContent + '\'' +
", endContent='" + endContent + '\'' +
", hasStartContent=" + hasStartContent +
", hasEndContent=" + hasEndContent +
", createUser=" + createUser +
", updateUser=" + updateUser +
", adNewsGroups=" + adNewsGroups +
", classifyIds=" + classifyIds +
"} " + super.toString();
}
} }
package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @author zhengyongqiang
* @date 2019/8/7 11:23
*/
@ApiModel("新闻微信公众号")
public class AdNewsWechat extends BaseEntity {
private static final long serialVersionUID = 454065623001378319L;
public AdNewsWechat() {
}
public AdNewsWechat(String newsFrom, String wechatName, Long adviserId, Boolean isDelete) {
this.newsFrom = newsFrom;
this.wechatName = wechatName;
this.adviserId = adviserId;
this.isDelete = isDelete;
}
@ApiModelProperty("微信公众号唯一标识")
private String newsFrom;
@ApiModelProperty("微信公众号名称")
private String wechatName;
@ApiModelProperty("编辑id")
private Long adviserId;
@ApiModelProperty("是否删除")
private Boolean isDelete;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getNewsFrom() {
return newsFrom;
}
public void setNewsFrom(String newsFrom) {
this.newsFrom = newsFrom;
}
public String getWechatName() {
return wechatName;
}
public void setWechatName(String wechatName) {
this.wechatName = wechatName;
}
public Long getAdviserId() {
return adviserId;
}
public void setAdviserId(Long adviserId) {
this.adviserId = adviserId;
}
public Boolean getDelete() {
return isDelete;
}
public void setDelete(Boolean delete) {
isDelete = delete;
}
@Override
public String toString() {
return "AdNewsWechat{" +
"newsFrom='" + newsFrom + '\'' +
", wechatName='" + wechatName + '\'' +
", adviserId=" + adviserId +
", isDelete=" + isDelete +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
package com.pcloud.book.adnews.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @author zhengyongqiang
* @date 2019/8/7 11:32
*/
@ApiModel("新闻公众号选择关联")
public class AdNewsWechatChoose extends BaseEntity {
private static final long serialVersionUID = 209558478794921448L;
@ApiModelProperty("编辑id")
private Long adviserId;
@ApiModelProperty("公众号id")
private Long adNewsWechatId;
@ApiModelProperty("是否删除")
private Boolean isDelete;
@ApiModelProperty("创建人")
private Long createUser;
@ApiModelProperty("修改人")
private Long updateUser;
public Long getAdviserId() {
return adviserId;
}
public void setAdviserId(Long adviserId) {
this.adviserId = adviserId;
}
public Long getAdNewsWechatId() {
return adNewsWechatId;
}
public void setAdNewsWechatId(Long adNewsWechatId) {
this.adNewsWechatId = adNewsWechatId;
}
public Boolean getDelete() {
return isDelete;
}
public void setDelete(Boolean delete) {
isDelete = delete;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
@Override
public String toString() {
return "AdNewsWechatChoose{" +
"adviserId=" + adviserId +
", adNewsWechatId=" + adNewsWechatId +
", isDelete=" + isDelete +
", createUser=" + createUser +
", updateUser=" + updateUser +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
package com.pcloud.book.adnews.enums;
import com.pcloud.book.advertising.enums.AdDetailModeEnum;
import org.springframework.amqp.rabbit.support.PublisherCallbackChannelImpl;
/**
* 早晚报内容来源
*
* @author zhengyongqiang
* @date 2019/8/6 17:50
*/
public enum AdContentFromEnum {
WECHAT(0, "微信公众号"),
CUSTOM(1, "自定义内容 ");
public final Integer key;
public final String name;
AdContentFromEnum(Integer key, String name) {
this.key = key;
this.name = name;
}
public static String getNameByKey(String key) {
AdContentFromEnum[] var1 = values();
int var2 = var1.length;
for (int var3 = 0; var3 < var2; ++var3) {
AdContentFromEnum methodEnum = var1[var3];
if (methodEnum.key.equals(key)) {
return methodEnum.name;
}
}
return null;
}
}
package com.pcloud.book.adnews.enums;
/**
* 禁止推送/允许推送
* @author zhengyongqiang
* @date 2019/8/12 14:42
*/
public enum AdNewsBanEnum {
NONBAN(0), // 不禁止推送
BAN(1); // 禁止推送
public final Integer key;
AdNewsBanEnum(Integer key){
this.key=key;
}
}
package com.pcloud.book.adnews.enums;
import java.security.Key;
/**
* 内容类型
*
* @author zhengyongqiang
* @date 2019/8/16 17:25
*/
public enum AdNewsContentTypeEnum {
MORNING(0, "早报"),
EVENING(1, "晚报");
public final Integer key;
public final String description;
AdNewsContentTypeEnum(Integer key, String description) {
this.key = key;
this.description = description;
}
public static String getDescriptionByKey(Integer key) {
AdNewsContentTypeEnum[] var1 = values();
int var2 = var1.length;
for (int var3 = 0; var3 < var2; ++var3) {
AdNewsContentTypeEnum methodEnum = var1[var3];
if (methodEnum.key.equals(key)) {
return methodEnum.description;
}
}
return null;
}
}
package com.pcloud.book.adnews.enums;
/**
* 公众号状态
* @author zhengyongqiang
* @date 2019/8/7 11:37
*/
public enum AdNewsWechatEnum {
EXAMINING(0), // 审核中
ENABLE(1); // 已启用
public final Integer key;
AdNewsWechatEnum(Integer key){
this.key=key;
}
}
package com.pcloud.book.adnews.facade; package com.pcloud.book.adnews.facade;
import com.pcloud.book.adnews.entity.AdNewsClickRecord;
import com.pcloud.book.adnews.entity.AdNewsSet; import com.pcloud.book.adnews.entity.AdNewsSet;
import com.pcloud.book.adnews.dto.AdNewsListParam;
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.*;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
@FeignClient(value = "pcloud-service-book",qualifier = "adNewsFacadeCloud",path = "adNews") @FeignClient(value = "pcloud-service-book", qualifier = "adNewsFacadeCloud", path = "adNews")
@Api(description = "推送群消息外部接口") @Api(description = "推送群消息外部接口")
public interface AdNewsFacade { public interface AdNewsFacade {
@ApiOperation("新增编辑端早晚报设置") @ApiOperation("新增编辑端早晚报设置")
@PostMapping("/createAdNewsSet") @PostMapping("/createAdNewsSet")
ResponseDto<?> createAdNewsSet( ResponseDto<?> createAdNewsSet(
...@@ -37,6 +36,7 @@ public interface AdNewsFacade { ...@@ -37,6 +36,7 @@ public interface AdNewsFacade {
@RequestHeader("token") @ApiParam("token信息") String token @RequestHeader("token") @ApiParam("token信息") String token
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@Deprecated
@ApiOperation("编辑添加选择的早晚报素材") @ApiOperation("编辑添加选择的早晚报素材")
@PostMapping("/createAdNewsChooseBatch") @PostMapping("/createAdNewsChooseBatch")
ResponseDto<?> createAdNewsChooseBatch( ResponseDto<?> createAdNewsChooseBatch(
...@@ -44,6 +44,7 @@ public interface AdNewsFacade { ...@@ -44,6 +44,7 @@ public interface AdNewsFacade {
@RequestBody @ApiParam("新闻id集合") List<Long> adNewsIds @RequestBody @ApiParam("新闻id集合") List<Long> adNewsIds
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@Deprecated
@ApiOperation("编辑移除选择的早晚报素材") @ApiOperation("编辑移除选择的早晚报素材")
@GetMapping("/deleteAdNewsChoose") @GetMapping("/deleteAdNewsChoose")
ResponseDto<?> deleteAdNewsChoose( ResponseDto<?> deleteAdNewsChoose(
...@@ -51,23 +52,91 @@ public interface AdNewsFacade { ...@@ -51,23 +52,91 @@ public interface AdNewsFacade {
@RequestParam @ApiParam("adNewsChooseId") Long adNewsChooseId @RequestParam @ApiParam("adNewsChooseId") Long adNewsChooseId
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@ApiOperation("获取早晚报素材库") @Deprecated
@GetMapping("/getAdNewsList") @ApiOperation("获取编辑选择的早晚报素材库")
@GetMapping("/getAdNewsChooseList")
ResponseDto<?> getAdNewsChooseList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "title", required = false) @ApiParam("标题") String title,
@RequestParam(value = "hasUsed", required = false) @ApiParam("标题") Boolean hasUsed,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException;
@ApiOperation("早晚报素材库")
@PostMapping("/getAdNewsList")
ResponseDto<?> getAdNewsList( ResponseDto<?> getAdNewsList(
@RequestHeader("token") @ApiParam("token信息") String token, @RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "title",required = false) @ApiParam("标题") String title, @RequestBody @ApiParam("查询参数") AdNewsListParam adNewsListParam
) throws BizException, PermissionException;
@ApiOperation("禁用/解除禁用")
@GetMapping("/saveAdNewsBan")
ResponseDto<?> saveAdNewsBan(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("adNewsId") @ApiParam("新闻id") Long adNewsId,
@RequestParam("hasBan") @ApiParam("禁止推送") Integer hasBan
) throws BizException, PermissionException;
@ApiOperation("添加编辑选择的公众号")
@PostMapping("/createAdNewsWechatChooseBatch")
ResponseDto<?> createAdNewsWechatChooseBatch(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody @ApiParam("选择的公众号主键") List<Long> adNewsWechatIds
) throws BizException, PermissionException;
@ApiOperation("移除编辑已选择的公众号")
@GetMapping("/deleteAdNewsWechatChoose")
ResponseDto<?> deleteAdNewsWechatChoose(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "adNewsWechatId") @ApiParam("公众号主键") Long adNewsWechatId
) throws BizException, PermissionException;
@ApiOperation("获取编辑已选择的公众号")
@GetMapping("/getAdNewsWechatChooseList")
ResponseDto<?> getAdNewsWechatChooseList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage, @RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage @RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@ApiOperation("获取编辑选择的早晚报素材库") @ApiOperation("获取所有的公众号列表")
@GetMapping("/getAdNewsChooseList") @GetMapping("/getAdNewsWechatList")
ResponseDto<?> getAdNewsChooseList( ResponseDto<?> getAdNewsWechatList(
@RequestHeader("token") @ApiParam("token信息") String token, @RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "title",required = false) @ApiParam("标题") String title,
@RequestParam(value = "hasUsed",required = false) @ApiParam("标题") Boolean hasUsed,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage, @RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage @RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@ApiOperation("获取早晚报发送记录")
@GetMapping("/getAdNewsMessageStatistic")
ResponseDto<?> getAdNewsMessageStatistic(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "title", required = false) @ApiParam("群名称、群分类、社群码、社群书") String title,
@RequestParam(value = "beginTime", required = false) @ApiParam("开始日期") String beginTime,
@RequestParam(value = "endTime", required = false) @ApiParam("结束日期") String endTime,
@RequestParam(value = "proLabelId", required = false) @ApiParam("专业") Long proLabelId,
@RequestParam(value = "depLabelId", required = false) @ApiParam("深度") Long depLabelId,
@RequestParam(value = "purLabelId", required = false) @ApiParam("目的") Long purLabelId,
@RequestParam(value = "currentPage", required = false, defaultValue = "0") @ApiParam("当前页") Integer currentPage,
@RequestParam(value = "numPerPage", required = false, defaultValue = "10") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException;
@ApiOperation("查询早晚报发送详情")
@GetMapping("/getAdNewsGroupRecord")
ResponseDto<?> getAdNewsGroupRecord(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("messageStatisticId") @ApiParam("统计表id") Long messageStatisticId
) throws BizException, PermissionException;
@ApiOperation("记录用户点击量")
@PostMapping("/addAdNewsClickRecord")
@ApiImplicitParams({
@ApiImplicitParam(name = "userInfo", value = "Cookie", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "adNewsClickRecord", value = "用户点击量对象", dataType = "AdNewsClickRecord", paramType = "body")})
ResponseDto<?> addAdNewsClickRecord(
@CookieValue("userInfo") @ApiParam("用户信息") String userInfo,
@RequestBody @ApiParam("用户点击量对象") AdNewsClickRecord adNewsClickRecord
) throws BizException, PermissionException;
} }
package com.pcloud.book.adnews.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhengyongqiang
* @date 2019/8/14 14:41
*/
@ApiModel
@Data
public class AdNewsGroupRecordVO {
@ApiModelProperty("主键id")
private Long id;
@ApiModelProperty("新闻id")
private Long adNewsId;
@ApiModelProperty("公众号名称")
private String wechatName;
@ApiModelProperty("新闻标题")
private String title;
@ApiModelProperty("新闻短链接")
private String shortUrl;
@ApiModelProperty("自定义早晚报内容")
private String customContent;
@ApiModelProperty("内容类型,0:早报;1:晚报")
private Integer contentType;
}
package com.pcloud.book.adnews.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author zhengyongqiang
* @date 2019/8/14 10:43
*/
@Data
public class AdNewsMessageStatisticVO {
@ApiModelProperty("主键id")
private Long id;
@ApiModelProperty("微信群名称")
private String groupName;
@ApiModelProperty("分类")
private String classify;
@ApiModelProperty("社群码名称")
private String groupQrcodeName;
@ApiModelProperty("社群书名称")
private String bookName;
@ApiModelProperty("专业")
private String depLabelName;
@ApiModelProperty("深度")
private String proLabelName;
@ApiModelProperty("目的")
private String purLabelName;
@ApiModelProperty("专业Id")
private Long depLabelId;
@ApiModelProperty("深度Id")
private Long proLabelId;
@ApiModelProperty("目的Id")
private Long purLabelId;
@ApiModelProperty("内容来源")
private Integer contentFrom;
@ApiModelProperty("发送消息数")
private Integer messageCount;
@ApiModelProperty("发送时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@ApiModelProperty("点击次数")
private Long clickCount;
@ApiModelProperty("点击人数")
private Long userCount;
}
...@@ -758,7 +758,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -758,7 +758,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
} }
} }
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO(); SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setGroupId(groupId); sendTextMessageVO.setWxGroupId(groupId);
sendTextMessageVO.setAltId(altId); sendTextMessageVO.setAltId(altId);
sendTextMessageVO.setContent(adTitle); sendTextMessageVO.setContent(adTitle);
sendTextMessageVO.setIp(findIp(groupId)); sendTextMessageVO.setIp(findIp(groupId));
...@@ -769,7 +769,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -769,7 +769,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
sendArticleMessageVO.setAltId(altId); sendArticleMessageVO.setAltId(altId);
sendArticleMessageVO.setTitle(advertisingSpace.getAdTitle()); sendArticleMessageVO.setTitle(advertisingSpace.getAdTitle());
sendArticleMessageVO.setDescription(advertisingSpace.getAdSlogan()); sendArticleMessageVO.setDescription(advertisingSpace.getAdSlogan());
sendArticleMessageVO.setGroupId(groupId); sendArticleMessageVO.setWxGroupId(groupId);
String adLink = ""; String adLink = "";
if (!StringUtil.isEmpty(advertisingSpace.getAdLink())) { if (!StringUtil.isEmpty(advertisingSpace.getAdLink())) {
if (advertisingSpace.getAdLink().contains("?")) { if (advertisingSpace.getAdLink().contains("?")) {
...@@ -791,7 +791,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz { ...@@ -791,7 +791,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
} else if (AdPositionModeEnum.JUST_PIC.modeCode.equals(advertisingSpace.getAdPositionMode())) { } else if (AdPositionModeEnum.JUST_PIC.modeCode.equals(advertisingSpace.getAdPositionMode())) {
SendPicMessageVO sendPicMessageVO = new SendPicMessageVO(); SendPicMessageVO sendPicMessageVO = new SendPicMessageVO();
sendPicMessageVO.setAltId(altId); sendPicMessageVO.setAltId(altId);
sendPicMessageVO.setGroupId(groupId); sendPicMessageVO.setWxGroupId(groupId);
sendPicMessageVO.setPicUrl(advertisingSpace.getAdPic()); sendPicMessageVO.setPicUrl(advertisingSpace.getAdPic());
sendPicMessageVO.setIp(findIp(groupId)); sendPicMessageVO.setIp(findIp(groupId));
LOGGER.info("发送微信消息-纯图片" + sendPicMessageVO.toString()); LOGGER.info("发送微信消息-纯图片" + sendPicMessageVO.toString());
......
...@@ -1317,8 +1317,10 @@ public class BookSet { ...@@ -1317,8 +1317,10 @@ public class BookSet {
Map<Long, Long> bookIdsMap = new HashMap<>(); Map<Long, Long> bookIdsMap = new HashMap<>();
for (Object object : bookList) { for (Object object : bookList) {
BookDto bookDto = (BookDto) object; BookDto bookDto = (BookDto) object;
if (bookDto != null && bookDto.getBookId() != null) {
bookIdsMap.put(bookDto.getBookId(), bookDto.getBookId()); bookIdsMap.put(bookDto.getBookId(), bookDto.getBookId());
} }
}
List<Long> bookIds = Lists.newArrayList(bookIdsMap.values()); List<Long> bookIds = Lists.newArrayList(bookIdsMap.values());
if (CollectionUtils.isEmpty(bookIds)) { if (CollectionUtils.isEmpty(bookIds)) {
return; return;
......
...@@ -377,7 +377,7 @@ public class BookClockBizImpl implements BookClockBiz { ...@@ -377,7 +377,7 @@ public class BookClockBizImpl implements BookClockBiz {
//获取机器人微信号 //获取机器人微信号
String altId = wechatGroupConsr.getRobotIdByGroupId(weixinGroupId); String altId = wechatGroupConsr.getRobotIdByGroupId(weixinGroupId);
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO(); SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setGroupId(weixinGroupId); sendTextMessageVO.setWxGroupId(weixinGroupId);
sendTextMessageVO.setAltId(altId); sendTextMessageVO.setAltId(altId);
sendTextMessageVO.setContent(bookClockInfoDTO.getNoticeContent()); sendTextMessageVO.setContent(bookClockInfoDTO.getNoticeContent());
if(!MapUtils.isEmpty(wxQrcodeDTOMap) && wxQrcodeDTOMap.containsKey(weixinGroupId)){ if(!MapUtils.isEmpty(wxQrcodeDTOMap) && wxQrcodeDTOMap.containsKey(weixinGroupId)){
......
...@@ -15,7 +15,10 @@ import com.pcloud.wechatgroup.group.service.GroupMemberService; ...@@ -15,7 +15,10 @@ import com.pcloud.wechatgroup.group.service.GroupMemberService;
import com.pcloud.wechatgroup.message.dto.GroupChatCountDTO; import com.pcloud.wechatgroup.message.dto.GroupChatCountDTO;
import com.pcloud.wechatgroup.message.service.MessageService; import com.pcloud.wechatgroup.message.service.MessageService;
import com.pcloud.wechatgroup.monitor.service.MonitorService; import com.pcloud.wechatgroup.monitor.service.MonitorService;
import com.pcloud.wechatgroup.selfrobot.service.SelfRobotService;
import com.pcloud.wechatgroup.selfrobot.dto.SelfRobotDTO;
import com.pcloud.wechatgroup.selfrobot.service.SelfRobotService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -38,6 +41,44 @@ public class WechatGroupConsr { ...@@ -38,6 +41,44 @@ public class WechatGroupConsr {
private MessageService messageService; private MessageService messageService;
@Autowired @Autowired
private MonitorService monitorService; private MonitorService monitorService;
@Autowired
private SelfRobotService selfRobotService;
@ParamLog("根据机器人id和用户微信id获取最新暗号")
public String getCipherByRobotAndUserWxId(String robotWxId, String userWxId) {
if (StringUtil.isBlank(robotWxId) || StringUtil.isBlank(userWxId)) {
return null;
}
try {
return ResponseHandleUtil.parseResponse(selfRobotService.getCipherByRobotAndUserWxId(robotWxId, userWxId), String.class);
} catch (BizException e) {
log.warn("根据机器人id和用户微信id获取最新暗号失败:" + e.getMessage(), e);
throw new BizException(e.getCode(), e.getMessage());
} catch (Exception e) {
log.error("根据机器人id和用户微信id获取最新暗号.[getCipherByRobotAndUserWxId]:" + e.getMessage(), e);
throw new BookBizException(BookBizException.INVOKE_RES_ERROR, "服务内部错误,请稍后重试");
} finally {
log.info("【根据机器人id和用户微信id获取最新暗号,<END>");
}
}
@ParamLog("是否群机器人")
public Boolean isGroupRobot(String robotWxId) {
if (StringUtil.isBlank(robotWxId)) {
return null;
}
try {
return ResponseHandleUtil.parseResponse(selfRobotService.isGroupRobot(robotWxId), Boolean.class);
} catch (BizException e) {
log.warn("是否群机器人失败:" + e.getMessage(), e);
throw new BizException(e.getCode(), e.getMessage());
} catch (Exception e) {
log.error("是否群机器人.[isGroupRobot]:" + e.getMessage(), e);
throw new BookBizException(BookBizException.INVOKE_RES_ERROR, "服务内部错误,请稍后重试");
} finally {
log.info("【是否群机器人,<END>");
}
}
/** /**
* 是否黑名单 * 是否黑名单
...@@ -271,6 +312,16 @@ public class WechatGroupConsr { ...@@ -271,6 +312,16 @@ public class WechatGroupConsr {
return map; return map;
} }
@ParamLog(value = "获取可用机器人")
public SelfRobotDTO getAvailableRobot(Long wechatUserId, Integer largeTemplet, Long classifyId) {
SelfRobotDTO selfRobotDTO = null;
try {
selfRobotDTO = ResponseHandleUtil.parseResponse(selfRobotService.getAvailableRobot(wechatUserId, largeTemplet, classifyId), SelfRobotDTO.class);
} catch (Exception e) {
log.error("获取可用机器人.[getAvailableRobot]:" + e.getMessage(), e);
}
return selfRobotDTO;
}
@ParamLog("根据用户微信ID获取用户信息") @ParamLog("根据用户微信ID获取用户信息")
public GroupUserDTO getWxUserInfoByWxUserId(String wxUserId) { public GroupUserDTO getWxUserInfoByWxUserId(String wxUserId) {
GroupUserDTO dto = new GroupUserDTO(); GroupUserDTO dto = new GroupUserDTO();
......
package com.pcloud.book.group.biz; package com.pcloud.book.group.biz;
import com.pcloud.book.book.dto.BookDto; import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.dto.AppStatisticsDTO; import com.pcloud.book.group.dto.AppStatisticsDTO;
import com.pcloud.book.group.dto.BookGroupDTO; import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.ClassifyKeywordDTO; import com.pcloud.book.group.dto.ClassifyKeywordDTO;
import com.pcloud.book.group.dto.GroupStoreMyPayDto; import com.pcloud.book.group.dto.GroupStoreMyPayDto;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO; import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.entity.BookGroup; import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.vo.*; import com.pcloud.book.group.vo.*;
import com.pcloud.book.group.vo.StatisticVO; import com.pcloud.book.group.vo.StatisticVO;
import com.pcloud.common.dto.StoreFlowInfoDto; import com.pcloud.common.dto.StoreFlowInfoDto;
...@@ -207,6 +207,13 @@ public interface BookGroupBiz { ...@@ -207,6 +207,13 @@ public interface BookGroupBiz {
BookGroupDTO getBaseInfoBySceneId(Long sceneId); BookGroupDTO getBaseInfoBySceneId(Long sceneId);
/** /**
* @description 更新个人二维码
* @author 戴兴
* @date 2019/8/7 16:30
*/
void updatePersonQrcode(PersonalQrcodeDTO personalQrcodeDTO);
/**
* @Author:lili * @Author:lili
* @Desr:是否是特殊的出版社 * @Desr:是否是特殊的出版社
* @Date:2019/5/28 11:14 * @Date:2019/5/28 11:14
...@@ -256,6 +263,42 @@ public interface BookGroupBiz { ...@@ -256,6 +263,42 @@ public interface BookGroupBiz {
* 获取是否显示书名 * 获取是否显示书名
*/ */
Boolean getIsShowBookName(Long partyId); Boolean getIsShowBookName(Long partyId);
/**
* 根据分类id获取个人二维码信息
*/
OwnAltQrcodeInfoDTO getOwnAltQrcodeInfoDTOByClassifyId(Long wechatUserId, Long classifyId);
/**
* 获取暗号状态
*/
Integer getCipherState(String cipher);
/**
* 更新状态为已使用
*/
void updateCipherStateToUsed(String cipher, String wxId);
/**
* 获取个人二维码方式群已使用和未使用数量
*/
GroupUseDTO getGroupUse(List<String> altIds);
/**
* 获取所有的大类分类
*/
List<LargeTempletDTO> getAllLargTemplet();
/**
* 根据微信id和机器人id获取分类集合
*/
List<JoinGroupCipherDTO> getClassifyIdsByWxIdAndAltId(String wxId,String altId);
/**
* 获取暗号基本信息
*/
GroupCipherDTO getJoinGroupCipher(String cipher);
/** /**
* 为信息流批量获取社群书基本信息 * 为信息流批量获取社群书基本信息
*/ */
......
package com.pcloud.book.group.biz; package com.pcloud.book.group.biz;
import com.pcloud.book.group.dto.*; 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.*; import com.pcloud.book.group.vo.AddClassifyVO;
import com.pcloud.book.group.vo.AdviserClassifyParam;
import com.pcloud.book.group.vo.AdviserClassifyVO;
import com.pcloud.book.group.vo.BookGroupClassifyVO;
import com.pcloud.book.group.vo.BookGroupQrcodeStatisticVO;
import com.pcloud.book.group.vo.ClassifyAndGroupCountVO;
import com.pcloud.book.group.vo.ClassifyAndUserCountVO;
import com.pcloud.book.group.vo.ClassifyNameVO;
import com.pcloud.book.group.vo.ClassifyVO;
import com.pcloud.book.group.vo.GroupQrcode4ClassifyVO;
import com.pcloud.book.group.vo.ListBookGroupQrcodeParamVO;
import com.pcloud.book.group.vo.ListClassify4WechatVO;
import com.pcloud.book.group.vo.ListClassifyVO;
import com.pcloud.book.group.vo.ListGroupClassifyParam;
import com.pcloud.book.group.vo.StatisticVO;
import com.pcloud.book.group.vo.UpdateClassifyVO;
import com.pcloud.book.group.vo.UpdateRankVO;
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 java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -106,6 +129,11 @@ public interface BookGroupClassifyBiz { ...@@ -106,6 +129,11 @@ public interface BookGroupClassifyBiz {
List<ListClassify4WechatVO> listClassify4Wechat(Long bookGroupId, Long wechatUserId); List<ListClassify4WechatVO> listClassify4Wechat(Long bookGroupId, Long wechatUserId);
/** /**
* 批量获取分类信息
*/
List<GroupClassifyQrcodeDTO> listClassifyQrcodeInfo(List<Long> classifyIds);
/**
* @Author:lili * @Author:lili
* @Desr:客户端根据群分类获取二维码 * @Desr:客户端根据群分类获取二维码
* @Date:2019/4/29 17:21 * @Date:2019/4/29 17:21
...@@ -113,6 +141,11 @@ public interface BookGroupClassifyBiz { ...@@ -113,6 +141,11 @@ public interface BookGroupClassifyBiz {
GroupQrcode4ClassifyVO getGroupQrcode4ClassifyWechat(Long classifyId, Long wechatUserId); GroupQrcode4ClassifyVO getGroupQrcode4ClassifyWechat(Long classifyId, Long wechatUserId);
/** /**
* 用户获取具体进群id
*/
String getWxGroupIdByClassifyIdAndWechatId(Long classifyId, Long wechatUserId);
/**
* @Author:lili * @Author:lili
* @Desr:获取编辑所有的分类 * @Desr:获取编辑所有的分类
* @Date:2019/4/30 15:33 * @Date:2019/4/30 15:33
...@@ -180,6 +213,14 @@ public interface BookGroupClassifyBiz { ...@@ -180,6 +213,14 @@ public interface BookGroupClassifyBiz {
PageBeanNew<ClassifyLearningReportDto> listClassifyForLearningReport(Integer currentPage, Integer numPerPage, String keyword, Long partyId); PageBeanNew<ClassifyLearningReportDto> listClassifyForLearningReport(Integer currentPage, Integer numPerPage, String keyword, Long partyId);
/** /**
* 用户支付金额
* @param qrcodeId
* @param wxId
* @return
*/
public BigDecimal getPayPrice(Long qrcodeId, String wxId);
/**
* 拖动排序 * 拖动排序
*/ */
void dragSortClassify(List<Long> classifyIds); void dragSortClassify(List<Long> classifyIds);
......
...@@ -22,7 +22,7 @@ public interface WeixinQrcodeBiz { ...@@ -22,7 +22,7 @@ public interface WeixinQrcodeBiz {
* @Desr:从二维码获取一个二维码 * @Desr:从二维码获取一个二维码
* @Date:2019/4/17 16:17 * @Date:2019/4/17 16:17
*/ */
WeixinQrcodeDTO getOneQrcode(); WeixinQrcodeDTO getOneQrcode(Integer generation);
/** /**
* @Author:lili * @Author:lili
......
...@@ -10,25 +10,59 @@ import com.pcloud.book.consumer.resource.ProductConsr; ...@@ -10,25 +10,59 @@ 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.group.biz.*; import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.biz.GroupAnnouncementBiz;
import com.pcloud.book.group.biz.GroupQrcodeBiz;
import com.pcloud.book.group.biz.WeixinQrcodeBiz;
import com.pcloud.book.group.dao.BookClassifyBuyRecordDao; import com.pcloud.book.group.dao.BookClassifyBuyRecordDao;
import com.pcloud.book.group.dao.BookGroupClassifyDao; import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookQrcodeUserDao; import com.pcloud.book.group.dao.BookQrcodeUserDao;
import com.pcloud.book.group.dao.JoinGroupCipherDao;
import com.pcloud.book.group.dao.*; import com.pcloud.book.group.dao.LearningReportBrowseRecordDao;
import com.pcloud.book.group.dao.LearningReportTouchRecordDao;
import com.pcloud.book.group.dto.*; import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookGroupStatisticDTO;
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;
import com.pcloud.book.group.enums.RankTypeEnum; import com.pcloud.book.group.enums.RankTypeEnum;
import com.pcloud.book.group.set.GroupSet; import com.pcloud.book.group.set.GroupSet;
import com.pcloud.book.group.tools.SendWeixinRequestTools; import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.group.vo.*; import com.pcloud.book.group.vo.AddClassifyVO;
import com.pcloud.book.group.vo.AdviserClassifyParam;
import com.pcloud.book.group.vo.AdviserClassifyVO;
import com.pcloud.book.group.vo.BookGroupClassifyVO;
import com.pcloud.book.group.vo.BookGroupQrcodeStatisticVO;
import com.pcloud.book.group.vo.ClassifyAndGroupCountVO;
import com.pcloud.book.group.vo.ClassifyAndUserCountVO;
import com.pcloud.book.group.vo.ClassifyNameVO;
import com.pcloud.book.group.vo.ClassifyVO;
import com.pcloud.book.group.vo.GroupQrcode4ClassifyVO;
import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO;
import com.pcloud.book.group.vo.ListBookGroupQrcodeParamVO;
import com.pcloud.book.group.vo.ListClassify4WechatVO;
import com.pcloud.book.group.vo.ListClassifyVO;
import com.pcloud.book.group.vo.ListGroupClassifyParam;
import com.pcloud.book.group.vo.StatisticVO;
import com.pcloud.book.group.vo.SyncKeyworsVO;
import com.pcloud.book.group.vo.UpdateClassifyVO;
import com.pcloud.book.group.vo.UpdateRankVO;
import com.pcloud.book.keywords.dao.BookKeywordDao; import com.pcloud.book.keywords.dao.BookKeywordDao;
import com.pcloud.book.keywords.entity.BookKeyword; import com.pcloud.book.keywords.entity.BookKeyword;
import com.pcloud.book.util.common.ThreadPoolUtils; import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.book.util.properties.BookProps;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.constant.SystemCode; import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.core.enums.NotifyOriginTypeEnum; import com.pcloud.common.core.enums.NotifyOriginTypeEnum;
...@@ -120,6 +154,8 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -120,6 +154,8 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
private LearningReportBrowseRecordDao learningReportBrowseRecordDao; private LearningReportBrowseRecordDao learningReportBrowseRecordDao;
@Autowired @Autowired
private LearningReportTouchRecordDao learningReportTouchRecordDao; private LearningReportTouchRecordDao learningReportTouchRecordDao;
@Autowired
private JoinGroupCipherDao joinGroupCipherDao;
@Override @Override
...@@ -144,18 +180,24 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -144,18 +180,24 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
if (qrcodeNameAndProId == null) { if (qrcodeNameAndProId == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请先填写社群码信息!"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "请先填写社群码信息!");
} }
String groupName = qrcodeNameAndProId.getGroupQrcodeName();
bookGroupClassify.setProductId(qrcodeNameAndProId.getProductId()); bookGroupClassify.setProductId(qrcodeNameAndProId.getProductId());
bookGroupClassify.setCreateUser(partyId); bookGroupClassify.setCreateUser(partyId);
Integer rank = bookGroupClassifyDao.getMaxRank(addClassifyVO.getBookGroupId()); Integer rank = bookGroupClassifyDao.getMaxRank(addClassifyVO.getBookGroupId());
bookGroupClassify.setRank(rank); bookGroupClassify.setRank(rank);
bookGroupClassifyDao.insert(bookGroupClassify); bookGroupClassifyDao.insert(bookGroupClassify);
final Long wechatGroupNum = weixinQrcodeBiz.countWechatGroup(); final Long wechatGroupNum = weixinQrcodeBiz.countWechatGroup();
// 只有生产环境才有30个限制
if ("pro".equalsIgnoreCase(BookProps.getSystemEnv())) {
if(null == wechatGroupNum || wechatGroupNum <= 30) { if(null == wechatGroupNum || wechatGroupNum <= 30) {
log.info("[新增分类] : 可用微信群数量:{}个", wechatGroupNum); log.info("[新增分类] : 可用微信群数量:{}个", wechatGroupNum);
throw new BookBizException(BookBizException.PARAM_IS_NULL, "群二维码数量不足,您可以明天再创建群。"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "群二维码数量不足,您可以明天再创建群。");
} }
WeixinQrcodeDTO oneQrcode = weixinQrcodeBiz.getOneQrcode(); }
Integer generation = null;
if (new Integer(2).equals(qrcodeNameAndProId.getJoinGroupType())) {
generation = 3;
}
WeixinQrcodeDTO oneQrcode = weixinQrcodeBiz.getOneQrcode(generation);
if (oneQrcode == null) { if (oneQrcode == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "系统二维码数量不足,请联系客服人员补充二维码数量!"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "系统二维码数量不足,请联系客服人员补充二维码数量!");
} }
...@@ -166,7 +208,16 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -166,7 +208,16 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
groupQrcode.setWeixinQrcodeId(oneQrcode.getId()); groupQrcode.setWeixinQrcodeId(oneQrcode.getId());
groupQrcode.setUserNumber(oneQrcode.getUserNumber()); groupQrcode.setUserNumber(oneQrcode.getUserNumber());
groupQrcode.setGroupSeq(1); groupQrcode.setGroupSeq(1);
groupQrcode.setGroupName(groupName + addClassifyVO.getClassify() + "1群"); // 群长度超过16部分会被截取,导致群名称重复
final String s = "1群";
String groupName = qrcodeNameAndProId.getGroupQrcodeName() + addClassifyVO.getClassify() + s;
if (groupName.length() > 15) {
groupName = addClassifyVO.getClassify() + s;
if (groupName.length() > 15) {
groupName = addClassifyVO.getClassify().substring(0, 16 - s.length()) + s;
}
}
groupQrcode.setGroupName(groupName);
groupQrcode.setClassifyId(bookGroupClassify.getId()); groupQrcode.setClassifyId(bookGroupClassify.getId());
groupQrcode.setQrcodeHeadUrl(readerConsr.getNineHeadUrl()); groupQrcode.setQrcodeHeadUrl(readerConsr.getNineHeadUrl());
groupQrcodeBiz.insert(groupQrcode); groupQrcodeBiz.insert(groupQrcode);
...@@ -430,6 +481,12 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -430,6 +481,12 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
} }
@Override @Override
@ParamLog("获取分类二维码相关标识")
public List<GroupClassifyQrcodeDTO> listClassifyQrcodeInfo(List<Long> classifyIds) {
return bookGroupClassifyDao.listClassifyQrcodeInfo(classifyIds);
}
@Override
@ParamLog("客户端获取分类信息") @ParamLog("客户端获取分类信息")
public List<ListClassify4WechatVO> listClassify4Wechat(Long bookGroupId, Long wechatUserId) { public List<ListClassify4WechatVO> listClassify4Wechat(Long bookGroupId, Long wechatUserId) {
//获取排序方式 //获取排序方式
...@@ -511,6 +568,19 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -511,6 +568,19 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
return groupQrcode4ClassifyVO; return groupQrcode4ClassifyVO;
} }
@Override
public String getWxGroupIdByClassifyIdAndWechatId(Long classifyId, Long wechatUserId) {
if(null == classifyId || null == wechatUserId) {
return null;
}
final GroupQrcode4ClassifyVO wechat = this.getGroupQrcode4ClassifyWechat(classifyId, wechatUserId);
if(null == wechat) {
return null;
}
final GroupQrcodeBaseInfoVO baseById = this.groupQrcodeBiz.getBaseById(wechat.getGroupQrcodeId());
return (null == baseById) ? null : baseById.getWeixinGroupId();
}
@ParamLog("获取备用二维码") @ParamLog("获取备用二维码")
private String getSpareQr(Long bookGroupId) { private String getSpareQr(Long bookGroupId) {
//获取备用二维码 //获取备用二维码
...@@ -964,6 +1034,11 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -964,6 +1034,11 @@ 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)
@Override @Override
......
...@@ -9,20 +9,10 @@ import com.pcloud.book.consumer.label.LabelConsr; ...@@ -9,20 +9,10 @@ import com.pcloud.book.consumer.label.LabelConsr;
import com.pcloud.book.consumer.reader.ReaderConsr; import com.pcloud.book.consumer.reader.ReaderConsr;
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.biz.*;
import com.pcloud.book.group.biz.GroupAnnouncementBiz; import com.pcloud.book.group.constants.BookBusinessConstants;
import com.pcloud.book.group.biz.GroupQrcodeBiz;
import com.pcloud.book.group.biz.WeixinQrcodeBiz;
import com.pcloud.book.group.dao.GroupQrcodeDao; import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dto.BookWxQrcodeDTO; import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.dto.ChangeGroupNameDTO;
import com.pcloud.book.group.dto.GroupAndUserNumberDTO;
import com.pcloud.book.group.dto.GroupNameAndMaxSeqDTO;
import com.pcloud.book.group.dto.GroupQrcodeDTO;
import com.pcloud.book.group.dto.GroupQrcodeInfo4Advertising;
import com.pcloud.book.group.dto.GroupQrcodeInfoDTO;
import com.pcloud.book.group.dto.PushAddUserMessageDTO;
import com.pcloud.book.group.dto.WeixinQrcodeDTO;
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.QrcodeStatusEnum;
import com.pcloud.book.group.tools.SendWeixinRequestTools; import com.pcloud.book.group.tools.SendWeixinRequestTools;
...@@ -65,6 +55,9 @@ import java.util.HashMap; ...@@ -65,6 +55,9 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -101,7 +94,75 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz { ...@@ -101,7 +94,75 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
private AdvertisingSpaceBiz advertisingSpaceBiz; private AdvertisingSpaceBiz advertisingSpaceBiz;
@Autowired @Autowired
private LabelConsr labelConsr; private LabelConsr labelConsr;
@Autowired
private BookGroupBiz bookGroupBiz;
/**
* 自动更新群人数线程是否开始执行
*/
private static final AtomicBoolean IS_START = new AtomicBoolean(false);
/**
* 处理群人数线程池
*/
private static final ExecutorService SINGLE_THREAD_EXECUTOR = Executors.newSingleThreadExecutor();
/**
* 更新群人数线程
*/
private void updateGroupNum() {
// 若已开始则无需再启动
if(IS_START.get()) {
return;
}
// 若设置时已经为true则代表已经有线程执行成功
final boolean andSet = IS_START.getAndSet(true);
if (andSet) {
return;
}
SINGLE_THREAD_EXECUTOR.execute(() -> {
while (true) {
try{
if (BookBusinessConstants.GROUP_NUM_DTO_MAP.size() < 1) {
try {
Thread.sleep(5000);
} 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);
continue;
}
log.info("[更新群人数] entry:{}, peopleCounts:{}", entry, peopleCounts);
groupQrcodeDao.updateUserNumber(value.getWxGroupId(), peopleCounts);
BookBusinessConstants.GROUP_NUM_DTO_MAP.remove(entry.getKey());
}
} catch (Exception e) {
log.error("[updateGroupNum] : Exception:{}", e);
}
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
log.error("[updateGroupNum] InterruptedException:{}", e);
}
}
});
}
@Override @Override
@ParamLog("updateGroupQrcode") @ParamLog("updateGroupQrcode")
...@@ -240,11 +301,23 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz { ...@@ -240,11 +301,23 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
} }
//获取群基本信息 //获取群基本信息
GroupQrcodeDTO groupQrcodeDTO = groupQrcodeDao.getGroupQrcodeInfo(weixinGroupId); GroupQrcodeDTO groupQrcodeDTO = groupQrcodeDao.getGroupQrcodeInfo(weixinGroupId);
log.info("[新增一个用户] groupQrcodeDTO:{}", groupQrcodeDTO);
if (groupQrcodeDTO == null) { if (groupQrcodeDTO == null) {
return; return;
} }
//更新用户数 //更新用户数(由于微信有延迟及时更新可能会数据对不上,所以调用方法延迟30s,统一处理)
groupQrcodeDao.updateUserNumber(weixinGroupId, memberCount); AutoUpdateGroupNumDTO numDTO = BookBusinessConstants.GROUP_NUM_DTO_MAP.get(weixinGroupId);
if (null == numDTO){
numDTO = new AutoUpdateGroupNumDTO(weixinGroupId, robotId, ip, new Date());
} else {
numDTO.getNum().incrementAndGet();
numDTO.setStartTime(new Date());
}
BookBusinessConstants.GROUP_NUM_DTO_MAP.put(weixinGroupId, numDTO);
// 启动更新群人数线程
if (!IS_START.get()) {
this.updateGroupNum();
}
//如果人数超过限制,重新分配群 //如果人数超过限制,重新分配群
if (memberCount >= groupQrcodeDTO.getChangeNumber() && QrcodeStatusEnum.ON_USE.value.equals(groupQrcodeDTO.getQrcodeState())) { if (memberCount >= groupQrcodeDTO.getChangeNumber() && QrcodeStatusEnum.ON_USE.value.equals(groupQrcodeDTO.getQrcodeState())) {
//修改状态,重新分配一个群 //修改状态,重新分配一个群
...@@ -397,24 +470,36 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz { ...@@ -397,24 +470,36 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
/** /**
* 重新分配一个群 * 重新分配一个群
*/ */
@ParamLog("重新分配一个群")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void addWechatGroup(Long classifyId, Long groupQrcodeId) { public void addWechatGroup(Long classifyId, Long groupQrcodeId) {
WeixinQrcodeDTO oneQrcode = weixinQrcodeBiz.getOneQrcode(); Integer generation = null;
ClassifyVO classifyVOOne = bookGroupClassifyBiz.getClassify(classifyId);
if (classifyVOOne != null && classifyVOOne.getBookGroupId() != null) {
QrcodeNameAndProIdDTO qrcodeNameAndProId = bookGroupBiz.getQrcodeNameAndProId(classifyVOOne.getBookGroupId());
if (qrcodeNameAndProId != null && new Integer(2).equals(qrcodeNameAndProId.getJoinGroupType())) {
generation = 3;
}
}
WeixinQrcodeDTO oneQrcode = weixinQrcodeBiz.getOneQrcode(generation);
log.info("[重新分配一个群] : oneQrcode:{}", oneQrcode);
if (oneQrcode != null) { if (oneQrcode != null) {
//将二维码改为已满群状态 //将二维码改为已满群状态
Integer number = groupQrcodeDao.changeQrcodeState(groupQrcodeId, QrcodeStatusEnum.OVER_NUMBER.value); Integer number = groupQrcodeDao.changeQrcodeState(groupQrcodeId, QrcodeStatusEnum.OVER_NUMBER.value);
log.info("[重新分配一个群] : groupQrcodeDao.changeQrcodeState number:{}", number);
if (number > 0){ if (number > 0){
//获取标签对应基本信息 //获取标签对应基本信息
GroupNameAndMaxSeqDTO groupNameAndMaxSeqDTO = bookGroupClassifyBiz.getGroupNameAndMaxSeq(classifyId); GroupNameAndMaxSeqDTO groupNameAndMaxSeqDTO = bookGroupClassifyBiz.getGroupNameAndMaxSeq(classifyId);
log.info("[重新分配一个群] : groupNameAndMaxSeqDTO:{}", groupNameAndMaxSeqDTO);
if (groupNameAndMaxSeqDTO != null) { if (groupNameAndMaxSeqDTO != null) {
Integer maxSeq = groupNameAndMaxSeqDTO.getMaxSeq() + 1; Integer maxSeq = groupNameAndMaxSeqDTO.getMaxSeq() + 1;
String groupName = groupNameAndMaxSeqDTO.getGroupQrcodeName() + groupNameAndMaxSeqDTO.getClassify() + maxSeq + "群"; String groupName = groupNameAndMaxSeqDTO.getGroupQrcodeName() + groupNameAndMaxSeqDTO.getClassify() + maxSeq + "群";
// 群长度超过16部分会被截取,导致群名称重复 // 群长度超过16部分会被截取,导致群名称重复
if (groupName.length() > 16) { if (groupName.length() > 15) {
final String s = maxSeq + "群"; final String s = maxSeq + "群";
groupName = groupNameAndMaxSeqDTO.getClassify() + s; groupName = groupNameAndMaxSeqDTO.getClassify() + s;
if (groupName.length() > 16) { if (groupName.length() > 15) {
groupName = groupNameAndMaxSeqDTO.getClassify().substring(0, 16 - s.length()) + s; groupName = groupNameAndMaxSeqDTO.getClassify().substring(0, 15 - s.length()) + s;
} }
} }
GroupQrcode groupQrcode = new GroupQrcode(); GroupQrcode groupQrcode = new GroupQrcode();
......
...@@ -84,8 +84,8 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz { ...@@ -84,8 +84,8 @@ public class WeixinQrcodeBizImpl implements WeixinQrcodeBiz {
@Override @Override
@ParamLog("从二维码库获取一个二维码") @ParamLog("从二维码库获取一个二维码")
@Transactional(propagation = Propagation.NOT_SUPPORTED) @Transactional(propagation = Propagation.NOT_SUPPORTED)
public WeixinQrcodeDTO getOneQrcode() { public WeixinQrcodeDTO getOneQrcode(Integer generation) {
WeixinQrcodeDTO qrcodeVO = weixinQrcodeDao.getOneWechatGroup(); WeixinQrcodeDTO qrcodeVO = weixinQrcodeDao.getOneWechatGroup(generation);
if (qrcodeVO == null) { if (qrcodeVO == null) {
return null; return null;
} }
......
package com.pcloud.book.group.constants;
import com.pcloud.book.group.dto.AutoUpdateGroupNumDTO;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* book业务常量类
*/
public class BookBusinessConstants {
/**
* 需更新微信群信息
*/
public static final Map<String, AutoUpdateGroupNumDTO> GROUP_NUM_DTO_MAP = new ConcurrentHashMap<>(128);
}
...@@ -132,6 +132,11 @@ public interface BookGroupClassifyDao extends BaseDao<BookGroupClassify> { ...@@ -132,6 +132,11 @@ public interface BookGroupClassifyDao extends BaseDao<BookGroupClassify> {
GroupClassifyQrcodeDTO getClassifyQrcodeInfo(String weixinGroupId); GroupClassifyQrcodeDTO getClassifyQrcodeInfo(String weixinGroupId);
/** /**
* 批量获取分类信息
*/
List<GroupClassifyQrcodeDTO> listClassifyQrcodeInfo(List<Long> classifyIds);
/**
* @Author:lili * @Author:lili
* @Desr:获取所有的分类 * @Desr:获取所有的分类
* @Date:2019/4/29 11:23 * @Date:2019/4/29 11:23
......
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.pcloud.book.group.dto.BookGroupDTO; import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.PersonalQrcodeDTO;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO; import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.entity.BookGroup; import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
...@@ -120,6 +121,13 @@ public interface BookGroupDao extends BaseDao<BookGroup> { ...@@ -120,6 +121,13 @@ public interface BookGroupDao extends BaseDao<BookGroup> {
Boolean isSpecialAgent(Long agentId); Boolean isSpecialAgent(Long agentId);
/** /**
* @description 更新个人二维码
* @author 戴兴
* @date 2019/8/7 16:49
*/
void updatePersonQrcode(PersonalQrcodeDTO personalQrcodeDTO);
/**
* 获取社群书基本信息(包括书籍封面isbn号) * 获取社群书基本信息(包括书籍封面isbn号)
* @param paramMap * @param paramMap
* @return * @return
......
package com.pcloud.book.group.dao;
import com.pcloud.book.group.dto.JoinGroupCipherDTO;
import com.pcloud.book.group.entity.JoinGroupCipher;
import com.pcloud.common.core.dao.BaseDao;
import java.math.BigDecimal;
import java.util.List;
public interface JoinGroupCipherDao extends BaseDao<JoinGroupCipher> {
JoinGroupCipher getByWechatUserId(Long wechatUserId,Long classifyId);
JoinGroupCipher getByCipher(String cipher);
JoinGroupCipherDTO getDTOByCipher(String cipher);
void updateCipherStateToUsed(String cipher, String wxId);
List<JoinGroupCipherDTO> getClassifyIdsByWxIdAndAltId(String wxId, String altId);
void updateQrcodeId(String cipher, String wxId, Long qrcodeId);
/**
* 用户支付金额
* @param wxId
* @param qrcodeId
* @return
*/
BigDecimal getPayPrice(String wxId, Long qrcodeId);
}
package com.pcloud.book.group.dao;
import com.pcloud.book.group.entity.TempletRelevance;
import com.pcloud.common.core.dao.BaseDao;
public interface TempletRelevanceDao extends BaseDao<TempletRelevance> {
TempletRelevance getByTempletId(Long templetId);
}
...@@ -24,7 +24,7 @@ public interface WeixinQrcodeDao extends BaseDao<WeixinQrcode> { ...@@ -24,7 +24,7 @@ public interface WeixinQrcodeDao extends BaseDao<WeixinQrcode> {
* @Desr:获取一个微信群 * @Desr:获取一个微信群
* @Date:2019/3/12 18:04 * @Date:2019/3/12 18:04
*/ */
WeixinQrcodeDTO getOneWechatGroup(); WeixinQrcodeDTO getOneWechatGroup(Integer generation);
/** /**
* @Author:lili * @Author:lili
...@@ -155,4 +155,9 @@ public interface WeixinQrcodeDao extends BaseDao<WeixinQrcode> { ...@@ -155,4 +155,9 @@ public interface WeixinQrcodeDao extends BaseDao<WeixinQrcode> {
Map<String, BookWxQrcodeDTO> listByWxGroupIds(List<String> wxGroupIds); Map<String, BookWxQrcodeDTO> listByWxGroupIds(List<String> wxGroupIds);
String getVirtualIp(Integer generation); String getVirtualIp(Integer generation);
/**
* 根据状态获取群数量
*/
Integer countByState(Integer state, List<String> altIds);
} }
...@@ -110,6 +110,11 @@ public class BookGroupClassifyDaoImpl extends BaseDaoImpl<BookGroupClassify> imp ...@@ -110,6 +110,11 @@ public class BookGroupClassifyDaoImpl extends BaseDaoImpl<BookGroupClassify> imp
} }
@Override @Override
public List<GroupClassifyQrcodeDTO> listClassifyQrcodeInfo(List<Long> classifyIds) {
return this.getSqlSession().selectList(this.getStatement("listClassifyQrcodeInfo"), classifyIds);
}
@Override
public List<ListClassify4WechatVO> listClassify4Wechat(Long bookGroupId, Integer rankType) { public List<ListClassify4WechatVO> listClassify4Wechat(Long bookGroupId, Integer rankType) {
Map<String, Object> paramMap = new HashMap(); Map<String, Object> paramMap = new HashMap();
paramMap.put("bookGroupId", bookGroupId); paramMap.put("bookGroupId", bookGroupId);
......
...@@ -3,6 +3,8 @@ package com.pcloud.book.group.dao.impl; ...@@ -3,6 +3,8 @@ package com.pcloud.book.group.dao.impl;
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 com.pcloud.book.group.dto.PersonalQrcodeDTO;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import com.pcloud.book.group.dao.BookGroupDao; import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dto.BookGroupDTO; import com.pcloud.book.group.dto.BookGroupDTO;
...@@ -124,6 +126,14 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou ...@@ -124,6 +126,14 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou
} }
@Override @Override
public void updatePersonQrcode(PersonalQrcodeDTO personalQrcodeDTO) {
Map<String,Object> map = new HashMap<>();
map.put("newQrcodeUrl",personalQrcodeDTO.getNewQrcodeUrl());
map.put("oldQrcodeUrl",personalQrcodeDTO.getOldQrcodeUrl());
this.getSqlSession().update(this.getStatement("updatePersonQrcode"), map);
}
@Override
public List<BookGroupDTO> getBookInfoByIdsWithBookClockInfoId(Map<String,Object> paramMap) { public List<BookGroupDTO> getBookInfoByIdsWithBookClockInfoId(Map<String,Object> paramMap) {
return this.getSqlSession().selectList(this.getStatement("getBookInfoByIdsWithBookClockInfoId"), paramMap); return this.getSqlSession().selectList(this.getStatement("getBookInfoByIdsWithBookClockInfoId"), paramMap);
} }
......
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.JoinGroupCipherDao;
import com.pcloud.book.group.dto.JoinGroupCipherDTO;
import com.pcloud.book.group.entity.JoinGroupCipher;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/5 16:18
**/
@Component("joinGroupCipherDao")
public class JoinGroupCipherDaoImpl extends BaseDaoImpl<JoinGroupCipher> implements JoinGroupCipherDao {
@Override
public JoinGroupCipher getByWechatUserId(Long wechatUserId,Long classifyId) {
Map<String,Object> map=new HashMap<>();
map.put("wechatUserId",wechatUserId);
map.put("classifyId",classifyId);
return this.getSqlSession().selectOne(this.getStatement("getByWechatUserId"), map);
}
@Override
public JoinGroupCipher getByCipher(String cipher) {
return this.getSqlSession().selectOne(this.getStatement("getByCipher"), cipher);
}
@Override
public JoinGroupCipherDTO getDTOByCipher(String cipher) {
return this.getSqlSession().selectOne(this.getStatement("getDTOByCipher"), cipher);
}
@Override
public void updateCipherStateToUsed(String cipher, String wxId) {
Map<String,Object> map=new HashMap<>();
map.put("cipher",cipher);
map.put("wxId",wxId);
this.getSqlSession().update(this.getStatement("updateCipherStateToUsed"), map);
}
@Override
public List<JoinGroupCipherDTO> getClassifyIdsByWxIdAndAltId(String wxId, String altId) {
Map<String,Object> map=new HashMap<>();
map.put("wxId",wxId);
map.put("altId",altId);
return this.getSqlSession().selectList(this.getStatement("getClassifyIdsByWxIdAndAltId"), map);
}
@Override
public void updateQrcodeId(String cipher, String wxId, Long qrcodeId) {
Map<String,Object> map=new HashMap<>();
map.put("cipher",cipher);
map.put("wxId",wxId);
map.put("qrcodeId",qrcodeId);
this.getSqlSession().update(this.getStatement("updateQrcodeId"), map);
}
@Override
public BigDecimal getPayPrice(String wxId, Long qrcodeId) {
Map<String, Object> map = new HashMap<>();
map.put("wxId", wxId);
map.put("qrcodeId", qrcodeId);
return getSessionTemplate().selectOne(getStatement("getPayPrice"), map);
}
}
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.TempletRelevanceDao;
import com.pcloud.book.group.entity.TempletRelevance;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/5 16:19
**/
@Component("templetRelevanceDao")
public class TempletRelevanceDaoImpl extends BaseDaoImpl<TempletRelevance> implements TempletRelevanceDao {
@Override
public TempletRelevance getByTempletId(Long templetId) {
return this.getSqlSession().selectOne(this.getStatement("getByTempletId"), templetId);
}
}
...@@ -25,8 +25,10 @@ import java.util.Map; ...@@ -25,8 +25,10 @@ import java.util.Map;
@Component("WeixinQrcodeDao") @Component("WeixinQrcodeDao")
public class WeixinQrcodeDaoImpl extends BaseDaoImpl<WeixinQrcode> implements WeixinQrcodeDao { public class WeixinQrcodeDaoImpl extends BaseDaoImpl<WeixinQrcode> implements WeixinQrcodeDao {
@Override @Override
public WeixinQrcodeDTO getOneWechatGroup() { public WeixinQrcodeDTO getOneWechatGroup(Integer generation) {
return this.getSqlSession().selectOne(this.getStatement("getOneWechatGroup")); Map<String, Object> paramMap = new HashMap();
paramMap.put("generation", generation);
return this.getSqlSession().selectOne(this.getStatement("getOneWechatGroup"),paramMap);
} }
@Override @Override
...@@ -154,4 +156,12 @@ public class WeixinQrcodeDaoImpl extends BaseDaoImpl<WeixinQrcode> implements We ...@@ -154,4 +156,12 @@ public class WeixinQrcodeDaoImpl extends BaseDaoImpl<WeixinQrcode> implements We
public String getVirtualIp(Integer generation) { public String getVirtualIp(Integer generation) {
return this.getSessionTemplate().selectOne("getVirtualIp", generation); return this.getSessionTemplate().selectOne("getVirtualIp", generation);
} }
@Override
public Integer countByState(Integer state, List<String> altIds) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("state", state);
paramMap.put("altIds", altIds);
return this.getSessionTemplate().selectOne("countByState", paramMap);
}
} }
package com.pcloud.book.group.dto;
import java.util.Date;
import java.util.concurrent.atomic.AtomicInteger;
import lombok.Data;
/**
* 自动更新群人数DTO
*/
@Data
public class AutoUpdateGroupNumDTO {
/**
* 群id
*/
private String wxGroupId;
/**
* 机器人id
*/
private String robotId;
/**
* wxGroupIp
*/
private String ip;
/**
* 当前触发次数
*/
private AtomicInteger num = new AtomicInteger(1);
/**
* 开始更新时间(犹豫微信有延迟,所以新用户进群之后30s再次更新群人数)
*/
private Date startTime;
public AutoUpdateGroupNumDTO() {
}
public AutoUpdateGroupNumDTO(String wxGroupId, String robotId, String ip, Date startTime) {
this.wxGroupId = wxGroupId;
this.robotId = robotId;
this.ip = ip;
this.num = new AtomicInteger(1);
this.startTime = startTime;
}
}
...@@ -142,6 +142,11 @@ public class BookGroupDTO extends BaseDto { ...@@ -142,6 +142,11 @@ public class BookGroupDTO extends BaseDto {
*/ */
private Boolean isShowBookName; private Boolean isShowBookName;
/**
* 进群方式:1群二维码,2客服机器人
*/
private Integer joinGroupType;
public String getUrl() { public String getUrl() {
return url; return url;
} }
...@@ -359,6 +364,14 @@ public class BookGroupDTO extends BaseDto { ...@@ -359,6 +364,14 @@ public class BookGroupDTO extends BaseDto {
this.isShowBookName = isShowBookName; this.isShowBookName = isShowBookName;
} }
public Integer getJoinGroupType() {
return joinGroupType;
}
public void setJoinGroupType(Integer joinGroupType) {
this.joinGroupType = joinGroupType;
}
@Override @Override
public String toString() { public String toString() {
return "BookGroupDTO{" + return "BookGroupDTO{" +
...@@ -388,7 +401,8 @@ public class BookGroupDTO extends BaseDto { ...@@ -388,7 +401,8 @@ public class BookGroupDTO extends BaseDto {
", bookName='" + bookName + '\'' + ", bookName='" + bookName + '\'' +
", url='" + url + '\'' + ", url='" + url + '\'' +
", bookClockInfoId=" + bookClockInfoId + ", bookClockInfoId=" + bookClockInfoId +
", isShowBookName='" + isShowBookName + '\'' + ", isShowBookName=" + isShowBookName +
", joinGroupType=" + joinGroupType +
"} " + super.toString(); "} " + super.toString();
} }
} }
\ No newline at end of file
...@@ -82,6 +82,8 @@ public class ClassifyDTO implements Serializable { ...@@ -82,6 +82,8 @@ public class ClassifyDTO implements Serializable {
private Long bookClockInfoId; private Long bookClockInfoId;
private Long createUser;
public Integer getRank() { public Integer getRank() {
return rank; return rank;
} }
...@@ -194,6 +196,14 @@ public class ClassifyDTO implements Serializable { ...@@ -194,6 +196,14 @@ public class ClassifyDTO implements Serializable {
this.bookClockInfoId = bookClockInfoId; this.bookClockInfoId = bookClockInfoId;
} }
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
@Override @Override
public String toString() { public String toString() {
return "ClassifyDTO{" + return "ClassifyDTO{" +
...@@ -211,6 +221,7 @@ public class ClassifyDTO implements Serializable { ...@@ -211,6 +221,7 @@ public class ClassifyDTO implements Serializable {
", changeNumber=" + changeNumber + ", changeNumber=" + changeNumber +
", rank=" + rank + ", rank=" + rank +
", bookClockInfoId=" + bookClockInfoId + ", bookClockInfoId=" + bookClockInfoId +
", createUser=" + createUser +
'}'; '}';
} }
} }
package com.pcloud.book.group.dto;
import lombok.Data;
@Data
public class JoinGroupCipherDTO {
private String cipher;
private Long classifyId;
private Long qrcodeId;
private Long wechatUserId;
private String wxId;
private Boolean hasUsed;
private Long bookGroupId;
}
package com.pcloud.book.group.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/5 17:14
**/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class OwnAltQrcodeInfoDTO implements Serializable {
@ApiModelProperty("小号id")
private String altId;
@ApiModelProperty("小号昵称")
private String altNickName;
@ApiModelProperty("小号头像")
private String altHeadUrl;
@ApiModelProperty("小号二维码地址")
private String altQrcodeUrl;
@ApiModelProperty("暗号")
private String cipher;
public String getAltId() {
return altId;
}
public void setAltId(String altId) {
this.altId = altId;
}
public String getAltNickName() {
return altNickName;
}
public void setAltNickName(String altNickName) {
this.altNickName = altNickName;
}
public String getAltHeadUrl() {
return altHeadUrl;
}
public void setAltHeadUrl(String altHeadUrl) {
this.altHeadUrl = altHeadUrl;
}
public String getAltQrcodeUrl() {
return altQrcodeUrl;
}
public void setAltQrcodeUrl(String altQrcodeUrl) {
this.altQrcodeUrl = altQrcodeUrl;
}
public String getCipher() {
return cipher;
}
public void setCipher(String cipher) {
this.cipher = cipher;
}
@Override
public String toString() {
return "OwnAltQrcodeInfoDTO{" +
"altId='" + altId + '\'' +
", altNickName='" + altNickName + '\'' +
", altHeadUrl='" + altHeadUrl + '\'' +
", altQrcodeUrl='" + altQrcodeUrl + '\'' +
", cipher='" + cipher + '\'' +
'}';
}
}
...@@ -18,6 +18,11 @@ public class QrcodeNameAndProIdDTO { ...@@ -18,6 +18,11 @@ public class QrcodeNameAndProIdDTO {
*/ */
private Long productId; private Long productId;
/**
* 进群方式:1群二维码,2客服机器人
*/
private Integer joinGroupType;
public Long getBookGroupId() { public Long getBookGroupId() {
return bookGroupId; return bookGroupId;
} }
...@@ -42,12 +47,21 @@ public class QrcodeNameAndProIdDTO { ...@@ -42,12 +47,21 @@ public class QrcodeNameAndProIdDTO {
this.productId = productId; this.productId = productId;
} }
public Integer getJoinGroupType() {
return joinGroupType;
}
public void setJoinGroupType(Integer joinGroupType) {
this.joinGroupType = joinGroupType;
}
@Override @Override
public String toString() { public String toString() {
return "QrcodeNameAndProIdDTO{" + return "QrcodeNameAndProIdDTO{" +
"bookGroupId=" + bookGroupId + "bookGroupId=" + bookGroupId +
", groupQrcodeName='" + groupQrcodeName + '\'' + ", groupQrcodeName='" + groupQrcodeName + '\'' +
", productId=" + productId + ", productId=" + productId +
", joinGroupType=" + joinGroupType +
'}'; '}';
} }
} }
...@@ -102,6 +102,11 @@ public class BookGroup extends BaseEntity { ...@@ -102,6 +102,11 @@ public class BookGroup extends BaseEntity {
*/ */
private Boolean isShowBookName; private Boolean isShowBookName;
/**
* 进群方式:1群二维码,2客服机器人
*/
private Integer joinGroupType;
public Long getId() { public Long getId() {
return id; return id;
} }
...@@ -246,6 +251,14 @@ public class BookGroup extends BaseEntity { ...@@ -246,6 +251,14 @@ public class BookGroup extends BaseEntity {
this.isShowBookName = isShowBookName; this.isShowBookName = isShowBookName;
} }
public Integer getJoinGroupType() {
return joinGroupType;
}
public void setJoinGroupType(Integer joinGroupType) {
this.joinGroupType = joinGroupType;
}
@Override @Override
public String toString() { public String toString() {
return "BookGroup{" + return "BookGroup{" +
...@@ -267,6 +280,7 @@ public class BookGroup extends BaseEntity { ...@@ -267,6 +280,7 @@ public class BookGroup extends BaseEntity {
", updateTime=" + updateTime + ", updateTime=" + updateTime +
", isDelete=" + isDelete + ", isDelete=" + isDelete +
", isShowBookName=" + isShowBookName + ", isShowBookName=" + isShowBookName +
", joinGroupType=" + joinGroupType +
"} " + super.toString(); "} " + super.toString();
} }
} }
\ No newline at end of file
package com.pcloud.book.group.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/5 15:59
**/
public class JoinGroupCipher extends BaseEntity {
private static final long serialVersionUID = -8724831387632496417L;
@ApiModelProperty("密码")
private String cipher;
@ApiModelProperty("分类id")
private Long classifyId;
@ApiModelProperty("群id")
private Long qrcodeId;
@ApiModelProperty("创建人")
private Long wechatUserId;
@ApiModelProperty("使用人微信id")
private String wxId;
@ApiModelProperty("是否使用")
private Boolean hasUsed;
@ApiModelProperty("机器人id")
private String altId;
public String getCipher() {
return cipher;
}
public void setCipher(String cipher) {
this.cipher = cipher;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getQrcodeId() {
return qrcodeId;
}
public void setQrcodeId(Long qrcodeId) {
this.qrcodeId = qrcodeId;
}
public Long getWechatUserId() {
return wechatUserId;
}
public void setWechatUserId(Long wechatUserId) {
this.wechatUserId = wechatUserId;
}
public String getWxId() {
return wxId;
}
public void setWxId(String wxId) {
this.wxId = wxId;
}
public Boolean getHasUsed() {
return hasUsed;
}
public void setHasUsed(Boolean hasUsed) {
this.hasUsed = hasUsed;
}
public String getAltId() {
return altId;
}
public void setAltId(String altId) {
this.altId = altId;
}
@Override
public String toString() {
return "JoinGroupCipher{" +
"cipher='" + cipher + '\'' +
", classifyId=" + classifyId +
", qrcodeId=" + qrcodeId +
", wechatUserId=" + wechatUserId +
", wxId='" + wxId + '\'' +
", hasUsed=" + hasUsed +
", altId='" + altId + '\'' +
"} " + super.toString();
}
}
package com.pcloud.book.group.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description 分类关联表
* @Author ruansiyuan
* @Date 2019/8/5 15:47
**/
public class TempletRelevance extends BaseEntity {
private static final long serialVersionUID = 5014986282950538055L;
@ApiModelProperty("分类id")
private Long templetId;
@ApiModelProperty("大类id")
private Integer largeTemplet;
public Long getTempletId() {
return templetId;
}
public void setTempletId(Long templetId) {
this.templetId = templetId;
}
public Integer getLargeTemplet() {
return largeTemplet;
}
public void setLargeTemplet(Integer largeTemplet) {
this.largeTemplet = largeTemplet;
}
@Override
public String toString() {
return "TempletRelevance{" +
"templetId=" + templetId +
", largeTemplet=" + largeTemplet +
"} " + super.toString();
}
}
package com.pcloud.book.group.enums;
public enum LargTempletEnum {
/**
* K12类
*/
K12(1, "K12类"),
/**
* 少儿类
*/
CHILD(2, "少儿类"),
/**
* 高等/职教
*/
HIGH(3, "高等/职教"),
/**
* 大众类
*/
GENERAL(4, "大众类");
public final Integer code;
public final String name;
LargTempletEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
}
...@@ -3,6 +3,7 @@ package com.pcloud.book.group.facade; ...@@ -3,6 +3,7 @@ package com.pcloud.book.group.facade;
import com.pcloud.book.group.entity.BookGroupClassify; import com.pcloud.book.group.entity.BookGroupClassify;
import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.JsonParseException;
import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.CookieValue; 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;
...@@ -275,4 +276,16 @@ public interface BookGroupFacade { ...@@ -275,4 +276,16 @@ public interface BookGroupFacade {
@RequestHeader("token") String token @RequestHeader("token") String token
) throws BizException, PermissionException, JsonParseException; ) throws BizException, PermissionException, JsonParseException;
@ApiOperation("根据分类id获取个人二维码")
@GetMapping("getOwnAltQrcodeInfoDTOByClassifyId")
ResponseDto<?> getOwnAltQrcodeInfoDTOByClassifyId(
@CookieValue("userInfo") String userInfo,
@RequestParam("classifyId") Long classifyId
) throws BizException, PermissionException, JsonParseException;
@ApiOperation("获取所有的大类")
@GetMapping("getAllLargeTemplet")
ResponseDto<?> getAllLargeTemplet(
@RequestHeader("token") String token
) throws BizException, PermissionException, JsonParseException;
} }
...@@ -3,6 +3,7 @@ package com.pcloud.book.group.facade.impl; ...@@ -3,6 +3,7 @@ package com.pcloud.book.group.facade.impl;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
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.dto.GroupStoreMyPayDto;
import com.pcloud.book.group.entity.BookGroup; import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.entity.BookGroupClassify; import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.facade.BookGroupFacade; import com.pcloud.book.group.facade.BookGroupFacade;
...@@ -19,6 +20,7 @@ import com.pcloud.common.utils.string.StringUtil; ...@@ -19,6 +20,7 @@ import com.pcloud.common.utils.string.StringUtil;
import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.JsonParseException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.CookieValue; 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;
...@@ -394,4 +396,30 @@ public class BookGroupFacadeImpl implements BookGroupFacade { ...@@ -394,4 +396,30 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID); Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(bookGroupBiz.getIsShowBookName(partyId)); return new ResponseDto<>(bookGroupBiz.getIsShowBookName(partyId));
} }
@ApiOperation("根据分类id获取个人二维码")
@GetMapping("getOwnAltQrcodeInfoDTOByClassifyId")
@Override
public ResponseDto<?> getOwnAltQrcodeInfoDTOByClassifyId(
@CookieValue("userInfo") String userInfo,
@RequestParam("classifyId") Long classifyId
) throws BizException, PermissionException, JsonParseException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
if (classifyId == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "分类不能为空!");
}
return new ResponseDto<>(bookGroupBiz.getOwnAltQrcodeInfoDTOByClassifyId(wechatUserId, classifyId));
}
@ApiOperation("获取所有的大类")
@GetMapping("getAllLargeTemplet")
@Override
public ResponseDto<?> getAllLargeTemplet(
@RequestHeader("token") String token
) throws BizException, PermissionException, JsonParseException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(bookGroupBiz.getAllLargTemplet());
}
} }
...@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
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;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -67,7 +68,7 @@ public class BookGroupClassifyServiceImpl implements BookGroupClassifyService { ...@@ -67,7 +68,7 @@ public class BookGroupClassifyServiceImpl implements BookGroupClassifyService {
@ApiImplicitParam(name = "query", value = "书籍名称", dataType = "string",required = false, paramType = "query"), @ApiImplicitParam(name = "query", value = "书籍名称", dataType = "string",required = false, paramType = "query"),
@ApiImplicitParam(name = "proLabelId", value = "专业标签id", dataType = "long",required = false, paramType = "query"), @ApiImplicitParam(name = "proLabelId", value = "专业标签id", dataType = "long",required = false, paramType = "query"),
@ApiImplicitParam(name = "depLabelId", value = "深度标签id", dataType = "long",required = false, paramType = "query"), @ApiImplicitParam(name = "depLabelId", value = "深度标签id", dataType = "long",required = false, paramType = "query"),
@ApiImplicitParam(name = "purLabelId", value = "目的标签id", dataType = "string",required = false, paramType = "query") @ApiImplicitParam(name = "purLabelId", value = "目的标签id", dataType = "long",required = false, paramType = "query")
}) })
@GetMapping("listQrcodeIdsByLabelQuery") @GetMapping("listQrcodeIdsByLabelQuery")
public ResponseEntity<ResponseDto<List<Long>>> listQrcodeIdsByLabelQuery( public ResponseEntity<ResponseDto<List<Long>>> listQrcodeIdsByLabelQuery(
...@@ -85,4 +86,14 @@ public class BookGroupClassifyServiceImpl implements BookGroupClassifyService { ...@@ -85,4 +86,14 @@ public class BookGroupClassifyServiceImpl implements BookGroupClassifyService {
List<Long>qrcodeIds = groupQrcodeBiz.filterDeleteId(wxGroupIdList); List<Long>qrcodeIds = groupQrcodeBiz.filterDeleteId(wxGroupIdList);
return ResponseHandleUtil.toResponse(qrcodeIds); return ResponseHandleUtil.toResponse(qrcodeIds);
} }
@Override
@GetMapping("getPayPrice")
@ApiImplicitParams({
@ApiImplicitParam(name = "qrcodeId", value = "qrcodeId", dataType = "long", required = true, paramType = "query"),
@ApiImplicitParam(name = "wxUserId", value = "wxUserId", dataType = "string", required = true, paramType = "query")
})
public ResponseEntity<ResponseDto<BigDecimal>> getPayPrice(@RequestParam("qrcodeId") Long qrcodeId, @RequestParam("wxUserId") String wxUserId) {
return ResponseHandleUtil.toResponse(bookGroupClassifyBiz.getPayPrice(qrcodeId, wxUserId));
}
} }
...@@ -3,13 +3,14 @@ package com.pcloud.book.group.service.impl; ...@@ -3,13 +3,14 @@ package com.pcloud.book.group.service.impl;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.pcloud.book.group.dto.PersonalQrcodeDTO;
import com.pcloud.book.group.dto.GroupCipherDTO;
import com.pcloud.book.group.dto.GroupUseDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.pcloud.book.group.biz.BookGroupBiz; import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.dto.BookGroupDTO; import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.service.BookGroupService; import com.pcloud.book.group.service.BookGroupService;
...@@ -86,4 +87,48 @@ public class BookGroupServiceImpl implements BookGroupService { ...@@ -86,4 +87,48 @@ public class BookGroupServiceImpl implements BookGroupService {
return ResponseHandleUtil.toResponse(bookGroupBiz.getBaseInfoBySceneId(sceneId)); return ResponseHandleUtil.toResponse(bookGroupBiz.getBaseInfoBySceneId(sceneId));
} }
@Override
@RequestMapping(value = "updatePersonQrcode",method = RequestMethod.POST)
public void updatePersonQrcode(@RequestBody PersonalQrcodeDTO personalQrcodeDTO) throws BizException {
bookGroupBiz.updatePersonQrcode(personalQrcodeDTO);
}
/**
* 获取暗号状态
*/
@ApiOperation("获取暗号状态")
@GetMapping("/getCipherState")
@Override
public ResponseEntity<ResponseDto<Integer>> getCipherState(String cipher) throws BizException {
return ResponseHandleUtil.toResponse(bookGroupBiz.getCipherState(cipher));
}
/**
* 更新密码状态为已使用
*/
@ApiOperation("更新暗号状态为已使用")
@GetMapping("/updateCipherStateToUsed")
@Override
public void updateCipherStateToUsed(String cipher, String wxId) throws BizException {
bookGroupBiz.updateCipherStateToUsed(cipher,wxId);
}
/**
* 获取个人二维码方式群已使用和未使用数量
*/
@ApiOperation("获取个人二维码方式群已使用和未使用数量")
@PostMapping("/getGroupUse")
@Override
public ResponseEntity<ResponseDto<GroupUseDTO>> getGroupUse(@RequestBody List<String> altIds) throws BizException {
return ResponseHandleUtil.toResponse(bookGroupBiz.getGroupUse(altIds));
}
@ApiOperation("获取暗号基本信息")
@GetMapping("/getJoinGroupCipher")
@Override
public ResponseEntity<ResponseDto<GroupCipherDTO>> getJoinGroupCipher(@RequestParam("cipher")String cipher) throws BizException {
return ResponseHandleUtil.toResponse(bookGroupBiz.getJoinGroupCipher(cipher));
}
} }
...@@ -88,7 +88,7 @@ public class WeixinQrcodeServiceImpl implements WeixinQrcodeService { ...@@ -88,7 +88,7 @@ public class WeixinQrcodeServiceImpl implements WeixinQrcodeService {
@Override @Override
@GetMapping("getOneQrcode") @GetMapping("getOneQrcode")
public ResponseEntity<ResponseDto<WeixinQrcodeDTO>> getOneQrcode() { public ResponseEntity<ResponseDto<WeixinQrcodeDTO>> getOneQrcode() {
return ResponseHandleUtil.toResponse(weixinQrcodeBiz.getOneQrcode()); return ResponseHandleUtil.toResponse(weixinQrcodeBiz.getOneQrcode(null));
} }
@Override @Override
......
...@@ -18,6 +18,7 @@ import com.pcloud.common.utils.string.StringUtil; ...@@ -18,6 +18,7 @@ import com.pcloud.common.utils.string.StringUtil;
import com.sdk.wxgroup.ChangeNameVO; import com.sdk.wxgroup.ChangeNameVO;
import com.sdk.wxgroup.QrcodeVO; import com.sdk.wxgroup.QrcodeVO;
import com.sdk.wxgroup.SendArticleMessageVO; import com.sdk.wxgroup.SendArticleMessageVO;
import com.sdk.wxgroup.SendMessageTypeEnum;
import com.sdk.wxgroup.SendPicMessageVO; import com.sdk.wxgroup.SendPicMessageVO;
import com.sdk.wxgroup.SendTextMessageVO; import com.sdk.wxgroup.SendTextMessageVO;
import com.sdk.wxgroup.WxGroupSDK; import com.sdk.wxgroup.WxGroupSDK;
...@@ -127,8 +128,8 @@ public class SendWeixinRequestTools { ...@@ -127,8 +128,8 @@ public class SendWeixinRequestTools {
}*/ }*/
} }
@ParamLog("修改微信群名称") @ParamLog("发送欢迎语消息")
public static void sendGuideMessage(List<ReplyMessageVO> replyMessages, String robotId, String weixinGroupId, String ip) { public static void sendGuideMessage(List<ReplyMessageVO> replyMessages, String robotId, String weixinGroupId, 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;
...@@ -148,37 +149,40 @@ public class SendWeixinRequestTools { ...@@ -148,37 +149,40 @@ public class SendWeixinRequestTools {
} }
} }
} }
sendMessage(sendMessageDTO, robotId, weixinGroupId, ip); sendMessage(sendMessageDTO, robotId, weixinGroupId, ip, code);
i++; i++;
} }
} }
@ParamLog("推送消息") @ParamLog("推送消息")
private static void sendMessage(SendMessageDTO sendMessageDTO, String robotId, String weixinGroupId, String ip) { private static void sendMessage(SendMessageDTO sendMessageDTO, String robotId, String weixinGroupId, String ip, Integer code) {
if (ReplyTypeEnum.TEXT.value.equals(sendMessageDTO.getReplyType())) { if (ReplyTypeEnum.TEXT.value.equals(sendMessageDTO.getReplyType())) {
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO(); SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setContent(sendMessageDTO.getContent()); sendTextMessageVO.setContent(sendMessageDTO.getContent());
sendTextMessageVO.setAltId(robotId); sendTextMessageVO.setAltId(robotId);
sendTextMessageVO.setGroupId(weixinGroupId); sendTextMessageVO.setWxGroupId(weixinGroupId);
sendTextMessageVO.setIp(ip); sendTextMessageVO.setIp(ip);
sendTextMessageVO.setCode(code);
WxGroupSDK.sendTextMessage(sendTextMessageVO); WxGroupSDK.sendTextMessage(sendTextMessageVO);
} else if (ReplyTypeEnum.IMAGE.value.equals(sendMessageDTO.getReplyType())) { } else if (ReplyTypeEnum.IMAGE.value.equals(sendMessageDTO.getReplyType())) {
SendPicMessageVO sendPicMessageVO = new SendPicMessageVO(); SendPicMessageVO sendPicMessageVO = new SendPicMessageVO();
sendPicMessageVO.setGroupId(weixinGroupId); sendPicMessageVO.setWxGroupId(weixinGroupId);
sendPicMessageVO.setAltId(robotId); sendPicMessageVO.setAltId(robotId);
sendPicMessageVO.setPicUrl(sendMessageDTO.getPicUrl()); sendPicMessageVO.setPicUrl(sendMessageDTO.getPicUrl());
sendPicMessageVO.setIp(ip); sendPicMessageVO.setIp(ip);
sendPicMessageVO.setCode(code);
WxGroupSDK.sendPicMessage(sendPicMessageVO); WxGroupSDK.sendPicMessage(sendPicMessageVO);
} else if (ReplyTypeEnum.APP.value.equals(sendMessageDTO.getReplyType()) || ReplyTypeEnum.LINK.value.equals(sendMessageDTO.getReplyType())) { } else if (ReplyTypeEnum.APP.value.equals(sendMessageDTO.getReplyType()) || ReplyTypeEnum.LINK.value.equals(sendMessageDTO.getReplyType())) {
SendArticleMessageVO sendArticleMessageVO = new SendArticleMessageVO(); SendArticleMessageVO sendArticleMessageVO = new SendArticleMessageVO();
sendArticleMessageVO.setAltId(robotId); sendArticleMessageVO.setAltId(robotId);
sendArticleMessageVO.setDescription(sendMessageDTO.getDescription()); sendArticleMessageVO.setDescription(sendMessageDTO.getDescription());
sendArticleMessageVO.setLinkUrl(sendMessageDTO.getLinkUrl()); sendArticleMessageVO.setLinkUrl(sendMessageDTO.getLinkUrl());
sendArticleMessageVO.setGroupId(weixinGroupId); sendArticleMessageVO.setWxGroupId(weixinGroupId);
sendArticleMessageVO.setPicUrl(sendMessageDTO.getPicUrl()); sendArticleMessageVO.setPicUrl(sendMessageDTO.getPicUrl());
sendArticleMessageVO.setTitle(sendMessageDTO.getContent()); sendArticleMessageVO.setTitle(sendMessageDTO.getContent());
sendArticleMessageVO.setIp(ip); sendArticleMessageVO.setIp(ip);
sendArticleMessageVO.setCode(code);
WxGroupSDK.sendArticleMessage(sendArticleMessageVO); WxGroupSDK.sendArticleMessage(sendArticleMessageVO);
} }
} }
...@@ -188,7 +192,7 @@ public class SendWeixinRequestTools { ...@@ -188,7 +192,7 @@ public class SendWeixinRequestTools {
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO(); SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setContent(nickNameStr); sendTextMessageVO.setContent(nickNameStr);
sendTextMessageVO.setAltId(robotId); sendTextMessageVO.setAltId(robotId);
sendTextMessageVO.setGroupId(weixinGroupId); sendTextMessageVO.setWxGroupId(weixinGroupId);
sendTextMessageVO.setIp(ip); sendTextMessageVO.setIp(ip);
WxGroupSDK.sendTextMessage(sendTextMessageVO); WxGroupSDK.sendTextMessage(sendTextMessageVO);
...@@ -198,10 +202,11 @@ public class SendWeixinRequestTools { ...@@ -198,10 +202,11 @@ public class SendWeixinRequestTools {
if (StringUtil.isEmpty(url)) { if (StringUtil.isEmpty(url)) {
return url; return url;
} }
final String s = "qrcode_id=" + groupQrcodeId + "&classify_id=" + classifyId + (null == bookGroupId ? "" : "&book_group_id=" + bookGroupId);
if (url.contains("?")) { if (url.contains("?")) {
url = url + "&qrcode_id=" + groupQrcodeId + "&classify_id=" + classifyId + "&book_group_id=" + bookGroupId; url = url + "&" + s;
} else { } else {
url = url + "?qrcode_id=" + groupQrcodeId + "&classify_id=" + classifyId + "&book_group_id=" + bookGroupId; url = url + "?" + s;
} }
return url; return url;
} }
...@@ -216,11 +221,11 @@ public class SendWeixinRequestTools { ...@@ -216,11 +221,11 @@ public class SendWeixinRequestTools {
} }
sendTextMessageVO.setContent(recommendLanguage); sendTextMessageVO.setContent(recommendLanguage);
sendTextMessageVO.setAltId(robotId); sendTextMessageVO.setAltId(robotId);
sendTextMessageVO.setGroupId(weixinGroupId); sendTextMessageVO.setWxGroupId(weixinGroupId);
sendTextMessageVO.setIp(ip); sendTextMessageVO.setIp(ip);
WxGroupSDK.sendTextMessage(sendTextMessageVO); WxGroupSDK.sendTextMessage(sendTextMessageVO);
SendPicMessageVO sendPicMessageVO = new SendPicMessageVO(); SendPicMessageVO sendPicMessageVO = new SendPicMessageVO();
sendPicMessageVO.setGroupId(weixinGroupId); sendPicMessageVO.setWxGroupId(weixinGroupId);
sendPicMessageVO.setAltId(robotId); sendPicMessageVO.setAltId(robotId);
sendPicMessageVO.setPicUrl(accountSettingDto.getQrcodeUrl()); sendPicMessageVO.setPicUrl(accountSettingDto.getQrcodeUrl());
sendPicMessageVO.setIp(ip); sendPicMessageVO.setIp(ip);
...@@ -228,10 +233,10 @@ public class SendWeixinRequestTools { ...@@ -228,10 +233,10 @@ public class SendWeixinRequestTools {
} }
@ParamLog("推送关键词回复消息") @ParamLog("推送关键词回复消息")
public static void sendKeywordMessage(ReplyKeywordDTO replyKeywordDTO, String robotId, String weixinGroupId, String ip) { public static void sendKeywordMessage(ReplyKeywordDTO replyKeywordDTO, String robotId, String weixinGroupId, String ip, Integer code) {
SendMessageDTO sendMessageDTO = new SendMessageDTO(); SendMessageDTO sendMessageDTO = new SendMessageDTO();
BeanUtils.copyProperties(replyKeywordDTO, sendMessageDTO); BeanUtils.copyProperties(replyKeywordDTO, sendMessageDTO);
sendMessage(sendMessageDTO, robotId, weixinGroupId, ip); sendMessage(sendMessageDTO, robotId, weixinGroupId, ip, code);
} }
@ParamLog("补充域名") @ParamLog("补充域名")
...@@ -269,32 +274,44 @@ public class SendWeixinRequestTools { ...@@ -269,32 +274,44 @@ public class SendWeixinRequestTools {
} }
@ParamLog("欢迎语中推送关键词信息") @ParamLog("欢迎语中推送关键词信息")
public static void sendKeywordsInfo(List<KeywordDTO> keywords, String robotId, String weixinGroupId, String ip){ public static void sendKeywordsInfo(List<KeywordDTO> keywords, String robotId, String toWxId, String ip){
if (ListUtils.isEmpty(keywords)) { if (ListUtils.isEmpty(keywords)) {
return; return;
} }
String content = ""; StringBuilder content = new StringBuilder();
for (int i = 0; i < keywords.size(); i++) { for (int i = 0; i < keywords.size(); i++) {
KeywordDTO keywordDTO = keywords.get(i); KeywordDTO keywordDTO = keywords.get(i);
String keyword = "关键词【" + keywordDTO.getKeywords() + "】\n" + " "+keywordDTO.getGuide(); String keyword = "关键词【" + keywordDTO.getKeywords() + "】\n" + " "+keywordDTO.getGuide();
if (content.length() + keyword.length() > 300) { if (content.length() + keyword.length() > 300) {
sendTextMessage(content, robotId, weixinGroupId, ip); sendTextMessageToSelf(content.toString(), robotId, toWxId, ip);
content = keyword; content = new StringBuilder(keyword);
}else{ }else{
content = content + keyword; content.append(keyword);
} }
if (i != keywords.size() - 1) { if (i != keywords.size() - 1) {
content = content + "\n"; content.append("\n");
} }
} }
sendTextMessage(content, robotId, weixinGroupId, ip); // 1001282-施总需求,群不推送关键词,个人欢迎语推送关键词
// sendTextMessage(content, robotId, weixinGroupId, ip);
sendTextMessageToSelf(content.toString(), robotId, toWxId, ip);
}
private static void sendTextMessageToSelf(String content, String robotId, String toWxId, String ip){
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setCode(SendMessageTypeEnum.SELF.getCode());
sendTextMessageVO.setWxGroupId(toWxId);
sendTextMessageVO.setContent(content);
sendTextMessageVO.setAltId(robotId);
sendTextMessageVO.setIp(ip);
WxGroupSDK.sendTextMessage(sendTextMessageVO);
} }
public static void sendTextMessage(String content, String robotId, String weixinGroupId, String ip){ public static void sendTextMessage(String content, String robotId, String weixinGroupId, String ip){
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO(); SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setContent(content); sendTextMessageVO.setContent(content);
sendTextMessageVO.setAltId(robotId); sendTextMessageVO.setAltId(robotId);
sendTextMessageVO.setGroupId(weixinGroupId); sendTextMessageVO.setWxGroupId(weixinGroupId);
sendTextMessageVO.setIp(ip); sendTextMessageVO.setIp(ip);
WxGroupSDK.sendTextMessage(sendTextMessageVO); WxGroupSDK.sendTextMessage(sendTextMessageVO);
} }
...@@ -303,7 +320,7 @@ public class SendWeixinRequestTools { ...@@ -303,7 +320,7 @@ public class SendWeixinRequestTools {
// SendTextMessageVO sendTextMessageVO = new SendTextMessageVO(); // SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
// sendTextMessageVO.setContent("关键词1:a" + "\n" + "换行换行换行" + "\n"); // sendTextMessageVO.setContent("关键词1:a" + "\n" + "换行换行换行" + "\n");
// sendTextMessageVO.setAltId("wxid_qj200bf0key022"); // sendTextMessageVO.setAltId("wxid_qj200bf0key022");
// sendTextMessageVO.setGroupId("14108963419@chatroom"); // sendTextMessageVO.setWxGroupId("14108963419@chatroom");
// WxGroupSDK.sendTextMessage(sendTextMessageVO); // WxGroupSDK.sendTextMessage(sendTextMessageVO);
} }
...@@ -349,7 +366,7 @@ public class SendWeixinRequestTools { ...@@ -349,7 +366,7 @@ public class SendWeixinRequestTools {
public static void sendClockKeywordsInfo(List<BookClockKeywordDTO> keywords, String robotId, String weixinGroupId, String ip) { public static void sendClockKeywordsInfo(List<BookClockKeywordDTO> keywords, String robotId, String weixinGroupId, String ip) {
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO(); SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setAltId(robotId); sendTextMessageVO.setAltId(robotId);
sendTextMessageVO.setGroupId(weixinGroupId); sendTextMessageVO.setWxGroupId(weixinGroupId);
sendTextMessageVO.setIp(ip); sendTextMessageVO.setIp(ip);
if (ListUtils.isEmpty(keywords)) { if (ListUtils.isEmpty(keywords)) {
return; return;
......
...@@ -5,11 +5,13 @@ import com.fasterxml.jackson.annotation.JsonInclude; ...@@ -5,11 +5,13 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable; import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/** /**
* @author lily * @author lily
* @date 2019/5/6 16:08 * @date 2019/5/6 16:08
*/ */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class GroupQrcodeBaseInfoVO implements Serializable { public class GroupQrcodeBaseInfoVO implements Serializable {
...@@ -22,36 +24,7 @@ public class GroupQrcodeBaseInfoVO implements Serializable { ...@@ -22,36 +24,7 @@ public class GroupQrcodeBaseInfoVO implements Serializable {
@ApiModelProperty("二维码地址") @ApiModelProperty("二维码地址")
private String qrcodeUrl; private String qrcodeUrl;
public Long getGroupQrcodeId() { @ApiModelProperty(value = "二维码地址", hidden = true)
return groupQrcodeId; private String weixinGroupId;
}
public void setGroupQrcodeId(Long groupQrcodeId) {
this.groupQrcodeId = groupQrcodeId;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public String getQrcodeUrl() {
return qrcodeUrl;
}
public void setQrcodeUrl(String qrcodeUrl) {
this.qrcodeUrl = qrcodeUrl;
}
@Override
public String toString() {
return "GroupQrcodeBaseInfoVO{" +
"groupQrcodeId=" + groupQrcodeId +
", groupName='" + groupName + '\'' +
", qrcodeUrl='" + qrcodeUrl + '\'' +
'}';
}
} }
...@@ -5,6 +5,7 @@ import com.pcloud.book.keywords.vo.GuideVO; ...@@ -5,6 +5,7 @@ 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.wechatgroup.message.dto.AgreeAddUserDTO;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -14,6 +15,11 @@ import java.util.Map; ...@@ -14,6 +15,11 @@ import java.util.Map;
* @date 2019/4/23 15:46 * @date 2019/4/23 15:46
*/ */
public interface BookGuideBiz { public interface BookGuideBiz {
/**
* 同意加好友发送欢迎语
*/
void sendGuide(AgreeAddUserDTO agreeAddUserDTO);
/** /**
* @Author:lili * @Author:lili
* @Desr:新增欢迎语 * @Desr:新增欢迎语
......
...@@ -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.sdk.wxgroup.SendMessageTypeEnum;
import java.util.List; import java.util.List;
...@@ -70,7 +71,7 @@ public interface BookKeywordBiz { ...@@ -70,7 +71,7 @@ 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); void sendKeywordMessage(String content, String weixinGroupId, String userWxId, String robotId, String ip, Integer code);
/** /**
* 关键词统计 * 关键词统计
......
...@@ -52,6 +52,11 @@ public interface BookKeywordDao extends BaseDao<BookKeyword> { ...@@ -52,6 +52,11 @@ public interface BookKeywordDao extends BaseDao<BookKeyword> {
ReplyKeywordDTO getKeywordId(Long classifyId, Long bookGroupId, String content); ReplyKeywordDTO getKeywordId(Long classifyId, Long bookGroupId, String content);
/** /**
* 根据分类ids和群ids批量获取关键词
*/
List<ReplyKeywordDTO> getKeywordIds(List<Long> classifyIds, List<Long> bookGroupIds, String content);
/**
* @Author:lili * @Author:lili
* @Desr:校验关键词 * @Desr:校验关键词
* @Date:2019/5/6 14:47 * @Date:2019/5/6 14:47
......
package com.pcloud.book.keywords.dao.impl; package com.pcloud.book.keywords.dao.impl;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.pcloud.book.group.vo.SyncKeyworsVO; import com.pcloud.book.group.vo.SyncKeyworsVO;
...@@ -12,10 +13,14 @@ import com.pcloud.book.keywords.vo.ListKeywordVO; ...@@ -12,10 +13,14 @@ import com.pcloud.book.keywords.vo.ListKeywordVO;
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 org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
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.stream.Collector;
import java.util.stream.Collectors;
/** /**
* @author lily * @author lily
...@@ -62,6 +67,18 @@ public class BookKeywordDaoImpl extends BaseDaoImpl<BookKeyword> implements Book ...@@ -62,6 +67,18 @@ public class BookKeywordDaoImpl extends BaseDaoImpl<BookKeyword> implements Book
} }
@Override @Override
public List<ReplyKeywordDTO> getKeywordIds(List<Long> classifyIds, List<Long> bookGroupIds, String content) {
if (CollectionUtils.isEmpty(classifyIds) || CollectionUtils.isEmpty(bookGroupIds) || StringUtils.isEmpty(content)) {
return Lists.newArrayList();
}
Map<String, Object> paramMap = Maps.newHashMap();
paramMap.put("classifyId", classifyIds.stream().map(Object::toString).collect(Collectors.joining(",")));
paramMap.put("bookGroupId", bookGroupIds.stream().map(Object::toString).collect(Collectors.joining(",")));
paramMap.put("content", content);
return this.getSqlSession().selectList(this.getStatement("getKeywordIds"), paramMap);
}
@Override
public Boolean checkKeyword(String keywords, Long classifyId, Long bookGroupId, Long keywordId) { public Boolean checkKeyword(String keywords, Long classifyId, Long bookGroupId, Long keywordId) {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("classifyId", classifyId); paramMap.put("classifyId", classifyId);
......
...@@ -27,6 +27,12 @@ public class ReplyKeywordDTO implements Serializable { ...@@ -27,6 +27,12 @@ public class ReplyKeywordDTO implements Serializable {
@ApiModelProperty("仓库关键词id") @ApiModelProperty("仓库关键词id")
private Long warehouseId; private Long warehouseId;
@ApiModelProperty("分类id")
private Long classifyId;
@ApiModelProperty("群id")
private Long bookGroupId;
@ApiModelProperty("内容") @ApiModelProperty("内容")
private String content; private String content;
...@@ -42,4 +48,10 @@ public class ReplyKeywordDTO implements Serializable { ...@@ -42,4 +48,10 @@ public class ReplyKeywordDTO implements Serializable {
@ApiModelProperty("短链接地址") @ApiModelProperty("短链接地址")
private String shortLinkUrl; private String shortLinkUrl;
@ApiModelProperty("应用/作品id")
private Long serveId;
@ApiModelProperty("应用/作品")
private String serveType;
} }
...@@ -6,12 +6,15 @@ import com.pcloud.book.keywords.vo.GuideVO; ...@@ -6,12 +6,15 @@ 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.common.core.constant.MQTopicProducer;
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 com.pcloud.common.utils.ResponseHandleUtil; import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.common.utils.SessionUtil; import com.pcloud.common.utils.SessionUtil;
import com.pcloud.wechatgroup.message.dto.AgreeAddUserDTO;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -26,16 +29,34 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -26,16 +29,34 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/** /**
* @author lily * @author lily
* @date 2019/4/23 15:24 * @date 2019/4/23 15:24
*/ */
@Slf4j
@RestController("bookGuideFacade") @RestController("bookGuideFacade")
@RequestMapping("bookGuide") @RequestMapping("bookGuide")
public class BookGuideFacadeImpl implements BookGuideFacade { public class BookGuideFacadeImpl implements BookGuideFacade {
@Autowired @Autowired
private BookGuideBiz bookGuidBiz; private BookGuideBiz bookGuidBiz;
@Autowired
private AmqpTemplate amqpTemplate;
@PostMapping("test")
public void test() {
final AgreeAddUserDTO agreeAddUserDTO = new AgreeAddUserDTO();
agreeAddUserDTO.setNickName("大威");
agreeAddUserDTO.setRobotWxId("wxid_arjobo1bbk2i22");
// 当消息为个人消息时,wechatGroupId为发送人id
agreeAddUserDTO.setUserWxId("p867263500");
agreeAddUserDTO.setIp("http://192.168.92.122:8081");
log.info("[processSelfMessage] start convertAndSend agreeAddUserDTO:{}", agreeAddUserDTO);
// 发送topic book处理后续欢迎语,关键词和拉群操作
amqpTemplate.convertAndSend(MQTopicProducer.EXCHAGE, MQTopicProducer.WX_AGREE_ADD_USER, agreeAddUserDTO);
}
@Override @Override
@PostMapping("insertGuide") @PostMapping("insertGuide")
......
...@@ -70,4 +70,9 @@ public class MQTopicConumer { ...@@ -70,4 +70,9 @@ public class MQTopicConumer {
*/ */
public static final String WXGROUP_LEARNING_REPORT = PREFIX + MQTopicProducer.WXGROUP_LEARNING_REPORT; public static final String WXGROUP_LEARNING_REPORT = PREFIX + MQTopicProducer.WXGROUP_LEARNING_REPORT;
/**
* 微信群同意添加好友成功
*/
public static final String WX_AGREE_ADD_USER = PREFIX + MQTopicProducer.WX_AGREE_ADD_USER;
} }
...@@ -51,8 +51,8 @@ public class UpdateWXGroupNameListener { ...@@ -51,8 +51,8 @@ public class UpdateWXGroupNameListener {
} }
String groupName = groupQrcode.getGroupName(); String groupName = groupQrcode.getGroupName();
// 如果数据库微信群名称超过16,就截断,然后重新设置数据库的名称,因为wxgroup那边设置的时候截断了 // 如果数据库微信群名称超过16,就截断,然后重新设置数据库的名称,因为wxgroup那边设置的时候截断了
if (groupName.length() > 16) { if (groupName.length() > 15) {
groupName = groupName.substring(0, 16); groupName = groupName.substring(0, 15);
groupQrcodeDao.updateGroupName(groupQrcode.getId(), groupName); groupQrcodeDao.updateGroupName(groupQrcode.getId(), groupName);
} }
if (!groupNameDTO.getNewGroupName().equals(groupName)) { if (!groupNameDTO.getNewGroupName().equals(groupName)) {
...@@ -67,7 +67,7 @@ public class UpdateWXGroupNameListener { ...@@ -67,7 +67,7 @@ public class UpdateWXGroupNameListener {
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO(); SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setContent("@"+groupNameDTO.getNickName()+",为方便群友入群分享好的助学方法,请不要随意修改群名。如再修改,会将您移出群聊。谢谢配合。"); sendTextMessageVO.setContent("@"+groupNameDTO.getNickName()+",为方便群友入群分享好的助学方法,请不要随意修改群名。如再修改,会将您移出群聊。谢谢配合。");
sendTextMessageVO.setAltId(altId); sendTextMessageVO.setAltId(altId);
sendTextMessageVO.setGroupId(wechatGroupId); sendTextMessageVO.setWxGroupId(wechatGroupId);
LOGGER.info("发送警告文本消息"+sendTextMessageVO.toString()); LOGGER.info("发送警告文本消息"+sendTextMessageVO.toString());
sendTextMessageVO.setIp(findIp(wechatGroupId)); sendTextMessageVO.setIp(findIp(wechatGroupId));
WxGroupSDK.sendTextMessage(sendTextMessageVO); WxGroupSDK.sendTextMessage(sendTextMessageVO);
......
...@@ -25,6 +25,7 @@ import com.pcloud.wechatgroup.message.dto.GroupLearningReportDTO; ...@@ -25,6 +25,7 @@ import com.pcloud.wechatgroup.message.dto.GroupLearningReportDTO;
import com.sdk.wxgroup.SendPicMessageVO; import com.sdk.wxgroup.SendPicMessageVO;
import com.sdk.wxgroup.SendTextMessageVO; import com.sdk.wxgroup.SendTextMessageVO;
import com.sdk.wxgroup.WxGroupSDK; import com.sdk.wxgroup.WxGroupSDK;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler; import org.springframework.amqp.rabbit.annotation.RabbitHandler;
...@@ -63,8 +64,9 @@ public class WXGroupLearningReportListener { ...@@ -63,8 +64,9 @@ public class WXGroupLearningReportListener {
try { try {
if (groupLearningReportDTO == null if (groupLearningReportDTO == null
|| groupLearningReportDTO.getWechatGroupId() == null || groupLearningReportDTO.getWechatGroupId() == null
|| groupLearningReportDTO.getWechatUserId() == null) || groupLearningReportDTO.getWechatUserId() == null) {
return; return;
}
String wechatUserId = groupLearningReportDTO.getWechatUserId(); String wechatUserId = groupLearningReportDTO.getWechatUserId();
String wechatGroupId = groupLearningReportDTO.getWechatGroupId(); String wechatGroupId = groupLearningReportDTO.getWechatGroupId();
//新增触发记录 //新增触发记录
...@@ -102,7 +104,7 @@ public class WXGroupLearningReportListener { ...@@ -102,7 +104,7 @@ public class WXGroupLearningReportListener {
return; return;
} }
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO(); SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setGroupId(wechatGroupId); sendTextMessageVO.setWxGroupId(wechatGroupId);
sendTextMessageVO.setAltId(alt); sendTextMessageVO.setAltId(alt);
sendTextMessageVO.setContent("个人专属学习报告,及群成员元气排行榜。点击获取" + resultUrl); sendTextMessageVO.setContent("个人专属学习报告,及群成员元气排行榜。点击获取" + resultUrl);
sendTextMessageVO.setIp(findIp(wechatGroupId)); sendTextMessageVO.setIp(findIp(wechatGroupId));
...@@ -115,7 +117,7 @@ public class WXGroupLearningReportListener { ...@@ -115,7 +117,7 @@ public class WXGroupLearningReportListener {
} }
SendPicMessageVO sendPicMessageVO = new SendPicMessageVO(); SendPicMessageVO sendPicMessageVO = new SendPicMessageVO();
sendPicMessageVO.setPicUrl(imageUrl); sendPicMessageVO.setPicUrl(imageUrl);
sendPicMessageVO.setGroupId(wechatGroupId); sendPicMessageVO.setWxGroupId(wechatGroupId);
sendPicMessageVO.setAltId(alt); sendPicMessageVO.setAltId(alt);
sendPicMessageVO.setIp(findIp(wechatGroupId)); sendPicMessageVO.setIp(findIp(wechatGroupId));
LOGGER.info("发送分享图消息开始"+sendPicMessageVO.toString()); LOGGER.info("发送分享图消息开始"+sendPicMessageVO.toString());
......
package com.pcloud.book.mq.topic;
import com.pcloud.book.keywords.biz.BookGuideBiz;
import com.pcloud.book.mq.config.MQTopicConumer;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.wechatgroup.message.dto.AgreeAddUserDTO;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
/**
* @author lily
* @date 2019/5/6 11:01
*/
@Slf4j
@Component
public class WxAgreeAddUserListener {
@Resource
private BookGuideBiz bookGuideBiz;
/**
* 接收微信用户进群消息
*/
@ParamLog("同意加好友发送欢迎语")
@RabbitListener(queues = MQTopicConumer.WX_AGREE_ADD_USER)
public void onMessage(AgreeAddUserDTO agreeAddUserDTO) throws BizException {
try {
bookGuideBiz.sendGuide(agreeAddUserDTO);
} catch (Exception e) {
log.error("同意加好友发送欢迎语" + e.getMessage(), e);
}
}
}
...@@ -12,6 +12,7 @@ import com.pcloud.common.exceptions.BizException; ...@@ -12,6 +12,7 @@ import com.pcloud.common.exceptions.BizException;
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.wechatgroup.message.dto.SendTextDTO; import com.pcloud.wechatgroup.message.dto.SendTextDTO;
import com.sdk.wxgroup.SendMessageTypeEnum;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -57,11 +58,11 @@ public class WxGroupSendTextListener { ...@@ -57,11 +58,11 @@ public class WxGroupSendTextListener {
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())) {
BookClockInfoDTO bookClockInfoDTO = bookClockCheck.checkKeywordIsClock(sendTextDTO.getTextContent().trim(), sendTextDTO.getWechatGroupId()); BookClockInfoDTO bookClockInfoDTO = bookClockCheck.checkKeywordIsClock(sendTextDTO.getTextContent().trim(), sendTextDTO.getWechatGroupId());
if(null != bookClockInfoDTO){ if(null != bookClockInfoDTO && SendMessageTypeEnum.GROUP.getCode().equals(sendTextDTO.getCode())){
bookClockKeywordBiz.sendKeywordMessage(bookClockInfoDTO, wechatUserId,sendTextDTO.getWechatGroupId(),sendTextDTO.getWxId(),sendTextDTO.getIp()); bookClockKeywordBiz.sendKeywordMessage(bookClockInfoDTO, 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()); bookKeywordBiz.sendKeywordMessage(sendTextDTO.getTextContent().trim(), sendTextDTO.getWechatGroupId(), wechatUserId, sendTextDTO.getWxId(), sendTextDTO.getIp(), sendTextDTO.getCode());
log.info("[接收用户发送文本消息] 总耗时:{}ms ", System.currentTimeMillis() - l); log.info("[接收用户发送文本消息] 总耗时:{}ms ", System.currentTimeMillis() - l);
} }
//猜谜语 //猜谜语
......
...@@ -320,7 +320,7 @@ public class PushBizImpl implements PushBiz { ...@@ -320,7 +320,7 @@ public class PushBizImpl implements PushBiz {
Integer itemType = pushItem.getItemType(); Integer itemType = pushItem.getItemType();
if (ItemTypeEnum.TEXT.value.equals(itemType)) { if (ItemTypeEnum.TEXT.value.equals(itemType)) {
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO(); SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setGroupId(groupId); sendTextMessageVO.setWxGroupId(groupId);
sendTextMessageVO.setAltId(altId); sendTextMessageVO.setAltId(altId);
sendTextMessageVO.setContent(pushItem.getTextContent()); sendTextMessageVO.setContent(pushItem.getTextContent());
sendTextMessageVO.setPushGroupRecordId(pushGroupRecordId); sendTextMessageVO.setPushGroupRecordId(pushGroupRecordId);
...@@ -331,7 +331,7 @@ public class PushBizImpl implements PushBiz { ...@@ -331,7 +331,7 @@ public class PushBizImpl implements PushBiz {
SendArticleMessageVO sendArticleMessageVO = new SendArticleMessageVO(); SendArticleMessageVO sendArticleMessageVO = new SendArticleMessageVO();
sendArticleMessageVO.setAltId(altId); sendArticleMessageVO.setAltId(altId);
sendArticleMessageVO.setDescription(pushItem.getLinkDescription()); sendArticleMessageVO.setDescription(pushItem.getLinkDescription());
sendArticleMessageVO.setGroupId(groupId); sendArticleMessageVO.setWxGroupId(groupId);
String url = pushItem.getLinkUrl(); String url = pushItem.getLinkUrl();
if (url.contains("?")) { if (url.contains("?")) {
url = url + "&" + otherUrl; url = url + "&" + otherUrl;
...@@ -356,10 +356,11 @@ public class PushBizImpl implements PushBiz { ...@@ -356,10 +356,11 @@ public class PushBizImpl implements PushBiz {
AppDto appDto = appConsr.getBaseById(pushItem.getAppId()); AppDto appDto = appConsr.getBaseById(pushItem.getAppId());
if (appDto != null) { if (appDto != null) {
accountSettingDto = qrcodeSceneConsr.getWechatInfo(appDto.getChannelId());
SendArticleMessageVO sendArticleMessageVO = new SendArticleMessageVO(); SendArticleMessageVO sendArticleMessageVO = new SendArticleMessageVO();
sendArticleMessageVO.setAltId(altId); sendArticleMessageVO.setAltId(altId);
sendArticleMessageVO.setDescription(appDto.getTypeName()); sendArticleMessageVO.setDescription(appDto.getTypeName());
sendArticleMessageVO.setGroupId(groupId); sendArticleMessageVO.setWxGroupId(groupId);
// 处理链接地址 // 处理链接地址
String endUrl = pushItem.getAppUrl() + "&" + otherUrl; String endUrl = pushItem.getAppUrl() + "&" + otherUrl;
String linkUrl = SendWeixinRequestTools.splitUrl(accountSettingDto, endUrl); String linkUrl = SendWeixinRequestTools.splitUrl(accountSettingDto, endUrl);
...@@ -381,7 +382,7 @@ public class PushBizImpl implements PushBiz { ...@@ -381,7 +382,7 @@ public class PushBizImpl implements PushBiz {
if (productDto.getProductTypeDto() != null) { if (productDto.getProductTypeDto() != null) {
sendArticleMessageVO.setDescription(productDto.getProductTypeDto().getTypeName()); sendArticleMessageVO.setDescription(productDto.getProductTypeDto().getTypeName());
} }
sendArticleMessageVO.setGroupId(groupId); sendArticleMessageVO.setWxGroupId(groupId);
// 处理链接地址 // 处理链接地址
String endUrl = pushItem.getProductUrl() + "&" + otherUrl; String endUrl = pushItem.getProductUrl() + "&" + otherUrl;
String linkUrl = SendWeixinRequestTools.splitUrl(accountSettingDto, endUrl); String linkUrl = SendWeixinRequestTools.splitUrl(accountSettingDto, endUrl);
...@@ -399,7 +400,7 @@ public class PushBizImpl implements PushBiz { ...@@ -399,7 +400,7 @@ public class PushBizImpl implements PushBiz {
if (ItemTypeEnum.IMAGE.value.equals(itemType)) { if (ItemTypeEnum.IMAGE.value.equals(itemType)) {
SendPicMessageVO sendPicMessageVO = new SendPicMessageVO(); SendPicMessageVO sendPicMessageVO = new SendPicMessageVO();
sendPicMessageVO.setAltId(altId); sendPicMessageVO.setAltId(altId);
sendPicMessageVO.setGroupId(groupId); sendPicMessageVO.setWxGroupId(groupId);
sendPicMessageVO.setPicUrl(pushItem.getImageUrl()); sendPicMessageVO.setPicUrl(pushItem.getImageUrl());
sendPicMessageVO.setPushGroupRecordId(pushGroupRecordId); sendPicMessageVO.setPushGroupRecordId(pushGroupRecordId);
sendPicMessageVO.setIp(findIp(groupId)); sendPicMessageVO.setIp(findIp(groupId));
...@@ -980,7 +981,7 @@ public class PushBizImpl implements PushBiz { ...@@ -980,7 +981,7 @@ public class PushBizImpl implements PushBiz {
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO(); SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setContent(content); sendTextMessageVO.setContent(content);
sendTextMessageVO.setAltId(robotId); sendTextMessageVO.setAltId(robotId);
sendTextMessageVO.setGroupId(weixinGroupId); sendTextMessageVO.setWxGroupId(weixinGroupId);
sendTextMessageVO.setIp(findIp(weixinGroupId)); sendTextMessageVO.setIp(findIp(weixinGroupId));
WxGroupSDK.sendTextMessage(sendTextMessageVO); WxGroupSDK.sendTextMessage(sendTextMessageVO);
LOGGER.info("发送早晚报" + sendTextMessageVO.toString()); LOGGER.info("发送早晚报" + sendTextMessageVO.toString());
......
...@@ -29,6 +29,7 @@ import com.pcloud.facade.quartz.entity.ScheduleJob; ...@@ -29,6 +29,7 @@ import com.pcloud.facade.quartz.entity.ScheduleJob;
import com.pcloud.facade.quartz.service.ScheduleService; import com.pcloud.facade.quartz.service.ScheduleService;
import com.pcloud.wechatgroup.group.dto.GroupUserDTO; import com.pcloud.wechatgroup.group.dto.GroupUserDTO;
import com.pcloud.wechatgroup.message.dto.SendTextDTO; import com.pcloud.wechatgroup.message.dto.SendTextDTO;
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;
...@@ -84,6 +85,9 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz { ...@@ -84,6 +85,9 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
if (null == sendTextDTO || StringUtil.isEmpty(sendTextDTO.getTextContent())) { if (null == sendTextDTO || StringUtil.isEmpty(sendTextDTO.getTextContent())) {
return; return;
} }
if (!SendMessageTypeEnum.GROUP.getCode().equals(sendTextDTO.getCode())) {//非群消息不处理
return;
}
String textContent = sendTextDTO.getTextContent().trim(); String textContent = sendTextDTO.getTextContent().trim();
String wxGroupId = sendTextDTO.getWechatGroupId(); String wxGroupId = sendTextDTO.getWechatGroupId();
String wxUserId = sendTextDTO.getWechatUserId(); String wxUserId = sendTextDTO.getWechatUserId();
...@@ -186,7 +190,7 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz { ...@@ -186,7 +190,7 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
public void sendWeixinTextMessage(String wxId, String wxGroupId, String content, String ip, String wxUserId) { public void sendWeixinTextMessage(String wxId, String wxGroupId, String content, String ip, String wxUserId) {
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO(); SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setAltId(wxId); sendTextMessageVO.setAltId(wxId);
sendTextMessageVO.setGroupId(wxGroupId); sendTextMessageVO.setWxGroupId(wxGroupId);
if (!StringUtil.isEmpty(wxUserId)) { if (!StringUtil.isEmpty(wxUserId)) {
sendTextMessageVO.setAtId(wxUserId); sendTextMessageVO.setAtId(wxUserId);
GroupUserDTO groupUser = wechatGroupConsr.getWxUserInfoByWxUserId(wxUserId); GroupUserDTO groupUser = wechatGroupConsr.getWxUserInfoByWxUserId(wxUserId);
......
...@@ -34,8 +34,7 @@ public class BookProps { ...@@ -34,8 +34,7 @@ public class BookProps {
*/ */
private static String jisuAppKey; private static String jisuAppKey;
@Value("group.luck.url") private static String systemEnv;
private String groupLuckUrl;
public static String getJisuAppKey() { public static String getJisuAppKey() {
return jisuAppKey; return jisuAppKey;
...@@ -73,11 +72,13 @@ public class BookProps { ...@@ -73,11 +72,13 @@ public class BookProps {
BookProps.appCode = appCode; BookProps.appCode = appCode;
} }
public String getGroupLuckUrl() {
return groupLuckUrl; public static String getSystemEnv() {
return systemEnv;
} }
public void setGroupLuckUrl(String groupLuckUrl) { @Value("${system.env}")
this.groupLuckUrl = groupLuckUrl; public void setSystemEnv(String systemEnv) {
BookProps.systemEnv = systemEnv;
} }
} }
<?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.adnews.dao.impl.AdNewsBanDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsBan">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="adviser_id" property="adviserId" jdbcType="BIGINT"/>
<result column="ad_news_id" property="adNewsId" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, adviser_id, ad_news_id, create_time, update_time
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from ad_news_choose
where id = #{id,jdbcType=BIGINT}
</select>
<insert id="insert" parameterType="com.pcloud.book.adnews.entity.AdNewsBan" useGeneratedKeys="true" keyProperty="id">
insert into ad_news_ban
(adviser_id,
ad_news_id,
create_time)
values(
#{adviserId,jdbcType=BIGINT},
#{adNewsId,jdbcType=BIGINT},
NOW())
</insert>
<!--根据id删除-->
<delete id="deleteByAdNewsId" parameterType="map">
DELETE FROM ad_news_ban
where ad_news_id=#{adNewsId} and adviser_id=#{partyId}
</delete>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsChooseDaoImpl"> <mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsChooseDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsChoose"> <resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsChoose">
<id column="id" property="id" jdbcType="BIGINT"/> <id column="id" property="id" jdbcType="BIGINT"/>
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<result column="is_delete" property="isDelete" jdbcType="BOOLEAN"/> <result column="is_delete" property="isDelete" jdbcType="BOOLEAN"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/> <result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_user" property="updateUser" jdbcType="BIGINT"/> <result column="update_user" property="updateUser" jdbcType="BIGINT"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap> </resultMap>
......
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