Commit b2bb411c by 高鹏

Merge branch 'master' into 'feat-zyjmaster'

# Conflicts:
#   pcloud-facade-book/src/main/java/com/pcloud/book/book/dto/BookDto.java
parents 6bec7976 6b6aada0
...@@ -24,5 +24,9 @@ public interface BookClockInfoService { ...@@ -24,5 +24,9 @@ public interface BookClockInfoService {
@PostMapping("/sendBookClockGroupMessage") @PostMapping("/sendBookClockGroupMessage")
void sendBookClockGroupMessage(@RequestBody Map<String, Object> map) throws BizException; void sendBookClockGroupMessage(@RequestBody Map<String, Object> map) throws BizException;
@ApiOperation(value = "处理关联应用的打卡的旧数据", httpMethod = "GET")
@RequestMapping(value = "/dealOldData4WeixinClock", method = RequestMethod.GET)
void dealOldData4WeixinClock();
} }
package com.pcloud.book.group.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
/**
* @author 戴兴
* @description TODO
* @date 2019/7/25 16:07
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BookClassifyDTO implements Serializable {
private Long bookId;
private Long bookGroupId;
private Long classifyCount;
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public Long getClassifyCount() {
return classifyCount;
}
public void setClassifyCount(Long classifyCount) {
this.classifyCount = classifyCount;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
@Override
public String toString() {
return "BookClassifyDTO{" +
"bookId=" + bookId +
", bookGroupId=" + bookGroupId +
", classifyCount=" + classifyCount +
'}';
}
}
\ No newline at end of file
package com.pcloud.book.group.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
/**
* @author 戴兴
* @description TODO
* @date 2019/7/25 16:29
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BookGroupStatisticsDTO implements Serializable {
/**
* 群分类数
*/
private Long classifyCount;
/**
* 微信群数
*/
private Long wxGroupCount;
/**
* 当前群人数
*/
private Long groupPersonNum;
/**
* 推广应用次数
*/
private Long promAppCount;
/**
* 推广作品次数
*/
private Long promProductCount;
public Long getClassifyCount() {
return classifyCount;
}
public void setClassifyCount(Long classifyCount) {
this.classifyCount = classifyCount;
}
public Long getWxGroupCount() {
return wxGroupCount;
}
public void setWxGroupCount(Long wxGroupCount) {
this.wxGroupCount = wxGroupCount;
}
public Long getGroupPersonNum() {
return groupPersonNum;
}
public void setGroupPersonNum(Long groupPersonNum) {
this.groupPersonNum = groupPersonNum;
}
public Long getPromAppCount() {
return promAppCount;
}
public void setPromAppCount(Long promAppCount) {
this.promAppCount = promAppCount;
}
public Long getPromProductCount() {
return promProductCount;
}
public void setPromProductCount(Long promProductCount) {
this.promProductCount = promProductCount;
}
@Override
public String toString() {
return "BookGroupStatisticsDTO{" +
"classifyCount=" + classifyCount +
", wxGroupCount=" + wxGroupCount +
", groupPersonNum=" + groupPersonNum +
", promAppCount=" + promAppCount +
", promProductCount=" + promProductCount +
'}';
}
}
\ No newline at end of file
package com.pcloud.book.group.dto;
import java.io.Serializable;
import java.util.List;
/**
* @author 戴兴
* @description TODO
* @date 2019/8/8 20:37
*/
public class ResourceBrowseParamDto implements Serializable {
private Long bookGroupId;
private Long classifyId;
private Long qrcodeId;
private String typeCode;
private List<Long> Ids;
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
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 String getTypeCode() {
return typeCode;
}
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
public List<Long> getIds() {
return Ids;
}
public void setIds(List<Long> ids) {
Ids = ids;
}
@Override
public String toString() {
return "ResourceBrowseParamDto{" +
"bookGroupId=" + bookGroupId +
", classifyId=" + classifyId +
", qrcodeId=" + qrcodeId +
", typeCode='" + typeCode + '\'' +
", Ids=" + Ids +
'}';
}
}
\ No newline at end of file
package com.pcloud.book.group.service; package com.pcloud.book.group.service;
import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO; import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.dto.GroupQrcodeBaseDTO;
import com.pcloud.book.group.dto.GroupQrcodeInfo4Advertising;
import com.pcloud.book.group.dto.ProAssocGroupAndUserNumberDTO;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.cloud.netflix.feign.FeignClient;
...@@ -32,6 +29,11 @@ public interface BookGroupClassifyService { ...@@ -32,6 +29,11 @@ public interface BookGroupClassifyService {
@GetMapping("getClassifyQrcodeInfo") @GetMapping("getClassifyQrcodeInfo")
ResponseEntity<ResponseDto<GroupClassifyQrcodeDTO>> getClassifyQrcodeInfo(@RequestParam("weixinGroupId") String weixinGroupId); ResponseEntity<ResponseDto<GroupClassifyQrcodeDTO>> getClassifyQrcodeInfo(@RequestParam("weixinGroupId") String weixinGroupId);
@ApiOperation("根据id获取微信群分类")
@PostMapping("getClassifyByIds")
ResponseEntity<ResponseDto<Map<Long, String>>> getClassifyByIds(@RequestBody List<Long> weixinGroupClassifyPrimaryIds);
@ApiOperation("根据微信群标识获取相关id") @ApiOperation("根据微信群标识获取相关id")
@PostMapping("listGroupQrcodeBaseInfo") @PostMapping("listGroupQrcodeBaseInfo")
ResponseEntity<ResponseDto<Map<String, GroupQrcodeBaseDTO>>> listGroupQrcodeBaseInfo(@RequestBody List<String> weixinGroupIds); ResponseEntity<ResponseDto<Map<String, GroupQrcodeBaseDTO>>> listGroupQrcodeBaseInfo(@RequestBody List<String> weixinGroupIds);
...@@ -56,7 +58,13 @@ public interface BookGroupClassifyService { ...@@ -56,7 +58,13 @@ public interface BookGroupClassifyService {
@PostMapping("filterDeleteId") @PostMapping("filterDeleteId")
ResponseEntity<ResponseDto<List<Long>>> filterDeleteId(@RequestBody List<String >wxGroupIdList); ResponseEntity<ResponseDto<List<Long>>> filterDeleteId(@RequestBody List<String >wxGroupIdList);
@ApiOperation("获取用户支付金额") @ApiOperation("获取用户支付金额")
@GetMapping("getPayPrice") @GetMapping("getPayPrice")
ResponseEntity<ResponseDto<BigDecimal>> getPayPrice(@RequestParam("qrcodeId") Long qrcodeId, @RequestParam("wxUserId") String wxUserId); ResponseEntity<ResponseDto<BigDecimal>> getPayPrice(@RequestParam("qrcodeId") Long qrcodeId, @RequestParam("wxUserId") String wxUserId);
@ApiOperation("获取群分类个数")
@PostMapping("getGroupClassifyCount")
ResponseEntity<ResponseDto<Map<Long, BookClassifyDTO>>> getGroupClassifyCount(@RequestBody List<Long> bookIds);
} }
...@@ -3,9 +3,12 @@ package com.pcloud.book.group.service; ...@@ -3,9 +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.PersonalQrcodeDTO;
import com.pcloud.book.group.dto.GroupCipherDTO; import com.pcloud.book.group.dto.GroupCipherDTO;
import com.pcloud.book.group.dto.GroupUseDTO; import com.pcloud.book.group.dto.GroupUseDTO;
import com.pcloud.book.group.dto.ResourceBrowseParamDto;
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.*; import org.springframework.web.bind.annotation.*;
...@@ -52,6 +55,7 @@ public interface BookGroupService { ...@@ -52,6 +55,7 @@ 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("更新个人二维码") @ApiOperation("更新个人二维码")
@RequestMapping(value = "updatePersonQrcode",method = RequestMethod.POST) @RequestMapping(value = "updatePersonQrcode",method = RequestMethod.POST)
void updatePersonQrcode(@RequestBody PersonalQrcodeDTO personalQrcodeDTO) throws BizException; void updatePersonQrcode(@RequestBody PersonalQrcodeDTO personalQrcodeDTO) throws BizException;
...@@ -72,4 +76,9 @@ public interface BookGroupService { ...@@ -72,4 +76,9 @@ public interface BookGroupService {
@GetMapping("/getJoinGroupCipher") @GetMapping("/getJoinGroupCipher")
ResponseEntity<ResponseDto<GroupCipherDTO>> getJoinGroupCipher(@RequestParam("cipher")String cipher) throws BizException; ResponseEntity<ResponseDto<GroupCipherDTO>> getJoinGroupCipher(@RequestParam("cipher")String cipher) throws BizException;
@ApiOperation("获取资源浏览数据")
@PostMapping("getResourcesBrowseCount")
ResponseEntity<ResponseDto<Map<Long, Long>>> getResourcesBrowseCount(@RequestBody ResourceBrowseParamDto resourceBrowseParamDto);
} }
...@@ -83,6 +83,10 @@ public interface WeixinQrcodeService { ...@@ -83,6 +83,10 @@ public interface WeixinQrcodeService {
@RequestMapping(value = "getGroupVersionIp", method = RequestMethod.POST) @RequestMapping(value = "getGroupVersionIp", method = RequestMethod.POST)
ResponseEntity<ResponseDto<Map<String, BookWxQrcodeDTO>>> getGroupVersionIp(@RequestBody List<String> wxGroupIds); ResponseEntity<ResponseDto<Map<String, BookWxQrcodeDTO>>> getGroupVersionIp(@RequestBody List<String> wxGroupIds);
@ApiOperation(value = "通过群分类id获取微信群id", httpMethod = "GET")
@RequestMapping(value = "getWxGroupId", method = RequestMethod.GET)
ResponseEntity<ResponseDto<String>> getWxGroupId(@RequestParam("classifyId") Long classifyId);
} }
...@@ -211,4 +211,14 @@ public class BookApplication { ...@@ -211,4 +211,14 @@ public class BookApplication {
public Binding wxGroupAgreeAddUserBind() { public Binding wxGroupAgreeAddUserBind() {
return RabbitMQFactory.bindingExchange(wxGroupAgreeAddUserQueue(), MQTopicProducer.WX_AGREE_ADD_USER); return RabbitMQFactory.bindingExchange(wxGroupAgreeAddUserQueue(), MQTopicProducer.WX_AGREE_ADD_USER);
} }
@Bean
public Queue wxGroupUserBindQueue(){
return RabbitMQFactory.queueBuilder(MQTopicConumer.CONSUMER_WXGROUP_USER_BIND);
}
@Bean
public Binding wxGroupUserBindBind(){
return RabbitMQFactory.bindingExchange(wxGroupUserBindQueue(), MQTopicProducer.WXGROUP_USER_BIND);
}
} }
...@@ -66,6 +66,15 @@ public interface AdNewsBiz { ...@@ -66,6 +66,15 @@ public interface AdNewsBiz {
Long addAdNewsWechat(AdNewsWechat adNewsWechat); Long addAdNewsWechat(AdNewsWechat adNewsWechat);
/** /**
* 获取自有公众号
* @param adviserId
* @param currentPage
* @param numPerPage
* @return
*/
PageBeanNew<AdNewsWechat> getAdNewsWechatListForAdviser(Long adviserId, Integer currentPage, Integer numPerPage);
/**
* 获取所有的公众号列表 * 获取所有的公众号列表
* @param currentPage * @param currentPage
* @param numPerPage * @param numPerPage
...@@ -124,4 +133,5 @@ public interface AdNewsBiz { ...@@ -124,4 +133,5 @@ public interface AdNewsBiz {
* @return * @return
*/ */
Long addAdNewsClickRecord(AdNewsClickRecord adNewsClickRecord); Long addAdNewsClickRecord(AdNewsClickRecord adNewsClickRecord);
} }
...@@ -16,7 +16,6 @@ import com.pcloud.book.group.biz.WeixinQrcodeBiz; ...@@ -16,7 +16,6 @@ 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.BookWxQrcodeDTO;
import com.pcloud.book.group.dto.GroupQrcodeFoAdDTO; import com.pcloud.book.group.dto.GroupQrcodeFoAdDTO;
import com.pcloud.book.group.vo.BookGroupClassifyVO;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
...@@ -40,7 +39,6 @@ import org.springframework.stereotype.Component; ...@@ -40,7 +39,6 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.security.cert.X509Certificate;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -107,11 +105,24 @@ public class AdNewsBizImpl implements AdNewsBiz { ...@@ -107,11 +105,24 @@ public class AdNewsBizImpl implements AdNewsBiz {
adNewsSetDao.insert(adNewsSet); adNewsSetDao.insert(adNewsSet);
buildAdNewsGroups(adNewsSet, adNewsSet.getCreateUser()); buildAdNewsGroups(adNewsSet, adNewsSet.getCreateUser());
adNewsGroupDao.batchInsert(adNewsSet.getAdNewsGroups()); adNewsGroupDao.batchInsert(adNewsSet.getAdNewsGroups());
buildAdNewsWechats(adNewsSet);
adNewsWechatDao.batchInsert(adNewsSet.getAdNewsWechats());
//创建定时任务 //创建定时任务
buildAdNewsSh(adNewsSet); buildAdNewsSh(adNewsSet);
return adNewsSet.getId(); return adNewsSet.getId();
} }
/**
* 构建自有公众号对象
*
* @param adNewsSet
*/
private void buildAdNewsWechats(AdNewsSet adNewsSet) {
for (AdNewsWechat adNewsWechat : adNewsSet.getAdNewsWechats()) {
adNewsWechat.setAdviserId(adNewsSet.getUpdateUser());
}
}
@ParamLog("创建编辑端早晚报定时任务") @ParamLog("创建编辑端早晚报定时任务")
private void buildAdNewsSh(AdNewsSet adNewsSet) { private void buildAdNewsSh(AdNewsSet adNewsSet) {
if (adNewsSet.getHasMorningOpen()) { if (adNewsSet.getHasMorningOpen()) {
...@@ -174,6 +185,12 @@ public class AdNewsBizImpl implements AdNewsBiz { ...@@ -174,6 +185,12 @@ public class AdNewsBizImpl implements AdNewsBiz {
//重新设置关联 //重新设置关联
buildAdNewsGroups(adNewsSet, adNewsSet.getUpdateUser()); buildAdNewsGroups(adNewsSet, adNewsSet.getUpdateUser());
adNewsGroupDao.batchInsert(adNewsSet.getAdNewsGroups()); adNewsGroupDao.batchInsert(adNewsSet.getAdNewsGroups());
// 判断是否增加自有过公众号,如果没有则将当前数据入库
if (!ListUtils.isEmpty(adNewsSet.getAdNewsWechats())
&& !adNewsWechatDao.existsAdNewsWechat(adNewsSet.getUpdateUser())) {
buildAdNewsWechats(adNewsSet);
adNewsWechatDao.batchInsert(adNewsSet.getAdNewsWechats());
}
//删除旧的定时任务 //删除旧的定时任务
deleteAdNewsSch(AD_MORNING_NEWS_SCHEDULE_PRE + adNewsSet.getId()); deleteAdNewsSch(AD_MORNING_NEWS_SCHEDULE_PRE + adNewsSet.getId());
deleteAdNewsSch(AD_EVENING_NEWS_SCHEDULE_PRE + adNewsSet.getId()); deleteAdNewsSch(AD_EVENING_NEWS_SCHEDULE_PRE + adNewsSet.getId());
...@@ -199,15 +216,16 @@ public class AdNewsBizImpl implements AdNewsBiz { ...@@ -199,15 +216,16 @@ public class AdNewsBizImpl implements AdNewsBiz {
//查询关联的群 //查询关联的群
List<GroupQrcodeFoAdDTO> groupQrcodeFoAdDTOS = groupQrcodeDao.GroupQrcodeFoAdDTOSByClassifyIds(classifyIds); List<GroupQrcodeFoAdDTO> groupQrcodeFoAdDTOS = groupQrcodeDao.GroupQrcodeFoAdDTOSByClassifyIds(classifyIds);
if (ListUtils.isEmpty(groupQrcodeFoAdDTOS)) { if (ListUtils.isEmpty(groupQrcodeFoAdDTOS)) {
LOGGER.info("没有关联任何群,无法发送早晚报!");
return; return;
} }
// 需要发送的早晚报内容 // 需要发送的早晚报内容
List<String> contents = new ArrayList<>(); List<String> contents = new ArrayList<>();
// 插入发送记录 // 需要入库的发送记录
List<AdNewsGroupRecord> adNewsGroupRecords = new ArrayList<>(); List<AdNewsGroupRecord> adNewsGroupRecords = new ArrayList<>();
// 插入消息统计信息 // 需要入库的消息统计信息
List<AdNewsMessageStatistic> adNewsMessageStatistics = new ArrayList<>(); List<AdNewsMessageStatistic> adNewsMessageStatistics = new ArrayList<>();
// for循环内的临时变量 // for循环内的临时变量
...@@ -216,10 +234,18 @@ public class AdNewsBizImpl implements AdNewsBiz { ...@@ -216,10 +234,18 @@ public class AdNewsBizImpl implements AdNewsBiz {
if (adNewsSet.getContentFrom() == AdContentFromEnum.WECHAT.key) { if (adNewsSet.getContentFrom() == AdContentFromEnum.WECHAT.key) {
//查询要发的记录 // 查询要发的记录
List<AdNews> adNewsList = adNewsDao.getNewsToSendBySetIdAndAdviser(adNewsSetId, adNewsSet.getCreateUser(), adNewsSet.getSendCount()); List<AdNews> adNewsList = null;
AdContentFromEnum adContentFromEnum = AdContentFromEnum.WECHAT_ADVISER;
adNewsList = adNewsDao.getNewsToSendBySetIdAndAdviser4Own(adNewsSetId, adNewsSet.getCreateUser(), adNewsSet.getSendCount());
if (ListUtils.isEmpty(adNewsList)) { if (ListUtils.isEmpty(adNewsList)) {
return; adContentFromEnum = AdContentFromEnum.WECHAT;
adNewsList = adNewsDao.getNewsToSendBySetIdAndAdviser(adNewsSetId, adNewsSet.getCreateUser(), adNewsSet.getSendCount());
if (ListUtils.isEmpty(adNewsList)) {
LOGGER.info("记录为空,没有可供发送的早晚报!");
return;
}
} }
// 构建记录对象 // 构建记录对象
...@@ -243,12 +269,13 @@ public class AdNewsBizImpl implements AdNewsBiz { ...@@ -243,12 +269,13 @@ public class AdNewsBizImpl implements AdNewsBiz {
adNewsMessageStatistic.setClassifyId(groupQrcodeFoAdDTO.getClassifyId()); adNewsMessageStatistic.setClassifyId(groupQrcodeFoAdDTO.getClassifyId());
adNewsMessageStatistic.setQrcodeId(groupQrcodeFoAdDTO.getQrcodeId()); adNewsMessageStatistic.setQrcodeId(groupQrcodeFoAdDTO.getQrcodeId());
adNewsMessageStatistic.setCreateUser(adNewsSet.getCreateUser()); adNewsMessageStatistic.setCreateUser(adNewsSet.getCreateUser());
adNewsMessageStatistic.setContentFrom(adNewsSet.getContentFrom()); adNewsMessageStatistic.setContentFrom(adContentFromEnum.key);
adNewsMessageStatistic.setMessageCount(adNewsList.size()); adNewsMessageStatistic.setMessageCount(adNewsList.size());
adNewsMessageStatistic.setInsertMark(groupQrcodeFoAdDTOS.indexOf(groupQrcodeFoAdDTO)); adNewsMessageStatistic.setInsertMark(groupQrcodeFoAdDTOS.indexOf(groupQrcodeFoAdDTO));
adNewsMessageStatistics.add(adNewsMessageStatistic); adNewsMessageStatistics.add(adNewsMessageStatistic);
} }
// 因为拼短链接需要主键,所以需要先入库拿到主键后然后拼接Url,最后再发送微信消息;
// 记录入库 // 记录入库
this.insertRecord(adNewsGroupRecords, adNewsMessageStatistics); this.insertRecord(adNewsGroupRecords, adNewsMessageStatistics);
...@@ -330,7 +357,7 @@ public class AdNewsBizImpl implements AdNewsBiz { ...@@ -330,7 +357,7 @@ public class AdNewsBizImpl implements AdNewsBiz {
*/ */
private void insertRecord(List<AdNewsGroupRecord> adNewsGroupRecords, List<AdNewsMessageStatistic> adNewsMessageStatistics) { private void insertRecord(List<AdNewsGroupRecord> adNewsGroupRecords, List<AdNewsMessageStatistic> adNewsMessageStatistics) {
adNewsMessageStatisticDao.batchInsert(adNewsMessageStatistics); adNewsMessageStatisticDao.batchInsert(adNewsMessageStatistics);
// 不会mybatis的主从表批量插入,所以只能这么做 // 将主键赋值给从表外键;(不会mybatis的主从表批量插入,所以只能这么做)
for (AdNewsMessageStatistic item : adNewsMessageStatistics) { for (AdNewsMessageStatistic item : adNewsMessageStatistics) {
adNewsGroupRecords.stream().filter(x -> x.getInsertMark() == item.getInsertMark()).forEach(x -> x.setMessageStatisticId(item.getId())); adNewsGroupRecords.stream().filter(x -> x.getInsertMark() == item.getInsertMark()).forEach(x -> x.setMessageStatisticId(item.getId()));
} }
...@@ -437,6 +464,10 @@ public class AdNewsBizImpl implements AdNewsBiz { ...@@ -437,6 +464,10 @@ public class AdNewsBizImpl implements AdNewsBiz {
List<Long> classifyIds = adNewsGroups.stream().filter(s -> s.getClassifyId() != null).map(AdNewsGroup::getClassifyId).collect(Collectors.toList()); List<Long> classifyIds = adNewsGroups.stream().filter(s -> s.getClassifyId() != null).map(AdNewsGroup::getClassifyId).collect(Collectors.toList());
adNewsSet.setClassifyIds(classifyIds); adNewsSet.setClassifyIds(classifyIds);
} }
// 自有公众号
List<AdNewsWechat> adNewsWechats = adNewsWechatDao.getListByAdviserId(adNewsSet.getUpdateUser());
adNewsSet.setAdNewsWechats(ListUtils.isEmpty(adNewsWechats) ? new ArrayList<>() : adNewsWechats);
} }
return adNewsSet; return adNewsSet;
} }
...@@ -481,6 +512,7 @@ public class AdNewsBizImpl implements AdNewsBiz { ...@@ -481,6 +512,7 @@ public class AdNewsBizImpl implements AdNewsBiz {
map.put("hasBan", adNewsListParam.getHasBan()); map.put("hasBan", adNewsListParam.getHasBan());
map.put("hasUsed", adNewsListParam.getHasUsed()); map.put("hasUsed", adNewsListParam.getHasUsed());
map.put("adNewsWechatIds", adNewsListParam.getAdNewsWechatIds()); map.put("adNewsWechatIds", adNewsListParam.getAdNewsWechatIds());
map.put("contentFrom", adNewsListParam.getContentFrom());
PageBeanNew<AdNews> pageBeanNew = adNewsDao.listPageNew(pageParam, map, "getAdNewsList"); PageBeanNew<AdNews> pageBeanNew = adNewsDao.listPageNew(pageParam, map, "getAdNewsList");
return pageBeanNew; return pageBeanNew;
} }
...@@ -550,9 +582,31 @@ public class AdNewsBizImpl implements AdNewsBiz { ...@@ -550,9 +582,31 @@ public class AdNewsBizImpl implements AdNewsBiz {
@ParamLog("增加公众号反馈") @ParamLog("增加公众号反馈")
@Override @Override
public Long addAdNewsWechat(AdNewsWechat adNewsWechat) { public Long addAdNewsWechat(AdNewsWechat adNewsWechat) {
this.checkAdNewsWechat(adNewsWechat);
return adNewsWechatDao.insert(adNewsWechat); return adNewsWechatDao.insert(adNewsWechat);
} }
private void checkAdNewsWechat(AdNewsWechat adNewsWechat) {
if (adNewsWechat.getAdviserId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "编辑id不能为空!");
}
if (StringUtil.isEmpty(adNewsWechat.getWechatName())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "公众号不能为空!");
}
if (adNewsWechatDao.checkRepeat(adNewsWechat.getWechatName(), adNewsWechat.getAdviserId())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "该公众号已经存在!");
}
}
@Override
@ParamLog("获取编辑自有公众号")
public PageBeanNew<AdNewsWechat> getAdNewsWechatListForAdviser(Long adviserId, Integer currentPage, Integer numPerPage) {
PageParam pageParam = new PageParam(currentPage, numPerPage);
Map<String, Object> map = new HashMap<>();
map.put("adviserId", adviserId);
return adNewsWechatDao.listPageNew(pageParam, map, "getAdNewsWechatListForAdviser");
}
@ParamLog("获取公众号列表") @ParamLog("获取公众号列表")
@Override @Override
public PageBeanNew<AdNewsWechat> getAdNewsWechatList(Integer currentPage, Integer numPerPage) { public PageBeanNew<AdNewsWechat> getAdNewsWechatList(Integer currentPage, Integer numPerPage) {
...@@ -587,7 +641,7 @@ public class AdNewsBizImpl implements AdNewsBiz { ...@@ -587,7 +641,7 @@ public class AdNewsBizImpl implements AdNewsBiz {
} }
// 移除编辑之前的选择 // 移除编辑之前的选择
adNewsWechatChooseDao.deleteAdNewsWechatChooseByPartyId(partyId); adNewsWechatChooseDao.deleteAdNewsWechatChooseByPartyId(partyId);
if(!ListUtils.isEmpty(adNewsWechatChooses)){ if (!ListUtils.isEmpty(adNewsWechatChooses)) {
// 重新建立关系 // 重新建立关系
adNewsWechatChooseDao.batchInsert(adNewsWechatChooses); adNewsWechatChooseDao.batchInsert(adNewsWechatChooses);
} }
......
...@@ -26,7 +26,9 @@ public class AdNewsCheck { ...@@ -26,7 +26,9 @@ public class AdNewsCheck {
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) { // 勾选 系统公众号 或者 自有公众号 并且 推送条数小于0则提示;
if ((adNewsSet.getContentFrom() == AdContentFromEnum.WECHAT.key || adNewsSet.getContentFrom() == AdContentFromEnum.WECHAT_ADVISER.key)
&& (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) {
...@@ -53,7 +55,9 @@ public class AdNewsCheck { ...@@ -53,7 +55,9 @@ public class AdNewsCheck {
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, "结束语不能为空!");
} }
if (adNewsSet.getContentFrom() != AdContentFromEnum.WECHAT.key && adNewsSet.getContentFrom() != AdContentFromEnum.CUSTOM.key) { if (adNewsSet.getContentFrom() != AdContentFromEnum.WECHAT.key
&& adNewsSet.getContentFrom() != AdContentFromEnum.CUSTOM.key
&& adNewsSet.getContentFrom() != AdContentFromEnum.WECHAT_ADVISER.key) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "请选择早晚报内容来源!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "请选择早晚报内容来源!");
} }
for (AdNewsGroup adNewsGroup : adNewsSet.getAdNewsGroups()) { for (AdNewsGroup adNewsGroup : adNewsSet.getAdNewsGroups()) {
......
...@@ -9,4 +9,12 @@ public interface AdNewsDao extends BaseDao<AdNews> { ...@@ -9,4 +9,12 @@ public interface AdNewsDao extends BaseDao<AdNews> {
List<AdNews> getNewsToSendBySetIdAndAdviser(Long adNewsSetId, Long adviserId, Integer top); List<AdNews> getNewsToSendBySetIdAndAdviser(Long adNewsSetId, Long adviserId, Integer top);
/**
* 获取自有公众号的需要发送的新闻
* @param adNewsSetId
* @param adviserId
* @param top
* @return
*/
List<AdNews> getNewsToSendBySetIdAndAdviser4Own(Long adNewsSetId, Long adviserId, Integer top);
} }
...@@ -3,10 +3,34 @@ package com.pcloud.book.adnews.dao; ...@@ -3,10 +3,34 @@ package com.pcloud.book.adnews.dao;
import com.pcloud.book.adnews.entity.AdNewsWechat; import com.pcloud.book.adnews.entity.AdNewsWechat;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/** /**
* @author zhengyongqiang * @author zhengyongqiang
* @date 2019/8/7 11:46 * @date 2019/8/7 11:46
*/ */
public interface AdNewsWechatDao extends BaseDao<AdNewsWechat> { public interface AdNewsWechatDao extends BaseDao<AdNewsWechat> {
boolean checkRepeat(String wechatName, Long adviserId);
/**
* 批量新增自有公众号
* @param list
* @return
*/
Integer batchInsert(List<AdNewsWechat> list);
/**
* 检测是否存在自有公众号
* @param adviserId
* @return
*/
boolean existsAdNewsWechat(Long adviserId);
/**
* 获取自有公众号
* @param adviserId
* @return
*/
List<AdNewsWechat> getListByAdviserId(Long adviserId);
} }
...@@ -24,4 +24,13 @@ public class AdNewsDaoImpl extends BaseDaoImpl<AdNews> implements AdNewsDao { ...@@ -24,4 +24,13 @@ public class AdNewsDaoImpl extends BaseDaoImpl<AdNews> implements AdNewsDao {
map.put("top", top); map.put("top", top);
return super.getSqlSession().selectList(getStatement("getNewsToSendBySetIdAndAdviser"), map); return super.getSqlSession().selectList(getStatement("getNewsToSendBySetIdAndAdviser"), map);
} }
@Override
public List<AdNews> getNewsToSendBySetIdAndAdviser4Own(Long adNewsSetId, Long adviserId, Integer top) {
Map<String, Object> map = new HashMap<>();
map.put("adNewsSetId", adNewsSetId);
map.put("adviserId", adviserId);
map.put("top", top);
return super.getSqlSession().selectList(getStatement("getNewsToSendBySetIdAndAdviser4Own"), map);
}
} }
...@@ -5,10 +5,38 @@ import com.pcloud.book.adnews.entity.AdNewsWechat; ...@@ -5,10 +5,38 @@ import com.pcloud.book.adnews.entity.AdNewsWechat;
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.Map;
/** /**
* @author zhengyongqiang * @author zhengyongqiang
* @date 2019/8/7 11:52 * @date 2019/8/7 11:52
*/ */
@Repository("adNewsWechatDao") @Repository("adNewsWechatDao")
public class AdNewsWechatDaoImpl extends BaseDaoImpl<AdNewsWechat> implements AdNewsWechatDao { public class AdNewsWechatDaoImpl extends BaseDaoImpl<AdNewsWechat> implements AdNewsWechatDao {
@Override
public boolean checkRepeat(String wechatName, Long adviserId) {
Map<String,Object> map = new HashMap<>();
map.put("wechatName",wechatName);
map.put("adviserId",adviserId);
return super.getSqlSession().selectOne(getStatement("checkRepeat"),map);
}
@Override
public Integer batchInsert(List<AdNewsWechat> list) {
return super.getSqlSession().insert(getStatement("batchInsert"),list);
}
@Override
public boolean existsAdNewsWechat(Long adviserId) {
Map<String,Object> map = new HashMap<>();
map.put("adviserId",adviserId);
return super.getSqlSession().selectOne(getStatement("existsAdNewsWechat"),map);
}
@Override
public List<AdNewsWechat> getListByAdviserId(Long adviserId) {
return super.getSqlSession().selectList(getStatement("getListByAdviserId"),adviserId);
}
} }
...@@ -30,6 +30,9 @@ public class AdNewsListParam { ...@@ -30,6 +30,9 @@ public class AdNewsListParam {
@ApiModelProperty ("公众号id") @ApiModelProperty ("公众号id")
private List<Long> adNewsWechatIds; private List<Long> adNewsWechatIds;
@ApiModelProperty(value = "公众号来源;", dataType = "com.pcloud.book.adnews.enums.AdContentFromEnum")
private Integer contentFrom;
@ApiModelProperty("已被禁用;0:没禁用; 1:已禁用;") @ApiModelProperty("已被禁用;0:没禁用; 1:已禁用;")
private Integer hasBan; private Integer hasBan;
......
...@@ -68,4 +68,8 @@ public class AdNewsSet extends BaseEntity { ...@@ -68,4 +68,8 @@ public class AdNewsSet extends BaseEntity {
@ApiModelProperty("分类id集合") @ApiModelProperty("分类id集合")
private List<Long> classifyIds; private List<Long> classifyIds;
@ApiModelProperty("自有公众号")
private List<AdNewsWechat> adNewsWechats;
} }
...@@ -3,11 +3,13 @@ package com.pcloud.book.adnews.entity; ...@@ -3,11 +3,13 @@ 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;
/** /**
* @author zhengyongqiang * @author zhengyongqiang
* @date 2019/8/7 11:23 * @date 2019/8/7 11:23
*/ */
@Data
@ApiModel("新闻微信公众号") @ApiModel("新闻微信公众号")
public class AdNewsWechat extends BaseEntity { public class AdNewsWechat extends BaseEntity {
...@@ -34,52 +36,4 @@ public class AdNewsWechat extends BaseEntity { ...@@ -34,52 +36,4 @@ public class AdNewsWechat extends BaseEntity {
@ApiModelProperty("是否删除") @ApiModelProperty("是否删除")
private Boolean isDelete; 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 +
'}';
}
} }
...@@ -11,8 +11,9 @@ import org.springframework.amqp.rabbit.support.PublisherCallbackChannelImpl; ...@@ -11,8 +11,9 @@ import org.springframework.amqp.rabbit.support.PublisherCallbackChannelImpl;
*/ */
public enum AdContentFromEnum { public enum AdContentFromEnum {
WECHAT(0, "微信公众号"), WECHAT(0, "系统推荐公众号"),
CUSTOM(1, "自定义内容 "); CUSTOM(1, "自定义内容 "),
WECHAT_ADVISER(2,"自有公众号"); // 目前只使用于 ad_news_message_statistic.content_from
public final Integer key; public final Integer key;
......
...@@ -3,6 +3,7 @@ package com.pcloud.book.adnews.facade; ...@@ -3,6 +3,7 @@ package com.pcloud.book.adnews.facade;
import com.pcloud.book.adnews.entity.AdNewsClickRecord; 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.book.adnews.dto.AdNewsListParam;
import com.pcloud.book.adnews.entity.AdNewsWechat;
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;
...@@ -58,12 +59,12 @@ public interface AdNewsFacade { ...@@ -58,12 +59,12 @@ public interface AdNewsFacade {
ResponseDto<?> getAdNewsChooseList( ResponseDto<?> getAdNewsChooseList(
@RequestHeader("token") @ApiParam("token信息") String token, @RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "title", required = false) @ApiParam("标题") String title, @RequestParam(value = "title", required = false) @ApiParam("标题") String title,
@RequestParam(value = "hasUsed", required = false) @ApiParam("标题") Boolean hasUsed, @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("早晚报素材库") @ApiOperation("早晚报素材库管理(只获取编辑已选公众号的素材)")
@PostMapping("/getAdNewsList") @PostMapping("/getAdNewsList")
ResponseDto<?> getAdNewsList( ResponseDto<?> getAdNewsList(
@RequestHeader("token") @ApiParam("token信息") String token, @RequestHeader("token") @ApiParam("token信息") String token,
...@@ -78,6 +79,21 @@ public interface AdNewsFacade { ...@@ -78,6 +79,21 @@ public interface AdNewsFacade {
@RequestParam("hasBan") @ApiParam("禁止推送") Integer hasBan @RequestParam("hasBan") @ApiParam("禁止推送") Integer hasBan
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@ApiOperation("编辑反馈公众号")
@PostMapping("/addAdNewsWechat")
ResponseDto<?> addAdNewsWechat(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody @ApiParam("AdNewsWechat") AdNewsWechat adNewsWechat
) throws BizException, PermissionException;
@ApiOperation("获取编辑自有公众号")
@GetMapping("/getAdNewsWechatList")
ResponseDto<?> getAdNewsWechatListForAdviser(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException;
@ApiOperation("添加编辑选择的公众号") @ApiOperation("添加编辑选择的公众号")
@PostMapping("/createAdNewsWechatChooseBatch") @PostMapping("/createAdNewsWechatChooseBatch")
ResponseDto<?> createAdNewsWechatChooseBatch( ResponseDto<?> createAdNewsWechatChooseBatch(
......
...@@ -171,6 +171,36 @@ public class AdNewsFacadeImpl implements AdNewsFacade { ...@@ -171,6 +171,36 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
return new ResponseDto<>(); return new ResponseDto<>();
} }
@Override
@ApiOperation("编辑反馈公众号")
@PostMapping("/addAdNewsWechat")
public ResponseDto<?> addAdNewsWechat(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody @ApiParam("AdNewsWechat") AdNewsWechat adNewsWechat
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
adNewsWechat.setAdviserId(partyId);
return new ResponseDto<>(adNewsBiz.addAdNewsWechat(adNewsWechat));
}
@Override
@ApiOperation("获取编辑自有公众号")
@GetMapping("/getAdNewsWechatListForAdviser")
public ResponseDto<?> getAdNewsWechatListForAdviser(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (currentPage == null || currentPage < 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "当前页不能为空且不能小于0!");
}
if (numPerPage == null || numPerPage <= 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "每页条数不能为空且必须大于0!");
}
return new ResponseDto<>(adNewsBiz.getAdNewsWechatListForAdviser(partyId, currentPage, numPerPage));
}
@ApiOperation("添加编辑选择的公众号") @ApiOperation("添加编辑选择的公众号")
@PostMapping("/createAdNewsWechatChooseBatch") @PostMapping("/createAdNewsWechatChooseBatch")
@Override @Override
...@@ -277,7 +307,7 @@ public class AdNewsFacadeImpl implements AdNewsFacade { ...@@ -277,7 +307,7 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
Long channelId = (Long) map.get(Cookie._CHANNEL_ID); Long channelId = (Long) map.get(Cookie._CHANNEL_ID);
Long wechatUserId = (Long) map.get(Cookie._WECHAT_USER_ID); Long wechatUserId = (Long) map.get(Cookie._WECHAT_USER_ID);
LOGGER.info("addAdNewsClickRecord Map => "+map.toString()); LOGGER.info("addAdNewsClickRecord Map => " + map.toString());
adNewsClickRecord.setWechatUserId(wechatUserId); adNewsClickRecord.setWechatUserId(wechatUserId);
return new ResponseDto<>(adNewsBiz.addAdNewsClickRecord(adNewsClickRecord)); return new ResponseDto<>(adNewsBiz.addAdNewsClickRecord(adNewsClickRecord));
......
...@@ -67,4 +67,8 @@ public interface BookClockBiz { ...@@ -67,4 +67,8 @@ public interface BookClockBiz {
*/ */
void deleteBookGroupClock(Long bookClockInfoId,Long adviserId); void deleteBookGroupClock(Long bookClockInfoId,Long adviserId);
/**
* 处理关联应用的打卡的旧数据
*/
void dealOldData4WeixinClock();
} }
...@@ -28,6 +28,8 @@ import com.pcloud.book.group.dao.WeixinQrcodeDao; ...@@ -28,6 +28,8 @@ import com.pcloud.book.group.dao.WeixinQrcodeDao;
import com.pcloud.book.group.dto.BookGroupDTO; import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookWxQrcodeDTO; import com.pcloud.book.group.dto.BookWxQrcodeDTO;
import com.pcloud.book.group.dto.ClassifyDTO; import com.pcloud.book.group.dto.ClassifyDTO;
import com.pcloud.book.weixinclock.biz.WeixinClockBiz;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean; import com.pcloud.common.page.PageBean;
...@@ -48,6 +50,8 @@ import java.util.ArrayList; ...@@ -48,6 +50,8 @@ import java.util.ArrayList;
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.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -84,6 +88,8 @@ public class BookClockBizImpl implements BookClockBiz { ...@@ -84,6 +88,8 @@ public class BookClockBizImpl implements BookClockBiz {
private ScheduleService scheduleService; private ScheduleService scheduleService;
@Autowired @Autowired
private WeixinQrcodeDao weixinQrcodeDao; private WeixinQrcodeDao weixinQrcodeDao;
@Autowired
private WeixinClockBiz weixinClockBiz;
/** /**
...@@ -416,4 +422,30 @@ public class BookClockBizImpl implements BookClockBiz { ...@@ -416,4 +422,30 @@ public class BookClockBizImpl implements BookClockBiz {
throw new BookBizException(BookBizException.ERROR,"删除定时任务失败!"); throw new BookBizException(BookBizException.ERROR,"删除定时任务失败!");
} }
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void dealOldData4WeixinClock() {
new Thread(() -> {
WeixinClockDto weixinClockDto = new WeixinClockDto();
weixinClockDto.setClockGuide("每日打卡,养成良好习惯");
weixinClockDto.setClockIntroduction("欢迎加入打卡,每天一次,养成良好习惯");
weixinClockDto.setClockKeyword("每日打卡");
List<BookClockInfoDTO> clockInfoIds = bookClockInfoDao.getAllClockInfoIds();
if(!ListUtils.isEmpty(clockInfoIds)){
for(BookClockInfoDTO bookClockInfoDTO: clockInfoIds){
List<Long> list1 = bookGroupClockDao.getClassifyIdsByBookGroupId(bookClockInfoDTO.getBookClockInfoId());
List<Long> list2 = bookGroupClockDao.getClassifyIdsByClassfyId(bookClockInfoDTO.getBookClockInfoId());
list1.addAll(list2);
List<Long> resultList = list1.stream().distinct().collect(Collectors.toList());
if(!ListUtils.isEmpty(resultList)) {
weixinClockDto.setCreateUser(bookClockInfoDTO.getCreateUser());
weixinClockDto.setLastModifiedUser(bookClockInfoDTO.getCreateUser());
weixinClockDto.setGroupClassifyIds(resultList);
weixinClockBiz.createWeixinClock(weixinClockDto);
}
}
}
}).start();
}
} }
...@@ -86,4 +86,6 @@ public interface BookClockInfoDao extends BaseDao<BookClockInfo> { ...@@ -86,4 +86,6 @@ public interface BookClockInfoDao extends BaseDao<BookClockInfo> {
* @param paramMap * @param paramMap
*/ */
void deleteBookClockInfo(Map<String, Object> paramMap); void deleteBookClockInfo(Map<String, Object> paramMap);
List<BookClockInfoDTO> getAllClockInfoIds();
} }
...@@ -70,4 +70,8 @@ public interface BookGroupClockDao extends BaseDao<BookGroupClock> { ...@@ -70,4 +70,8 @@ public interface BookGroupClockDao extends BaseDao<BookGroupClock> {
* @param paramMap * @param paramMap
*/ */
void deleteBookGroupClock(Map<String,Object> paramMap); void deleteBookGroupClock(Map<String,Object> paramMap);
List<Long> getClassifyIdsByBookGroupId(Long bookClockInfoId);
List<Long> getClassifyIdsByClassfyId(Long bookClockInfoId);
} }
...@@ -135,5 +135,11 @@ public class BookClockInfoDaoImpl extends BaseDaoImpl<BookClockInfo> implements ...@@ -135,5 +135,11 @@ public class BookClockInfoDaoImpl extends BaseDaoImpl<BookClockInfo> implements
super.sqlSessionTemplate.delete(getStatement("deleteBookClockInfo"),paramMap); super.sqlSessionTemplate.delete(getStatement("deleteBookClockInfo"),paramMap);
} }
@Override
public List<BookClockInfoDTO> getAllClockInfoIds() {
Map<String,Object> paramMap = new HashMap<>();
return super.sqlSessionTemplate.selectList(getStatement("getAllClockInfoIds"),paramMap);
}
} }
...@@ -6,6 +6,7 @@ import com.pcloud.book.clock.entity.BookGroupClock; ...@@ -6,6 +6,7 @@ import com.pcloud.book.clock.entity.BookGroupClock;
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; import java.util.Map;
...@@ -100,4 +101,18 @@ public class BookGroupClockDaoImpl extends BaseDaoImpl<BookGroupClock> implement ...@@ -100,4 +101,18 @@ public class BookGroupClockDaoImpl extends BaseDaoImpl<BookGroupClock> implement
public void deleteBookGroupClock(Map<String, Object> paramMap) { public void deleteBookGroupClock(Map<String, Object> paramMap) {
super.sqlSessionTemplate.delete(getStatement("deleteBookGroupClock"),paramMap); super.sqlSessionTemplate.delete(getStatement("deleteBookGroupClock"),paramMap);
} }
@Override
public List<Long> getClassifyIdsByBookGroupId(Long bookClockInfoId) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("bookClockInfoId",bookClockInfoId);
return super.sqlSessionTemplate.selectList(getStatement("getClassifyIdsByBookGroupId"),paramMap);
}
@Override
public List<Long> getClassifyIdsByClassfyId(Long bookClockInfoId) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("bookClockInfoId",bookClockInfoId);
return super.sqlSessionTemplate.selectList(getStatement("getClassifyIdsByClassfyId"),paramMap);
}
} }
...@@ -60,7 +60,21 @@ public class BookClockInfoServiceImpl implements BookClockInfoService { ...@@ -60,7 +60,21 @@ public class BookClockInfoServiceImpl implements BookClockInfoService {
@RequestMapping(value = "sendBookClockGroupMessage", method = RequestMethod.POST) @RequestMapping(value = "sendBookClockGroupMessage", method = RequestMethod.POST)
public void sendBookClockGroupMessage(@RequestBody Map<String, Object> map) throws BizException { public void sendBookClockGroupMessage(@RequestBody Map<String, Object> map) throws BizException {
LOGGER.info("内部接口群发消息被调用"+map.toString()); LOGGER.info("内部接口群发消息被调用"+map.toString());
bookClockBiz.sendBookClockGroupMessage(map); return;
// bookClockBiz.sendBookClockGroupMessage(map);
} }
/**
* @description 处理关联应用的打卡的旧数据
* @author 杨涛
* @date 2019/5/10 10:28
*/
@Override
@RequestMapping(value = "/dealOldData4WeixinClock", method = RequestMethod.GET)
public void dealOldData4WeixinClock() {
bookClockBiz.dealOldData4WeixinClock();
}
} }
package com.pcloud.book.consumer.settlement; package com.pcloud.book.consumer.settlement;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.settlementcenter.record.dto.GetGroupClassifyIncomeDTO;
import com.pcloud.settlementcenter.record.dto.GetGroupQrcodeIncomeDTO;
import com.pcloud.settlementcenter.record.dto.GroupRescourceIncomeParamDTO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
...@@ -102,4 +109,52 @@ public class BookConsr { ...@@ -102,4 +109,52 @@ public class BookConsr {
LOGGER.info("【书刊-结算(消)】批量获取书刊总收益,<END>"); LOGGER.info("【书刊-结算(消)】批量获取书刊总收益,<END>");
return resultMap; return resultMap;
} }
@ParamLog(value = "批量获取社群码下资源的收益", isBefore = false, isAfterReturn = false)
public Map<Long, BigDecimal> getRescourceIncome(GroupRescourceIncomeParamDTO groupRescourceIncomeParamDTO) throws BizException {
Map<Long, BigDecimal> rescourceIncome = new HashMap<>();
try {
ResponseEntity<ResponseDto<Map<Long, BigDecimal>>> responseEntityP = bookService.getGroupRescourceIncome(groupRescourceIncomeParamDTO);
rescourceIncome = ResponseHandleUtil.parseMap(responseEntityP, Long.class, BigDecimal.class);
} catch (Exception e) {
LOGGER.error("批量获取社群码下资源的收益.[getRescourceIncome]:" + e.getMessage(), e);
}
return rescourceIncome;
}
@ParamLog(value = "批量获取社群码下资源的总收益", isBefore = false, isAfterReturn = false)
public BigDecimal getRescourceTotalIncome(GroupRescourceIncomeParamDTO groupRescourceIncomeParamDTO) throws BizException {
BigDecimal rescourceTotalIncome = new BigDecimal(0);
try {
ResponseEntity<ResponseDto<BigDecimal>> responseEntityP = bookService.getGroupRescourceTotalIncome(groupRescourceIncomeParamDTO);
rescourceTotalIncome = ResponseHandleUtil.parseResponse(responseEntityP, BigDecimal.class);
} catch (Exception e) {
LOGGER.error("批量获取社群码下资源的总收益.[getRescourceTotalIncome]:" + e.getMessage(), e);
}
return rescourceTotalIncome == null?BigDecimal.ZERO:rescourceTotalIncome;
}
@ParamLog(value = "批量获取社群码分类的收益", isBefore = false, isAfterReturn = false)
public Map<Long,BigDecimal> getClassifyIncome(GetGroupClassifyIncomeDTO getGroupClassifyIncomeDTO) throws BizException {
Map<Long,BigDecimal> classifyIncome = new HashMap<>();
try {
ResponseEntity<ResponseDto<Map<Long,BigDecimal>>> responseEntityP = bookService.getGroupClassifyIncome(getGroupClassifyIncomeDTO);
classifyIncome = ResponseHandleUtil.parseMap(responseEntityP, Long.class, BigDecimal.class);
} catch (Exception e) {
LOGGER.error("批量获取社群码分类的收益.[getClassifyIncome]:" + e.getMessage(), e);
}
return classifyIncome;
}
@ParamLog(value = "批量获取社群码分类下的微信群收益", isBefore = false, isAfterReturn = false)
public Map<Long,BigDecimal> getQrcodeIncome(GetGroupQrcodeIncomeDTO getGroupQrcodeIncomeDTO) throws BizException {
Map<Long,BigDecimal> qrcodeIncome = new HashMap<>();
try {
ResponseEntity<ResponseDto<Map<Long,BigDecimal>>> responseEntityP = bookService.getGroupQrcodeIncome(getGroupQrcodeIncomeDTO);
qrcodeIncome = ResponseHandleUtil.parseMap(responseEntityP, Long.class, BigDecimal.class);
} catch (Exception e) {
LOGGER.error("批量获取社群码分类下的微信群收益.[getQrcodeIncome]:" + e.getMessage(), e);
}
return qrcodeIncome;
}
} }
...@@ -5,6 +5,9 @@ import com.pcloud.common.dto.ResponseDto; ...@@ -5,6 +5,9 @@ import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil; import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.settlementcenter.record.dto.ProductStaticUnderAppMapDTO;
import com.pcloud.settlementcenter.record.dto.ResourcesStatisticVO;
import com.pcloud.settlementcenter.record.service.BookService;
import com.pcloud.settlementcenter.record.service.SettlementService; import com.pcloud.settlementcenter.record.service.SettlementService;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -14,9 +17,8 @@ import org.springframework.http.ResponseEntity; ...@@ -14,9 +17,8 @@ import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
@Component("settlementConsr") @Component("settlementConsr")
public class SettlementConsr { public class SettlementConsr {
...@@ -27,6 +29,8 @@ public class SettlementConsr { ...@@ -27,6 +29,8 @@ public class SettlementConsr {
@Autowired @Autowired
private SettlementService settlementService; private SettlementService settlementService;
@Autowired
private BookService bookService;
@ParamLog(value = "获取收益", isBefore = false, isAfterReturn = false) @ParamLog(value = "获取收益", isBefore = false, isAfterReturn = false)
public Map<Long, BigDecimal> getWXGroupQrcodeIncomeByAdviser(List<Long> groupQrcodeIds, Long adviserId) throws BizException { public Map<Long, BigDecimal> getWXGroupQrcodeIncomeByAdviser(List<Long> groupQrcodeIds, Long adviserId) throws BizException {
...@@ -55,4 +59,28 @@ public class SettlementConsr { ...@@ -55,4 +59,28 @@ public class SettlementConsr {
} }
return map; return map;
} }
@ParamLog(value = "获取日期列表", isBefore = false, isAfterReturn = false)
public List<Date> getDateList(Integer dayNum,Date startDate, Date endDate) throws BizException {
List<Date> dateList = new ArrayList<>();
try {
ResponseEntity<ResponseDto<List<Date>>> responseEntityP = settlementService.getDateList(dayNum,startDate,endDate);
dateList = ResponseHandleUtil.parseList(responseEntityP, Date.class);
} catch (Exception e) {
LOGGER.error("获取日期列表.[getDateList]:" + e.getMessage(), e);
}
return dateList;
}
@ParamLog(value = "社群码应用下商品的收益", isBefore = false, isAfterReturn = false)
public Map<Long,List<ResourcesStatisticVO>> getProductStaticUnderApp(ProductStaticUnderAppMapDTO productStaticUnderAppMapDTO) throws BizException {
Map<Long,List<ResourcesStatisticVO>> resourcesStatisticVOS = new HashMap<>();
try {
ResponseEntity<ResponseDto<Map<Long,List<ResourcesStatisticVO>>>> responseEntityP = bookService.getProductStaticUnderAppMap(productStaticUnderAppMapDTO);
resourcesStatisticVOS = ResponseHandleUtil.parseMapList(responseEntityP, Long.class, ResourcesStatisticVO.class);
} catch (Exception e) {
LOGGER.error("社群码应用下商品的收益.[getProductStaticUnderApp]:" + e.getMessage(), e);
}
return resourcesStatisticVOS;
}
} }
...@@ -7,6 +7,7 @@ import com.pcloud.common.utils.ListUtils; ...@@ -7,6 +7,7 @@ import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil; import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.facade.tradecenter.dto.*; import com.pcloud.facade.tradecenter.dto.*;
import com.pcloud.facade.tradecenter.service.OrderFormService; import com.pcloud.facade.tradecenter.service.OrderFormService;
import org.apache.commons.collections.MapUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -14,10 +15,7 @@ import org.springframework.http.ResponseEntity; ...@@ -14,10 +15,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @Author:lili * @Author:lili
...@@ -126,6 +124,7 @@ public class TradeConsr { ...@@ -126,6 +124,7 @@ public class TradeConsr {
return amount; return amount;
} }
@ParamLog("获取用户购买或者参与过的社群码ID") @ParamLog("获取用户购买或者参与过的社群码ID")
public List<Long> getBuyBookGroupIdList(Long channelId, Long wechatUserId) throws BizException { public List<Long> getBuyBookGroupIdList(Long channelId, Long wechatUserId) throws BizException {
List<Long> results = new ArrayList<>(); List<Long> results = new ArrayList<>();
...@@ -138,4 +137,46 @@ public class TradeConsr { ...@@ -138,4 +137,46 @@ public class TradeConsr {
return results; return results;
} }
@ParamLog("获取社群码下的应用作品购买量")
public List<ClassifyPayDetailDto> getGroupBuyCount(Long bookGroupId, Long classifyId, Long qrcodeId, Date startDate, Date endDate) throws BizException{
List<ClassifyPayDetailDto> classifyPayDetailDtos = new ArrayList<>();
try {
ResponseEntity<ResponseDto<List<ClassifyPayDetailDto>>> responseEntity = orderFormService.getSaleVolume(startDate,endDate,bookGroupId,classifyId,qrcodeId);
classifyPayDetailDtos = ResponseHandleUtil.parseListResponse(responseEntity, ClassifyPayDetailDto.class);
} catch (Exception e) {
LOGGER.error("获取社群码下的应用作品购买量:" + e.getMessage(), e);
}
if (ListUtils.isEmpty(classifyPayDetailDtos)) {
classifyPayDetailDtos = new ArrayList<>();
}
return classifyPayDetailDtos;
}
@ParamLog("查询社区码下购买应用详情")
public Map<Long, GroupMoneyDto> getSaleDetail4Group(GroupIncomeSearchDto groupIncomeSearchDto) throws BizException {
Map<Long, GroupMoneyDto> groupMoneyDtoMap = new HashMap<>();
try {
ResponseEntity<ResponseDto<Map<Long, GroupMoneyDto>>> responseEntity = orderFormService.getSaleDetail4Group(groupIncomeSearchDto);
groupMoneyDtoMap = ResponseHandleUtil.parseMap(responseEntity, Long.class, GroupMoneyDto.class);
} catch (Exception e) {
LOGGER.error("查询社区码下购买应用详情:" + e.getMessage(), e);
}
if (MapUtils.isEmpty(groupMoneyDtoMap)) {
groupMoneyDtoMap = new HashMap<>();
}
return groupMoneyDtoMap;
}
@ParamLog("查询社群码下购买应用或作品的总销售额")
public BigDecimal getTotalSale(Long bookGroupId, Long classifyId, Long qrcodeId, String type) throws BizException {
BigDecimal totalSale = BigDecimal.ZERO;
try {
ResponseEntity<ResponseDto<BigDecimal>> responseEntity = orderFormService.getSaleAmount4Group(bookGroupId,classifyId,qrcodeId,type);
totalSale = ResponseHandleUtil.parseResponse(responseEntity, BigDecimal.class);
} catch (Exception e) {
LOGGER.error("查询社区码下购买应用详情:" + e.getMessage(), e);
}
return totalSale;
}
} }
...@@ -178,6 +178,19 @@ public class WechatGroupConsr { ...@@ -178,6 +178,19 @@ public class WechatGroupConsr {
return null; return null;
} }
@ParamLog(value = "群分类累计进群人数与今日进群人数", isBefore = false, isAfterReturn = false)
public Map<Long, Long> getclassifyMemberCount(List<Long> classifyIds) throws BizException {
if (ListUtils.isEmpty(classifyIds)) {
return null;
}
try {
return ResponseHandleUtil.parseMapResponse(groupMemberService.mapGroupClassifyStatisInfo(classifyIds), Long.class, Long.class);
} catch (Exception e) {
log.error("群分类累计进群人数与今日进群人数.[getclassifyMemberCount]:" + e.getMessage(), e);
}
return null;
}
@ParamLog(value = "活跃人数与总发言数", isBefore = false, isAfterReturn = false) @ParamLog(value = "活跃人数与总发言数", isBefore = false, isAfterReturn = false)
public Map<Long, GroupChatCountDTO> getChatCountByGroup(List<Long> groupQrcodeIds, Long bookGroupId) throws BizException { public Map<Long, GroupChatCountDTO> getChatCountByGroup(List<Long> groupQrcodeIds, Long bookGroupId) throws BizException {
if (ListUtils.isEmpty(groupQrcodeIds)) { if (ListUtils.isEmpty(groupQrcodeIds)) {
......
...@@ -2,6 +2,7 @@ package com.pcloud.book.group.biz; ...@@ -2,6 +2,7 @@ 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.*;
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;
...@@ -9,6 +10,11 @@ import com.pcloud.book.group.dto.GroupStoreMyPayDto; ...@@ -9,6 +10,11 @@ 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.entity.BookGroup;
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;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
...@@ -322,4 +328,47 @@ public interface BookGroupBiz { ...@@ -322,4 +328,47 @@ public interface BookGroupBiz {
* 获取用户购买或者参与过的社群书信息 * 获取用户购买或者参与过的社群书信息
*/ */
PageBeanNew<GroupStoreMyPayDto> getUserBrowseGroup4KnowLedgeMall(Long channelId, Long wechatUserId, Integer currentPage, Integer numPerPage); PageBeanNew<GroupStoreMyPayDto> getUserBrowseGroup4KnowLedgeMall(Long channelId, Long wechatUserId, Integer currentPage, Integer numPerPage);
/**
* 获取社群码相关数据
*/
BookGroupStatisticsDTO getBookGroupStatisByBookGroupId(Long bookGroupId);
/**
* 收益统计
*/
PageBeanNew<ResourcesStatisticVO> getGroupIncomeStatic(GroupIncomeStaticParamVO groupIncomeStaticParamVO, Long adviserId);
/**
* 社群码浏览趋势图
*/
List<GroupScanTrendVO> getGroupScanTrend(GroupScanTrendParamVO groupScanTrendParamVO, Long adviserId);
/**
* 社群码分类统计
*/
PageBeanNew<GroupStatisticVO> getClassifyStatistic(Long bookGroupId, Long adviserId, Integer currentPage, Integer numPerPage);
/**
* 社群码分类的微信群统计
*/
List<WxGroupStatisticVO> getQrcodeStatistic(Long bookGroupId, Long classifyId, Long adviserId);
/**
* 资源数据统计
*/
TotalRescourceDataVO getTotalRescourceData(Long bookGroupId,Long adviserId, Long classifyId, Long qrcodeId, String type);
/**
* 资源数据导出
*/
Map<String, String> exportRescourceIncomeData(Long bookGroupId,Long adviserId);
/**
* 获取资源浏览数据
*/
Map<Long, Long> getResourcesBrowseCount(ResourceBrowseParamDto resourceBrowseParamDto);
} }
package com.pcloud.book.group.biz; package com.pcloud.book.group.biz;
import com.pcloud.book.group.dto.BookGroupStatisticDTO; import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.dto.ClassifyDTO;
import com.pcloud.book.group.dto.ClassifyLearningReportDto;
import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import com.pcloud.book.group.dto.GroupNameAndMaxSeqDTO;
import com.pcloud.book.group.dto.GroupQrcodeBaseDTO;
import com.pcloud.book.group.dto.ProAssocGroupAndUserNumberDTO;
import com.pcloud.book.group.entity.BookGroupClassify; import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.vo.AddClassifyVO; import com.pcloud.book.group.vo.AddClassifyVO;
import com.pcloud.book.group.vo.AdviserClassifyParam; import com.pcloud.book.group.vo.AdviserClassifyParam;
...@@ -73,6 +67,13 @@ public interface BookGroupClassifyBiz { ...@@ -73,6 +67,13 @@ public interface BookGroupClassifyBiz {
ClassifyVO getClassify(Long classifyId); ClassifyVO getClassify(Long classifyId);
/** /**
* 根据id获取微信群分类
* @param weixinGroupClassifyPrimaryIds
* @return
*/
Map<Long, String> getClassifyByIds(List<Long> weixinGroupClassifyPrimaryIds);
/**
* @Author:lili * @Author:lili
* @Desr:根据规格对应分类信息 * @Desr:根据规格对应分类信息
* @Date:2019/4/19 11:46 * @Date:2019/4/19 11:46
...@@ -202,6 +203,9 @@ public interface BookGroupClassifyBiz { ...@@ -202,6 +203,9 @@ public interface BookGroupClassifyBiz {
PageBeanNew<ClassifyDTO> listSimpleBookGroupClassify4Adviser(Long adviserId, BookGroupClassify bookGroupClassify, PageParam pageParam); PageBeanNew<ClassifyDTO> listSimpleBookGroupClassify4Adviser(Long adviserId, BookGroupClassify bookGroupClassify, PageParam pageParam);
PageBeanNew<AdviserClassifyVO> listAdviserClassify(Long adviserId, AdviserClassifyParam adviserClassifyParam); PageBeanNew<AdviserClassifyVO> listAdviserClassify(Long adviserId, AdviserClassifyParam adviserClassifyParam);
Map<Long, BookClassifyDTO> getGroupClassifyCount(List<Long> bookIds);
/** /**
* 更新是否开启微学习报告 * 更新是否开启微学习报告
*/ */
...@@ -224,4 +228,12 @@ public interface BookGroupClassifyBiz { ...@@ -224,4 +228,12 @@ public interface BookGroupClassifyBiz {
* 拖动排序 * 拖动排序
*/ */
void dragSortClassify(List<Long> classifyIds); void dragSortClassify(List<Long> classifyIds);
/**
* 埋点记录点击群分类次数
*/
void clickClassify(Long wechatUserId, Long bookGroupId, Long classifyId);
List<ListClassifyVO> getClassifyIngoreDelete(Long bookGroupId);
} }
...@@ -65,6 +65,13 @@ public interface GroupQrcodeBiz { ...@@ -65,6 +65,13 @@ public interface GroupQrcodeBiz {
PageBeanNew<ClassifyQrcodeVO> listQrcodeByClassify(ListQrcodeByClassifyParamVO listQrcodeByClassifyParamVO); PageBeanNew<ClassifyQrcodeVO> listQrcodeByClassify(ListQrcodeByClassifyParamVO listQrcodeByClassifyParamVO);
/** /**
* @description 获取社群码类别下的群---不分页
* @author 戴兴
* @date 2019/7/28 15:59
*/
List<ClassifyQrcodeVO> getQrcodeByClassify(Long bookGroupId, Long classifyId);
/**
* @Author:lili * @Author:lili
* @Desr:修改微信群名称 * @Desr:修改微信群名称
* @Date:2019/4/1 11:22 * @Date:2019/4/1 11:22
......
...@@ -17,12 +17,14 @@ import com.pcloud.book.consumer.app.AppConsr; ...@@ -17,12 +17,14 @@ import com.pcloud.book.consumer.app.AppConsr;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr; import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.raystask.MainLineConsr; import com.pcloud.book.consumer.raystask.MainLineConsr;
import com.pcloud.book.consumer.resource.ProductConsr; import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.consumer.settlement.BookConsr;
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.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.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.dao.*; import com.pcloud.book.group.dao.*;
import com.pcloud.book.group.dto.*; import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.entity.BookGroup; import com.pcloud.book.group.entity.BookGroup;
...@@ -30,11 +32,19 @@ import com.pcloud.book.group.entity.JoinGroupCipher; ...@@ -30,11 +32,19 @@ import com.pcloud.book.group.entity.JoinGroupCipher;
import com.pcloud.book.group.entity.TempletRelevance; import com.pcloud.book.group.entity.TempletRelevance;
import com.pcloud.book.group.enums.LargTempletEnum; import com.pcloud.book.group.enums.LargTempletEnum;
import com.pcloud.book.group.vo.StatisticVO; import com.pcloud.book.group.vo.StatisticVO;
import com.pcloud.book.group.biz.GroupQrcodeBiz;
import com.pcloud.book.group.dao.AppClickRecordDao; import com.pcloud.book.group.dao.AppClickRecordDao;
import com.pcloud.book.group.dao.AppTouchRecordDao; import com.pcloud.book.group.dao.AppTouchRecordDao;
import com.pcloud.book.group.dao.BookGroupClassifyDao; import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookGroupDao; import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.vo.ClassifyAndGroupCountVO; import com.pcloud.book.group.vo.ClassifyAndGroupCountVO;
import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.vo.*; import com.pcloud.book.group.vo.*;
import com.pcloud.book.keywords.dao.BookKeywordDao; import com.pcloud.book.keywords.dao.BookKeywordDao;
import com.pcloud.book.keywords.enums.ReplyTypeEnum; import com.pcloud.book.keywords.enums.ReplyTypeEnum;
...@@ -56,11 +66,14 @@ import com.pcloud.common.page.PageBean; ...@@ -56,11 +66,14 @@ import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.*; import com.pcloud.common.utils.*;
import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.QrcodeUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.common.utils.export.excel.ExcelExportor;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.common.utils.zip.CompressUtils; import com.pcloud.common.utils.zip.CompressUtils;
import com.pcloud.facade.tradecenter.dto.GroupMoneyDto; import com.pcloud.facade.tradecenter.dto.*;
import com.pcloud.facade.tradecenter.dto.SpeWechatGroupDto;
import com.pcloud.facade.tradecenter.dto.WechatGroupDto;
import com.pcloud.labelcenter.label.service.LabelService; import com.pcloud.labelcenter.label.service.LabelService;
import com.pcloud.liveapp.live.dto.ProductIdSearchDto; import com.pcloud.liveapp.live.dto.ProductIdSearchDto;
import com.pcloud.liveapp.live.service.TimeTableService; import com.pcloud.liveapp.live.service.TimeTableService;
...@@ -72,8 +85,14 @@ import com.pcloud.resourcecenter.product.dto.UpdateAppProductParamDTO; ...@@ -72,8 +85,14 @@ import com.pcloud.resourcecenter.product.dto.UpdateAppProductParamDTO;
import com.pcloud.resourcecenter.product.entity.Product; import com.pcloud.resourcecenter.product.entity.Product;
import com.pcloud.resourcecenter.product.service.ProductService; import com.pcloud.resourcecenter.product.service.ProductService;
import com.pcloud.resourcecenter.store.constants.StoreCons; import com.pcloud.resourcecenter.store.constants.StoreCons;
import com.pcloud.settlementcenter.record.dto.GetGroupClassifyIncomeDTO;
import com.pcloud.settlementcenter.record.dto.GetGroupQrcodeIncomeDTO;
import com.pcloud.settlementcenter.record.dto.GroupRescourceIncomeParamDTO;
import com.pcloud.settlementcenter.record.dto.ProductStaticUnderAppMapDTO;
import com.pcloud.settlementcenter.record.service.SettlementService; import com.pcloud.settlementcenter.record.service.SettlementService;
import com.pcloud.videolesson.schedule.service.ScheduleService; import com.pcloud.videolesson.schedule.service.ScheduleService;
import com.pcloud.wechatgroup.group.dto.GroupMemberStatisDTO;
import com.pcloud.wechatgroup.group.service.GroupMemberService; import com.pcloud.wechatgroup.group.service.GroupMemberService;
import com.pcloud.wechatgroup.selfrobot.dto.SelfRobotDTO; import com.pcloud.wechatgroup.selfrobot.dto.SelfRobotDTO;
...@@ -94,10 +113,10 @@ import java.util.Date; ...@@ -94,10 +113,10 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.sun.tools.doclets.formats.html.markup.HtmlStyle.title;
/** /**
* Description 社群书群二维码业务逻辑层接口实现类 * Description 社群书群二维码业务逻辑层接口实现类
* Created by PENG on 2019/4/17. * Created by PENG on 2019/4/17.
...@@ -169,6 +188,11 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -169,6 +188,11 @@ public class BookGroupBizImpl implements BookGroupBiz {
private WechatGroupConsr wechatGroupConsr; private WechatGroupConsr wechatGroupConsr;
@Autowired @Autowired
private WeixinQrcodeDao weixinQrcodeDao; private WeixinQrcodeDao weixinQrcodeDao;
@Autowired
private BookConsr bookConsr;
@Autowired
private GroupQrcodeBiz groupQrcodeBiz;
@Override @Override
...@@ -268,9 +292,18 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -268,9 +292,18 @@ public class BookGroupBizImpl implements BookGroupBiz {
return null; return null;
} }
List<BookGroupDTO> list = bookGroupDao.getDTOByIds(bookGroupIds); List<BookGroupDTO> list = bookGroupDao.getDTOByIds(bookGroupIds);
List<Long> bookIds = list.stream().map(BookGroupDTO::getBookId).collect(Collectors.toList());
Map<Long, BookDto> mapByIds = bookDao.getMapByIds(bookIds);
if (ListUtils.isEmpty(list)) { if (ListUtils.isEmpty(list)) {
return null; return null;
} }
list.forEach(e ->{
if (!MapUtils.isEmpty(mapByIds) && mapByIds.get(e.getBookId()) != null){
e.setBookName(mapByIds.get(e.getBookId()).getBookName());
e.setIsbn(mapByIds.get(e.getBookId()).getIsbn());
e.setBookNumber("BK" + e.getBookId());
}
});
return list.stream().collect(Collectors.toMap(BookGroupDTO::getId, dto -> dto)); return list.stream().collect(Collectors.toMap(BookGroupDTO::getId, dto -> dto));
} }
...@@ -1142,6 +1175,7 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -1142,6 +1175,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
return bookGroupDao.getIsShowBookName(partyId); return bookGroupDao.getIsShowBookName(partyId);
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ParamLog("删除社群码") @ParamLog("删除社群码")
@Override @Override
...@@ -1386,7 +1420,7 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -1386,7 +1420,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
PageBeanNew<ListBook4ChannelVO> resultInfos = bookDao.listPageNew(pageParam, paramMap, "listBookGroup4Channel"); PageBeanNew<ListBook4ChannelVO> resultInfos = bookDao.listPageNew(pageParam, paramMap, "listBookGroup4Channel");
List<Long> bookGroupIds = resultInfos.getRecordList().stream().map(ListBook4ChannelVO::getBookGroupId).collect(Collectors.toList()); List<Long> bookGroupIds = resultInfos.getRecordList().stream().map(ListBook4ChannelVO::getBookGroupId).collect(Collectors.toList());
if(ListUtils.isEmpty(bookGroupIds)){ if(ListUtils.isEmpty(bookGroupIds)){
return new PageBeanNew(0, 0, 0, new ArrayList<>()); return new PageBeanNew(currentPage, numPerPage, 0, new ArrayList<>());
} }
Map<Long, BookGroupStatisticDTO> statisMap = bookGroupClassifyBiz.getBookGroupStatistic(bookGroupIds); Map<Long, BookGroupStatisticDTO> statisMap = bookGroupClassifyBiz.getBookGroupStatistic(bookGroupIds);
for (ListBook4ChannelVO listBook4ChannelVO : resultInfos.getRecordList()) { for (ListBook4ChannelVO listBook4ChannelVO : resultInfos.getRecordList()) {
...@@ -1444,4 +1478,420 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -1444,4 +1478,420 @@ public class BookGroupBizImpl implements BookGroupBiz {
} }
return new PageBeanNew<>(currentPage, numPerPage, resultInfos.getTotalCount(), results); return new PageBeanNew<>(currentPage, numPerPage, resultInfos.getTotalCount(), results);
} }
@Override
public BookGroupStatisticsDTO getBookGroupStatisByBookGroupId(Long bookGroupId) {
Map<Long, BookGroupStatisticDTO> bookGroupStatisticMap = bookGroupClassifyBiz.getBookGroupStatistic(Arrays.asList(bookGroupId));
BookGroupStatisticsDTO bookGroupStatisticsDTO = new BookGroupStatisticsDTO();
Long appCount = appTouchRecordDao.getCountByBokkGroupId(bookGroupId, "APP");
Long productCount = appTouchRecordDao.getCountByBokkGroupId(bookGroupId, "PRODUCT");
if (MapUtils.isEmpty(bookGroupStatisticMap)){
bookGroupStatisticsDTO.setClassifyCount(0L);
bookGroupStatisticsDTO.setGroupPersonNum(0L);
bookGroupStatisticsDTO.setWxGroupCount(0L);
bookGroupStatisticsDTO.setPromAppCount(appCount);
bookGroupStatisticsDTO.setPromProductCount(productCount);
return bookGroupStatisticsDTO;
}
bookGroupStatisticsDTO.setClassifyCount(bookGroupStatisticMap.get(bookGroupId).getClassifyCount().longValue());
bookGroupStatisticsDTO.setGroupPersonNum(bookGroupStatisticMap.get(bookGroupId).getUserNumber().longValue());
bookGroupStatisticsDTO.setWxGroupCount(bookGroupStatisticMap.get(bookGroupId).getGroupNumber().longValue());
bookGroupStatisticsDTO.setPromAppCount(appCount);
bookGroupStatisticsDTO.setPromProductCount(productCount);
return bookGroupStatisticsDTO;
}
@Override
public PageBeanNew<ResourcesStatisticVO> getGroupIncomeStatic(GroupIncomeStaticParamVO groupIncomeStaticParamVO, Long adviserId) {
Long bookGroupId = groupIncomeStaticParamVO.getBookGroupId();
Integer currentPage = groupIncomeStaticParamVO.getCurrentPage();
Integer numPerPage = groupIncomeStaticParamVO.getNumPerPage();
String type = groupIncomeStaticParamVO.getType();
Long classifyId = groupIncomeStaticParamVO.getClassifyId();
Long wxGroupId = groupIncomeStaticParamVO.getWxGroupId();
if (currentPage==null||currentPage<0||numPerPage==null||numPerPage<=0){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"分页参数错误!");
}
if (bookGroupId==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"社群码id不能为空!");
}
if (type==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"类型不能为空");
}
PageParam pageParam = new PageParam(currentPage, numPerPage);
Map<String, Object> map = new HashMap<>();
map.put("bookGroupId", bookGroupId);
map.put("type", type);
if (null != classifyId){
map.put("classifyId", classifyId);
}
if (null != wxGroupId){
map.put("qrcodeId", wxGroupId);
}
PageBeanNew<ResourcesStatisticVO> pageBeanNew = appClickRecordDao.listPageNew(pageParam, map, "getClickStatistics");
List<ResourcesStatisticVO> recordList = pageBeanNew.getRecordList();
if (ListUtils.isEmpty(recordList)){
return pageBeanNew;
}
//填充数据
setInfo(recordList,bookGroupId,classifyId,wxGroupId,type,adviserId);
return pageBeanNew;
}
void setInfo(List<ResourcesStatisticVO> recordList,Long bookGroupId,Long classifyId, Long qrcodeId, String type,Long partyId){
List<Long> rescourceIds = recordList.stream().map(ResourcesStatisticVO::getRescourceId).collect(Collectors.toList());
// map.put("rescourceIds",rescourceIds);
GroupRescourceIncomeParamDTO groupRescourceIncomeParamDTO = new GroupRescourceIncomeParamDTO();
groupRescourceIncomeParamDTO.setBookGroupId(bookGroupId);
groupRescourceIncomeParamDTO.setClassifyId(classifyId);
groupRescourceIncomeParamDTO.setQrcodeId(qrcodeId);
groupRescourceIncomeParamDTO.setType(type);
groupRescourceIncomeParamDTO.setRescourceIds(rescourceIds);
groupRescourceIncomeParamDTO.setRoleId(5L);
groupRescourceIncomeParamDTO.setPartyId(partyId);
Map<Long, BigDecimal> rescourceIncome = bookConsr.getRescourceIncome(groupRescourceIncomeParamDTO);
GroupIncomeSearchDto groupIncomeSearchDto = new GroupIncomeSearchDto();
groupIncomeSearchDto.setBookGroupId(bookGroupId);
groupIncomeSearchDto.setClassifyId(classifyId);
groupIncomeSearchDto.setIds(rescourceIds);
groupIncomeSearchDto.setQrcodeId(qrcodeId);
groupIncomeSearchDto.setTypeCode(type);
Map<Long, GroupMoneyDto> saleDetail4Group = tradeConsr.getSaleDetail4Group(groupIncomeSearchDto);
Map<Long, AppDto> appDtoMap;
Map<Long, ProductDto> productDtoMap;
if ("APP".equals(type)){
appDtoMap = appConsr.mapByIds(rescourceIds);
recordList.forEach(e ->{
if (!MapUtils.isEmpty(appDtoMap) && null != appDtoMap.get(e.getRescourceId())){
e.setRescourceName(appDtoMap.get(e.getRescourceId()).getTitle());
}
if (!MapUtils.isEmpty(saleDetail4Group) && null != saleDetail4Group.get(e.getRescourceId())){
e.setSaleCount(saleDetail4Group.get(e.getRescourceId()).getSaleCount());
e.setTotalSale(new BigDecimal(saleDetail4Group.get(e.getRescourceId()).getSaleMoney()));
}else {
e.setSaleCount(0L);
e.setTotalSale(BigDecimal.ZERO);
}
e.setType("APP");
if (null == rescourceIncome.get(e.getRescourceId())){
e.setTotalIncome(BigDecimal.ZERO);
}else {
e.setTotalIncome(rescourceIncome.get(e.getRescourceId()));
}
});
}else {
productDtoMap = productConsr.getProBasesByIds(rescourceIds);
recordList.forEach(e ->{
if (!MapUtils.isEmpty(productDtoMap) && null != productDtoMap.get(e.getRescourceId())){
e.setRescourceName(productDtoMap.get(e.getRescourceId()).getProductName());
}
e.setType("PRODUCT");
if (null == rescourceIncome.get(e.getRescourceId())){
e.setTotalIncome(BigDecimal.ZERO);
}else {
e.setTotalIncome(rescourceIncome.get(e.getRescourceId()));
}
if (!MapUtils.isEmpty(saleDetail4Group) && null != saleDetail4Group.get(e.getRescourceId())){
e.setSaleCount(saleDetail4Group.get(e.getRescourceId()).getSaleCount());
e.setTotalSale(new BigDecimal(saleDetail4Group.get(e.getRescourceId()).getSaleMoney()));
}else {
e.setSaleCount(0L);
e.setTotalSale(BigDecimal.ZERO);
}
});
}
}
@Override
public List<GroupScanTrendVO> getGroupScanTrend(GroupScanTrendParamVO groupScanTrendParamVO, Long adviserId) {
Integer dayNum = groupScanTrendParamVO.getDayNum();
if (dayNum == null) {
groupScanTrendParamVO.setDayNum(30);
dayNum = 30;
}
Date startDate = groupScanTrendParamVO.getStartDate();
Date endDate = groupScanTrendParamVO.getEndDate();
Long bookGroupId = groupScanTrendParamVO.getBookGroupId();
Long classifyId = groupScanTrendParamVO.getClassifyId();
Long wxGroupId = groupScanTrendParamVO.getWxGroupId();
List<Date> dateList = settlementConsr.getDateList(dayNum, startDate, endDate);
List<GroupScanTrendVO> groupScanTrendVOS = appClickRecordDao.getClickTrend(groupScanTrendParamVO);
List<Date> collect = groupScanTrendVOS.stream().map(GroupScanTrendVO::getDate).collect(Collectors.toList());
List<ClassifyPayDetailDto> groupBuyCount = tradeConsr.getGroupBuyCount(bookGroupId, classifyId, wxGroupId, startDate, endDate);
List<String> tradeDate = groupBuyCount.stream().map(ClassifyPayDetailDto::getDivideDate).collect(Collectors.toList());
if (dateList.size() > groupScanTrendVOS.size()) {
dateList.forEach(e -> {
if (!collect.contains(e)) {
GroupScanTrendVO groupScanTrendVO = new GroupScanTrendVO();
groupScanTrendVO.setDate(e);
groupScanTrendVO.setScanCount(0L);
groupScanTrendVOS.add(groupScanTrendVO);
}
});
}
if (ListUtils.isEmpty(groupBuyCount)){
groupScanTrendVOS.forEach( e -> e.setBuyCount(0L));
}else {
groupScanTrendVOS.forEach(e -> {
for (ClassifyPayDetailDto classifyPayDetailDto : groupBuyCount) {
if (DateUtils.formatDate(e.getDate()).equals(classifyPayDetailDto.getDivideDate())) {
e.setBuyCount(classifyPayDetailDto.getBuyCount());
} else {
e.setBuyCount(0L);
}
}
});
}
return groupScanTrendVOS;
}
@Override
public PageBeanNew<GroupStatisticVO> getClassifyStatistic(Long bookGroupId, Long adviserId, Integer currentPage, Integer numPerPage) {
PageParam pageParam = new PageParam(currentPage,numPerPage);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookGroupId",bookGroupId);
PageBeanNew<GroupStatisticVO> pageClassify = bookGroupClassifyDao.listPageNew(pageParam, paramMap, "pageClassify");
List<GroupStatisticVO> recordList = pageClassify.getRecordList();
if (ListUtils.isEmpty(recordList)){
return new PageBeanNew<>();
}
List<Long> classifyIds = recordList.stream().map(GroupStatisticVO::getClassifyId).collect(Collectors.toList());
if (ListUtils.isEmpty(classifyIds)){
return new PageBeanNew<>();
}
Map<Long, ClickClassifyDTO> longClickClassifyDTOMap = bookGroupClassifyDao.mapClickClassify(classifyIds);
GetGroupClassifyIncomeDTO getGroupClassifyIncomeDTO = new GetGroupClassifyIncomeDTO();
getGroupClassifyIncomeDTO.setClassifyIds(classifyIds);
getGroupClassifyIncomeDTO.setPartyId(adviserId);
getGroupClassifyIncomeDTO.setRoleId(5L);
Map<Long, BigDecimal> classifyIncome = bookConsr.getClassifyIncome(getGroupClassifyIncomeDTO);
Map<Long, Long> mapMemberCount = wechatGroupConsr.getclassifyMemberCount(classifyIds);
recordList.forEach(e ->{
if (longClickClassifyDTOMap.get(e.getClassifyId()) != null){
Long count = longClickClassifyDTOMap.get(e.getClassifyId()).getCount()==null?0L:longClickClassifyDTOMap.get(e.getClassifyId()).getCount();
e.setClickCount(count);
}
if (BigDecimal.ZERO.compareTo(e.getPrice()) ==0){
e.setIsFree(1);
}else {
e.setIsFree(0);
}
if (!MapUtils.isEmpty(classifyIncome)){
e.setIncome(classifyIncome.get(e.getClassifyId()));
}else {
e.setIncome(BigDecimal.ZERO);
}
if (!MapUtils.isEmpty(mapMemberCount)){
e.setInGroupPersonCount(mapMemberCount.get(e.getClassifyId()));
}else {
e.setInGroupPersonCount(0L);
}
});
return pageClassify;
}
@Override
public List<WxGroupStatisticVO> getQrcodeStatistic(Long bookGroupId, Long classifyId, Long adviserId) {
List<ClassifyQrcodeVO> qrcodeByClassify = groupQrcodeBiz.getQrcodeByClassify(bookGroupId, classifyId);
if (ListUtils.isEmpty(qrcodeByClassify)){
return new ArrayList<>();
}
List<Long> qrcodeIds = qrcodeByClassify.stream().map(ClassifyQrcodeVO::getId).collect(Collectors.toList());
List<String> wxGroupIds = qrcodeByClassify.stream().map(ClassifyQrcodeVO::getWeixinGroupId).collect(Collectors.toList());
GetGroupQrcodeIncomeDTO getGroupQrcodeIncomeDTO = new GetGroupQrcodeIncomeDTO();
getGroupQrcodeIncomeDTO.setRoleId(5L);
getGroupQrcodeIncomeDTO.setQrcodeIds(qrcodeIds);
getGroupQrcodeIncomeDTO.setPartyId(adviserId);
Map<Long, BigDecimal> qrcodeIncome = bookConsr.getQrcodeIncome(getGroupQrcodeIncomeDTO);
Map<String, GroupMemberStatisDTO> groupMemberStatisDTOMap = wechatGroupConsr.listGroupMemberStatisInfo(wxGroupIds);
List<WxGroupStatisticVO> wxGroupStatisticVOS = new ArrayList<>();
qrcodeByClassify.forEach(e ->{
WxGroupStatisticVO wxGroupStatisticVO = new WxGroupStatisticVO();
wxGroupStatisticVO.setCreatedTime(e.getCreatedTime());
wxGroupStatisticVO.setGroupPersonCount(e.getUserNumber().longValue());
if (MapUtils.isEmpty(qrcodeIncome)){
wxGroupStatisticVO.setIncome(BigDecimal.ZERO);
}else {
wxGroupStatisticVO.setIncome(qrcodeIncome.get(e.getId()));
}
if (MapUtils.isEmpty(groupMemberStatisDTOMap)){
wxGroupStatisticVO.setInGroupPersonCount(0L);
}else {
wxGroupStatisticVO.setInGroupPersonCount(groupMemberStatisDTOMap.get(e.getWeixinGroupId()).getJoinCount().longValue());
}
wxGroupStatisticVO.setQrcodeId(e.getId());
wxGroupStatisticVO.setWxGroupName(e.getGroupName());
wxGroupStatisticVOS.add(wxGroupStatisticVO);
});
return wxGroupStatisticVOS;
}
@Override
public TotalRescourceDataVO getTotalRescourceData(Long bookGroupId, Long adviserId, Long classifyId, Long qrcodeId, String type) {
TotalRescourceDataVO totalRescourceDataVO = new TotalRescourceDataVO();
List<Long> rescourceIds = appClickRecordDao.getRescourceIds(bookGroupId, classifyId, qrcodeId, type);
Long rescourceTotalClick = appClickRecordDao.getRescourceTotalClick(bookGroupId, classifyId, qrcodeId, type);
totalRescourceDataVO.setClickCount(rescourceTotalClick == null?0L:rescourceTotalClick);
GroupRescourceIncomeParamDTO groupRescourceIncomeParamDTO = new GroupRescourceIncomeParamDTO();
groupRescourceIncomeParamDTO.setBookGroupId(bookGroupId);
groupRescourceIncomeParamDTO.setClassifyId(classifyId);
groupRescourceIncomeParamDTO.setQrcodeId(qrcodeId);
groupRescourceIncomeParamDTO.setType(type);
groupRescourceIncomeParamDTO.setRescourceIds(rescourceIds);
groupRescourceIncomeParamDTO.setPartyId(adviserId);
groupRescourceIncomeParamDTO.setRoleId(5L);
BigDecimal rescourceTotalIncome = bookConsr.getRescourceTotalIncome(groupRescourceIncomeParamDTO);
totalRescourceDataVO.setTotalIncome(rescourceTotalIncome == null?BigDecimal.ZERO:rescourceTotalIncome);
BigDecimal totalSale = tradeConsr.getTotalSale(bookGroupId, classifyId, qrcodeId, type);
totalRescourceDataVO.setTotalSale(totalSale);
return totalRescourceDataVO;
}
@Override
public Map<String, String> exportRescourceIncomeData(Long bookGroupId, Long adviserId) {
List<StatisticsIncomeDto> appStatisticsIncomeDtos = new ArrayList<>();
List<StatisticsIncomeDto> productStatisticsIncomeDtos = new ArrayList<>();
List<ResourcesStatisticVO> appClickStatistics = appClickRecordDao.getClickStatistics(bookGroupId, null, null, "APP");
List<ResourcesStatisticVO> productClickStatistics = appClickRecordDao.getClickStatistics(bookGroupId, null, null, "PRODUCT");
if (!ListUtils.isEmpty(appClickStatistics)){
setInfo(appClickStatistics, bookGroupId, null, null, "APP", adviserId);
//获取挂在应用下的商品信息
ProductStaticUnderAppMapDTO productStaticUnderAppMapDTO = new ProductStaticUnderAppMapDTO();
productStaticUnderAppMapDTO.setBookGroupId(bookGroupId);
productStaticUnderAppMapDTO.setAppIds(appClickStatistics.stream().map(ResourcesStatisticVO::getRescourceId).collect(Collectors.toList()));
productStaticUnderAppMapDTO.setPartyId(adviserId);
productStaticUnderAppMapDTO.setRoleId(5L);
// Map<Long, List<com.pcloud.settlementcenter.record.dto.ResourcesStatisticVO>> productStaticUnderApp = settlementConsr.getProductStaticUnderApp(productStaticUnderAppMapDTO);
// Map<Long, List<StatisticsIncomeDto>> productStaticUnderAppMap = copy(productStaticUnderApp,bookGroupId);
appClickStatistics.forEach(e ->{
StatisticsIncomeDto statisticsIncomeDto = new StatisticsIncomeDto();
statisticsIncomeDto.setAppId(e.getRescourceId());
statisticsIncomeDto.setBookGroupId(bookGroupId);
statisticsIncomeDto.setIncome(e.getTotalIncome());
statisticsIncomeDto.setAppName(e.getRescourceName());
statisticsIncomeDto.setSaleCounts(e.getSaleCount().intValue());
statisticsIncomeDto.setSaleMoney(e.getTotalSale());
statisticsIncomeDto.setScanCounts(e.getBrowseCount().intValue());
// statisticsIncomeDto.setItemList(productStaticUnderAppMap.get(e.getRescourceId()));
appStatisticsIncomeDtos.add(statisticsIncomeDto);
});
}
if (!ListUtils.isEmpty(productClickStatistics)){
setInfo(productClickStatistics, bookGroupId, null, null, "PRODUCT", adviserId);
productClickStatistics.forEach(e ->{
StatisticsIncomeDto statisticsIncomeDto = new StatisticsIncomeDto();
statisticsIncomeDto.setProductId(e.getRescourceId());
statisticsIncomeDto.setBookGroupId(bookGroupId);
statisticsIncomeDto.setIncome(e.getTotalIncome());
statisticsIncomeDto.setProductName(e.getRescourceName());
statisticsIncomeDto.setSaleCounts(e.getSaleCount().intValue());
statisticsIncomeDto.setSaleMoney(e.getTotalSale());
statisticsIncomeDto.setScanCounts(e.getBrowseCount().intValue());
productStatisticsIncomeDtos.add(statisticsIncomeDto);
});
}
TotalRescourceDataVO appTotalRescourceData = getTotalRescourceData(bookGroupId, null, null, null, "APP");
StatisticsIncomeDto appSumStatistics = setResourceSumStatistics(appTotalRescourceData);
TotalRescourceDataVO productTotalRescourceData = getTotalRescourceData(bookGroupId, null, null, null, "PRODUCT");
StatisticsIncomeDto productSumStatistics = setResourceSumStatistics(productTotalRescourceData);
Map<String, Object> dataMap = new HashMap<>();
BookGroupDTO bookGroupDTO = bookGroupDao.getDTOById(bookGroupId);
if (bookGroupDTO == null){
bookGroupDTO = new BookGroupDTO();
}
String groupQrcodeName = bookGroupDTO.getGroupQrcodeName()== null?" ":bookGroupDTO.getGroupQrcodeName();
String title = "社群码" + groupQrcodeName + "的收益列表";
dataMap.put("appIncomeList", appStatisticsIncomeDtos);
dataMap.put("productIncomeList", productStatisticsIncomeDtos);
dataMap.put("title", title);
dataMap.put("appSumStatistics", appSumStatistics);
dataMap.put("productSumStatistics", productSumStatistics);
String today = DateUtils.formatDate(DateUtils.nowTimeStamp(), DateUtils.DATE_FORMAT_DATEONLY);
String fileName = title+ "-" + today;
String filePath = "";
try {
LOGGER.info("生成Excel【START】");
filePath = ExcelExportor.uploadExcel(this.getClass(), dataMap, "template_bookGroupStatistics.ftl");
LOGGER.info("生成Excel【END】" + filePath);
} catch (Exception e) {
LOGGER.error("生成Excel异常+++" + e.getMessage(), e);
throw new BookBizException(BookBizException.ERROR, "导出失败,请联系管理员");
}
Map<String, String> resultMap = new HashMap<>();
resultMap.put("fileName", fileName);
resultMap.put("fileUrl", filePath);
return resultMap;
}
private StatisticsIncomeDto setResourceSumStatistics(TotalRescourceDataVO totalRescourceDataVO){
if (totalRescourceDataVO == null){
return new StatisticsIncomeDto();
}
Long clickCount = totalRescourceDataVO.getClickCount();
BigDecimal totalIncome = totalRescourceDataVO.getTotalIncome();
BigDecimal totalSale = totalRescourceDataVO.getTotalSale();
StatisticsIncomeDto statisticsIncomeDto = new StatisticsIncomeDto();
statisticsIncomeDto.setScanCounts(clickCount.intValue());
statisticsIncomeDto.setIncome(totalIncome);
statisticsIncomeDto.setSaleMoney(totalSale);
return statisticsIncomeDto;
}
private Map<Long, List<StatisticsIncomeDto>> copy(Map<Long, List<com.pcloud.settlementcenter.record.dto.ResourcesStatisticVO>> productStaticUnderApp,Long bookGroupId){
Map<Long, List<StatisticsIncomeDto>> productStaticUnderAppMap = new HashMap<>();
if (MapUtils.isEmpty(productStaticUnderApp)){
return productStaticUnderAppMap;
}
List<StatisticsIncomeDto> productStatisticsIncomeDtos = new ArrayList<>();
productStaticUnderApp.forEach((k,v) ->{
v.forEach(e ->{
StatisticsIncomeDto statisticsIncomeDto = new StatisticsIncomeDto();
statisticsIncomeDto.setProductId(e.getRescourceId());
statisticsIncomeDto.setIncome(e.getTotalIncome());
statisticsIncomeDto.setProductName(e.getRescourceName());
statisticsIncomeDto.setSaleCounts(e.getSaleCount() == null ? 0 : e.getSaleCount().intValue());
statisticsIncomeDto.setSaleMoney(e.getTotalSale());
statisticsIncomeDto.setScanCounts(e.getBrowseCount() == null? 0 :e.getBrowseCount().intValue());
productStatisticsIncomeDtos.add(statisticsIncomeDto);
});
productStaticUnderAppMap.put(k,productStatisticsIncomeDtos);
});
return productStaticUnderAppMap;
}
@Override
public Map<Long, Long> getResourcesBrowseCount(ResourceBrowseParamDto resourceBrowseParamDto) {
Map<Long, Long> resultMap = new HashMap<>();
Long bookGroupId = resourceBrowseParamDto.getBookGroupId();
Long classifyId = resourceBrowseParamDto.getClassifyId();
Long qrcodeId = resourceBrowseParamDto.getQrcodeId();
String typeCode = resourceBrowseParamDto.getTypeCode();
List<Long> ids = resourceBrowseParamDto.getIds();
if (ListUtils.isEmpty(ids)){
return resultMap;
}
Map<String, Object> map = new HashMap<>();
map.put("bookGroupId", bookGroupId);
map.put("classifyId", classifyId);
map.put("qrcodeId", qrcodeId);
map.put("type", typeCode);
map.put("rescourceIds", ids);
Map<Long, ResourceClickVO> resourceClick = appClickRecordDao.getResourceClick(map);
if (MapUtils.isEmpty(resourceClick)){
return resultMap;
}
resourceClick.forEach((k,v) ->{
resultMap.put(k,v.getClickCount());
});
return resultMap;
}
} }
...@@ -21,20 +21,7 @@ import com.pcloud.book.group.dao.BookQrcodeUserDao; ...@@ -21,20 +21,7 @@ import com.pcloud.book.group.dao.BookQrcodeUserDao;
import com.pcloud.book.group.dao.JoinGroupCipherDao; import com.pcloud.book.group.dao.JoinGroupCipherDao;
import com.pcloud.book.group.dao.LearningReportBrowseRecordDao; import com.pcloud.book.group.dao.LearningReportBrowseRecordDao;
import com.pcloud.book.group.dao.LearningReportTouchRecordDao; import com.pcloud.book.group.dao.LearningReportTouchRecordDao;
import com.pcloud.book.group.dto.BookGroupDTO; import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.dto.BookGroupStatisticDTO;
import com.pcloud.book.group.dto.BookWxQrcodeDTO;
import com.pcloud.book.group.dto.ClassifyDTO;
import com.pcloud.book.group.dto.ClassifyLearningCountDto;
import com.pcloud.book.group.dto.ClassifyLearningReportDto;
import com.pcloud.book.group.dto.GroupAndUserNumberDTO;
import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import com.pcloud.book.group.dto.GroupNameAndMaxSeqDTO;
import com.pcloud.book.group.dto.GroupQrcodeBaseDTO;
import com.pcloud.book.group.dto.GroupQrcodeInfoDTO;
import com.pcloud.book.group.dto.ProAssocGroupAndUserNumberDTO;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.dto.WeixinQrcodeDTO;
import com.pcloud.book.group.entity.BookGroupClassify; import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.entity.BookQrcodeUser; import com.pcloud.book.group.entity.BookQrcodeUser;
import com.pcloud.book.group.entity.GroupQrcode; import com.pcloud.book.group.entity.GroupQrcode;
...@@ -194,10 +181,12 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -194,10 +181,12 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
log.info("[新增分类] : 可用微信群数量:{}个", wechatGroupNum); log.info("[新增分类] : 可用微信群数量:{}个", wechatGroupNum);
throw new BookBizException(BookBizException.PARAM_IS_NULL, "群二维码数量不足,您可以明天再创建群。"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "群二维码数量不足,您可以明天再创建群。");
} }
} }
Integer generation = null; Integer generation = null;
if (new Integer(2).equals(qrcodeNameAndProId.getJoinGroupType())) { if (new Integer(2).equals(qrcodeNameAndProId.getJoinGroupType())) {
generation = 3; generation = 3;
} }
WeixinQrcodeDTO oneQrcode = weixinQrcodeBiz.getOneQrcode(generation); WeixinQrcodeDTO oneQrcode = weixinQrcodeBiz.getOneQrcode(generation);
if (oneQrcode == null) { if (oneQrcode == null) {
...@@ -411,6 +400,22 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -411,6 +400,22 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
} }
@Override @Override
@ParamLog("根据主键id获取群分类")
public Map<Long, String> getClassifyByIds(List<Long> weixinGroupClassifyPrimaryIds) {
if (ListUtils.isEmpty(weixinGroupClassifyPrimaryIds)) {
return new HashMap<>();
}
List<BookGroupClassify> bookGroupClassifyList = bookGroupClassifyDao.getClassifyByIds(weixinGroupClassifyPrimaryIds);
Map<Long, String> classifyMap = new HashMap<>();
bookGroupClassifyList.stream().forEach(eachBookGroupClassify ->{
Long key = eachBookGroupClassify.getId();
String value = eachBookGroupClassify.getClassify();
classifyMap.put(key, value);
});
return classifyMap;
}
@Override
@ParamLog("根据规格获取分类基本信息(图书,运营,二维码,分类)") @ParamLog("根据规格获取分类基本信息(图书,运营,二维码,分类)")
public ClassifyDTO getBaseInfoBySpecId(Long productSpecId) { public ClassifyDTO getBaseInfoBySpecId(Long productSpecId) {
ClassifyDTO classifyDTO = bookGroupClassifyDao.getBaseInfoBySpecId(productSpecId); ClassifyDTO classifyDTO = bookGroupClassifyDao.getBaseInfoBySpecId(productSpecId);
...@@ -957,6 +962,15 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -957,6 +962,15 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
return pageBeanNew; return pageBeanNew;
} }
@Override
public Map<Long, BookClassifyDTO> getGroupClassifyCount(List<Long> bookIds) {
if (!ListUtils.isEmpty(bookIds)){
return bookGroupClassifyDao.getGroupClassifyCount(bookIds);
}else {
return new HashMap<>();
}
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ParamLog("更新是否开启微学习报告") @ParamLog("更新是否开启微学习报告")
@Override @Override
...@@ -1054,4 +1068,20 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -1054,4 +1068,20 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
bookGroupClassifyDao.dragSortClassify(classifyIds); bookGroupClassifyDao.dragSortClassify(classifyIds);
} }
@Override
public void clickClassify(Long wechatUserId, Long bookGroupId, Long classifyId) {
bookGroupClassifyDao.addClickClassify(wechatUserId,bookGroupId,classifyId);
}
@Override
public List<ListClassifyVO> getClassifyIngoreDelete(Long bookGroupId) {
List<ListClassifyVO> classifyVOS = bookGroupClassifyDao.getClassifyIngoreDelete(bookGroupId);
if (ListUtils.isEmpty(classifyVOS)){
return new ArrayList<>();
}
return classifyVOS;
}
} }
...@@ -142,7 +142,7 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz { ...@@ -142,7 +142,7 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
try{ try{
if (BookBusinessConstants.GROUP_NUM_DTO_MAP.size() < 1) { if (BookBusinessConstants.GROUP_NUM_DTO_MAP.size() < 1) {
try { try {
Thread.sleep(5000); Thread.sleep(10000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
log.error("[updateGroupNum] InterruptedException:{}", e); log.error("[updateGroupNum] InterruptedException:{}", e);
} }
...@@ -160,17 +160,24 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz { ...@@ -160,17 +160,24 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
Integer peopleCounts = WxGroupSDK.getPeopleCounts(value.getWxGroupId(), value.getRobotId(), value.getIp()); Integer peopleCounts = WxGroupSDK.getPeopleCounts(value.getWxGroupId(), value.getRobotId(), value.getIp());
if (null == peopleCounts || peopleCounts < 1) { if (null == peopleCounts || peopleCounts < 1) {
log.info("[更新群人数] null == peopleCounts || peopleCounts < 1 entry:{}; peopleCounts:{}", entry, peopleCounts); log.info("[更新群人数] null == peopleCounts || peopleCounts < 1 entry:{}; peopleCounts:{}", entry, peopleCounts);
// 若未获取到将其移除
BookBusinessConstants.GROUP_NUM_DTO_MAP.remove(entry.getKey());
continue; continue;
} }
log.info("[更新群人数] entry:{}, peopleCounts:{}", entry, peopleCounts); log.info("[更新群人数] entry:{}, peopleCounts:{}", entry, peopleCounts);
groupQrcodeDao.updateUserNumber(value.getWxGroupId(), peopleCounts); groupQrcodeDao.updateUserNumber(value.getWxGroupId(), peopleCounts);
BookBusinessConstants.GROUP_NUM_DTO_MAP.remove(entry.getKey()); BookBusinessConstants.GROUP_NUM_DTO_MAP.remove(entry.getKey());
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
log.error("[updateGroupNum] InterruptedException:{}", e);
}
} }
} catch (Exception e) { } catch (Exception e) {
log.error("[updateGroupNum] : Exception:{}", e); log.error("[updateGroupNum] : Exception:{}", e);
} }
try { try {
Thread.sleep(5000); Thread.sleep(10000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
log.error("[updateGroupNum] InterruptedException:{}", e); log.error("[updateGroupNum] InterruptedException:{}", e);
} }
...@@ -243,6 +250,15 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz { ...@@ -243,6 +250,15 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
return pageBeanNew; return pageBeanNew;
} }
@Override
public List<ClassifyQrcodeVO> getQrcodeByClassify(Long bookGroupId, Long classifyId) {
List<ClassifyQrcodeVO> qrcodeByClassify = groupQrcodeDao.getQrcodeByClassify(classifyId);
if (ListUtils.isEmpty(qrcodeByClassify)){
return new ArrayList<>();
}
return qrcodeByClassify;
}
@ParamLog(value = "设置关键词次数", isBefore = false) @ParamLog(value = "设置关键词次数", isBefore = false)
private void setKeywordCount(List<ClassifyQrcodeVO> classifyQrcodeVOS) { private void setKeywordCount(List<ClassifyQrcodeVO> classifyQrcodeVOS) {
if (ListUtils.isEmpty(classifyQrcodeVOS)) { if (ListUtils.isEmpty(classifyQrcodeVOS)) {
...@@ -328,6 +344,9 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz { ...@@ -328,6 +344,9 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
numDTO = new AutoUpdateGroupNumDTO(weixinGroupId, robotId, ip, new Date()); numDTO = new AutoUpdateGroupNumDTO(weixinGroupId, robotId, ip, new Date());
} else { } else {
numDTO.getNum().incrementAndGet(); numDTO.getNum().incrementAndGet();
numDTO.setRobotId(robotId);
numDTO.setIp(ip);
numDTO.setWxGroupId(weixinGroupId);
numDTO.setStartTime(new Date()); numDTO.setStartTime(new Date());
} }
BookBusinessConstants.GROUP_NUM_DTO_MAP.put(weixinGroupId, numDTO); BookBusinessConstants.GROUP_NUM_DTO_MAP.put(weixinGroupId, numDTO);
......
...@@ -3,9 +3,14 @@ package com.pcloud.book.group.dao; ...@@ -3,9 +3,14 @@ package com.pcloud.book.group.dao;
import com.pcloud.book.group.dto.AppClickDTO; import com.pcloud.book.group.dto.AppClickDTO;
import com.pcloud.book.group.dto.AppStatisticsDTO; import com.pcloud.book.group.dto.AppStatisticsDTO;
import com.pcloud.book.group.entity.AppClickRecord; import com.pcloud.book.group.entity.AppClickRecord;
import com.pcloud.book.group.vo.GroupScanTrendParamVO;
import com.pcloud.book.group.vo.GroupScanTrendVO;
import com.pcloud.book.group.vo.ResourceClickVO;
import com.pcloud.book.group.vo.ResourcesStatisticVO;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
import java.util.List; import java.util.List;
import java.util.Map;
public interface AppClickRecordDao extends BaseDao<AppClickRecord> { public interface AppClickRecordDao extends BaseDao<AppClickRecord> {
/** /**
...@@ -17,4 +22,29 @@ public interface AppClickRecordDao extends BaseDao<AppClickRecord> { ...@@ -17,4 +22,29 @@ public interface AppClickRecordDao extends BaseDao<AppClickRecord> {
* 获取最近点击 * 获取最近点击
*/ */
List<AppClickDTO> getRecentlyClick(Long wechatUserId, Long qrcodeId, Integer top); List<AppClickDTO> getRecentlyClick(Long wechatUserId, Long qrcodeId, Integer top);
/**
* 获取资源点击趋势
*/
List<GroupScanTrendVO> getClickTrend(GroupScanTrendParamVO groupScanTrendParamVO);
/**
* 获取资源点击次数
*/
Map<Long, ResourceClickVO> getResourceClick(Map<String,Object> map);
/**
* 获取资源点击总数
*/
Long getRescourceTotalClick(Long bookGroupId,Long classifyId,Long qrcodeId,String type);
/**
* 获取资源id
*/
List<Long> getRescourceIds(Long bookGroupId,Long classifyId,Long qrcodeId,String type);
/**
* 获取资源点击数
*/
List<ResourcesStatisticVO> getClickStatistics(Long bookGroupId,Long classifyId,Long qrcodeId,String type);
} }
...@@ -4,4 +4,6 @@ import com.pcloud.book.group.entity.AppTouchRecord; ...@@ -4,4 +4,6 @@ import com.pcloud.book.group.entity.AppTouchRecord;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
public interface AppTouchRecordDao extends BaseDao<AppTouchRecord> { public interface AppTouchRecordDao extends BaseDao<AppTouchRecord> {
Long getCountByBokkGroupId(Long bookGroupId, String type);
} }
...@@ -62,6 +62,14 @@ public interface BookGroupClassifyDao extends BaseDao<BookGroupClassify> { ...@@ -62,6 +62,14 @@ public interface BookGroupClassifyDao extends BaseDao<BookGroupClassify> {
Integer getClassifyCount(Long bookGroupId); Integer getClassifyCount(Long bookGroupId);
/** /**
* 据id获取微信分类
* @param weixinGroupClassifyPrimaryIds
* @return
*/
List<BookGroupClassify> getClassifyByIds(List<Long> weixinGroupClassifyPrimaryIds);
/**
* @Author:lili * @Author:lili
* @Desr:获取所有分类列表 * @Desr:获取所有分类列表
* @Date:2019/4/18 19:46 * @Date:2019/4/18 19:46
...@@ -233,6 +241,8 @@ public interface BookGroupClassifyDao extends BaseDao<BookGroupClassify> { ...@@ -233,6 +241,8 @@ public interface BookGroupClassifyDao extends BaseDao<BookGroupClassify> {
* @return * @return
*/ */
List<ClassifyKeywordDTO> getClassifyStatistics(Long bookId); List<ClassifyKeywordDTO> getClassifyStatistics(Long bookId);
Map<Long,BookClassifyDTO> getGroupClassifyCount(List<Long> bookIds);
GroupClassifyQrcodeDTO getClassifyQrcodeInfoByName(String weixinGroupName); GroupClassifyQrcodeDTO getClassifyQrcodeInfoByName(String weixinGroupName);
...@@ -241,8 +251,16 @@ public interface BookGroupClassifyDao extends BaseDao<BookGroupClassify> { ...@@ -241,8 +251,16 @@ public interface BookGroupClassifyDao extends BaseDao<BookGroupClassify> {
*/ */
void updateHasOpenLearningReport(Long classifyId, Boolean hasOpenLearningReport, Long partyId); void updateHasOpenLearningReport(Long classifyId, Boolean hasOpenLearningReport, Long partyId);
/** /**
* 拖动排序 * 拖动排序
*/ */
void dragSortClassify(List<Long> classifyIds); void dragSortClassify(List<Long> classifyIds);
void addClickClassify(Long wechatUserId, Long bookGroupId, Long classifyId);
Map<Long, ClickClassifyDTO> mapClickClassify(List<Long> classifyIds);
List<ListClassifyVO> getClassifyIngoreDelete(Long bookGroupId);
} }
...@@ -3,6 +3,7 @@ package com.pcloud.book.group.dao; ...@@ -3,6 +3,7 @@ package com.pcloud.book.group.dao;
import com.pcloud.book.advertising.dto.WeixinClassifyInfoDTO; import com.pcloud.book.advertising.dto.WeixinClassifyInfoDTO;
import com.pcloud.book.group.dto.*; import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.entity.GroupQrcode; import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.vo.ClassifyQrcodeVO;
import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO; import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO;
import com.pcloud.book.group.vo.ListGroupQrcodeResponseVO; import com.pcloud.book.group.vo.ListGroupQrcodeResponseVO;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
...@@ -204,4 +205,9 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> { ...@@ -204,4 +205,9 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> {
*/ */
void updateRiddleOpenStatus(Long qrcodeId, Boolean status); void updateRiddleOpenStatus(Long qrcodeId, Boolean status);
/**
* 根据分类id获取分类下的群---不分页
*/
List<ClassifyQrcodeVO> getQrcodeByClassify(Long classifyId);
} }
...@@ -4,6 +4,10 @@ import com.pcloud.book.group.dao.AppClickRecordDao; ...@@ -4,6 +4,10 @@ import com.pcloud.book.group.dao.AppClickRecordDao;
import com.pcloud.book.group.dto.AppClickDTO; import com.pcloud.book.group.dto.AppClickDTO;
import com.pcloud.book.group.dto.AppStatisticsDTO; import com.pcloud.book.group.dto.AppStatisticsDTO;
import com.pcloud.book.group.entity.AppClickRecord; import com.pcloud.book.group.entity.AppClickRecord;
import com.pcloud.book.group.vo.GroupScanTrendParamVO;
import com.pcloud.book.group.vo.GroupScanTrendVO;
import com.pcloud.book.group.vo.ResourceClickVO;
import com.pcloud.book.group.vo.ResourcesStatisticVO;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -35,4 +39,44 @@ public class AppClickRecordDaoImpl extends BaseDaoImpl<AppClickRecord> implement ...@@ -35,4 +39,44 @@ public class AppClickRecordDaoImpl extends BaseDaoImpl<AppClickRecord> implement
map.put("top", top); map.put("top", top);
return this.getSqlSession().selectList(this.getStatement("getRecentlyClick"), map); return this.getSqlSession().selectList(this.getStatement("getRecentlyClick"), map);
} }
@Override
public List<GroupScanTrendVO> getClickTrend(GroupScanTrendParamVO groupScanTrendParamVO) {
return this.getSqlSession().selectList(this.getStatement("getClickTrend"), groupScanTrendParamVO);
}
@Override
public Map<Long, ResourceClickVO> getResourceClick(Map<String, Object> map) {
return this.getSqlSession().selectMap(this.getStatement("getResourceClick"), map,"rescourceId");
}
@Override
public Long getRescourceTotalClick(Long bookGroupId, Long classifyId, Long qrcodeId, String type) {
Map<String, Object> map = new HashMap<>();
map.put("qrcodeId", qrcodeId);
map.put("bookGroupId", bookGroupId);
map.put("classifyId", classifyId);
map.put("type", type);
return this.getSqlSession().selectOne(this.getStatement("getRescourceTotalClick"), map);
}
@Override
public List<Long> getRescourceIds(Long bookGroupId, Long classifyId, Long qrcodeId, String type) {
Map<String, Object> map = new HashMap<>();
map.put("qrcodeId", qrcodeId);
map.put("bookGroupId", bookGroupId);
map.put("classifyId", classifyId);
map.put("type", type);
return this.getSqlSession().selectList(this.getStatement("getRescourceIds"), map);
}
@Override
public List<ResourcesStatisticVO> getClickStatistics(Long bookGroupId, Long classifyId, Long qrcodeId, String type) {
Map<String, Object> map = new HashMap<>();
map.put("qrcodeId", qrcodeId);
map.put("bookGroupId", bookGroupId);
map.put("classifyId", classifyId);
map.put("type", type);
return this.getSqlSession().selectList(this.getStatement("getClickStatistics"), map);
}
} }
...@@ -5,6 +5,9 @@ import com.pcloud.book.group.entity.AppTouchRecord; ...@@ -5,6 +5,9 @@ import com.pcloud.book.group.entity.AppTouchRecord;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/** /**
* @Description * @Description
* @Author ruansiyuan * @Author ruansiyuan
...@@ -12,4 +15,13 @@ import org.springframework.stereotype.Component; ...@@ -12,4 +15,13 @@ import org.springframework.stereotype.Component;
**/ **/
@Component("appTouchRecordDao") @Component("appTouchRecordDao")
public class AppTouchRecordDaoImpl extends BaseDaoImpl<AppTouchRecord> implements AppTouchRecordDao { public class AppTouchRecordDaoImpl extends BaseDaoImpl<AppTouchRecord> implements AppTouchRecordDao {
@Override
public Long getCountByBokkGroupId(Long bookGroupId, String type) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupId",bookGroupId);
map.put("type",type);
return this.getSqlSession().selectOne(this.getStatement("getCountByBokkGroupId"), map);
}
} }
...@@ -65,6 +65,10 @@ public class BookGroupClassifyDaoImpl extends BaseDaoImpl<BookGroupClassify> imp ...@@ -65,6 +65,10 @@ public class BookGroupClassifyDaoImpl extends BaseDaoImpl<BookGroupClassify> imp
} }
@Override @Override
public List<BookGroupClassify> getClassifyByIds(List<Long> weixinGroupClassifyPrimaryIds) {
return this.getSqlSession().selectList(this.getStatement("getClassifyByIds"), weixinGroupClassifyPrimaryIds);
}
@Override
public List<ListClassifyVO> listAllClassifyByRank(Long bookGroupId) { public List<ListClassifyVO> listAllClassifyByRank(Long bookGroupId) {
return this.getSqlSession().selectList(this.getStatement("listAllClassifyByRank"), bookGroupId); return this.getSqlSession().selectList(this.getStatement("listAllClassifyByRank"), bookGroupId);
} }
...@@ -197,6 +201,11 @@ public class BookGroupClassifyDaoImpl extends BaseDaoImpl<BookGroupClassify> imp ...@@ -197,6 +201,11 @@ public class BookGroupClassifyDaoImpl extends BaseDaoImpl<BookGroupClassify> imp
public List<ClassifyKeywordDTO> getClassifyStatistics(Long bookId) { public List<ClassifyKeywordDTO> getClassifyStatistics(Long bookId) {
return this.getSqlSession().selectList(this.getStatement("getClassifyStatistics"), bookId); return this.getSqlSession().selectList(this.getStatement("getClassifyStatistics"), bookId);
} }
@Override
public Map<Long, BookClassifyDTO> getGroupClassifyCount(List<Long> bookIds) {
return this.getSessionTemplate().selectMap(getStatement("getGroupClassifyCount"), bookIds,"bookId");
}
@Override @Override
public GroupClassifyQrcodeDTO getClassifyQrcodeInfoByName(String weixinGroupName) { public GroupClassifyQrcodeDTO getClassifyQrcodeInfoByName(String weixinGroupName) {
...@@ -218,4 +227,25 @@ public class BookGroupClassifyDaoImpl extends BaseDaoImpl<BookGroupClassify> imp ...@@ -218,4 +227,25 @@ public class BookGroupClassifyDaoImpl extends BaseDaoImpl<BookGroupClassify> imp
paramMap.put("classifyIds", classifyIds); paramMap.put("classifyIds", classifyIds);
this.getSqlSession().update(this.getStatement("dragSortClassify"), paramMap); this.getSqlSession().update(this.getStatement("dragSortClassify"), paramMap);
} }
@Override
public void addClickClassify(Long wechatUserId, Long bookGroupId, Long classifyId) {
Map<String, Object> paramMap = new HashMap();
paramMap.put("classifyId", classifyId);
paramMap.put("wechatUserId", wechatUserId);
paramMap.put("bookGroupId", bookGroupId);
this.getSqlSession().insert(this.getStatement("addClickClassify"), paramMap);
}
@Override
public Map<Long, ClickClassifyDTO> mapClickClassify(List<Long> classifyIds) {
Map<String, Object> paramMap = new HashMap();
paramMap.put("classifyIds", classifyIds);
return this.getSqlSession().selectMap(this.getStatement("mapClickClassify"), paramMap,"classifyId");
}
@Override
public List<ListClassifyVO> getClassifyIngoreDelete(Long bookGroupId) {
return this.getSqlSession().selectList(this.getStatement("getClassifyIngoreDelete"), bookGroupId);
}
} }
...@@ -6,6 +6,7 @@ import com.pcloud.book.advertising.dto.WeixinClassifyInfoDTO; ...@@ -6,6 +6,7 @@ import com.pcloud.book.advertising.dto.WeixinClassifyInfoDTO;
import com.pcloud.book.group.dao.GroupQrcodeDao; import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dto.*; import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.entity.GroupQrcode; import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.vo.ClassifyQrcodeVO;
import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO; import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO;
import com.pcloud.book.group.vo.ListGroupQrcodeResponseVO; import com.pcloud.book.group.vo.ListGroupQrcodeResponseVO;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
...@@ -197,4 +198,9 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou ...@@ -197,4 +198,9 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou
getSessionTemplate().update(getStatement("updateRiddleOpenStatus"), map); getSessionTemplate().update(getStatement("updateRiddleOpenStatus"), map);
} }
public List<ClassifyQrcodeVO> getQrcodeByClassify(Long classifyId) {
return this.getSqlSession().selectList(this.getStatement("getQrcodeByClassify"), classifyId);
}
} }
...@@ -133,6 +133,11 @@ public class BookGroupDTO extends BaseDto { ...@@ -133,6 +133,11 @@ public class BookGroupDTO extends BaseDto {
private String bookName; private String bookName;
/**
* 编号
*/
private String bookNumber;
private String url; private String url;
private Long bookClockInfoId; private Long bookClockInfoId;
...@@ -364,6 +369,7 @@ public class BookGroupDTO extends BaseDto { ...@@ -364,6 +369,7 @@ public class BookGroupDTO extends BaseDto {
this.isShowBookName = isShowBookName; this.isShowBookName = isShowBookName;
} }
public Integer getJoinGroupType() { public Integer getJoinGroupType() {
return joinGroupType; return joinGroupType;
} }
...@@ -372,6 +378,14 @@ public class BookGroupDTO extends BaseDto { ...@@ -372,6 +378,14 @@ public class BookGroupDTO extends BaseDto {
this.joinGroupType = joinGroupType; this.joinGroupType = joinGroupType;
} }
public String getBookNumber() {
return bookNumber;
}
public void setBookNumber(String bookNumber) {
this.bookNumber = bookNumber;
}
@Override @Override
public String toString() { public String toString() {
return "BookGroupDTO{" + return "BookGroupDTO{" +
...@@ -399,10 +413,13 @@ public class BookGroupDTO extends BaseDto { ...@@ -399,10 +413,13 @@ public class BookGroupDTO extends BaseDto {
", bookImg='" + bookImg + '\'' + ", bookImg='" + bookImg + '\'' +
", isbn='" + isbn + '\'' + ", isbn='" + isbn + '\'' +
", bookName='" + bookName + '\'' + ", bookName='" + bookName + '\'' +
", bookNumber='" + bookNumber + '\'' +
", url='" + url + '\'' + ", url='" + url + '\'' +
", bookClockInfoId=" + bookClockInfoId + ", bookClockInfoId=" + bookClockInfoId +
", isShowBookName=" + isShowBookName + ", isShowBookName=" + isShowBookName +
", joinGroupType=" + joinGroupType + ", joinGroupType=" + joinGroupType +
"} " + super.toString(); "} " + super.toString();
} }
} }
\ No newline at end of file
package com.pcloud.book.group.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* @author 戴兴
* @description TODO
* @date 2019/8/22 21:49
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ClickClassifyDTO implements Serializable {
@ApiModelProperty("社群码标识")
private Long bookGroupId;
@ApiModelProperty("分类标识")
private Long classifyId;
@ApiModelProperty("点击次数")
private Long count;
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
@Override
public String toString() {
return "ClickClassifyDTO{" +
"bookGroupId=" + bookGroupId +
", classifyId=" + classifyId +
", count=" + count +
'}';
}
}
\ No newline at end of file
package com.pcloud.book.group.dto;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* @author 戴兴
* @description TODO
* @date 2019/8/8 21:39
*/
public class StatisticsIncomeDto implements Serializable {
/**
*
*/
private static final long serialVersionUID = 4695716936925368521L;
/**
* 应用标识
*/
private Long appId;
/**
* 书刊标识
*/
private Long bookGroupId;
/**
* 应用名称
*/
private String appName;
/**
* 浏览量
*/
private Integer scanCounts;
/**
* 销售量
*/
private Integer saleCounts;
/**
* 销售额
*/
private BigDecimal saleMoney;
/**
* 收益额
*/
private BigDecimal income;
/**
* 商品标识
*/
private Long productId;
/**
* 商品名称
*/
private String productName;
/**
* 收益时间
*/
private String dateTime;
/**
* 子项
*/
private List<StatisticsIncomeDto> itemList;
public Long getAppId() {
return appId;
}
public void setAppId(Long appId) {
this.appId = appId;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public Integer getScanCounts() {
return scanCounts;
}
public void setScanCounts(Integer scanCounts) {
this.scanCounts = scanCounts;
}
public Integer getSaleCounts() {
return saleCounts;
}
public void setSaleCounts(Integer saleCounts) {
this.saleCounts = saleCounts;
}
public BigDecimal getSaleMoney() {
return saleMoney;
}
public void setSaleMoney(BigDecimal saleMoney) {
this.saleMoney = saleMoney;
}
public BigDecimal getIncome() {
return income;
}
public void setIncome(BigDecimal income) {
this.income = income;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getDateTime() {
return dateTime;
}
public void setDateTime(String dateTime) {
this.dateTime = dateTime;
}
public List<StatisticsIncomeDto> getItemList() {
return itemList;
}
public void setItemList(List<StatisticsIncomeDto> itemList) {
this.itemList = itemList;
}
@Override
public String toString() {
return "StatisticsIncomeDto{" +
"appId=" + appId +
", bookGroupId=" + bookGroupId +
", appName='" + appName + '\'' +
", scanCounts=" + scanCounts +
", saleCounts=" + saleCounts +
", saleMoney=" + saleMoney +
", income=" + income +
", productId=" + productId +
", productName='" + productName + '\'' +
", dateTime='" + dateTime + '\'' +
", itemList=" + itemList +
'}';
}
}
\ No newline at end of file
...@@ -172,6 +172,7 @@ public interface BookGroupClassifyFacade { ...@@ -172,6 +172,7 @@ public interface BookGroupClassifyFacade {
@RequestParam(value = "keyword", required = false) @ApiParam("关键词") String keyword @RequestParam(value = "keyword", required = false) @ApiParam("关键词") String keyword
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@ApiOperation("拖动排序") @ApiOperation("拖动排序")
@PostMapping("dragSortClassify") @PostMapping("dragSortClassify")
ResponseDto<?> dragSortClassify( ResponseDto<?> dragSortClassify(
...@@ -179,4 +180,20 @@ public interface BookGroupClassifyFacade { ...@@ -179,4 +180,20 @@ public interface BookGroupClassifyFacade {
@RequestBody List<Long> classifyIds @RequestBody List<Long> classifyIds
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@ApiOperation("埋点记录点击分类次数")
@GetMapping("clickClassify")
ResponseDto<?> clickClassify(
@CookieValue("userinfo") @ApiParam("cookie信息") String userInfo,
@RequestParam("bookGroupId") @ApiParam("社群码id") Long bookGroupId,
@RequestParam("classifyId") @ApiParam("群分类id") Long classifyId) throws BizException, PermissionException;
@ApiOperation("获取所有群分类包括已删除的")
@GetMapping("getClassifyIngoreDelete")
ResponseDto<?> getClassifyIngoreDelete(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("bookGroupId") @ApiParam("社群码id") Long bookGroupId) throws BizException, PermissionException;
} }
package com.pcloud.book.group.facade; package com.pcloud.book.group.facade;
import com.pcloud.book.group.entity.BookGroupClassify; import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.vo.*;
import com.pcloud.common.page.PageBeanNew;
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.*;
...@@ -24,6 +26,8 @@ import io.swagger.annotations.ApiImplicitParam; ...@@ -24,6 +26,8 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import java.util.List;
/** /**
* Description 社群书群二维码接口 * Description 社群书群二维码接口
* Created by PENG on 2019/4/17. * Created by PENG on 2019/4/17.
...@@ -276,6 +280,7 @@ public interface BookGroupFacade { ...@@ -276,6 +280,7 @@ public interface BookGroupFacade {
@RequestHeader("token") String token @RequestHeader("token") String token
) throws BizException, PermissionException, JsonParseException; ) throws BizException, PermissionException, JsonParseException;
@ApiOperation("删除社群码") @ApiOperation("删除社群码")
@GetMapping("deleteBookGroup") @GetMapping("deleteBookGroup")
ResponseDto<?> deleteBookGroup( ResponseDto<?> deleteBookGroup(
...@@ -295,4 +300,70 @@ public interface BookGroupFacade { ...@@ -295,4 +300,70 @@ public interface BookGroupFacade {
ResponseDto<?> getAllLargeTemplet( ResponseDto<?> getAllLargeTemplet(
@RequestHeader("token") String token @RequestHeader("token") String token
) throws BizException, PermissionException, JsonParseException; ) throws BizException, PermissionException, JsonParseException;
@ApiOperation("获取社群书数据")
@RequestMapping(value = "getBookGroupStatisByBookGroupId",method = RequestMethod.GET)
ResponseDto<?> getBookGroupStatisByBookGroupId(@RequestParam("bookGroupId")Long bookGroupId) throws BizException;
@ApiOperation(value = "收益统计--pc", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "groupIncomeStaticParamVO", value = "GroupIncomeStaticParamVO", required = true, dataType = "GroupIncomeStaticParamVO", paramType = "body")
})
@RequestMapping(value ="getGroupIncomeStatic",method = RequestMethod.POST)
public ResponseDto<PageBeanNew<ResourcesStatisticVO>> getGroupIncomeStatic(@RequestHeader("token") String token,
@RequestBody GroupIncomeStaticParamVO groupIncomeStaticParamVO) throws BizException, PermissionException;
@ApiOperation(value = "社群码浏览趋势图--pc", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "groupScanTrendParamVO", value = "GroupScanTrendParamVO", required = true, dataType = "GroupScanTrendParamVO", paramType = "body")
})
@RequestMapping(value ="getGroupScanTrend",method = RequestMethod.POST)
public ResponseDto<List<GroupScanTrendVO>> getGroupScanTrend(@RequestHeader("token") String token,
@RequestBody GroupScanTrendParamVO groupScanTrendParamVO) throws BizException, PermissionException;
@ApiOperation(value = "社群码分类统计--pc", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "bookGroupId", value = "bookGroupId", required = true, dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "currentPage", required = true, dataType = "Integer", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "numPerPage", required = true, dataType = "Integer", paramType = "query")
})
@RequestMapping(value ="getClassifyStatistic",method = RequestMethod.GET)
public ResponseDto<?> getClassifyStatistic(@RequestHeader("token") String token,
@RequestParam(value = "bookGroupId",required = true) Long bookGroupId,
@RequestParam(value = "currentPage",required = true) Integer currentPage,
@RequestParam(value = "numPerPage",required = true) Integer numPerPage) throws BizException, PermissionException;
@ApiOperation(value = "社群码分类下的微信群统计--pc", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "bookGroupId", value = "bookGroupId", required = true, dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "classifyId", value = "classifyId", required = true, dataType = "Long", paramType = "query")
})
@RequestMapping(value ="getQrcodeStatistic",method = RequestMethod.GET)
public ResponseDto<?> getQrcodeStatistic(@RequestHeader("token") String token,
@RequestParam(value = "bookGroupId",required = true) Long bookGroupId,
@RequestParam("classifyId") Long classifyId) throws BizException, PermissionException;
@ApiOperation(value = "资源数据统计--pc", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "bookGroupId", value = "bookGroupId", required = true, dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "classifyId",value = "classifyId",required = false,dataType = "Long",paramType = "query"),
@ApiImplicitParam(name = "qrcodeId",value = "qrcodeId",required = false,dataType = "Long",paramType = "query"),
@ApiImplicitParam(name = "type",value = "type",required = true,dataType = "String",paramType = "query")
})
@RequestMapping(value ="getTotalRescourceData",method = RequestMethod.GET)
public ResponseDto<?> getTotalRescourceData(@RequestHeader("token") String token, @RequestParam(value = "bookGroupId",required = true) Long bookGroupId,
@RequestParam(value = "classifyId",required = false) Long classifyId, @RequestParam(value = "qrcodeId",required = false) Long qrcodeId,
@RequestParam("type") String type) throws BizException, PermissionException;
@ApiOperation(value = "社群码资源收益数据导出--pc", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "bookGroupId", value = "bookGroupId", required = true, dataType = "Long", paramType = "query")
})
@RequestMapping(value ="exportRescourceIncomeData",method = RequestMethod.GET)
public ResponseDto<?> exportRescourceIncomeData(@RequestHeader("token") String token,
@RequestParam(value = "bookGroupId",required = true) Long bookGroupId) throws BizException, PermissionException;
} }
...@@ -35,6 +35,15 @@ public interface GroupQrcodeFacade { ...@@ -35,6 +35,15 @@ public interface GroupQrcodeFacade {
@RequestMapping(value = "listQrcodeByClassify", method = RequestMethod.POST) @RequestMapping(value = "listQrcodeByClassify", method = RequestMethod.POST)
ResponseDto<PageBeanNew> listQrcodeByClassify(@RequestHeader("token") String token, @RequestBody ListQrcodeByClassifyParamVO listQrcodeByClassifyParamVO) throws PermissionException; ResponseDto<PageBeanNew> listQrcodeByClassify(@RequestHeader("token") String token, @RequestBody ListQrcodeByClassifyParamVO listQrcodeByClassifyParamVO) throws PermissionException;
@ApiOperation(value = "根据分类获取分类下二维码----不分页", httpMethod = "GET")
@ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "bookGroupId", value = "bookGroupId", dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "classifyId", value = "classifyId", dataType = "Long", paramType = "query")
})
@RequestMapping(value = "getQrcodeByClassify", method = RequestMethod.GET)
ResponseDto<?> getQrcodeByClassify(@RequestHeader("token") String token, @RequestParam("bookGroupId") Long bookGroupId,
@RequestParam("classifyId") Long classifyId) throws PermissionException;
@ApiOperation(value = "修改微信群名称", httpMethod = "POST") @ApiOperation(value = "修改微信群名称", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"), @ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"),
......
...@@ -184,6 +184,7 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade { ...@@ -184,6 +184,7 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade {
return new ResponseDto<>(bookGroupClassifyBiz.listClassifyForLearningReport(currentPage,numPerPage,keyword,partyId)); return new ResponseDto<>(bookGroupClassifyBiz.listClassifyForLearningReport(currentPage,numPerPage,keyword,partyId));
} }
@ApiOperation("拖动排序") @ApiOperation("拖动排序")
@PostMapping("dragSortClassify") @PostMapping("dragSortClassify")
@Override @Override
...@@ -196,4 +197,23 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade { ...@@ -196,4 +197,23 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade {
return new ResponseDto<>(); return new ResponseDto<>();
} }
@Override
@GetMapping("clickClassify")
public ResponseDto<?> clickClassify(@CookieValue("userInfo") String userInfo, @RequestParam("bookGroupId") Long bookGroupId,
@RequestParam("classifyId") Long classifyId) throws BizException, PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
bookGroupClassifyBiz.clickClassify(wechatUserId,bookGroupId,classifyId);
return new ResponseDto<>();
}
@Override
@GetMapping("getClassifyIngoreDelete")
public ResponseDto<?> getClassifyIngoreDelete(@RequestHeader("token") String token, @RequestParam("bookGroupId") Long bookGroupId) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
List<ListClassifyVO> classifyVOS = bookGroupClassifyBiz.getClassifyIngoreDelete(bookGroupId);
return new ResponseDto<>(classifyVOS);
}
} }
...@@ -17,7 +17,6 @@ import com.pcloud.common.permission.PermissionException; ...@@ -17,7 +17,6 @@ import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil; import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie; import com.pcloud.common.utils.cookie.Cookie;
import com.pcloud.common.utils.string.StringUtil; 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.*;
...@@ -32,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -32,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -397,6 +397,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade { ...@@ -397,6 +397,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
return new ResponseDto<>(bookGroupBiz.getIsShowBookName(partyId)); return new ResponseDto<>(bookGroupBiz.getIsShowBookName(partyId));
} }
@ApiOperation("删除社群码") @ApiOperation("删除社群码")
@GetMapping("deleteBookGroup") @GetMapping("deleteBookGroup")
@Override @Override
...@@ -433,4 +434,75 @@ public class BookGroupFacadeImpl implements BookGroupFacade { ...@@ -433,4 +434,75 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
return new ResponseDto<>(bookGroupBiz.getAllLargTemplet()); return new ResponseDto<>(bookGroupBiz.getAllLargTemplet());
} }
@Override
@RequestMapping(value = "getBookGroupStatisByBookGroupId",method = RequestMethod.GET)
public ResponseDto<?> getBookGroupStatisByBookGroupId(@RequestParam("bookGroupId")Long bookGroupId) throws BizException {
return new ResponseDto<>(bookGroupBiz.getBookGroupStatisByBookGroupId(bookGroupId));
}
@Override
@RequestMapping(value ="getGroupIncomeStatic",method = RequestMethod.POST)
public ResponseDto<PageBeanNew<ResourcesStatisticVO>> getGroupIncomeStatic(@RequestHeader("token") String token,
@RequestBody GroupIncomeStaticParamVO groupIncomeStaticParamVO) throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long adviserId = (Long) map.get(SessionUtil.PARTY_ID);
PageBeanNew<ResourcesStatisticVO> groupIncomeStatic = bookGroupBiz.getGroupIncomeStatic(groupIncomeStaticParamVO, adviserId);
return new ResponseDto<>(groupIncomeStatic);
}
@Override
@RequestMapping(value ="getGroupScanTrend",method = RequestMethod.POST)
public ResponseDto<List<GroupScanTrendVO>> getGroupScanTrend(@RequestHeader("token") String token,
@RequestBody GroupScanTrendParamVO groupScanTrendParamVO) throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long adviserId = (Long) map.get(SessionUtil.PARTY_ID);
List<GroupScanTrendVO> groupScanTrend = bookGroupBiz.getGroupScanTrend(groupScanTrendParamVO, adviserId);
return new ResponseDto<>(groupScanTrend);
}
@Override
@RequestMapping(value ="getClassifyStatistic",method = RequestMethod.GET)
public ResponseDto<?> getClassifyStatistic(@RequestHeader("token") String token,
@RequestParam(value = "bookGroupId",required = true) Long bookGroupId,
@RequestParam(value = "currentPage",required = true) Integer currentPage,
@RequestParam(value = "numPerPage",required = true) Integer numPerPage) throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long adviserId = (Long) map.get(SessionUtil.PARTY_ID);
PageBeanNew<GroupStatisticVO> groupQrcodeStatistic = bookGroupBiz.getClassifyStatistic(bookGroupId, adviserId,currentPage,numPerPage);
return new ResponseDto<>(groupQrcodeStatistic);
}
@Override
@RequestMapping(value ="getQrcodeStatistic",method = RequestMethod.GET)
public ResponseDto<?> getQrcodeStatistic(@RequestHeader("token") String token,
@RequestParam(value = "bookGroupId",required = true) Long bookGroupId,
@RequestParam("classifyId") Long classifyId) throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long adviserId = (Long) map.get(SessionUtil.PARTY_ID);
List<WxGroupStatisticVO> qrcodeStatistic = bookGroupBiz.getQrcodeStatistic(bookGroupId, classifyId, adviserId);
return new ResponseDto<>(qrcodeStatistic);
}
@Override
@RequestMapping(value ="getTotalRescourceData",method = RequestMethod.GET)
public ResponseDto<?> getTotalRescourceData(@RequestHeader("token") String token, @RequestParam(value = "bookGroupId",required = true) Long bookGroupId,
@RequestParam(value = "classifyId",required = false) Long classifyId, @RequestParam(value = "qrcodeId",required = false) Long qrcodeId,
@RequestParam("type") String type) throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long adviserId = (Long) map.get(SessionUtil.PARTY_ID);
TotalRescourceDataVO totalRescourceData = bookGroupBiz.getTotalRescourceData(bookGroupId, adviserId, classifyId, qrcodeId, type);
return new ResponseDto<>(totalRescourceData);
}
@Override
@RequestMapping(value ="exportRescourceIncomeData",method = RequestMethod.GET)
public ResponseDto<?> exportRescourceIncomeData(@RequestHeader("token") String token,
@RequestParam(value = "bookGroupId",required = true) Long bookGroupId) throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long adviserId = (Long) map.get(SessionUtil.PARTY_ID);
Map<String, String> resultMap = bookGroupBiz.exportRescourceIncomeData(bookGroupId, adviserId);
return new ResponseDto<>(resultMap);
}
} }
...@@ -36,6 +36,8 @@ import java.util.Optional; ...@@ -36,6 +36,8 @@ import java.util.Optional;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import java.util.List;
/** /**
* @author lily * @author lily
* @date 2019/4/19 15:36 * @date 2019/4/19 15:36
...@@ -73,6 +75,14 @@ public class GroupQrcodeFacadeImpl implements GroupQrcodeFacade { ...@@ -73,6 +75,14 @@ public class GroupQrcodeFacadeImpl implements GroupQrcodeFacade {
} }
@Override @Override
@RequestMapping(value = "getQrcodeByClassify", method = RequestMethod.GET)
public ResponseDto<?> getQrcodeByClassify(@RequestHeader("token") String token, @RequestParam("bookGroupId") Long bookGroupId,
@RequestParam("classifyId") Long classifyId) throws PermissionException {
List<ClassifyQrcodeVO> qrcodeByClassify = groupQrcodeBiz.getQrcodeByClassify(bookGroupId, classifyId);
return new ResponseDto<>(qrcodeByClassify);
}
@Override
@PostMapping("modifyWechatGroupName") @PostMapping("modifyWechatGroupName")
@ApiOperation("修改微信群名称") @ApiOperation("修改微信群名称")
public ResponseDto<?> modifyWechatGroupName(@RequestHeader("token") String token, @RequestBody WechatGroupNameVO wechatGroupNameVO) public ResponseDto<?> modifyWechatGroupName(@RequestHeader("token") String token, @RequestBody WechatGroupNameVO wechatGroupNameVO)
......
...@@ -43,6 +43,13 @@ public class BookGroupClassifyServiceImpl implements BookGroupClassifyService { ...@@ -43,6 +43,13 @@ public class BookGroupClassifyServiceImpl implements BookGroupClassifyService {
} }
@Override @Override
@PostMapping("getClassifyByIds")
public ResponseEntity<ResponseDto<Map<Long, String>>> getClassifyByIds(@RequestBody List<Long> weixinGroupClassifyPrimaryIds) {
Map<Long, String> groupClassifyMap = bookGroupClassifyBiz.getClassifyByIds(weixinGroupClassifyPrimaryIds);
return ResponseHandleUtil.toResponse(groupClassifyMap);
}
@Override
@PostMapping("listGroupQrcodeBaseInfo") @PostMapping("listGroupQrcodeBaseInfo")
public ResponseEntity<ResponseDto<Map<String, GroupQrcodeBaseDTO>>> listGroupQrcodeBaseInfo(@RequestBody List<String> weixinGroupIds) { public ResponseEntity<ResponseDto<Map<String, GroupQrcodeBaseDTO>>> listGroupQrcodeBaseInfo(@RequestBody List<String> weixinGroupIds) {
Map<String, GroupQrcodeBaseDTO> groupQrcodeMap = bookGroupClassifyBiz.listGroupQrcodeBaseInfo(weixinGroupIds); Map<String, GroupQrcodeBaseDTO> groupQrcodeMap = bookGroupClassifyBiz.listGroupQrcodeBaseInfo(weixinGroupIds);
...@@ -96,4 +103,11 @@ public class BookGroupClassifyServiceImpl implements BookGroupClassifyService { ...@@ -96,4 +103,11 @@ public class BookGroupClassifyServiceImpl implements BookGroupClassifyService {
public ResponseEntity<ResponseDto<BigDecimal>> getPayPrice(@RequestParam("qrcodeId") Long qrcodeId, @RequestParam("wxUserId") String wxUserId) { public ResponseEntity<ResponseDto<BigDecimal>> getPayPrice(@RequestParam("qrcodeId") Long qrcodeId, @RequestParam("wxUserId") String wxUserId) {
return ResponseHandleUtil.toResponse(bookGroupClassifyBiz.getPayPrice(qrcodeId, wxUserId)); return ResponseHandleUtil.toResponse(bookGroupClassifyBiz.getPayPrice(qrcodeId, wxUserId));
} }
@Override
@PostMapping("getGroupClassifyCount")
public ResponseEntity<ResponseDto<Map<Long, BookClassifyDTO>>> getGroupClassifyCount(@RequestBody List<Long> bookIds) {
Map<Long, BookClassifyDTO> groupClassifyCount = bookGroupClassifyBiz.getGroupClassifyCount(bookIds);
return ResponseHandleUtil.toResponse(groupClassifyCount);
}
} }
...@@ -3,11 +3,12 @@ package com.pcloud.book.group.service.impl; ...@@ -3,11 +3,12 @@ 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.PersonalQrcodeDTO;
import com.pcloud.book.group.dto.GroupCipherDTO; import com.pcloud.book.group.dto.GroupCipherDTO;
import com.pcloud.book.group.dto.GroupUseDTO; import com.pcloud.book.group.dto.GroupUseDTO;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import com.pcloud.book.group.dto.ResourceBrowseParamDto;
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.*; import org.springframework.web.bind.annotation.*;
...@@ -88,6 +89,7 @@ public class BookGroupServiceImpl implements BookGroupService { ...@@ -88,6 +89,7 @@ public class BookGroupServiceImpl implements BookGroupService {
} }
@Override @Override
@RequestMapping(value = "updatePersonQrcode",method = RequestMethod.POST) @RequestMapping(value = "updatePersonQrcode",method = RequestMethod.POST)
public void updatePersonQrcode(@RequestBody PersonalQrcodeDTO personalQrcodeDTO) throws BizException { public void updatePersonQrcode(@RequestBody PersonalQrcodeDTO personalQrcodeDTO) throws BizException {
...@@ -131,4 +133,16 @@ public class BookGroupServiceImpl implements BookGroupService { ...@@ -131,4 +133,16 @@ public class BookGroupServiceImpl implements BookGroupService {
return ResponseHandleUtil.toResponse(bookGroupBiz.getJoinGroupCipher(cipher)); return ResponseHandleUtil.toResponse(bookGroupBiz.getJoinGroupCipher(cipher));
} }
/**
* @description 获取资源浏览数据
* @author 戴兴
* @date 2019/8/8 20:45
*/
@Override
@PostMapping("getResourcesBrowseCount")
public ResponseEntity<ResponseDto<Map<Long, Long>>> getResourcesBrowseCount(@RequestBody ResourceBrowseParamDto resourceBrowseParamDto) {
return ResponseHandleUtil.toResponse(bookGroupBiz.getResourcesBrowseCount(resourceBrowseParamDto));
}
} }
package com.pcloud.book.group.service.impl; package com.pcloud.book.group.service.impl;
import com.pcloud.book.group.biz.GroupQrcodeBiz;
import com.pcloud.book.group.biz.WeixinQrcodeBiz; import com.pcloud.book.group.biz.WeixinQrcodeBiz;
import com.pcloud.book.group.dto.BookWxQrcodeDTO; import com.pcloud.book.group.dto.BookWxQrcodeDTO;
import com.pcloud.book.group.dto.SyncWeixinGroupIdDTO; import com.pcloud.book.group.dto.SyncWeixinGroupIdDTO;
...@@ -7,8 +8,10 @@ import com.pcloud.book.group.dto.UpdateQrDTO; ...@@ -7,8 +8,10 @@ import com.pcloud.book.group.dto.UpdateQrDTO;
import com.pcloud.book.group.dto.WeixinQrcodeCountDTO; import com.pcloud.book.group.dto.WeixinQrcodeCountDTO;
import com.pcloud.book.group.dto.WeixinQrcodeDTO; import com.pcloud.book.group.dto.WeixinQrcodeDTO;
import com.pcloud.book.group.service.WeixinQrcodeService; import com.pcloud.book.group.service.WeixinQrcodeService;
import com.pcloud.book.group.vo.ClassifyQrcodeVO;
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.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil; import com.pcloud.common.utils.ResponseHandleUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -35,6 +38,8 @@ public class WeixinQrcodeServiceImpl implements WeixinQrcodeService { ...@@ -35,6 +38,8 @@ public class WeixinQrcodeServiceImpl implements WeixinQrcodeService {
@Autowired @Autowired
private WeixinQrcodeBiz weixinQrcodeBiz; private WeixinQrcodeBiz weixinQrcodeBiz;
@Autowired
private GroupQrcodeBiz groupQrcodeBiz;
@Override @Override
@GetMapping("tenQuartz") @GetMapping("tenQuartz")
...@@ -117,4 +122,15 @@ public class WeixinQrcodeServiceImpl implements WeixinQrcodeService { ...@@ -117,4 +122,15 @@ public class WeixinQrcodeServiceImpl implements WeixinQrcodeService {
return ResponseHandleUtil.toResponse(weixinQrcodeBiz.getGroupVersion(wxGroupIds)); return ResponseHandleUtil.toResponse(weixinQrcodeBiz.getGroupVersion(wxGroupIds));
} }
@Override
@RequestMapping(value = "getWxGroupId", method = RequestMethod.GET)
public ResponseEntity<ResponseDto<String>> getWxGroupId(@RequestParam("classifyId") Long classifyId) {
List<ClassifyQrcodeVO> qrcodeByClassify = groupQrcodeBiz.getQrcodeByClassify(null, classifyId);
String wxGroupId = null;
if (!ListUtils.isEmpty(qrcodeByClassify)){
wxGroupId = qrcodeByClassify.get(0).getWeixinGroupId();
}
return ResponseHandleUtil.toResponse(wxGroupId);
}
} }
...@@ -30,6 +30,9 @@ public class BookGroupClassifyVO { ...@@ -30,6 +30,9 @@ public class BookGroupClassifyVO {
@ApiModelProperty("群二维码名称") @ApiModelProperty("群二维码名称")
private String groupQrcodeName; private String groupQrcodeName;
@ApiModelProperty("群数量")
private Integer groupsCount;
@ApiModelProperty("群人数") @ApiModelProperty("群人数")
private Integer userNumber; private Integer userNumber;
...@@ -102,6 +105,14 @@ public class BookGroupClassifyVO { ...@@ -102,6 +105,14 @@ public class BookGroupClassifyVO {
this.groupQrcodeName = groupQrcodeName; this.groupQrcodeName = groupQrcodeName;
} }
public Integer getGroupsCount() {
return groupsCount;
}
public void setGroupsCount(Integer groupsCount) {
this.groupsCount = groupsCount;
}
public Integer getUserNumber() { public Integer getUserNumber() {
return userNumber; return userNumber;
} }
...@@ -175,6 +186,7 @@ public class BookGroupClassifyVO { ...@@ -175,6 +186,7 @@ public class BookGroupClassifyVO {
", classify='" + classify + '\'' + ", classify='" + classify + '\'' +
", bookGroupId='" + bookGroupId + '\'' + ", bookGroupId='" + bookGroupId + '\'' +
", groupQrcodeName='" + groupQrcodeName + '\'' + ", groupQrcodeName='" + groupQrcodeName + '\'' +
", groupsCount=" + groupsCount +
", userNumber=" + userNumber + ", userNumber=" + userNumber +
", weekActiveNumber=" + weekActiveNumber + ", weekActiveNumber=" + weekActiveNumber +
", proLabelId=" + proLabelId + ", proLabelId=" + proLabelId +
......
package com.pcloud.book.group.vo; package com.pcloud.book.group.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -44,6 +46,13 @@ public class ClassifyQrcodeVO implements Serializable { ...@@ -44,6 +46,13 @@ public class ClassifyQrcodeVO implements Serializable {
@ApiModelProperty("关键词识别次数") @ApiModelProperty("关键词识别次数")
private Integer keywordCount; private Integer keywordCount;
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
@ApiModelProperty("关键词识别次数")
private Date createdTime;
public String getWeixinGroupId() { public String getWeixinGroupId() {
return weixinGroupId; return weixinGroupId;
} }
...@@ -124,6 +133,18 @@ public class ClassifyQrcodeVO implements Serializable { ...@@ -124,6 +133,18 @@ public class ClassifyQrcodeVO implements Serializable {
this.keywordCount = keywordCount; this.keywordCount = keywordCount;
} }
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
@Override @Override
public String toString() { public String toString() {
return "ClassifyQrcodeVO{" + return "ClassifyQrcodeVO{" +
...@@ -136,7 +157,8 @@ public class ClassifyQrcodeVO implements Serializable { ...@@ -136,7 +157,8 @@ public class ClassifyQrcodeVO implements Serializable {
", quitRate=" + quitRate + ", quitRate=" + quitRate +
", weixinQrcodeId=" + weixinQrcodeId + ", weixinQrcodeId=" + weixinQrcodeId +
", weixinGroupId='" + weixinGroupId + '\'' + ", weixinGroupId='" + weixinGroupId + '\'' +
", keywordCount='" + keywordCount + '\'' + ", keywordCount=" + keywordCount +
", createdTime=" + createdTime +
'}'; '}';
} }
} }
package com.pcloud.book.group.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import java.io.Serializable;
/**
* @author 戴兴
* @description TODO
* @date 2019/7/25 19:35
*/
@ApiModel
@JsonInclude(JsonInclude.Include.NON_NULL)
public class GroupIncomeStaticParamVO implements Serializable {
private Long bookGroupId;
private Integer currentPage;
private Integer numPerPage;
private String type;
private Long classifyId;
private Long wxGroupId;
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public Integer getCurrentPage() {
return currentPage;
}
public void setCurrentPage(Integer currentPage) {
this.currentPage = currentPage;
}
public Integer getNumPerPage() {
return numPerPage;
}
public void setNumPerPage(Integer numPerPage) {
this.numPerPage = numPerPage;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getWxGroupId() {
return wxGroupId;
}
public void setWxGroupId(Long wxGroupId) {
this.wxGroupId = wxGroupId;
}
@Override
public String toString() {
return "GroupIncomeStaticParamVO{" +
"bookGroupId=" + bookGroupId +
", currentPage=" + currentPage +
", numPerPage=" + numPerPage +
", type=" + type +
", classifyId=" + classifyId +
", wxGroupId=" + wxGroupId +
'}';
}
}
\ No newline at end of file
package com.pcloud.book.group.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import java.io.Serializable;
import java.util.Date;
/**
* @author 戴兴
* @description TODO
* @date 2019/7/25 19:57
*/
@ApiModel
@JsonInclude(JsonInclude.Include.NON_NULL)
public class GroupScanTrendParamVO implements Serializable {
private Long bookGroupId;
private Long classifyId;
private Long wxGroupId;
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date startDate;
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date endDate;
private Integer dayNum;
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getWxGroupId() {
return wxGroupId;
}
public void setWxGroupId(Long wxGroupId) {
this.wxGroupId = wxGroupId;
}
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Integer getDayNum() {
return dayNum;
}
public void setDayNum(Integer dayNum) {
this.dayNum = dayNum;
}
@Override
public String toString() {
return "GroupScanTrendParamVO{" +
"bookGroupId=" + bookGroupId +
", classifyId=" + classifyId +
", wxGroupId=" + wxGroupId +
", startDate=" + startDate +
", endDate=" + endDate +
", dayNum=" + dayNum +
'}';
}
}
\ No newline at end of file
package com.pcloud.book.group.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import java.io.Serializable;
import java.util.Date;
/**
* @author 戴兴
* @description TODO
* @date 2019/7/26 9:05
*/
@ApiModel
@JsonInclude(JsonInclude.Include.NON_NULL)
public class GroupScanTrendVO implements Serializable {
@JsonFormat(
pattern = "yyyy-MM-dd",
timezone = "GMT+8"
)
private Date date;
private Long buyCount;
private Long scanCount;
@JsonFormat(
pattern = "yyyy-MM-dd",
timezone = "GMT+8"
)
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public Long getBuyCount() {
return buyCount;
}
public void setBuyCount(Long buyCount) {
this.buyCount = buyCount;
}
public Long getScanCount() {
return scanCount;
}
public void setScanCount(Long scanCount) {
this.scanCount = scanCount;
}
@Override
public String toString() {
return "GroupScanTrendVO{" +
"date=" + date +
", buyCount=" + buyCount +
", scanCount=" + scanCount +
'}';
}
}
\ No newline at end of file
package com.pcloud.book.group.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @author 戴兴
* @description TODO
* @date 2019/7/28 15:45
*/
public class GroupStatisticVO implements Serializable {
@ApiModelProperty("分类唯一标识")
private Long classifyId;
@ApiModelProperty("分类名称")
private String classifyName;
@ApiModelProperty("是否免费,1-免费 0-收费")
private Integer isFree;
@ApiModelProperty("价格")
private BigDecimal price;
@ApiModelProperty("点击人数")
private Long clickCount;
@ApiModelProperty("累计进群人数")
private Long inGroupPersonCount;
@ApiModelProperty("当前群人数")
private Long groupPersonCount;
@ApiModelProperty("收益")
private BigDecimal income;
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date createdTime;
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public String getClassifyName() {
return classifyName;
}
public void setClassifyName(String classifyName) {
this.classifyName = classifyName;
}
public Integer getIsFree() {
return isFree;
}
public void setIsFree(Integer isFree) {
this.isFree = isFree;
}
public Long getClickCount() {
return clickCount;
}
public void setClickCount(Long clickCount) {
this.clickCount = clickCount;
}
public Long getInGroupPersonCount() {
return inGroupPersonCount;
}
public void setInGroupPersonCount(Long inGroupPersonCount) {
this.inGroupPersonCount = inGroupPersonCount;
}
public Long getGroupPersonCount() {
return groupPersonCount;
}
public void setGroupPersonCount(Long groupPersonCount) {
this.groupPersonCount = groupPersonCount;
}
public BigDecimal getIncome() {
return income;
}
public void setIncome(BigDecimal income) {
this.income = income;
}
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
@Override
public String toString() {
return "GroupStatisticVO{" +
"classifyId=" + classifyId +
", classifyName=" + classifyName +
", isFree=" + isFree +
", clickCount=" + clickCount +
", inGroupPersonCount=" + inGroupPersonCount +
", groupPersonCount=" + groupPersonCount +
", income=" + income +
", createdTime=" + createdTime +
'}';
}
}
\ No newline at end of file
package com.pcloud.book.group.vo; package com.pcloud.book.group.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -42,6 +44,13 @@ public class ListClassifyVO implements Serializable { ...@@ -42,6 +44,13 @@ public class ListClassifyVO implements Serializable {
@ApiModelProperty("排序") @ApiModelProperty("排序")
private Integer rank; private Integer rank;
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
@ApiModelProperty("创建时间")
private Date createdTime;
public Integer getRank() { public Integer getRank() {
return rank; return rank;
} }
...@@ -114,9 +123,21 @@ public class ListClassifyVO implements Serializable { ...@@ -114,9 +123,21 @@ public class ListClassifyVO implements Serializable {
this.qrcodeNumber = qrcodeNumber; this.qrcodeNumber = qrcodeNumber;
} }
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
@Override @Override
public String toString() { public String toString() {
return "ClassifyNameVO{" + return "ListClassifyVO{" +
"id=" + id + "id=" + id +
", classify='" + classify + '\'' + ", classify='" + classify + '\'' +
", classifyIntroduce='" + classifyIntroduce + '\'' + ", classifyIntroduce='" + classifyIntroduce + '\'' +
...@@ -125,6 +146,7 @@ public class ListClassifyVO implements Serializable { ...@@ -125,6 +146,7 @@ public class ListClassifyVO implements Serializable {
", qrcodeNumber=" + qrcodeNumber + ", qrcodeNumber=" + qrcodeNumber +
", userNumberTotal=" + userNumberTotal + ", userNumberTotal=" + userNumberTotal +
", rank=" + rank + ", rank=" + rank +
", createdTime=" + createdTime +
'}'; '}';
} }
} }
package com.pcloud.book.group.vo;
import java.io.Serializable;
/**
* @author 戴兴
* @description TODO
* @date 2019/7/27 17:19
*/
public class ResourceClickVO implements Serializable {
private Long rescourceId;
private Long clickCount;
public Long getRescourceId() {
return rescourceId;
}
public void setRescourceId(Long rescourceId) {
this.rescourceId = rescourceId;
}
public Long getClickCount() {
return clickCount;
}
public void setClickCount(Long clickCount) {
this.clickCount = clickCount;
}
@Override
public String toString() {
return "ResourceClickVO{" +
"rescourceId=" + rescourceId +
", clickCount=" + clickCount +
'}';
}
}
\ No newline at end of file
package com.pcloud.book.group.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author 戴兴
* @description TODO
* @date 2019/7/25 19:01
*/
@ApiModel
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResourcesStatisticVO implements Serializable {
private Long rescourceId;
private String rescourceName;
private String type;
private Long browseCount;
private Long saleCount;
private BigDecimal totalSale;
private BigDecimal totalIncome;
public Long getRescourceId() {
return rescourceId;
}
public void setRescourceId(Long rescourceId) {
this.rescourceId = rescourceId;
}
public String getRescourceName() {
return rescourceName;
}
public void setRescourceName(String rescourceName) {
this.rescourceName = rescourceName;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Long getBrowseCount() {
return browseCount;
}
public void setBrowseCount(Long browseCount) {
this.browseCount = browseCount;
}
public Long getSaleCount() {
return saleCount;
}
public void setSaleCount(Long saleCount) {
this.saleCount = saleCount;
}
public BigDecimal getTotalSale() {
return totalSale;
}
public void setTotalSale(BigDecimal totalSale) {
this.totalSale = totalSale;
}
public BigDecimal getTotalIncome() {
return totalIncome;
}
public void setTotalIncome(BigDecimal totalIncome) {
this.totalIncome = totalIncome;
}
@Override
public String toString() {
return "ResourcesStatisticVO{" +
"rescourceId='" + rescourceId + '\'' +
", rescourceName=" + rescourceName +
", type='" + type + '\'' +
", browseCount=" + browseCount +
", saleCount=" + saleCount +
", totalSale=" + totalSale +
", totalIncome=" + totalIncome +
'}';
}
}
\ No newline at end of file
package com.pcloud.book.group.vo;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author 戴兴
* @description TODO
* @date 2019/7/28 16:16
*/
public class TotalRescourceDataVO implements Serializable {
private Long clickCount;
private BigDecimal totalSale;
private BigDecimal totalIncome;
public Long getClickCount() {
return clickCount;
}
public void setClickCount(Long clickCount) {
this.clickCount = clickCount;
}
public BigDecimal getTotalSale() {
return totalSale;
}
public void setTotalSale(BigDecimal totalSale) {
this.totalSale = totalSale;
}
public BigDecimal getTotalIncome() {
return totalIncome;
}
public void setTotalIncome(BigDecimal totalIncome) {
this.totalIncome = totalIncome;
}
@Override
public String toString() {
return "TotalRescourceDataVO{" +
"clickCount=" + clickCount +
", totalSale=" + totalSale +
", totalIncome=" + totalIncome +
'}';
}
}
\ No newline at end of file
package com.pcloud.book.group.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author 戴兴
* @description TODO
* @date 2019/7/28 15:47
*/
public class WxGroupStatisticVO implements Serializable {
private Long qrcodeId;
private String wxGroupName;
private Long inGroupPersonCount;
private Long groupPersonCount;
private BigDecimal income;
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date createdTime;
public Long getQrcodeId() {
return qrcodeId;
}
public void setQrcodeId(Long qrcodeId) {
this.qrcodeId = qrcodeId;
}
public String getWxGroupName() {
return wxGroupName;
}
public void setWxGroupName(String wxGroupName) {
this.wxGroupName = wxGroupName;
}
public Long getInGroupPersonCount() {
return inGroupPersonCount;
}
public void setInGroupPersonCount(Long inGroupPersonCount) {
this.inGroupPersonCount = inGroupPersonCount;
}
public Long getGroupPersonCount() {
return groupPersonCount;
}
public void setGroupPersonCount(Long groupPersonCount) {
this.groupPersonCount = groupPersonCount;
}
public BigDecimal getIncome() {
return income;
}
public void setIncome(BigDecimal income) {
this.income = income;
}
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
@Override
public String toString() {
return "WxGroupStatisticVO{" +
"qrcodeId=" + qrcodeId +
", wxGroupName='" + wxGroupName + '\'' +
", inGroupPersonCount=" + inGroupPersonCount +
", groupPersonCount=" + groupPersonCount +
", income=" + income +
", createdTime=" + createdTime +
'}';
}
}
\ No newline at end of file
...@@ -15,11 +15,7 @@ import com.pcloud.book.group.dao.BookGroupClassifyDao; ...@@ -15,11 +15,7 @@ import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookGroupDao; import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dao.GroupQrcodeDao; import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dao.JoinGroupCipherDao; import com.pcloud.book.group.dao.JoinGroupCipherDao;
import com.pcloud.book.group.dto.BookGroupDTO; import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import com.pcloud.book.group.dto.GroupQrcodeDTO;
import com.pcloud.book.group.dto.JoinGroupCipherDTO;
import com.pcloud.book.group.dto.PushAddUserMessageDTO;
import com.pcloud.book.group.entity.AppTouchRecord; import com.pcloud.book.group.entity.AppTouchRecord;
import com.pcloud.book.group.entity.GroupQrcode; import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.enums.TouchTypeEnum; import com.pcloud.book.group.enums.TouchTypeEnum;
...@@ -42,6 +38,8 @@ import com.pcloud.book.keywords.vo.ReplyMessageVO; ...@@ -42,6 +38,8 @@ import com.pcloud.book.keywords.vo.ReplyMessageVO;
import com.pcloud.book.keywords.vo.SetGuideVO; import com.pcloud.book.keywords.vo.SetGuideVO;
import com.pcloud.book.keywords.vo.UpdateGuideVO; import com.pcloud.book.keywords.vo.UpdateGuideVO;
import com.pcloud.book.util.properties.BookProps; import com.pcloud.book.util.properties.BookProps;
import com.pcloud.book.weixinclock.dao.WeixinClockGroupClassifyDao;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto; import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
...@@ -106,6 +104,8 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -106,6 +104,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
private JoinGroupCipherDao joinGroupCipherDao; private JoinGroupCipherDao joinGroupCipherDao;
@Autowired @Autowired
private KeywordDao keywordDao; private KeywordDao keywordDao;
@Autowired
private WeixinClockGroupClassifyDao weixinClockGroupClassifyDao;
@ParamLog("同意加好友发送欢迎语") @ParamLog("同意加好友发送欢迎语")
@Override @Override
...@@ -396,7 +396,7 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -396,7 +396,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
SendWeixinRequestTools.sendAccountMessage(weixinGroupId, bookGuide.getRecommendLanguage(), robotId, wechatInfo, pushAddUserMessageDTO.getIp()); SendWeixinRequestTools.sendAccountMessage(weixinGroupId, bookGuide.getRecommendLanguage(), robotId, wechatInfo, pushAddUserMessageDTO.getIp());
} }
//校验该群是否与微信群打卡有关 //校验该群是否与微信群打卡有关
List<Long> bookClockInfoIdList = bookClockCheck.checkGroupIsClock(classifyQrcodeInfo); /*List<Long> bookClockInfoIdList = bookClockCheck.checkGroupIsClock(classifyQrcodeInfo);
if(!ListUtils.isEmpty(bookClockInfoIdList)){ if(!ListUtils.isEmpty(bookClockInfoIdList)){
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
int i = 0; int i = 0;
...@@ -419,13 +419,14 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -419,13 +419,14 @@ public class BookGuideBizImpl implements BookGuideBiz {
} }
} }
} }*/
} }
@ParamLog("推关学习报告/猜谜语关键词消息") @ParamLog("推关学习报告/猜谜语关键词消息")
private void pushLearningReport(GroupClassifyQrcodeDTO classifyQrcodeInfo, String robotId, String weixinGroupId, String ip) { private void pushLearningReport(GroupClassifyQrcodeDTO classifyQrcodeInfo, String robotId, String weixinGroupId, String ip) {
Boolean reportOpen = false; Boolean reportOpen = false;
Boolean riddleOpen = false; Boolean riddleOpen = false;
Boolean clockOpen = false;
if (classifyQrcodeInfo.getHasOpenLearningReport() != null && classifyQrcodeInfo.getHasOpenLearningReport()) { if (classifyQrcodeInfo.getHasOpenLearningReport() != null && classifyQrcodeInfo.getHasOpenLearningReport()) {
reportOpen = true; reportOpen = true;
} }
...@@ -433,9 +434,25 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -433,9 +434,25 @@ public class BookGuideBizImpl implements BookGuideBiz {
if (null != groupQrcode && groupQrcode.getRiddleOpen()) { if (null != groupQrcode && groupQrcode.getRiddleOpen()) {
riddleOpen = true; riddleOpen = true;
} }
if (reportOpen && riddleOpen) { WeixinClockDto weixinClockDto = weixinClockGroupClassifyDao.getClockBaseInfoByClassify(classifyQrcodeInfo.getClassifyId());
if (null != weixinClockDto && !StringUtil.isEmpty(weixinClockDto.getClockGuide()) && !StringUtil.isEmpty(weixinClockDto.getClockKeyword())) {
clockOpen = true;
}
if (reportOpen && riddleOpen && clockOpen) {
SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值\n" +
"关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666\n" +
"关键词【" + weixinClockDto.getClockKeyword() + "】\n " + weixinClockDto.getClockGuide(), robotId, weixinGroupId, ip);
} else if (reportOpen && riddleOpen) {
SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值\n" + SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值\n" +
"关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666", robotId, weixinGroupId, ip); "关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666", robotId, weixinGroupId, ip);
} else if (reportOpen && clockOpen) {
SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值\n" +
"关键词【" + weixinClockDto.getClockKeyword() + "】\n " + weixinClockDto.getClockGuide(), robotId, weixinGroupId, ip);
} else if (riddleOpen && clockOpen) {
SendWeixinRequestTools.sendTextMessage("关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666" +
"关键词【" + weixinClockDto.getClockKeyword() + "】\n " + weixinClockDto.getClockGuide(), robotId, weixinGroupId, ip);
} else if (clockOpen) {
SendWeixinRequestTools.sendTextMessage("关键词【" + weixinClockDto.getClockKeyword() + "】\n " + weixinClockDto.getClockGuide(), robotId, weixinGroupId, ip);
} else if (reportOpen) { } else if (reportOpen) {
SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值", robotId, weixinGroupId, ip); SendWeixinRequestTools.sendTextMessage("关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值", robotId, weixinGroupId, ip);
} else if (riddleOpen) { } else if (riddleOpen) {
......
...@@ -75,4 +75,9 @@ public class MQTopicConumer { ...@@ -75,4 +75,9 @@ public class MQTopicConumer {
*/ */
public static final String WX_AGREE_ADD_USER = PREFIX + MQTopicProducer.WX_AGREE_ADD_USER; public static final String WX_AGREE_ADD_USER = PREFIX + MQTopicProducer.WX_AGREE_ADD_USER;
/**
* 微信群微信ID和微信用户ID绑定
*/
public static final String CONSUMER_WXGROUP_USER_BIND = PREFIX + MQTopicProducer.WXGROUP_USER_BIND;
} }
package com.pcloud.book.mq.topic;
/**
* @author 杨涛
* @description 绑定
* @date 2019/8/23 18:48
*/
import com.pcloud.book.mq.config.MQTopicConumer;
import com.pcloud.book.weixinclock.biz.WeixinClockBiz;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.readercenter.wechat.entity.WechatGroupUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@RabbitListener(queues = MQTopicConumer.CONSUMER_WXGROUP_USER_BIND)
public class ReaderCenterBindInfoListener {
private static final Logger LOGGER = LoggerFactory.getLogger(ReaderCenterBindInfoListener.class);
@Autowired
private WeixinClockBiz weixinClockBiz;
@RabbitHandler
@ParamLog("接收到微信用户绑定TOPIC")
public void process(WechatGroupUser wechatGroupUser) {
try {
if (null != wechatGroupUser && null != wechatGroupUser.getWechatUserId() && !StringUtil.isEmpty(wechatGroupUser.getWxUserId())) {
weixinClockBiz.receiveWxGroupUserBindTopic(wechatGroupUser);
}
} catch (Exception e) {
LOGGER.error("接收到微信用户绑定TOPIC,JMS异常+++++" + e.getMessage(), e);
}
}
}
...@@ -7,13 +7,13 @@ import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr; ...@@ -7,13 +7,13 @@ import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.keywords.biz.BookKeywordBiz; import com.pcloud.book.keywords.biz.BookKeywordBiz;
import com.pcloud.book.mq.config.MQTopicConumer; import com.pcloud.book.mq.config.MQTopicConumer;
import com.pcloud.book.riddle.biz.RiddleRecordBiz; import com.pcloud.book.riddle.biz.RiddleRecordBiz;
import com.pcloud.book.weixinclock.biz.WeixinClockBiz;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.wechatgroup.message.dto.SendTextDTO; import com.pcloud.wechatgroup.message.dto.SendTextDTO;
import com.sdk.wxgroup.SendMessageTypeEnum; import com.sdk.wxgroup.SendMessageTypeEnum;
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;
...@@ -43,6 +43,8 @@ public class WxGroupSendTextListener { ...@@ -43,6 +43,8 @@ public class WxGroupSendTextListener {
private BookClockCheck bookClockCheck; private BookClockCheck bookClockCheck;
@Autowired @Autowired
private RiddleRecordBiz riddleRecordBiz; private RiddleRecordBiz riddleRecordBiz;
@Autowired
private WeixinClockBiz weixinClockBiz;
/** /**
* 接收微信用户进群消息 * 接收微信用户进群消息
...@@ -57,10 +59,10 @@ public class WxGroupSendTextListener { ...@@ -57,10 +59,10 @@ 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()); Boolean flag = weixinClockBiz.checkWeixinClockKeyword(sendTextDTO.getTextContent().trim(), sendTextDTO.getWechatGroupId());
if(null != bookClockInfoDTO && SendMessageTypeEnum.GROUP.getCode().equals(sendTextDTO.getCode())){ if(flag && SendMessageTypeEnum.GROUP.getCode().equals(sendTextDTO.getCode())){
bookClockKeywordBiz.sendKeywordMessage(bookClockInfoDTO, wechatUserId,sendTextDTO.getWechatGroupId(),sendTextDTO.getWxId(),sendTextDTO.getIp()); weixinClockBiz.sendKeywordMessage(sendTextDTO.getTextContent().trim(), wechatUserId, sendTextDTO.getWechatGroupId(), sendTextDTO.getWxId(), sendTextDTO.getIp());
} else{ } else {
final long l = System.currentTimeMillis(); final long l = System.currentTimeMillis();
bookKeywordBiz.sendKeywordMessage(sendTextDTO.getTextContent().trim(), sendTextDTO.getWechatGroupId(), wechatUserId, sendTextDTO.getWxId(), sendTextDTO.getIp(), sendTextDTO.getCode()); bookKeywordBiz.sendKeywordMessage(sendTextDTO.getTextContent().trim(), sendTextDTO.getWechatGroupId(), wechatUserId, sendTextDTO.getWxId(), sendTextDTO.getIp(), sendTextDTO.getCode());
log.info("[接收用户发送文本消息] 总耗时:{}ms ", System.currentTimeMillis() - l); log.info("[接收用户发送文本消息] 总耗时:{}ms ", System.currentTimeMillis() - l);
......
...@@ -265,8 +265,8 @@ public class PushBizImpl implements PushBiz { ...@@ -265,8 +265,8 @@ public class PushBizImpl implements PushBiz {
pushRecord.setPushStatus(PushStatusEnum.PUSHING.value); pushRecord.setPushStatus(PushStatusEnum.PUSHING.value);
//新增群发记录 //新增群发记录
pushRecordDao.insert(pushRecord); pushRecordDao.insert(pushRecord);
//新增细化到群的记录并发送消息 //新增细化到群的记录并发送消息,异步
addPushGroupRecordsAndSend(pushGroupList, pushRecord, pushItemList); ThreadPoolUtils.SEND_MESSAGE_THREAD_POOL.execute(() -> addPushGroupRecordsAndSend(pushGroupList, pushRecord, pushItemList));
} catch (Exception e) { } catch (Exception e) {
LOGGER.error(e.getMessage(), "群发消息失败!"+e); LOGGER.error(e.getMessage(), "群发消息失败!"+e);
pushRecordDao.updateStateById(pushRecord.getId(), PushStatusEnum.FAIL.value); pushRecordDao.updateStateById(pushRecord.getId(), PushStatusEnum.FAIL.value);
...@@ -299,7 +299,15 @@ public class PushBizImpl implements PushBiz { ...@@ -299,7 +299,15 @@ public class PushBizImpl implements PushBiz {
String altId = wechatGroupConsr.getRobotIdByGroupId(groupQrcode.getWeixinGroupId()); String altId = wechatGroupConsr.getRobotIdByGroupId(groupQrcode.getWeixinGroupId());
//遍历发送消息 //遍历发送消息
for (PushItem pushItem : pushItemList) { for (PushItem pushItem : pushItemList) {
sendWechatMessage(pushGroup, pushItem, pushGroupRecord.getId(), altId); try {
LOGGER.info("发送一个群里的一个消息开始pushGroup=" + pushGroup.toString() + "pushItem=" + pushItem.toString() + "altId=" + altId);
sendWechatMessage(pushGroup, pushItem, pushGroupRecord.getId(), altId);
LOGGER.info("发送一个群里的一个消息结束,休眠1秒pushGroup=" + pushGroup.toString() + "pushItem=" + pushItem.toString() + "altId=" + altId);
Thread.sleep(1000);
} catch (InterruptedException e) {
LOGGER.error("发消息休眠1秒出错", e);
}
} }
} }
} }
......
package com.pcloud.book.weixinclock.biz;
import com.pcloud.book.group.vo.BookGroupClassifyVO;
import com.pcloud.book.group.vo.ListGroupClassifyParam;
import com.pcloud.book.weixinclock.dto.RankDto;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.readercenter.wechat.entity.WechatGroupUser;
import java.util.List;
import java.util.Map;
/**
* @author 杨涛
* @description TODO
* @date 2019/8/14 19:11
*/
public interface WeixinClockBiz {
/**
* 创建微信群签到打卡
* @param weixinClockDto
*/
Long createWeixinClock(WeixinClockDto weixinClockDto) throws BizException;
/**
* 获取编辑所有的分类
* @param listGroupClassifyParam
*/
PageBeanNew<BookGroupClassifyVO> listGroupClassify4Clock(ListGroupClassifyParam listGroupClassifyParam, Long adviserId) throws BizException;
/**
* 删除微信群签到打卡
* @param weixinClockId
*/
void deleteWeixinClock(Long weixinClockId, Long adviserId) throws BizException;
/**
* 修改微信群签到打卡
* @param weixinClockDto
*/
void updateWeixinClock(WeixinClockDto weixinClockDto) throws BizException;
/**
* 微信群签到打卡列表(编辑端)
* @param pageParam
*/
PageBeanNew<WeixinClockDto> listWeixinClock4Adviser(PageParam pageParam, Map<String,Object> paramMap) throws BizException;
/**
* 获取微信群签到打卡信息
* @param weixinClockId
*/
WeixinClockDto getWeixinClockBaseInfo(Long weixinClockId) throws BizException;
/**
* 获取某个微信群签到打卡的所有群分类详情
* @param weixinClockId
*/
PageBeanNew<BookGroupClassifyVO> listGroupClassifyDetail4Clock(Long weixinClockId, Integer currentPage, Integer numPerPage) throws BizException;
/**
* 校验是否为该群的打卡关键字
* @param weixinGroupId
*/
Boolean checkWeixinClockKeyword(String content, String weixinGroupId) throws BizException;
/**
* 发送关键词信息
* @param content
* @param userWxId
* @return
*/
Boolean sendKeywordMessage(String content, String userWxId, String wechatGroupId,String wxId, String ip);
/**
* 获取某个群内的打卡排行榜
* @param wxGroupId
* @return
*/
PageBeanNew<RankDto> listWeixinClockRank(String wxGroupId, String wxUserId, Integer currentPage, Integer numPerPage);
/**
* 获取某个群内某个用户的信息
* @param wxGroupId
* @return
*/
RankDto getClockWechatUserRank(Long wechatUserId, String wxGroupId, String wxUserId);
/**
* 接收到微信用户绑定TOPIC
* @param wechatGroupUser
*/
void receiveWxGroupUserBindTopic(WechatGroupUser wechatGroupUser);
}
package com.pcloud.book.weixinclock.biz.impl;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.clock.dto.PushBookClockKeywordDTO;
import com.pcloud.book.consumer.app.AppConsr;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.reader.ReaderConsr;
import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import com.pcloud.book.group.vo.BookGroupClassifyVO;
import com.pcloud.book.group.vo.ListGroupClassifyParam;
import com.pcloud.book.weixinclock.biz.WeixinClockBiz;
import com.pcloud.book.weixinclock.check.WeixinClockCheck;
import com.pcloud.book.weixinclock.dao.WeixinClockDao;
import com.pcloud.book.weixinclock.dao.WeixinClockGroupClassifyDao;
import com.pcloud.book.weixinclock.dao.WeixinClockMemberDao;
import com.pcloud.book.weixinclock.dao.WeixinClockPrizeRecordDao;
import com.pcloud.book.weixinclock.dao.WeixinClockRewardDao;
import com.pcloud.book.weixinclock.dao.WeixinClockTopicDao;
import com.pcloud.book.weixinclock.dto.DrawRewardDto;
import com.pcloud.book.weixinclock.dto.RankDto;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
import com.pcloud.book.weixinclock.entity.WeixinClock;
import com.pcloud.book.weixinclock.entity.WeixinClockGroupClassify;
import com.pcloud.book.weixinclock.entity.WeixinClockMember;
import com.pcloud.book.weixinclock.entity.WeixinClockPrizeRecord;
import com.pcloud.book.weixinclock.entity.WeixinClockTopic;
import com.pcloud.channelcenter.base.constants.ChannelConstants;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.constant.MQTopicProducer;
import com.pcloud.common.core.constant.ProductTypeConstant;
import com.pcloud.common.core.constant.WXKeywordOperationConstant;
import com.pcloud.common.core.dto.PromotionGiftDto;
import com.pcloud.common.core.dto.PromotionOrderDto;
import com.pcloud.common.core.enums.PromotionOrderEnum;
import com.pcloud.common.enums.AppTypeEnum;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.DateNewUtils;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.httpclient.UrlUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.labelcenter.label.service.LabelService;
import com.pcloud.readercenter.wechat.entity.WechatGroupUser;
import com.pcloud.wechatgroup.group.dto.GroupUserDTO;
import com.sdk.wxgroup.SendTextMessageVO;
import com.sdk.wxgroup.WxGroupSDK;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* @author 杨涛
* @description TODO
* @date 2019/8/14 19:12
*/
@Component("weixinClockBiz")
public class WeixinClockBizImpl implements WeixinClockBiz {
private static final Logger LOGGER = LoggerFactory.getLogger(WeixinClockBizImpl.class);
@Autowired
private WeixinClockDao weixinClockDao;
@Autowired
private BookGroupClassifyDao bookGroupClassifyDao;
@Autowired
private WechatGroupConsr wechatGroupConsr;
@Autowired
private LabelService labelService;
@Autowired
private WeixinClockRewardDao weixinClockRewardDao;
@Autowired
private WeixinClockGroupClassifyDao weixinClockGroupClassifyDao;
@Autowired
private AppConsr appConsr;
@Autowired
private WeixinClockMemberDao weixinClockMemberDao;
@Autowired
private WeixinClockTopicDao weixinClockTopicDao;
@Autowired
private BookGroupClassifyBiz bookGroupClassifyBiz;
@Autowired
private QrcodeSceneConsr qrcodeSceneConsr;
@Autowired
private AmqpTemplate amqpTemplate;
@Autowired
private ReaderConsr readerConsr;
@Autowired
private WeixinClockCheck weixinClockCheck;
@Autowired
private WeixinClockPrizeRecordDao weixinClockPrizeRecordDao;
@Autowired
private AdviserConsr adviserConsr;
private static final ThreadFactory NAMED_THREAD_FACTORY = new ThreadFactoryBuilder()
.setNameFormat("weixinclock-pool-%d").build();
private static final ExecutorService EXECUTOR_SERVICE = new ThreadPoolExecutor(5, 10, 0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(1024), NAMED_THREAD_FACTORY, new ThreadPoolExecutor.CallerRunsPolicy());
@Value("${wechat.group.link.prefix}")
private String wechatGroupLinkPrefix;
/**
* 关创建微信群签到打卡
* @param weixinClockDto
*/
@Override
@ParamLog("创建微信群签到打卡")
@Transactional(rollbackFor = Exception.class)
public Long createWeixinClock(WeixinClockDto weixinClockDto) throws BizException {
if(null == weixinClockDto) {
throw new BookBizException(BookBizException.ERROR,"缺少必要参数!");
}
weixinClockCheck.checkParam4CreateWeixinClock(weixinClockDto);
WeixinClock weixinClock = new WeixinClock();
BeanUtils.copyProperties(weixinClockDto, weixinClock);
weixinClockDao.insert(weixinClock);
Long weixinClockId = weixinClock.getWeixinClockId();
if(!ListUtils.isEmpty(weixinClockDto.getGroupClassifyIds())) {
List<WeixinClockGroupClassify> groupClassifyIds = Lists.newArrayList();
weixinClockDto.getGroupClassifyIds().forEach(e -> {
WeixinClockGroupClassify weixinClockGroupClassify = new WeixinClockGroupClassify();
weixinClockGroupClassify.setBookGroupClassifyId(e);
weixinClockGroupClassify.setWeixinClockId(weixinClockId);
groupClassifyIds.add(weixinClockGroupClassify);
});
weixinClockGroupClassifyDao.batchInsert(groupClassifyIds);
}
if(!ListUtils.isEmpty(weixinClockDto.getWeixinClockRewards())) {
weixinClockDto.getWeixinClockRewards().forEach(e -> e.setWeixinClockId(weixinClockId));
weixinClockRewardDao.batchInsert(weixinClockDto.getWeixinClockRewards());
}
return weixinClockId;
}
@Override
@ParamLog("获取编辑所有的分类")
public PageBeanNew<BookGroupClassifyVO> listGroupClassify4Clock(ListGroupClassifyParam listGroupClassifyParam, Long adviserId) throws BizException {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adviserId", adviserId);
if (!StringUtil.isEmpty(listGroupClassifyParam.getName())) {
paramMap.put("name", listGroupClassifyParam.getName());
}
paramMap.put("bookIds", listGroupClassifyParam.getBookIds());
paramMap.put("proLabelId",listGroupClassifyParam.getProLabelId());
paramMap.put("depLabelId",listGroupClassifyParam.getDepLabelId());
paramMap.put("purLabelId",listGroupClassifyParam.getPurLabelId());
PageParam pageParam = new PageParam(listGroupClassifyParam.getCurrentPage(), listGroupClassifyParam.getNumPerPage());
PageBeanNew<BookGroupClassifyVO> pageBeanNew = bookGroupClassifyDao.listPageNew(pageParam, paramMap, "listGroupClassify4Clock");
if (pageBeanNew == null) {
return new PageBeanNew<>(listGroupClassifyParam.getCurrentPage(), listGroupClassifyParam.getNumPerPage(), new ArrayList<>());
}
//遍历填充标签
List<BookGroupClassifyVO> bookGroupClassifyVOS = pageBeanNew.getRecordList();
if (!ListUtils.isEmpty(bookGroupClassifyVOS)) {
List<Long> labelIds = new ArrayList<>();
List<Long> classifyIds = new ArrayList<>();
for (BookGroupClassifyVO bookGroupClassifyVO : bookGroupClassifyVOS) {
classifyIds.add(bookGroupClassifyVO.getClassifyId());
if (bookGroupClassifyVO.getProLabelId() != null) {
labelIds.add(bookGroupClassifyVO.getProLabelId());
}
if (bookGroupClassifyVO.getPurLabelId() != null) {
labelIds.add(bookGroupClassifyVO.getPurLabelId());
}
if (bookGroupClassifyVO.getDepLabelId() != null) {
labelIds.add(bookGroupClassifyVO.getDepLabelId());
}
}
Map<Long, Integer> activeCountMap = wechatGroupConsr.get7DayActiveUserCountByClassify(classifyIds);
Map<Long, String> labelMap = new HashMap<>();
if (!ListUtils.isEmpty(labelIds)) {
labelMap = ResponseHandleUtil.parseMap(labelService.getLabelName(labelIds), Long.class, String.class);
}
for (BookGroupClassifyVO bookGroupClassifyVO : bookGroupClassifyVOS) {
if (!MapUtils.isEmpty(labelMap)) {
Long proLabelId = bookGroupClassifyVO.getProLabelId();
Long purLabelId = bookGroupClassifyVO.getPurLabelId();
Long depLabelId = bookGroupClassifyVO.getDepLabelId();
if (proLabelId != null) {
bookGroupClassifyVO.setProLabelName(labelMap.get(proLabelId));
}
if (purLabelId != null) {
bookGroupClassifyVO.setPurLabelName(labelMap.get(purLabelId));
}
if (depLabelId != null) {
bookGroupClassifyVO.setDepLabelName(labelMap.get(depLabelId));
}
}
Integer count = activeCountMap.get(bookGroupClassifyVO.getClassifyId());
if (count == null) {
bookGroupClassifyVO.setWeekActiveNumber(0);
} else {
bookGroupClassifyVO.setWeekActiveNumber(count);
}
}
}
return pageBeanNew;
}
/**
* 删除微信群签到打卡
* @param weixinClockId
* @param adviserId
*/
@Override
@ParamLog("删除微信群签到打卡")
@Transactional(rollbackFor = Exception.class)
public void deleteWeixinClock(Long weixinClockId, Long adviserId) throws BizException {
if(null == weixinClockId){
throw new BookBizException(BookBizException.ERROR,"缺少删除的必要参数");
}
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("weixinClockId",weixinClockId);
//删除对应的群分类
weixinClockGroupClassifyDao.deleteById(weixinClockId);
//删除对应的奖励信息
weixinClockRewardDao.deleteById(weixinClockId);
//删除主表的微信群签到打卡
weixinClockDao.deleteWeixinClock(paramMap);
}
/**
* 修改微信群签到打卡
* @param weixinClockDto
* @throws BizException
*/
@Override
@ParamLog("修改微信群签到打卡")
@Transactional(rollbackFor = Exception.class)
public void updateWeixinClock(WeixinClockDto weixinClockDto) throws BizException {
if(null == weixinClockDto) {
throw new BookBizException(BookBizException.ERROR,"缺少必要参数!");
}
if(null == weixinClockDto.getWeixinClockId()){
throw new BookBizException(BookBizException.ERROR,"缺少修改的必要参数");
}
weixinClockCheck.checkParam4CreateWeixinClock(weixinClockDto);
Long weixinClockId = weixinClockDto.getWeixinClockId();
WeixinClock weixinClock = new WeixinClock();
BeanUtils.copyProperties(weixinClockDto, weixinClock);
weixinClockDao.update(weixinClock);
//删除对应的群分类
weixinClockGroupClassifyDao.deleteById(weixinClockId);
//删除对应的基本信息
weixinClockRewardDao.deleteById(weixinClockId);
if(!ListUtils.isEmpty(weixinClockDto.getGroupClassifyIds())) {
List<WeixinClockGroupClassify> groupClassifyIds = Lists.newArrayList();
weixinClockDto.getGroupClassifyIds().forEach(e -> {
WeixinClockGroupClassify weixinClockGroupClassify = new WeixinClockGroupClassify();
weixinClockGroupClassify.setBookGroupClassifyId(e);
weixinClockGroupClassify.setWeixinClockId(weixinClockId);
groupClassifyIds.add(weixinClockGroupClassify);
});
weixinClockGroupClassifyDao.batchInsert(groupClassifyIds);
}
if(!ListUtils.isEmpty(weixinClockDto.getWeixinClockRewards())) {
weixinClockDto.getWeixinClockRewards().forEach(e -> e.setWeixinClockId(weixinClockId));
weixinClockRewardDao.batchInsert(weixinClockDto.getWeixinClockRewards());
}
}
@Override
public PageBeanNew<WeixinClockDto> listWeixinClock4Adviser(PageParam pageParam, Map<String, Object> paramMap) throws BizException {
PageBeanNew<WeixinClockDto> clockDtoPage = weixinClockDao.listPageNew(pageParam, paramMap, "listWeixinClock4Adviser");
if (clockDtoPage == null) {
return new PageBeanNew<>(pageParam.getPageNum(), pageParam.getNumPerPage(), 0, new ArrayList<>());
}
List<Long> appIds = clockDtoPage.getRecordList().stream().map(WeixinClockDto::getClockPrizeId).collect(Collectors.toList());
if(!ListUtils.isEmpty(appIds)) {
Map<Long, AppDto> resultsMap = appConsr.getBaseByIds(appIds);
for(WeixinClockDto weixinClockDto:clockDtoPage.getRecordList()){
if(null != resultsMap && resultsMap.containsKey(weixinClockDto.getClockPrizeId())){
AppDto appDto = resultsMap.get(weixinClockDto.getClockPrizeId());
DrawRewardDto drawRewardDto = new DrawRewardDto();
drawRewardDto.setAppId(weixinClockDto.getClockPrizeId());
drawRewardDto.setChannelId(appDto.getChannelId());
drawRewardDto.setSquareImg(appDto.getSquareImg());
drawRewardDto.setTitle(appDto.getTitle());
drawRewardDto.setTypeCode(appDto.getTypeCode());
weixinClockDto.setDrawRewardDto(drawRewardDto);
}
}
}
return clockDtoPage == null ? new PageBeanNew() : clockDtoPage;
}
@Override
public WeixinClockDto getWeixinClockBaseInfo(Long weixinClockId) throws BizException {
WeixinClockDto weixinClockDto = weixinClockDao.getWeixinClockBaseInfo(weixinClockId);
if(null != weixinClockDto && null != weixinClockDto.getClockPrizeId() && !weixinClockDto.getClockPrizeId().equals(0L)) {
AppDto appDto = appConsr.getBaseById(weixinClockDto.getClockPrizeId());
DrawRewardDto drawRewardDto = new DrawRewardDto();
drawRewardDto.setAppId(weixinClockDto.getClockPrizeId());
drawRewardDto.setChannelId(appDto.getChannelId());
drawRewardDto.setSquareImg(appDto.getSquareImg());
drawRewardDto.setTitle(appDto.getTitle());
drawRewardDto.setTypeCode(appDto.getTypeCode());
weixinClockDto.setDrawRewardDto(drawRewardDto);
}
return weixinClockDto == null ? new WeixinClockDto() : weixinClockDto;
}
@Override
@ParamLog("获取某个微信群签到打卡的所有群分类详情")
public PageBeanNew<BookGroupClassifyVO> listGroupClassifyDetail4Clock(Long weixinClockId, Integer currentPage, Integer numPerPage) throws BizException {
if(null == weixinClockId) {
throw new BookBizException(BookBizException.ERROR,"缺少微信打卡标识的必要参数!");
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("weixinClockId", weixinClockId);
PageParam pageParam = new PageParam(currentPage, numPerPage);
PageBeanNew<BookGroupClassifyVO> pageBeanNew = weixinClockDao.listPageNew(pageParam, paramMap, "listGroupClassifyDetail4Clock");
if (pageBeanNew == null) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
}
List<BookGroupClassifyVO> bookGroupClassifyVOS = pageBeanNew.getRecordList();
if (!ListUtils.isEmpty(bookGroupClassifyVOS)) {
List<Long> classifyIds = bookGroupClassifyVOS.stream().map(BookGroupClassifyVO::getClassifyId).collect(Collectors.toList());
Map<Long, Integer> activeCountMap = wechatGroupConsr.get7DayActiveUserCountByClassify(classifyIds);
for (BookGroupClassifyVO bookGroupClassifyVO : bookGroupClassifyVOS) {
//最近7天活跃人数
Integer count = activeCountMap.get(bookGroupClassifyVO.getClassifyId());
if (count == null) {
bookGroupClassifyVO.setWeekActiveNumber(0);
} else {
bookGroupClassifyVO.setWeekActiveNumber(count);
}
}
}
return pageBeanNew == null ? new PageBeanNew() : pageBeanNew;
}
@Override
@ParamLog("校验是否为该群的打卡关键字")
public Boolean checkWeixinClockKeyword(String content, String weixinGroupId) throws BizException {
LOGGER.info("content----->"+content+"weixinGroupId----->"+weixinGroupId);
//简单过滤非关键词的词
if (StringUtil.isEmpty(content) || content.length() > 10) {
return false;
}
//通过群id获取对应基本信息
GroupClassifyQrcodeDTO classifyQrcodeInfo = bookGroupClassifyBiz.getClassifyQrcodeInfo(weixinGroupId);
if(null == classifyQrcodeInfo){
return false;
}
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("bookGroupClassifyId",classifyQrcodeInfo.getClassifyId());
String aimKeyword = weixinClockGroupClassifyDao.getKeywordByGroupClassify(paramMap);
LOGGER.info("aimKeyword=" + aimKeyword + "content=" + content);
return content.equalsIgnoreCase(aimKeyword);
}
private String getClockRankUrl(Long adviserId, Long clockPrizeId, String wxGroupId, String wxUserId){
StringBuffer sbu=new StringBuffer();
if(null != clockPrizeId && !clockPrizeId.equals(0L)) {
AppDto appDto = appConsr.getBaseById(clockPrizeId);
AccountSettingDto accountSettingDto = qrcodeSceneConsr.getWechatInfo(appDto.getChannelId());
if (null == accountSettingDto) {
return "";
}
String protocol = accountSettingDto.getProtocol();
if (StringUtils.isEmpty(protocol)) {
protocol = ChannelConstants.HTTP;
}
sbu.append(protocol).append(accountSettingDto.getDomain()).append("/W")
.append(accountSettingDto.getAccountSettingId()).append("/clock").append("?wxGroupId=")
.append(wxGroupId).append("&wxUserId=").append(wxUserId);
return UrlUtils.getShortUrl4Own(sbu.toString());
}
if(null != adviserId && !adviserId.equals(0L)){
Long channelId = adviserConsr.getDefaultChannel(adviserId);
AccountSettingDto accountSettingDto = qrcodeSceneConsr.getWechatInfo(channelId);
if (null == accountSettingDto) {
return "";
}
String protocol = accountSettingDto.getProtocol();
if (StringUtils.isEmpty(protocol)) {
protocol = ChannelConstants.HTTP;
}
sbu.append(protocol).append(accountSettingDto.getDomain()).append("/W")
.append(accountSettingDto.getAccountSettingId()).append("/clock").append("?wxGroupId=")
.append(wxGroupId).append("&wxUserId=").append(wxUserId);
return UrlUtils.getShortUrl4Own(sbu.toString());
}
return "";
}
private String getClockRewardUrl(Long clockPrizeId){
StringBuffer sbu=new StringBuffer();
if(null != clockPrizeId && !clockPrizeId.equals(0L)) {
AppDto appDto = appConsr.getBaseById(clockPrizeId);
AccountSettingDto accountSettingDto = qrcodeSceneConsr.getWechatInfo(appDto.getChannelId());
if(null == accountSettingDto){
return "";
}
String protocol = accountSettingDto.getProtocol();
if (StringUtils.isEmpty(protocol)) {
protocol = ChannelConstants.HTTP;
}
if(accountSettingDto.getRandom() != null) {
sbu.append(protocol).append("app").append(accountSettingDto.getRandom()).append(".").append(accountSettingDto.getFirstDomain())
.append("/luck").append("/W").append(accountSettingDto.getAccountSettingId()).append("/C").append(appDto.getChannelId())
.append("/A").append(appDto.getAppId())
.append("/luckPage?isPreview=1&adviserId=").append(appDto.getCreatedUser()).append("&appType==").append(appDto.getTypeCode())
.append("&origin=wxGroup");
}else{
sbu.append(protocol).append("app.").append(accountSettingDto.getFirstDomain())
.append("/luck").append("/W").append(accountSettingDto.getAccountSettingId()).append("/C").append(appDto.getChannelId())
.append("/A").append(appDto.getAppId())
.append("/luckPage?isPreview=1&adviserId=").append(appDto.getCreatedUser()).append("&appType==").append(appDto.getTypeCode())
.append("&origin=wxGroup");
}
LOGGER.info("抽奖的跳转链接=====" + sbu.toString() + "================s");
return UrlUtils.getShortUrl4Own(sbu.toString());
}
return "";
}
/**
* 发送关键词信息
* @param content
* @param userWxId
* @return
*/
@Override
@ParamLog("为微信群打卡关键词,发送关键词信息")
@Transactional(rollbackFor = Exception.class)
public Boolean sendKeywordMessage(String content, String userWxId,String wechatGroupId, String wxId, String ip) {
LOGGER.info("接受到的关键词信息" + content);
GroupClassifyQrcodeDTO classifyQrcodeInfo = bookGroupClassifyBiz.getClassifyQrcodeInfo(wechatGroupId);
if(null == classifyQrcodeInfo){
return false;
}
WeixinClockDto weixinClockDto = weixinClockGroupClassifyDao.getClockBaseInfoByClassify(classifyQrcodeInfo.getClassifyId());
WeixinClockMember clockMember = weixinClockMemberDao.getByWxUserId(wechatGroupId, userWxId);
AppDto appDto = appConsr.getBaseById(weixinClockDto.getClockPrizeId());
Long channelId = null;
if(null == appDto) {
channelId = adviserConsr.getDefaultChannel(weixinClockDto.getCreateUser());
}else {
channelId = appDto.getChannelId();
}
Long wechatUserId = readerConsr.getWechatUserId(userWxId, channelId);
GroupUserDTO groupUserDTO = wechatGroupConsr.getWxUserInfoByWxUserId(userWxId);
groupUserDTO = null == groupUserDTO ? new GroupUserDTO() : groupUserDTO;
Long weixinClockMemberId = clockMember == null ? null : clockMember.getWeixinClockMemberId();
if(null == clockMember) {
WeixinClockMember weixinClockMember = new WeixinClockMember();
weixinClockMember.setWeixinClockId(weixinClockDto.getWeixinClockId());
weixinClockMember.setAllClockDay(0);
weixinClockMember.setBookGroupClassifyId(classifyQrcodeInfo.getClassifyId());
weixinClockMember.setHeadPic(groupUserDTO.getHeadPic());
weixinClockMember.setNickname(groupUserDTO.getNickName());
weixinClockMember.setWxGroupId(wechatGroupId);
weixinClockMember.setWxUserId(userWxId);
weixinClockMember.setWechatUserId(wechatUserId);
weixinClockMemberDao.insert(weixinClockMember);
weixinClockMemberId = weixinClockMember.getWeixinClockMemberId();
}
SendTextMessageVO vo = new SendTextMessageVO();
vo.setAltId(wxId);
vo.setWxGroupId(wechatGroupId);
vo.setIp(ip);
String sendContent = "";
String nickname = groupUserDTO.getNickName();
if(StringUtil.isEmpty(nickname)){
nickname = "神秘客";
}
WeixinClockTopic weixinTopic = weixinClockTopicDao.getTopicByIds4Today(wechatGroupId, userWxId);
if(null == weixinTopic){
WeixinClockTopic weixinClockTopic = new WeixinClockTopic();
weixinClockTopic.setBookGroupClassifyId(classifyQrcodeInfo.getClassifyId());
weixinClockTopic.setCreatedDay(new Date());
weixinClockTopic.setWeixinClockId(weixinClockDto.getWeixinClockId());
weixinClockTopic.setWxGroupId(wechatGroupId);
weixinClockTopic.setWxUserId(userWxId);
weixinClockTopic.setWeixinClockMemberId(weixinClockMemberId);
weixinClockMemberDao.updateClockDays(wechatGroupId, userWxId, wechatUserId);
weixinClockTopicDao.insert(weixinClockTopic);
//发topic,增加抽奖次数
//发送抽奖的TOPIC
Long clockDays = weixinClockTopicDao.getClockCountByUser(wechatGroupId, userWxId);
if(null != weixinClockDto.getClockPrizeId()) {
if (null != wechatUserId && !wechatUserId.equals(0L)) {
EXECUTOR_SERVICE.execute(() -> {
LOGGER.info("异步校验是否满足抽奖要求,clockDays=" + clockDays);
PromotionOrderDto promotionOrderDto = new PromotionOrderDto();
List<PromotionGiftDto> promotionGiftDtoList = new ArrayList<>();
PromotionGiftDto promotionGiftDto = new PromotionGiftDto();
promotionGiftDto.setTargetClass(PromotionOrderEnum.TARGET_CLASS_APP.getCode());
promotionGiftDto.setTargetType(AppTypeEnum.DRAW.value);
promotionGiftDto.setTargetId(weixinClockDto.getClockPrizeId());
Integer grantNum = weixinClockRewardDao.getGrantNumFromReward(weixinClockDto.getWeixinClockId(), clockDays);
promotionGiftDto.setGrantNum(grantNum == null ? "0" : grantNum.toString());
promotionGiftDtoList.add(promotionGiftDto);
promotionOrderDto.setGifts(promotionGiftDtoList);
promotionOrderDto.setUserId(wechatUserId);
LOGGER.info("发送抽奖规则,参数:promotionOrderDto=" + promotionOrderDto);
amqpTemplate.convertAndSend(MQTopicProducer.EXCHAGE, MQTopicProducer.GIVE_GIFT, promotionOrderDto);
});
} else {
WeixinClockPrizeRecord weixinClockPrizeRecord1 = weixinClockPrizeRecordDao.selectByWxUserIdAndAppId(userWxId, weixinClockDto.getClockPrizeId());
LOGGER.info("weixinClockPrizeRecord1=====" + weixinClockPrizeRecord1);
if (null == weixinClockPrizeRecord1) {
WeixinClockPrizeRecord weixinClockPrizeRecord2 = new WeixinClockPrizeRecord();
weixinClockPrizeRecord2.setClockPrizeId(weixinClockDto.getClockPrizeId());
weixinClockPrizeRecord2.setWxUserId(userWxId);
Integer grantNum = weixinClockRewardDao.getGrantNumFromReward(weixinClockDto.getWeixinClockId(), clockDays);
weixinClockPrizeRecord2.setPrizeTime(grantNum == null ? 0 : grantNum);
LOGGER.info("weixinClockPrizeRecord2------" + weixinClockPrizeRecord2);
weixinClockPrizeRecordDao.insert(weixinClockPrizeRecord2);
} else {
Integer grantNum = weixinClockRewardDao.getGrantNumFromReward(weixinClockDto.getWeixinClockId(), clockDays);
grantNum = grantNum == null ? 0 : grantNum;
weixinClockPrizeRecordDao.updatePrizeTime(userWxId, weixinClockDto.getClockPrizeId(), grantNum);
}
}
}
//获取我的新排名
Integer newOrder = weixinClockMemberDao.getMyNewOrder(wechatGroupId, userWxId);
String clockRewardUrl = getClockRewardUrl(weixinClockDto.getClockPrizeId());
String clockRankUrl = getClockRankUrl(weixinClockDto.getCreateUser(), weixinClockDto.getClockPrizeId(), wechatGroupId, userWxId);
Calendar today = Calendar.getInstance();
int month = today.get(Calendar.MONTH) + 1;
int dayOfMonth = today.get(Calendar.DAY_OF_MONTH);
Integer grantNum = weixinClockRewardDao.getGrantNumFromReward(weixinClockDto.getWeixinClockId(), clockDays);
if(null == weixinClockDto.getClockPrizeId()){
grantNum = 0;
}
if(null != grantNum && !grantNum.equals(0)){
sendContent = "@" + nickname + " "+ weixinClockDto.getClockIntroduction() + "\n" + month + "月" + dayOfMonth + "日打卡成功,你已累积打卡"
+ clockDays + "天,排名第" +
newOrder + ",明天继续!" + "\n" + "\n" + "查看排行榜:" + clockRankUrl + "\n" + "点击抽奖,即可有机会获得精美礼品哦:" + clockRewardUrl;
}else {
sendContent = "@" + nickname + " "+ weixinClockDto.getClockIntroduction() + "\n" + month + "月" + dayOfMonth + "日打卡成功,你已累积打卡"
+ clockDays + "天,排名第" +
newOrder + ",明天继续!" + "\n" + "\n" + "查看排行榜:" + clockRankUrl;
}
} else {
sendContent = "@" + nickname + " ,你今天已经打过卡了,明天再继续!";
}
vo.setContent(sendContent);
LOGGER.info("微信群内加入并打卡:发送微信消息vo="+vo);
WxGroupSDK.sendTextMessage(vo);
return true;
}
/**
* 获取某个群内的打卡排行榜
* @param wxGroupId
* @param wxUserId
* @return
*/
@Override
@ParamLog("获取某个群内的打卡排行榜")
public PageBeanNew<RankDto> listWeixinClockRank(String wxGroupId, String wxUserId, Integer currentPage, Integer numPerPage) {
PageParam pageParam = new PageParam(currentPage, numPerPage);
Map<String, Object> map = new HashMap<>();
map.put("wxGroupId", wxGroupId);
map.put("wxUserId", wxUserId);
PageBeanNew<RankDto> rankDtos = weixinClockMemberDao.listPageNew(pageParam, map, "listWeixinClockRank");
if (null == rankDtos || ListUtils.isEmpty(rankDtos.getRecordList())) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
}
return rankDtos;
}
/**
* 获取某个群内某个用户的信息
* @param wxGroupId
* @param wxUserId
* @return
*/
@Override
@ParamLog("获取某个群内某个用户的信息")
public RankDto getClockWechatUserRank(Long wechatUserId, String wxGroupId, String wxUserId) {
RankDto rankDto = weixinClockMemberDao.getClockWechatUserRank(wechatUserId, wxGroupId);
return null == rankDto ? new RankDto() : rankDto;
}
/**
* 接收到微信用户绑定TOPIC
* @param wechatGroupUser
*/
@Override
@ParamLog("微信用户绑定")
public void receiveWxGroupUserBindTopic(WechatGroupUser wechatGroupUser) {
List<WeixinClockPrizeRecord> weixinClockPrizeRecords = weixinClockPrizeRecordDao.getAllPrizeList(wechatGroupUser.getWxUserId());
PromotionOrderDto promotionOrderDto = new PromotionOrderDto();
List<PromotionGiftDto> promotionGiftDtoList = new ArrayList<>();
for(WeixinClockPrizeRecord weixinClockPrizeRecord : weixinClockPrizeRecords){
PromotionGiftDto promotionGiftDto = new PromotionGiftDto();
promotionGiftDto.setTargetClass(PromotionOrderEnum.TARGET_CLASS_APP.getCode());
promotionGiftDto.setTargetType(AppTypeEnum.DRAW.value);
promotionGiftDto.setTargetId(weixinClockPrizeRecord.getClockPrizeId());
Integer grantNum = weixinClockPrizeRecord.getPrizeTime();
promotionGiftDto.setGrantNum(grantNum == null ? "0" : grantNum.toString());
promotionGiftDtoList.add(promotionGiftDto);
}
promotionOrderDto.setGifts(promotionGiftDtoList);
promotionOrderDto.setUserId(wechatGroupUser.getWechatUserId());
LOGGER.info("发送抽奖规则,参数:promotionOrderDto=" + promotionOrderDto);
amqpTemplate.convertAndSend(MQTopicProducer.EXCHAGE, MQTopicProducer.GIVE_GIFT, promotionOrderDto);
weixinClockPrizeRecordDao.deleteByWxUserId(wechatGroupUser.getWxUserId());
weixinClockMemberDao.updatMemberWechatUserId(wechatGroupUser.getWxUserId(), wechatGroupUser.getWechatUserId());
}
}
package com.pcloud.book.weixinclock.check;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
/**
* @author 杨涛
* @description 检查
* @date 2019/8/20 10:03
*/
public interface WeixinClockCheck {
void checkParam4CreateWeixinClock(WeixinClockDto weixinClockDto);
}
package com.pcloud.book.weixinclock.check.impl;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.clock.entity.BookClockInfo;
import com.pcloud.book.weixinclock.check.WeixinClockCheck;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.string.StringUtil;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author 杨涛
* @description 检查
* @date 2019/8/20 10:19
*/
@Component("weixinClockCheck")
public class WeixinClockCheckImpl implements WeixinClockCheck {
/**
* 创建微信签到打卡时的参数校验
* @param weixinClockDto
*/
@Override
public void checkParam4CreateWeixinClock(WeixinClockDto weixinClockDto) {
if(StringUtil.isEmpty(weixinClockDto.getClockKeyword())){
throw new BookBizException(BookBizException.ERROR,"缺少打卡关键词!");
}
if(StringUtil.isEmpty(weixinClockDto.getClockGuide())){
throw new BookBizException(BookBizException.ERROR,"缺少打卡引导语!");
}
if(StringUtil.isEmpty(weixinClockDto.getClockIntroduction())){
throw new BookBizException(BookBizException.ERROR,"缺少打卡简介!");
}
/*if(null == weixinClockDto.getClockPrizeId()){
throw new BookBizException(BookBizException.ERROR,"缺少打卡的奖励应用ID!");
}*/
}
}
package com.pcloud.book.weixinclock.dao;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
import com.pcloud.book.weixinclock.entity.WeixinClock;
import com.pcloud.common.core.dao.BaseDao;
import java.util.Map;
/**
* @author 杨涛
* @description dao层
* @date 2019/8/14 19:17
*/
public interface WeixinClockDao extends BaseDao<WeixinClock> {
/**
* 删除微信群签到打卡
* @param paramMap
*/
void deleteWeixinClock(Map<String,Object> paramMap);
/**
* 获取微信群签到打卡信息
* @param weixinClockId
*/
WeixinClockDto getWeixinClockBaseInfo(Long weixinClockId);
}
package com.pcloud.book.weixinclock.dao;
import com.pcloud.book.group.vo.StatisticVO;
import com.pcloud.book.weixinclock.dto.ClassifyInfoDto;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
import com.pcloud.book.weixinclock.entity.WeixinClockGroupClassify;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
import java.util.Map;
/**
* @author 杨涛
* @description 群分类
* @date 2019/8/15 11:25
*/
public interface WeixinClockGroupClassifyDao extends BaseDao<WeixinClockGroupClassify> {
/**
* 批量插入
* @param groupClassifyIds
*/
void batchInsert(List<WeixinClockGroupClassify> groupClassifyIds);
/**
* 获取该群分类下的打卡关键字
* @param paramMap
* @return
*/
String getKeywordByGroupClassify (Map<String,Object> paramMap);
/**
* 根据群分类获取某个群的详细信息
* @param bookGroupClassifyId
* @return
*/
WeixinClockDto getClockBaseInfoByClassify(Long bookGroupClassifyId);
/**
* 根据weixinClockId获取群分类等统计
* @param weixinClockId
* @return
*/
StatisticVO getClockGroupStatistics(Long weixinClockId);
/**
* 获取群分类详情
* @param weixinClockId
* @return
*/
List<ClassifyInfoDto> getClassifyInfo4Update(Long weixinClockId);
}
package com.pcloud.book.weixinclock.dao;
import com.pcloud.book.weixinclock.dto.RankDto;
import com.pcloud.book.weixinclock.entity.WeixinClockMember;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* @author 杨涛
* @description TODO
* @date 2019/8/16 9:59
*/
public interface WeixinClockMemberDao extends BaseDao<WeixinClockMember> {
/**
* 获取某个群内的打卡排行榜
* @param wxGroupId
* @return
*/
List<RankDto> listWeixinClockRank(String wxGroupId, String wxUserId);
/**
* 获取某个群内某用户的信息
* @param userWxId
* @return
*/
WeixinClockMember getByWxUserId(String wechatGroupId, String userWxId);
/**
* 更新打卡天数
* @param userWxId
* @return
*/
void updateClockDays(String wechatGroupId, String userWxId, Long wechatUserId);
/**
* 获取的打卡排名(微信群)
* @param wechatGroupId
* @param userWxId
* @return
*/
Integer getMyNewOrder(String wechatGroupId, String userWxId);
/**
* 获取某个群内某个用户的信息
* @param wxGroupId
* @param wechatUserId
* @return
*/
RankDto getClockWechatUserRank(Long wechatUserId, String wxGroupId);
/**
* 同步wechatuserId
* @param wxUserId
* @param wechatUserId
* @return
*/
void updatMemberWechatUserId(String wxUserId, Long wechatUserId);
}
package com.pcloud.book.weixinclock.dao;
import com.pcloud.book.weixinclock.entity.WeixinClockPrizeRecord;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
public interface WeixinClockPrizeRecordDao extends BaseDao<WeixinClockPrizeRecord> {
int deleteByWxUserId(String wxUserId);
WeixinClockPrizeRecord selectByWxUserIdAndAppId(String wxUserId, Long appId);
void updatePrizeTime(String wxUserId, Long clockPrizeId, Integer grantNum);
List<WeixinClockPrizeRecord> getAllPrizeList(String wxUserId);
}
\ No newline at end of file
package com.pcloud.book.weixinclock.dao;
import com.pcloud.book.weixinclock.entity.WeixinClockReward;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* @author 杨涛
* @description 奖励
* @date 2019/8/15 14:04
*/
public interface WeixinClockRewardDao extends BaseDao<WeixinClockReward> {
/**
* 批量插入
* @param weixinClockRewards
*/
void batchInsert(List<WeixinClockReward> weixinClockRewards);
/**
* 获取奖励详情给编辑
* @param weixinClockId
*/
List<WeixinClockReward> listRewardDetail4Adviser(Long weixinClockId);
/**
* 获取奖励次数
* @param weixinClockId
*/
Integer getGrantNumFromReward(Long weixinClockId, Long clockDays);
}
package com.pcloud.book.weixinclock.dao;
import com.pcloud.book.weixinclock.entity.WeixinClockTopic;
import com.pcloud.common.core.dao.BaseDao;
/**
* @author 杨涛
* @description TODO
* @date 2019/8/16 11:39
*/
public interface WeixinClockTopicDao extends BaseDao<WeixinClockTopic> {
/**
* 获取用户今天打卡情况
* @param wxGroupId
* @param wxUserId
* @return
*/
WeixinClockTopic getTopicByIds4Today(String wxGroupId, String wxUserId);
/**
* 获得用户的打卡天数
* @param wxGroupId
* @param wxUserId
* @return
*/
Long getClockCountByUser(String wxGroupId, String wxUserId);
}
package com.pcloud.book.weixinclock.dao.impl;
import com.pcloud.book.weixinclock.dao.WeixinClockDao;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
import com.pcloud.book.weixinclock.entity.WeixinClock;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.Map;
/**
* @author 杨涛
* @description dao层
* @date 2019/8/14 19:18
*/
@Repository("weixinClockDao")
public class WeixinClockDaoImpl extends BaseDaoImpl<WeixinClock> implements WeixinClockDao {
/**
* 删除微信群签到打卡
* @param paramMap
* @return
*/
@Override
public void deleteWeixinClock(Map<String, Object> paramMap) {
super.sqlSessionTemplate.delete(getStatement("deleteWeixinClock"),paramMap);
}
/**
* 获取微信群签到打卡信息
* @param weixinClockId
* @return
*/
@Override
public WeixinClockDto getWeixinClockBaseInfo(Long weixinClockId) {
return super.sqlSessionTemplate.selectOne(getStatement("getWeixinClockBaseInfo"),weixinClockId);
}
}
package com.pcloud.book.weixinclock.dao.impl;
import com.pcloud.book.group.vo.StatisticVO;
import com.pcloud.book.weixinclock.dao.WeixinClockGroupClassifyDao;
import com.pcloud.book.weixinclock.dto.ClassifyInfoDto;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
import com.pcloud.book.weixinclock.entity.WeixinClockGroupClassify;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @author 杨涛
* @description TODO
* @date 2019/8/15 11:25
*/
@Repository("weixinClockGroupClassifyDao")
public class WeixinClockGroupClassifyDaoImpl extends BaseDaoImpl<WeixinClockGroupClassify> implements WeixinClockGroupClassifyDao {
/**
* 批量插入
* @param groupClassifyIds
*/
@Override
public void batchInsert(List<WeixinClockGroupClassify> groupClassifyIds) {
super.sqlSessionTemplate.insert(getStatement("batchInsert"),groupClassifyIds);
}
/**
* 获取该群分类下的打卡关键字
* @param paramMap
* @return
*/
@Override
public String getKeywordByGroupClassify(Map<String, Object> paramMap) {
return super.sqlSessionTemplate.selectOne(getStatement("getKeywordByGroupClassify"),paramMap);
}
/**
* 根据群分类获取某个群的详细信息
* @param bookGroupClassifyId
* @return
*/
@Override
public WeixinClockDto getClockBaseInfoByClassify(Long bookGroupClassifyId) {
return super.sqlSessionTemplate.selectOne(getStatement("getClockBaseInfoByClassify"),bookGroupClassifyId);
}
/**
* 获取打卡统计
* @param weixinClockId
* @return
*/
@Override
public StatisticVO getClockGroupStatistics(Long weixinClockId) {
return this.getSqlSession().selectOne(this.getStatement("getClockGroupStatistics"), weixinClockId);
}
/**
* 获取群分类详情
* @param weixinClockId
* @return
*/
@Override
public List<ClassifyInfoDto> getClassifyInfo4Update(Long weixinClockId) {
return super.sqlSessionTemplate.selectList(getStatement("getClassifyInfo4Update"),weixinClockId);
}
}
package com.pcloud.book.weixinclock.dao.impl;
import com.pcloud.book.weixinclock.dao.WeixinClockMemberDao;
import com.pcloud.book.weixinclock.dto.RankDto;
import com.pcloud.book.weixinclock.entity.WeixinClockMember;
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 杨涛
* @description TODO
* @date 2019/8/16 9:59
*/
@Repository("weixinClockMemberDao")
public class WeixinClockMemberDaoImpl extends BaseDaoImpl<WeixinClockMember> implements WeixinClockMemberDao {
/**
* 获取某个群内的打卡排行榜
* @param wxGroupId
* @return
*/
@Override
public List<RankDto> listWeixinClockRank(String wxGroupId, String wxUserId) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("wxGroupId",wxGroupId);
paramMap.put("wxUserId",wxUserId);
return super.sqlSessionTemplate.selectList(getStatement("listWeixinClockRank"),paramMap);
}
/**
* 获取某个群内某用户的信息
* @param userWxId
* @return
*/
@Override
public WeixinClockMember getByWxUserId(String wechatGroupId, String userWxId) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("wechatGroupId",wechatGroupId);
paramMap.put("userWxId",userWxId);
return super.sqlSessionTemplate.selectOne(getStatement("getByWxUserId"),paramMap);
}
/**
* 更新打卡天数
* @param userWxId
* @return
*/
@Override
public void updateClockDays(String wechatGroupId, String userWxId, Long wechatUserId) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("wechatGroupId",wechatGroupId);
paramMap.put("userWxId",userWxId);
paramMap.put("wechatUserId",wechatUserId);
super.getSqlSession().update(this.getStatement("updateClockDays"), paramMap);
}
/**
* 获取群内最新排名
* @param userWxId
* @return
*/
@Override
public Integer getMyNewOrder(String wechatGroupId, String userWxId){
Map<String, Object> map = new HashMap<>();
map.put("wechatGroupId", wechatGroupId);
map.put("userWxId", userWxId);
return super.getSqlSession().selectOne(getStatement("getMyNewOrder"), map);
}
/**
* 获取某个群内某个用户的信息
* @param wxGroupId
* @return
*/
@Override
public RankDto getClockWechatUserRank(Long wechatUserId, String wxGroupId) {
Map<String, Object> map = new HashMap<>();
map.put("wechatUserId", wechatUserId);
map.put("wechatGroupId", wxGroupId);
return super.getSqlSession().selectOne(getStatement("getClockWechatUserRank"), map);
}
@Override
public void updatMemberWechatUserId(String wxUserId, Long wechatUserId) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("wxUserId",wxUserId);
paramMap.put("wechatUserId",wechatUserId);
super.sqlSessionTemplate.update(getStatement("updatMemberWechatUserId"),paramMap);
}
}
package com.pcloud.book.weixinclock.dao.impl;
import com.pcloud.book.weixinclock.dao.WeixinClockPrizeRecordDao;
import com.pcloud.book.weixinclock.entity.WeixinClockPrizeRecord;
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 杨涛
* @description TODO
* @date 2019/8/23 17:32
*/
@Repository("weixinClockPrizeRecordDao")
public class WeixinClockPrizeRecordDaoImpl extends BaseDaoImpl<WeixinClockPrizeRecord> implements WeixinClockPrizeRecordDao {
@Override
public int deleteByWxUserId(String wxUserId) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("wxUserId",wxUserId);
return super.sqlSessionTemplate.delete(getStatement("deleteByWxUserId"),paramMap);
}
@Override
public WeixinClockPrizeRecord selectByWxUserIdAndAppId(String wxUserId, Long appId) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("wxUserId",wxUserId);
paramMap.put("appId",appId);
return super.sqlSessionTemplate.selectOne(getStatement("selectByWxUserIdAndAppId"),paramMap);
}
@Override
public void updatePrizeTime(String userWxId, Long clockPrizeId, Integer grantNum) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("wxUserId",userWxId);
paramMap.put("appId",clockPrizeId);
paramMap.put("grantNum",grantNum);
super.sqlSessionTemplate.update(getStatement("updatePrizeTime"),paramMap);
}
@Override
public List<WeixinClockPrizeRecord> getAllPrizeList(String wxUserId) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("wxUserId",wxUserId);
return super.sqlSessionTemplate.selectList(getStatement("getAllPrizeList"),paramMap);
}
}
package com.pcloud.book.weixinclock.dao.impl;
import com.pcloud.book.weixinclock.dao.WeixinClockRewardDao;
import com.pcloud.book.weixinclock.entity.WeixinClockReward;
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 杨涛
* @description TODO
* @date 2019/8/15 14:04
*/
@Repository("weixinClockRewardDao")
public class WeixinClockRewardDaoImpl extends BaseDaoImpl<WeixinClockReward> implements WeixinClockRewardDao {
@Override
public void batchInsert(List<WeixinClockReward> weixinClockRewards) {
super.sqlSessionTemplate.insert(getStatement("batchInsert"),weixinClockRewards);
}
@Override
public List<WeixinClockReward> listRewardDetail4Adviser(Long weixinClockId) {
return super.sqlSessionTemplate.selectList(getStatement("listRewardDetail4Adviser"),weixinClockId);
}
@Override
public Integer getGrantNumFromReward(Long weixinClockId, Long clockDays) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("weixinClockId",weixinClockId);
paramMap.put("clockDays",clockDays);
return super.sqlSessionTemplate.selectOne(getStatement("getGrantNumFromReward"),paramMap);
}
}
package com.pcloud.book.weixinclock.dao.impl;
import com.google.common.collect.Maps;
import com.pcloud.book.weixinclock.dao.WeixinClockTopicDao;
import com.pcloud.book.weixinclock.entity.WeixinClockTopic;
import com.pcloud.common.core.dao.BaseDaoImpl;
import com.pcloud.common.utils.DateNewUtils;
import org.springframework.stereotype.Repository;
import java.util.Map;
/**
* @author 杨涛
* @description TODO
* @date 2019/8/16 11:39
*/
@Repository("weixinClockTopicDao")
public class WeixinClockTopicDaoImpl extends BaseDaoImpl<WeixinClockTopic> implements WeixinClockTopicDao {
/**
* 获取用户今天打卡情况
*/
@Override
public WeixinClockTopic getTopicByIds4Today(String wxGroupId, String wxUserId) {
Map<String, Object> paramMap = Maps.newHashMap();
paramMap.put("wxGroupId", wxGroupId);
paramMap.put("wxUserId", wxUserId);
paramMap.put("date", DateNewUtils.getShortDateStr());
return super.getSqlSession().selectOne(getStatement("getTopicByIds4Today"), paramMap);
}
/**
* 获得用户的打卡天数
*/
@Override
public Long getClockCountByUser(String wxGroupId, String wxUserId) {
Map<String, Object> paramMap = Maps.newHashMap();
paramMap.put("wxGroupId", wxGroupId);
paramMap.put("wxUserId", wxUserId);
return super.getSqlSession().selectOne(getStatement("getClockCountByUser"), paramMap);
}
}
package com.pcloud.book.weixinclock.dto;
import com.pcloud.common.dto.BaseDto;
import io.swagger.annotations.ApiModelProperty;
/**
* @author 杨涛
* @description TODO
* @date 2019/8/20 16:39
*/
public class ClassifyInfoDto extends BaseDto {
private static final long serialVersionUID = -2602004619572932040L;
@ApiModelProperty("分类标识")
private Long classifyId;
@ApiModelProperty("群分类")
private String classify;
@ApiModelProperty("群数量")
private Integer groupsCount;
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public String getClassify() {
return classify;
}
public void setClassify(String classify) {
this.classify = classify;
}
public Integer getGroupsCount() {
return groupsCount;
}
public void setGroupsCount(Integer groupsCount) {
this.groupsCount = groupsCount;
}
@Override
public String toString() {
return "ClassifyInfoDto{" +
"classifyId=" + classifyId +
", classify='" + classify + '\'' +
", groupsCount=" + groupsCount +
'}';
}
}
package com.pcloud.book.weixinclock.dto;
import com.pcloud.common.dto.BaseDto;
import io.swagger.annotations.ApiModelProperty;
/**
* @author 杨涛
* @description 抽奖应用信息
* @date 2019/8/16 14:22
*/
public class DrawRewardDto extends BaseDto {
private static final long serialVersionUID = -5223468352278026294L;
@ApiModelProperty("应用标识")
private Long appId;
@ApiModelProperty("渠道标识")
private Long channelId;
@ApiModelProperty("类型")
private String typeCode;
@ApiModelProperty("标题")
private String title;
@ApiModelProperty("封面图")
private String squareImg;
public Long getAppId() {
return appId;
}
public void setAppId(Long appId) {
this.appId = appId;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public String getTypeCode() {
return typeCode;
}
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getSquareImg() {
return squareImg;
}
public void setSquareImg(String squareImg) {
this.squareImg = squareImg;
}
@Override
public String toString() {
return "DrawRewardDto{" +
"appId=" + appId +
", channelId=" + channelId +
", typeCode='" + typeCode + '\'' +
", title='" + title + '\'' +
", squareImg='" + squareImg + '\'' +
'}';
}
}
package com.pcloud.book.weixinclock.dto;
import com.pcloud.common.dto.BaseDto;
import io.swagger.annotations.ApiModelProperty;
/**
* @author 杨涛
* @description TODO
* @date 2019/8/16 17:45
*/
public class RankDto extends BaseDto {
private static final long serialVersionUID = 1717568387924758933L;
@ApiModelProperty("排名")
private Integer rankNum;
@ApiModelProperty("昵称")
private String nickname;
@ApiModelProperty("头像")
private String headPic;
@ApiModelProperty("打卡次数")
private Integer clockNum;
public Integer getRankNum() {
return rankNum;
}
public void setRankNum(Integer rankNum) {
this.rankNum = rankNum;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getHeadPic() {
return headPic;
}
public void setHeadPic(String headPic) {
this.headPic = headPic;
}
public Integer getClockNum() {
return clockNum;
}
public void setClockNum(Integer clockNum) {
this.clockNum = clockNum;
}
@Override
public String toString() {
return "RankDto{" +
"rankNum=" + rankNum +
", nickname='" + nickname + '\'' +
", headPic='" + headPic + '\'' +
", clockNum=" + clockNum +
'}';
}
}
package com.pcloud.book.weixinclock.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.book.group.vo.StatisticVO;
import com.pcloud.book.weixinclock.entity.WeixinClockReward;
import com.pcloud.common.dto.BaseDto;
import java.util.Date;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
/**
* @author 杨涛
* @description dto
* @date 2019/8/15 9:13
*/
public class WeixinClockDto extends BaseDto {
private static final long serialVersionUID = 2919177537250026356L;
@ApiModelProperty("weixinClockId")
private Long weixinClockId;
@ApiModelProperty("群统计信息")
private StatisticVO statisticVO;
@ApiModelProperty("抽奖应用信息")
private DrawRewardDto drawRewardDto;
@ApiModelProperty("打卡奖励集合")
private List<WeixinClockReward> weixinClockRewards;
@ApiModelProperty("群分类详情")
private List<ClassifyInfoDto> classifyInfoDtos;
@ApiModelProperty("群分类集合")
private List<Long> groupClassifyIds;
@ApiModelProperty("打卡关键词")
private String clockKeyword;
@ApiModelProperty("打卡引导语")
private String clockGuide;
@ApiModelProperty("打卡简介")
private String clockIntroduction;
@ApiModelProperty("打卡奖励ID")
private Long clockPrizeId;
@ApiModelProperty("打卡奖励URL")
private String clockPrizeUrl;
@ApiModelProperty("创建人")
private Long createUser;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("创建时间")
private Date createDate;
@ApiModelProperty("最近修改人")
private Long lastModifiedUser;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("最近修改时间")
private Date lastModifiedDate;
public Long getWeixinClockId() {
return weixinClockId;
}
public void setWeixinClockId(Long weixinClockId) {
this.weixinClockId = weixinClockId;
}
public StatisticVO getStatisticVO() {
return statisticVO;
}
public void setStatisticVO(StatisticVO statisticVO) {
this.statisticVO = statisticVO;
}
public DrawRewardDto getDrawRewardDto() {
return drawRewardDto;
}
public void setDrawRewardDto(DrawRewardDto drawRewardDto) {
this.drawRewardDto = drawRewardDto;
}
public List<WeixinClockReward> getWeixinClockRewards() {
return weixinClockRewards;
}
public void setWeixinClockRewards(List<WeixinClockReward> weixinClockRewards) {
this.weixinClockRewards = weixinClockRewards;
}
public List<ClassifyInfoDto> getClassifyInfoDtos() {
return classifyInfoDtos;
}
public void setClassifyInfoDtos(List<ClassifyInfoDto> classifyInfoDtos) {
this.classifyInfoDtos = classifyInfoDtos;
}
public List<Long> getGroupClassifyIds() {
return groupClassifyIds;
}
public void setGroupClassifyIds(List<Long> groupClassifyIds) {
this.groupClassifyIds = groupClassifyIds;
}
public String getClockKeyword() {
return clockKeyword;
}
public void setClockKeyword(String clockKeyword) {
this.clockKeyword = clockKeyword;
}
public String getClockGuide() {
return clockGuide;
}
public void setClockGuide(String clockGuide) {
this.clockGuide = clockGuide;
}
public String getClockIntroduction() {
return clockIntroduction;
}
public void setClockIntroduction(String clockIntroduction) {
this.clockIntroduction = clockIntroduction;
}
public Long getClockPrizeId() {
return clockPrizeId;
}
public void setClockPrizeId(Long clockPrizeId) {
this.clockPrizeId = clockPrizeId;
}
public String getClockPrizeUrl() {
return clockPrizeUrl;
}
public void setClockPrizeUrl(String clockPrizeUrl) {
this.clockPrizeUrl = clockPrizeUrl;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
@Override
public Long getLastModifiedUser() {
return lastModifiedUser;
}
@Override
public void setLastModifiedUser(Long lastModifiedUser) {
this.lastModifiedUser = lastModifiedUser;
}
@Override
public Date getLastModifiedDate() {
return lastModifiedDate;
}
@Override
public void setLastModifiedDate(Date lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
@Override
public String toString() {
return "WeixinClockDto{" +
"weixinClockId=" + weixinClockId +
", statisticVO=" + statisticVO +
", drawRewardDto=" + drawRewardDto +
", weixinClockRewards=" + weixinClockRewards +
", classifyInfoDtos=" + classifyInfoDtos +
", groupClassifyIds=" + groupClassifyIds +
", clockKeyword='" + clockKeyword + '\'' +
", clockGuide='" + clockGuide + '\'' +
", clockIntroduction='" + clockIntroduction + '\'' +
", clockPrizeId=" + clockPrizeId +
", clockPrizeUrl='" + clockPrizeUrl + '\'' +
", createUser=" + createUser +
", createDate=" + createDate +
", lastModifiedUser=" + lastModifiedUser +
", lastModifiedDate=" + lastModifiedDate +
'}';
}
}
package com.pcloud.book.weixinclock.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
/**
* @author 杨涛
* @description 微信打卡
* @date 2019/8/14 19:49
*/
public class WeixinClock extends BaseEntity {
private static final long serialVersionUID = 5405036821243584401L;
@ApiModelProperty("weixinClockId")
private Long weixinClockId;
@ApiModelProperty("打卡关键词")
private String clockKeyword;
@ApiModelProperty("打卡引导语")
private String clockGuide;
@ApiModelProperty("打卡简介")
private String clockIntroduction;
@ApiModelProperty("打卡奖励ID")
private Long clockPrizeId;
@ApiModelProperty("打卡奖励URL")
private String clockPrizeUrl;
@ApiModelProperty("创建人")
private Long createUser;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("创建时间")
private Date createDate;
@ApiModelProperty("最近修改人")
private Long lastModifiedUser;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("最近修改时间")
private Date lastModifiedDate;
public Long getWeixinClockId() {
return weixinClockId;
}
public void setWeixinClockId(Long weixinClockId) {
this.weixinClockId = weixinClockId;
}
public String getClockKeyword() {
return clockKeyword;
}
public void setClockKeyword(String clockKeyword) {
this.clockKeyword = clockKeyword;
}
public String getClockGuide() {
return clockGuide;
}
public void setClockGuide(String clockGuide) {
this.clockGuide = clockGuide;
}
public String getClockIntroduction() {
return clockIntroduction;
}
public void setClockIntroduction(String clockIntroduction) {
this.clockIntroduction = clockIntroduction;
}
public Long getClockPrizeId() {
return clockPrizeId;
}
public void setClockPrizeId(Long clockPrizeId) {
this.clockPrizeId = clockPrizeId;
}
public String getClockPrizeUrl() {
return clockPrizeUrl;
}
public void setClockPrizeUrl(String clockPrizeUrl) {
this.clockPrizeUrl = clockPrizeUrl;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Long getLastModifiedUser() {
return lastModifiedUser;
}
public void setLastModifiedUser(Long lastModifiedUser) {
this.lastModifiedUser = lastModifiedUser;
}
public Date getLastModifiedDate() {
return lastModifiedDate;
}
public void setLastModifiedDate(Date lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
@Override
public String toString() {
return "WeixinClock{" +
"weixinClockId=" + weixinClockId +
", clockKeyword='" + clockKeyword + '\'' +
", clockGuide='" + clockGuide + '\'' +
", clockIntroduction='" + clockIntroduction + '\'' +
", clockPrizeId=" + clockPrizeId +
", clockPrizeUrl='" + clockPrizeUrl + '\'' +
", createUser=" + createUser +
", createDate=" + createDate +
", lastModifiedUser=" + lastModifiedUser +
", lastModifiedDate=" + lastModifiedDate +
'}';
}
}
package com.pcloud.book.weixinclock.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
/**
* @author 杨涛
* @description 群分类
* @date 2019/8/15 11:31
*/
public class WeixinClockGroupClassify extends BaseEntity {
private static final long serialVersionUID = 8053226115622528631L;
@ApiModelProperty("weixinClockGroupClassifyId")
private Long weixinClockGroupClassifyId;
@ApiModelProperty("群分类ID")
private Long bookGroupClassifyId;
@ApiModelProperty("微信群签到打卡ID")
private Long weixinClockId;
public Long getWeixinClockGroupClassifyId() {
return weixinClockGroupClassifyId;
}
public void setWeixinClockGroupClassifyId(Long weixinClockGroupClassifyId) {
this.weixinClockGroupClassifyId = weixinClockGroupClassifyId;
}
public Long getBookGroupClassifyId() {
return bookGroupClassifyId;
}
public void setBookGroupClassifyId(Long bookGroupClassifyId) {
this.bookGroupClassifyId = bookGroupClassifyId;
}
public Long getWeixinClockId() {
return weixinClockId;
}
public void setWeixinClockId(Long weixinClockId) {
this.weixinClockId = weixinClockId;
}
@Override
public String toString() {
return "WeixinClockGroupClassify{" +
"weixinClockGroupClassifyId=" + weixinClockGroupClassifyId +
", bookGroupClassifyId=" + bookGroupClassifyId +
", weixinClockId=" + weixinClockId +
'}';
}
}
package com.pcloud.book.weixinclock.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
/**
* @author 杨涛
* @description 打卡成员
* @date 2019/8/16 9:53
*/
public class WeixinClockMember extends BaseEntity {
private static final long serialVersionUID = 4437962905235665251L;
@ApiModelProperty("主键")
private Long weixinClockMemberId;
@ApiModelProperty("签到打卡标识")
private Long weixinClockId;
@ApiModelProperty("微信用户标识")
private String wxUserId;
@ApiModelProperty("群分类标识")
private Long bookGroupClassifyId;
@ApiModelProperty("群标识")
private String wxGroupId;
@ApiModelProperty("昵称")
private String nickname;
@ApiModelProperty("头像")
private String headPic;
@ApiModelProperty("打卡天数")
private Integer allClockDay;
@ApiModelProperty("微信用户ID")
private Long wechatUserId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("创建时间")
private Date createTime;
public Long getWeixinClockMemberId() {
return weixinClockMemberId;
}
public void setWeixinClockMemberId(Long weixinClockMemberId) {
this.weixinClockMemberId = weixinClockMemberId;
}
public Long getWeixinClockId() {
return weixinClockId;
}
public void setWeixinClockId(Long weixinClockId) {
this.weixinClockId = weixinClockId;
}
public String getWxUserId() {
return wxUserId;
}
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId;
}
public Long getBookGroupClassifyId() {
return bookGroupClassifyId;
}
public void setBookGroupClassifyId(Long bookGroupClassifyId) {
this.bookGroupClassifyId = bookGroupClassifyId;
}
public String getWxGroupId() {
return wxGroupId;
}
public void setWxGroupId(String wxGroupId) {
this.wxGroupId = wxGroupId;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getHeadPic() {
return headPic;
}
public void setHeadPic(String headPic) {
this.headPic = headPic;
}
public Integer getAllClockDay() {
return allClockDay;
}
public void setAllClockDay(Integer allClockDay) {
this.allClockDay = allClockDay;
}
public Long getWechatUserId() {
return wechatUserId;
}
public void setWechatUserId(Long wechatUserId) {
this.wechatUserId = wechatUserId;
}
@Override
public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public String toString() {
return "WeixinClockMember{" +
"weixinClockMemberId=" + weixinClockMemberId +
", weixinClockId=" + weixinClockId +
", wxUserId='" + wxUserId + '\'' +
", bookGroupClassifyId=" + bookGroupClassifyId +
", wxGroupId='" + wxGroupId + '\'' +
", nickname='" + nickname + '\'' +
", headPic='" + headPic + '\'' +
", allClockDay=" + allClockDay +
", wechatUserId=" + wechatUserId +
", createTime=" + createTime +
'}';
}
}
package com.pcloud.book.weixinclock.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
/**
* @author 杨涛
* @description 奖励记录表
* @date 2019/8/23 17:20
*/
public class WeixinClockPrizeRecord extends BaseEntity {
private static final long serialVersionUID = -8507834064618771705L;
@ApiModelProperty("主键标识")
private Long weixinClockPrizeRecordId;
@ApiModelProperty("微信ID")
private String wxUserId;
@ApiModelProperty("微信用户ID")
private Long wechatUserId;
@ApiModelProperty("奖励appId")
private Long clockPrizeId;
@ApiModelProperty("奖励次数")
private Integer prizeTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("创建时间")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("更新时间")
private Date updateTime;
public Long getWeixinClockPrizeRecordId() {
return weixinClockPrizeRecordId;
}
public void setWeixinClockPrizeRecordId(Long weixinClockPrizeRecordId) {
this.weixinClockPrizeRecordId = weixinClockPrizeRecordId;
}
public String getWxUserId() {
return wxUserId;
}
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId;
}
public Long getWechatUserId() {
return wechatUserId;
}
public void setWechatUserId(Long wechatUserId) {
this.wechatUserId = wechatUserId;
}
public Long getClockPrizeId() {
return clockPrizeId;
}
public void setClockPrizeId(Long clockPrizeId) {
this.clockPrizeId = clockPrizeId;
}
public Integer getPrizeTime() {
return prizeTime;
}
public void setPrizeTime(Integer prizeTime) {
this.prizeTime = prizeTime;
}
@Override
public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public Date getUpdateTime() {
return updateTime;
}
@Override
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "WeixinClockPrizeRecord{" +
"weixinClockPrizeRecordId=" + weixinClockPrizeRecordId +
", wxUserId='" + wxUserId + '\'' +
", wechatUserId=" + wechatUserId +
", clockPrizeId=" + clockPrizeId +
", prizeTime=" + prizeTime +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}
package com.pcloud.book.weixinclock.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
/**
* @author 杨涛
* @description TODO
* @date 2019/8/15 14:05
*/
public class WeixinClockReward extends BaseEntity {
private static final long serialVersionUID = 4061202053963659184L;
@ApiModelProperty("微信群签到打卡奖励ID")
private Long weixinClockRewardId;
@ApiModelProperty("微信群签到打卡ID")
private Long weixinClockId;
@ApiModelProperty("获取奖励需要的打卡天数")
private Integer clockDays;
@ApiModelProperty("获取到的抽奖次数")
private Integer rewardNum;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("创建时间")
private Date createTime;
public Long getWeixinClockRewardId() {
return weixinClockRewardId;
}
public void setWeixinClockRewardId(Long weixinClockRewardId) {
this.weixinClockRewardId = weixinClockRewardId;
}
public Long getWeixinClockId() {
return weixinClockId;
}
public void setWeixinClockId(Long weixinClockId) {
this.weixinClockId = weixinClockId;
}
public Integer getClockDays() {
return clockDays;
}
public void setClockDays(Integer clockDays) {
this.clockDays = clockDays;
}
public Integer getRewardNum() {
return rewardNum;
}
public void setRewardNum(Integer rewardNum) {
this.rewardNum = rewardNum;
}
@Override
public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public String toString() {
return "WeixinClockReward{" +
"weixinClockRewardId=" + weixinClockRewardId +
", weixinClockId=" + weixinClockId +
", clockDays=" + clockDays +
", rewardNum=" + rewardNum +
", createTime=" + createTime +
'}';
}
}
package com.pcloud.book.weixinclock.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
/**
* @author 杨涛
* @description 打卡记录
* @date 2019/8/16 10:42
*/
public class WeixinClockTopic extends BaseEntity {
private static final long serialVersionUID = -2573601301200332849L;
@ApiModelProperty("打卡记录标识")
private Long weixinClockTopicId;
@ApiModelProperty("微信群签到打卡标识")
private Long weixinClockId;
@ApiModelProperty("打卡成员标识")
private Long weixinClockMemberId;
@ApiModelProperty("微信用户标识")
private String wxUserId;
@ApiModelProperty("群分类标识")
private Long bookGroupClassifyId;
@ApiModelProperty("微信群标识")
private String wxGroupId;
@ApiModelProperty("打卡日期")
private Date createdDay;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("创建时间")
private Date createTime;
public Long getWeixinClockTopicId() {
return weixinClockTopicId;
}
public void setWeixinClockTopicId(Long weixinClockTopicId) {
this.weixinClockTopicId = weixinClockTopicId;
}
public Long getWeixinClockId() {
return weixinClockId;
}
public void setWeixinClockId(Long weixinClockId) {
this.weixinClockId = weixinClockId;
}
public Long getWeixinClockMemberId() {
return weixinClockMemberId;
}
public void setWeixinClockMemberId(Long weixinClockMemberId) {
this.weixinClockMemberId = weixinClockMemberId;
}
public String getWxUserId() {
return wxUserId;
}
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId;
}
public Long getBookGroupClassifyId() {
return bookGroupClassifyId;
}
public void setBookGroupClassifyId(Long bookGroupClassifyId) {
this.bookGroupClassifyId = bookGroupClassifyId;
}
public String getWxGroupId() {
return wxGroupId;
}
public void setWxGroupId(String wxGroupId) {
this.wxGroupId = wxGroupId;
}
public Date getCreatedDay() {
return createdDay;
}
public void setCreatedDay(Date createdDay) {
this.createdDay = createdDay;
}
@Override
public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public String toString() {
return "WeixinClockTopicDao{" +
"weixinClockTopicId=" + weixinClockTopicId +
", weixinClockId=" + weixinClockId +
", weixinClockMemberId=" + weixinClockMemberId +
", wxUserId='" + wxUserId + '\'' +
", bookGroupClassifyId=" + bookGroupClassifyId +
", wxGroupId='" + wxGroupId + '\'' +
", createdDay=" + createdDay +
", createTime=" + createTime +
'}';
}
}
package com.pcloud.book.weixinclock.facade;
import com.pcloud.book.group.vo.BookGroupClassifyVO;
import com.pcloud.book.group.vo.ListGroupClassifyParam;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.permission.PermissionException;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
/**
* @author 杨涛
* @description 接口层
* @date 2019/8/14 19:15
*/
@FeignClient(value = "pcloud-service-book",qualifier = "weixinClockFacadeCloud",path = "weixinClock")
@Api(description = "微信群签到打卡")
public interface WeixinClockFacade {
@ApiOperation(value = "创建微信群签到打卡", httpMethod = "POST")
@ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "weixinClockDto", value = "微信群签到打卡实体", dataType = "WeixinClockDto", paramType = "body")})
@RequestMapping(value = "createWeixinClock", method = RequestMethod.POST)
ResponseDto<?> createWeixinClock(@RequestHeader("token") String token, @RequestBody WeixinClockDto weixinClockDto)
throws BizException, PermissionException;
@ApiOperation(value = "获取微信群签到打卡信息", httpMethod = "GET")
@ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "weixinClockId", value = "weixinClockId", dataType = "Long", paramType = "query")})
@RequestMapping(value = "getWeixinClockBaseInfo", method = RequestMethod.GET)
ResponseDto<?> getWeixinClockBaseInfo(@RequestHeader("token") String token,
@RequestParam(value = "weixinClockId",required = false) Long weixinClockId)
throws BizException, PermissionException;
@ApiOperation(value = "获取编辑所有的分类", httpMethod = "POST")
@ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "listGroupClassifyParam", value = "获取分类列表参数", dataType = "ListGroupClassifyParam", paramType = "body")})
@RequestMapping(value = "listGroupClassify4Clock", method = RequestMethod.POST)
ResponseDto<PageBeanNew<BookGroupClassifyVO>> listGroupClassify4Clock(@RequestHeader("token") String token, @RequestBody @ApiParam("获取分类列表参数") ListGroupClassifyParam listGroupClassifyParam)
throws PermissionException;
@ApiOperation(value = "修改微信群签到打卡", httpMethod = "POST")
@ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "weixinClockDto", value = "微信群签到打卡实体", dataType = "WeixinClockDto", paramType = "body")})
@RequestMapping(value = "updateWeixinClock", method = RequestMethod.POST)
ResponseDto<?> updateWeixinClock(@RequestHeader("token") String token, @RequestBody WeixinClockDto weixinClockDto)
throws BizException, PermissionException;
@ApiOperation(value = "删除微信群签到打卡", httpMethod = "GET")
@ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "weixinClockId", value = "weixinClockId", dataType = "Long", paramType = "query")})
@RequestMapping(value = "deleteWeixinClock", method = RequestMethod.GET)
ResponseDto<?> deleteWeixinClock(@RequestHeader("token") String token, @RequestParam(value = "weixinClockId",required = false)Long weixinClockId)
throws BizException, PermissionException;
@ApiOperation(value = "微信群签到打卡列表(编辑端)")
@ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "keyword", value = "打卡关键字", dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "Integer", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页大小", dataType = "Integer", paramType = "query")})
@RequestMapping(value = "listWeixinClock4Adviser", method = RequestMethod.GET)
ResponseDto<?> listWeixinClock4Adviser(@RequestHeader("token") String token,
@RequestParam(value = "keyword" ,required = false) String keyword,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws BizException, PermissionException ;
@ApiOperation(value = "获取某个微信群签到打卡的所有群分类详情", httpMethod = "GET")
@ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "weixinClockId", value = "weixinClockId", dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "Integer", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页大小", dataType = "Integer", paramType = "query")
})
@RequestMapping(value = "listGroupClassifyDetail4Clock", method = RequestMethod.GET)
ResponseDto<?> listGroupClassifyDetail4Clock(@RequestHeader("token") String token,
@RequestParam("weixinClockId") Long weixinClockId,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws BizException, PermissionException ;
@ApiOperation("获取某个群内的打卡排行榜")
@ApiImplicitParams({@ApiImplicitParam(name = "userInfo", value = "Cookie", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "wxGroupId", value = "wxGroupId", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "wxUserId", value = "wxUserId", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "Integer", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页大小", dataType = "Integer", paramType = "query")})
@RequestMapping(value = "listWeixinClockRank", method = RequestMethod.GET)
ResponseDto<?> listWeixinClockRank(@CookieValue("userInfo")String userInfo,
@RequestParam(value = "wxGroupId", required = false) String wxGroupId,
@RequestParam(value = "wxUserId", required = false) String wxUserId,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws BizException, PermissionException;
@ApiOperation("获取某个群内某个用户的信息")
@ApiImplicitParams({@ApiImplicitParam(name = "userInfo", value = "Cookie", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "wxGroupId", value = "wxGroupId", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "wxUserId", value = "wxUserId", dataType = "string", paramType = "query")
})
@RequestMapping(value = "getClockWechatUserRank", method = RequestMethod.GET)
ResponseDto<?> getClockWechatUserRank(@CookieValue("userInfo")String userInfo,
@RequestParam(value = "wxGroupId", required = false) String wxGroupId,
@RequestParam(value = "wxUserId", required = false) String wxUserId)
throws BizException, PermissionException;
}
package com.pcloud.book.weixinclock.facade.impl;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.group.vo.BookGroupClassifyVO;
import com.pcloud.book.group.vo.ListGroupClassifyParam;
import com.pcloud.book.weixinclock.biz.WeixinClockBiz;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
import com.pcloud.book.weixinclock.facade.WeixinClockFacade;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
import io.swagger.annotations.ApiParam;
/**
* @author 杨涛
* @description 接口实现层
* @date 2019/8/14 19:15
*/
@RequestMapping("/weixinClock")
@RestController("weixinClockFacade")
public class WeixinClockFacadeImpl implements WeixinClockFacade {
@Autowired
private WeixinClockBiz weixinClockBiz;
/**
* 创建微信群签到打卡
* @param token
* @param weixinClockDto
* @return
* @throws BizException
* @throws PermissionException
*/
@Override
@RequestMapping(value = "createWeixinClock", method = RequestMethod.POST)
public ResponseDto<?> createWeixinClock(@RequestHeader("token") String token,
@RequestBody WeixinClockDto weixinClockDto) throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
weixinClockDto.setCreateUser(adviserId);
weixinClockDto.setLastModifiedUser(adviserId);
return new ResponseDto<>(weixinClockBiz.createWeixinClock(weixinClockDto));
}
/**
* 获取微信群签到打卡信息
* @param token
* @param weixinClockId
* @return
* @throws BizException
* @throws PermissionException
*/
@Override
@RequestMapping(value = "getWeixinClockBaseInfo", method = RequestMethod.GET)
public ResponseDto<?> getWeixinClockBaseInfo(@RequestHeader("token") String token,
@RequestParam(value = "weixinClockId",required = false) Long weixinClockId) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(weixinClockBiz.getWeixinClockBaseInfo(weixinClockId));
}
@Override
@RequestMapping(value = "listGroupClassify4Clock", method = RequestMethod.POST)
public ResponseDto<PageBeanNew<BookGroupClassifyVO>> listGroupClassify4Clock(@RequestHeader("token") String token,
@RequestBody ListGroupClassifyParam listGroupClassifyParam) throws PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
PageBeanNew<BookGroupClassifyVO> pageBeanNew = weixinClockBiz.listGroupClassify4Clock(listGroupClassifyParam, adviserId);
return new ResponseDto<>(pageBeanNew);
}
/**
* 修改微信群签到打卡
* @param token
* @param weixinClockDto
* @return
* @throws BizException
* @throws PermissionException
*/
@Override
@RequestMapping(value = "updateWeixinClock", method = RequestMethod.POST)
public ResponseDto<?> updateWeixinClock(@RequestHeader("token") String token,
@RequestBody WeixinClockDto weixinClockDto) throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if(null == weixinClockDto || null == weixinClockDto.getWeixinClockId()){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数有误");
}
weixinClockDto.setLastModifiedUser(adviserId);
weixinClockBiz.updateWeixinClock(weixinClockDto);
return new ResponseDto<>();
}
/**
* 删除微信群签到打卡
* @param token
* @param weixinClockId
* @return
* @throws BizException
* @throws PermissionException
*/
@Override
@RequestMapping(value = "deleteWeixinClock", method = RequestMethod.GET)
public ResponseDto<?> deleteWeixinClock(@RequestHeader("token") String token,
@RequestParam(value = "weixinClockId",required = false) Long weixinClockId) throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if(null == weixinClockId){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数有误!");
}
weixinClockBiz.deleteWeixinClock(weixinClockId,adviserId);
return new ResponseDto<>();
}
/**
* 微信群签到打卡列表(编辑端)
* @param token
* @param keyword
* @return
* @throws BizException
* @throws PermissionException
*/
@Override
@RequestMapping(value = "listWeixinClock4Adviser", method = RequestMethod.GET)
public ResponseDto<?> listWeixinClock4Adviser(@RequestHeader("token") String token,
@RequestParam(value = "keyword" ,required = false) String keyword,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage) throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if(null == currentPage || null == numPerPage){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"分页参数有误");
}
PageParam pageParam = new PageParam(currentPage,numPerPage);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("keyword", keyword != null && "".equals(keyword.trim()) ? null : keyword);
paramMap.put("adviserId", adviserId);
return new ResponseDto<>(weixinClockBiz.listWeixinClock4Adviser(pageParam, paramMap));
}
/**
* 获取某个微信群签到打卡的所有群分类详情
* @param token
* @param weixinClockId
* @return
* @throws BizException
* @throws PermissionException
*/
@Override
@RequestMapping(value = "listGroupClassifyDetail4Clock", method = RequestMethod.GET)
public ResponseDto<?> listGroupClassifyDetail4Clock(@RequestHeader("token") String token,
@RequestParam("weixinClockId") Long weixinClockId,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
PageBeanNew<BookGroupClassifyVO> pageBeanNew = weixinClockBiz.listGroupClassifyDetail4Clock(weixinClockId, currentPage, numPerPage);
return new ResponseDto<>(pageBeanNew);
}
/**
* 获取某个群内的打卡排行榜
* @param userInfo
* @return
* @throws BizException
* @throws PermissionException
*/
@Override
@RequestMapping(value = "listWeixinClockRank", method = RequestMethod.GET)
public ResponseDto<?> listWeixinClockRank(@CookieValue("userInfo")String userInfo,
@RequestParam(value = "wxGroupId", required = false) String wxGroupId,
@RequestParam(value = "wxUserId", required = false) String wxUserId,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws BizException, PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
return new ResponseDto<>(weixinClockBiz.listWeixinClockRank(wxGroupId, wxUserId, currentPage, numPerPage));
}
/**
* 获取某个群内某个用户的信息
* @param userInfo
* @return
* @throws BizException
* @throws PermissionException
*/
@Override
@RequestMapping(value = "getClockWechatUserRank", method = RequestMethod.GET)
public ResponseDto<?> getClockWechatUserRank(@CookieValue("userInfo")String userInfo,
@RequestParam(value = "wxGroupId", required = false) String wxGroupId,
@RequestParam(value = "wxUserId", required = false) String wxUserId)
throws BizException, PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
return new ResponseDto<>(weixinClockBiz.getClockWechatUserRank(wechatUserId, wxGroupId, wxUserId));
}
}
...@@ -32,15 +32,16 @@ ...@@ -32,15 +32,16 @@
SELECT SELECT
a.id, a.id,
a.ad_news_id adNewsId, a.ad_news_id adNewsId,
c.wechat_name wechatName, d.wechat_name wechatName,
b.title, c.title,
b.short_url shortUrl, c.short_url shortUrl,
a.custom_content customContent, a.custom_content customContent,
a.content_type contentType a.content_type contentType
FROM FROM
ad_news_group_record a ad_news_group_record a
LEFT JOIN ad_news b ON a.ad_news_id=b.id INNER JOIN ad_news_message_statistic b ON a.message_statistic_id=b.id
LEFT JOIN ad_news_wechat c ON b.news_from=c.news_from LEFT JOIN ad_news c ON a.ad_news_id=c.id
LEFT JOIN ad_news_wechat d ON d.news_from=c.news_from AND ((b.content_from=2 AND d.adviser_id=#{partyId,jdbcType=BIGINT}) OR b.content_from <![CDATA[<>]]> 2)
WHERE a.message_statistic_id=#{messageStatisticId,jdbcType=BIGINT} WHERE a.message_statistic_id=#{messageStatisticId,jdbcType=BIGINT}
AND a.create_user=#{partyId,jdbcType=BIGINT} AND a.create_user=#{partyId,jdbcType=BIGINT}
</select> </select>
......
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
</foreach> </foreach>
</insert> </insert>
<!--查找要发送的新闻--> <!--查找要发送的新闻(推荐公众号)-->
<!-- <!--
1、ad_news_ban 排除掉禁止发送的 1、ad_news_ban 排除掉禁止发送的
2、ad_news_group_record 排除掉已发送的 2、ad_news_group_record 排除掉已发送的
...@@ -123,6 +123,25 @@ ...@@ -123,6 +123,25 @@
LIMIT #{top} LIMIT #{top}
</select> </select>
<!--查找要发送的新闻(自有公众号)-->
<!--
1、ad_news_ban 排除掉禁止发送的
2、ad_news_group_record 排除掉已发送的
-->
<select id="getNewsToSendBySetIdAndAdviser4Own" parameterType="map" resultMap="BaseResultMap">
SELECT
a.id, a.type, a.news_from, a.title, a.publisher, a.url, a.short_url, a.news_date, a.create_time
FROM
ad_news a
INNER JOIN ad_news_wechat b ON a.news_from = b.news_from AND b.is_delete = 0 AND b.adviser_id=#{adviserId}
WHERE
NOT EXISTS ( SELECT 1 FROM ad_news_ban e WHERE a.id = e.ad_news_id AND e.adviser_id = #{adviserId} )
AND NOT EXISTS (SELECT 1 from ad_news_group_record f WHERE f.ad_news_id=a.id and f.ad_news_set_id=#{adNewsSetId})
ORDER BY
a.id DESC
LIMIT #{top}
</select>
<!--获取素材库列表--> <!--获取素材库列表-->
<select id="getAdNewsList" parameterType="map" resultType="com.pcloud.book.adnews.entity.AdNews"> <select id="getAdNewsList" parameterType="map" resultType="com.pcloud.book.adnews.entity.AdNews">
SELECT SELECT
...@@ -141,13 +160,20 @@ ...@@ -141,13 +160,20 @@
FROM FROM
ad_news a ad_news a
INNER JOIN ad_news_wechat b on a.news_from=b.news_from and b.is_delete=0 INNER JOIN ad_news_wechat b on a.news_from=b.news_from and b.is_delete=0
<if test="adNewsWechatIds != null and adNewsWechatIds.size()>0"> <choose>
AND b.id IN <when test="contentFrom != null and contentFrom == 2">
<foreach collection="adNewsWechatIds" item="item" index="i" separator="," open="(" close=")"> AND b.adviser_id=#{partyId}
${item} </when>
</foreach> <otherwise>
</if> <if test="adNewsWechatIds != null and adNewsWechatIds.size()>0">
INNER JOIN ad_news_wechat_choose c ON b.id=c.ad_news_wechat_id and c.create_user=#{partyId} and c.is_delete=0 AND b.id IN
<foreach collection="adNewsWechatIds" item="item" index="i" separator="," open="(" close=")">
${item}
</foreach>
</if>
INNER JOIN ad_news_wechat_choose c ON b.id=c.ad_news_wechat_id and c.create_user=#{partyId} and c.is_delete=0
</otherwise>
</choose>
where 1=1 where 1=1
<if test="title!=null"> <if test="title!=null">
AND a.title like concat('%', #{title},'%') AND a.title like concat('%', #{title},'%')
......
<?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.AdNewsWechatDaoImpl"> <mapper namespace="com.pcloud.book.adnews.dao.impl.AdNewsWechatDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsWechat"> <resultMap id="BaseResultMap" type="com.pcloud.book.adnews.entity.AdNewsWechat">
<id column="id" property="id" jdbcType="BIGINT"/> <id column="id" property="id" jdbcType="BIGINT"/>
...@@ -22,12 +22,34 @@ ...@@ -22,12 +22,34 @@
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</select> </select>
<select id="getListByAdviserId" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from ad_news_wechat
where adviser_id = #{adviserId,jdbcType=BIGINT}
AND is_delete=0
</select>
<!--获取公众号列表--> <!--获取公众号列表-->
<select id="getAdNewsWechatList" parameterType="map" resultMap="BaseResultMap"> <select id="getAdNewsWechatList" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> select
from ad_news_wechat <include refid="Base_Column_List"/>
from ad_news_wechat
where where
news_from IS NOT NULL news_from IS NOT NULL
AND adviser_id IS NULL
AND is_delete=0
order by id desc
</select>
<!--获取编辑自有公众号-->
<select id="getAdNewsWechatListForAdviser" parameterType="map" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from ad_news_wechat
where
adviser_id=#{adviserId}
AND is_delete=0
order by id desc order by id desc
</select> </select>
...@@ -48,20 +70,52 @@ ...@@ -48,20 +70,52 @@
AND b.adviser_id = #{partyId} AND b.adviser_id = #{partyId}
WHERE WHERE
a.`news_from` IS NOT NULL a.`news_from` IS NOT NULL
AND a.adviser_id IS NULL
AND a.is_delete=0
</select> </select>
<select id="checkRepeat" parameterType="map" resultType="boolean">
SELECT count(1) FROM ad_news_wechat
WHERE (wechat_name=#{wechatName} AND adviser_id IS NULL)
OR (wechat_name=#{wechatName} AND adviser_id=#{adviserId})
</select>
<select id="existsAdNewsWechat" parameterType="map" resultType="boolean">
SELECT count(1) FROM ad_news_wechat
WHERE adviser_id=#{adviserId}
</select>
<insert id="insert" parameterType="com.pcloud.book.adnews.entity.AdNewsWechat" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="com.pcloud.book.adnews.entity.AdNewsWechat" useGeneratedKeys="true"
keyProperty="id">
insert into ad_news_wechat insert into ad_news_wechat
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
news_from, wechat_name, adviser_id, is_delete, create_time wechat_name, adviser_id, is_delete, create_time
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{newsFrom,jdbcType=VARCHAR},
#{wechatName,jdbcType=VARCHAR}, #{wechatName,jdbcType=VARCHAR},
#{adviserId,jdbcType=BIGINT}, #{adviserId,jdbcType=BIGINT},
#{isDelete,jdbcType=BOOLEAN}, 0,
NOW() NOW()
</trim> </trim>
</insert> </insert>
<insert id="batchInsert" parameterType="list" useGeneratedKeys="true" keyProperty="id">
insert into ad_news_wechat(
wechat_name,
adviser_id,
is_delete,
create_time
)
values
<foreach collection="list" item="item" index="index" separator="," >
(
#{item.wechatName,jdbcType=VARCHAR},
#{item.adviserId,jdbcType=BIGINT},
0,
NOW()
)
</foreach>
</insert>
</mapper> </mapper>
\ No newline at end of file
...@@ -198,5 +198,10 @@ ...@@ -198,5 +198,10 @@
WHERE book_clock_info_id = #{bookClockInfoId} WHERE book_clock_info_id = #{bookClockInfoId}
</delete> </delete>
<select id="getAllClockInfoIds" parameterType="map" resultMap="BaseResultMapDTO">
select <include refid="Base_Column_List"/>
from book_clock_info where origin_type = 'APP'
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -140,5 +140,31 @@ ...@@ -140,5 +140,31 @@
WHERE book_clock_info_id = #{bookClockInfoId} WHERE book_clock_info_id = #{bookClockInfoId}
</delete> </delete>
<select id="getClassifyIdsByBookGroupId" parameterType="map" resultType="Long">
SELECT DISTINCT
t2.id
FROM
book_group_clock t1
LEFT JOIN book_group_classify t2 ON t1.book_group_id = t2.book_group_id
LEFT JOIN weixin_clock_group_classify t3 ON t2.id = t3.book_group_classify_id
WHERE
t2.is_delete = 0
AND t3.weixin_clock_group_classify_id IS NULL
AND t1.book_clock_info_id = #{bookClockInfoId}
</select>
<select id="getClassifyIdsByClassfyId" parameterType="map" resultType="Long">
SELECT DISTINCT
t2.id
FROM
book_group_clock t1
LEFT JOIN book_group_classify t2 ON t1.classify_id = t2.id
LEFT JOIN weixin_clock_group_classify t3 ON t2.id = t3.book_group_classify_id
WHERE
t2.is_delete = 0
AND t3.weixin_clock_group_classify_id IS NULL
AND t1.book_clock_info_id = #{bookClockInfoId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -65,6 +65,18 @@ ...@@ -65,6 +65,18 @@
t.serve_id t.serve_id
</select> </select>
<select id="getClickStatistics" parameterType="map" resultType="com.pcloud.book.group.vo.ResourcesStatisticVO">
select serve_id rescourceId, count(1) browseCount from app_click_record
where book_group_id = #{bookGroupId} and serve_type = #{type}
<if test="classifyId != null">
and classify_id = #{classifyId}
</if>
<if test="qrcodeId!=null">
AND qrcode_id = #{qrcodeId}
</if>
group by serve_id
</select>
<!--获取最近点击--> <!--获取最近点击-->
<select id="getRecentlyClick" parameterType="map" resultType="com.pcloud.book.group.dto.AppClickDTO"> <select id="getRecentlyClick" parameterType="map" resultType="com.pcloud.book.group.dto.AppClickDTO">
select select
...@@ -81,4 +93,81 @@ ...@@ -81,4 +93,81 @@
order by create_time desc order by create_time desc
limit #{top} limit #{top}
</select> </select>
<select id="getClickTrend" parameterType="com.pcloud.book.group.vo.GroupScanTrendParamVO" resultType="com.pcloud.book.group.vo.GroupScanTrendVO">
select DATE_FORMAT(create_time, '%Y-%m-%d') date, count(1) scanCount from app_click_record
where book_group_id = #{bookGroupId}
<if test="classifyId != null">
and classify_id = #{classifyId}
</if>
<if test="wxGroupId != null">
and qrcode_id = #{wxGroupId}
</if>
and create_time &gt;=
<if test="startDate == null">
DATE_FORMAT(SUBDATE(NOW(), INTERVAL #{dayNum} DAY),'%Y-%m-%d')
AND create_time &lt; DATE_FORMAT(now(), '%Y-%m-%d')
</if>
<if test="startDate != null">
DATE_FORMAT(#{startDate},'%Y-%m-%d')
AND create_time &lt;= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
</if>
GROUP BY date
order by date
</select>
<select id="getResourceClick" parameterType="map" resultType="com.pcloud.book.group.vo.ResourceClickVO">
SELECT
t.serve_id rescourceId,
count(1) clickCount
FROM
app_click_record t
WHERE
t.serve_id IN
<foreach collection="rescourceIds" index="index" item="item" close=")" open="(" separator=",">
#{item}
</foreach>
<if test="bookGroupId!=null">
AND t.book_group_id = #{bookGroupId}
</if>
<if test="classifyId!=null">
AND t.classify_id = #{classifyId}
</if>
<if test="qrcodeId!=null">
AND t.qrcode_id = #{qrcodeId}
</if>
<if test="type!=null">
AND t.serve_type = #{type}
</if>
GROUP BY
t.serve_id
</select>
<select id="getRescourceTotalClick" parameterType="map" resultType="long">
select count(1) FROM app_click_record t
WHERE t.book_group_id = #{bookGroupId}
<if test="classifyId!=null">
AND t.classify_id = #{classifyId}
</if>
<if test="qrcodeId!=null">
AND t.qrcode_id = #{qrcodeId}
</if>
<if test="type!=null">
AND t.serve_type = #{type}
</if>
</select>
<select id="getRescourceIds" parameterType="map" resultType="long">
select t.serve_id FROM app_click_record t
WHERE t.book_group_id = #{bookGroupId}
<if test="classifyId!=null">
AND t.classify_id = #{classifyId}
</if>
<if test="qrcodeId!=null">
AND t.qrcode_id = #{qrcodeId}
</if>
<if test="type!=null">
AND t.serve_type = #{type}
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -62,4 +62,8 @@ ...@@ -62,4 +62,8 @@
t.serve_id t.serve_id
order by t.create_time desc order by t.create_time desc
</select> </select>
<select id="getCountByBokkGroupId" parameterType="map" resultType="long">
select count(1) from app_touch_record where book_group_id =#{bookGroupId} and serve_type = #{type}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -183,6 +183,24 @@ ...@@ -183,6 +183,24 @@
id = #{_parameter,jdbcType=BIGINT} id = #{_parameter,jdbcType=BIGINT}
</select> </select>
<resultMap id="getClassifyByIdsMap" type="com.pcloud.book.group.entity.BookGroupClassify">
<result property="id" column="id"/>
<result property="classify" column="classify"/>
</resultMap>
<!--根据id获取分类-->
<select id="getClassifyByIds" parameterType="list" resultMap="getClassifyByIdsMap">
SELECT
id id,classify classify
FROM
book_group_classify
WHERE
is_delete= 0
AND
id IN
<foreach collection="list" index="index" open="(" close=")" item="item" separator=",">
${item}
</foreach>
</select>
<select id="listAllClassifyByRank" resultType="ListClassifyVO" parameterType="Long"> <select id="listAllClassifyByRank" resultType="ListClassifyVO" parameterType="Long">
select select
...@@ -191,7 +209,8 @@ ...@@ -191,7 +209,8 @@
classify_introduce classifyIntroduce, classify_introduce classifyIntroduce,
price, price,
change_number changeNumber, change_number changeNumber,
rank rank,
create_time createdTime
from from
book_group_classify book_group_classify
where where
...@@ -207,7 +226,8 @@ ...@@ -207,7 +226,8 @@
change_number changeNumber, change_number changeNumber,
rank, rank,
count(1) qrcodeNumber, count(1) qrcodeNumber,
SUM(user_number) userNumberTotal SUM(user_number) userNumberTotal,
c.create_time createdTime
from from
book_group_classify c join book_group_qrcode q on c.id = q.classify_id book_group_classify c join book_group_qrcode q on c.id = q.classify_id
where where
...@@ -427,6 +447,55 @@ ...@@ -427,6 +447,55 @@
order by c.id desc, g.id desc order by c.id desc, g.id desc
</select> </select>
<select id="listGroupClassify4Clock" resultType="com.pcloud.book.group.vo.BookGroupClassifyVO" parameterType="map">
SELECT
c.id classifyId,
count(DISTINCT g.id) groupsCount,
c.book_id bookId,
b.BOOK_NAME bookName,
c.classify,
c.book_group_id bookGroupId,
bg.group_qrcode_name groupQrcodeName,
sum(IFNULL(g.user_number,0)) userNumber,
bg.pro_label_id proLabelId,
bg.dep_label_id depLabelId,
bg.pur_label_id purLabelId
FROM book_group_classify c
INNER JOIN book_group_qrcode g ON c.id = g.classify_id
LEFT JOIN BOOK_GROUP bg on bg.id = c.book_group_id
LEFT JOIN book b ON c.book_id = b.book_id
LEFT JOIN weixin_clock_group_classify wc ON c.id = wc.book_group_classify_id
WHERE c.is_delete = 0
AND g.is_delete = 0
AND bg.is_delete = 0
AND b.is_delete = 0
AND wc.weixin_clock_group_classify_id is null
AND c.create_user = #{adviserId}
<if test="bookIds != null">
AND c.book_id IN
<foreach collection = "bookIds" index="index" item = "item" open = "(" separator= "," close = ")">
${item}
</foreach>
</if>
<if test="name != null">
AND (
book_name LIKE CONCAT('%', #{name},'%')
OR c.classify LIKE CONCAT('%', #{name},'%')
)
</if>
<if test="proLabelId!=null">
and bg.pro_label_id=#{proLabelId}
</if>
<if test="depLabelId!=null">
and bg.dep_label_id=#{depLabelId}
</if>
<if test="purLabelId!=null">
and bg.pur_label_id=#{purLabelId}
</if>
group by c.id
order by c.id desc, g.id desc
</select>
<select id="listGroupQrcode4Platform" resultType="GroupQrcodeVO" parameterType="map"> <select id="listGroupQrcode4Platform" resultType="GroupQrcodeVO" parameterType="map">
SELECT SELECT
g.id groupQrcodeId, g.id groupQrcodeId,
...@@ -805,6 +874,16 @@ ...@@ -805,6 +874,16 @@
book_group_classify c join book_group_qrcode q on c.id = q.classify_id book_group_classify c join book_group_qrcode q on c.id = q.classify_id
and q.group_name = #{_parameter} limit 1 and q.group_name = #{_parameter} limit 1
</select> </select>
<select id="getGroupClassifyCount" parameterType="list" resultType="map">
select book_id bookId, count(1) classifyCount, book_group_id bookGroupId from book_group_classify
where is_delete = 0 and book_id in
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
group by book_id
</select>
<!--更新是否开启学习报告--> <!--更新是否开启学习报告-->
<update id="updateHasOpenLearningReport" parameterType="map"> <update id="updateHasOpenLearningReport" parameterType="map">
update book_group_classify set update book_group_classify set
...@@ -814,6 +893,24 @@ ...@@ -814,6 +893,24 @@
where id=#{classifyId} where id=#{classifyId}
</update> </update>
<insert id="addClickClassify" parameterType="map">
insert into book_group_classify_click(book_group_id, classify_id,create_user, create_time)
values(#{bookGroupId},#{classifyId},#{wechatUserId},now())
</insert>
<select id="mapClickClassify" parameterType="map" resultType="com.pcloud.book.group.dto.ClickClassifyDTO">
select classify_id classifyId, count(1) count from book_group_classify_click
where classify_id in
<foreach collection="classifyIds" open="(" close=")" separator="," item="id">
#{id}
</foreach>
group by classify_id
</select>
<select id="getClassifyIngoreDelete" parameterType="long" resultType="com.pcloud.book.group.vo.ListClassifyVO">
select id,classify from book_group_classify where book_group_id = #{bookGroupId}
</select>
<!--获取群分类学习报告相关列表--> <!--获取群分类学习报告相关列表-->
<select id="listClassifyForLearningReport" parameterType="map" resultType="com.pcloud.book.group.dto.ClassifyLearningReportDto"> <select id="listClassifyForLearningReport" parameterType="map" resultType="com.pcloud.book.group.dto.ClassifyLearningReportDto">
SELECT SELECT
...@@ -845,6 +942,7 @@ ...@@ -845,6 +942,7 @@
order by c.id desc order by c.id desc
</select> </select>
<!--拖动排序--> <!--拖动排序-->
<update id="dragSortClassify" parameterType="map"> <update id="dragSortClassify" parameterType="map">
update book_group_classify update book_group_classify
...@@ -859,4 +957,12 @@ ...@@ -859,4 +957,12 @@
#{classifyId} #{classifyId}
</foreach> </foreach>
</update> </update>
<select id="pageClassify" parameterType="map" resultType="com.pcloud.book.group.vo.GroupStatisticVO">
select bgc.id classifyId, bgc.classify classifyName, bgc.price price,sum(user_number) groupPersonCount, bgc.create_time createdTime
from book_group_classify bgc left join book_group_qrcode bgq on bgc.id = bgq.classify_id
where book_group_id = #{bookGroupId}
group by bgc.id
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -88,7 +88,8 @@ ...@@ -88,7 +88,8 @@
<select id="listQrcodeByClassify" resultType="ClassifyQrcodeVO" parameterType="map"> <select id="listQrcodeByClassify" resultType="ClassifyQrcodeVO" parameterType="map">
SELECT SELECT
id, weixin_qrcode_id weixinQrcodeId, weixin_group_id weixinGroupId, group_name groupName, classify_id classifyId, qrcode_url qrcodeUrl, user_number userNumber, ${changeNumber} changeNumber id, weixin_qrcode_id weixinQrcodeId, weixin_group_id weixinGroupId, group_name groupName, classify_id classifyId,
qrcode_url qrcodeUrl, user_number userNumber, ${changeNumber} changeNumber, create_time createdTime
FROM FROM
book_group_qrcode book_group_qrcode
WHERE WHERE
...@@ -500,6 +501,7 @@ ...@@ -500,6 +501,7 @@
</foreach> </foreach>
</select> </select>
<select id="listPageRiddle" parameterType="map" resultType="com.pcloud.book.riddle.dto.GroupRiddleDTO"> <select id="listPageRiddle" parameterType="map" resultType="com.pcloud.book.riddle.dto.GroupRiddleDTO">
SELECT SELECT
q.group_name AS groupName, q.group_name AS groupName,
...@@ -541,4 +543,10 @@ ...@@ -541,4 +543,10 @@
id = #{qrcodeId} id = #{qrcodeId}
</update> </update>
<select id="getQrcodeByClassify" parameterType="long" resultType="com.pcloud.book.group.vo.ClassifyQrcodeVO">
select id, classify_id classifyId, group_name groupName, user_number userNumber, weixin_group_id weixinGroupId, create_time createdTime
from book_group_qrcode where classify_id = #{classifyId}
</select>
</mapper> </mapper>
\ No newline at end of file
<?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.weixinclock.dao.impl.WeixinClockDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.weixinclock.entity.WeixinClock">
<id column="weixin_clock_id" property="weixinClockId" jdbcType="BIGINT"/>
<result column="clock_keyword" property="clockKeyword" jdbcType="VARCHAR"/>
<result column="clock_guide" property="clockGuide" jdbcType="VARCHAR"/>
<result column="clock_introduction" property="clockIntroduction" jdbcType="VARCHAR"/>
<result column="clock_prize_id" property="clockPrizeId" jdbcType="BIGINT"/>
<result column="clock_prize_url" property="clockPrizeUrl" jdbcType="VARCHAR"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_date" property="createDate" jdbcType="TIMESTAMP"/>
<result column="last_modified_user" property="lastModifiedUser" jdbcType="BIGINT"/>
<result column="last_modified_date" property="lastModifiedDate" jdbcType="TIMESTAMP"/>
</resultMap>
<resultMap id="BaseResultListMapDTO" type="com.pcloud.book.weixinclock.dto.WeixinClockDto">
<id column="weixin_clock_id" property="weixinClockId" jdbcType="BIGINT"/>
<result column="clock_keyword" property="clockKeyword" jdbcType="VARCHAR"/>
<result column="clock_guide" property="clockGuide" jdbcType="VARCHAR"/>
<result column="clock_introduction" property="clockIntroduction" jdbcType="VARCHAR"/>
<result column="clock_prize_id" property="clockPrizeId" jdbcType="BIGINT"/>
<result column="clock_prize_url" property="clockPrizeUrl" jdbcType="VARCHAR"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_date" property="createDate" jdbcType="TIMESTAMP"/>
<result column="last_modified_user" property="lastModifiedUser" jdbcType="BIGINT"/>
<result column="last_modified_date" property="lastModifiedDate" jdbcType="TIMESTAMP"/>
<association property="statisticVO" column="weixin_clock_id"
select="com.pcloud.book.weixinclock.dao.impl.WeixinClockGroupClassifyDaoImpl.getClockGroupStatistics" />
</resultMap>
<resultMap id="ClockBaseInfoMap" type="com.pcloud.book.weixinclock.dto.WeixinClockDto">
<id column="weixin_clock_id" property="weixinClockId" jdbcType="BIGINT"/>
<result column="clock_keyword" property="clockKeyword" jdbcType="VARCHAR"/>
<result column="clock_guide" property="clockGuide" jdbcType="VARCHAR"/>
<result column="clock_introduction" property="clockIntroduction" jdbcType="VARCHAR"/>
<result column="clock_prize_id" property="clockPrizeId" jdbcType="BIGINT"/>
<result column="clock_prize_url" property="clockPrizeUrl" jdbcType="VARCHAR"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_date" property="createDate" jdbcType="TIMESTAMP"/>
<result column="last_modified_user" property="lastModifiedUser" jdbcType="BIGINT"/>
<result column="last_modified_date" property="lastModifiedDate" jdbcType="TIMESTAMP"/>
<association property="statisticVO" column="weixin_clock_id"
select="com.pcloud.book.weixinclock.dao.impl.WeixinClockGroupClassifyDaoImpl.getClockGroupStatistics" />
<collection property="weixinClockRewards" column="weixin_clock_id"
select="com.pcloud.book.weixinclock.dao.impl.WeixinClockRewardDaoImpl.listRewardDetail4Adviser" />
<collection property="classifyInfoDtos" column="weixin_clock_id"
select="com.pcloud.book.weixinclock.dao.impl.WeixinClockGroupClassifyDaoImpl.getClassifyInfo4Update" />
</resultMap>
<sql id="Base_Column_List">
weixin_clock_id, clock_keyword, clock_guide, clock_introduction, clock_prize_id, clock_prize_url, create_user, create_date,
last_modified_user, last_modified_date
</sql>
<insert id="insert" parameterType="weixinClock" useGeneratedKeys="true" keyProperty="weixinClockId" flushCache="true">
INSERT INTO weixin_clock (
clock_keyword, clock_guide, clock_introduction, clock_prize_id, clock_prize_url, create_user, create_date,
last_modified_user, last_modified_date
)
VALUES (
#{clockKeyword, jdbcType=VARCHAR}, #{clockGuide, jdbcType=VARCHAR}, #{clockIntroduction, jdbcType=VARCHAR}, #{clockPrizeId, jdbcType=BIGINT},
#{clockPrizeUrl, jdbcType=VARCHAR}, #{createUser, jdbcType=VARCHAR}, NOW(), #{lastModifiedUser, jdbcType=BIGINT}, NOW()
)
</insert>
<!-- 获取基本信息-->
<select id="getBaseInfoById" parameterType="long" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM weixin_clock
WHERE weixin_clock_id = #{weixinClockId}
LIMIT 1
</select>
<!--修改微信群签到打卡-->
<update id="update" parameterType="weixinClock">
UPDATE weixin_clock
<set>
<if test="clockKeyword != null">
clock_keyword = #{clockKeyword, jdbcType=VARCHAR},
</if>
<if test="clockGuide != null">
clock_guide = #{clockGuide, jdbcType=VARCHAR},
</if>
<if test="clockIntroduction != null">
clock_introduction = #{clockIntroduction, jdbcType=VARCHAR},
</if>
<if test="clockPrizeId != null">
clock_prize_id = #{clockPrizeId, jdbcType=BIGINT},
</if>
<if test="clockPrizeUrl != null">
clock_prize_url = #{clockPrizeUrl, jdbcType=VARCHAR},
</if>
<if test="lastModifiedUser != null">
last_modified_user = #{lastModifiedUser, jdbcType=BIGINT},
</if>
last_modified_date = NOW()
</set>
WHERE weixin_clock_id = #{weixinClockId}
</update>
<!--删除微信群签到打卡-->
<delete id="deleteWeixinClock" parameterType="map">
DELETE FROM weixin_clock
WHERE weixin_clock_id = #{weixinClockId}
</delete>
<select id="listWeixinClock4Adviser" parameterType="map" resultMap="BaseResultListMapDTO">
SELECT weixin_clock_id, clock_keyword, clock_guide, clock_introduction,
clock_prize_id, clock_prize_url, create_user, create_date, last_modified_user, last_modified_date
FROM
weixin_clock
WHERE create_user = #{adviserId}
<if test="keyword != null">
and (clock_keyword like CONCAT('%', #{keyword}, '%'))
</if>
order by last_modified_date desc
</select>
<select id="getWeixinClockBaseInfo" parameterType="Long" resultMap="ClockBaseInfoMap">
SELECT weixin_clock_id, clock_keyword, clock_guide, clock_introduction,
clock_prize_id, clock_prize_url, create_user, create_date, last_modified_user, last_modified_date
FROM
weixin_clock
WHERE
weixin_clock_id = #{weixinClockId}
</select>
<select id="listGroupClassifyDetail4Clock" resultType="com.pcloud.book.group.vo.BookGroupClassifyVO" parameterType="map">
SELECT
c.id classifyId,
c.book_id bookId,
b.BOOK_NAME bookName,
c.classify,
c.book_group_id bookGroupId,
sum(IFNULL(g.user_number,0)) userNumber
FROM weixin_clock_group_classify wcg
INNER JOIN book_group_classify c ON wcg.book_group_classify_id = c.id
INNER JOIN book_group_qrcode g ON c.id = g.classify_id
LEFT JOIN book b ON c.book_id = b.book_id
WHERE c.is_delete = 0
AND g.is_delete = 0
AND b.is_delete = 0
AND wcg.weixin_clock_id = #{weixinClockId}
group by c.id
order by c.id desc, g.id desc
</select>
</mapper>
\ No newline at end of file
<?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.weixinclock.dao.impl.WeixinClockGroupClassifyDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.weixinclock.entity.WeixinClockGroupClassify">
<id column="weixin_clock_group_classify_id" property="weixinClockGroupClassifyId" jdbcType="BIGINT"/>
<result column="book_group_classify_id" property="bookGroupClassifyId" jdbcType="BIGINT"/>
<result column="weixin_clock_id" property="weixinClockId" jdbcType="BIGINT"/>
</resultMap>
<resultMap id="ClockBaseInfoMap" type="com.pcloud.book.weixinclock.dto.WeixinClockDto">
<id column="weixin_clock_id" property="weixinClockId" jdbcType="BIGINT"/>
<result column="clock_keyword" property="clockKeyword" jdbcType="VARCHAR"/>
<result column="clock_guide" property="clockGuide" jdbcType="VARCHAR"/>
<result column="clock_introduction" property="clockIntroduction" jdbcType="VARCHAR"/>
<result column="clock_prize_id" property="clockPrizeId" jdbcType="BIGINT"/>
<result column="clock_prize_url" property="clockPrizeUrl" jdbcType="VARCHAR"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_date" property="createDate" jdbcType="TIMESTAMP"/>
<result column="last_modified_user" property="lastModifiedUser" jdbcType="BIGINT"/>
<result column="last_modified_date" property="lastModifiedDate" jdbcType="TIMESTAMP"/>
<collection property="weixinClockRewards" column="weixin_clock_id"
select="com.pcloud.book.weixinclock.dao.impl.WeixinClockRewardDaoImpl.listRewardDetail4Adviser" />
</resultMap>
<insert id="batchInsert" parameterType="weixinClockGroupClassify" useGeneratedKeys="true" keyProperty="weixinClockGroupClassifyId" flushCache="true">
insert into weixin_clock_group_classify (
book_group_classify_id,
weixin_clock_id
) values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.bookGroupClassifyId,jdbcType=BIGINT},
#{item.weixinClockId,jdbcType=INTEGER}
)
</foreach>
</insert>
<select id="getKeywordByGroupClassify" parameterType="map" resultType="String">
SELECT
wc.clock_keyword
FROM
weixin_clock_group_classify wcc
LEFT JOIN weixin_clock wc ON wcc.weixin_clock_id = wc.weixin_clock_id
WHERE
wcc.book_group_classify_id = #{bookGroupClassifyId}
ORDER BY wc.create_date DESC
LIMIT 1
</select>
<select id="getClockBaseInfoByClassify" parameterType="map" resultMap="ClockBaseInfoMap">
SELECT
wc.weixin_clock_id, wc.clock_keyword, wc.clock_guide, wc.clock_introduction, wc.clock_prize_id, wc.clock_prize_url, wc.create_user, wc.create_date,
wc.last_modified_user, wc.last_modified_date
FROM
weixin_clock_group_classify wcc
LEFT JOIN weixin_clock wc ON wcc.weixin_clock_id = wc.weixin_clock_id
WHERE
wcc.book_group_classify_id = #{bookGroupClassifyId}
ORDER BY wc.create_date DESC
LIMIT 1
</select>
<!--获取打卡群统计信息-->
<select id="getClockGroupStatistics" parameterType="Long" resultType="com.pcloud.book.group.vo.StatisticVO">
SELECT
COUNT(DISTINCT t1.book_group_classify_id) classifyCount,
COUNT(DISTINCT t2.id) groupNumber
FROM
weixin_clock_group_classify t1
INNER JOIN book_group_qrcode t2 ON t1.book_group_classify_id = t2.classify_id
WHERE
t2.is_delete = 0
AND t1.weixin_clock_id = #{weixinClockId}
</select>
<!-- 删除书籍应用关联信息 -->
<delete id="deleteById" parameterType="long" flushCache="true">
DELETE FROM
weixin_clock_group_classify
WHERE
weixin_clock_id = #{weixinClockId}
</delete>
<select id="getClassifyInfo4Update" parameterType="long" resultType="com.pcloud.book.weixinclock.dto.ClassifyInfoDto">
SELECT
c.id classifyId,
c.classify classify,
count(DISTINCT g.id) groupsCount
FROM
weixin_clock_group_classify wc
LEFT JOIN book_group_classify c ON c.id = wc.book_group_classify_id
LEFT JOIN book_group_qrcode g ON c.id = g.classify_id
WHERE c.is_delete = 0
AND g.is_delete = 0
AND wc.weixin_clock_id = #{weixinClockId}
group by c.id
order by c.id desc, g.id desc
</select>
</mapper>
\ No newline at end of file
<?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.weixinclock.dao.impl.WeixinClockMemberDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.weixinclock.entity.WeixinClockMember">
<id column="weixin_clock_member_id" property="weixinClockMemberId" jdbcType="BIGINT"/>
<result column="weixin_clock_id" property="weixinClockId" jdbcType="BIGINT"/>
<result column="wx_user_id" property="wxUserId" jdbcType="VARCHAR"/>
<result column="book_group_classify_id" property="bookGroupClassifyId" jdbcType="BIGINT"/>
<result column="wx_group_id" property="wxGroupId" jdbcType="VARCHAR"/>
<result column="nickname" property="nickname" jdbcType="VARCHAR"/>
<result column="head_pic" property="headPic" jdbcType="VARCHAR"/>
<result column="all_clock_day" property="allClockDay" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
weixin_clock_member_id, weixin_clock_id, wx_user_id, book_group_classify_id, wx_group_id, nickname, head_pic, all_clock_day,
create_time
</sql>
<insert id="insert" parameterType="weixinClockMember" useGeneratedKeys="true" keyProperty="weixinClockMemberId" flushCache="true">
INSERT INTO weixin_clock_member (
weixin_clock_id, wx_user_id, book_group_classify_id, wx_group_id, nickname, head_pic, all_clock_day,
create_time, update_time,wechat_user_id
)
VALUES (
#{weixinClockId, jdbcType=BIGINT}, #{wxUserId, jdbcType=VARCHAR}, #{bookGroupClassifyId, jdbcType=BIGINT}, #{wxGroupId, jdbcType=VARCHAR},
#{nickname, jdbcType=VARCHAR}, #{headPic, jdbcType=VARCHAR}, #{allClockDay, jdbcType=INTEGER}, NOW(), NOW(),#{wechatUserId, jdbcType=BIGINT}
)
</insert>
<select id="listWeixinClockRank" parameterType="map" resultType="com.pcloud.book.weixinclock.dto.RankDto">
SELECT
w.all_clock_day clockNum, w.nickname nickname, w.head_pic headPic, (@i :=@i + 1) rankNum
FROM
weixin_clock_member w,
(SELECT @i := 0) i
WHERE
w.wx_group_id = #{wxGroupId, jdbcType=VARCHAR}
AND (w.all_clock_day <![CDATA[ >]]> 0 or w.wx_user_id = #{wxUserId, jdbcType=VARCHAR})
ORDER BY w.all_clock_day DESC
</select>
<select id="getByWxUserId" parameterType="map" resultMap="BaseResultMap">
select
weixin_clock_member_id, weixin_clock_id, wx_user_id, book_group_classify_id, wx_group_id, nickname, head_pic, all_clock_day, create_time
from
weixin_clock_member
where
wx_user_id = #{userWxId}
and wx_group_id = #{wechatGroupId}
LIMIT 1
</select>
<update id="updateClockDays" parameterType="map" flushCache="true">
update weixin_clock_member
set
all_clock_day = all_clock_day + 1,
wechat_user_id = #{wechatUserId, jdbcType=BIGINT},
update_time = NOW()
where
wx_user_id = #{userWxId}
and wx_group_id = #{wechatGroupId}
</update>
<select id="getMyNewOrder" parameterType="map" resultType="java.lang.Integer">
select cm.rowNo from (
select wx_user_id, (@rowNum:=@rowNum+1) AS rowNo from (
select wx_user_id, @rowNum:=0 from weixin_clock_member
where wx_group_id = #{wechatGroupId}
AND (all_clock_day <![CDATA[ >]]> 0 or wx_user_id = #{userWxId, jdbcType=VARCHAR})
order by all_clock_day desc, update_time asc
) a
) cm where cm.wx_user_id = #{userWxId}
</select>
<select id="getClockWechatUserRank" parameterType="map" resultType="com.pcloud.book.weixinclock.dto.RankDto">
select cm.rankNum rankNum, cm.clockNum clockNum, cm.nickname nickname, cm.headPic headPic from (
select wx_user_id, (@rowNum:=@rowNum+1) AS rankNum, all_clock_day clockNum, nickname nickname, head_pic headPic, wechat_user_id from (
select wx_user_id, all_clock_day, nickname, head_pic, wechat_user_id, @rowNum:=0 from weixin_clock_member
where wx_group_id = #{wechatGroupId}
AND (all_clock_day <![CDATA[ >]]> 0 or wechat_user_id = #{wechatUserId, jdbcType=VARCHAR})
order by all_clock_day desc, update_time asc
) a
) cm where cm.wechat_user_id = #{wechatUserId}
LIMIT 1
</select>
<update id="updatMemberWechatUserId" parameterType="map">
update weixin_clock_member
set wechat_user_id = #{wechatUserId,jdbcType=BIGINT},
update_time = NOW()
where wx_user_id = #{wxUserId,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
<?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.weixinclock.dao.impl.WeixinClockPrizeRecordDaoImpl" >
<resultMap id="BaseResultMap" type="com.pcloud.book.weixinclock.entity.WeixinClockPrizeRecord" >
<id column="weixin_clock_prize_record_id" property="weixinClockPrizeRecordId" jdbcType="BIGINT" />
<result column="wx_user_id" property="wxUserId" jdbcType="VARCHAR" />
<result column="wechat_user_id" property="wechatUserId" jdbcType="BIGINT" />
<result column="clock_prize_id" property="clockPrizeId" jdbcType="BIGINT" />
<result column="prize_time" property="prizeTime" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
weixin_clock_prize_record_id, wx_user_id, wechat_user_id, clock_prize_id, prize_time,
create_time, update_time
</sql>
<select id="selectByWxUserIdAndAppId" resultMap="BaseResultMap" parameterType="map" >
select
<include refid="Base_Column_List" />
from weixin_clock_prize_record
where wx_user_id = #{wxUserId,jdbcType=VARCHAR}
and clock_prize_id = #{appId}
LIMIT 1
</select>
<insert id="insert" parameterType="com.pcloud.book.weixinclock.entity.WeixinClockPrizeRecord" >
insert into weixin_clock_prize_record (wx_user_id,wechat_user_id, clock_prize_id, prize_time,
create_time, update_time)
values ( #{wxUserId,jdbcType=VARCHAR},#{wechatUserId,jdbcType=BIGINT}, #{clockPrizeId,jdbcType=BIGINT}, #{prizeTime,jdbcType=INTEGER},
NOW(), NOW())
</insert>
<update id="updatePrizeTime" parameterType="map">
update weixin_clock_prize_record
set prize_time = prize_time + #{prizeTime,jdbcType=INTEGER},
update_time = NOW()
where wx_user_id = #{wxUserId,jdbcType=VARCHAR}
and clock_prize_id = #{appId}
</update>
<select id="getAllPrizeList" parameterType="map" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from weixin_clock_prize_record
where wx_user_id = #{wxUserId,jdbcType=VARCHAR}
</select>
<delete id="deleteByWxUserId" parameterType="map" >
delete from weixin_clock_prize_record
where wx_user_id = #{wxUserId,jdbcType=VARCHAR}
</delete>
</mapper>
\ No newline at end of file
<?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.weixinclock.dao.impl.WeixinClockRewardDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.weixinclock.entity.WeixinClockReward">
<id column="weixin_clock_reward_id" property="weixinClockRewardId" jdbcType="BIGINT"/>
<result column="weixin_clock_id" property="weixinClockId" jdbcType="BIGINT"/>
<result column="clock_days" property="clockDays" jdbcType="INTEGER"/>
<result column="reward_num" property="rewardNum" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<insert id="batchInsert" parameterType="weixinClockReward" useGeneratedKeys="true" keyProperty="weixinClockRewardId" flushCache="true">
insert into weixin_clock_reward (
weixin_clock_id,
clock_days,
reward_num,
create_time
) values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.weixinClockId,jdbcType=BIGINT},
#{item.clockDays,jdbcType=INTEGER},
#{item.rewardNum,jdbcType=INTEGER},
NOW()
)
</foreach>
</insert>
<select id="listRewardDetail4Adviser" parameterType="long" resultMap="BaseResultMap">
SELECT clock_days,reward_num
FROM weixin_clock_reward
WHERE weixin_clock_id = #{weixinClockId}
ORDER BY clock_days asc
</select>
<!-- 删除书籍应用关联信息 -->
<delete id="deleteById" parameterType="long" flushCache="true">
DELETE FROM
weixin_clock_reward
WHERE
weixin_clock_id = #{weixinClockId}
</delete>
<select id="getGrantNumFromReward" parameterType="map" resultType="Integer">
select reward_num
from weixin_clock_reward
WHERE weixin_clock_id = #{weixinClockId}
AND clock_days = #{clockDays}
LIMIT 1
</select>
</mapper>
\ No newline at end of file
<?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.weixinclock.dao.impl.WeixinClockTopicDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.weixinclock.entity.WeixinClockTopic">
<id column="weixin_clock_topic_id" property="weixinClockTopicId" jdbcType="BIGINT"/>
<result column="weixin_clock_id" property="weixinClockId" jdbcType="BIGINT"/>
<result column="weixin_clock_member_id" property="weixinClockMemberId" jdbcType="BIGINT"/>
<result column="wx_user_id" property="wxUserId" jdbcType="VARCHAR"/>
<result column="book_group_classify_id" property="bookGroupClassifyId" jdbcType="BIGINT"/>
<result column="wx_group_id" property="wxGroupId" jdbcType="VARCHAR"/>
<result column="created_day" property="createdDay" jdbcType="DATE"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
weixin_clock_topic_id, weixin_clock_id, weixin_clock_member_id, wx_user_id, book_group_classify_id, wx_group_id, created_day, create_time
</sql>
<insert id="insert" parameterType="weixinClockTopic" useGeneratedKeys="true" keyProperty="weixinClockTopicId" flushCache="true">
INSERT INTO weixin_clock_topic (
weixin_clock_id, weixin_clock_member_id, wx_user_id, book_group_classify_id, wx_group_id, created_day, create_time
)
VALUES (
#{weixinClockId, jdbcType=BIGINT}, #{weixinClockMemberId, jdbcType=BIGINT}, #{wxUserId, jdbcType=VARCHAR}, #{bookGroupClassifyId, jdbcType=BIGINT},
#{wxGroupId, jdbcType=VARCHAR}, #{createdDay, jdbcType=DATE}, NOW()
)
</insert>
<!-- 获取用户今天打卡情况 -->
<select id="getTopicByIds4Today" resultMap="BaseResultMap" parameterType="map">
select
<include refid="Base_Column_List"/>
from weixin_clock_topic
where
wx_group_id = #{wxGroupId, jdbcType=VARCHAR}
and wx_user_id = #{wxUserId, jdbcType=VARCHAR}
AND CREATED_DAY = #{date}
LIMIT 1
</select>
<!-- 获得该用户的打卡天数 -->
<select id="getClockCountByUser" parameterType="map" resultType="long">
SELECT
count(DISTINCT CREATED_DAY)
FROM
weixin_clock_topic
WHERE
wx_group_id = #{wxGroupId, jdbcType=VARCHAR}
AND wx_user_id = #{wxUserId, jdbcType=VARCHAR}
<if test="createdDay != null">
AND CREATED_DAY = #{createdDay,jdbcType=VARCHAR}
</if>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author>蒙娇</Author>
<LastAuthor>林伟彬</LastAuthor>
<Created>2017-06-27T08:48:00Z</Created>
<LastSaved>2017-07-16T07:06:45Z</LastSaved>
<Version>15.00</Version>
</DocumentProperties>
<CustomDocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<KSOProductBuildVer dt:dt="string">2052-10.1.0.6489</KSOProductBuildVer>
</CustomDocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<AllowPNG/>
</OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>11388</WindowHeight>
<WindowWidth>22944</WindowWidth>
<WindowTopX>0</WindowTopX>
<WindowTopY>0</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Center"/>
<Borders/>
<Font ss:FontName="宋体" x:CharSet="134" ss:Size="11" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="m2113688147332">
<Alignment ss:Horizontal="Center" ss:Vertical="Center"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
</Borders>
<Font ss:FontName="宋体" x:CharSet="134" ss:Size="14" ss:Color="#000000"
ss:Bold="1"/>
</Style>
<Style ss:ID="m2113688147372">
<Alignment ss:Horizontal="Left" ss:Vertical="Center"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
</Borders>
<Font ss:FontName="宋体" x:CharSet="134" ss:Size="11" ss:Color="#000000"/>
</Style>
<Style ss:ID="m2113688147392">
<Alignment ss:Horizontal="Left" ss:Vertical="Center"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
</Borders>
<Font ss:FontName="宋体" x:CharSet="134" ss:Size="11" ss:Color="#000000"/>
</Style>
<Style ss:ID="s94">
<Alignment ss:Horizontal="Center" ss:Vertical="Center"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
</Borders>
<Interior ss:Color="#AEAAAA" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s95">
<Alignment ss:Horizontal="Center" ss:Vertical="Center"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
</Borders>
</Style>
<Style ss:ID="s96">
<Alignment ss:Horizontal="Right" ss:Vertical="Center"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
</Borders>
</Style>
<Style ss:ID="s97">
<Alignment ss:Horizontal="Right" ss:Vertical="Center"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
</Borders>
<NumberFormat ss:Format="0%"/>
</Style>
<Style ss:ID="s99">
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
</Borders>
</Style>
<Style ss:ID="s100">
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
</Borders>
<NumberFormat ss:Format="0%"/>
</Style>
<Style ss:ID="s120">
<Alignment ss:Horizontal="Left" ss:Vertical="Center"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
</Borders>
<Font ss:FontName="宋体" x:CharSet="134" ss:Size="11" ss:Color="#000000"
ss:Bold="1"/>
</Style>
<Style ss:ID="s121">
<Alignment ss:Horizontal="Center" ss:Vertical="Center"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
</Borders>
<Interior ss:Color="#AEAAAA" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s122">
<Alignment ss:Horizontal="Center" ss:Vertical="Center"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
</Borders>
</Style>
<Style ss:ID="s123">
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
</Borders>
</Style>
<Style ss:ID="s124">
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
<Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
</Borders>
<NumberFormat ss:Format="0%"/>
</Style>
<Style ss:ID="s126">
<Alignment ss:Horizontal="Left" ss:Vertical="Center"/>
<Borders>
<Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
<Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"
ss:Color="#000000"/>
</Borders>
<Font ss:FontName="宋体" x:CharSet="134" ss:Size="11" ss:Color="#000000"
ss:Bold="1"/>
</Style>
</Styles>
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="7" ss:ExpandedRowCount="10000" x:FullColumns="1"
x:FullRows="1" ss:DefaultColumnWidth="48.6"
ss:DefaultRowHeight="19.950000000000003">
<Column ss:AutoFitWidth="0" ss:Width="169.20000000000002"/>
<Column ss:AutoFitWidth="0" ss:Width="63.599999999999994"/>
<Column ss:AutoFitWidth="0" ss:Width="64.8"/>
<Column ss:AutoFitWidth="0" ss:Width="99.6"/>
<Column ss:AutoFitWidth="0" ss:Width="76.8"/>
<Column ss:AutoFitWidth="0" ss:Width="63.599999999999994"/>
<Column ss:AutoFitWidth="0" ss:Width="59.4"/>
<Row ss:AutoFitHeight="0" ss:Height="26.4">
<Cell ss:MergeAcross="6" ss:MergeDown="1" ss:StyleID="m2113688147332"><Data
ss:Type="String">${title!}</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0"/>
<Row ss:AutoFitHeight="0">
<Cell ss:MergeAcross="6" ss:StyleID="s126"><Data ss:Type="String">应用统计 销售总额:¥${appSumStatistics.saleMoney!} 收益总额:¥${appSumStatistics.income!} 浏览总量:${appSumStatistics.scanCounts!}</Data></Cell>
</Row>
<#if appIncomeList??>
<#list appIncomeList as app>
<Row ss:AutoFitHeight="0">
<Cell ss:MergeAcross="6" ss:StyleID="m2113688147372"><Data ss:Type="String">应用名称:${app.appName!} 销售额:¥${app.saleMoney!} 收益额:¥${app.income!} 浏览量:${app.scanCounts!}</Data></Cell>
</Row>
<#if app.itemList??>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s94"><Data ss:Type="String">商品名称</Data></Cell>
<Cell ss:StyleID="s94"><Data ss:Type="String">浏览量</Data></Cell>
<Cell ss:StyleID="s94"><Data ss:Type="String">销售量</Data></Cell>
<Cell ss:StyleID="s94"><Data ss:Type="String">销售总额(¥)</Data></Cell>
<Cell ss:StyleID="s94"><Data ss:Type="String">收益额(¥)</Data></Cell>
</Row>
<#list app.itemList as appProduct>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s95"><Data ss:Type="String">${appProduct.productName!}</Data></Cell>
<Cell ss:StyleID="s96"><Data ss:Type="Number">${appProduct.scanCounts!}</Data></Cell>
<Cell ss:StyleID="s96"><Data ss:Type="Number">${appProduct.saleCounts!}</Data></Cell>
<Cell ss:StyleID="s96"><Data ss:Type="Number">${appProduct.saleMoney!}</Data></Cell>
<Cell ss:StyleID="s96"><Data ss:Type="Number">${appProduct.income!}</Data></Cell>
</Row>
</#list>
</#if>
</#list>
</#if>
<Row ss:AutoFitHeight="0"/>
<Row ss:AutoFitHeight="0"/>
<Row ss:AutoFitHeight="0">
<Cell ss:MergeAcross="6" ss:StyleID="s120"><Data ss:Type="String">商品统计 销售总额:¥${productSumStatistics.saleMoney!} 收益总额:¥${productSumStatistics.income!} 浏览总量:${productSumStatistics.scanCounts!}</Data></Cell>
</Row>
<#if productIncomeList??>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s121"><Data ss:Type="String">商品名称</Data></Cell>
<Cell ss:StyleID="s121"><Data ss:Type="String">浏览量</Data></Cell>
<Cell ss:StyleID="s121"><Data ss:Type="String">销售量</Data></Cell>
<Cell ss:StyleID="s121"><Data ss:Type="String">销售总额(¥)</Data></Cell>
<Cell ss:StyleID="s121"><Data ss:Type="String">收益额(¥)</Data></Cell>
</Row>
<#list productIncomeList as product>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s122"><Data ss:Type="String">${product.productName!}</Data></Cell>
<Cell ss:StyleID="s123"><Data ss:Type="Number">${product.scanCounts!}</Data></Cell>
<Cell ss:StyleID="s123"><Data ss:Type="Number">${product.saleCounts!}</Data></Cell>
<Cell ss:StyleID="s123"><Data ss:Type="Number">${product.saleMoney!}</Data></Cell>
<Cell ss:StyleID="s123"><Data ss:Type="Number">${product.income!}</Data></Cell>
</Row>
</#list>
</#if>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.69930555555555596"
x:Right="0.69930555555555596" x:Top="0.75"/>
</PageSetup>
<Unsynced/>
<Print>
<ValidPrinterInfo/>
<PaperSizeIndex>9</PaperSizeIndex>
<HorizontalResolution>600</HorizontalResolution>
<VerticalResolution>600</VerticalResolution>
</Print>
<Selected/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>12</ActiveRow>
<ActiveCol>16</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
</Workbook>
...@@ -105,21 +105,19 @@ ...@@ -105,21 +105,19 @@
<pcloud-common-web.version>2.1.0-RELEASE</pcloud-common-web.version> <pcloud-common-web.version>2.1.0-RELEASE</pcloud-common-web.version>
<!-- book --> <!-- book -->
<pcloud-facade-book.version>2.1.0-RELEASE</pcloud-facade-book.version> <pcloud-facade-book.version>2.1.0-RELEASE</pcloud-facade-book.version>
<pcloud-service-book.version>2.1.0-RELEASE</pcloud-service-book.version>
<pcloud-facade-usercenter.version>2.1.0-RELEASE</pcloud-facade-usercenter.version> <pcloud-facade-usercenter.version>2.1.0-RELEASE</pcloud-facade-usercenter.version>
<pcloud-facade-channelcenter.version>2.1.0-RELEASE</pcloud-facade-channelcenter.version> <pcloud-facade-channelcenter.version>2.1.0-RELEASE</pcloud-facade-channelcenter.version>
<pcloud-facade-resourcecenter.version>2.1.0-RELEASE</pcloud-facade-resourcecenter.version> <pcloud-facade-resourcecenter.version>2.1.0-RELEASE</pcloud-facade-resourcecenter.version>
<pcloud-facade-analysisengine.version>2.1.0-RELEASE</pcloud-facade-analysisengine.version> <pcloud-facade-analysisengine.version>2.1.0-RELEASE</pcloud-facade-analysisengine.version>
<pcloud-facade-quartz.version>2.1.0-RELEASE</pcloud-facade-quartz.version> <pcloud-facade-quartz.version>2.1.0-RELEASE</pcloud-facade-quartz.version>
<pcloud-facade-appcenter.version>2.1.0-RELEASE</pcloud-facade-appcenter.version> <pcloud-facade-appcenter.version>2.1.0-RELEASE</pcloud-facade-appcenter.version>
<pcloud-facade-settlement.version>2.1.0-RELEASE</pcloud-facade-settlement.version> <pcloud-facade-settlement.version>2.1.0-RELEASE</pcloud-facade-settlement.version>
<pcloud-facade-message.version>2.1.0-RELEASE</pcloud-facade-message.version> <pcloud-facade-message.version>2.1.0-RELEASE</pcloud-facade-message.version>
<pcloud-facade-commoncenter.version>2.1.0-RELEASE</pcloud-facade-commoncenter.version> <pcloud-facade-commoncenter.version>2.1.0-RELEASE</pcloud-facade-commoncenter.version>
<pcloud-facade-comment.version>2.1.0-RELEASE</pcloud-facade-comment.version> <pcloud-facade-comment.version>2.1.0-RELEASE</pcloud-facade-comment.version>
<pcloud-facade-voicemessage.version>2.1.0-RELEASE</pcloud-facade-voicemessage.version> <pcloud-facade-voicemessage.version>2.1.0-RELEASE</pcloud-facade-voicemessage.version>
<pcloud-facade-raystask.version>2.1.0-RELEASE</pcloud-facade-raystask.version> <pcloud-facade-raystask.version>2.1.0-RELEASE</pcloud-facade-raystask.version>
<pcloud-facade-contentcenter.version>2.1.0-SNAPSHOT</pcloud-facade-contentcenter.version> <pcloud-facade-contentcenter.version>2.1.0-RELEASE</pcloud-facade-contentcenter.version>
<pcloud-facade-tradecenter.version>2.1.0-RELEASE</pcloud-facade-tradecenter.version> <pcloud-facade-tradecenter.version>2.1.0-RELEASE</pcloud-facade-tradecenter.version>
<pcloud-facade-readercenter.version>2.1.0-RELEASE</pcloud-facade-readercenter.version> <pcloud-facade-readercenter.version>2.1.0-RELEASE</pcloud-facade-readercenter.version>
<pcloud-facade-labelcenter.version>2.1.0-RELEASE</pcloud-facade-labelcenter.version> <pcloud-facade-labelcenter.version>2.1.0-RELEASE</pcloud-facade-labelcenter.version>
......
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