Commit 0c28f887 by 杨涛

feat/签到打卡

parent 02489a39
...@@ -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;
...@@ -41,7 +37,9 @@ import com.pcloud.book.keywords.vo.GuideVO; ...@@ -41,7 +37,9 @@ import com.pcloud.book.keywords.vo.GuideVO;
import com.pcloud.book.keywords.vo.ReplyMessageVO; import com.pcloud.book.keywords.vo.ReplyMessageVO;
import com.pcloud.book.keywords.vo.SetGuideVO; import com.pcloud.book.keywords.vo.SetGuideVO;
import com.pcloud.book.keywords.vo.UpdateGuideVO; import com.pcloud.book.keywords.vo.UpdateGuideVO;
import com.pcloud.book.util.properties.BookProps; import com.pcloud.book.weixinclock.dao.WeixinClockGroupClassifyDao;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
import com.pcloud.book.weixinclock.entity.WeixinClockGroupClassify;
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
...@@ -421,6 +421,7 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -421,6 +421,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
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;
} }
...@@ -428,9 +429,25 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -428,9 +429,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) {
......
...@@ -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,13 +59,18 @@ public class WxGroupSendTextListener { ...@@ -57,13 +59,18 @@ 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(); BookClockInfoDTO bookClockInfoDTO = bookClockCheck.checkKeywordIsClock(sendTextDTO.getTextContent().trim(), sendTextDTO.getWechatGroupId());
bookKeywordBiz.sendKeywordMessage(sendTextDTO.getTextContent().trim(), sendTextDTO.getWechatGroupId(), wechatUserId, sendTextDTO.getWxId(), sendTextDTO.getIp(), sendTextDTO.getCode()); if (null != bookClockInfoDTO && SendMessageTypeEnum.GROUP.getCode().equals(sendTextDTO.getCode())) {
log.info("[接收用户发送文本消息] 总耗时:{}ms ", System.currentTimeMillis() - l); bookClockKeywordBiz.sendKeywordMessage(bookClockInfoDTO, wechatUserId, sendTextDTO.getWechatGroupId(), sendTextDTO.getWxId(), sendTextDTO.getIp());
} else {
final long l = System.currentTimeMillis();
bookKeywordBiz.sendKeywordMessage(sendTextDTO.getTextContent().trim(), sendTextDTO.getWechatGroupId(), wechatUserId, sendTextDTO.getWxId(), sendTextDTO.getIp(), sendTextDTO.getCode());
log.info("[接收用户发送文本消息] 总耗时:{}ms ", System.currentTimeMillis() - l);
}
} }
//猜谜语 //猜谜语
riddleRecordBiz.riddleProcess(sendTextDTO); riddleRecordBiz.riddleProcess(sendTextDTO);
......
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 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
*/
List<RankDto> listWeixinClockRank(String wxGroupId, String wxUserId);
}
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.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);
}
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);
/**
* 获取的打卡排名(微信群)
* @param wechatGroupId
* @param userWxId
* @return
*/
Integer getMyNewOrder(String wechatGroupId, String userWxId);
}
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.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);
}
}
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) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("wechatGroupId",wechatGroupId);
paramMap.put("userWxId",userWxId);
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);
}
}
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 抽奖应用信息
* @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<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<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 +
", 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;
@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;
}
@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 +
", 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 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")})
@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)
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)
throws BizException, PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
return new ResponseDto<>(weixinClockBiz.listWeixinClockRank(wxGroupId, wxUserId));
}
}
...@@ -427,6 +427,54 @@ ...@@ -427,6 +427,54 @@
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,
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,
......
<?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" />
</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>
</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
)
VALUES (
#{weixinClockId, jdbcType=BIGINT}, #{wxUserId, jdbcType=VARCHAR}, #{bookGroupClassifyId, jdbcType=BIGINT}, #{wxGroupId, jdbcType=VARCHAR},
#{nickname, jdbcType=VARCHAR}, #{headPic, jdbcType=VARCHAR}, #{allClockDay, jdbcType=INTEGER}, NOW(), NOW()
)
</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 > 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,
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}
order by all_clock_day desc, update_time asc
) a
) cm where cm.wx_user_id = #{userWxId}
</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.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
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